diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index 6cf1d5302..a0a7aef5b 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -293,8 +293,8 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) x190_gunFollowXf = qGun.toTransform() * gunXf; SetTransform(x190_gunFollowXf * bobXf.getRotation()); - - CActor::SetTranslation(x190_gunFollowXf.origin + player->GetTransform().rotate(bobXf.origin)); + x190_gunFollowXf.origin = eyePos; + CActor::SetTranslation(eyePos + player->GetTransform().rotate(bobXf.origin)); x190_gunFollowXf.orthonormalize(); } diff --git a/Runtime/Graphics/CBooRenderer.cpp b/Runtime/Graphics/CBooRenderer.cpp index 56f450f86..a8123c96c 100644 --- a/Runtime/Graphics/CBooRenderer.cpp +++ b/Runtime/Graphics/CBooRenderer.cpp @@ -130,7 +130,7 @@ void Buckets::Sort() std::sort(bucket.begin(), bucket.end(), [](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) { //SetupRendererStates(); - CAreaListItem* lastOctreeItem = nullptr; for (CAreaListItem& item : x1c_areaListItems) @@ -880,7 +879,7 @@ void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask) CPVSVisSet* pvs = nullptr; if (xc8_pvs) pvs = &*xc8_pvs; - if (xe0_pvsAreaIdx != item.x10_models.size()) + if (xe0_pvsAreaIdx != item.x18_areaIdx) pvs = nullptr; u32 idx = 0; @@ -921,8 +920,8 @@ void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask) if (!x44_frustumPlanes.aabbFrustumTest(model->x20_aabb)) { - model->x40_25_modelVisible = false; - continue; + //model->x40_25_modelVisible = false; + //continue; } if (x318_25_drawWireframe) diff --git a/Runtime/Graphics/CMetroidModelInstance.hpp b/Runtime/Graphics/CMetroidModelInstance.hpp index bc80eeee0..c8263987a 100644 --- a/Runtime/Graphics/CMetroidModelInstance.hpp +++ b/Runtime/Graphics/CMetroidModelInstance.hpp @@ -23,7 +23,7 @@ class CMetroidModelInstance std::vector m_surfaces; std::unique_ptr m_instance; hecl::HMDLMeta m_hmdlMeta; - std::vector> m_shaders; + std::unordered_map> m_shaders; public: CMetroidModelInstance() = default; CMetroidModelInstance(CMetroidModelInstance&&) = default; diff --git a/Runtime/Graphics/CModel.hpp b/Runtime/Graphics/CModel.hpp index 1c2ac0c28..b47f64d31 100644 --- a/Runtime/Graphics/CModel.hpp +++ b/Runtime/Graphics/CModel.hpp @@ -94,7 +94,7 @@ struct GeometryUniformLayout struct SShader { std::vector> x0_textures; - std::vector> m_shaders; + std::unordered_map> m_shaders; MaterialSet m_matSet; std::experimental::optional m_geomLayout; int m_matSetIdx; @@ -104,7 +104,7 @@ struct SShader std::shared_ptr BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& mat); void BuildShaders(const hecl::HMDLMeta& meta, - std::vector>& shaders); + std::unordered_map>& shaders); void BuildShaders(const hecl::HMDLMeta& meta) { BuildShaders(meta, m_shaders); } }; @@ -134,7 +134,7 @@ private: const MaterialSet* x4_matSet; const GeometryUniformLayout* m_geomLayout; int m_matSetIdx = -1; - const std::vector>* m_pipelines; + const std::unordered_map>* m_pipelines; std::vector> x1c_textures; zeus::CAABox x20_aabb; CBooSurface* x38_firstUnsortedSurface = nullptr; @@ -210,7 +210,7 @@ public: void DisableAllLights(); void RemapMaterialData(SShader& shader); void RemapMaterialData(SShader& shader, - const std::vector>& pipelines); + const std::unordered_map>& pipelines); bool TryLockTextures() const; void UnlockTextures() const; void SyncLoadTextures() const; diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 7ab1573b4..f179fd787 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -502,7 +502,7 @@ void CBooModel::RemapMaterialData(SShader& shader) } void CBooModel::RemapMaterialData(SShader& shader, - const std::vector>& pipelines) + const std::unordered_map>& pipelines) { x4_matSet = &shader.m_matSet; 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, - std::vector>& shaders) + std::unordered_map>& shaders) { shaders.reserve(m_matSet.materials.size()); + int idx = 0; for (const MaterialSet::Material& mat : m_matSet.materials) - shaders.push_back(BuildShader(meta, mat)); + shaders[idx++] = BuildShader(meta, mat); } CModel::CModel(std::unique_ptr&& in, u32 /* dataLen */, IObjectStore* store, CObjectReference* selfRef) diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index 083401d01..3e62ce533 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -1244,7 +1244,7 @@ void CGameArea::FillInStaticGeometry(bool textures) u32 surfCount = hecl::SBig(*reinterpret_cast(secIt->first)); inst.m_surfaces.reserve(surfCount); - inst.m_shaders.resize(matSet.m_matSet.materials.size()); + inst.m_shaders.reserve(surfCount); ++secIt; for (u32 j=0 ; jGetGunNotFiringTime(); diff --git a/amuse b/amuse index 862c618b7..cab740210 160000 --- a/amuse +++ b/amuse @@ -1 +1 @@ -Subproject commit 862c618b7ed689a459dc1240a7d81298082f9d39 +Subproject commit cab740210479ae8f5090ec847dfc4dd76c816dac diff --git a/hecl b/hecl index 6ec84b0a4..8873d5245 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 6ec84b0a45831d673dbd3b3e039a5eb287fd37f3 +Subproject commit 8873d5245636361079db04a5cc031f775b3ca0cf