Represents a color with four components: red, green, blue,
alpha.
Each component is represented by a 32 bit float value. The value
0 for the alpha means full transparency, while 1 means fully
opaque.
- Examples:
-
FixedFunctionMaterial/FixedFunctionMaterial.h, and ToonMaterial/ToonMaterial.h.
Definition at line 659 of file math.h.
Public Member Functions
|
| |
Color
(float fRed=1.0f, float fGreen=1.0f, float fBlue=1.0f, float
fAlpha=1.0f) |
| |
Constructs a color object with specified
values.
|
| void |
Set
(float fRed, float fGreen, float fBlue, float fAlpha=1.0f) |
| |
Sets the current value of the color.
|
| |
operator
const float * (void) const |
| |
Returns a pointer to the color data, which
consists of four floats (R, G, B, and A).
|
| float
& |
operator[]
(unsigned int iChannel) |
| |
Returns a color component based on its
index.
|
| |
operator
unsigned int (void) const |
| |
Converts the color value into a singe 32 bit
integer, where each component takes eight bits.
|
| Color & |
operator*=
(const float f) |
| |
Multiplies each component of the color with
a single scalar value.
|
| Color |
operator*
(float f) const |
| |
Multiplies the color by a scalar value.
|
| Color |
operator/
(float f) const |
| |
Divides the color by a scalar value.
|
| Color |
operator*
(const Color
&c) const |
| |
Multiplies two colors and returns the
result.
|
| Color & |
operator*=
(const Color
&c) |
| |
Mutliplies two colors, puts the result into
the current object, and returns it.
|
| Color |
operator+
(const Color
&c) const |
| |
Adds two colors and returns the result.
|
| Color |
operator-
(const Color
&c) const |
| |
Subtracts two colors and returns the result.
|
| Color & |
operator+=
(const Color
&c) |
| |
Adds two colors, puts the result into the
current object, and returns it.
|
| bool |
operator==
(const Color
&c) const |
| |
Returns true if the two colors are
identical, false otherwise.
|
| bool |
operator!=
(const Color
&c) const |
| |
Returns true if the two colors are
different, false otherwise.
|
| Color |
Mix
(const Color
&c, float f) const |
| |
Mix two colors based on a scalar value which
should be within the range 0 and 1.
|
| float |
Luminance
() const |
| |
Returns the luminance value for the color.
|
Public Attributes
|
| union { |
| struct { |
|
float m_fRed |
|
float m_fGreen |
|
float m_fBlue |
|
float m_fAlpha |
| } |
|
| struct { |
|
float r |
|
float g |
|
float b |
|
float a |
| } |
|
|
float m_fData
[4] |
|
double m_dAlignDummy |
|
__m128 m_vAlignDummy |
| }; |
|
Static Public Attributes
|
| static Color |
black |
| static Color |
white |
| static Color |
red |
| static Color |
green |
| static Color |
blue |
| static Color |
gray |
| operator const float * |
( |
void |
|
) |
const [inline] |
Returns a pointer to the color data, which consists of four
floats (R, G, B, and A).
Do not delete this pointer.
Definition at line 686 of file math.h.