|
|
@ -35,14 +35,6 @@ float SRGBToLinear(float in)
|
|
|
|
return powf((in + 0.055f) / 1.055f, 2.4f);
|
|
|
|
return powf((in + 0.055f) / 1.055f, 2.4f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float LinearToSRGB(float in)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (in <= 0.0031308f)
|
|
|
|
|
|
|
|
return in * 12.92f;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return 1.055f * powf(in, 1.0f / 2.4f) - 0.055f;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImVec4 SRGBToLinear(ImVec4 col)
|
|
|
|
ImVec4 SRGBToLinear(ImVec4 col)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
col.x = SRGBToLinear(col.x);
|
|
|
|
col.x = SRGBToLinear(col.x);
|
|
|
@ -53,16 +45,6 @@ ImVec4 SRGBToLinear(ImVec4 col)
|
|
|
|
return col;
|
|
|
|
return col;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ImVec4 LinearToSRGB(ImVec4 col)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
col.x = LinearToSRGB(col.x);
|
|
|
|
|
|
|
|
col.y = LinearToSRGB(col.y);
|
|
|
|
|
|
|
|
col.z = LinearToSRGB(col.z);
|
|
|
|
|
|
|
|
// Alpha component is already linear
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return col;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, typename R = float>
|
|
|
|
template<typename T, typename R = float>
|
|
|
|
R format_units(T value, const char*& unit)
|
|
|
|
R format_units(T value, const char*& unit)
|
|
|
|
{
|
|
|
|
{
|
|
|
|