diff --git a/include/osg/Matrixd b/include/osg/Matrixd index d7e866221..02bedbbd5 100644 --- a/include/osg/Matrixd +++ b/include/osg/Matrixd @@ -110,12 +110,12 @@ class SG_EXPORT Matrixd void makeTranslate( value_type, value_type, value_type ); void makeRotate( const Vec3& from, const Vec3& to ); - void makeRotate( float angle, const Vec3& axis ); - void makeRotate( float angle, float x, float y, float z ); + void makeRotate( value_type angle, const Vec3& axis ); + void makeRotate( value_type angle, value_type x, value_type y, value_type z ); void makeRotate( const Quat& ); - void makeRotate( float angle1, const Vec3& axis1, - float angle2, const Vec3& axis2, - float angle3, const Vec3& axis3); + void makeRotate( value_type angle1, const Vec3& axis1, + value_type angle2, const Vec3& axis2, + value_type angle3, const Vec3& axis3); @@ -166,7 +166,7 @@ class SG_EXPORT Matrixd 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,float lookDistance=1.0f); + void getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance=1.0f); bool invert( const Matrixd& ); @@ -177,11 +177,11 @@ class SG_EXPORT Matrixd inline static Matrixd translate( const Vec3& dv); inline static Matrixd translate( value_type x, value_type y, value_type z); inline static Matrixd rotate( const Vec3& from, const Vec3& to); - inline static Matrixd rotate( float angle, float x, float y, float z); - inline static Matrixd rotate( float angle, const Vec3& axis); - inline static Matrixd rotate( float angle1, const Vec3& axis1, - float angle2, const Vec3& axis2, - float angle3, const Vec3& axis3); + inline static Matrixd rotate( value_type angle, value_type x, value_type y, value_type z); + inline static Matrixd rotate( value_type angle, const Vec3& axis); + inline static Matrixd rotate( value_type angle1, const Vec3& axis1, + value_type angle2, const Vec3& axis2, + value_type angle3, const Vec3& axis3); inline static Matrixd rotate( const Quat& quat); inline static Matrixd inverse( const Matrixd& matrix); @@ -321,21 +321,21 @@ inline Matrixd Matrixd::rotate( const Quat& q ) { return Matrixd(q); } -inline Matrixd Matrixd::rotate(float angle, float x, float y, float z ) +inline Matrixd Matrixd::rotate(value_type angle, value_type x, value_type y, value_type z ) { Matrixd m; m.makeRotate(angle,x,y,z); return m; } -inline Matrixd Matrixd::rotate(float angle, const Vec3& axis ) +inline Matrixd Matrixd::rotate(value_type angle, const Vec3& axis ) { Matrixd m; m.makeRotate(angle,axis); return m; } -inline Matrixd Matrixd::rotate( float angle1, const Vec3& axis1, - float angle2, const Vec3& axis2, - float angle3, const Vec3& axis3) +inline Matrixd Matrixd::rotate( value_type angle1, const Vec3& axis1, + value_type angle2, const Vec3& axis2, + value_type angle3, const Vec3& axis3) { Matrixd m; m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); @@ -399,7 +399,7 @@ inline Matrixd Matrixd::lookAt(const Vec3& eye,const Vec3& center,const Vec3& up inline Vec3 Matrixd::postMult( const Vec3& v ) const { - float d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; + value_type d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; return Vec3( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3])*d, (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3])*d, (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3])*d) ; @@ -407,7 +407,7 @@ inline Vec3 Matrixd::postMult( const Vec3& v ) const inline Vec3 Matrixd::preMult( const Vec3& v ) const { - float d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ; + value_type d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ; return Vec3( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0])*d, (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1])*d, (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2])*d); diff --git a/include/osg/Matrixf b/include/osg/Matrixf index 4c8afffc4..eaa056b48 100644 --- a/include/osg/Matrixf +++ b/include/osg/Matrixf @@ -108,12 +108,12 @@ class SG_EXPORT Matrixf void makeTranslate( value_type, value_type, value_type ); void makeRotate( const Vec3& from, const Vec3& to ); - void makeRotate( float angle, const Vec3& axis ); - void makeRotate( float angle, float x, float y, float z ); + void makeRotate( value_type angle, const Vec3& axis ); + void makeRotate( value_type angle, value_type x, value_type y, value_type z ); void makeRotate( const Quat& ); - void makeRotate( float angle1, const Vec3& axis1, - float angle2, const Vec3& axis2, - float angle3, const Vec3& axis3); + void makeRotate( value_type angle1, const Vec3& axis1, + value_type angle2, const Vec3& axis2, + value_type angle3, const Vec3& axis3); @@ -165,7 +165,7 @@ class SG_EXPORT Matrixf 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,float lookDistance=1.0f); + void getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance=1.0f); bool invert( const Matrixf& ); @@ -176,11 +176,11 @@ class SG_EXPORT Matrixf inline static Matrixf translate( const Vec3& dv); inline static Matrixf translate( value_type x, value_type y, value_type z); inline static Matrixf rotate( const Vec3& from, const Vec3& to); - inline static Matrixf rotate( float angle, float x, float y, float z); - inline static Matrixf rotate( float angle, const Vec3& axis); - inline static Matrixf rotate( float angle1, const Vec3& axis1, - float angle2, const Vec3& axis2, - float angle3, const Vec3& axis3); + inline static Matrixf rotate( value_type angle, value_type x, value_type y, value_type z); + inline static Matrixf rotate( value_type angle, const Vec3& axis); + inline static Matrixf rotate( value_type angle1, const Vec3& axis1, + value_type angle2, const Vec3& axis2, + value_type angle3, const Vec3& axis3); inline static Matrixf rotate( const Quat& quat); inline static Matrixf inverse( const Matrixf& matrix); @@ -320,21 +320,21 @@ inline Matrixf Matrixf::rotate( const Quat& q ) { return Matrixf(q); } -inline Matrixf Matrixf::rotate(float angle, float x, float y, float z ) +inline Matrixf Matrixf::rotate(value_type angle, value_type x, value_type y, value_type z ) { Matrixf m; m.makeRotate(angle,x,y,z); return m; } -inline Matrixf Matrixf::rotate(float angle, const Vec3& axis ) +inline Matrixf Matrixf::rotate(value_type angle, const Vec3& axis ) { Matrixf m; m.makeRotate(angle,axis); return m; } -inline Matrixf Matrixf::rotate( float angle1, const Vec3& axis1, - float angle2, const Vec3& axis2, - float angle3, const Vec3& axis3) +inline Matrixf Matrixf::rotate( value_type angle1, const Vec3& axis1, + value_type angle2, const Vec3& axis2, + value_type angle3, const Vec3& axis3) { Matrixf m; m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3); @@ -398,7 +398,7 @@ inline Matrixf Matrixf::lookAt(const Vec3& eye,const Vec3& center,const Vec3& up inline Vec3 Matrixf::postMult( const Vec3& v ) const { - float d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; + value_type d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; return Vec3( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3])*d, (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3])*d, (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3])*d) ; @@ -406,7 +406,7 @@ inline Vec3 Matrixf::postMult( const Vec3& v ) const inline Vec3 Matrixf::preMult( const Vec3& v ) const { - float d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ; + value_type d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ; return Vec3( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0])*d, (_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1])*d, (_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2])*d); diff --git a/src/osg/Matrix_implementation.cpp b/src/osg/Matrix_implementation.cpp index 8b32782d2..0883bef36 100644 --- a/src/osg/Matrix_implementation.cpp +++ b/src/osg/Matrix_implementation.cpp @@ -222,14 +222,14 @@ void Matrix_implementation::makeRotate( const Vec3& from, const Vec3& to ) set(quat); } -void Matrix_implementation::makeRotate( float angle, const Vec3& axis ) +void Matrix_implementation::makeRotate( value_type angle, const Vec3& axis ) { Quat quat; quat.makeRotate( angle, axis); set(quat); } -void Matrix_implementation::makeRotate( float angle, float x, float y, float z ) +void Matrix_implementation::makeRotate( value_type angle, value_type x, value_type y, value_type z ) { Quat quat; quat.makeRotate( angle, x, y, z); @@ -241,9 +241,9 @@ void Matrix_implementation::makeRotate( const Quat& quat ) set(quat); } -void Matrix_implementation::makeRotate( float angle1, const Vec3& axis1, - float angle2, const Vec3& axis2, - float angle3, const Vec3& axis3) +void Matrix_implementation::makeRotate( value_type angle1, const Vec3& axis1, + value_type angle2, const Vec3& axis2, + value_type angle3, const Vec3& axis3) { Quat quat; quat.makeRotate(angle1, axis1, @@ -291,8 +291,8 @@ void Matrix_implementation::preMult( const Matrix_implementation& other ) //Matrix_implementation tmp(other* *this); // *this = tmp; - // more efficient method just use a float[4] for temporary storage. - float t[4]; + // more efficient method just use a value_type[4] for temporary storage. + value_type t[4]; for(int col=0; col<4; ++col) { t[0] = INNER_PRODUCT( other, *this, 0, col ); t[1] = INNER_PRODUCT( other, *this, 1, col ); @@ -312,7 +312,7 @@ void Matrix_implementation::postMult( const Matrix_implementation& other ) //Matrix_implementation tmp(*this * other); // *this = tmp; - // more efficient method just use a float[4] for temporary storage. + // more efficient method just use a value_type[4] for temporary storage. value_type t[4]; for(int row=0; row<4; ++row) { @@ -357,7 +357,7 @@ bool Matrix_implementation::invert( const Matrix_implementation& mat ) for(i=0;i<4;i++) { - big=(float)0.0; + big=0.0; for (j=0; j<4; j++) if (ipiv[j] != 1) for (k=0; k<4; k++) @@ -520,7 +520,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,float lookDistance) +void Matrix_implementation::getLookAt(Vec3& eye,Vec3& center,Vec3& up,value_type lookDistance) { Matrix_implementation inv; inv.invert(*this);