From d77bfa1a704c7060fc723e2c463cae398dc5b354 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 4 May 2014 17:20:40 +0200 Subject: [PATCH] Fixed GTX_color_space - saturation #195 --- glm/gtx/color_space.hpp | 4 ++-- glm/gtx/color_space.inl | 8 ++++---- test/gtx/gtx_color_space.cpp | 11 +++++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/glm/gtx/color_space.hpp b/glm/gtx/color_space.hpp index f9bb7ac1..44e2dd13 100644 --- a/glm/gtx/color_space.hpp +++ b/glm/gtx/color_space.hpp @@ -64,8 +64,8 @@ namespace glm /// Build a saturation matrix. /// @see gtx_color_space - template - GLM_FUNC_DECL detail::tmat4x4 saturation( + template + GLM_FUNC_DECL detail::tmat4x4 saturation( T const s); /// Modify the saturation of a color. diff --git a/glm/gtx/color_space.inl b/glm/gtx/color_space.inl index e45fae61..32d2ce8d 100644 --- a/glm/gtx/color_space.inl +++ b/glm/gtx/color_space.inl @@ -106,16 +106,16 @@ namespace glm return hsv; } - template - GLM_FUNC_QUALIFIER detail::tmat4x4 saturation(const T s) + template + GLM_FUNC_QUALIFIER detail::tmat4x4 saturation(T const s) { - detail::tvec3 rgbw = detail::tvec3(T(0.2126), T(0.7152), T(0.0722)); + detail::tvec3 rgbw = detail::tvec3(T(0.2126), T(0.7152), T(0.0722)); T col0 = (T(1) - s) * rgbw.r; T col1 = (T(1) - s) * rgbw.g; T col2 = (T(1) - s) * rgbw.b; - detail::tmat4x4 result(T(1)); + detail::tmat4x4 result(T(1)); result[0][0] = col0 + s; result[0][1] = col0; result[0][2] = col0; diff --git a/test/gtx/gtx_color_space.cpp b/test/gtx/gtx_color_space.cpp index a4e909c5..fb3649e9 100644 --- a/test/gtx/gtx_color_space.cpp +++ b/test/gtx/gtx_color_space.cpp @@ -11,9 +11,20 @@ #include #include +int test_saturation() +{ + int Error(0); + + glm::vec4 Color = glm::saturation(1.0f, glm::vec4(1.0, 0.5, 0.0, 1.0)); + + return Error; +} + int main() { int Error(0); + Error += test_saturation(); + return Error; }