Przeglądaj źródła

Fixed GTX_color_space - saturation #195

Christophe Riccio 11 lat temu
rodzic
commit
d77bfa1a70
3 zmienionych plików z 17 dodań i 6 usunięć
  1. 2 2
      glm/gtx/color_space.hpp
  2. 4 4
      glm/gtx/color_space.inl
  3. 11 0
      test/gtx/gtx_color_space.cpp

+ 2 - 2
glm/gtx/color_space.hpp

@@ -64,8 +64,8 @@ namespace glm
 		
 	/// Build a saturation matrix.
 	/// @see gtx_color_space
-	template <typename T, precision P>
-	GLM_FUNC_DECL detail::tmat4x4<T, P> saturation(
+	template <typename T>
+	GLM_FUNC_DECL detail::tmat4x4<T, defaultp> saturation(
 		T const s);
 
 	/// Modify the saturation of a color.

+ 4 - 4
glm/gtx/color_space.inl

@@ -106,16 +106,16 @@ namespace glm
 		return hsv;
 	}
 
-	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> saturation(const T s)
+	template <typename T>
+	GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> saturation(T const s)
 	{
-		detail::tvec3<T, P> rgbw = detail::tvec3<T, P>(T(0.2126), T(0.7152), T(0.0722));
+		detail::tvec3<T, defaultp> rgbw = detail::tvec3<T, defaultp>(T(0.2126), T(0.7152), T(0.0722));
 
 		T col0 = (T(1) - s) * rgbw.r;
 		T col1 = (T(1) - s) * rgbw.g;
 		T col2 = (T(1) - s) * rgbw.b;
 
-		detail::tmat4x4<T, P> result(T(1));
+		detail::tmat4x4<T, defaultp> result(T(1));
 		result[0][0] = col0 + s;
 		result[0][1] = col0;
 		result[0][2] = col0;

+ 11 - 0
test/gtx/gtx_color_space.cpp

@@ -11,9 +11,20 @@
 #include <glm/gtc/type_precision.hpp>
 #include <glm/gtx/color_space.hpp>
 
+int test_saturation()
+{
+	int Error(0);
+	
+	glm::vec4 Color = glm::saturation(1.0f, glm::vec4(1.0, 0.5, 0.0, 1.0));
+
+	return Error;
+}
+
 int main()
 {
 	int Error(0);
 
+	Error += test_saturation();
+
 	return Error;
 }