diff --git a/include/osg/Vec2d b/include/osg/Vec2d index 3a2a76f68..31b0b9cb0 100644 --- a/include/osg/Vec2d +++ b/include/osg/Vec2d @@ -31,12 +31,12 @@ class Vec2d { public: - typedef float value_type; + typedef double value_type; value_type _v[2]; Vec2d() {_v[0]=0.0; _v[1]=0.0;} - Vec2d(float x,float y) { _v[0]=x; _v[1]=y; } + Vec2d(value_type x,value_type y) { _v[0]=x; _v[1]=y; } inline Vec2d(const Vec2f& vec) { _v[0]=vec._v[0]; _v[1]=vec._v[1]; } @@ -54,19 +54,19 @@ class Vec2d else return (_v[1]0.0) { - float inv = 1.0/norm; + value_type inv = 1.0/norm; _v[0] *= inv; _v[1] *= inv; } diff --git a/include/osg/Vec3d b/include/osg/Vec3d index 766d00423..ec63f5122 100644 --- a/include/osg/Vec3d +++ b/include/osg/Vec3d @@ -20,18 +20,18 @@ namespace osg { -/** General purpose float triple for use as vertices, vectors and normals. +/** General purpose double triple for use as vertices, vectors and normals. Provides general maths operations from addition through to cross products. - No support yet added for float * Vec3d - is it necessary? + No support yet added for double * Vec3d - is it necessary? Need to define a non-member non-friend operator* etc. - Vec3d * float is okay + Vec3d * double is okay */ class Vec3d { public: - typedef float value_type; + typedef double value_type; value_type _v[3]; Vec3d() { _v[0]=0.0; _v[1]=0.0; _v[2]=0.0;} diff --git a/include/osg/Vec4d b/include/osg/Vec4d index b5805bafa..456d2fb0a 100644 --- a/include/osg/Vec4d +++ b/include/osg/Vec4d @@ -19,17 +19,17 @@ namespace osg { -/** General purpose float quad, uses include representation +/** General purpose double quad, uses include representation of colour coordinates. - No support yet added for float * Vec4d - is it necessary? + No support yet added for double * Vec4d - is it necessary? Need to define a non-member non-friend operator* etc. - Vec4d * float is okay + Vec4d * double is okay */ class Vec4d { public: - typedef float value_type; + typedef double value_type; value_type _v[4]; @@ -96,18 +96,18 @@ class Vec4d inline unsigned long asABGR() const { - return (unsigned long)clampTo((_v[0]*255.0f),0.0f,255.0f)<<24 | - (unsigned long)clampTo((_v[1]*255.0f),0.0f,255.0f)<<16 | - (unsigned long)clampTo((_v[2]*255.0f),0.0f,255.0f)<<8 | - (unsigned long)clampTo((_v[3]*255.0f),0.0f,255.0f); + return (unsigned long)clampTo((_v[0]*255.0),0.0,255.0)<<24 | + (unsigned long)clampTo((_v[1]*255.0),0.0,255.0)<<16 | + (unsigned long)clampTo((_v[2]*255.0),0.0,255.0)<<8 | + (unsigned long)clampTo((_v[3]*255.0),0.0,255.0); } inline unsigned long asRGBA() const { - return (unsigned long)clampTo((_v[3]*255.0f),0.0f,255.0f)<<24 | - (unsigned long)clampTo((_v[2]*255.0f),0.0f,255.0f)<<16 | - (unsigned long)clampTo((_v[1]*255.0f),0.0f,255.0f)<<8 | - (unsigned long)clampTo((_v[0]*255.0f),0.0f,255.0f); + return (unsigned long)clampTo((_v[3]*255.0),0.0,255.0)<<24 | + (unsigned long)clampTo((_v[2]*255.0),0.0,255.0)<<16 | + (unsigned long)clampTo((_v[1]*255.0),0.0,255.0)<<8 | + (unsigned long)clampTo((_v[0]*255.0),0.0,255.0); } inline bool valid() const { return !isNaN(); }