Renamed GTC_color to GTC_color_space

This commit is contained in:
Christophe Riccio 2015-08-01 21:55:28 +02:00
parent d6ae2fd694
commit 5437d49cf2
5 changed files with 38 additions and 42 deletions

View File

@ -24,15 +24,15 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE. /// THE SOFTWARE.
/// ///
/// @ref gtc_color /// @ref gtc_color_space
/// @file glm/gtc/color.hpp /// @file glm/gtc/color_space.hpp
/// @date 2015-02-10 / 2015-02-10 /// @date 2015-02-10 / 2015-08-02
/// @author Christophe Riccio /// @author Christophe Riccio
/// ///
/// @see core (dependence) /// @see core (dependence)
/// @see gtc_color (dependence) /// @see gtc_color_space (dependence)
/// ///
/// @defgroup gtc_color GLM_GTC_color /// @defgroup gtc_color_space GLM_GTC_color_space
/// @ingroup gtc /// @ingroup gtc
/// ///
/// @brief Allow to perform bit operations on integer values /// @brief Allow to perform bit operations on integer values
@ -51,31 +51,31 @@
#include <limits> #include <limits>
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_color extension included") # pragma message("GLM: GLM_GTC_color_space extension included")
#endif #endif
namespace glm namespace glm
{ {
/// @addtogroup gtc_color /// @addtogroup gtc_color_space
/// @{ /// @{
/// Convert a RGB color to sRGB color using a standard gamma correction /// Convert a linear 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> convertRgbToSrgb(vecType<T, P> const & ColorRGB); GLM_FUNC_DECL vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear);
/// Convert a RGB color to sRGB color using a custom gamma correction /// Convert a linear 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> convertRgbToSrgb(vecType<T, P> const & ColorRGB, T Gamma); GLM_FUNC_DECL vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear, T Gamma);
/// Convert a sRGB color to RGB color using a standard gamma correction /// Convert a sRGB color to linear 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> convertSrgbToRgb(vecType<T, P> const & ColorSRGB); GLM_FUNC_DECL vecType<T, P> convertSRGBToLinear(vecType<T, P> const & ColorSRGB);
/// Convert a sRGB color to RGB color using a custom gamma correction /// Convert a sRGB color to linear 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> convertSrgbToRgb(vecType<T, P> const & ColorSRGB, T Gamma); GLM_FUNC_DECL vecType<T, P> convertSRGBToLinear(vecType<T, P> const & ColorSRGB, T Gamma);
/// @} /// @}
} //namespace glm } //namespace glm
#include "color.inl" #include "color_space.inl"

View File

@ -24,9 +24,9 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE. /// THE SOFTWARE.
/// ///
/// @ref gtc_color /// @ref gtc_color_space
/// @file glm/gtc/color.inl /// @file glm/gtc/color_space.inl
/// @date 2015-02-10 / 2015-02-10 /// @date 2015-02-10 / 2015-08-02
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
@ -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> convertRgbToSrgb(vecType<T, P> const & ColorRGB) GLM_FUNC_QUALIFIER vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear)
{ {
return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorRGB, static_cast<T>(0.41666)); return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorLinear, 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> convertRgbToSrgb(vecType<T, P> const & ColorRGB, T Gamma) GLM_FUNC_QUALIFIER vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear, T Gamma)
{ {
return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorRGB, static_cast<T>(1) / Gamma); return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorLinear, 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> convertSrgbToRgb(vecType<T, P> const & ColorSRGB) GLM_FUNC_QUALIFIER vecType<T, P> convertSRGBToLinear(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> convertSrgbToRgb(vecType<T, P> const & ColorSRGB, T Gamma) GLM_FUNC_QUALIFIER vecType<T, P> convertSRGBToLinear(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

@ -50,9 +50,9 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
## Release notes ## Release notes
#### GLM 0.9.7.0 - 2015-XX-XX #### GLM 0.9.7.0 - 2015-08-02
##### Features: ##### Features:
- Added GTC_color: convertRgbToSrgb and convertSrgbToRgb functions - Added GTC_color_space: convertLinearToSRGB and convertSRGBToLinear functions
- Added 'fmod' overload to GTX_common with tests #308 - Added 'fmod' overload to GTX_common with tests #308
- Left handed perspective and lookAt functions #314 - Left handed perspective and lookAt functions #314
- Added functions eulerAngleXYZ and extractEulerAngleXYZ #311 - Added functions eulerAngleXYZ and extractEulerAngleXYZ #311
@ -71,6 +71,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Updated list of compiler versions - Updated list of compiler versions
##### Fixes: ##### Fixes:
- Fixed default precision for quat and dual_quat type #312
- Fixed (u)int64 MSB/LSB handling on BE archs #306 - Fixed (u)int64 MSB/LSB handling on BE archs #306
- Fixed multi-line comment warning in g++. #315 - Fixed multi-line comment warning in g++. #315
- Fixed specifier removal by 'std::make_pair<>' #333 - Fixed specifier removal by 'std::make_pair<>' #333
@ -87,11 +88,6 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Removed integer specification for 'mod' in GTC_integer #308 - Removed integer specification for 'mod' in GTC_integer #308
- Removed GTX_multiple, replaced by GTC_round - Removed GTX_multiple, replaced by GTC_round
--------------------------------------------------------------------------------
#### GLM 0.9.6.4 - 2015-0X-XX
##### Fixes:
- Fixed default precision for quat and dual_quat type #312
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
#### [GLM 0.9.6.3 - 2015-02-15](https://github.com/g-truc/glm/releases/tag/0.9.6.3) #### [GLM 0.9.6.3 - 2015-02-15](https://github.com/g-truc/glm/releases/tag/0.9.6.3)
- Fixed Android doesn't have C++ 11 STL #284 - Fixed Android doesn't have C++ 11 STL #284

View File

@ -1,5 +1,5 @@
glmCreateTestGTC(gtc_bitfield) glmCreateTestGTC(gtc_bitfield)
glmCreateTestGTC(gtc_color) glmCreateTestGTC(gtc_color_space)
glmCreateTestGTC(gtc_constants) glmCreateTestGTC(gtc_constants)
glmCreateTestGTC(gtc_epsilon) glmCreateTestGTC(gtc_epsilon)
glmCreateTestGTC(gtc_integer) glmCreateTestGTC(gtc_integer)

View File

@ -29,7 +29,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtc/color.hpp> #include <glm/gtc/color_space.hpp>
#include <glm/gtc/epsilon.hpp> #include <glm/gtc/epsilon.hpp>
#include <glm/gtc/constants.hpp> #include <glm/gtc/constants.hpp>
@ -42,28 +42,28 @@ namespace srgb
glm::vec3 const ColorSourceRGB(1.0, 0.5, 0.0); glm::vec3 const ColorSourceRGB(1.0, 0.5, 0.0);
{ {
glm::vec3 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB); glm::vec3 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceRGB);
glm::vec3 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB); glm::vec3 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB);
Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1; Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1;
} }
{ {
glm::vec3 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB, 2.8f); glm::vec3 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceRGB, 2.8f);
glm::vec3 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB, 2.8f); glm::vec3 const ColorRGB = glm::convertSRGBToLinear(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;
} }
glm::vec4 const ColorSourceRGBA(1.0, 0.5, 0.0, 1.0); glm::vec4 const ColorSourceRGBA(1.0, 0.5, 0.0, 1.0);
{ {
glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGBA); glm::vec4 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceRGBA);
glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB); glm::vec4 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB);
Error += glm::all(glm::epsilonEqual(ColorSourceRGBA, ColorRGB, 0.00001f)) ? 0 : 1; Error += glm::all(glm::epsilonEqual(ColorSourceRGBA, ColorRGB, 0.00001f)) ? 0 : 1;
} }
{ {
glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGBA, 2.8f); glm::vec4 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceRGBA, 2.8f);
glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB, 2.8f); glm::vec4 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB, 2.8f);
Error += glm::all(glm::epsilonEqual(ColorSourceRGBA, ColorRGB, 0.00001f)) ? 0 : 1; Error += glm::all(glm::epsilonEqual(ColorSourceRGBA, ColorRGB, 0.00001f)) ? 0 : 1;
} }