瀏覽代碼

Wrap tquat's, simdQuat's and simdVec4's static constants in GLM_STATIC_CONST_MEMBERS

- Also, fixed indentation
Jesse Talavera-Greenberg 10 年之前
父節點
當前提交
d1cdb46cfb
共有 7 個文件被更改,包括 94 次插入81 次删除
  1. 2 0
      glm/gtc/quaternion.hpp
  2. 50 48
      glm/gtc/quaternion.inl
  3. 2 0
      glm/gtx/simd_quat.hpp
  4. 18 17
      glm/gtx/simd_quat.inl
  5. 2 0
      glm/gtx/simd_vec4.hpp
  6. 18 16
      glm/gtx/simd_vec4.inl
  7. 2 0
      test/gtx/gtx_simd_vec4.cpp

+ 2 - 0
glm/gtc/quaternion.hpp

@@ -76,6 +76,7 @@ namespace glm
 
 
 		T x, y, z, w;
 		T x, y, z, w;
 
 
+#		ifdef GLM_STATIC_CONST_MEMBERS
 		static const type ZERO;
 		static const type ZERO;
 		static const type X;
 		static const type X;
 		static const type Y;
 		static const type Y;
@@ -92,6 +93,7 @@ namespace glm
 		static const type XZW;
 		static const type XZW;
 		static const type YZW;
 		static const type YZW;
 		static const type XYZW;
 		static const type XYZW;
+#		endif
 
 
 		// -- Component accesses --
 		// -- Component accesses --
 
 

+ 50 - 48
glm/gtc/quaternion.inl

@@ -49,69 +49,71 @@ namespace detail
 	};
 	};
 }//namespace detail
 }//namespace detail
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::ZERO =
-		tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
+#	ifdef GLM_STATIC_CONST_MEMBERS
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::ZERO =
+			tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::X =
-		tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::X =
+			tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::Y =
-		tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::Y =
+			tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::Z =
-		tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::Z =
+			tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::W =
-		tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::W =
+			tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::XY =
-		tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::XY =
+			tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::XZ =
-		tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::XZ =
+			tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::XW =
-		tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::XW =
+			tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::YZ =
-		tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::YZ =
+			tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::YW =
-		tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::YW =
+			tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::ZW =
-		tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::ZW =
+			tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::XYZ =
-		tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::XYZ =
+			tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::XYW =
-		tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::XYW =
+			tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::XZW =
-		tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::XZW =
+			tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::YZW =
-		tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::YZW =
+			tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
 
 
-template <typename T, precision P>
-const tquat<T, P> tquat<T, P>::XYZW =
-		tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
+	template <typename T, precision P>
+	const tquat<T, P> tquat<T, P>::XYZW =
+			tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
+#	endif
 	// -- Component accesses --
 	// -- Component accesses --
 
 
 #	ifdef GLM_FORCE_SIZE_FUNC
 #	ifdef GLM_FORCE_SIZE_FUNC

+ 2 - 0
glm/gtx/simd_quat.hpp

@@ -91,6 +91,7 @@ namespace detail
 		__m128 Data;
 		__m128 Data;
 #endif
 #endif
 
 
+#		ifdef GLM_STATIC_CONST_MEMBERS
 		static const type ZERO;
 		static const type ZERO;
 		static const type X;
 		static const type X;
 		static const type Y;
 		static const type Y;
@@ -107,6 +108,7 @@ namespace detail
 		static const type XZW;
 		static const type XZW;
 		static const type YZW;
 		static const type YZW;
 		static const type XYZW;
 		static const type XYZW;
+#		endif
 
 
 		//////////////////////////////////////
 		//////////////////////////////////////
 		// Implicit basic constructors
 		// Implicit basic constructors

+ 18 - 17
glm/gtx/simd_quat.inl

@@ -51,23 +51,24 @@ void print(const fvec4SIMD &v)
 }
 }
 #endif
 #endif
 
 
-const fquatSIMD fquatSIMD::ZERO = fquatSIMD(0, 0, 0, 0);
-const fquatSIMD fquatSIMD::X = fquatSIMD(0, 1, 0, 0);
-const fquatSIMD fquatSIMD::Y = fquatSIMD(0, 0, 1, 0);
-const fquatSIMD fquatSIMD::Z = fquatSIMD(0, 0, 0, 1);
-const fquatSIMD fquatSIMD::W = fquatSIMD(1, 0, 0, 0);
-const fquatSIMD fquatSIMD::XY = fquatSIMD(0, 1, 1, 0);
-const fquatSIMD fquatSIMD::XZ = fquatSIMD(0, 1, 0, 1);
-const fquatSIMD fquatSIMD::XW = fquatSIMD(1, 1, 0, 0);
-const fquatSIMD fquatSIMD::YZ = fquatSIMD(0, 0, 1, 1);
-const fquatSIMD fquatSIMD::YW = fquatSIMD(1, 0, 1, 0);
-const fquatSIMD fquatSIMD::ZW = fquatSIMD(1, 0, 0, 1);
-const fquatSIMD fquatSIMD::XYZ = fquatSIMD(0, 1, 1, 1);
-const fquatSIMD fquatSIMD::XYW = fquatSIMD(1, 1, 1, 0);
-const fquatSIMD fquatSIMD::XZW = fquatSIMD(1, 1, 0, 1);
-const fquatSIMD fquatSIMD::YZW = fquatSIMD(1, 0, 1, 1);
-const fquatSIMD fquatSIMD::XYZW = fquatSIMD(1, 1, 1, 1);
-
+#	ifdef GLM_STATIC_CONST_MEMBERS
+	const fquatSIMD fquatSIMD::ZERO = fquatSIMD(0, 0, 0, 0);
+	const fquatSIMD fquatSIMD::X = fquatSIMD(0, 1, 0, 0);
+	const fquatSIMD fquatSIMD::Y = fquatSIMD(0, 0, 1, 0);
+	const fquatSIMD fquatSIMD::Z = fquatSIMD(0, 0, 0, 1);
+	const fquatSIMD fquatSIMD::W = fquatSIMD(1, 0, 0, 0);
+	const fquatSIMD fquatSIMD::XY = fquatSIMD(0, 1, 1, 0);
+	const fquatSIMD fquatSIMD::XZ = fquatSIMD(0, 1, 0, 1);
+	const fquatSIMD fquatSIMD::XW = fquatSIMD(1, 1, 0, 0);
+	const fquatSIMD fquatSIMD::YZ = fquatSIMD(0, 0, 1, 1);
+	const fquatSIMD fquatSIMD::YW = fquatSIMD(1, 0, 1, 0);
+	const fquatSIMD fquatSIMD::ZW = fquatSIMD(1, 0, 0, 1);
+	const fquatSIMD fquatSIMD::XYZ = fquatSIMD(0, 1, 1, 1);
+	const fquatSIMD fquatSIMD::XYW = fquatSIMD(1, 1, 1, 0);
+	const fquatSIMD fquatSIMD::XZW = fquatSIMD(1, 1, 0, 1);
+	const fquatSIMD fquatSIMD::YZW = fquatSIMD(1, 0, 1, 1);
+	const fquatSIMD fquatSIMD::XYZW = fquatSIMD(1, 1, 1, 1);
+#	endif
 
 
 //////////////////////////////////////
 //////////////////////////////////////
 // Implicit basic constructors
 // Implicit basic constructors

+ 2 - 0
glm/gtx/simd_vec4.hpp

@@ -114,6 +114,7 @@ namespace detail
 		__m128 Data;
 		__m128 Data;
 #endif
 #endif
 
 
+#		ifdef GLM_STATIC_CONST_MEMBERS
 		static const type ZERO;
 		static const type ZERO;
 		static const type X;
 		static const type X;
 		static const type Y;
 		static const type Y;
@@ -130,6 +131,7 @@ namespace detail
 		static const type XZW;
 		static const type XZW;
 		static const type YZW;
 		static const type YZW;
 		static const type XYZW;
 		static const type XYZW;
+#		endif
 
 
 		//////////////////////////////////////
 		//////////////////////////////////////
 		// Implicit basic constructors
 		// Implicit basic constructors

+ 18 - 16
glm/gtx/simd_vec4.inl

@@ -16,22 +16,24 @@ struct shuffle_mask
 	enum{value = Value};
 	enum{value = Value};
 };
 };
 
 
-const fvec4SIMD fvec4SIMD::ZERO = fvec4SIMD(0, 0, 0, 0);
-const fvec4SIMD fvec4SIMD::X = fvec4SIMD(1, 0, 0, 0);
-const fvec4SIMD fvec4SIMD::Y = fvec4SIMD(0, 1, 0, 0);
-const fvec4SIMD fvec4SIMD::Z = fvec4SIMD(0, 0, 1, 0);
-const fvec4SIMD fvec4SIMD::W = fvec4SIMD(0, 0, 0, 1);
-const fvec4SIMD fvec4SIMD::XY = fvec4SIMD(1, 1, 0, 0);
-const fvec4SIMD fvec4SIMD::XZ = fvec4SIMD(1, 0, 1, 0);
-const fvec4SIMD fvec4SIMD::XW = fvec4SIMD(1, 0, 0, 1);
-const fvec4SIMD fvec4SIMD::YZ = fvec4SIMD(0, 1, 1, 0);
-const fvec4SIMD fvec4SIMD::YW = fvec4SIMD(0, 1, 0, 1);
-const fvec4SIMD fvec4SIMD::ZW = fvec4SIMD(0, 0, 1, 1);
-const fvec4SIMD fvec4SIMD::XYZ = fvec4SIMD(1, 1, 1, 0);
-const fvec4SIMD fvec4SIMD::XYW = fvec4SIMD(1, 1, 0, 1);
-const fvec4SIMD fvec4SIMD::XZW = fvec4SIMD(1, 0, 1, 1);
-const fvec4SIMD fvec4SIMD::YZW = fvec4SIMD(0, 1, 1, 1);
-const fvec4SIMD fvec4SIMD::XYZW = fvec4SIMD(1, 1, 1, 1);
+#	ifdef GLM_STATIC_CONST_MEMBERS
+	const fvec4SIMD fvec4SIMD::ZERO = fvec4SIMD(0, 0, 0, 0);
+	const fvec4SIMD fvec4SIMD::X = fvec4SIMD(1, 0, 0, 0);
+	const fvec4SIMD fvec4SIMD::Y = fvec4SIMD(0, 1, 0, 0);
+	const fvec4SIMD fvec4SIMD::Z = fvec4SIMD(0, 0, 1, 0);
+	const fvec4SIMD fvec4SIMD::W = fvec4SIMD(0, 0, 0, 1);
+	const fvec4SIMD fvec4SIMD::XY = fvec4SIMD(1, 1, 0, 0);
+	const fvec4SIMD fvec4SIMD::XZ = fvec4SIMD(1, 0, 1, 0);
+	const fvec4SIMD fvec4SIMD::XW = fvec4SIMD(1, 0, 0, 1);
+	const fvec4SIMD fvec4SIMD::YZ = fvec4SIMD(0, 1, 1, 0);
+	const fvec4SIMD fvec4SIMD::YW = fvec4SIMD(0, 1, 0, 1);
+	const fvec4SIMD fvec4SIMD::ZW = fvec4SIMD(0, 0, 1, 1);
+	const fvec4SIMD fvec4SIMD::XYZ = fvec4SIMD(1, 1, 1, 0);
+	const fvec4SIMD fvec4SIMD::XYW = fvec4SIMD(1, 1, 0, 1);
+	const fvec4SIMD fvec4SIMD::XZW = fvec4SIMD(1, 0, 1, 1);
+	const fvec4SIMD fvec4SIMD::YZW = fvec4SIMD(0, 1, 1, 1);
+	const fvec4SIMD fvec4SIMD::XYZW = fvec4SIMD(1, 1, 1, 1);
+#	endif
 
 
 //////////////////////////////////////
 //////////////////////////////////////
 // Implicit basic constructors
 // Implicit basic constructors

+ 2 - 0
test/gtx/gtx_simd_vec4.cpp

@@ -29,6 +29,8 @@
 /// @author Christophe Riccio
 /// @author Christophe Riccio
 ///////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////
 
 
+#define GLM_STATIC_CONST_MEMBERS
+
 #include <glm/glm.hpp>
 #include <glm/glm.hpp>
 #include <glm/gtx/simd_vec4.hpp>
 #include <glm/gtx/simd_vec4.hpp>
 #include <cstdio>
 #include <cstdio>