mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(model): implement more of CM2Model dtor
This commit is contained in:
parent
12a7752a57
commit
de3215afc9
@ -94,6 +94,15 @@ CM2Model::~CM2Model() {
|
||||
|
||||
this->DetachFromScene();
|
||||
|
||||
if (this->m_shared) {
|
||||
// TODO
|
||||
|
||||
this->FreeInternalResources();
|
||||
|
||||
this->m_shared->Release();
|
||||
this->m_shared = nullptr;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
this->UnlinkFromAttachList();
|
||||
@ -955,6 +964,65 @@ LABEL_36:
|
||||
}
|
||||
}
|
||||
|
||||
void CM2Model::FreeInternalResources() {
|
||||
if (!this->m_internalResources) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->m_bones) {
|
||||
this->m_bones = nullptr;
|
||||
}
|
||||
|
||||
if (this->m_loops) {
|
||||
this->m_loops = nullptr;
|
||||
}
|
||||
|
||||
if (this->m_skinSections) {
|
||||
this->m_skinSections = nullptr;
|
||||
}
|
||||
|
||||
if (this->m_colors) {
|
||||
this->m_colors = nullptr;
|
||||
}
|
||||
|
||||
if (this->m_textureWeights) {
|
||||
this->m_textureWeights = nullptr;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// if (this->m_textureTransforms) {
|
||||
// this->m_textureTransforms = nullptr;
|
||||
// }
|
||||
|
||||
if (this->m_attachments) {
|
||||
this->m_attachments = nullptr;
|
||||
}
|
||||
|
||||
if (this->m_lights) {
|
||||
for (int32_t i = 0; i < this->m_shared->m_data->lights.Count(); i++) {
|
||||
this->m_lights[i].light.~CM2Light();
|
||||
}
|
||||
|
||||
this->m_lights = nullptr;
|
||||
}
|
||||
|
||||
if (this->m_cameras) {
|
||||
this->m_cameras = nullptr;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// if (this->m_ribbons) {
|
||||
// this->m_ribbons = nullptr;
|
||||
// }
|
||||
|
||||
// TODO
|
||||
// if (this->m_particles) {
|
||||
// this->m_particles = nullptr;
|
||||
// }
|
||||
|
||||
STORM_FREE(this->m_internalResources);
|
||||
}
|
||||
|
||||
C44Matrix CM2Model::GetAttachmentWorldTransform(uint32_t id) {
|
||||
if (!this->m_loaded) {
|
||||
this->WaitForLoad("GetAttachmentWorldTransform");
|
||||
|
||||
@ -96,7 +96,10 @@ class CM2Model {
|
||||
uint32_t uint74 = 0;
|
||||
float float88 = 0.0f;
|
||||
uint32_t uint90 = 0;
|
||||
M2ModelBone* m_bones = nullptr;
|
||||
union {
|
||||
M2ModelBone* m_bones = nullptr;
|
||||
void* m_internalResources;
|
||||
};
|
||||
C44Matrix* m_boneMatrices = nullptr;
|
||||
M2ModelColor* m_colors = nullptr;
|
||||
uint32_t* m_skinSections = nullptr;
|
||||
@ -159,6 +162,7 @@ class CM2Model {
|
||||
void DetachFromParent();
|
||||
void DetachFromScene();
|
||||
void FindKey(M2ModelBoneSeq* sequence, const M2TrackBase& track, uint32_t& currentKey, uint32_t& nextKey, float& ratio);
|
||||
void FreeInternalResources();
|
||||
C44Matrix GetAttachmentWorldTransform(uint32_t id);
|
||||
CAaBox& GetBoundingBox(CAaBox& bounds);
|
||||
HCAMERA GetCameraByIndex(uint32_t index);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user