ML Reference
ml::ColorField Class Reference

Field to encapsulate a vector of 3 float values representing an (rgb) color with all properties of Vector3Field. More...

#include <mlFields.h>

Inheritance diagram for ml::ColorField:
ml::Vector3Field ml::Field

List of all members.

Public Member Functions

 ColorField ()
 Default constructor, do not use it.
 ColorField (const std::string &name)
 Constructor, create a field with a name to manage a vector of 3 float values interpreted as rgb-color values without transparency.
void setColorValue (float r, float g, float b)
 Sets the field value to r, g and b.
void updateColorValue (float r, float g, float b)
 Sets the field value to r, g and b, but only touch field if the new value is different from the old value.
void getColorValue (float &r, float &g, float &b) const
 Returns the value of the field into the floats r, g, and b.
const Vector3getColorValue () const
 Returns the value of the field as a Vector3.
void setPackedColorValue (MLuint32 rgba)
 Sets the packed uint32 color value to rgba.
MLuint32 getPackedColorValue () const
 Returns the packed uint32 color value.
Deprecated
 ColorField (const std::string &name, Vector3 *valuePtr)

Detailed Description

Field to encapsulate a vector of 3 float values representing an (rgb) color with all properties of Vector3Field.

Definition at line 1779 of file mlFields.h.


Constructor & Destructor Documentation

ml::ColorField::ColorField ( )

Default constructor, do not use it.

ml::ColorField::ColorField ( const std::string &  name)

Constructor, create a field with a name to manage a vector of 3 float values interpreted as rgb-color values without transparency.

Default value is (0,0,0).

ml::ColorField::ColorField ( const std::string &  name,
Vector3 valuePtr 
)

Member Function Documentation

void ml::ColorField::getColorValue ( float &  r,
float &  g,
float &  b 
) const

Returns the value of the field into the floats r, g, and b.

const Vector3& ml::ColorField::getColorValue ( ) const [inline]

Returns the value of the field as a Vector3.

Definition at line 1806 of file mlFields.h.

References ml::Vector3Field::getVectorValue().

MLuint32 ml::ColorField::getPackedColorValue ( ) const

Returns the packed uint32 color value.

Last (alpha) value is always set to opaque in bits 24 to 31. Red is read from the lowest 8 bits, green from bits 8-15, and blue from the bits 16 to 23.

void ml::ColorField::setColorValue ( float  r,
float  g,
float  b 
)

Sets the field value to r, g and b.

void ml::ColorField::setPackedColorValue ( MLuint32  rgba)

Sets the packed uint32 color value to rgba.

Last (alpha) value from bits 24 to 31 is ignored; red is read from the lowest 8 bits, green from bits 8-15, and blue from the bits 16 to 23; then value are normalized from ranges [0,255] to range [0,1] and stored as floating point values.

void ml::ColorField::updateColorValue ( float  r,
float  g,
float  b 
)

Sets the field value to r, g and b, but only touch field if the new value is different from the old value.

(NOTE that values must be identical to avoid touching the field!)


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