|
| Color () |
| Creates a black, opaque color. More...
|
|
| Color (const Color &color) |
|
| Color (unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) |
|
void | SetR (unsigned char r) |
|
void | SetG (unsigned char g) |
|
void | SetB (unsigned char b) |
|
void | SetA (unsigned char a) |
|
void | SetRGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
|
unsigned char | GetR () const |
|
unsigned char | GetG () const |
|
unsigned char | GetB () const |
|
unsigned char | GetA () const |
|
void | GetRGBA (unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) const |
|
void | Get (float rgbaVec[4]) const |
| Returns RGBA componts as a vector of floats. More...
|
|
Color & | operator= (const Color &color) |
|
Color | operator+ (const Color &color) const |
|
Color | operator- (const Color &color) const |
|
bool | operator== (const Color &color) const |
|
bool | operator!= (const Color &color) const |
|
void | GetScaled (float escalar, float result[4]) const |
| Multiplies RGB components, keeps A component. More...
|
|
void | GetScaled (float escalar, Color *result) const |
| Multiplies RGB components, keeps A component. More...
|
|
RGBA color representation.
Colors are quadruplets of Red (R), Green (G), Blue (B) and Alpha (A) components where A is the opacity of a color. Note that OpenGL requires that blending is enabled in order to make actual use of the alpha value - this is NOT done automatically by V-ART to produce faster drawings when blending is not needed. To enable blending the programmer should do it in the application's main routine, with code like "glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);". Enabling blending may not be enough in some cases: OpenGL uses traditional frame-buffer pixel blending which requires that farther fragments be drawn first in order to achieve correct blending results. In other words, translucent objects may appear opaque if drawn before the objects behind them.
Definition at line 24 of file color.h.
void VART::Color::GetScaled |
( |
float |
escalar, |
|
|
float |
result[4] |
|
) |
| const |
Multiplies RGB components, keeps A component.
Use this method to make a color darker, by multipling it by a number in the range 0..1.
- Parameters
-
escalar | [in] Number to multiply against RGB components. Should be in the range 0..1 in order to garantee that the result is in the range 0..1. No checking on the range is done. |
result | [out] Result of multiplication as RGBA float vector. Components should be in the range 0..1, but no clamping is done. |
Definition at line 178 of file color.cpp.
Referenced by VART::Material::Material(), and VART::Material::SetPlasticColor().
Returns a randomly chosen color.
You may want to initialize the random number generator with something like: srand(static_cast<unsigned int>(time(NULL))) before generating random colors.
Definition at line 110 of file color.cpp.
References SetA(), SetB(), SetG(), and SetR().