Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | Namespace Members | Class Members | Related Pages

ColorReal Class Reference
[XEngineCore Library]

List of all members.

Detailed Description

A little helper class for handling RGBA colors specified as 4 real values. Usually the components of an RGBA color, when specified as real values, are each in the range [0, 1]. However, this class allows any real value for the components (which can be used for certain special effects, for example for lighting calculations). You can call ColorReal::Clamp to clamp the color components to a range of [0, 1].

Warning:
This class must always be of the size sizeof(real) * 4 and have no virtual functions.


Public Member Functions

 ColorReal (real red=1.0f, real green=1.0f, real blue=1.0f, real alpha=1.0f)
 Constructs a color using the 4 given real values.
 ColorReal (const real *color)
 Constructs a color from the given 4-element real array.
 ColorReal (const Vector4 &v)
 Constructs a color from the given vector.
template<wxUint32 RedShift, wxUint32 GreenShift, wxUint32 BlueShift, wxUint32 AlphaShift>
 ColorReal (Color< RedShift, GreenShift, BlueShift, AlphaShift > color)
 Constructs a color from the given Color object.
void Set (real red, real green, real blue, real alpha=1.0f)
 Sets this color using the 4 given real values.
void Set (const Vector4 &v)
 Sets this color using the given vector.
void SetAlpha (real alpha)
 Sets the alpha component of this color.
void SetRed (real red)
 Sets the red component of this color.
void SetGreen (real green)
 Sets the green component of this color.
void SetBlue (real blue)
 Sets the blue component of this color.
real GetAlpha () const
 Returns the alpha component of this color.
real GetRed () const
 Returns the red component of this color.
real GetGreen () const
 Returns the green component of this color.
real GetBlue () const
 Returns the blue component of this color.
 operator real * ()
 Casts this color to a real array.
 operator const real * () const
 Casts this color to a const real array.
template<wxUint32 RedShift, wxUint32 GreenShift, wxUint32 BlueShift, wxUint32 AlphaShift>
ColorRealoperator= (Color< RedShift, GreenShift, BlueShift, AlphaShift > color)
 Assigns the given Color object to this color.
ColorRealoperator= (const Vector4 &v)
 Assigns the given vector to this color object.
Vector4 GetAsVector4 () const
 Returns this color as a vector.
void Clamp ()
 Clamps all components of this color to the range [0, 1].
bool operator== (const ColorReal &color) const
 Equality operator.
bool operator!= (const ColorReal &color) const
 Inequality operator.

Public Attributes

real m_red
 Color component.
real m_green
 Color component.
real m_blue
 Color component.
real m_alpha
 Color component.


Constructor & Destructor Documentation

ColorReal real  red = 1.0f,
real  green = 1.0f,
real  blue = 1.0f,
real  alpha = 1.0f
 

Constructs a ColorReal object from the 4 given real values.

ColorReal const real color  ) 
 

Constructs a ColorReal object from the given 4-element real array.

ColorReal const Vector4 v  ) 
 

Constructs a color from the given vector. The components will be mapped in the following order: (r, g, b, a) = (x, y, z, w).

ColorReal Color< RedShift, GreenShift, BlueShift, AlphaShift >  color  ) 
 

Constructs a ColorReal object from the given Color object.


Member Function Documentation

void Clamp  ) 
 

Clamps all four components of this ColorReal object to the range [0, 1].

real GetAlpha  )  const
 

Returns the alpha component of this ColorReal object.

Vector4 GetAsVector4  )  const
 

Returns this color as vector. The components will be mapped in the following order: (r, g, b, a) = (x, y, z, w).

real GetBlue  )  const
 

Returns the blue component of this ColorReal object.

real GetGreen  )  const
 

Returns the green component of this ColorReal object.

real GetRed  )  const
 

Returns the red component of this ColorReal object.

operator const real *  )  const
 

Casts this ColorReal object to a const 4-element real array.

operator real *  ) 
 

Casts this ColorReal object to a 4-element real array.

bool operator!= const ColorReal color  )  const
 

Inequality operator.

ColorReal & operator= const Vector4 v  ) 
 

Assigns the given vector to this color object. The components will be mapped in the following order: (r, g, b, a) = (x, y, z, w).

ColorReal & operator= Color< RedShift, GreenShift, BlueShift, AlphaShift >  color  ) 
 

Assigns and converts the given Color to this ColorReal object.

bool operator== const ColorReal color  )  const
 

Equality operator.

void Set const Vector4 v  ) 
 

Sets this color using the given vector. The components will be mapped in the following order: (r, g, b, a) = (x, y, z, w).

void Set real  red,
real  green,
real  blue,
real  alpha = 1.0f
 

Sets this ColorReal object to the color given by the 4 given real values.

void SetAlpha real  alpha  ) 
 

Sets the alpha component of this ColorReal object to the given value.

void SetBlue real  blue  ) 
 

Sets the blue component of this ColorReal object to the given value.

void SetGreen real  green  ) 
 

Sets the green component of this ColorReal object to the given value.

void SetRed real  red  ) 
 

Sets the red component of this ColorReal object to the given value.


The documentation for this class was generated from the following files: