- Timestamp:
- Oct 27, 2008, 10:56:51 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/objects/Scene.cc
r2019 r2023 31 31 32 32 #include <OgreRoot.h> 33 #include <OgreSceneManager .h>33 #include <OgreSceneManagerEnumerator.h> 34 34 #include <OgreSceneNode.h> 35 35 #include <OgreLight.h> 36 36 37 37 #include "core/CoreIncludes.h" 38 #include "core/Core.h" 38 39 #include "core/XMLPort.h" 39 40 … … 49 50 this->bShadows_ = false; 50 51 51 if ( Ogre::Root::getSingletonPtr())52 if (Core::showsGraphics()) 52 53 { 53 this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); 54 this->rootSceneNode_ = this->sceneManager_->getRootSceneNode(); 54 if (Ogre::Root::getSingletonPtr()) 55 { 56 this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); 57 this->rootSceneNode_ = this->sceneManager_->getRootSceneNode(); 58 } 59 else 60 { 61 this->sceneManager_ = 0; 62 this->rootSceneNode_ = 0; 63 } 55 64 } 56 65 else 57 66 { 58 this->sceneManager_ = 0; 59 this->rootSceneNode_ = 0; 67 // create a dummy SceneManager of our own since we don't have Ogre::Root. 68 this->sceneManager_ = new Ogre::DefaultSceneManager(""); 69 this->rootSceneNode_ = this->sceneManager_->getRootSceneNode(); 60 70 } 61 71 62 72 // test test test 63 if ( this->sceneManager_)73 if (Core::showsGraphics() && this->sceneManager_) 64 74 { 65 75 Ogre::Light* light; … … 80 90 Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_); 81 91 } 82 else 92 else if (!Core::showsGraphics()) 83 93 { 94 delete this->sceneManager_; 84 95 } 85 96 } … … 104 115 void Scene::setSkybox(const std::string& skybox) 105 116 { 106 if ( this->sceneManager_)117 if (Core::showsGraphics() && this->sceneManager_) 107 118 this->sceneManager_->setSkyBox(true, skybox); 108 119 … … 112 123 void Scene::setAmbientLight(const ColourValue& colour) 113 124 { 114 if ( this->sceneManager_)125 if (Core::showsGraphics() && this->sceneManager_) 115 126 this->sceneManager_->setAmbientLight(colour); 116 127 … … 120 131 void Scene::setShadow(bool bShadow) 121 132 { 122 if ( this->sceneManager_)133 if (Core::showsGraphics() && this->sceneManager_) 123 134 { 124 135 if (bShadow)
Note: See TracChangeset
for help on using the changeset viewer.