From d4019aab407f26ed5d0365f3148d9955c3885e3a Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 20 Nov 2016 21:50:12 +0100 Subject: [PATCH] Moved color_encoding to experimental --- glm/ext.hpp | 2 +- glm/{gtc => gtx}/color_encoding.hpp | 20 +++++++------- glm/{gtc => gtx}/color_encoding.inl | 33 +++++------------------- readme.md | 2 +- test/gtc/CMakeLists.txt | 1 - test/gtc/gtc_packing.cpp | 17 ------------ test/gtx/CMakeLists.txt | 1 + test/{gtc => gtx}/gtc_color_encoding.cpp | 0 8 files changed, 20 insertions(+), 56 deletions(-) rename glm/{gtc => gtx}/color_encoding.hpp (75%) rename glm/{gtc => gtx}/color_encoding.inl (73%) rename test/{gtc => gtx}/gtc_color_encoding.cpp (100%) diff --git a/glm/ext.hpp b/glm/ext.hpp index c385a79b..9dedc01c 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -35,7 +35,6 @@ #endif//GLM_MESSAGES #include "./gtc/bitfield.hpp" -#include "./gtc/color_encoding.hpp" #include "./gtc/color_space.hpp" #include "./gtc/constants.hpp" #include "./gtc/epsilon.hpp" @@ -64,6 +63,7 @@ #include "./gtx/associated_min_max.hpp" #include "./gtx/bit.hpp" #include "./gtx/closest_point.hpp" +#include "./gtx/color_encoding.hpp" #include "./gtx/color_space.hpp" #include "./gtx/color_space_YCoCg.hpp" #include "./gtx/compatibility.hpp" diff --git a/glm/gtc/color_encoding.hpp b/glm/gtx/color_encoding.hpp similarity index 75% rename from glm/gtc/color_encoding.hpp rename to glm/gtx/color_encoding.hpp index 0ff5fdcb..9537ecd1 100644 --- a/glm/gtc/color_encoding.hpp +++ b/glm/gtx/color_encoding.hpp @@ -1,11 +1,11 @@ -/// @ref gtc_color_encoding -/// @file glm/gtc/color_encoding.hpp +/// @ref gtx_color_encoding +/// @file glm/gtx/color_encoding.hpp /// /// @see core (dependence) -/// @see gtc_color_encoding (dependence) +/// @see gtx_color_encoding (dependence) /// -/// @defgroup gtc_color_encoding GLM_GTC_color_encoding -/// @ingroup gtc +/// @defgroup gtx_color_encoding GLM_GTX_color_encoding +/// @ingroup gtx /// /// @brief Allow to perform bit operations on integer values /// @@ -25,21 +25,21 @@ namespace glm { - /// @addtogroup gtc_color_encoding + /// @addtogroup gtx_color_encoding /// @{ /// Convert a linear sRGB color to D65 YUV. template GLM_FUNC_DECL tvec3 convertLinearSRGBToD65XYZ(tvec3 const& ColorLinearSRGB); + /// Convert a linear sRGB color to D50 YUV. + template + GLM_FUNC_DECL tvec3 convertLinearSRGBToD50XYZ(tvec3 const& ColorLinearSRGB); + /// Convert a D65 YUV color to linear sRGB. template GLM_FUNC_DECL tvec3 convertD65XYZToLinearSRGB(tvec3 const& ColorD65XYZ); - /// Convert a D50 YUV color to D65 YUV. - template - GLM_FUNC_DECL tvec3 convertD50XYZToD65XYZ(tvec3 const& ColorD50XYZ); - /// Convert a D65 YUV color to D50 YUV. template GLM_FUNC_DECL tvec3 convertD65XYZToD50XYZ(tvec3 const& ColorD65XYZ); diff --git a/glm/gtc/color_encoding.inl b/glm/gtx/color_encoding.inl similarity index 73% rename from glm/gtc/color_encoding.inl rename to glm/gtx/color_encoding.inl index ca5044f8..c5ed2cd1 100644 --- a/glm/gtc/color_encoding.inl +++ b/glm/gtx/color_encoding.inl @@ -1,5 +1,5 @@ -/// @ref gtc_color_encoding -/// @file glm/gtc/color_encoding.inl +/// @ref gtx_color_encoding +/// @file glm/gtx/color_encoding.inl namespace glm { @@ -13,16 +13,6 @@ namespace glm return (M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB) * static_cast(5.650675255693055f); } - template - GLM_FUNC_QUALIFIER tvec3 convertD65XYZToLinearSRGB(tvec3 const& ColorD65XYZ) - { - tvec3 const M(0.41847f, -0.091169f, 0.0009209f); - tvec3 const N(-0.15866f, 0.25243f, 0.015708f); - tvec3 const O(0.0009209f, -0.0025498f, 0.1786f); - - return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; - } - template GLM_FUNC_QUALIFIER tvec3 convertLinearSRGBToD50XYZ(tvec3 const& ColorLinearSRGB) { @@ -34,13 +24,13 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 convertD50XYZToLinearSRGB(tvec3 const& ColorD50XYZ) + GLM_FUNC_QUALIFIER tvec3 convertD65XYZToLinearSRGB(tvec3 const& ColorD65XYZ) { - tvec3 const M(); - tvec3 const N(); - tvec3 const O(); + tvec3 const M(0.41847f, -0.091169f, 0.0009209f); + tvec3 const N(-0.15866f, 0.25243f, 0.015708f); + tvec3 const O(0.0009209f, -0.0025498f, 0.1786f); - return M * ColorD50XYZ + N * ColorD50XYZ + O * ColorD50XYZ; + return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; } template @@ -53,13 +43,4 @@ namespace glm return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; } - template - GLM_FUNC_QUALIFIER tvec3 convertD50XYZToD65XYZ(tvec3 const& ColorD50XYZ) - { - tvec3 const M(); - tvec3 const N(); - tvec3 const O(); - - return M * ColorD50XYZ + N * ColorD50XYZ + O * ColorD50XYZ; - } }//namespace glm diff --git a/readme.md b/readme.md index 39b90aba..b4ade7c7 100644 --- a/readme.md +++ b/readme.md @@ -55,7 +55,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ### [GLM 0.9.9.0](https://github.com/g-truc/glm/releases/latest) - 2017-XX-XX #### Features: - Added RGBM encoding in GTC_packing #420 -- Added GTC_color_encoding extension +- Added GTX_color_encoding extension - Added GTX_vec_swizzle, faster compile time swizzling then swizzle operator #558 - Added [GLM_ENABLE_EXPERIMENTAL](manual.md#section7_4) to enable experimental features. diff --git a/test/gtc/CMakeLists.txt b/test/gtc/CMakeLists.txt index 56b2f13a..ab26247a 100644 --- a/test/gtc/CMakeLists.txt +++ b/test/gtc/CMakeLists.txt @@ -1,5 +1,4 @@ glmCreateTestGTC(gtc_bitfield) -glmCreateTestGTC(gtc_color_encoding) glmCreateTestGTC(gtc_color_space) glmCreateTestGTC(gtc_constants) glmCreateTestGTC(gtc_epsilon) diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp index 368c46d2..fdb8ad59 100644 --- a/test/gtc/gtc_packing.cpp +++ b/test/gtc/gtc_packing.cpp @@ -174,13 +174,6 @@ int test_Snorm3x10_1x2() glm::uint32 p1 = glm::packSnorm3x10_1x2(v0); glm::vec4 v1 = glm::unpackSnorm3x10_1x2(p1); -<<<<<<< HEAD -======= - printf("Snorm3x10_1x2: p0: %x; v0: %3.2f, %3.2f, %3.2f, %3.2f; p1: %x; v1: %3.2f, %3.2f, %3.2f, %3.2f\n", - p0, v0.x, v0.y, v0.z, v0.w, - p1, v1.x, v1.y, v1.z, v1.w); - ->>>>>>> 0.9.8 Error += glm::all(glm::epsilonEqual(v0, v1, 0.01f)) ? 0 : 1; } @@ -206,13 +199,6 @@ int test_Unorm3x10_1x2() glm::uint32 p1 = glm::packUnorm3x10_1x2(v0); glm::vec4 v1 = glm::unpackUnorm3x10_1x2(p1); -<<<<<<< HEAD -======= - printf("Unorm3x10_1x2: p0: %x; v0: %3.2f, %3.2f, %3.2f, %3.2f; p1: %x; v1: %3.2f, %3.2f, %3.2f, %3.2f\n", - p0, v0.x, v0.y, v0.z, v0.w, - p1, v1.x, v1.y, v1.z, v1.w); - ->>>>>>> 0.9.8 Error += glm::all(glm::epsilonEqual(v0, v1, 0.001f)) ? 0 : 1; } @@ -705,10 +691,7 @@ int main() Error += test_F3x9_E1x5(); Error += test_RGBM(); Error += test_Unorm3x10_1x2(); -<<<<<<< HEAD Error += test_Snorm3x10_1x2(); -======= ->>>>>>> 0.9.8 Error += test_I3x10_1x2(); Error += test_U3x10_1x2(); diff --git a/test/gtx/CMakeLists.txt b/test/gtx/CMakeLists.txt index 23b92813..a2731f80 100644 --- a/test/gtx/CMakeLists.txt +++ b/test/gtx/CMakeLists.txt @@ -1,5 +1,6 @@ glmCreateTestGTC(gtx_associated_min_max) glmCreateTestGTC(gtx_closest_point) +glmCreateTestGTC(gtx_color_encoding) glmCreateTestGTC(gtx_color_space_YCoCg) glmCreateTestGTC(gtx_color_space) glmCreateTestGTC(gtx_common) diff --git a/test/gtc/gtc_color_encoding.cpp b/test/gtx/gtc_color_encoding.cpp similarity index 100% rename from test/gtc/gtc_color_encoding.cpp rename to test/gtx/gtc_color_encoding.cpp