Further work on cleaning up SceneView and Camera, in particular moving strereo
support out of Camera and into SceneView. Also enabled the option to set the projection and modelview matrices directly on SceneView thereby removing the dependance on osg::Camrea to control the view of the scene.
This commit is contained in:
@@ -242,17 +242,6 @@ class SG_EXPORT Camera: public osg::Referenced
|
||||
* equivalent to using gluLookAt.*/
|
||||
const Matrix& getModelViewMatrix() const;
|
||||
|
||||
|
||||
/** Switch on/off the use of the near and far clipping plane which creating the
|
||||
* getClippingVolume(), uses the camera _zfar value for the position
|
||||
* of the far clipping plane. By default this value is off.*/
|
||||
void setUseNearAndFarClippingPlanes(const bool use);
|
||||
/** Get whether the ClippingVolume uses a near and far clipping planes.*/
|
||||
const bool getUseNearAndFarClippingPlanes() const { return _useNearAndFarClippingPlanes; }
|
||||
|
||||
/** get the view frustum clipping in model coordinates */
|
||||
const ClippingVolume& getClippingVolume() const;
|
||||
|
||||
|
||||
/** Map object coordinates into windows coordinates.
|
||||
* Equivalent to gluProject(...). */
|
||||
@@ -297,15 +286,6 @@ class SG_EXPORT Camera: public osg::Referenced
|
||||
/** Get the physical distance between the viewers eyes and the display system.*/
|
||||
const float getScreenDistance() const { return _screenDistance; }
|
||||
|
||||
/** Convinience method for adjusting the project and model view to account for
|
||||
* and eye offset, as used in stereo work, assumes that the users will use
|
||||
* a seperate camera for each eye, adjustEyePointForStereo(..) being used to
|
||||
* specialize the camera for each eye view.*/
|
||||
void adjustEyeOffsetForStereo(const osg::Vec3& offset);
|
||||
|
||||
|
||||
/** Set up the OpenGL projection and model view matrices.*/
|
||||
virtual void apply(State& state);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -352,11 +332,8 @@ class SG_EXPORT Camera: public osg::Referenced
|
||||
mutable ref_ptr<Matrix> _mp;
|
||||
mutable ref_ptr<Matrix> _inversemp;
|
||||
|
||||
void calculateMatricesAndClippingVolume() const;
|
||||
void computeMatrices() const;
|
||||
|
||||
// used for offsetting camera to ajust for left and right stereo views.
|
||||
bool _useEyeOffset;
|
||||
osg::Vec3 _eyeOffset;
|
||||
float _screenDistance;
|
||||
|
||||
FusionDistanceMode _fusionDistanceMode;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <osg/Vec2>
|
||||
#include <osg/BoundingSphere>
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Camera>
|
||||
#include <osg/ImpostorSprite>
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/TexEnv>
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include <osg/Matrix>
|
||||
|
||||
#include <osg/FrameStamp>
|
||||
#include <osg/Camera>
|
||||
#include <osg/DisplaySettings>
|
||||
#include <osg/ClippingVolume>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
@@ -115,14 +115,22 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
osg::State* getState() { return _state.get(); }
|
||||
const osg::State* getState() const { return _state.get(); }
|
||||
|
||||
|
||||
/** set an osg::Camera for the scene view to use for setting projection and modelview matrices internaly.
|
||||
* However, the projection matrix from the camera will be overriden by a projection matrix which is set explicitly
|
||||
* via setProjectionMatrix(..), see below.
|
||||
* Also, the model matrix from the camera will be overriden by a modelview matrix which is set explicitly
|
||||
* via setModelViewMatrix(..), see below.*/
|
||||
void setCamera(osg::Camera* camera) { _camera = camera; }
|
||||
osg::Camera* getCamera() { return _camera.get(); }
|
||||
const osg::Camera* getCamera() const { return _camera.get(); }
|
||||
|
||||
/** set an projection matrix. Note, this will override a camera's projection matrix if it is not NULL.*/
|
||||
void setProjectionMatrix(osg::Matrix* matrix) { _projectionMatrix = matrix; }
|
||||
osg::Matrix* getProjectionMatrix() { return _projectionMatrix.get(); }
|
||||
const osg::Matrix* getProjectionMatrix() const { return _projectionMatrix.get(); }
|
||||
|
||||
/** set an modelview matrix. Note, this will override a camera's modelview matrix if it is not NULL.*/
|
||||
void setModelViewMatrix(osg::Matrix* matrix) { _modelviewMatrix = matrix; }
|
||||
osg::Matrix* getModelViewMatrix() { return _modelviewMatrix.get(); }
|
||||
const osg::Matrix* getModelViewMatrix() const { return _modelviewMatrix.get(); }
|
||||
@@ -237,7 +245,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
virtual ~SceneView();
|
||||
|
||||
/** Do cull traversal of attached scene graph using Cull NodeVisitor.*/
|
||||
virtual void cullStage(osg::Camera* camera,osgUtil::CullVisitor* cullVisitor, osgUtil::RenderGraph* rendergraph, osgUtil::RenderStage* renderStage);
|
||||
virtual void cullStage(osg::Matrix* projection,osg::Matrix* modelview,osgUtil::CullVisitor* cullVisitor, osgUtil::RenderGraph* rendergraph, osgUtil::RenderStage* renderStage);
|
||||
virtual void drawStage(osgUtil::RenderStage* renderStage);
|
||||
|
||||
osg::ref_ptr<osg::Node> _sceneData;
|
||||
@@ -258,13 +266,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
osg::ref_ptr<osgUtil::RenderStage> _renderStage;
|
||||
|
||||
osg::Node::NodeMask _cullMaskLeft;
|
||||
osg::ref_ptr<osg::Camera> _cameraLeft;
|
||||
osg::ref_ptr<osgUtil::CullVisitor> _cullVisitorLeft;
|
||||
osg::ref_ptr<osgUtil::RenderGraph> _rendergraphLeft;
|
||||
osg::ref_ptr<osgUtil::RenderStage> _renderStageLeft;
|
||||
|
||||
osg::Node::NodeMask _cullMaskRight;
|
||||
osg::ref_ptr<osg::Camera> _cameraRight;
|
||||
osg::ref_ptr<osgUtil::CullVisitor> _cullVisitorRight;
|
||||
osg::ref_ptr<osgUtil::RenderGraph> _rendergraphRight;
|
||||
osg::ref_ptr<osgUtil::RenderStage> _renderStageRight;
|
||||
|
||||
Reference in New Issue
Block a user