mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-06 10:25:53 +00:00
Initial area rendering (needs frustum culling fixes)
This commit is contained in:
parent
cff5198e6b
commit
f579007dc1
@ -293,8 +293,8 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||||||
|
|
||||||
x190_gunFollowXf = qGun.toTransform() * gunXf;
|
x190_gunFollowXf = qGun.toTransform() * gunXf;
|
||||||
SetTransform(x190_gunFollowXf * bobXf.getRotation());
|
SetTransform(x190_gunFollowXf * bobXf.getRotation());
|
||||||
|
x190_gunFollowXf.origin = eyePos;
|
||||||
CActor::SetTranslation(x190_gunFollowXf.origin + player->GetTransform().rotate(bobXf.origin));
|
CActor::SetTranslation(eyePos + player->GetTransform().rotate(bobXf.origin));
|
||||||
x190_gunFollowXf.orthonormalize();
|
x190_gunFollowXf.orthonormalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ void Buckets::Sort()
|
|||||||
std::sort(bucket.begin(), bucket.end(),
|
std::sort(bucket.begin(), bucket.end(),
|
||||||
[](CDrawable* a, CDrawable* b) -> bool
|
[](CDrawable* a, CDrawable* b) -> bool
|
||||||
{
|
{
|
||||||
return a->GetDistance() >= b->GetDistance();
|
return a->GetDistance() > b->GetDistance();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -866,7 +866,6 @@ void CBooRenderer::DrawAreaGeometry(int areaIdx, int mask, int targetMask)
|
|||||||
void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask)
|
void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask)
|
||||||
{
|
{
|
||||||
//SetupRendererStates();
|
//SetupRendererStates();
|
||||||
|
|
||||||
CAreaListItem* lastOctreeItem = nullptr;
|
CAreaListItem* lastOctreeItem = nullptr;
|
||||||
|
|
||||||
for (CAreaListItem& item : x1c_areaListItems)
|
for (CAreaListItem& item : x1c_areaListItems)
|
||||||
@ -880,7 +879,7 @@ void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask)
|
|||||||
CPVSVisSet* pvs = nullptr;
|
CPVSVisSet* pvs = nullptr;
|
||||||
if (xc8_pvs)
|
if (xc8_pvs)
|
||||||
pvs = &*xc8_pvs;
|
pvs = &*xc8_pvs;
|
||||||
if (xe0_pvsAreaIdx != item.x10_models.size())
|
if (xe0_pvsAreaIdx != item.x18_areaIdx)
|
||||||
pvs = nullptr;
|
pvs = nullptr;
|
||||||
|
|
||||||
u32 idx = 0;
|
u32 idx = 0;
|
||||||
@ -921,8 +920,8 @@ void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask)
|
|||||||
|
|
||||||
if (!x44_frustumPlanes.aabbFrustumTest(model->x20_aabb))
|
if (!x44_frustumPlanes.aabbFrustumTest(model->x20_aabb))
|
||||||
{
|
{
|
||||||
model->x40_25_modelVisible = false;
|
//model->x40_25_modelVisible = false;
|
||||||
continue;
|
//continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x318_25_drawWireframe)
|
if (x318_25_drawWireframe)
|
||||||
|
@ -23,7 +23,7 @@ class CMetroidModelInstance
|
|||||||
std::vector<CBooSurface> m_surfaces;
|
std::vector<CBooSurface> m_surfaces;
|
||||||
std::unique_ptr<CBooModel> m_instance;
|
std::unique_ptr<CBooModel> m_instance;
|
||||||
hecl::HMDLMeta m_hmdlMeta;
|
hecl::HMDLMeta m_hmdlMeta;
|
||||||
std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>> m_shaders;
|
std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>> m_shaders;
|
||||||
public:
|
public:
|
||||||
CMetroidModelInstance() = default;
|
CMetroidModelInstance() = default;
|
||||||
CMetroidModelInstance(CMetroidModelInstance&&) = default;
|
CMetroidModelInstance(CMetroidModelInstance&&) = default;
|
||||||
|
@ -94,7 +94,7 @@ struct GeometryUniformLayout
|
|||||||
struct SShader
|
struct SShader
|
||||||
{
|
{
|
||||||
std::vector<TCachedToken<CTexture>> x0_textures;
|
std::vector<TCachedToken<CTexture>> x0_textures;
|
||||||
std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>> m_shaders;
|
std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>> m_shaders;
|
||||||
MaterialSet m_matSet;
|
MaterialSet m_matSet;
|
||||||
std::experimental::optional<GeometryUniformLayout> m_geomLayout;
|
std::experimental::optional<GeometryUniformLayout> m_geomLayout;
|
||||||
int m_matSetIdx;
|
int m_matSetIdx;
|
||||||
@ -104,7 +104,7 @@ struct SShader
|
|||||||
std::shared_ptr<hecl::Runtime::ShaderPipelines>
|
std::shared_ptr<hecl::Runtime::ShaderPipelines>
|
||||||
BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& mat);
|
BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& mat);
|
||||||
void BuildShaders(const hecl::HMDLMeta& meta,
|
void BuildShaders(const hecl::HMDLMeta& meta,
|
||||||
std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>>& shaders);
|
std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>>& shaders);
|
||||||
void BuildShaders(const hecl::HMDLMeta& meta) { BuildShaders(meta, m_shaders); }
|
void BuildShaders(const hecl::HMDLMeta& meta) { BuildShaders(meta, m_shaders); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ private:
|
|||||||
const MaterialSet* x4_matSet;
|
const MaterialSet* x4_matSet;
|
||||||
const GeometryUniformLayout* m_geomLayout;
|
const GeometryUniformLayout* m_geomLayout;
|
||||||
int m_matSetIdx = -1;
|
int m_matSetIdx = -1;
|
||||||
const std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>>* m_pipelines;
|
const std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>>* m_pipelines;
|
||||||
std::vector<TCachedToken<CTexture>> x1c_textures;
|
std::vector<TCachedToken<CTexture>> x1c_textures;
|
||||||
zeus::CAABox x20_aabb;
|
zeus::CAABox x20_aabb;
|
||||||
CBooSurface* x38_firstUnsortedSurface = nullptr;
|
CBooSurface* x38_firstUnsortedSurface = nullptr;
|
||||||
@ -210,7 +210,7 @@ public:
|
|||||||
void DisableAllLights();
|
void DisableAllLights();
|
||||||
void RemapMaterialData(SShader& shader);
|
void RemapMaterialData(SShader& shader);
|
||||||
void RemapMaterialData(SShader& shader,
|
void RemapMaterialData(SShader& shader,
|
||||||
const std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>>& pipelines);
|
const std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>>& pipelines);
|
||||||
bool TryLockTextures() const;
|
bool TryLockTextures() const;
|
||||||
void UnlockTextures() const;
|
void UnlockTextures() const;
|
||||||
void SyncLoadTextures() const;
|
void SyncLoadTextures() const;
|
||||||
|
@ -502,7 +502,7 @@ void CBooModel::RemapMaterialData(SShader& shader)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CBooModel::RemapMaterialData(SShader& shader,
|
void CBooModel::RemapMaterialData(SShader& shader,
|
||||||
const std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>>& pipelines)
|
const std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>>& pipelines)
|
||||||
{
|
{
|
||||||
x4_matSet = &shader.m_matSet;
|
x4_matSet = &shader.m_matSet;
|
||||||
m_geomLayout = &*shader.m_geomLayout;
|
m_geomLayout = &*shader.m_geomLayout;
|
||||||
@ -1106,11 +1106,12 @@ SShader::BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& ma
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SShader::BuildShaders(const hecl::HMDLMeta& meta,
|
void SShader::BuildShaders(const hecl::HMDLMeta& meta,
|
||||||
std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>>& shaders)
|
std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>>& shaders)
|
||||||
{
|
{
|
||||||
shaders.reserve(m_matSet.materials.size());
|
shaders.reserve(m_matSet.materials.size());
|
||||||
|
int idx = 0;
|
||||||
for (const MaterialSet::Material& mat : m_matSet.materials)
|
for (const MaterialSet::Material& mat : m_matSet.materials)
|
||||||
shaders.push_back(BuildShader(meta, mat));
|
shaders[idx++] = BuildShader(meta, mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* store, CObjectReference* selfRef)
|
CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* store, CObjectReference* selfRef)
|
||||||
|
@ -1244,7 +1244,7 @@ void CGameArea::FillInStaticGeometry(bool textures)
|
|||||||
|
|
||||||
u32 surfCount = hecl::SBig(*reinterpret_cast<const u32*>(secIt->first));
|
u32 surfCount = hecl::SBig(*reinterpret_cast<const u32*>(secIt->first));
|
||||||
inst.m_surfaces.reserve(surfCount);
|
inst.m_surfaces.reserve(surfCount);
|
||||||
inst.m_shaders.resize(matSet.m_matSet.materials.size());
|
inst.m_shaders.reserve(surfCount);
|
||||||
++secIt;
|
++secIt;
|
||||||
for (u32 j=0 ; j<surfCount ; ++j)
|
for (u32 j=0 ; j<surfCount ; ++j)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,8 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox&
|
|||||||
const CMaterialList& ml)
|
const CMaterialList& ml)
|
||||||
: CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), xf,
|
: CPhysicsActor(uid, true, "CPlayer", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), xf,
|
||||||
MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(), stepUp,
|
MakePlayerAnimRes(resId, playerScale), ml, aabb, SMoverData(mass), CActorParameters::None(), stepUp,
|
||||||
stepDown), x7d0_animRes(resId, 0, playerScale, 0, true), x7d8_beamScale(playerScale)
|
stepDown), x7d0_animRes(resId, 0, playerScale, 0, true), x2d8_fpBounds(aabb),
|
||||||
|
x7d8_beamScale(playerScale)
|
||||||
{
|
{
|
||||||
x490_gun.reset(new CPlayerGun(uid));
|
x490_gun.reset(new CPlayerGun(uid));
|
||||||
x49c_gunHolsterRemTime = g_tweakPlayerGun->GetGunNotFiringTime();
|
x49c_gunHolsterRemTime = g_tweakPlayerGun->GetGunNotFiringTime();
|
||||||
|
2
amuse
2
amuse
@ -1 +1 @@
|
|||||||
Subproject commit 862c618b7ed689a459dc1240a7d81298082f9d39
|
Subproject commit cab740210479ae8f5090ec847dfc4dd76c816dac
|
2
hecl
2
hecl
@ -1 +1 @@
|
|||||||
Subproject commit 6ec84b0a45831d673dbd3b3e039a5eb287fd37f3
|
Subproject commit 8873d5245636361079db04a5cc031f775b3ca0cf
|
Loading…
x
Reference in New Issue
Block a user