Page 1 of 1

Question on Ogre::Light Class Reference

Posted: Sat Jul 23, 2005 3:56 pm
by Mugen
I have a question on the Light color in this section.
Public Member Functions
ColourValue (float red=1.0f, float green=1.0f, float blue=1.0f, float alpha=1.0f)
bool operator== (const ColourValue &rhs) const
bool operator!= (const ColourValue &rhs) const
RGBA getAsRGBA (void) const
Retrieves colour as RGBA.
ARGB getAsARGB (void) const
Retrieves colour as ARGB.
ABGR getAsABGR (void) const
Retrieves colours as ABGR.
ColourValue operator+ (const ColourValue &rkVector) const
ColourValue operator- (const ColourValue &rkVector) const
ColourValue operator * (float fScalar) const
ColourValue operator * (const ColourValue &rhs) const
ColourValue operator/ (const ColourValue &rhs) const
ColourValue operator/ (float fScalar) const
ColourValue & operator+= (const ColourValue &rkVector)
ColourValue & operator-= (const ColourValue &rkVector)
ColourValue & operator *= (float fScalar)
ColourValue & operator/= (float fScalar)
I am confused on the range of values for the color value of RGB
is it 0 - 1
or is it 0 - 255
and what is alpha?

Posted: Sat Jul 23, 2005 5:44 pm
by bal
Colour is represented as 4 components, each of which is a floating-point value from 0.0 to 1.0.

The 3 'normal' colour components are red, green and blue, a higher number indicating greater amounts of that component in the colour. The forth component is the 'alpha' value, which represents transparency. In this case, 0.0 is completely transparent and 1.0 is fully opaque.
Literally in the same file :).

Posted: Tue Aug 02, 2005 3:00 am
by Mugen
hahaha... i dont know how i could have missed that ... i still am confused on why they want to use a 0-1 range for colors, when most artist standard programs use 0-255. I will have to figure a way to adjust for when artist want to use their standards to ogre's code.

Posted: Tue Aug 02, 2005 7:25 am
by Walley
0-255 is generally better for exact precision with 32-bit colour.

Whilst floating point values ranging from 0.0f to 1.0f provide enough precision, you'd need to convert from the 0-255 value to be exact.
Primarily though, 0.0f to 1.0f is better for math operations (adding colours, multiplying colours, etc).

Posted: Tue Aug 02, 2005 1:11 pm
by SuprChikn
Mugen wrote:I will have to figure a way to adjust for when artist want to use their standards to ogre's code.
easy: divide by 255.

Posted: Tue Aug 02, 2005 4:38 pm
by :wumpus:
As ogre can render to 10bit, 16bit or even 32bit per channel formats, the range 0.0f .. 1.0f is nicely general.