Changeset 1244 for code/branches/ogre
- Timestamp:
- May 7, 2008, 9:20:42 AM (17 years ago)
- Location:
- code/branches/ogre/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ogre/src/orxonox/GraphicsEngine.cc
r1243 r1244 70 70 this->renderWindow_ = 0; 71 71 this->setConfigValues(); 72 C OUT(4) << "*** GraphicsEngine:Constructed" << std::endl;72 CCOUT(4) << "Constructed" << std::endl; 73 73 } 74 74 … … 87 87 void GraphicsEngine::destroy() 88 88 { 89 COUT(4) << " *** GraphicsEngine:Destroying objects..." << std::endl;89 COUT(4) << "Destroying objects..." << std::endl; 90 90 Ogre::WindowEventUtilities::removeWindowEventListener(this->renderWindow_, this); 91 91 if (this->root_) … … 101 101 delete Ogre::LogManager::getSingletonPtr(); 102 102 } 103 COUT(4) << " *** GraphicsEngine:Destroying objects done" << std::endl;103 COUT(4) << "Destroying objects done" << std::endl; 104 104 } 105 105 … … 118 118 bool GraphicsEngine::setup(std::string& dataPath) 119 119 { 120 CCOUT(3) << "Setting up..." << std::endl; 120 121 // temporary overwrite of dataPath, change ini file for permanent change 121 122 if (dataPath != "") … … 139 140 else 140 141 logger = Ogre::LogManager::getSingletonPtr(); 141 C OUT(4) << "*** GraphicsEngine:Ogre LogManager created/assigned" << std::endl;142 CCOUT(4) << "Ogre LogManager created/assigned" << std::endl; 142 143 143 144 // create our own log that we can listen to … … 153 154 154 155 // Root will detect that we've already created a Log 155 C OUT(4) << "*** GraphicsEngine:Creating Ogre Root..." << std::endl;156 CCOUT(4) << "Creating Ogre Root..." << std::endl; 156 157 root_ = new Ogre::Root(plugin_filename); 157 C OUT(4) << "*** GraphicsEngine:Creating Ogre Root done" << std::endl;158 CCOUT(4) << "Creating Ogre Root done" << std::endl; 158 159 159 160 // specify where Ogre has to look for resources. This call doesn't parse anything yet! 160 161 declareRessourceLocations(); 161 162 163 CCOUT(3) << "Set up done." << std::endl; 162 164 return true; 163 165 } … … 165 167 void GraphicsEngine::declareRessourceLocations() 166 168 { 169 CCOUT(4) << "Declaring Resources" << std::endl; 167 170 //TODO: Specify layout of data file and maybe use xml-loader 168 171 //TODO: Work with ressource groups (should be generated by a special loader) … … 194 197 bool GraphicsEngine::loadRenderer() 195 198 { 199 CCOUT(4) << "Configuring Renderer" << std::endl; 196 200 if (!root_->restoreConfig() && !root_->showConfigDialog()) 197 201 return false; 198 202 203 CCOUT(4) << "Creating render window" << std::endl; 199 204 this->renderWindow_ = root_->initialise(true, "OrxonoxV2"); 200 205 if (!root_->isInitialised()) 201 return false; 206 { 207 CCOUT(2) << "Error: Creating Ogre root object failed" << std::endl; 208 return false; 209 } 202 210 Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this); 203 211 Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); … … 205 213 } 206 214 207 void GraphicsEngine::initialiseResources() 208 { 215 bool GraphicsEngine::initialiseResources() 216 { 217 CCOUT(4) << "Initialising resources" << std::endl; 209 218 //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load... 210 Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); 219 try 220 { 221 Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); 222 } 223 catch (Ogre::Exception e) 224 { 225 CCOUT(2) << "Error: There was an Error when initialising the resources." << std::endl; 226 CCOUT(2) << "ErrorMessage: " << e.getFullDescription() << std::endl; 227 return false; 228 } 229 return true; 211 230 } 212 231 … … 216 235 bool GraphicsEngine::createNewScene() 217 236 { 237 CCOUT(4) << "Creating new SceneManager" << std::endl; 218 238 if (scene_) 219 return false; 239 { 240 CCOUT(2) << "SceneManager already exists! Skipping." << std::endl; 241 return false; 242 } 220 243 scene_ = root_->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager"); 221 C OUT(3) << "Info:Created SceneManager: " << scene_ << std::endl;244 CCOUT(3) << "Created SceneManager: " << scene_ << std::endl; 222 245 return true; 223 246 } -
code/branches/ogre/src/orxonox/GraphicsEngine.h
r1243 r1244 59 59 void declareRessourceLocations(); 60 60 bool loadRenderer(); 61 voidinitialiseResources();61 bool initialiseResources(); 62 62 bool createNewScene(); 63 63 -
code/branches/ogre/src/orxonox/Orxonox.cc
r1243 r1244 37 37 38 38 //****** STD ******* 39 //#include <iostream>40 //#include <exception>41 39 #include <deque> 42 40 43 41 //****** OGRE ****** 44 //#include <OgreException.h>45 42 #include <OgreFrameListener.h> 46 43 #include <OgreOverlay.h> … … 159 156 160 157 /** 161 * create a new instance of Orxonox158 * Create a new instance of Orxonox. Avoid doing any actual work here. 162 159 */ 163 160 Orxonox::Orxonox() … … 177 174 178 175 /** 179 * destruct Orxonox176 * Destruct Orxonox. 180 177 */ 181 178 Orxonox::~Orxonox() … … 208 205 209 206 /** 210 * @return singleton object207 * @return singleton reference 211 208 */ 212 209 Orxonox* Orxonox::getSingleton() … … 248 245 return false; 249 246 247 COUT(3) << "*** Orxonox: Mode is " << mode << "." << std::endl; 250 248 if (mode == "client") 251 249 mode_ = CLIENT; … … 260 258 261 259 // for playable server, client and standalone, the startup 262 // procedure until the GUI is theidentical260 // procedure until the GUI is identical 263 261 264 262 TclBind::getInstance().setDataPath(dataPath); … … 284 282 return false; 285 283 286 // Calls the Input Handler which sets up the input devices.284 // Calls the InputManager which sets up the input devices. 287 285 // The render window width and height are used to set up the mouse movement. 288 286 if (!InputManager::initialise(ogre_->getWindowHandle(), … … 290 288 return false; 291 289 292 // TODO: Spread this so that this call onyl initialises things needed for the GUI 293 ogre_->initialiseResources(); 290 // TODO: Spread this so that this call only initialises things needed for the GUI 291 if (!ogre_->initialiseResources()) 292 return false; 294 293 295 294 // TOOD: load the GUI here … … 298 297 // TODO: run GUI here 299 298 300 // The following lines depend very much on the GUI , so they're probably misplaced here..299 // The following lines depend very much on the GUI output, so they're probably misplaced here.. 301 300 302 301 InputManager::setInputState(InputManager::IS_NONE); … … 325 324 } 326 325 326 /** 327 * Loads everything in the scene except for the actual objects. 328 * This includes HUD, Console.. 329 */ 327 330 bool Orxonox::loadPlayground() 328 331 { … … 338 341 339 342 // Load the HUD 343 COUT(3) << "*** Orxonox: Loading HUD..." << std::endl; 340 344 Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2"); 341 345 orxonoxHUD_ = new HUD(); … … 344 348 hudOverlay->show(); 345 349 350 COUT(3) << "*** Orxonox: Loading Console..." << std::endl; 346 351 InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyHandler("buffer")); 347 352 /* … … 365 370 } 366 371 372 /** 373 * Level loading method for server mode. 374 */ 367 375 bool Orxonox::serverLoad() 368 376 { 369 COUT(2) << " initialising server" << std::endl;377 COUT(2) << "Loading level in server mode" << std::endl; 370 378 371 379 server_g = new network::Server(); … … 379 387 } 380 388 389 /** 390 * Level loading method for client mode. 391 */ 381 392 bool Orxonox::clientLoad() 382 393 { 383 COUT(2) << " initialising client" << std::endl;\394 COUT(2) << "Loading level in client mode" << std::endl;\ 384 395 385 396 if (serverIp_.compare("") == 0) … … 394 405 } 395 406 407 /** 408 * Level loading method for standalone mode. 409 */ 396 410 bool Orxonox::standaloneLoad() 397 411 { 398 COUT(2) << " initialisingstandalone mode" << std::endl;412 COUT(2) << "Loading level in standalone mode" << std::endl; 399 413 400 414 if (!loadScene()) … … 404 418 } 405 419 420 /** 421 * Helper method to load a level. 422 */ 406 423 bool Orxonox::loadScene() 407 424 { … … 447 464 timer_->reset(); 448 465 466 COUT(3) << "*** Orxonox: Starting the main loop." << std::endl; 449 467 while (!bAbort_) 450 468 { … … 534 552 } 535 553 554 /** 555 * Static function that shows the console in game mode. 556 */ 536 557 void Orxonox::activateConsole() 537 558 { 559 // currently, the console shows itself when feeded with input. 538 560 InputManager::setInputState(InputManager::IS_CONSOLE); 539 561 }
Note: See TracChangeset
for help on using the changeset viewer.