Normalize color storage
Colors are now normalized to 0 - 1 values instead of 0 - 255 causes calculations to be simpler and generally cleans up the codebase.
This commit is contained in:
parent
0e3547e0f6
commit
96198dae55
18 changed files with 71 additions and 72 deletions
|
|
@ -4,6 +4,7 @@
|
|||
CColor::CColor() {}
|
||||
|
||||
CColor::CColor(float r, float g, float b, float a) {
|
||||
RASSERT(r <= 1.f && g <= 1.f && b <= 1.f && a <= 1.f, "un-normalized color assignment");
|
||||
this->r = r;
|
||||
this->g = g;
|
||||
this->b = b;
|
||||
|
|
@ -11,10 +12,10 @@ CColor::CColor(float r, float g, float b, float a) {
|
|||
}
|
||||
|
||||
CColor::CColor(uint64_t hex) {
|
||||
this->r = RED(hex) * 255.f;
|
||||
this->g = GREEN(hex) * 255.f;
|
||||
this->b = BLUE(hex) * 255.f;
|
||||
this->a = ALPHA(hex) * 255.f;
|
||||
this->r = RED(hex);
|
||||
this->g = GREEN(hex);
|
||||
this->b = BLUE(hex);
|
||||
this->a = ALPHA(hex);
|
||||
}
|
||||
|
||||
uint64_t CColor::getAsHex() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue