mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(model): partially implement CM2Shared dtor
This commit is contained in:
parent
45c632781b
commit
09acc6f421
@ -12,6 +12,12 @@
|
||||
#include "util/SFile.hpp"
|
||||
#include <cstring>
|
||||
|
||||
void CM2Shared::LoadCanceledCallback(CAsyncObject* object) {
|
||||
AsyncFileReadDestroyObject(object);
|
||||
|
||||
// TODO free buffer?
|
||||
}
|
||||
|
||||
void CM2Shared::LoadFailedCallback(void* arg) {
|
||||
CM2Shared* shared = static_cast<CM2Shared*>(arg);
|
||||
|
||||
@ -52,6 +58,40 @@ void CM2Shared::SkinProfileLoadedCallback(void* arg) {
|
||||
shared->asyncObject = nullptr;
|
||||
}
|
||||
|
||||
CM2Shared::~CM2Shared() {
|
||||
// TODO this->CancelAllDeferredSequences();
|
||||
|
||||
bool cancelPending = false;
|
||||
|
||||
if (this->asyncObject) {
|
||||
if (!AsyncFileReadCancel(this->asyncObject, &CM2Shared::LoadCanceledCallback)) {
|
||||
cancelPending = true;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
if (this->textures) {
|
||||
for (int32_t i = 0; i < this->m_data->textures.Count(); i++) {
|
||||
auto texture = this->textures[i];
|
||||
|
||||
if (texture) {
|
||||
HandleClose(texture);
|
||||
}
|
||||
}
|
||||
|
||||
STORM_FREE(this->textures);
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
if (this->m_skinSections) {
|
||||
STORM_FREE(this->m_skinSections);
|
||||
}
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CM2Shared::AddRef() {
|
||||
// TODO free list management etc
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ class SFile;
|
||||
class CM2Shared {
|
||||
public:
|
||||
// Static functions
|
||||
static void LoadCanceledCallback(CAsyncObject* object);
|
||||
static void LoadFailedCallback(void* param);
|
||||
static void LoadSucceededCallback(void* param);
|
||||
static void SkinProfileLoadedCallback(void* param);
|
||||
@ -65,6 +66,7 @@ class CM2Shared {
|
||||
, m_flag20(0)
|
||||
, m_flag40(0)
|
||||
{};
|
||||
~CM2Shared();
|
||||
void AddRef();
|
||||
int32_t CallbackWhenLoaded(CM2Model* model);
|
||||
CShaderEffect* CreateSimpleEffect(uint32_t textureCount, uint16_t shader, uint16_t textureCoordComboIndex);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user