Added setProjectionMatrix*(), setViewMatrix*() and get*() methods to osgUtil::SceneView.
This commit is contained in:
@@ -127,7 +127,7 @@ class SG_EXPORT Matrix
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the frustum setting of a perspective projection matrix.
|
||||
* Note, if matrix is not an orthographic matrix then invalid values will be returned.*/
|
||||
* Note, if matrix is not an perspective matrix then invalid values will be returned.*/
|
||||
void getFrustum(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar);
|
||||
|
||||
@@ -128,8 +128,28 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
const osg::State* getState() const { return _state.get(); }
|
||||
|
||||
|
||||
|
||||
/** Set the projection matrix. Can be thought of as setting the lens of a camera. */
|
||||
void setProjectionMatrix(const osg::Matrix& matrix) { _projectionMatrix = new osg::RefMatrix(matrix); }
|
||||
void setProjectionMatrix(const osg::Matrix& matrix);
|
||||
|
||||
/** Set to a orthographic projection. See OpenGL glOrtho for documentation further details.*/
|
||||
void setProjectionMatrixAsOrtho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Set to a 2D orthographic projection. See OpenGL glOrtho2D documentation for further details.*/
|
||||
void setProjectionMatrixAsOrtho2D(double left, double right,
|
||||
double bottom, double top);
|
||||
|
||||
/** Set to a perspective projection. See OpenGL glFrustum documentation for further details.*/
|
||||
void setProjectionMatrixAsFrustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details.
|
||||
* Aspect ratio is defined as width/height.*/
|
||||
void setProjectionMatrixAsPerspective(double fovy,double aspectRatio,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the projection matrix.*/
|
||||
osg::Matrix& getProjectionMatrix() { return *_projectionMatrix; }
|
||||
@@ -137,8 +157,24 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
/** Get the const projection matrix.*/
|
||||
const osg::Matrix& getProjectionMatrix() const { return *_projectionMatrix; }
|
||||
|
||||
/** Get the othorgraphic settings of the orthographic projection matrix.
|
||||
* Note, if matrix is not an orthographic matrix then invalid values will be returned.*/
|
||||
void getProjectionMatrixAsOrtho(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar);
|
||||
|
||||
/** Get the frustum setting of a perspective projection matrix.
|
||||
* Note, if matrix is not an perspective matrix then invalid values will be returned.*/
|
||||
void getProjectionMatrixAsFrustum(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar);
|
||||
|
||||
/** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */
|
||||
void setViewMatrix(const osg::Matrix& matrix) { _viewMatrix = new osg::RefMatrix(matrix); }
|
||||
void setViewMatrix(const osg::Matrix& matrix);
|
||||
|
||||
/** Set to the position and orientation of view matrix, using the same convention as gluLookAt. */
|
||||
void setViewMatrixAsLookAt(const osg::Vec3& eye,const osg::Vec3& center,const osg::Vec3& up);
|
||||
|
||||
|
||||
/** Get the view matrix. */
|
||||
osg::Matrix& getViewMatrix() { return *_viewMatrix; }
|
||||
@@ -146,6 +182,10 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
|
||||
/** Get the const view matrix. */
|
||||
const osg::Matrix& getViewMatrix() const { return *_viewMatrix; }
|
||||
|
||||
/** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */
|
||||
void getViewMatrixAsLookAt(osg::Vec3& eye,osg::Vec3& center,osg::Vec3& up,float lookDistance=1.0f);
|
||||
|
||||
|
||||
|
||||
void setInitVisitor(osg::NodeVisitor* av) { _initVisitor = av; }
|
||||
osg::NodeVisitor* getInitVisitor() { return _initVisitor.get(); }
|
||||
|
||||
Reference in New Issue
Block a user