Changeset 7966 for code/branches/usability/src/libraries/tools
- Timestamp:
- Feb 26, 2011, 5:00:17 PM (14 years ago)
- Location:
- code/branches/usability/src/libraries/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note: See TracChangeset
for help on using the changeset viewer.