Changeset 1653 for code/branches/gui/src/orxonox/GraphicsEngine.cc
- Timestamp:
- Aug 5, 2008, 9:50:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/GraphicsEngine.cc
r1652 r1653 64 64 namespace orxonox 65 65 { 66 SetConsoleCommand(GraphicsEngine, printScreen, true).setKeybindMode(KeybindMode::OnPress); 67 66 68 GraphicsEngine* GraphicsEngine::singletonRef_s = 0; 67 69 … … 72 74 The only instance of GraphicsEngine. 73 75 */ 74 /*static*/ GraphicsEngine& GraphicsEngine::get Singleton()76 /*static*/ GraphicsEngine& GraphicsEngine::getInstance() 75 77 { 76 78 assert(singletonRef_s); … … 128 130 if (this->root_) 129 131 delete this->root_; 130 this->root_ = 0;131 this->levelSceneManager_ = 0;132 this->renderWindow_ = 0;133 132 134 133 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 … … 154 153 CCOUT(3) << "Setting up..." << std::endl; 155 154 156 // TODO: LogManager doesn't work on linuxplatform. The why is yet unknown.155 // TODO: LogManager doesn't work on oli platform. The why is yet unknown. 157 156 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 158 157 // create a new logManager … … 193 192 root_ = new Ogre::Root(ogrePluginsFile_, ogreConfigFile_, ogreLogFile_); 194 193 195 if (!root_->getInstalledPlugins().size()) 196 { 197 ThrowException(PluginsNotFound, "No Ogre plugins declared. Cannot load Ogre."); 198 } 199 200 #if 0 // Ogre 1.4.3 doesn't support setDebugOutputEnabled(.) 201 //#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32 194 // We don't need plugins for the dedicated.. 195 //if (!root_->getInstalledPlugins().size() > 0) 196 //{ 197 // ThrowException(PluginsNotFound, "No Ogre plugins declared. Cannot load Ogre."); 198 //} 199 200 #if 0 // Ogre 1.4.3 doesn't yet support setDebugOutputEnabled(.) 201 #if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32 202 202 // tame the ogre ouput so we don't get all the mess in the console 203 203 Ogre::Log* defaultLog = Ogre::LogManager::getSingleton().getDefaultLog(); … … 206 206 defaultLog->addListener(this); 207 207 #endif 208 #endif 208 209 209 210 CCOUT(4) << "Creating Ogre Root done" << std::endl; … … 233 234 cf.load(Settings::getDataPath() + resourceFile_); 234 235 } 235 catch ( Ogre::Exception& ex)236 { 237 COUT(1) << ex.getFullDescription() << std::endl;236 catch (...) 237 { 238 //COUT(1) << ex.getFullDescription() << std::endl; 238 239 COUT(0) << "Have you forgotten to set the data path in orxnox.ini?" << std::endl; 239 240 throw; … … 300 301 } 301 302 302 boolGraphicsEngine::initialiseResources()303 void GraphicsEngine::initialiseResources() 303 304 { 304 305 CCOUT(4) << "Initialising resources" << std::endl; … … 313 314 }*/ 314 315 } 315 catch (Ogre::Exception& e) 316 { 317 CCOUT(2) << "Error: There was an Error when initialising the resources." << std::endl; 318 CCOUT(2) << "ErrorMessage: " << e.getFullDescription() << std::endl; 319 return false; 320 } 321 return true; 316 catch (...) 317 { 318 CCOUT(2) << "Error: There was a serious error when initialising the resources." << std::endl; 319 throw; 320 } 322 321 } 323 322 … … 326 325 Creates the SceneManager 327 326 */ 328 boolGraphicsEngine::createNewScene()327 void GraphicsEngine::createNewScene() 329 328 { 330 329 CCOUT(4) << "Creating new SceneManager..." << std::endl; … … 332 331 { 333 332 CCOUT(2) << "SceneManager already exists! Skipping." << std::endl; 334 return false;335 333 } 336 334 this->levelSceneManager_ = this->root_->createSceneManager(Ogre::ST_GENERIC, "LevelSceneManager"); 337 CCOUT(3) << "Created SceneManager: " << levelSceneManager_ << std::endl; 338 return true; 335 CCOUT(3) << "Created SceneManager: " << levelSceneManager_->getName() << std::endl; 339 336 } 340 337 … … 487 484 } 488 485 486 487 /*static*/ void GraphicsEngine::printScreen() 488 { 489 if (getInstance().renderWindow_) 490 { 491 getInstance().renderWindow_->writeContentsToTimestampedFile("shot_", ".jpg"); 492 } 493 } 489 494 }
Note: See TracChangeset
for help on using the changeset viewer.