Near match CMetroidModelInstances, regswaps in BoundingBoxFromData

This commit is contained in:
Phillip Stephens 2022-10-09 15:43:43 -07:00
parent a31407c69c
commit cf99f3047b
2 changed files with 31 additions and 9 deletions

View File

@ -1,18 +1,28 @@
#ifndef _CMETROIDMODELINSTANCE #ifndef _CMETROIDMODELINSTANCE
#define _CMETROIDMODELINSTANCE #define _CMETROIDMODELINSTANCE
#include "Kyoto/Math/CTransform4f.hpp"
#include "Kyoto/Math/CAABox.hpp" #include "Kyoto/Math/CAABox.hpp"
#include "Kyoto/Math/CTransform4f.hpp"
#include "rstl/vector.hpp" #include "rstl/vector.hpp"
class CMetroidModelInstance { class CMetroidModelInstance {
public: public:
CMetroidModelInstance(const void* header, const void* firstGeom, CMetroidModelInstance(const void* header, const void* firstGeom, const void* positions,
const void* positions, const void* normals, const void* normals, const void* colors, const void* texCoords,
const void* colors, const void* uvs, const void* packedTexCoords, const rstl::vector< void* >& surfaces);
const void* packedUvs,
const rstl::vector< void* >& surfaces); private:
u32 x0_visorFlags;
CTransform4f x4_worldXf;
CAABox x34_worldAABB;
const void* x4c_materialData;
rstl::vector<void*> x50_surfaces;
const void* x60_positions;
const void* x64_normals;
const void* x68_colors;
const void* x6c_texCoords;
const void* x70_packedTexCoords;
}; };
#endif // _CMETROIDMODELINSTANCE #endif // _CMETROIDMODELINSTANCE

View File

@ -17,6 +17,18 @@ CAABox BoundingBoxFromData(const void* ptr) {
return CAABox(minX, minY, minZ, maxX, maxY, maxZ); return CAABox(minX, minY, minZ, maxX, maxY, maxZ);
} }
CMetroidModelInstance::CMetroidModelInstance(const void*, const void*, const void*, const void*, CMetroidModelInstance::CMetroidModelInstance(const void* header, const void* firstGeom,
const void*, const void*, const void*, const void* positions, const void* normals,
const rstl::vector< void* >&) {} 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) {}