瀏覽代碼

Reduced dependencies

Christophe Riccio 7 年之前
父節點
當前提交
6543cc9ad1
共有 6 個文件被更改,包括 65 次插入64 次删除
  1. 1 2
      glm/ext/matrix_clip_space.hpp
  2. 0 27
      glm/ext/quaternion_transform.hpp
  3. 0 34
      glm/ext/quaternion_transform.inl
  4. 26 0
      glm/gtc/quaternion.hpp
  5. 35 0
      glm/gtc/quaternion.inl
  6. 3 1
      readme.md

+ 1 - 2
glm/ext/matrix_clip_space.hpp

@@ -19,10 +19,9 @@
 #pragma once
 
 // Dependencies
-#include "../gtc/constants.hpp"
+#include "../ext/scalar_constants.hpp"
 #include "../geometric.hpp"
 #include "../trigonometric.hpp"
-#include "../matrix.hpp"
 
 #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
 #	pragma message("GLM: GLM_EXT_matrix_clip_space extension included")

+ 0 - 27
glm/ext/quaternion_transform.hpp

@@ -38,33 +38,6 @@ namespace glm
 	/// @see ext_quaternion_transform
 	template<typename T, qualifier Q>
 	GLM_FUNC_DECL qua<T, Q> rotate(qua<T, Q> const& q, T const& angle, vec<3, T, Q> const& axis);
-
-	/// Build a look at quaternion based on the default handedness.
-	///
-	/// @param direction Desired forward direction. Needs to be normalized.
-	/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
-	template<typename T, qualifier Q>
-	GLM_FUNC_DECL qua<T, Q> quatLookAt(
-		vec<3, T, Q> const& direction,
-		vec<3, T, Q> const& up);
-
-	/// Build a right-handed look at quaternion.
-	///
-	/// @param direction Desired forward direction onto which the -z-axis gets mapped. Needs to be normalized.
-	/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
-	template<typename T, qualifier Q>
-	GLM_FUNC_DECL qua<T, Q> quatLookAtRH(
-		vec<3, T, Q> const& direction,
-		vec<3, T, Q> const& up);
-
-	/// Build a left-handed look at quaternion.
-	///
-	/// @param direction Desired forward direction onto which the +z-axis gets mapped. Needs to be normalized.
-	/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
-	template<typename T, qualifier Q>
-	GLM_FUNC_DECL qua<T, Q> quatLookAtLH(
-		vec<3, T, Q> const& direction,
-		vec<3, T, Q> const& up);
 	/// @}
 } //namespace glm
 

+ 0 - 34
glm/ext/quaternion_transform.inl

@@ -20,39 +20,5 @@ namespace glm
 
 		return q * qua<T, Q>(cos(AngleRad * static_cast<T>(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
 	}
-
-	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER qua<T, Q> quatLookAt(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
-	{
-#		if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
-			return quatLookAtLH(direction, up);
-#		else
-			return quatLookAtRH(direction, up);
-# 		endif
-	}
-
-	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtRH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
-	{
-		mat<3, 3, T, Q> Result;
-
-		Result[2] = -direction;
-		Result[0] = normalize(cross(up, Result[2]));
-		Result[1] = cross(Result[2], Result[0]);
-
-		return quat_cast(Result);
-	}
-
-	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtLH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
-	{
-		mat<3, 3, T, Q> Result;
-
-		Result[2] = direction;
-		Result[0] = normalize(cross(up, Result[2]));
-		Result[1] = cross(Result[2], Result[0]);
-
-		return quat_cast(Result);
-	}
 }//namespace glm
 

+ 26 - 0
glm/gtc/quaternion.hpp

@@ -152,6 +152,32 @@ namespace glm
 	template<typename T, qualifier Q>
 	GLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(qua<T, Q> const& x, qua<T, Q> const& y);
 
+	/// Build a look at quaternion based on the default handedness.
+	///
+	/// @param direction Desired forward direction. Needs to be normalized.
+	/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
+	template<typename T, qualifier Q>
+	GLM_FUNC_DECL qua<T, Q> quatLookAt(
+		vec<3, T, Q> const& direction,
+		vec<3, T, Q> const& up);
+
+	/// Build a right-handed look at quaternion.
+	///
+	/// @param direction Desired forward direction onto which the -z-axis gets mapped. Needs to be normalized.
+	/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
+	template<typename T, qualifier Q>
+	GLM_FUNC_DECL qua<T, Q> quatLookAtRH(
+		vec<3, T, Q> const& direction,
+		vec<3, T, Q> const& up);
+
+	/// Build a left-handed look at quaternion.
+	///
+	/// @param direction Desired forward direction onto which the +z-axis gets mapped. Needs to be normalized.
+	/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
+	template<typename T, qualifier Q>
+	GLM_FUNC_DECL qua<T, Q> quatLookAtLH(
+		vec<3, T, Q> const& direction,
+		vec<3, T, Q> const& up);
 	/// @}
 } //namespace glm
 

+ 35 - 0
glm/gtc/quaternion.inl

@@ -157,6 +157,41 @@ namespace glm
 			Result[i] = x[i] >= y[i];
 		return Result;
 	}
+
+
+	template<typename T, qualifier Q>
+	GLM_FUNC_QUALIFIER qua<T, Q> quatLookAt(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
+	{
+#		if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
+			return quatLookAtLH(direction, up);
+#		else
+			return quatLookAtRH(direction, up);
+# 		endif
+	}
+
+	template<typename T, qualifier Q>
+	GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtRH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
+	{
+		mat<3, 3, T, Q> Result;
+
+		Result[2] = -direction;
+		Result[0] = normalize(cross(up, Result[2]));
+		Result[1] = cross(Result[2], Result[0]);
+
+		return quat_cast(Result);
+	}
+
+	template<typename T, qualifier Q>
+	GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtLH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
+	{
+		mat<3, 3, T, Q> Result;
+
+		Result[2] = direction;
+		Result[0] = normalize(cross(up, Result[2]));
+		Result[1] = cross(Result[2], Result[0]);
+
+		return quat_cast(Result);
+	}
 }//namespace glm
 
 #if GLM_CONFIG_SIMD == GLM_ENABLE

+ 3 - 1
readme.md

@@ -65,9 +65,11 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
 - Redesigned constexpr support which excludes both SIMD and constexpr #783
 - Added detection of Visual C++ 2017 toolsets
 - Added identity functions #765
-- Split headers to improve compilation time #670
+- Splitted headers into EXT extensions to improve compilation time #670
+- Added separated performance tests
 
 #### Fixes:
+- Fixed SIMD detection on Clang and GCC
 - Fixed build problems due to printf and std::clock_t #778
 - Fixed int mod
 - Anonymous unions require C++ language extensions