Changeset 2396 for code/branches/objecthierarchy2/src/orxonox/objects
- Timestamp:
- Dec 10, 2008, 6:37:31 PM (16 years ago)
- Location:
- code/branches/objecthierarchy2/src/orxonox/objects/worldentities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Camera.cc
r2369 r2396 36 36 #include <OgreSceneManager.h> 37 37 #include <OgreSceneNode.h> 38 #include <OgreViewport.h>39 #include <OgreCompositorManager.h>40 #include <OgreResource.h>41 38 42 39 #include "util/Exception.h" … … 44 41 #include "core/ConfigValueIncludes.h" 45 42 #include "objects/Scene.h" 46 #include "tools/Shader.h"47 43 #include "CameraManager.h" 48 44 … … 54 50 { 55 51 RegisterObject(Camera); 56 COUT(0) << this << ": created camera" << std::endl; 52 57 53 if (!this->getScene() || !this->getScene()->getSceneManager()) 58 54 ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given."); … … 80 76 this->getScene()->getSceneManager()->destroyCamera(this->camera_); 81 77 } 82 COUT(0) << this << ": destroyed camera" << std::endl;83 78 } 84 79 … … 123 118 void Camera::removeFocus() 124 119 { 125 COUT(0) << this << ": remove focus" << std::endl;126 120 this->bHasFocus_ = false; 127 121 } 128 122 129 void Camera::setFocus( Ogre::Viewport* viewport)123 void Camera::setFocus() 130 124 { 131 // This workaround is needed to avoid weird behaviour with active compositors while132 // switching the camera (like freezing the image)133 //134 // Last known Ogre version needing this workaround:135 // 1.4.8136 137 // deactivate all compositors138 {139 Ogre::ResourceManager::ResourceMapIterator iterator = Ogre::CompositorManager::getSingleton().getResourceIterator();140 while (iterator.hasMoreElements())141 Ogre::CompositorManager::getSingleton().setCompositorEnabled(viewport, iterator.getNext()->getName(), false);142 }143 144 125 this->bHasFocus_ = true; 145 viewport->setCamera(this->camera_); 146 COUT(0) << this << ": set focus" << std::endl; 147 148 // reactivate all visible compositors 149 { 150 for (ObjectList<Shader>::iterator it = ObjectList<Shader>::begin(); it != ObjectList<Shader>::end(); ++it) 151 it->updateVisibility(); 152 } 126 CameraManager::getInstance().useCamera(this->camera_); 153 127 } 154 128 } -
code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Camera.h
r2171 r2396 62 62 private: 63 63 void removeFocus(); 64 void setFocus( Ogre::Viewport* viewport);64 void setFocus(); 65 65 void configvaluecallback_changedNearClipDistance(); 66 66
Note: See TracChangeset
for help on using the changeset viewer.