Browse Source

Moved color_encoding to experimental

Christophe Riccio 9 years ago
parent
commit
d4019aab40

+ 1 - 1
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"

+ 10 - 10
glm/gtc/color_encoding.hpp → 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,20 +25,20 @@
 
 namespace glm
 {
-	/// @addtogroup gtc_color_encoding
+	/// @addtogroup gtx_color_encoding
 	/// @{
 
 	/// Convert a linear sRGB color to D65 YUV.
 	template <typename T, precision P>
 	GLM_FUNC_DECL tvec3<T, P> convertLinearSRGBToD65XYZ(tvec3<T, P> const& ColorLinearSRGB);
 
-	/// Convert a D65 YUV color to linear sRGB.
+	/// Convert a linear sRGB color to D50 YUV.
 	template <typename T, precision P>
-	GLM_FUNC_DECL tvec3<T, P> convertD65XYZToLinearSRGB(tvec3<T, P> const& ColorD65XYZ);
+	GLM_FUNC_DECL tvec3<T, P> convertLinearSRGBToD50XYZ(tvec3<T, P> const& ColorLinearSRGB);
 
-	/// Convert a D50 YUV color to D65 YUV.
+	/// Convert a D65 YUV color to linear sRGB.
 	template <typename T, precision P>
-	GLM_FUNC_DECL tvec3<T, P> convertD50XYZToD65XYZ(tvec3<T, P> const& ColorD50XYZ);
+	GLM_FUNC_DECL tvec3<T, P> convertD65XYZToLinearSRGB(tvec3<T, P> const& ColorD65XYZ);
 
 	/// Convert a D65 YUV color to D50 YUV.
 	template <typename T, precision P>

+ 7 - 26
glm/gtc/color_encoding.inl → 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<T>(5.650675255693055f);
 	}
 
-	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec3<T, P> convertD65XYZToLinearSRGB(tvec3<T, P> const& ColorD65XYZ)
-	{
-		tvec3<T, P> const M(0.41847f, -0.091169f, 0.0009209f);
-		tvec3<T, P> const N(-0.15866f, 0.25243f, 0.015708f);
-		tvec3<T, P> const O(0.0009209f, -0.0025498f, 0.1786f);
-
-		return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
-	}
-
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec3<T, P> convertLinearSRGBToD50XYZ(tvec3<T, P> const& ColorLinearSRGB)
 	{
@@ -34,13 +24,13 @@ namespace glm
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec3<T, P> convertD50XYZToLinearSRGB(tvec3<T, P> const& ColorD50XYZ)
+	GLM_FUNC_QUALIFIER tvec3<T, P> convertD65XYZToLinearSRGB(tvec3<T, P> const& ColorD65XYZ)
 	{
-		tvec3<T, P> const M();
-		tvec3<T, P> const N();
-		tvec3<T, P> const O();
+		tvec3<T, P> const M(0.41847f, -0.091169f, 0.0009209f);
+		tvec3<T, P> const N(-0.15866f, 0.25243f, 0.015708f);
+		tvec3<T, P> const O(0.0009209f, -0.0025498f, 0.1786f);
 
-		return M * ColorD50XYZ + N * ColorD50XYZ + O * ColorD50XYZ;
+		return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
 	}
 
 	template <typename T, precision P>
@@ -53,13 +43,4 @@ namespace glm
 		return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
 	}
 
-	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tvec3<T, P> convertD50XYZToD65XYZ(tvec3<T, P> const& ColorD50XYZ)
-	{
-		tvec3<T, P> const M();
-		tvec3<T, P> const N();
-		tvec3<T, P> const O();
-
-		return M * ColorD50XYZ + N * ColorD50XYZ + O * ColorD50XYZ;
-	}
 }//namespace glm

+ 1 - 1
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.
 

+ 0 - 1
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)

+ 0 - 17
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();

+ 1 - 0
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)

+ 0 - 0
test/gtc/gtc_color_encoding.cpp → test/gtx/gtc_color_encoding.cpp