mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-23 16:43:50 +00:00
adds toLinear and toGamma helper functions for ColorF, uses the former in adjusting lights.
This commit is contained in:
parent
79f8b819ea
commit
13f00ca79d
2 changed files with 16 additions and 3 deletions
|
|
@ -104,6 +104,9 @@ class ColorF
|
|||
(alpha >= 0.0f && alpha <= 1.0f); }
|
||||
void clamp();
|
||||
|
||||
ColorF toLinear() const;
|
||||
ColorF toGamma() const;
|
||||
|
||||
static const ColorF ZERO;
|
||||
static const ColorF ONE;
|
||||
static const ColorF WHITE;
|
||||
|
|
@ -462,6 +465,16 @@ inline void ColorF::clamp()
|
|||
alpha = 0.0f;
|
||||
}
|
||||
|
||||
inline ColorF ColorF::toLinear() const
|
||||
{
|
||||
return ColorF(mPow(red, 2.2f), mPow(green, 2.2f), mPow(blue, 2.2f), alpha);
|
||||
}
|
||||
|
||||
inline ColorF ColorF::toGamma() const
|
||||
{
|
||||
return ColorF(mPow(red, 1.0f / 2.2f), mPow(green, 1.0f / 2.2f), mPow(blue, 1.0f / 2.2f), alpha);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//-------------------------------------- INLINES (ColorI)
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue