feat(model): set up texture transforms in CM2Model::InitializeLoaded

This commit is contained in:
fallenoak 2025-12-24 21:43:56 -06:00
parent 3c7f163ad6
commit 79b5afdd71
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
3 changed files with 17 additions and 1 deletions

View File

@ -1237,7 +1237,18 @@ int32_t CM2Model::InitializeLoaded() {
} }
} }
// TODO texture transforms if (this->m_shared->m_data->textureTransforms.Count()) {
buffer = ALIGN_BUFFER(buffer, start, M2ModelTextureTransform);
this->m_textureTransforms = reinterpret_cast<M2ModelTextureTransform*>(buffer);
buffer += sizeof(M2ModelTextureTransform) * this->m_shared->m_data->textureTransforms.Count();
for (int32_t i = 0; i < this->m_shared->m_data->textureWeights.Count(); i++) {
new (&this->m_textureTransforms[i]) M2ModelTextureTransform();
}
// TODO use A16 allocator
this->m_textureMatrices = static_cast<C44Matrix*>(SMemAlloc(sizeof(C44Matrix) * this->m_shared->m_data->textureTransforms.Count(), __FILE__, __LINE__, 0x0));
}
if (this->m_shared->m_data->attachments.Count()) { if (this->m_shared->m_data->attachments.Count()) {
buffer = ALIGN_BUFFER(buffer, start, M2ModelAttachment); buffer = ALIGN_BUFFER(buffer, start, M2ModelAttachment);

View File

@ -19,6 +19,7 @@ struct M2ModelBoneSeq;
struct M2ModelCamera; struct M2ModelCamera;
struct M2ModelColor; struct M2ModelColor;
struct M2ModelLight; struct M2ModelLight;
struct M2ModelTextureTransform;
struct M2ModelTextureWeight; struct M2ModelTextureWeight;
struct M2SequenceFallback; struct M2SequenceFallback;
struct M2TrackBase; struct M2TrackBase;
@ -105,6 +106,7 @@ class CM2Model {
uint32_t* m_skinSections = nullptr; uint32_t* m_skinSections = nullptr;
HTEXTURE* m_textures = nullptr; HTEXTURE* m_textures = nullptr;
M2ModelTextureWeight* m_textureWeights = nullptr; M2ModelTextureWeight* m_textureWeights = nullptr;
M2ModelTextureTransform* m_textureTransforms = nullptr;
C44Matrix* m_textureMatrices = nullptr; C44Matrix* m_textureMatrices = nullptr;
C44Matrix matrixB4; C44Matrix matrixB4;
C44Matrix matrixF4; C44Matrix matrixF4;

View File

@ -76,6 +76,9 @@ struct M2ModelLight {
}; };
struct M2ModelTextureTransform { struct M2ModelTextureTransform {
M2ModelTrack<C3Vector> translationTrack;
M2ModelTrack<C4Quaternion> rotationTrack;
M2ModelTrack<C3Vector> scaleTrack;
}; };
struct M2ModelTextureWeight { struct M2ModelTextureWeight {