Beginings of support for quad bufferd, red/green, and slit screen stereo.
This commit is contained in:
@@ -25,6 +25,8 @@ class SG_EXPORT Camera: public osg::Referenced
|
||||
public:
|
||||
|
||||
Camera();
|
||||
Camera(const Camera&);
|
||||
Camera& operator=(const Camera&);
|
||||
virtual ~Camera();
|
||||
|
||||
/** Range of projection types.
|
||||
@@ -254,11 +256,15 @@ class SG_EXPORT Camera: public osg::Referenced
|
||||
const bool unproject(const Vec3& win,const Viewport& viewport,Vec3& obj) const;
|
||||
|
||||
|
||||
/** 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,float screenDistance);
|
||||
|
||||
protected:
|
||||
|
||||
// Disallow copy construction & assignment (for now)
|
||||
Camera(const Camera&);
|
||||
Camera& operator=(const Camera&);
|
||||
|
||||
void copy(const Camera&);
|
||||
|
||||
// projection details.
|
||||
ProjectionType _projectionType;
|
||||
@@ -306,7 +312,10 @@ class SG_EXPORT Camera: public osg::Referenced
|
||||
|
||||
void calculateMatricesAndClippingVolume() const;
|
||||
|
||||
|
||||
// values to offset
|
||||
bool _useEyeOffset;
|
||||
osg::Vec3 _eyeOffset;
|
||||
float _screenDistance;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define OSGUTIL_RENDERSTAGE 1
|
||||
|
||||
#include <osg/Camera>
|
||||
#include <osg/ColorMask>
|
||||
|
||||
#include <osgUtil/RenderBin>
|
||||
#include <osgUtil/RenderStageLighting>
|
||||
@@ -53,6 +54,11 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
const GLbitfield getClearMask() const { return _clearMask; }
|
||||
|
||||
|
||||
void setColorMask(osg::ColorMask* cm) { _colorMask = cm; }
|
||||
osg::ColorMask* getColorMask() { return _colorMask.get(); }
|
||||
const osg::ColorMask* getColorMask() const { return _colorMask.get(); }
|
||||
|
||||
|
||||
/** Set the clear color used in glClearColor(..).
|
||||
* glClearColor is only called if mask & GL_COLOR_BUFFER_BIT is true*/
|
||||
void setClearColor(const osg::Vec4& color) { _clearColor=color; }
|
||||
@@ -131,6 +137,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
osg::ref_ptr<osg::Viewport> _viewport;
|
||||
|
||||
GLbitfield _clearMask;
|
||||
osg::ref_ptr<osg::ColorMask> _colorMask;
|
||||
osg::Vec4 _clearColor;
|
||||
osg::Vec4 _clearAccum;
|
||||
double _clearDepth;
|
||||
|
||||
@@ -101,14 +101,32 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
osg::Light* getLight() { return _light.get(); }
|
||||
const osg::Light* getLight() const { return _light.get(); }
|
||||
|
||||
void setCamera(osg::Camera* camera) { _camera = camera; }
|
||||
osg::Camera* getCamera() { return _camera.get(); }
|
||||
const osg::Camera* getCamera() const { return _camera.get(); }
|
||||
|
||||
void setState(osg::State* state) { _state = state; }
|
||||
osg::State* getState() { return _state.get(); }
|
||||
const osg::State* getState() const { return _state.get(); }
|
||||
|
||||
enum StereoMode
|
||||
{
|
||||
MONO,
|
||||
QUAD_BUFFER_STEREO,
|
||||
RED_GREEN_STEREO,
|
||||
HORIZONTAL_SPLIT_STEREO,
|
||||
VERTICAL_SPLIT_STEREO
|
||||
};
|
||||
|
||||
void setStereoMode(const StereoMode mode) { _stereoMode = mode; }
|
||||
const StereoMode getStereoMode() const { return _stereoMode; }
|
||||
|
||||
void setLeftEyeOffset(const osg::Vec3& pos) { _leftEye = pos; }
|
||||
void setRightEyeOffset(const osg::Vec3& pos) { _rightEye = pos; }
|
||||
|
||||
void setFocalLength(float length) { _focalLength = length; }
|
||||
void setScreenDistance(float distance) { _screenDistance = distance; }
|
||||
|
||||
void setCamera(osg::Camera* camera) { _camera = camera; }
|
||||
osg::Camera* getCamera() { return _camera.get(); }
|
||||
const osg::Camera* getCamera() const { return _camera.get(); }
|
||||
|
||||
|
||||
void setInitVisitor(osg::NodeVisitor* av) { _initVisitor = av; }
|
||||
osg::NodeVisitor* getInitVisitor() { return _initVisitor.get(); }
|
||||
@@ -212,6 +230,14 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
osg::ref_ptr<osg::Light> _light;
|
||||
osg::ref_ptr<osg::Camera> _camera;
|
||||
osg::ref_ptr<osg::State> _state;
|
||||
|
||||
StereoMode _stereoMode;
|
||||
|
||||
osg::Vec3 _leftEye;
|
||||
osg::Vec3 _rightEye;
|
||||
|
||||
float _focalLength;
|
||||
float _screenDistance;
|
||||
|
||||
bool _initCalled;
|
||||
osg::ref_ptr<osg::NodeVisitor> _initVisitor;
|
||||
|
||||
Reference in New Issue
Block a user