mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 17:04:35 +00:00
Updated GTC_color
This commit is contained in:
parent
3ea110b44d
commit
387df50459
@ -61,19 +61,19 @@ namespace glm
|
||||
|
||||
/// Convert a RGB color to sRGB color using a standard gamma correction
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
@ -79,25 +79,25 @@ namespace detail
|
||||
}//namespace detail
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ namespace srgb
|
||||
glm::vec4 const ColorSourceRGB(1.0, 0.5, 0.0, 1.0);
|
||||
|
||||
{
|
||||
glm::vec4 const ColorSRGB = glm::rgbToSrgb(ColorSourceRGB);
|
||||
glm::vec4 const ColorRGB = glm::srgbToRgb(ColorSRGB);
|
||||
glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB);
|
||||
glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB);
|
||||
Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec4 const ColorSRGB = glm::rgbToSrgb(ColorSourceRGB, 2.8f);
|
||||
glm::vec4 const ColorRGB = glm::srgbToRgb(ColorSRGB, 2.8f);
|
||||
glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB, 2.8f);
|
||||
glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB, 2.8f);
|
||||
Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user