OGRE-Next: Ogre::ColourValue Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Ogre::ColourValue Class Reference
Core » General

Class representing colour. More...

`#include <OgreColourValue.h>`

## Public Member Functions
| ColourValue (float red=1.0f, float green=1.0f, float blue=1.0f, float alpha=1.0f)
| ColourValue (Vector3 v)
| ColourValue (Vector4 v)
void | fromVector3 (Vector3 v)
| Sets 'this' RGB from xyz. Alpha component is left intact.
void | fromVector4 (Vector4 v)
| Sets 'this' RGBA from xyzw.
ABGR | getAsABGR () const
| Retrieves colours as ABGR.
ARGB | getAsARGB () const
| Retrieves colour as ARGB.
BGRA | getAsBGRA () const
| Retrieves colour as BGRA.
RGBA | getAsRGBA () const
| Retrieves colour as RGBA.
void | getHSB (Real *hue, Real *saturation, Real *brightness) const
| Convert the current colour to Hue, Saturation and Brightness values.
bool | operator!= (const ColourValue &rhs) const
ColourValue | operator* (const ColourValue &rhs) const
ColourValue | operator* (const float fScalar) const
ColourValue & | operator*= (const float fScalar)
ColourValue | operator+ (const ColourValue &rkVector) const
ColourValue & | operator+= (const ColourValue &rkVector)
ColourValue | operator- (const ColourValue &rkVector) const
ColourValue & | operator-= (const ColourValue &rkVector)
ColourValue | operator/ (const ColourValue &rhs) const
ColourValue | operator/ (const float fScalar) const
ColourValue & | operator/= (const float fScalar)
bool | operator== (const ColourValue &rhs) const
float & | operator[] (const size_t i)
| Array accessor operator.
float | operator[] (const size_t i) const
| Array accessor operator.
float * | ptr ()
| Pointer accessor for direct copying.
const float * | ptr () const
| Pointer accessor for direct copying.
void | saturate ()
| Clamps colour value to the range [0, 1].
ColourValue | saturateCopy () const
| As saturate, except that this colour value is unaffected and the saturated colour value is returned as a copy.
void | setAsABGR (const ABGR val)
| Sets colour as ABGR.
void | setAsARGB (const ARGB val)
| Sets colour as ARGB.
void | setAsBGRA (const BGRA val)
| Sets colour as BGRA.
void | setAsRGBA (const RGBA val)
| Sets colour as RGBA.
void | setHSB (Real hue, Real saturation, Real brightness)
| Set a colour value from Hue, Saturation and Brightness.
Vector3 | toVector3 () const
| Returns the RGB in xyz as a Vector3.
Vector4 | toVector4 () const
| Returns the RGBA in xyzw component as a Vector4.

## Public Attributes
float | a
float | b
float | g
float | r

## Static Public Attributes
static const ColourValue | Black
static const ColourValue | Blue
static const ColourValue | Green
static const ColourValue | Red
static const ColourValue | White
static const ColourValue | ZERO

## Detailed Description

Class representing colour.

Remarks
  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.

## Constructor & Destructor Documentation

## ◆ ColourValue() [1/3]

Ogre::ColourValue::ColourValue | ( | float | red = 1.0f,
|  | float | green = 1.0f,
|  | float | blue = 1.0f,
|  | float | alpha = 1.0f )
| inlineexplicit

References a, b, g, and r.

Referenced by operator!=(), operator*(), operator*(), operator*, operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/(), operator/=(), operator<<, operator==(), and saturateCopy().

## ◆ ColourValue() [2/3]

Ogre::ColourValue::ColourValue | ( | Vector3 | v | ) |
| inlineexplicit

References a, and fromVector3().

## ◆ ColourValue() [3/3]

Ogre::ColourValue::ColourValue | ( | Vector4 | v | ) |
| inlineexplicit

References fromVector4().

## Member Function Documentation

## ◆ fromVector3()

void Ogre::ColourValue::fromVector3 | ( | Vector3 | v | ) |
| inline

Sets 'this' RGB from xyz. Alpha component is left intact.

References Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by ColourValue().

## ◆ fromVector4()

void Ogre::ColourValue::fromVector4 | ( | Vector4 | v | ) |
| inline

Sets 'this' RGBA from xyzw.

References Ogre::Vector4::w, Ogre::Vector4::x, Ogre::Vector4::y, and Ogre::Vector4::z.

Referenced by ColourValue().

## ◆ getAsABGR()

ABGR Ogre::ColourValue::getAsABGR | ( |  | ) | const

Retrieves colours as ABGR.

## ◆ getAsARGB()

ARGB Ogre::ColourValue::getAsARGB | ( |  | ) | const

Retrieves colour as ARGB.

## ◆ getAsBGRA()

BGRA Ogre::ColourValue::getAsBGRA | ( |  | ) | const

Retrieves colour as BGRA.

## ◆ getAsRGBA()

RGBA Ogre::ColourValue::getAsRGBA | ( |  | ) | const

Retrieves colour as RGBA.

## ◆ getHSB()

void Ogre::ColourValue::getHSB | ( | Real * | hue,
|  | Real * | saturation,
|  | Real * | brightness ) const

Convert the current colour to Hue, Saturation and Brightness values.

Parameters

  hue | Output hue value, scaled to the [0,1] range as opposed to the 0-360
  saturation | Output saturation level, [0,1]
  brightness | Output brightness level, [0,1]

## ◆ operator!=()

bool Ogre::ColourValue::operator!= | ( | const ColourValue & | rhs | ) | const

References ColourValue().

## ◆ operator*() [1/2]

ColourValue Ogre::ColourValue::operator* | ( | const ColourValue & | rhs | ) | const
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator*() [2/2]

ColourValue Ogre::ColourValue::operator* | ( | const float | fScalar | ) | const
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator*=()

ColourValue & Ogre::ColourValue::operator*= | ( | const float | fScalar | ) |
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator+()

ColourValue Ogre::ColourValue::operator+ | ( | const ColourValue & | rkVector | ) | const
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator+=()

ColourValue & Ogre::ColourValue::operator+= | ( | const ColourValue & | rkVector | ) |
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator-()

ColourValue Ogre::ColourValue::operator- | ( | const ColourValue & | rkVector | ) | const
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator-=()

ColourValue & Ogre::ColourValue::operator-= | ( | const ColourValue & | rkVector | ) |
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator/() [1/2]

ColourValue Ogre::ColourValue::operator/ | ( | const ColourValue & | rhs | ) | const
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator/() [2/2]

ColourValue Ogre::ColourValue::operator/ | ( | const float | fScalar | ) | const
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator/=()

ColourValue & Ogre::ColourValue::operator/= | ( | const float | fScalar | ) |
| inline

References ColourValue(), a, b, g, and r.

## ◆ operator==()

bool Ogre::ColourValue::operator== | ( | const ColourValue & | rhs | ) | const

References ColourValue().

## ◆ operator[]() [1/2]

float & Ogre::ColourValue::operator[] | ( | const size_t | i | ) |
| inline

Array accessor operator.

References r.

## ◆ operator[]() [2/2]

float Ogre::ColourValue::operator[] | ( | const size_t | i | ) | const
| inline

Array accessor operator.

References r.

## ◆ ptr() [1/2]

float * Ogre::ColourValue::ptr | ( |  | ) |
| inline

Pointer accessor for direct copying.

References r.

## ◆ ptr() [2/2]

const float * Ogre::ColourValue::ptr | ( |  | ) | const
| inline

Pointer accessor for direct copying.

References r.

## ◆ saturate()

void Ogre::ColourValue::saturate | ( |  | ) |
| inline

Clamps colour value to the range [0, 1].

References a, b, g, and r.

Referenced by saturateCopy().

## ◆ saturateCopy()

ColourValue Ogre::ColourValue::saturateCopy | ( |  | ) | const
| inline

As saturate, except that this colour value is unaffected and the saturated colour value is returned as a copy.

References ColourValue(), and saturate().

## ◆ setAsABGR()

void Ogre::ColourValue::setAsABGR | ( | const ABGR | val | ) |

Sets colour as ABGR.

## ◆ setAsARGB()

void Ogre::ColourValue::setAsARGB | ( | const ARGB | val | ) |

Sets colour as ARGB.

## ◆ setAsBGRA()

void Ogre::ColourValue::setAsBGRA | ( | const BGRA | val | ) |

Sets colour as BGRA.

## ◆ setAsRGBA()

void Ogre::ColourValue::setAsRGBA | ( | const RGBA | val | ) |

Sets colour as RGBA.

## ◆ setHSB()

void Ogre::ColourValue::setHSB | ( | Real | hue,
|  | Real | saturation,
|  | Real | brightness )

Set a colour value from Hue, Saturation and Brightness.

Parameters

  hue | Hue value, scaled to the [0,1] range as opposed to the 0-360
  saturation | Saturation level, [0,1]
  brightness | Brightness level, [0,1]

## ◆ toVector3()

Vector3 Ogre::ColourValue::toVector3 | ( |  | ) | const
| inline

Returns the RGB in xyz as a Vector3.

References b, g, and r.

## ◆ toVector4()

Vector4 Ogre::ColourValue::toVector4 | ( |  | ) | const
| inline

Returns the RGBA in xyzw component as a Vector4.

References a, b, g, and r.

## Member Data Documentation

## ◆ a

float Ogre::ColourValue::a

Referenced by ColourValue(), ColourValue(), operator*(), operator*(), operator*, operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/(), operator/=(), saturate(), and toVector4().

## ◆ b

float Ogre::ColourValue::b

Referenced by ColourValue(), operator*(), operator*(), operator*, operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/(), operator/=(), saturate(), toVector3(), and toVector4().

## ◆ Black

const ColourValue Ogre::ColourValue::Black
| static

Referenced by Ogre::CompositorPassDef::CompositorPassDef(), Ogre::GLES2RenderSystem::clearFrameBuffer(), and Ogre::StringConverter::parseColourValue().

## ◆ Blue

const ColourValue Ogre::ColourValue::Blue
| static

## ◆ g

float Ogre::ColourValue::g

Referenced by ColourValue(), operator*(), operator*(), operator*, operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/(), operator/=(), saturate(), toVector3(), and toVector4().

## ◆ Green

const ColourValue Ogre::ColourValue::Green
| static

## ◆ r

float Ogre::ColourValue::r

Referenced by ColourValue(), operator*(), operator*(), operator*, operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/(), operator/=(), operator[](), operator[](), ptr(), ptr(), saturate(), toVector3(), and toVector4().

## ◆ Red

const ColourValue Ogre::ColourValue::Red
| static

## ◆ White

const ColourValue Ogre::ColourValue::White
| static

Referenced by Ogre::v1::Billboard::Billboard(), Ogre::v1::BillboardSet::createBillboard(), Ogre::v1::BillboardSet::createBillboard(), and Ogre::TextureUnitState::setColourOperationEx().

## ◆ ZERO

const ColourValue Ogre::ColourValue::ZERO
| static

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

- OgreColourValue.h