Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2008, 6:37:31 PM (15 years ago)
Author:
landauf
Message:

fixed shader/camera crash

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  
    3636#include <OgreSceneManager.h>
    3737#include <OgreSceneNode.h>
    38 #include <OgreViewport.h>
    39 #include <OgreCompositorManager.h>
    40 #include <OgreResource.h>
    4138
    4239#include "util/Exception.h"
     
    4441#include "core/ConfigValueIncludes.h"
    4542#include "objects/Scene.h"
    46 #include "tools/Shader.h"
    4743#include "CameraManager.h"
    4844
     
    5450    {
    5551        RegisterObject(Camera);
    56 COUT(0) << this << ": created camera" << std::endl;
     52
    5753        if (!this->getScene() || !this->getScene()->getSceneManager())
    5854            ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given.");
     
    8076            this->getScene()->getSceneManager()->destroyCamera(this->camera_);
    8177        }
    82 COUT(0) << this << ": destroyed camera" << std::endl;
    8378    }
    8479
     
    123118    void Camera::removeFocus()
    124119    {
    125 COUT(0) << this << ": remove focus" << std::endl;
    126120        this->bHasFocus_ = false;
    127121    }
    128122
    129     void Camera::setFocus(Ogre::Viewport* viewport)
     123    void Camera::setFocus()
    130124    {
    131         // This workaround is needed to avoid weird behaviour with active compositors while
    132         // switching the camera (like freezing the image)
    133         //
    134         // Last known Ogre version needing this workaround:
    135         // 1.4.8
    136 
    137         // deactivate all compositors
    138         {
    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 
    144125        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_);
    153127    }
    154128}
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Camera.h

    r2171 r2396  
    6262        private:
    6363            void removeFocus();
    64             void setFocus(Ogre::Viewport* viewport);
     64            void setFocus();
    6565            void configvaluecallback_changedNearClipDistance();
    6666
Note: See TracChangeset for help on using the changeset viewer.