feat(model): add CM2Model::FreeExternalResources

This commit is contained in:
fallenoak 2026-01-03 20:35:42 -06:00
parent 6db4041b8d
commit e37f768a8d
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 22 additions and 2 deletions

View File

@ -95,8 +95,7 @@ CM2Model::~CM2Model() {
this->DetachFromScene();
if (this->m_shared) {
// TODO
this->FreeExternalResources();
this->FreeInternalResources();
this->m_shared->Release();
@ -1023,6 +1022,26 @@ void CM2Model::FindKey(M2ModelBoneSeq* sequence, const M2TrackBase& track, uint3
}
}
void CM2Model::FreeExternalResources() {
if (!this->m_loaded) {
return;
}
// TODO
if (this->m_textures) {
for (int32_t i = 0; i < this->m_shared->m_data->textures.Count(); i++) {
auto texture = this->m_textures[i];
if (texture) {
HandleClose(texture);
}
}
}
// TODO
}
void CM2Model::FreeInternalResources() {
if (!this->m_internalResources) {
return;

View File

@ -165,6 +165,7 @@ class CM2Model {
void DetachFromParent();
void DetachFromScene();
void FindKey(M2ModelBoneSeq* sequence, const M2TrackBase& track, uint32_t& currentKey, uint32_t& nextKey, float& ratio);
void FreeExternalResources();
void FreeInternalResources();
C44Matrix GetAttachmentWorldTransform(uint32_t id);
CAaBox& GetBoundingBox(CAaBox& bounds);