Irrlicht 3D Engine: irr::video::SColorf Class Reference

| Irrlicht 3D Engine |

Public Member Functions | Public Attributes
irr::video::SColorf Class Reference

Class representing a color with four floats. More...

`#include <SColor.h>`

List of all members.

## Public Member Functions

- SColorf ()
    Default constructor for SColorf.
- SColorf (f32 r, f32 g, f32 b, f32 a=1.0f)
    Constructs a color from up to four color values: red, green, blue, and alpha.
- SColorf (SColor c)
    Constructs a color from 32 bit Color.
- f32 getAlpha () const
    Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque)
- f32 getBlue () const
    Returns the blue component of the color in the range 0.0 to 1.0.
- f32 getGreen () const
    Returns the green component of the color in the range 0.0 to 1.0.
- SColorf getInterpolated (const SColorf &other, f32 d) const
    Interpolates the color with a f32 value to another color.
- SColorf getInterpolated_quadratic (const SColorf &c1, const SColorf &c2, f32 d) const
    Returns interpolated color. ( quadratic )
- f32 getRed () const
    Returns the red component of the color in the range 0.0 to 1.0.
- void set (f32 rr, f32 gg, f32 bb)
    Sets three color components to new values at once.
- void set (f32 aa, f32 rr, f32 gg, f32 bb)
    Sets all four color components to new values at once.
- void setColorComponentValue (s32 index, f32 value)
    Sets a color component by index. R=0, G=1, B=2, A=3.
- SColor toSColor () const
    Converts this color to a SColor without floats.

## Public Attributes

- f32 a
    alpha color component
- f32 b
    blue component
- f32 g
    green color component
- f32 r
    red color component

## Detailed Description

Class representing a color with four floats.

The color values for red, green, blue and alpha are each stored in a 32 bit floating point variable. So all four values may be between 0.0f and 1.0f. Another, faster way to define colors is using the class SColor, which stores the color values in a single 32 bit integer.

Definition at line 458 of file SColor.h.

## Constructor & Destructor Documentation

irr::video::SColorf::SColorf | ( |  | ) | `[inline]`

Default constructor for SColorf.

Sets red, green and blue to 0.0f and alpha to 1.0f.

Definition at line 463 of file SColor.h.

Referenced by getInterpolated(), and getInterpolated_quadratic().

irr::video::SColorf::SColorf | ( | f32 | r,
|  | f32 | g,
|  | f32 | b,
|  | f32 | a = `1.0f`
| ) |  | `[inline]`

Constructs a color from up to four color values: red, green, blue, and alpha.

Parameters:

  r,: | Red color component. Should be a value between 0.0f meaning no red and 1.0f, meaning full red.
  g,: | Green color component. Should be a value between 0.0f meaning no green and 1.0f, meaning full green.
  b,: | Blue color component. Should be a value between 0.0f meaning no blue and 1.0f, meaning full blue.
  a,: | Alpha color component of the color. The alpha component defines how transparent a color should be. Has to be a value between 0.0f and 1.0f, 1.0f means not transparent (opaque), 0.0f means fully transparent.

Definition at line 476 of file SColor.h.

irr::video::SColorf::SColorf | ( | SColor | c | ) | `[inline]`

Constructs a color from 32 bit Color.

Parameters:

  c,: | 32 bit color from which this SColorf class is constructed from.

Definition at line 481 of file SColor.h.

References a, b, g, irr::video::SColor::getAlpha(), irr::video::SColor::getBlue(), irr::video::SColor::getGreen(), irr::video::SColor::getRed(), and r.

## Member Function Documentation

f32 irr::video::SColorf::getAlpha | ( |  | ) | const`[inline]`

Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque)

Definition at line 562 of file SColor.h.

References a.

f32 irr::video::SColorf::getBlue | ( |  | ) | const`[inline]`

Returns the blue component of the color in the range 0.0 to 1.0.

Definition at line 571 of file SColor.h.

References b.

Referenced by irr::video::SColorHSL::fromRGB().

f32 irr::video::SColorf::getGreen | ( |  | ) | const`[inline]`

Returns the green component of the color in the range 0.0 to 1.0.

Definition at line 568 of file SColor.h.

References g.

Referenced by irr::video::SColorHSL::fromRGB().

SColorf irr::video::SColorf::getInterpolated | ( | const SColorf & | other,
|  | f32 | d
| ) |  | const`[inline]`

Interpolates the color with a f32 value to another color.

Parameters:

  other,: | Other color
  d,: | value between 0.0f and 1.0f

Returns:
  Interpolated color.

Definition at line 520 of file SColor.h.

References a, b, irr::core::clamp(), g, r, and SColorf().

SColorf irr::video::SColorf::getInterpolated_quadratic | ( | const SColorf & | c1,
|  | const SColorf & | c2,
|  | f32 | d
| ) |  | const`[inline]`

Returns interpolated color. ( quadratic )

Parameters:

  c1,: | first color to interpolate with
  c2,: | second color to interpolate with
  d,: | value between 0.0f and 1.0f.

Definition at line 532 of file SColor.h.

References a, b, irr::core::clamp(), g, r, and SColorf().

f32 irr::video::SColorf::getRed | ( |  | ) | const`[inline]`

Returns the red component of the color in the range 0.0 to 1.0.

Definition at line 565 of file SColor.h.

References r.

Referenced by irr::video::SColorHSL::fromRGB().

void irr::video::SColorf::set | ( | f32 | rr,
|  | f32 | gg,
|  | f32 | bb
| ) |  | `[inline]`

Sets three color components to new values at once.

Parameters:

  rr,: | Red color component. Should be a value between 0.0f meaning no red (=black) and 1.0f, meaning full red.
  gg,: | Green color component. Should be a value between 0.0f meaning no green (=black) and 1.0f, meaning full green.
  bb,: | Blue color component. Should be a value between 0.0f meaning no blue (=black) and 1.0f, meaning full blue.

Definition at line 503 of file SColor.h.

References b, g, and r.

Referenced by irr::video::SColorHSL::toRGB().

void irr::video::SColorf::set | ( | f32 | aa,
|  | f32 | rr,
|  | f32 | gg,
|  | f32 | bb
| ) |  | `[inline]`

Sets all four color components to new values at once.

Parameters:

  aa,: | Alpha component. Should be a value between 0.0f meaning fully transparent and 1.0f, meaning opaque.
  rr,: | Red color component. Should be a value between 0.0f meaning no red and 1.0f, meaning full red.
  gg,: | Green color component. Should be a value between 0.0f meaning no green and 1.0f, meaning full green.
  bb,: | Blue color component. Should be a value between 0.0f meaning no blue and 1.0f, meaning full blue.

Definition at line 514 of file SColor.h.

References a, b, g, and r.

void irr::video::SColorf::setColorComponentValue | ( | s32 | index,
|  | f32 | value
| ) |  | `[inline]`

Sets a color component by index. R=0, G=1, B=2, A=3.

Definition at line 550 of file SColor.h.

References a, b, g, and r.

SColor irr::video::SColorf::toSColor | ( |  | ) | const`[inline]`

Converts this color to a SColor without floats.

Definition at line 491 of file SColor.h.

References a, b, g, r, and irr::core::round32().

## Member Data Documentation

f32 irr::video::SColorf::a

alpha color component

Definition at line 583 of file SColor.h.

Referenced by getAlpha(), getInterpolated(), getInterpolated_quadratic(), SColorf(), set(), setColorComponentValue(), and toSColor().

f32 irr::video::SColorf::b

blue component

Definition at line 580 of file SColor.h.

Referenced by getBlue(), getInterpolated(), getInterpolated_quadratic(), SColorf(), set(), setColorComponentValue(), and toSColor().

f32 irr::video::SColorf::g

green color component

Definition at line 577 of file SColor.h.

Referenced by getGreen(), getInterpolated(), getInterpolated_quadratic(), SColorf(), set(), setColorComponentValue(), and toSColor().

f32 irr::video::SColorf::r

red color component

Definition at line 574 of file SColor.h.

Referenced by getInterpolated(), getInterpolated_quadratic(), getRed(), SColorf(), set(), setColorComponentValue(), and toSColor().

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

- SColor.h