]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
fix for IMetaMesh modelpath
authorPeter Schaefer <schaeferpm@gmail.com>
Wed, 6 May 2015 15:47:29 +0000 (17:47 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Wed, 6 May 2015 15:47:29 +0000 (17:47 +0200)
fix deleteModel works now

Weave/Game.cpp
Weave/Graphix/Model/IMetaMesh.cpp
Weave/Graphix/Model/Model.cpp

index e1fb972b6065c8f71f4d0bc9dbdf887daee0c3cc..19ec862228e14e028bb86a41a0acfa57cb55d420 100644 (file)
@@ -67,6 +67,8 @@ Game::Game() : playing(true)
        //current_world->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(3.f)), "cow/cow.dae", "model_cow_2D.jpg"));
        current_world->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(.32f)), vec4(3.0f, 0.5f, 0.4f, 1.5f), "duck.dae", "model_duck_2D.png"));
 
+       current_world->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(.32f)), vec4(3.0f, 3.f, 0.4f, 1.5f), "duck.dae", "model_cow_2D.jpg"));
+
        current_world->addObject(new EventBox(translate(vec3(3.f, .4f, 0.f)),EB_LOSTZONE));
        current_world->addObject(new EventBox(translate(vec3(3.f, .4f, -15.f)), EB_WINZONE));
 
index aadddafb2835feb5008f7609b2026640cea66ae5..7bd695878fe6bd3184adaa82735e8da991fddbb8 100644 (file)
@@ -10,7 +10,7 @@
 
 using std::string;
 
-IMetaMesh::IMetaMesh(const string& _modelpath)
+IMetaMesh::IMetaMesh(const string& _modelpath) : modelpath(_modelpath)
 {
        Assimp::Importer importer;
 
index 88db18aedb74bd33d3777d7b20378d326a1c381a..941bc8fbe9d4000de444c5f9229202558a4a8d7d 100644 (file)
@@ -384,11 +384,13 @@ Model* Model::newIMetaModel(const string& _modelpath)
 void Model::deleteBBoxModel()
 {
        delete BoundingBox;
+       BoundingBox = nullptr;
 }
 
 void Model::deleteSkyBoxModel()
 {
        delete SkyBoxModel;
+       SkyBoxModel = nullptr;
 }
 
 
@@ -404,7 +406,12 @@ void Model::deleteIMetaModel(const string& _modelpath)
        --count;
 
        if (!count)
-               delete IMetaModel[_modelpath];
+       {
+               Model*& ptr = IMetaModel[_modelpath];
+               delete ptr;
+               ptr = nullptr;
+       }
+               
 
 }