From 314a82b1264d13ba0f78efb7f36ce10b4cb973f9 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Wed, 13 Jan 2016 21:23:56 -0400 Subject: [PATCH] Fixed the piecewise function in linearToGamma to use <= instead of < when determining whether to use the linear part of the function. --- src/modules/graphics/opengl/wrap_Graphics.lua | 2 +- src/modules/math/MathModule.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/wrap_Graphics.lua b/src/modules/graphics/opengl/wrap_Graphics.lua index e4a28f74a..b92cb40bb 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.lua +++ b/src/modules/graphics/opengl/wrap_Graphics.lua @@ -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; diff --git a/src/modules/math/MathModule.cpp b/src/modules/math/MathModule.cpp index d04ade374..2493630de 100644 --- a/src/modules/math/MathModule.cpp +++ b/src/modules/math/MathModule.cpp @@ -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;