From 22d5390784f24f185f35badb3ac5011bf42c682f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 6 Dec 2005 10:16:21 +0000 Subject: [PATCH] From Louis Hamilton, fix to LightPoint's under 64 bit build, changing longs to ints in colour conversion code. --- include/osg/Vec4d | 20 ++++++++++---------- include/osg/Vec4f | 20 ++++++++++---------- src/osgSim/LightPointDrawable.h | 8 ++++---- src/osgWrappers/osg/Vec4d.cpp | 4 ++-- src/osgWrappers/osg/Vec4f.cpp | 4 ++-- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/osg/Vec4d b/include/osg/Vec4d index f391b22c7..055bb6d33 100644 --- a/include/osg/Vec4d +++ b/include/osg/Vec4d @@ -108,20 +108,20 @@ class Vec4d inline value_type a() const { return _v[3]; } - inline unsigned long asABGR() const + inline unsigned int asABGR() const { - 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); + return (unsigned int)clampTo((_v[0]*255.0),0.0,255.0)<<24 | + (unsigned int)clampTo((_v[1]*255.0),0.0,255.0)<<16 | + (unsigned int)clampTo((_v[2]*255.0),0.0,255.0)<<8 | + (unsigned int)clampTo((_v[3]*255.0),0.0,255.0); } - inline unsigned long asRGBA() const + inline unsigned int asRGBA() const { - 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); + return (unsigned int)clampTo((_v[3]*255.0),0.0,255.0)<<24 | + (unsigned int)clampTo((_v[2]*255.0),0.0,255.0)<<16 | + (unsigned int)clampTo((_v[1]*255.0),0.0,255.0)<<8 | + (unsigned int)clampTo((_v[0]*255.0),0.0,255.0); } inline bool valid() const { return !isNaN(); } diff --git a/include/osg/Vec4f b/include/osg/Vec4f index 8745f6e45..42f4be353 100644 --- a/include/osg/Vec4f +++ b/include/osg/Vec4f @@ -103,20 +103,20 @@ class Vec4f inline value_type b() const { return _v[2]; } inline value_type a() const { return _v[3]; } - inline unsigned long asABGR() const + inline unsigned int 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 int)clampTo((_v[0]*255.0f),0.0f,255.0f)<<24 | + (unsigned int)clampTo((_v[1]*255.0f),0.0f,255.0f)<<16 | + (unsigned int)clampTo((_v[2]*255.0f),0.0f,255.0f)<<8 | + (unsigned int)clampTo((_v[3]*255.0f),0.0f,255.0f); } - inline unsigned long asRGBA() const + inline unsigned int 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 int)clampTo((_v[3]*255.0f),0.0f,255.0f)<<24 | + (unsigned int)clampTo((_v[2]*255.0f),0.0f,255.0f)<<16 | + (unsigned int)clampTo((_v[1]*255.0f),0.0f,255.0f)<<8 | + (unsigned int)clampTo((_v[0]*255.0f),0.0f,255.0f); } inline bool valid() const { return !isNaN(); } diff --git a/src/osgSim/LightPointDrawable.h b/src/osgSim/LightPointDrawable.h index 70c1e101f..8cceedae0 100644 --- a/src/osgSim/LightPointDrawable.h +++ b/src/osgSim/LightPointDrawable.h @@ -40,18 +40,18 @@ class OSGSIM_EXPORT LightPointDrawable : public osg::Drawable virtual const char* className() const { return "LightPointDrawable"; } - //typedef std::pair ColorPosition; + //typedef std::pair ColorPosition; struct ColorPosition { - unsigned long first; + unsigned int first; osg::Vec3 second; ColorPosition() {} - ColorPosition(unsigned long f,const osg::Vec3& s):first(f),second(s) {} + ColorPosition(unsigned int f,const osg::Vec3& s):first(f),second(s) {} }; void reset(); - inline unsigned long asRGBA(const osg::Vec4& color) const + inline unsigned int asRGBA(const osg::Vec4& color) const { return _endian==osg::BigEndian?color.asABGR():color.asRGBA(); } diff --git a/src/osgWrappers/osg/Vec4d.cpp b/src/osgWrappers/osg/Vec4d.cpp index a01973b49..616ace86d 100644 --- a/src/osgWrappers/osg/Vec4d.cpp +++ b/src/osgWrappers/osg/Vec4d.cpp @@ -51,8 +51,8 @@ BEGIN_VALUE_REFLECTOR(osg::Vec4d) I_Method0(osg::Vec4d::value_type, g); I_Method0(osg::Vec4d::value_type, b); I_Method0(osg::Vec4d::value_type, a); - I_Method0(unsigned long, asABGR); - I_Method0(unsigned long, asRGBA); + I_Method0(unsigned int, asABGR); + I_Method0(unsigned int, asRGBA); I_Method0(bool, valid); I_Method0(bool, isNaN); I_Method0(osg::Vec4d::value_type, length); diff --git a/src/osgWrappers/osg/Vec4f.cpp b/src/osgWrappers/osg/Vec4f.cpp index 8d9067cd7..e2b601437 100644 --- a/src/osgWrappers/osg/Vec4f.cpp +++ b/src/osgWrappers/osg/Vec4f.cpp @@ -49,8 +49,8 @@ BEGIN_VALUE_REFLECTOR(osg::Vec4f) I_Method0(osg::Vec4f::value_type, g); I_Method0(osg::Vec4f::value_type, b); I_Method0(osg::Vec4f::value_type, a); - I_Method0(unsigned long, asABGR); - I_Method0(unsigned long, asRGBA); + I_Method0(unsigned int, asABGR); + I_Method0(unsigned int, asRGBA); I_Method0(bool, valid); I_Method0(bool, isNaN); I_Method0(osg::Vec4f::value_type, length);