Changeset 1993 for code/branches/objecthierarchy/src/orxonox/tools
- Timestamp:
- Oct 22, 2008, 5:25:01 AM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/orxonox/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/tools/Mesh.cc
r1949 r1993 32 32 #include <sstream> 33 33 #include <OgreSceneManager.h> 34 34 35 #include "core/Core.h" 35 36 #include "GraphicsEngine.h" 37 #include "util/Convert.h" 38 #include "util/String.h" 36 39 37 40 namespace orxonox … … 39 42 unsigned int Mesh::meshCounter_s = 0; 40 43 41 Mesh::Mesh() : 42 entity_(0) 44 Mesh::Mesh() 43 45 { 44 } 45 46 void Mesh::setMesh(const std::string& file) 47 { 48 std::ostringstream name; 49 name << (Mesh::meshCounter_s++); 50 if (Core::showsGraphics()) 51 this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + name.str(), file); 46 this->entity_ = 0; 52 47 } 53 48 … … 57 52 GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_); 58 53 } 54 55 void Mesh::setMeshSource(const std::string& meshsource) 56 { 57 if (Core::showsGraphics()) 58 { 59 if (this->entity_) 60 GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_); 61 this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + convertToString(Mesh::meshCounter_s++), meshsource); 62 } 63 } 64 65 const std::string& Mesh::getName() const 66 { 67 if (this->entity_) 68 return this->entity_->getName(); 69 else 70 return blankString; 71 } 72 73 void Mesh::setVisible(bool bVisible) 74 { 75 if (this->entity_) 76 this->entity_->setVisible(bVisible); 77 } 78 79 bool Mesh::isVisible() const 80 { 81 if (this->entity_) 82 return this->entity_->getVisible(); 83 else 84 return false; 85 } 59 86 } -
code/branches/objecthierarchy/src/orxonox/tools/Mesh.h
r1627 r1993 33 33 34 34 #include <string> 35 36 35 #include <OgreEntity.h> 37 36 … … 43 42 Mesh(); 44 43 ~Mesh(); 45 void setMesh(const std::string& file); 44 45 void setMeshSource(const std::string& file); 46 46 47 47 inline Ogre::Entity* getEntity() 48 48 { return this->entity_; } 49 49 50 inline const std::string& getName() const 51 { return this->entity_->getName(); } 50 const std::string& getName() const; 52 51 53 inline void setVisible(bool visible) 54 { if (this->entity_) this->entity_->setVisible(visible); } 55 inline bool getVisible() const 56 { if (this->entity_) return this->entity_->getVisible(); else return false; } 52 void setVisible(bool bVisible); 53 bool isVisible() const; 57 54 58 55 private:
Note: See TracChangeset
for help on using the changeset viewer.