- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# FMColor Class Reference
[Mathematics Classes.]

A RBGA color. More...

`#include <FMColor.h>`

List of all members.

## Public Member Functions
| FMColor ()
| Creates an empty FMColor.
| FMColor (uint8 _r, uint8 _g, uint8 _b, uint8 _a=255)
| Creates the FMColor with the coordinates values.
| FMColor (uint32 hex)
| Creates the FMColor from a color encoded into a uint32.
| FMColor (const float *components, uint32 componentCount)
| Creates the FMColor from a list of `floats`.
| FMColor (const FMVector3 &v)
| Creates a color value from a 3D vector.
| FMColor (const FMVector4 &v)
| Creates a color value from a 4D vector.
void | ToFloats (float *components, uint32 componentCount)
| Get this FMColor as an array of `floats`.
uint8 | ComponentAverage ()
| Get the average of the three color values of this FMColor.
| operator uint8 * ()
| Get this FMColor as an array of uint8s.
## Public Attributes
uint8 | r
| The red component.
uint8 | g
| The green component.
uint8 | b
| The blue component.
uint8 | a
| The alpha component.

## Detailed Description

A RBGA color.

Not used within FCollada.

## Constructor & Destructor Documentation

FMColor::FMColor | ( |  | ) | `[inline]`

| Creates an empty FMColor. The default values are non deterministic.

FMColor::FMColor | ( | uint8 | _r,
|  | uint8 | _g,
|  | uint8 | _b,
|  | uint8 | _a = `255`
| ) | `[inline]`

  | Creates the FMColor with the coordinates values. The first three coordinates are taken from the FMVector3, where the first one is the x value, the second is that y, and the third is the z. The forth value is the `float` specified. Parameters:
  | _r | The red value.
  | _g | The green value.
  | _b | The blue value.
  | _a | The alpha value.

FMColor::FMColor | ( | uint32 | hex | ) | `[inline]`

  | Creates the FMColor from a color encoded into a uint32. The most significant byte makes up the red value. The second most significant makes up the green value, the third the blue, and the forth the alpha. Parameters:
  | hex | The uint to decode the color values from.

FMColor::FMColor | ( | const float * | components,
|  | uint32 | componentCount
| ) |

  | Creates the FMColor from a list of `floats`. It creates the FMColor with the values specified in the `floats`, which range from 0.0f to 1.0f. componentCount is used to determined how many values to take from the `float` array. If there are insufficient values, then it will give the remaining values default values. The default values are 0 for the colors and 255 for the alpha. It fills in the values in this order: red, green, blue, alpha. Parameters:
  | components | The `float` array to get values from.
  | componentCount | The amount of `float` to take from the array.

FMColor::FMColor | ( | const FMVector3 & | v | ) |

  | Creates a color value from a 3D vector. The alpha value of the color is set to the default of 255 (1.0f). Parameters:
  | v | The 3D vector representing the color value.

FMColor::FMColor | ( | const FMVector4 & | v | ) |

  | Creates a color value from a 4D vector. Parameters:
  | v | The 4D vector representing the color value.

## Member Function Documentation

uint8 FMColor::ComponentAverage | ( |  | ) | `[inline]`

| Get the average of the three color values of this FMColor. Returns: The averages of the three colors values of this FMColor.

FMColor::operator uint8 * | ( |  | ) | `[inline]`

| Get this FMColor as an array of uint8s. Returns: The `uint8` array.

void FMColor::ToFloats | ( | float * | components,
|  | uint32 | componentCount
| ) |

  | Get this FMColor as an array of `floats`. It fills the first componentCount elements (max 4) of `components` with the red, green, blue, alpha values of this FMColor in that order. Parameters:
  | components | The `float` array to fill.
  | componentCount | The amount of `float` to fill into the array.

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

- FMath/FMColor.h