cleanups; remove commented out stuff that's not needed; fix broken

friend function (it's to make 3 * RageColor/Vector work like RageColor * 3,
but I don't know if anything uses it.)
This commit is contained in:
Glenn Maynard
2002-11-16 07:11:05 +00:00
parent 738473aa63
commit 2d7b9001b1
3 changed files with 10 additions and 30 deletions
+1 -1
View File
@@ -91,4 +91,4 @@ protected:
extern RageDisplay* DISPLAY; // global and accessable from anywhere in our program
#endif
#endif
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef RageMath_H
#define RageMath_H
#ifndef RAGE_MATH_H
#define RAGE_MATH_H
/*
-----------------------------------------------------------------------------
File: RageMath.h
@@ -27,4 +27,4 @@ void RageMatrixRotationX( RageMatrix* pOut, float fTheta );
void RageMatrixRotationY( RageMatrix* pOut, float fTheta );
void RageMatrixRotationZ( RageMatrix* pOut, float fTheta );
#endif
#endif
+6 -26
View File
@@ -108,32 +108,14 @@ public:
float x, y, z, w;
};
/* nuke this stuff once we're sure RageVColor is OK */
/* #define RAGECOLOR_ARGB(a,r,g,b) \
((DWORD)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
#define RAGECOLOR_RGBA(r,g,b,a) RAGECOLOR_ARGB(a,r,g,b)
#define RAGECOLOR_COLORVALUE(r,g,b,a) \
RAGECOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
*/
struct RageColor
{
public:
RageColor() {}
RageColor( const float * f ) { r=f[0]; g=f[1]; b=f[2]; a=f[3]; }
RageColor( float r1, float g1, float b1, float a1 ) { r=r1; g=g1; b=b1; a=a1; }
/* RageColor( unsigned long c )
{
a = ((c>>24)&0xff) / 255.f;
r = ((c>>16)&0xff) / 255.f;
g = ((c>>8)&0xff) / 255.f;
b = (c&0xff) / 255.f;
}
*/
// casting
// operator unsigned long () const { return RAGECOLOR_COLORVALUE(min(1.f,max(0.f,r)),min(1.f,max(0.f,g)),min(1.f,max(0.f,b)),min(1.f,max(0.f,a))); }
operator float* () { return &r; };
operator const float* () const { return &r; };
@@ -149,11 +131,7 @@ public:
RageColor operator * ( float f ) const { return RageColor( r*f, g*f, b*f, a*f ); }
RageColor operator / ( float f ) const { return RageColor( r/f, g/f, b/f, a/f ); }
friend RageVector4 operator * ( float f, const RageVector4& other ) { return other*f; } // What is this for? Did I add this? -Chris
/* unneeded; this is a POD type */
// bool operator == ( const RageColor& other ) const { return r==other.r && g==other.g && b==other.b && a==other.a; }
// bool operator != ( const RageColor& other ) const { return r!=other.r || g!=other.g || b!=other.b || a!=other.a; }
friend RageColor operator * ( float f, const RageColor& other ) { return other*f; } // What is this for? Did I add this? -Chris
float r, g, b, a;
};
@@ -173,8 +151,10 @@ class RageVColor
public:
RageVColor() { }
RageVColor(const RageColor &rc) {
RageVColor(const RageColor &rc) { *this = rc; }
RageVColor &operator= (const RageColor &rc) {
r = FTOC(rc.r); g = FTOC(rc.g); b = FTOC(rc.b); a = FTOC(rc.a);
return *this;
}
};
@@ -281,4 +261,4 @@ public:
#pragma warning (pop)
#endif
#endif