Changeset 1640 for code/branches
- Timestamp:
- Jul 21, 2008, 8:39:14 PM (16 years ago)
- Location:
- code/branches/gui/src/orxonox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/GraphicsEngine.cc
r1638 r1640 85 85 , renderWindow_(0) 86 86 , levelSceneManager_(0) 87 , levelViewport_(0)87 , viewport_(0) 88 88 { 89 89 RegisterObject(GraphicsEngine); … … 308 308 // The GUI uses its own one to be able to render on top of everything. 309 309 // That explains why the Z order here is only 1 and not 0 (top most) 310 this-> levelViewport_ = this->renderWindow_->addViewport(0, 1);310 this->viewport_ = this->renderWindow_->addViewport(0, 1); 311 311 312 312 return true; -
code/branches/gui/src/orxonox/GraphicsEngine.h
r1638 r1640 68 68 Ogre::SceneManager* getLevelSceneManager() { return levelSceneManager_; } 69 69 70 Ogre::Viewport* get LevelViewport() { return this->levelViewport_; }70 Ogre::Viewport* getViewport() { return this->viewport_; } 71 71 72 72 // several window properties … … 107 107 Ogre::RenderWindow* renderWindow_; //!< the current render window 108 108 Ogre::SceneManager* levelSceneManager_; //!< scene manager of the game 109 Ogre::Viewport* levelViewport_; //!< default full size viewport for the level109 Ogre::Viewport* viewport_; //!< default full size viewport 110 110 111 111 // stats -
code/branches/gui/src/orxonox/Orxonox.cc
r1638 r1640 250 250 ogre_->getWindowWidth(), ogre_->getWindowHeight(), true, true, true); 251 251 KeyBinder* keyBinder = new KeyBinder(); 252 keyBinder->loadBindings(); 252 253 InputManager::createSimpleInputState("game", 20)->setHandler(keyBinder); 253 254 … … 277 278 { 278 279 // show main menu 279 //GraphicsEngine::getSingleton().createNewScene();280 G UIManager::getInstance().showGUI("MainMenu", true);280 GUIManager::getInstance().showGUI("MainMenu", 0); 281 GraphicsEngine::getSingleton().getViewport()->setCamera(GUIManager::getInstance().getCamera()); 281 282 } 282 283 } … … 340 341 341 342 if (success) 343 { 342 344 InputManager::requestEnterState("game"); 345 this->mode_ = mode; 346 } 343 347 344 348 return success; … … 450 454 unsigned long frameCount = 0; 451 455 452 const unsigned long refreshTime = debugRefreshTime_ * 1000000.0f; 456 const unsigned long refreshTime = 50000.0f; 457 //const unsigned long refreshTime = debugRefreshTime_ * 1000000.0f; 453 458 unsigned long refreshStartTime = 0; 454 459 unsigned long tickTime = 0; … … 458 463 unsigned long timeBeforeTickOld = 0; 459 464 unsigned long timeAfterTick = 0; 460 461 int sleepTime = 0;462 465 463 466 // TODO: Update time in seconds every 7 seconds to avoid any overflow (7 secs is very tight) … … 511 514 GraphicsEngine::getSingleton().setAverageFramesPerSecond(avgFPS); 512 515 513 if (avgFPS > 60.0)514 sleepTime++;515 else516 sleepTime--;517 if (sleepTime < 0)518 sleepTime = 0;519 520 516 oldFrameCount = frameCount; 521 517 tickTime = 0; 522 518 refreshStartTime = timeAfterTick; 523 519 } 524 525 // do some sleeping when the frameRate is over 60526 if (sleepTime > 0)527 msleep(sleepTime);528 529 520 530 521 // don't forget to call _fireFrameStarted in ogre to make sure -
code/branches/gui/src/orxonox/gui/GUIManager.cc
r1638 r1640 59 59 60 60 GUIManager::GUIManager() 61 : emptySceneManager_(0)62 ,backgroundSceneManager_(0)63 , emptyCamera_(0)61 //: emptySceneManager_(0) 62 : backgroundSceneManager_(0) 63 //, emptyCamera_(0) 64 64 , backgroundCamera_(0) 65 , viewport_(0)65 //, viewport_(0) 66 66 , renderWindow_(0) 67 67 , guiRenderer_(0) … … 91 91 92 92 // Full screen viewport with Z order = 0 (top most). Don't yet feed a camera (so nothing gets rendered) 93 this->viewport_ = renderWindow_->addViewport(0, 3);94 this->viewport_->setOverlaysEnabled(false);95 this->viewport_->setShadowsEnabled(false);96 this->viewport_->setSkiesEnabled(false);97 this->viewport_->setClearEveryFrame(false);93 //this->viewport_ = renderWindow_->addViewport(0, 3); 94 //this->viewport_->setOverlaysEnabled(false); 95 //this->viewport_->setShadowsEnabled(false); 96 //this->viewport_->setSkiesEnabled(false); 97 //this->viewport_->setClearEveryFrame(false); 98 98 99 99 // Note: No SceneManager specified yet … … 145 145 // But in order to realise that, we also need a SceneManager with an empty scene, 146 146 // because the SceneManager is responsible for the render queue. 147 this->emptySceneManager_ = Ogre::Root::getSingleton()148 .createSceneManager(Ogre::ST_GENERIC, "GUI/EmptySceneManager");147 //this->emptySceneManager_ = Ogre::Root::getSingleton() 148 // .createSceneManager(Ogre::ST_GENERIC, "GUI/EmptySceneManager"); 149 149 150 150 // we also need a camera or we won't see anything at all. 151 151 // The camera settings don't matter at all for an empty scene since the GUI 152 152 // gets rendered on top of the screen rather than into the scene. 153 this->emptyCamera_ = this->emptySceneManager_->createCamera("GUI/EmptyCamera");153 //this->emptyCamera_ = this->emptySceneManager_->createCamera("GUI/EmptyCamera"); 154 154 155 155 // Create another SceneManager that enables to display some 3D … … 171 171 } 172 172 173 void GUIManager::showGUI(const std::string& name, bool showBackground)173 void GUIManager::showGUI(const std::string& name, Ogre::SceneManager* sceneManager)// bool showBackground) 174 174 { 175 175 if (state_ != Uninitialised) … … 181 181 try 182 182 { 183 if ( showBackground)183 if (!sceneManager) 184 184 { 185 185 // currently, only an image is loaded. We could do 3D, see loadBackground. 186 this->viewport_->setClearEveryFrame(true);186 //this->viewport_->setClearEveryFrame(true); 187 187 this->guiRenderer_->setTargetSceneManager(this->backgroundSceneManager_); 188 this->viewport_->setCamera(this->backgroundCamera_);188 //this->viewport_->setCamera(this->backgroundCamera_); 189 189 190 190 lua_pushboolean(this->scriptModule_->getLuaState(), true); … … 193 193 else 194 194 { 195 this->viewport_->setClearEveryFrame(false);196 this->guiRenderer_->setTargetSceneManager( this->emptySceneManager_);197 this->viewport_->setCamera(this->emptyCamera_);195 //this->viewport_->setClearEveryFrame(false); 196 this->guiRenderer_->setTargetSceneManager(sceneManager); 197 //this->viewport_->setCamera(this->emptyCamera_); 198 198 199 199 lua_pushboolean(this->scriptModule_->getLuaState(), false); … … 226 226 if (this->state_ != OnDisplay) 227 227 return; 228 this->viewport_->setCamera(0); 228 //this->viewport_->setCamera(0); 229 this->guiRenderer_->setTargetSceneManager(0); 229 230 this->state_ = Ready; 230 231 InputManager::requestLeaveState("gui"); -
code/branches/gui/src/orxonox/gui/GUIManager.h
r1638 r1640 70 70 bool initialise(); 71 71 void tick(float dt); 72 void showGUI(const std::string& name, bool showBackground); // tolua_export72 void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export 73 73 void _hideGUI(); // tolua_export 74 74 75 Ogre::Camera* getCamera() { return this->backgroundCamera_; } 76 75 77 static GUIManager& getInstance(); // tolua_export 76 static void showGUI_s(const std::string& name, bool showBackground)78 static void showGUI_s(const std::string& name, Ogre::SceneManager* sceneManager)//bool showBackground) 77 79 { 78 getInstance().showGUI(name, s howBackground);80 getInstance().showGUI(name, sceneManager); 79 81 } 80 82 … … 104 106 void loadScenes(); 105 107 106 Ogre::SceneManager* emptySceneManager_;108 //Ogre::SceneManager* emptySceneManager_; 107 109 Ogre::SceneManager* backgroundSceneManager_; 108 Ogre::Camera* emptyCamera_;110 //Ogre::Camera* emptyCamera_; 109 111 Ogre::Camera* backgroundCamera_; 110 Ogre::Viewport* viewport_;112 //Ogre::Viewport* viewport_; 111 113 Ogre::RenderWindow* renderWindow_; 112 114 CEGUI::OgreCEGUIRenderer* guiRenderer_; -
code/branches/gui/src/orxonox/objects/CameraHandler.cc
r1638 r1640 45 45 { 46 46 this->cam_ = GraphicsEngine::getSingleton().getLevelSceneManager()->createCamera("Cam"); 47 GraphicsEngine::getSingleton().get LevelViewport()->setCamera(this->cam_);48 GraphicsEngine::getSingleton().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2);47 GraphicsEngine::getSingleton().getViewport()->setCamera(this->cam_); 48 //GraphicsEngine::getSingleton().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2); 49 49 /*this->activeCamera_ = *ObjectList<Camera>::begin(); 50 50 this->activeCamera_->cam_ = this->cam_;*/
Note: See TracChangeset
for help on using the changeset viewer.