From b598dbb411c6d8b64342adfbda78817427f6326a Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 9 Oct 2022 15:43:43 -0700 Subject: [PATCH] Near match CMetroidModelInstances, regswaps in BoundingBoxFromData Former-commit-id: cf99f3047b95fa6e9a6da31b640257f52a20c994 --- include/WorldFormat/CMetroidModelInstance.hpp | 22 ++++++++++++++----- src/WorldFormat/CMetroidModelInstance.cpp | 18 ++++++++++++--- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/include/WorldFormat/CMetroidModelInstance.hpp b/include/WorldFormat/CMetroidModelInstance.hpp index 8ca3d6ef..3d412911 100644 --- a/include/WorldFormat/CMetroidModelInstance.hpp +++ b/include/WorldFormat/CMetroidModelInstance.hpp @@ -1,18 +1,28 @@ #ifndef _CMETROIDMODELINSTANCE #define _CMETROIDMODELINSTANCE -#include "Kyoto/Math/CTransform4f.hpp" #include "Kyoto/Math/CAABox.hpp" +#include "Kyoto/Math/CTransform4f.hpp" #include "rstl/vector.hpp" class CMetroidModelInstance { public: - CMetroidModelInstance(const void* header, const void* firstGeom, - const void* positions, const void* normals, - const void* colors, const void* uvs, - const void* packedUvs, - const rstl::vector< void* >& surfaces); + CMetroidModelInstance(const void* header, const void* firstGeom, const void* positions, + const void* normals, const void* colors, const void* texCoords, + const void* packedTexCoords, const rstl::vector< void* >& surfaces); + +private: + u32 x0_visorFlags; + CTransform4f x4_worldXf; + CAABox x34_worldAABB; + const void* x4c_materialData; + rstl::vector x50_surfaces; + const void* x60_positions; + const void* x64_normals; + const void* x68_colors; + const void* x6c_texCoords; + const void* x70_packedTexCoords; }; #endif // _CMETROIDMODELINSTANCE diff --git a/src/WorldFormat/CMetroidModelInstance.cpp b/src/WorldFormat/CMetroidModelInstance.cpp index 8a70699f..cc7f4ca8 100644 --- a/src/WorldFormat/CMetroidModelInstance.cpp +++ b/src/WorldFormat/CMetroidModelInstance.cpp @@ -17,6 +17,18 @@ CAABox BoundingBoxFromData(const void* ptr) { return CAABox(minX, minY, minZ, maxX, maxY, maxZ); } -CMetroidModelInstance::CMetroidModelInstance(const void*, const void*, const void*, const void*, - const void*, const void*, const void*, - const rstl::vector< void* >&) {} +CMetroidModelInstance::CMetroidModelInstance(const void* header, const void* firstGeom, + const void* positions, const void* normals, + const void* colors, const void* texCoords, + const void* packedTexCoords, + const rstl::vector< void* >& surfaces) +: x0_visorFlags(*reinterpret_cast< const uint* >(header)) +, x4_worldXf(TransformFromData((uchar*)header + sizeof(uint))) +, x34_worldAABB(BoundingBoxFromData((uchar*)header + sizeof(CTransform4f) + sizeof(uint))) +, x4c_materialData(firstGeom) +, x50_surfaces(surfaces) +, x60_positions(positions) +, x64_normals(normals) +, x68_colors(colors) +, x6c_texCoords(texCoords) +, x70_packedTexCoords(packedTexCoords) {}