Changeset 2019 for code/branches/objecthierarchy/src/orxonox/tools
- Timestamp:
- Oct 27, 2008, 4:08:51 AM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/orxonox/tools
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/tools/BillboardSet.cc
r1755 r2019 31 31 32 32 #include <sstream> 33 33 #include <cassert> 34 34 #include <OgreSceneManager.h> 35 35 … … 46 46 } 47 47 48 void BillboardSet::setBillboardSet( const std::string& file, int count)48 void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, int count) 49 49 { 50 assert(scenemanager); 51 50 52 std::ostringstream name; 51 53 name << (BillboardSet::billboardSetCounter_s++); 52 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);54 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count); 53 55 this->billboardSet_->createBillboard(Vector3::ZERO); 54 56 this->billboardSet_->setMaterialName(file); 57 58 this->scenemanager_ = scenemanager; 55 59 } 56 60 57 void BillboardSet::setBillboardSet( const std::string& file, const ColourValue& colour, int count)61 void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, int count) 58 62 { 63 assert(scenemanager); 64 59 65 std::ostringstream name; 60 66 name << (BillboardSet::billboardSetCounter_s++); 61 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);67 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count); 62 68 this->billboardSet_->createBillboard(Vector3::ZERO, colour); 63 69 this->billboardSet_->setMaterialName(file); 70 71 this->scenemanager_ = scenemanager; 64 72 } 65 73 66 void BillboardSet::setBillboardSet( const std::string& file, const Vector3& position, int count)74 void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const Vector3& position, int count) 67 75 { 76 assert(scenemanager); 77 68 78 std::ostringstream name; 69 79 name << (BillboardSet::billboardSetCounter_s++); 70 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);80 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count); 71 81 this->billboardSet_->createBillboard(position); 72 82 this->billboardSet_->setMaterialName(file); 83 84 this->scenemanager_ = scenemanager; 73 85 } 74 86 75 void BillboardSet::setBillboardSet( const std::string& file, const ColourValue& colour, const Vector3& position, int count)87 void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, const Vector3& position, int count) 76 88 { 89 assert(scenemanager); 90 77 91 std::ostringstream name; 78 92 name << (BillboardSet::billboardSetCounter_s++); 79 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);93 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count); 80 94 this->billboardSet_->createBillboard(position, colour); 81 95 this->billboardSet_->setMaterialName(file); 96 97 this->scenemanager_ = scenemanager; 82 98 } 83 99 84 100 BillboardSet::~BillboardSet() 85 101 { 86 if (this->billboardSet_ )87 GraphicsEngine::getInstance().getLevelSceneManager()->destroyBillboardSet(this->billboardSet_);102 if (this->billboardSet_ && this->scenemanager_) 103 this->scenemanager_->destroyBillboardSet(this->billboardSet_); 88 104 } 89 105 } -
code/branches/objecthierarchy/src/orxonox/tools/BillboardSet.h
r1602 r2019 44 44 BillboardSet(); 45 45 ~BillboardSet(); 46 void setBillboardSet( const std::string& file, int count = 1);47 void setBillboardSet( const std::string& file, const ColourValue& colour, int count = 1);48 void setBillboardSet( const std::string& file, const Vector3& position, int count = 1);49 void setBillboardSet( const std::string& file, const ColourValue& colour, const Vector3& position, int count = 1);46 void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, int count = 1); 47 void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, int count = 1); 48 void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const Vector3& position, int count = 1); 49 void setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, const Vector3& position, int count = 1); 50 50 51 51 inline Ogre::BillboardSet* getBillboardSet() … … 63 63 static unsigned int billboardSetCounter_s; 64 64 Ogre::BillboardSet* billboardSet_; 65 Ogre::SceneManager* scenemanager_; 65 66 }; 66 67 } -
code/branches/objecthierarchy/src/orxonox/tools/Light.cc
r1755 r2019 31 31 32 32 #include <sstream> 33 #include <cassert> 33 34 34 35 #include <OgreSceneManager.h> … … 45 46 } 46 47 47 void Light::setLight(Ogre:: Light::LightTypes type, const ColourValue& diffuse, const ColourValue& specular)48 void Light::setLight(Ogre::SceneManager* scenemanager, Ogre::Light::LightTypes type, const ColourValue& diffuse, const ColourValue& specular) 48 49 { 50 assert(scenemanager); 51 49 52 std::ostringstream name; 50 53 name << (Light::lightCounter_s++); 51 this->light_ = GraphicsEngine::getInstance().getLevelSceneManager()->createLight("Light" + name.str());54 this->light_ = scenemanager->createLight("Light" + name.str()); 52 55 this->light_->setType(type); 53 56 this->light_->setDiffuseColour(diffuse); 54 57 this->light_->setSpecularColour(specular); 58 59 this->scenemanager_ = scenemanager; 55 60 } 56 61 57 62 Light::~Light() 58 63 { 59 if (this->light_ )60 GraphicsEngine::getInstance().getLevelSceneManager()->destroyLight(this->light_);64 if (this->light_ && this->scenemanager_) 65 this->scenemanager_->destroyLight(this->light_); 61 66 } 62 67 } -
code/branches/objecthierarchy/src/orxonox/tools/Light.h
r1505 r2019 45 45 Light(); 46 46 ~Light(); 47 void setLight(Ogre:: Light::LightTypes type = Ogre::Light::LT_POINT, const ColourValue& diffuse = ColourValue(1.0, 1.0, 1.0), const ColourValue& specular = ColourValue(1.0, 1.0, 1.0));47 void setLight(Ogre::SceneManager* scenemanager, Ogre::Light::LightTypes type = Ogre::Light::LT_POINT, const ColourValue& diffuse = ColourValue(1.0, 1.0, 1.0), const ColourValue& specular = ColourValue(1.0, 1.0, 1.0)); 48 48 49 49 inline Ogre::Light* getLight() … … 56 56 static unsigned int lightCounter_s; 57 57 Ogre::Light* light_; 58 Ogre::SceneManager* scenemanager_; 58 59 }; 59 60 } -
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 -
code/branches/objecthierarchy/src/orxonox/tools/Mesh.h
r2006 r2019 43 43 ~Mesh(); 44 44 45 void setMeshSource( const std::string& file);45 void setMeshSource(Ogre::SceneManager* scenemanager, const std::string& file); 46 46 47 47 inline Ogre::Entity* getEntity() … … 61 61 Ogre::Entity* entity_; 62 62 bool bCastShadows_; 63 Ogre::SceneManager* scenemanager_; 63 64 }; 64 65 } -
code/branches/objecthierarchy/src/orxonox/tools/ParticleInterface.cc
r1755 r2019 37 37 #include <OgreParticleEmitter.h> 38 38 #include <OgreSceneManager.h> 39 #include <cassert> 39 40 40 41 #include "GraphicsEngine.h" … … 47 48 ParticleInterface* ParticleInterface::currentParticleInterface_s = 0; 48 49 49 ParticleInterface::ParticleInterface( const std::string& templateName, LODParticle::LOD detaillevel)50 ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel) 50 51 { 51 52 RegisterRootObject(ParticleInterface); 52 53 54 assert(scenemanager); 55 56 this->scenemanager_ = scenemanager; 53 57 this->sceneNode_ = 0; 54 58 this->bEnabled_ = true; 55 59 this->detaillevel_ = (unsigned int)detaillevel; 56 this->particleSystem_ = GraphicsEngine::getInstance().getLevelSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);60 this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 57 61 //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor()); 58 62 this->particleSystem_->setSpeedFactor(1.0f); … … 72 76 { 73 77 this->particleSystem_->removeAllEmitters(); 74 GraphicsEngine::getInstance().getLevelSceneManager()->destroyParticleSystem(particleSystem_);78 this->scenemanager_->destroyParticleSystem(particleSystem_); 75 79 } 76 80 -
code/branches/objecthierarchy/src/orxonox/tools/ParticleInterface.h
r1563 r2019 48 48 { 49 49 public: 50 ParticleInterface( const std::string& templateName, LODParticle::LOD detaillevel);50 ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel); 51 51 ~ParticleInterface(); 52 52 … … 92 92 bool bEnabled_; 93 93 unsigned int detaillevel_; //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high) 94 Ogre::SceneManager* scenemanager_; 94 95 }; 95 96 }
Note: See TracChangeset
for help on using the changeset viewer.