Changeset 1502 for code/trunk/src/orxonox/GraphicsEngine.cc
- Timestamp:
- Jun 1, 2008, 3:54:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/GraphicsEngine.cc
r1349 r1502 45 45 #include "core/Debug.h" 46 46 #include "core/CommandExecutor.h" 47 47 #include "core/TclBind.h" 48 #include "console/InGameConsole.h" 49 50 #include "core/ConsoleCommand.h" 51 #include <OgreSceneManager.h> 52 #include <OgreCompositorManager.h> 53 #include <OgreViewport.h> 48 54 49 55 namespace orxonox { 50 51 56 /** 52 57 @brief Returns the singleton instance and creates it the first time. … … 83 88 SetConfigValue(ogreLogLevelNormal_ , 4).description("Corresponding orxonox debug level for ogre Normal"); 84 89 SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical"); 90 91 TclBind::getInstance().setDataPath(this->dataPath_); 85 92 } 86 93 … … 137 144 #endif 138 145 139 /* // create a logManager 146 // TODO: LogManager doesn't work on specific systems. The why is unknown yet. 147 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 148 // create a logManager 140 149 // note: If there's already a logManager, Ogre will complain by a failed assertation. 141 150 // but that shouldn't happen, since this is the first time to create a logManager.. … … 148 157 myLog = logger->createLog("ogre.log", true, false, true); 149 158 else 150 159 myLog = logger->createLog(this->ogreLogfile_, true, false, false); 151 160 CCOUT(4) << "Ogre Log created" << std::endl; 152 161 153 162 myLog->setLogDetail(Ogre::LL_BOREME); 154 myLog->addListener(this);*/ 163 myLog->addListener(this); 164 #endif 155 165 156 166 // Root will detect that we've already created a Log 157 167 CCOUT(4) << "Creating Ogre Root..." << std::endl; 158 root_ = new Ogre::Root(plugin_filename); 168 169 root_ = new Ogre::Root(plugin_filename, "ogre.cfg", this->ogreLogfile_); 170 171 #if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32 172 // tame the ogre ouput so we don't get all the mess in the console 173 Ogre::Log* defaultLog = Ogre::LogManager::getSingleton().getDefaultLog(); 174 defaultLog->setDebugOutputEnabled(false); 175 defaultLog->setLogDetail(Ogre::LL_BOREME); 176 defaultLog->addListener(this); 177 #endif 178 159 179 CCOUT(4) << "Creating Ogre Root done" << std::endl; 160 180 … … 241 261 bool GraphicsEngine::createNewScene() 242 262 { 243 CCOUT(4) << "Creating new SceneManager " << std::endl;263 CCOUT(4) << "Creating new SceneManager..." << std::endl; 244 264 if (scene_) 245 265 { … … 291 311 else 292 312 return 0; 313 } 314 315 /** 316 @brief Returns the window aspect ratio height/width. 317 @return The ratio 318 */ 319 float GraphicsEngine::getWindowAspectRatio() const 320 { 321 if (this->renderWindow_) 322 return (float)this->renderWindow_->getHeight() / (float)this->renderWindow_->getWidth(); 323 else 324 return 1.0f; 293 325 } 294 326 … … 345 377 int h = rw->getHeight(); 346 378 InputManager::setWindowExtents(w, h); 379 InGameConsole::getInstance().resize(); 347 380 } 348 381 … … 365 398 CommandExecutor::execute("exit", false); 366 399 } 400 401 //HACK!! 402 /*SetConsoleCommandShortcut(GraphicsEngine, CompositorBloomOn).setAccessLevel(AccessLevel::User); 403 SetConsoleCommandShortcut(GraphicsEngine, CompositorMotionBlurOn).setAccessLevel(AccessLevel::User); 404 SetConsoleCommandShortcut(GraphicsEngine, CompositorBloomOff).setAccessLevel(AccessLevel::User); 405 SetConsoleCommandShortcut(GraphicsEngine, CompositorMotionBlurOff).setAccessLevel(AccessLevel::User); 406 void GraphicsEngine::CompositorBloomOn() 407 { 408 Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager(); 409 Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport(); 410 Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "Bloom"); 411 Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Bloom", true); 412 } 413 void GraphicsEngine::CompositorBloomOff() 414 { 415 Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager(); 416 Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport(); 417 Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "Bloom", false); 418 } 419 420 void GraphicsEngine::CompositorMotionBlurOn() 421 { 422 Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager(); 423 Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport(); 424 Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "MotionBlur"); 425 Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "MotionBlur", true); 426 } 427 void GraphicsEngine::CompositorMotionBlurOff() 428 { 429 Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager(); 430 Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport(); 431 Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, "MotionBlur", false); 432 }*/ 367 433 }
Note: See TracChangeset
for help on using the changeset viewer.