Updated GTC_color

This commit is contained in:
Christophe Riccio 2015-02-12 21:21:50 +01:00
parent 3ea110b44d
commit 387df50459
3 changed files with 12 additions and 12 deletions

View File

@ -61,19 +61,19 @@ namespace glm
/// Convert a RGB color to sRGB color using a standard gamma correction /// Convert a RGB color to sRGB color using a standard gamma correction
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> rgbToSrgb(vecType<T, P> const & ColorRGB); GLM_FUNC_DECL vecType<T, P> convertRgbToSrgb(vecType<T, P> const & ColorRGB);
/// Convert a RGB color to sRGB color using a custom gamma correction /// Convert a RGB color to sRGB color using a custom gamma correction
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> rgbToSrgb(vecType<T, P> const & ColorRGB, T Gamma); GLM_FUNC_DECL vecType<T, P> convertRgbToSrgb(vecType<T, P> const & ColorRGB, T Gamma);
/// Convert a sRGB color to RGB color using a standard gamma correction /// Convert a sRGB color to RGB color using a standard gamma correction
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> srgbToRgb(vecType<T, P> const & ColorSRGB); GLM_FUNC_DECL vecType<T, P> convertSrgbToRgb(vecType<T, P> const & ColorSRGB);
/// Convert a sRGB color to RGB color using a custom gamma correction /// Convert a sRGB color to RGB color using a custom gamma correction
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> srgbToRgb(vecType<T, P> const & ColorSRGB, T Gamma); GLM_FUNC_DECL vecType<T, P> convertSrgbToRgb(vecType<T, P> const & ColorSRGB, T Gamma);
/// @} /// @}
} //namespace glm } //namespace glm

View File

@ -79,25 +79,25 @@ namespace detail
}//namespace detail }//namespace detail
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> rgbToSrgb(vecType<T, P> const & ColorRGB) GLM_FUNC_QUALIFIER vecType<T, P> convertRgbToSrgb(vecType<T, P> const & ColorRGB)
{ {
return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorRGB, static_cast<T>(0.41666)); return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorRGB, static_cast<T>(0.41666));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> rgbToSrgb(vecType<T, P> const & ColorRGB, T Gamma) GLM_FUNC_QUALIFIER vecType<T, P> convertRgbToSrgb(vecType<T, P> const & ColorRGB, T Gamma)
{ {
return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorRGB, static_cast<T>(1) / Gamma); return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorRGB, static_cast<T>(1) / Gamma);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> srgbToRgb(vecType<T, P> const & ColorSRGB) GLM_FUNC_QUALIFIER vecType<T, P> convertSrgbToRgb(vecType<T, P> const & ColorSRGB)
{ {
return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4)); return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> srgbToRgb(vecType<T, P> const & ColorSRGB, T Gamma) GLM_FUNC_QUALIFIER vecType<T, P> convertSrgbToRgb(vecType<T, P> const & ColorSRGB, T Gamma)
{ {
return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, Gamma); return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, Gamma);
} }

View File

@ -42,14 +42,14 @@ namespace srgb
glm::vec4 const ColorSourceRGB(1.0, 0.5, 0.0, 1.0); glm::vec4 const ColorSourceRGB(1.0, 0.5, 0.0, 1.0);
{ {
glm::vec4 const ColorSRGB = glm::rgbToSrgb(ColorSourceRGB); glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB);
glm::vec4 const ColorRGB = glm::srgbToRgb(ColorSRGB); glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB);
Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1; Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1;
} }
{ {
glm::vec4 const ColorSRGB = glm::rgbToSrgb(ColorSourceRGB, 2.8f); glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB, 2.8f);
glm::vec4 const ColorRGB = glm::srgbToRgb(ColorSRGB, 2.8f); glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB, 2.8f);
Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1; Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1;
} }