diff --git a/model.cpp b/model.cpp index 8d5f46a..0684ba1 100755 --- a/model.cpp +++ b/model.cpp @@ -28,18 +28,7 @@ namespace vb01{ } Model::~Model(){ - vector descendants; - getDescendants(descendants); - - for(Node *node : descendants) - for(Mesh *mesh : node->getMeshes()) - mesh->setMaterial(nullptr); - - while(!children.empty()){ - Node *c = children[children.size() - 1]; - dettachChild(c); - delete c; - } + this->setMaterial(nullptr); } void Model::update(){ diff --git a/node.cpp b/node.cpp index 7b3a5f7..721820e 100755 --- a/node.cpp +++ b/node.cpp @@ -32,8 +32,10 @@ namespace vb01{ for(Mesh *m : meshes) delete m; - for(Light *l : lights) + for(Light *l : lights){ + removeLight(l); delete l; + } for(ParticleEmitter *p : emitters) delete p;