Changeset 1021 for code/trunk/src/orxonox/GraphicsEngine.cc
- Timestamp:
- Apr 10, 2008, 5:03:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/GraphicsEngine.cc
r790 r1021 33 33 34 34 #include <OgreRoot.h> 35 #include <OgreException.h> 35 36 #include <OgreConfigFile.h> 36 37 #include <OgreTextureManager.h> 38 #include <OgreRenderWindow.h> 37 39 40 #include "core/CoreIncludes.h" 38 41 #include "core/Debug.h" 39 42 #include "GraphicsEngine.h" … … 46 49 GraphicsEngine::GraphicsEngine() 47 50 { 51 RegisterObject(GraphicsEngine); 52 //this->bOverwritePath_ = false; 53 this->setConfigValues(); 48 54 // set to standard values 49 55 this->configPath_ = ""; 50 this->dataPath_ = ""; 51 scene_ = NULL; 56 this->root_ = 0; 57 this->scene_ = 0; 58 this->renderWindow_ = 0; 52 59 } 53 60 … … 55 62 GraphicsEngine::~GraphicsEngine() 56 63 { 64 if (!this->root_) 65 delete this->root_; 66 } 67 68 void GraphicsEngine::setConfigValues() 69 { 70 SetConfigValue(dataPath_, dataPath_).description("relative path to media data"); 71 57 72 } 58 73 … … 66 81 root_ = new Root(NULL, configPath_ + "ogre.cfg", configPath_ + "Ogre.log"); 67 82 #endif*/ 68 #if defined(_DEBUG) && defined(WIN32)83 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && defined(_DEBUG) 69 84 std::string plugin_filename = "plugins_d.cfg"; 70 85 #else … … 87 102 } 88 103 89 bool GraphicsEngine::load( )104 bool GraphicsEngine::load(std::string dataPath) 90 105 { 106 // temporary overwrite of dataPath, change ini file for permanent change 107 if( dataPath != "" ) 108 dataPath_ = dataPath; 91 109 loadRessourceLocations(this->dataPath_); 92 110 if (!root_->restoreConfig() && !root_->showConfigDialog()) … … 95 113 } 96 114 97 void GraphicsEngine:: startRender()115 void GraphicsEngine::initialise() 98 116 { 99 root_->initialise(true, "OrxonoxV2");117 this->renderWindow_ = root_->initialise(true, "OrxonoxV2"); 100 118 TextureManager::getSingleton().setDefaultNumMipmaps(5); 119 //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load... 101 120 ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); 102 121 } … … 131 150 } 132 151 152 /** 153 Returns the window handle of the render window. 154 At least the InputHandler uses this to create the OIS::InputManager 155 @return The window handle of the render window 156 */ 157 size_t GraphicsEngine::getWindowHandle() 158 { 159 if (this->renderWindow_) 160 { 161 Ogre::RenderWindow *renderWindow = this->root_->getAutoCreatedWindow(); 162 size_t windowHnd = 0; 163 renderWindow->getCustomAttribute("WINDOW", &windowHnd); 164 return windowHnd; 165 } 166 else 167 return 0; 168 } 169 170 /** 171 Get the width of the current render window 172 @return The width of the current render window 173 */ 174 int GraphicsEngine::getWindowWidth() const 175 { 176 if (this->renderWindow_) 177 { 178 return this->renderWindow_->getWidth(); 179 } 180 else 181 return 0; 182 } 183 184 /** 185 Get the height of the current render window 186 @return The height of the current render window 187 */ 188 int GraphicsEngine::getWindowHeight() const 189 { 190 if (this->renderWindow_) 191 { 192 return this->renderWindow_->getHeight(); 193 } 194 else 195 return 0; 196 } 133 197 134 198 }
Note: See TracChangeset
for help on using the changeset viewer.