From 635cf7f7c585fad07b2e12bd9d6375bfd48e04fe Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 23 Jan 2004 16:09:56 +0000 Subject: [PATCH] Made getLookAt() etc methods const --- include/osg/Matrixd | 8 ++++---- include/osg/Matrixf | 8 ++++---- src/osg/Matrix_implementation.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/osg/Matrixd b/include/osg/Matrixd index d18925092..5d059826a 100644 --- a/include/osg/Matrixd +++ b/include/osg/Matrixd @@ -128,7 +128,7 @@ class SG_EXPORT Matrixd * Note, if matrix is not an orthographic matrix then invalid values will be returned.*/ bool getOrtho(double& left, double& right, double& bottom, double& top, - double& zNear, double& zFar); + double& zNear, double& zFar) const; /** Set to a 2D orthographic projection. See glOrtho2D for further details.*/ inline void makeOrtho2D(double left, double right, @@ -147,7 +147,7 @@ class SG_EXPORT Matrixd * Note, if matrix is not an perspective matrix then invalid values will be returned.*/ bool getFrustum(double& left, double& right, double& bottom, double& top, - double& zNear, double& zFar); + double& zNear, double& zFar) const; /** Set to a symmetrical perspective projection, See gluPerspective for further details. * Aspect ratio is defined as width/height.*/ @@ -160,13 +160,13 @@ class SG_EXPORT Matrixd * 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); + double& zNear, double& zFar) const; /** 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); /** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */ - void getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance=1.0f); + void getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance=1.0f) const; /** invert the matrix rhs. */ bool invert( const Matrixd& rhs); diff --git a/include/osg/Matrixf b/include/osg/Matrixf index 010e66e20..370b98ede 100644 --- a/include/osg/Matrixf +++ b/include/osg/Matrixf @@ -126,7 +126,7 @@ class SG_EXPORT Matrixf * Note, if matrix is not an orthographic matrix then invalid values will be returned.*/ bool getOrtho(double& left, double& right, double& bottom, double& top, - double& zNear, double& zFar); + double& zNear, double& zFar) const; /** Set to a 2D orthographic projection. See glOrtho2D for further details.*/ inline void makeOrtho2D(double left, double right, @@ -145,7 +145,7 @@ class SG_EXPORT Matrixf * 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); + double& zNear, double& zFar) const; /** Set to a symmetrical perspective projection, See gluPerspective for further details. * Aspect ratio is defined as width/height.*/ @@ -158,14 +158,14 @@ class SG_EXPORT Matrixf * 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); + double& zNear, double& zFar) const; /** 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); /** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */ - void getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance=1.0f); + void getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance=1.0f) const; /** invert the matrix rhs placing result in this matrix.*/ bool invert( const Matrixf& rhs); diff --git a/src/osg/Matrix_implementation.cpp b/src/osg/Matrix_implementation.cpp index 38dc5d75d..4d6c75110 100644 --- a/src/osg/Matrix_implementation.cpp +++ b/src/osg/Matrix_implementation.cpp @@ -608,7 +608,7 @@ void Matrix_implementation::makeOrtho(double left, double right, bool Matrix_implementation::getOrtho(double& left, double& right, double& bottom, double& top, - double& zNear, double& zFar) + double& zNear, double& zFar) const { if (_mat[0][3]!=0.0 || _mat[1][3]!=0.0 || _mat[2][3]!=0.0 || _mat[3][3]!=1.0) return false; @@ -642,7 +642,7 @@ void Matrix_implementation::makeFrustum(double left, double right, bool Matrix_implementation::getFrustum(double& left, double& right, double& bottom, double& top, - double& zNear, double& zFar) + double& zNear, double& zFar) const { if (_mat[0][3]!=0.0 || _mat[1][3]!=0.0 || _mat[2][3]!=-1.0 || _mat[3][3]!=0.0) return false; @@ -673,7 +673,7 @@ void Matrix_implementation::makePerspective(double fovy,double aspectRatio, } bool Matrix_implementation::getPerspective(double& fovy,double& aspectRatio, - double& zNear, double& zFar) + double& zNear, double& zFar) const { double right = 0.0; double left = 0.0; @@ -706,7 +706,7 @@ void Matrix_implementation::makeLookAt(const Vec3& eye,const Vec3& center,const preMult(Matrix_implementation::translate(-eye)); } -void Matrix_implementation::getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance) +void Matrix_implementation::getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance) const { Matrix_implementation inv; inv.invert(*this);