/**
* Color
* @version: 01-29-2005
* @author Joseph 'Pcjoe' Florencio
*/
#ifndef FXCOLOR_H
#define FXCOLOR_H

class CFXColor
{
public:
	// Constructor
	CFXColor() {setColor(0,0,0);}
	CFXColor(float r, float g, float b) {setColor(r,g,b);}

	// Operators
	operator float *()				{ return &m_flColor[0]; } // Colors will now automatically convert to float * when needed
	operator const float *() const	{ return &m_flColor[0]; } // Colors will now automatically convert to float * when needed

	// Accessors
	void setColor( float *c ) { for(int i=0;i<3;i++) { m_flColor[i] = c[i]; } }
	void setColor( float r, float g, float b ) { m_flColor[0]=r;m_flColor[1]=g;m_flColor[2]=b; }
	float *getColor( void ) { return (float*)this; }
	float getR( void ) { return m_flColor[0]; }
	float getG( void ) { return m_flColor[1]; }
	float getB( void ) { return m_flColor[2]; }

	/*
	* Interpolate to color by specified percent
	*/
	CFXColor interpolateTo( CFXColor interpolTo, float v )
	{	CFXColor c;
		for(int i=0;i<3;i++)
		{	c[i] = getColor()[i] + (interpolTo[i]-getColor()[i])* v;
		}
		return c;
	}
private:
	float m_flColor[3];
};

#endif