mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Fixed the piecewise function in linearToGamma to use <= instead of < when determining whether to use the linear part of the function.
This commit is contained in:
@@ -82,7 +82,7 @@ float linearToGammaPrecise(float c) {
|
||||
return c < 0.0031308 ? c * 12.92 : 1.055 * pow(c, 1.0 / 2.4) - 0.055;
|
||||
}
|
||||
vec3 linearToGammaPrecise(vec3 c) {
|
||||
bvec3 lt = lessThan(c, vec3(0.0031308));
|
||||
bvec3 lt = lessThanEqual(c, vec3(0.0031308));
|
||||
c.r = lt.r ? c.r * 12.92 : 1.055 * pow(c.r, 1.0 / 2.4) - 0.055;
|
||||
c.g = lt.g ? c.g * 12.92 : 1.055 * pow(c.g, 1.0 / 2.4) - 0.055;
|
||||
c.b = lt.b ? c.b * 12.92 : 1.055 * pow(c.b, 1.0 / 2.4) - 0.055;
|
||||
|
||||
@@ -213,7 +213,7 @@ float Math::gammaToLinear(float c) const
|
||||
**/
|
||||
float Math::linearToGamma(float c) const
|
||||
{
|
||||
if (c < 0.0031308f)
|
||||
if (c <= 0.0031308f)
|
||||
return c * 12.92f;
|
||||
else
|
||||
return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f;
|
||||
|
||||
Reference in New Issue
Block a user