Browse Source

Add static constants to quat, simdVec4, and simdQuat

- No tests, though
Jesse Talavera-Greenberg 10 years ago
parent
commit
a92ed0cdf5
6 changed files with 148 additions and 0 deletions
  1. 17 0
      glm/gtc/quaternion.hpp
  2. 63 0
      glm/gtc/quaternion.inl
  3. 17 0
      glm/gtx/simd_quat.hpp
  4. 17 0
      glm/gtx/simd_quat.inl
  5. 17 0
      glm/gtx/simd_vec4.hpp
  6. 17 0
      glm/gtx/simd_vec4.inl

+ 17 - 0
glm/gtc/quaternion.hpp

@@ -76,6 +76,23 @@ namespace glm
 
 		T x, y, z, w;
 
+		static const type ZERO;
+		static const type X;
+		static const type Y;
+		static const type Z;
+		static const type W;
+		static const type XY;
+		static const type XZ;
+		static const type XW;
+		static const type YZ;
+		static const type YW;
+		static const type ZW;
+		static const type XYZ;
+		static const type XYW;
+		static const type XZW;
+		static const type YZW;
+		static const type XYZW;
+
 		// -- Component accesses --
 
 #		ifdef GLM_FORCE_SIZE_FUNC

+ 63 - 0
glm/gtc/quaternion.inl

@@ -49,6 +49,69 @@ 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));
+
+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>::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>::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>::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>::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>::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>::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>::XYZW =
+		tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
 	// -- Component accesses --
 
 #	ifdef GLM_FORCE_SIZE_FUNC

+ 17 - 0
glm/gtx/simd_quat.hpp

@@ -91,6 +91,23 @@ namespace detail
 		__m128 Data;
 #endif
 
+		static const type ZERO;
+		static const type X;
+		static const type Y;
+		static const type Z;
+		static const type W;
+		static const type XY;
+		static const type XZ;
+		static const type XW;
+		static const type YZ;
+		static const type YW;
+		static const type ZW;
+		static const type XYZ;
+		static const type XYW;
+		static const type XZW;
+		static const type YZW;
+		static const type XYZW;
+
 		//////////////////////////////////////
 		// Implicit basic constructors
 

+ 17 - 0
glm/gtx/simd_quat.inl

@@ -51,6 +51,23 @@ void print(const fvec4SIMD &v)
 }
 #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);
+
 
 //////////////////////////////////////
 // Implicit basic constructors

+ 17 - 0
glm/gtx/simd_vec4.hpp

@@ -114,6 +114,23 @@ namespace detail
 		__m128 Data;
 #endif
 
+		static const type ZERO;
+		static const type X;
+		static const type Y;
+		static const type Z;
+		static const type W;
+		static const type XY;
+		static const type XZ;
+		static const type XW;
+		static const type YZ;
+		static const type YW;
+		static const type ZW;
+		static const type XYZ;
+		static const type XYW;
+		static const type XZW;
+		static const type YZW;
+		static const type XYZW;
+
 		//////////////////////////////////////
 		// Implicit basic constructors
 

+ 17 - 0
glm/gtx/simd_vec4.inl

@@ -16,6 +16,23 @@ struct shuffle_mask
 	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);
+
 //////////////////////////////////////
 // Implicit basic constructors