From 3ea110b44d46f8684f795331882ac29997d47ea7 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 11 Feb 2015 00:14:17 +0100 Subject: [PATCH] Added GTC_color documentation --- glm/gtc/color.hpp | 4 ++++ glm/gtc/color.inl | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/glm/gtc/color.hpp b/glm/gtc/color.hpp index 1d3872ca..c560d256 100644 --- a/glm/gtc/color.hpp +++ b/glm/gtc/color.hpp @@ -59,15 +59,19 @@ namespace glm /// @addtogroup gtc_color /// @{ + /// Convert a RGB color to sRGB color using a standard gamma correction template class vecType> GLM_FUNC_DECL vecType rgbToSrgb(vecType const & ColorRGB); + /// Convert a RGB color to sRGB color using a custom gamma correction template class vecType> GLM_FUNC_DECL vecType rgbToSrgb(vecType const & ColorRGB, T Gamma); + /// Convert a sRGB color to RGB color using a standard gamma correction template class vecType> GLM_FUNC_DECL vecType srgbToRgb(vecType const & ColorSRGB); + /// Convert a sRGB color to RGB color using a custom gamma correction template class vecType> GLM_FUNC_DECL vecType srgbToRgb(vecType const & ColorSRGB, T Gamma); diff --git a/glm/gtc/color.inl b/glm/gtc/color.inl index 69df4296..11cb931d 100644 --- a/glm/gtc/color.inl +++ b/glm/gtc/color.inl @@ -36,12 +36,12 @@ namespace detail template class vecType> struct compute_rgbToSrgb { - GLM_FUNC_QUALIFIER static vecType call(vecType const & ColorRGB, T InverseGamma) + GLM_FUNC_QUALIFIER static vecType call(vecType const & ColorRGB, T GammaCorrection) { vecType const ClampedColor(clamp(ColorRGB, static_cast(0), static_cast(1))); return mix( - pow(ClampedColor, vecType(InverseGamma)) * static_cast(1.055) - static_cast(0.055), + pow(ClampedColor, vecType(GammaCorrection)) * static_cast(1.055) - static_cast(0.055), ClampedColor * static_cast(12.92), lessThan(ClampedColor, vecType(static_cast(0.0031308)))); } @@ -50,9 +50,9 @@ namespace detail template struct compute_rgbToSrgb { - GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & ColorRGB, T InverseGamma) + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & ColorRGB, T GammaCorrection) { - return tvec4(compute_rgbToSrgb::call(tvec3(ColorRGB), InverseGamma), ColorRGB.a); + return tvec4(compute_rgbToSrgb::call(tvec3(ColorRGB), GammaCorrection), ColorRGB.a); } };