AnimatLab
2
Test
|
Standard color class. More...
#include <StdColor.h>
Public Member Functions | |
CStdColor () | |
Default constructor. More... | |
CStdColor (float fltMaxRange) | |
Constructor with maximum range. More... | |
CStdColor (float valr, float valg, float valb, float vala, float fltMaxRange) | |
Constructor. More... | |
void | a (float fltA, bool bThrowError=true) |
Sets the alpha value of the color. More... | |
float | a () |
Gets the alpha value of the color. More... | |
void | b (float fltB, bool bThrowError=true) |
Sets the blue value of the color. More... | |
float | b () |
Gets the blue value of the color. More... | |
void | ClearNearZero (float fltTolerance=1e-5f) |
Clears the near zero described by fltTolerance. More... | |
void | g (float fltG, bool bThrowError=true) |
Sets the green value of the color. More... | |
float | g () |
Gets the green value of the color. More... | |
void | Load (CStdXml &oXml, std::string strParamName, bool bThrowError=true) |
Loads the color. More... | |
void | Load (std::string strXml, std::string strParamName, bool bThrowError=true) |
Loads the color. More... | |
double | Magnitude () |
Gets the magnitude of the color. More... | |
void | Normalize () |
Normalizes the color. More... | |
bool | operator!= (const CStdColor &oPoint) |
!= casting operator. More... | |
CStdColor | operator* (const float fltVal) |
| |
void | operator*= (const float fltVal) |
*= casting operator. More... | |
CStdColor | operator+ (const CStdColor &oPoint) |
| |
CStdColor | operator+ (const float fltVal) |
| |
void | operator+= (const CStdColor &oPoint) |
+= casting operator. More... | |
void | operator+= (const float fltVal) |
+= casting operator. More... | |
CStdColor | operator- (const CStdColor &oPoint) |
| |
CStdColor | operator- (const float fltVal) |
| |
void | operator-= (const CStdColor &oPoint) |
-= casting operator. More... | |
void | operator-= (const float fltVal) |
-= casting operator. More... | |
CStdColor | operator/ (const float fltVal) |
/ casting operator. More... | |
void | operator/= (const float fltVal) |
/= casting operator. More... | |
void | operator= (const CStdColor &oPoint) |
= casting operator. More... | |
bool | operator== (const CStdColor &oPoint) |
== casting operator. More... | |
float | operator[] (const int iIndex) |
[] casting operator. More... | |
void | r (float fltR, bool bThrowError=true) |
Sets the red value of the color. More... | |
float | r () |
Gets the red value of the color. More... | |
void | Set (float R, float G, float B, float A) |
Sets the color values. More... | |
Protected Attributes | |
float | m_fltA |
The alpha component of the color. | |
float | m_fltB |
The blue component of the color. | |
float | m_fltG |
The green component of the color. | |
float | m_fltMaxRange |
some colors are 0-255, others are 0-1. This specifies the max range for these colors | |
float | m_fltR |
The red component of the color. | |
StdUtils::CStdColor::CStdColor | ( | ) |
Default constructor.
Definition at line 13 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.
StdUtils::CStdColor::CStdColor | ( | float | fltMaxRange | ) |
Constructor with maximum range.
fltMaxRange | The maximum range used for color values. |
Definition at line 23 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.
StdUtils::CStdColor::CStdColor | ( | float | valr, |
float | valg, | ||
float | valb, | ||
float | vala, | ||
float | fltMaxRange | ||
) |
Constructor.
valr | The red value. |
valg | The green value. |
valb | The blue value. |
vala | The alpha value. |
fltMaxRange | The maximum range for the color values. |
Definition at line 32 of file StdColor.cpp.
References a(), b(), g(), m_fltMaxRange, and r().
void StdUtils::CStdColor::a | ( | float | fltA, |
bool | bThrowError = true |
||
) |
Sets the alpha value of the color.
fltA | The new alpha value. |
bThrowError | true to throw error if there is a problem. |
Definition at line 126 of file StdColor.cpp.
References m_fltA, and StdUtils::Std_InValidRange().
Referenced by AnimatSim::Environment::ConstraintLimit::Alpha(), and AnimatSim::Simulator::SetData().
float StdUtils::CStdColor::a | ( | ) |
Gets the alpha value of the color.
Definition at line 140 of file StdColor.cpp.
References m_fltA.
Referenced by CStdColor(), Load(), and Set().
void StdUtils::CStdColor::b | ( | float | fltB, |
bool | bThrowError = true |
||
) |
Sets the blue value of the color.
fltB | The new blue value. |
bThrowError | true to throw error if there is a problem. |
Definition at line 101 of file StdColor.cpp.
References m_fltB, and StdUtils::Std_InValidRange().
Referenced by AnimatSim::Simulator::SetData().
float StdUtils::CStdColor::b | ( | ) |
Gets the blue value of the color.
Definition at line 115 of file StdColor.cpp.
References m_fltB.
Referenced by CStdColor(), Load(), and Set().
void StdUtils::CStdColor::ClearNearZero | ( | float | fltTolerance = 1e-5f | ) |
Clears the near zero described by fltTolerance.
This method checks each value to see if it is less than m_fltA give tolerance. If it is then it just sets it to zero.
fltTolerance | The tolerance. |
Definition at line 490 of file StdColor.cpp.
void StdUtils::CStdColor::g | ( | float | fltG, |
bool | bThrowError = true |
||
) |
Sets the green value of the color.
fltG | The new green value. |
bThrowError | true to throw error if there is a problem. |
Definition at line 76 of file StdColor.cpp.
References m_fltG, and StdUtils::Std_InValidRange().
Referenced by AnimatSim::Simulator::SetData().
float StdUtils::CStdColor::g | ( | ) |
Gets the green value of the color.
Definition at line 90 of file StdColor.cpp.
References m_fltG.
Referenced by CStdColor(), Load(), and Set().
void StdUtils::CStdColor::Load | ( | CStdXml & | oXml, |
std::string | strParamName, | ||
bool | bThrowError = true |
||
) |
Loads the color.
[in,out] | oXml | The xml used to load data. |
strParamName | Name of the string parameter. | |
bThrowError | true to throw error if there is a problem. |
Definition at line 540 of file StdColor.cpp.
References a(), b(), StdUtils::CStdXml::FindChildElement(), g(), StdUtils::CStdXml::GetAttribFloat(), StdUtils::CStdXml::IntoChildElement(), StdUtils::CStdXml::OutOfElem(), and r().
Referenced by AnimatSim::Environment::MovableItem::Ambient(), AnimatSim::Simulator::BackgroundColor(), AnimatSim::Environment::ConstraintLimit::Color(), AnimatSim::Environment::MovableItem::Diffuse(), Load(), AnimatSim::Simulator::LoadEnvironment(), and AnimatSim::Environment::MovableItem::Specular().
void StdUtils::CStdColor::Load | ( | std::string | strXml, |
std::string | strParamName, | ||
bool | bThrowError = true |
||
) |
Loads the color.
strXml | The xml used to load data. |
strParamName | Name of the std::string parameter. |
bThrowError | true to throw error if there is a problem. |
Definition at line 566 of file StdColor.cpp.
References StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), and Load().
double StdUtils::CStdColor::Magnitude | ( | ) |
Gets the magnitude of the color.
Definition at line 449 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, and m_fltR.
Referenced by Normalize().
void StdUtils::CStdColor::Normalize | ( | ) |
Normalizes the color.
Definition at line 458 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltR, and Magnitude().
bool StdUtils::CStdColor::operator!= | ( | const CStdColor & | oPoint | ) |
CStdColor StdUtils::CStdColor::operator* | ( | const float | fltVal | ) |
fltVal | The value. |
Definition at line 406 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.
void StdUtils::CStdColor::operator*= | ( | const float | fltVal | ) |
oPoint | The point. |
Definition at line 253 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.
CStdColor StdUtils::CStdColor::operator+ | ( | const float | fltVal | ) |
fltVal | The value. |
Definition at line 364 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.
void StdUtils::CStdColor::operator+= | ( | const CStdColor & | oPoint | ) |
void StdUtils::CStdColor::operator+= | ( | const float | fltVal | ) |
oPoint | The point. |
Definition at line 274 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.
CStdColor StdUtils::CStdColor::operator- | ( | const float | fltVal | ) |
fltVal | The value. |
Definition at line 385 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.
void StdUtils::CStdColor::operator-= | ( | const CStdColor & | oPoint | ) |
void StdUtils::CStdColor::operator-= | ( | const float | fltVal | ) |
CStdColor StdUtils::CStdColor::operator/ | ( | const float | fltVal | ) |
/ casting operator.
fltVal | The value. |
Definition at line 427 of file StdColor.cpp.
References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.
void StdUtils::CStdColor::operator/= | ( | const float | fltVal | ) |
void StdUtils::CStdColor::operator= | ( | const CStdColor & | oPoint | ) |
bool StdUtils::CStdColor::operator== | ( | const CStdColor & | oPoint | ) |
float StdUtils::CStdColor::operator[] | ( | const int | iIndex | ) |
void StdUtils::CStdColor::r | ( | float | fltR, |
bool | bThrowError = true |
||
) |
Sets the red value of the color.
fltR | The new red value. |
bThrowError | true to throw error if there is a problem. |
Definition at line 51 of file StdColor.cpp.
References m_fltR, and StdUtils::Std_InValidRange().
Referenced by AnimatSim::Simulator::SetData().
float StdUtils::CStdColor::r | ( | ) |
Gets the red value of the color.
Definition at line 65 of file StdColor.cpp.
References m_fltR.
Referenced by CStdColor(), Load(), and Set().
void StdUtils::CStdColor::Set | ( | float | R, |
float | G, | ||
float | B, | ||
float | A | ||
) |
Sets the color values.
R | The red value. |
G | The green value. |
B | The blue value. |
A | The alpha value. |
Definition at line 153 of file StdColor.cpp.
References a(), b(), g(), and r().
Referenced by AnimatSim::Environment::ConstraintLimit::Color(), AnimatSim::Environment::MovableItem::MovableItem(), and AnimatSim::Simulator::Simulator().