- Timestamp:
- Feb 26, 2011, 5:00:17 PM (14 years ago)
- Location:
- code/branches/usability/src
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/usability/src/libraries/core/CMakeLists.txt
r7284 r7966 35 35 OrxonoxClass.cc 36 36 Resource.cc 37 WindowEventListener.cc38 37 39 38 # hierarchy … … 49 48 Template.cc 50 49 XMLPort.cc 50 51 COMPILATION_BEGIN ListenerCompilation.cc 52 ViewportEventListener.cc 53 WindowEventListener.cc 51 54 XMLNameListener.cc 55 COMPILATION_END 52 56 53 57 COMPILATION_BEGIN FilesystemCompilation.cc -
code/branches/usability/src/libraries/core/CorePrereqs.h
r7849 r7966 182 182 class Thread; 183 183 class ThreadPool; 184 class ViewportEventListener; 184 185 template <class T> 185 186 class WeakPtr; -
code/branches/usability/src/libraries/core/GraphicsManager.cc
r7874 r7966 57 57 #include "Game.h" 58 58 #include "GameMode.h" 59 #include "GUIManager.h" 59 60 #include "Loader.h" 60 61 #include "MemoryArchive.h" 61 62 #include "PathConfig.h" 63 #include "ViewportEventListener.h" 62 64 #include "WindowEventListener.h" 63 65 #include "XMLFile.h" … … 381 383 void GraphicsManager::setCamera(Ogre::Camera* camera) 382 384 { 385 Ogre::Camera* oldCamera = this->viewport_->getCamera(); 386 383 387 this->viewport_->setCamera(camera); 388 GUIManager::getInstance().setCamera(camera); 389 390 for (ObjectList<ViewportEventListener>::iterator it = ObjectList<ViewportEventListener>::begin(); it != ObjectList<ViewportEventListener>::end(); ++it) 391 it->cameraChanged(this->viewport_, oldCamera); 384 392 } 385 393 -
code/branches/usability/src/libraries/tools/Shader.cc
r6417 r7966 56 56 this->bVisible_ = true; 57 57 this->bLoadCompositor_ = GameMode::showsGraphics(); 58 this->bViewportInitialized_ = false;58 this->bViewportInitialized_ = true; 59 59 60 60 if (this->bLoadCompositor_ && Ogre::Root::getSingletonPtr()) … … 89 89 { 90 90 this->scenemanager_ = scenemanager; 91 this->bViewportInitialized_ = false; 92 } 93 91 // this->bViewportInitialized_ = false; 92 } 93 94 void Shader::cameraChanged(Ogre::Viewport* viewport, Ogre::Camera* oldCamera) 95 { 96 if (!this->scenemanager_ || (viewport != this->scenemanager_->getCurrentViewport() && this->scenemanager_->getCurrentViewport() != NULL)) 97 return; 98 99 // update compositor in viewport (shader should only be active if the current camera is in the same scene as the shader) 100 101 // Note: 102 // The shader needs also to be switched off and on after changing the camera in the 103 // same scene to avoid weird behaviour with active compositors while switching the 104 // camera (like freezing the image) 105 // 106 // Last known Ogre version needing this workaround: 107 // 1.4.8 108 // 1.7.2 109 110 111 if (oldCamera && this->scenemanager_ == oldCamera->getSceneManager()) 112 Ogre::CompositorManager::getSingleton().setCompositorEnabled(viewport, this->compositor_, false); 113 114 if (viewport->getCamera() && this->scenemanager_ == viewport->getCamera()->getSceneManager()) 115 Ogre::CompositorManager::getSingleton().setCompositorEnabled(viewport, this->compositor_, this->isVisible()); 116 } 117 /* 94 118 void Shader::tick(float dt) 95 119 { … … 102 126 } 103 127 } 104 128 */ 105 129 void Shader::changedCompositor() 106 130 { … … 119 143 if (!this->compositorInstance_) 120 144 COUT(2) << "Warning: Couldn't load compositor with name \"" << this->compositor_ << "\"." << std::endl; 121 Ogre::CompositorManager::getSingleton().setCompositorEnabled(viewport, this->compositor_, this->bViewportInitialized_ && this->isVisible());145 //Ogre::CompositorManager::getSingleton().setCompositorEnabled(viewport, this->compositor_, this->bViewportInitialized_ && this->isVisible()); 122 146 } 123 147 this->oldcompositor_ = this->compositor_; -
code/branches/usability/src/libraries/tools/Shader.h
r5781 r7966 37 37 38 38 #include "util/OgreForwardRefs.h" 39 #include " tools/interfaces/Tickable.h"39 #include "core/ViewportEventListener.h" 40 40 41 41 namespace orxonox 42 42 { 43 class _ToolsExport Shader : public Tickable43 class _ToolsExport Shader : public ViewportEventListener 44 44 { 45 45 typedef std::pair<bool, void*> ParameterPointer; … … 52 52 Shader(Ogre::SceneManager* scenemanager = 0); 53 53 virtual ~Shader(); 54 55 virtual void tick(float dt);56 54 57 55 inline void setVisible(bool bVisible) … … 83 81 { return this->scenemanager_; } 84 82 83 virtual void cameraChanged(Ogre::Viewport* viewport, Ogre::Camera* oldCamera); 84 85 85 void setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, float value); 86 86 void setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, int value); -
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.