From a7e437fc59c5604de27ff09178d7f7d179de11d9 Mon Sep 17 00:00:00 2001 From: Peter Schaefer Date: Wed, 6 May 2015 17:47:29 +0200 Subject: [PATCH] fix for IMetaMesh modelpath fix deleteModel works now --- Weave/Game.cpp | 2 ++ Weave/Graphix/Model/IMetaMesh.cpp | 2 +- Weave/Graphix/Model/Model.cpp | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Weave/Game.cpp b/Weave/Game.cpp index e1fb972..19ec862 100644 --- a/Weave/Game.cpp +++ b/Weave/Game.cpp @@ -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)); diff --git a/Weave/Graphix/Model/IMetaMesh.cpp b/Weave/Graphix/Model/IMetaMesh.cpp index aadddaf..7bd6958 100644 --- a/Weave/Graphix/Model/IMetaMesh.cpp +++ b/Weave/Graphix/Model/IMetaMesh.cpp @@ -10,7 +10,7 @@ using std::string; -IMetaMesh::IMetaMesh(const string& _modelpath) +IMetaMesh::IMetaMesh(const string& _modelpath) : modelpath(_modelpath) { Assimp::Importer importer; diff --git a/Weave/Graphix/Model/Model.cpp b/Weave/Graphix/Model/Model.cpp index 88db18a..941bc8f 100644 --- a/Weave/Graphix/Model/Model.cpp +++ b/Weave/Graphix/Model/Model.cpp @@ -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; + } + } -- 2.47.3