Changeset 2019 for code/branches/objecthierarchy/src/orxonox/tools/Mesh.cc
- Timestamp:
- Oct 27, 2008, 4:08:51 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/tools/Mesh.cc
r2006 r2019 32 32 #include <sstream> 33 33 #include <OgreSceneManager.h> 34 #include <cassert> 34 35 35 36 #include "core/Core.h" … … 50 51 Mesh::~Mesh() 51 52 { 52 if (this->entity_ && Core::showsGraphics())53 GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_);53 if (this->entity_ && this->scenemanager_) 54 this->scenemanager_->destroyEntity(this->entity_); 54 55 } 55 56 56 void Mesh::setMeshSource( const std::string& meshsource)57 void Mesh::setMeshSource(Ogre::SceneManager* scenemanager, const std::string& meshsource) 57 58 { 58 if (Core::showsGraphics()) 59 assert(scenemanager); 60 61 this->scenemanager_ = scenemanager; 62 63 if (this->entity_) 64 this->scenemanager_->destroyEntity(this->entity_); 65 66 try 59 67 { 60 if (this->entity_) 61 GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_); 62 63 try 64 { 65 this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + convertToString(Mesh::meshCounter_s++), meshsource); 66 this->entity_->setCastShadows(this->bCastShadows_); 67 } 68 catch (...) 69 { 70 COUT(1) << "Error: Couln't load mesh \"" << meshsource << "\"" << std::endl; 71 } 68 this->entity_ = this->scenemanager_->createEntity("Mesh" + convertToString(Mesh::meshCounter_s++), meshsource); 69 this->entity_->setCastShadows(this->bCastShadows_); 70 } 71 catch (...) 72 { 73 COUT(1) << "Error: Couln't load mesh \"" << meshsource << "\"" << std::endl; 72 74 } 73 75 } … … 85 87 return this->entity_->getName(); 86 88 else 87 return blankString;89 return BLANKSTRING; 88 90 } 89 91
Note: See TracChangeset
for help on using the changeset viewer.