Added getPerspective() method to Matrix* and SceneView

This commit is contained in:
Robert Osfield
2003-09-29 13:14:34 +00:00
parent a1d0ebece0
commit 7d69f8e193
6 changed files with 128 additions and 53 deletions

View File

@@ -126,7 +126,7 @@ class SG_EXPORT Matrixd
/** Get the othorgraphic settings of the orthographic projection matrix.
* Note, if matrix is not an orthographic matrix then invalid values will be returned.*/
void getOrtho(double& left, double& right,
bool getOrtho(double& left, double& right,
double& bottom, double& top,
double& zNear, double& zFar);
@@ -145,15 +145,23 @@ class SG_EXPORT Matrixd
/** Get the frustum setting of a perspective projection matrix.
* 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);
bool getFrustum(double& left, double& right,
double& bottom, double& top,
double& zNear, double& zFar);
/** Set to a symmetrical perspective projection, See gluPerspective for further details.
* Aspect ratio is defined as width/height.*/
void makePerspective(double fovy,double aspectRatio,
double zNear, double zFar);
/** Get the frustum setting of a symetric perspective projection matrix.
* Returns false if matrix is not a perspective matrix, where parameter values are undefined.
* Note, if matrix is not a symetric perspective matrix then the shear will be lost.
* Asymetric metrices occur when stereo, power walls, caves and reality center display are used.
* In these configuration one should use the AsFrustum method instead.*/
bool getPerspective(double& fovy,double& aspectRatio,
double& zNear, double& zFar);
/** Set to the position and orientation modelview matrix, using the same convention as gluLookAt. */
void makeLookAt(const Vec3& eye,const Vec3& center,const Vec3& up);

View File

@@ -124,7 +124,7 @@ class SG_EXPORT Matrixf
/** Get the othorgraphic settings of the orthographic projection matrix.
* Note, if matrix is not an orthographic matrix then invalid values will be returned.*/
void getOrtho(double& left, double& right,
bool getOrtho(double& left, double& right,
double& bottom, double& top,
double& zNear, double& zFar);
@@ -142,16 +142,25 @@ class SG_EXPORT Matrixf
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 getFrustum(double& left, double& right,
double& bottom, double& top,
double& zNear, double& zFar);
* Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/
bool getFrustum(double& left, double& right,
double& bottom, double& top,
double& zNear, double& zFar);
/** Set to a symmetrical perspective projection, See gluPerspective for further details.
* Aspect ratio is defined as width/height.*/
void makePerspective(double fovy,double aspectRatio,
double zNear, double zFar);
/** Get the frustum setting of a symetric perspective projection matrix.
* Returns false if matrix is not a perspective matrix, where parameter values are undefined.
* Note, if matrix is not a symetric perspective matrix then the shear will be lost.
* Asymetric metrices occur when stereo, power walls, caves and reality center display are used.
* In these configuration one should use the AsFrustum method instead.*/
bool getPerspective(double& fovy,double& aspectRatio,
double& zNear, double& zFar);
/** Set to the position and orientation modelview matrix, using the same convention as gluLookAt. */
void makeLookAt(const Vec3& eye,const Vec3& center,const Vec3& up);

View File

@@ -158,17 +158,26 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
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,
* Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/
bool 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,
* Returns false if matrix is not a perspective matrix, where parameter values are undefined.*/
bool getProjectionMatrixAsFrustum(double& left, double& right,
double& bottom, double& top,
double& zNear, double& zFar);
/** Get the frustum setting of a symetric perspective projection matrix.
* Returns false if matrix is not a perspective matrix, where parameter values are undefined.
* Note, if matrix is not a symetric perspective matrix then the shear will be lost.
* Asymetric metrices occur when stereo, power walls, caves and reality center display are used.
* In these configuration one should use the AsFrustum method instead.*/
bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio,
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);