I use Irrlicht version 1.7.1
First, little bug in documentation: Class name SColorHSL, but in description of class is written "Class representing a color in HSV format.". but HSL not equal HSV. Text must be corrected to: "Class representing a color in HSL format."
Next.
Big bug in code SColorHSL::fromRGB(const SColor &color)
Luminance must be:
Code: Select all
Luminance = (maxVal+minVal)*0.5f;Code: Select all
Luminance = (maxVal/minVal)*0.5f;Values if colors of SColor is in range [0,255], but in this case line 00512
Code: Select all
Saturation = (delta)/(2-maxVal-minVal);
Therefore must be SColorHSL::fromRGB(const SColorf &color), or
change code of fromRGB to somthing like this
Code: Select all
inline void SColorHSL::fromRGB(const SColor &color)
{
f32 r = color.getRed()/255.0;
f32 g = color.getGreen()/255.0;
f32 b = color.getBlue()/255.0;
const f32 maxVal = (f32)core::max_(r, g, b);
const f32 minVal = (f32)core::min_(r, g, b)
......and so on.....
Code: Select all