Changeset 7966 for code/branches/usability/src/orxonox
- Timestamp:
- Feb 26, 2011, 5:00:17 PM (14 years ago)
- Location:
- code/branches/usability/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/usability/src/orxonox/CameraManager.cc
r7879 r7966 29 29 #include "CameraManager.h" 30 30 31 #include <cassert> 32 31 33 #include <OgreSceneManager.h> 32 34 #include <OgreViewport.h> 33 35 #include <OgreCompositorManager.h> 34 36 35 #include "util/StringUtils.h"36 37 #include "util/ScopedSingletonManager.h" 37 38 #include "core/GameMode.h" 38 39 #include "core/GraphicsManager.h" 39 #include "core/GUIManager.h"40 40 #include "core/ObjectList.h" 41 41 #include "tools/Shader.h" 42 42 #include "graphics/Camera.h" 43 #include "Scene.h"44 43 45 44 namespace orxonox … … 48 47 49 48 CameraManager::CameraManager() 50 : viewport_(GraphicsManager::getInstance().getViewport())51 49 { 52 50 assert(GameMode::showsGraphics()); … … 55 53 CameraManager::~CameraManager() 56 54 { 57 GUIManager::getInstance().setCamera(0);58 55 } 59 56 … … 95 92 if (!this->cameraList_.empty()) 96 93 this->cameraList_.front()->setFocus(); 94 else 95 this->useCamera(NULL); 97 96 } 98 97 else … … 102 101 void CameraManager::useCamera(Ogre::Camera* camera) 103 102 { 104 // This workaround is needed to avoid weird behaviour with active compositors while 105 // switching the camera (like freezing the image) 106 // 107 // Last known Ogre version needing this workaround: 108 // 1.4.8 109 // 1.7.2 110 111 // deactivate all compositors 112 { 113 Ogre::ResourceManager::ResourceMapIterator iterator = Ogre::CompositorManager::getSingleton().getResourceIterator(); 114 while (iterator.hasMoreElements()) 115 Ogre::CompositorManager::getSingleton().setCompositorEnabled(this->viewport_, iterator.getNext()->getName(), false); 116 } 117 118 this->viewport_->setCamera(camera); 119 GUIManager::getInstance().setCamera(camera); 120 121 // reactivate all visible compositors 122 { 123 for (ObjectList<Shader>::iterator it = ObjectList<Shader>::begin(); it != ObjectList<Shader>::end(); ++it) 124 it->updateVisibility(); 125 } 103 GraphicsManager::getInstance().setCamera(camera); 126 104 } 127 105 } -
code/branches/usability/src/orxonox/CameraManager.h
r6746 r7966 38 38 #include "OrxonoxPrereqs.h" 39 39 40 #include <cassert>41 40 #include <list> 42 41 #include "util/OgreForwardRefs.h" 43 42 #include "util/Singleton.h" 44 43 #include "core/OrxonoxClass.h" 45 #include "core/SmartPtr.h"46 44 47 45 namespace orxonox … … 65 63 66 64 std::list<Camera*> cameraList_; 67 Ogre::Viewport* viewport_;68 65 69 66 static CameraManager* singletonPtr_s; -
code/branches/usability/src/orxonox/gamestates/GSMainMenu.cc
r7876 r7966 96 96 { 97 97 // show main menu 98 GraphicsManager::getInstance().setCamera(this->camera_); 98 99 GUIManager::getInstance().showGUI("MainMenu", true); 99 GUIManager::getInstance().setCamera(this->camera_);100 100 GUIManager::getInstance().setBackgroundImage("MainMenuBackground", "Background"); 101 GraphicsManager::getInstance().setCamera(this->camera_);102 101 103 102 InputManager::getInstance().enterState("MainMenuHackery"); … … 129 128 InputManager::getInstance().leaveState("MainMenuHackery"); 130 129 131 G UIManager::getInstance().setCamera(0);130 GraphicsManager::getInstance().setCamera(0); 132 131 GUIManager::getInstance().setBackgroundImage(""); 133 132 GUIManager::hideGUI("MainMenu"); 134 GraphicsManager::getInstance().setCamera(0);135 133 136 134 ModifyConsoleCommand(__CC_startStandalone_name).deactivate(); -
code/branches/usability/src/orxonox/graphics/Camera.cc
r7163 r7966 82 82 if (this->isInitialized()) 83 83 { 84 if (GUIManager::getInstance().getCamera() == this->camera_)85 GUIManager::getInstance().setCamera(NULL);86 84 this->releaseFocus(); 87 85
Note: See TracChangeset
for help on using the changeset viewer.