mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-25 16:26:18 +00:00
Changed: #825 Remove all warnings when compiling Ryzom
This commit is contained in:
parent
84a04309ef
commit
1ddc4db6d1
1 changed files with 13 additions and 12 deletions
|
@ -615,25 +615,26 @@ bool CRGBA::convertToHLS(float &h, float &l, float &s) const
|
|||
float maxV = NLMISC::maxof(r, g, b);
|
||||
float minV = NLMISC::minof(r, g, b);
|
||||
|
||||
/// get lightness
|
||||
l = 0.5f * (maxV + minV);
|
||||
|
||||
/// Get saturation
|
||||
if (minV == maxV) // all composants are equals -> achromatique
|
||||
// all composants are equals -> achromatique
|
||||
if (minV == maxV)
|
||||
{
|
||||
h = 0;
|
||||
s = 0;
|
||||
h = 0.f;
|
||||
l = minV;
|
||||
s = 0.f;
|
||||
return true;
|
||||
}
|
||||
|
||||
// get lightness
|
||||
l = 0.5f * (maxV + minV);
|
||||
|
||||
float diff = maxV - minV;
|
||||
|
||||
/// compute saturation
|
||||
// get saturation
|
||||
s = l > 0.5f ? /*are we in the top of the double-hexcone ? */
|
||||
diff / (2.f - maxV - minV) :
|
||||
diff / (maxV + minV);
|
||||
|
||||
// Get hue
|
||||
// get hue
|
||||
if (maxV == r)
|
||||
{
|
||||
h = (g - b) / diff;
|
||||
|
@ -691,10 +692,10 @@ static float HLSValue(float h, float v1, float v2)
|
|||
// ***************************************************************************
|
||||
void CRGBA::buildFromHLS(float h, float l, float s)
|
||||
{
|
||||
clamp(l, 0, 1);
|
||||
clamp(s, 0, 1);
|
||||
clamp(l, 0.f, 1.f);
|
||||
clamp(s, 0.f, 1.f);
|
||||
|
||||
float v2 = (l <= 0.5f) ? (l * (1 + s)) : (l + s - l * s);
|
||||
float v2 = (l <= 0.5f) ? (l * (1.f + s)) : (l + s - l * s);
|
||||
float v1 = 2.f * l - v2;
|
||||
|
||||
if (s == 0) // achromatic ?
|
||||
|
|
Loading…
Reference in a new issue