Browse Source

Fixed GTX_easying clang warnings

Christophe Riccio 7 years ago
parent
commit
e2b75b6bf7
2 changed files with 13 additions and 14 deletions
  1. 3 0
      glm/gtx/easing.hpp
  2. 10 14
      glm/gtx/easing.inl

+ 3 - 0
glm/gtx/easing.hpp

@@ -185,16 +185,19 @@ namespace glm{
 	template <typename genType>
 	template <typename genType>
 	GLM_FUNC_DECL genType backEaseInOut(genType const& a);
 	GLM_FUNC_DECL genType backEaseInOut(genType const& a);
 
 
+	/// @param a parameter
 	/// @param o Optional overshoot modifier
 	/// @param o Optional overshoot modifier
 	/// @see gtx_easing
 	/// @see gtx_easing
 	template <typename genType>
 	template <typename genType>
 	GLM_FUNC_DECL genType backEaseIn(genType const& a, genType const& o);
 	GLM_FUNC_DECL genType backEaseIn(genType const& a, genType const& o);
 
 
+	/// @param a parameter
 	/// @param o Optional overshoot modifier
 	/// @param o Optional overshoot modifier
 	/// @see gtx_easing
 	/// @see gtx_easing
 	template <typename genType>
 	template <typename genType>
 	GLM_FUNC_DECL genType backEaseOut(genType const& a, genType const& o);
 	GLM_FUNC_DECL genType backEaseOut(genType const& a, genType const& o);
 
 
+	/// @param a parameter
 	/// @param o Optional overshoot modifier
 	/// @param o Optional overshoot modifier
 	/// @see gtx_easing
 	/// @see gtx_easing
 	template <typename genType>
 	template <typename genType>

+ 10 - 14
glm/gtx/easing.inl

@@ -119,7 +119,7 @@ namespace glm{
 		assert(a >= zero<genType>());
 		assert(a >= zero<genType>());
 		assert(a <= one<genType>());
 		assert(a <= one<genType>());
 
 
-		if (a < static_cast<genType>(0.5))
+		if(a < static_cast<genType>(0.5))
 		{
 		{
 			return static_cast<genType>(8) * a * a * a * a;
 			return static_cast<genType>(8) * a * a * a * a;
 		}
 		}
@@ -158,7 +158,7 @@ namespace glm{
 		assert(a >= zero<genType>());
 		assert(a >= zero<genType>());
 		assert(a <= one<genType>());
 		assert(a <= one<genType>());
 
 
-		if (a < static_cast<genType>(0.5))
+		if(a < static_cast<genType>(0.5))
 		{
 		{
 			return static_cast<genType>(16) * a * a * a * a * a;
 			return static_cast<genType>(16) * a * a * a * a * a;
 		}
 		}
@@ -243,7 +243,10 @@ namespace glm{
 		assert(a >= zero<genType>());
 		assert(a >= zero<genType>());
 		assert(a <= one<genType>());
 		assert(a <= one<genType>());
 
 
-		return (a == zero<genType>()) ? a : pow<genType>(static_cast<genType>(2), static_cast<genType>(10) * (a - one<genType>()));
+		if(a <= zero<genType>())
+			return a;
+		else
+			return pow<genType>(static_cast<genType>(2), static_cast<genType>(10) * (a - one<genType>()));
 	}
 	}
 
 
 	template <typename genType>
 	template <typename genType>
@@ -253,7 +256,10 @@ namespace glm{
 		assert(a >= zero<genType>());
 		assert(a >= zero<genType>());
 		assert(a <= one<genType>());
 		assert(a <= one<genType>());
 
 
-		return (a == one<genType>()) ? a : one<genType>() - pow<genType>(static_cast<genType>(2), -static_cast<genType>(10) * a);
+		if(a >= one<genType>())
+			return a;
+		else
+			return one<genType>() - pow<genType>(static_cast<genType>(2), -static_cast<genType>(10) * a);
 	}
 	}
 
 
 	template <typename genType>
 	template <typename genType>
@@ -263,16 +269,10 @@ namespace glm{
 		assert(a >= zero<genType>());
 		assert(a >= zero<genType>());
 		assert(a <= one<genType>());
 		assert(a <= one<genType>());
 
 
-		if(a == zero<genType>() || a == one<genType>()) return a;
-		
 		if(a < static_cast<genType>(0.5))
 		if(a < static_cast<genType>(0.5))
-		{
 			return static_cast<genType>(0.5) * pow<genType>(static_cast<genType>(2), (static_cast<genType>(20) * a) - static_cast<genType>(10));
 			return static_cast<genType>(0.5) * pow<genType>(static_cast<genType>(2), (static_cast<genType>(20) * a) - static_cast<genType>(10));
-		}
 		else
 		else
-		{
 			return -static_cast<genType>(0.5) * pow<genType>(static_cast<genType>(2), (-static_cast<genType>(20) * a) + static_cast<genType>(10)) + one<genType>();
 			return -static_cast<genType>(0.5) * pow<genType>(static_cast<genType>(2), (-static_cast<genType>(20) * a) + static_cast<genType>(10)) + one<genType>();
-		}
 	}
 	}
 
 
 	template <typename genType>
 	template <typename genType>
@@ -303,13 +303,9 @@ namespace glm{
 		assert(a <= one<genType>());
 		assert(a <= one<genType>());
 
 
 		if(a < static_cast<genType>(0.5))
 		if(a < static_cast<genType>(0.5))
-		{
 			return static_cast<genType>(0.5) * sin(static_cast<genType>(13) * half_pi<genType>() * (static_cast<genType>(2) * a)) * pow<genType>(static_cast<genType>(2), static_cast<genType>(10) * ((static_cast<genType>(2) * a) - one<genType>()));
 			return static_cast<genType>(0.5) * sin(static_cast<genType>(13) * half_pi<genType>() * (static_cast<genType>(2) * a)) * pow<genType>(static_cast<genType>(2), static_cast<genType>(10) * ((static_cast<genType>(2) * a) - one<genType>()));
-		}
 		else
 		else
-		{
 			return static_cast<genType>(0.5) * (sin(-static_cast<genType>(13) * half_pi<genType>() * ((static_cast<genType>(2) * a - one<genType>()) + one<genType>())) * pow<genType>(static_cast<genType>(2), -static_cast<genType>(10) * (static_cast<genType>(2) * a - one<genType>())) + static_cast<genType>(2));
 			return static_cast<genType>(0.5) * (sin(-static_cast<genType>(13) * half_pi<genType>() * ((static_cast<genType>(2) * a - one<genType>()) + one<genType>())) * pow<genType>(static_cast<genType>(2), -static_cast<genType>(10) * (static_cast<genType>(2) * a - one<genType>())) + static_cast<genType>(2));
-		}
 	}
 	}
 
 
 	template <typename genType>
 	template <typename genType>