Changeset 1032 for code/trunk/src/orxonox/GraphicsEngine.cc
- Timestamp:
- Apr 12, 2008, 4:08:29 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/GraphicsEngine.cc
r1024 r1032 22 22 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 23 23 * Co-authors: 24 * ...24 * Reto Grieder 25 25 * 26 26 */ … … 41 41 #include "core/CoreIncludes.h" 42 42 #include "core/Debug.h" 43 43 44 #include "GraphicsEngine.h" 44 45 … … 48 49 using namespace Ogre; 49 50 51 /** 52 @brief Returns the singleton instance and creates it the first time. 53 @return The only instance of GraphicsEngine. 54 */ 55 GraphicsEngine& GraphicsEngine::getSingleton() 56 { 57 static GraphicsEngine theOnlyInstance; 58 return theOnlyInstance; 59 } 60 61 /** 62 @brief Only use constructor to initialise variables and pointers! 63 */ 50 64 GraphicsEngine::GraphicsEngine() 51 65 { … … 58 72 this->scene_ = 0; 59 73 this->renderWindow_ = 0; 60 } 61 62 74 COUT(4) << "*** GraphicsEngine: Constructed" << std::endl; 75 } 76 77 /** 78 @brief Called after main() --> call destroyObjects()! 79 */ 63 80 GraphicsEngine::~GraphicsEngine() 64 81 { 82 this->destroy(); 83 } 84 85 /** 86 @brief Destroys all the internal objects. Call this method when you 87 normally would call the destructor. 88 */ 89 void GraphicsEngine::destroy() 90 { 91 COUT(4) << "*** GraphicsEngine: Destroying objects..." << std::endl; 65 92 if (this->root_) 66 93 delete this->root_; 67 // delete the ogre log and the logManager (sine we have created it). 94 this->root_ = 0; 95 this->scene_ = 0; 96 this->renderWindow_ = 0; 97 // delete the ogre log and the logManager (since we have created it). 68 98 if (LogManager::getSingletonPtr() != 0) 69 99 { … … 72 102 delete LogManager::getSingletonPtr(); 73 103 } 104 COUT(4) << "*** GraphicsEngine: Destroying objects done" << std::endl; 74 105 } 75 106 … … 78 109 SetConfigValue(dataPath_, "../../media/").description("relative path to media data"); 79 110 SetConfigValue(ogreLogfile_, "ogre.log").description("Logfile for messages from Ogre. Use \"\" to suppress log file creation."); 80 SetConfigValue(ogreLogLevelTrivial_ , 5).description(" relative path to media data");81 SetConfigValue(ogreLogLevelNormal_ , 4).description(" relative path to media data");82 SetConfigValue(ogreLogLevelCritical_, 2).description(" relative path to media data");111 SetConfigValue(ogreLogLevelTrivial_ , 5).description("Corresponding orxonox debug level for ogre Trivial"); 112 SetConfigValue(ogreLogLevelNormal_ , 4).description("Corresponding orxonox debug level for ogre Normal"); 113 SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical"); 83 114 } 84 115 … … 107 138 else 108 139 logger = LogManager::getSingletonPtr(); 140 COUT(4) << "*** GraphicsEngine: Ogre LogManager created/assigned" << std::endl; 109 141 110 142 // create our own log that we can listen to … … 114 146 else 115 147 myLog = logger->createLog(this->ogreLogfile_, true, false, false); 148 COUT(4) << "*** GraphicsEngine: Ogre Log created" << std::endl; 116 149 117 150 myLog->setLogDetail(LL_BOREME); … … 119 152 120 153 // Root will detect that we've already created a Log 154 COUT(4) << "*** GraphicsEngine: Creating Ogre Root..." << std::endl; 121 155 root_ = new Root(plugin_filename); 156 COUT(4) << "*** GraphicsEngine: Creating Ogre Root done" << std::endl; 122 157 } 123 158 … … 192 227 if (this->renderWindow_) 193 228 { 194 Ogre::RenderWindow *renderWindow = this->root_->getAutoCreatedWindow();195 229 size_t windowHnd = 0; 196 renderWindow->getCustomAttribute("WINDOW", &windowHnd);230 this->renderWindow_->getCustomAttribute("WINDOW", &windowHnd); 197 231 return windowHnd; 198 232 } … … 208 242 { 209 243 if (this->renderWindow_) 210 {211 244 return this->renderWindow_->getWidth(); 212 }213 245 else 214 246 return 0; … … 222 254 { 223 255 if (this->renderWindow_) 224 {225 256 return this->renderWindow_->getHeight(); 226 }227 257 else 228 258 return 0;
Note: See TracChangeset
for help on using the changeset viewer.