Browse Source

Added GLM_META_PROG_HELPERS #350

Christophe Riccio 10 years ago
parent
commit
38c9cd6cba

+ 13 - 11
glm/detail/type_mat2x2.hpp

@@ -54,17 +54,19 @@ namespace glm
 		template <typename U, precision Q>
 		template <typename U, precision Q>
 		friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);
 		friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 2;
-		static GLM_CONSTEXPR length_t cols = 2;
-		static GLM_CONSTEXPR length_t rows = 2;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 2;
-		static const length_t cols = 2;
-		static const length_t rows = 2;
-		static const precision prec = P;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 2;
+				static GLM_CONSTEXPR length_t columns = 2;
+				static GLM_CONSTEXPR length_t rows = 2;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 2;
+				static const length_t columns = 2;
+				static const length_t rows = 2;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL

+ 13 - 11
glm/detail/type_mat2x3.hpp

@@ -50,17 +50,19 @@ namespace glm
 		typedef tmat3x2<T, P> transpose_type;
 		typedef tmat3x2<T, P> transpose_type;
 		typedef T value_type;
 		typedef T value_type;
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 2;
-		static GLM_CONSTEXPR length_t cols = 3;
-		static GLM_CONSTEXPR length_t rows = 2;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 2;
-		static const length_t cols = 3;
-		static const length_t rows = 2;
-		static const precision prec = P;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 2;
+				static GLM_CONSTEXPR length_t cols = 3;
+				static GLM_CONSTEXPR length_t rows = 2;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 2;
+				static const length_t cols = 3;
+				static const length_t rows = 2;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL

+ 13 - 11
glm/detail/type_mat2x4.hpp

@@ -50,17 +50,19 @@ namespace glm
 		typedef tmat4x2<T, P> transpose_type;
 		typedef tmat4x2<T, P> transpose_type;
 		typedef T value_type;
 		typedef T value_type;
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 2;
-		static GLM_CONSTEXPR length_t cols = 4;
-		static GLM_CONSTEXPR length_t rows = 2;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 2;
-		static const length_t cols = 4;
-		static const length_t rows = 2;
-		static const precision prec = P;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 2;
+				static GLM_CONSTEXPR length_t cols = 4;
+				static GLM_CONSTEXPR length_t rows = 2;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 2;
+				static const length_t cols = 4;
+				static const length_t rows = 2;
+				static const precision prec = P;
+#			endif
+#		endif//GLM_META_PROG_HELPERS
 
 
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL

+ 13 - 11
glm/detail/type_mat3x2.hpp

@@ -50,17 +50,19 @@ namespace glm
 		typedef tmat2x3<T, P> transpose_type;
 		typedef tmat2x3<T, P> transpose_type;
 		typedef T value_type;
 		typedef T value_type;
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 3;
-		static GLM_CONSTEXPR length_t cols = 2;
-		static GLM_CONSTEXPR length_t rows = 3;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 3;
-		static const length_t cols = 2;
-		static const length_t rows = 3;
-		static const precision prec = P;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 3;
+				static GLM_CONSTEXPR length_t cols = 2;
+				static GLM_CONSTEXPR length_t rows = 3;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 3;
+				static const length_t cols = 2;
+				static const length_t rows = 3;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL

+ 13 - 11
glm/detail/type_mat3x4.hpp

@@ -50,17 +50,19 @@ namespace glm
 		typedef tmat4x3<T, P> transpose_type;
 		typedef tmat4x3<T, P> transpose_type;
 		typedef T value_type;
 		typedef T value_type;
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 3;
-		static GLM_CONSTEXPR length_t cols = 4;
-		static GLM_CONSTEXPR length_t rows = 3;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 3;
-		static const length_t cols = 4;
-		static const length_t rows = 3;
-		static const precision prec = P;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 3;
+				static GLM_CONSTEXPR length_t cols = 4;
+				static GLM_CONSTEXPR length_t rows = 3;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 3;
+				static const length_t cols = 4;
+				static const length_t rows = 3;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL

+ 13 - 11
glm/detail/type_mat4x2.hpp

@@ -50,17 +50,19 @@ namespace glm
 		typedef tmat2x4<T, P> transpose_type;
 		typedef tmat2x4<T, P> transpose_type;
 		typedef T value_type;
 		typedef T value_type;
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 4;
-		static GLM_CONSTEXPR length_t cols = 2;
-		static GLM_CONSTEXPR length_t rows = 4;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 4;
-		static const length_t cols = 2;
-		static const length_t rows = 4;
-		static const precision prec = P;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 4;
+				static GLM_CONSTEXPR length_t cols = 2;
+				static GLM_CONSTEXPR length_t rows = 4;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 4;
+				static const length_t cols = 2;
+				static const length_t rows = 4;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 	private:
 	private:
 		/// @cond DETAIL
 		/// @cond DETAIL

+ 13 - 11
glm/detail/type_mat4x3.hpp

@@ -50,17 +50,19 @@ namespace glm
 		typedef tmat3x4<T, P> transpose_type;
 		typedef tmat3x4<T, P> transpose_type;
 		typedef T value_type;
 		typedef T value_type;
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 4;
-		static GLM_CONSTEXPR length_t cols = 3;
-		static GLM_CONSTEXPR length_t rows = 4;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 4;
-		static const length_t cols = 3;
-		static const length_t rows = 4;
-		static const precision prec = P;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 4;
+				static GLM_CONSTEXPR length_t cols = 3;
+				static GLM_CONSTEXPR length_t rows = 4;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 4;
+				static const length_t cols = 3;
+				static const length_t rows = 4;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 	private:
 	private:
 		// Data
 		// Data

+ 13 - 11
glm/detail/type_mat4x4.hpp

@@ -49,17 +49,19 @@ namespace glm
 		typedef tmat4x4<T, P> transpose_type;
 		typedef tmat4x4<T, P> transpose_type;
 		typedef T value_type;
 		typedef T value_type;
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 4;
-		static GLM_CONSTEXPR length_t cols = 4;
-		static GLM_CONSTEXPR length_t rows = 4;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 4;
-		static const length_t cols = 4;
-		static const length_t rows = 4;
-		static const precision prec = P;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 4;
+				static GLM_CONSTEXPR length_t cols = 4;
+				static GLM_CONSTEXPR length_t rows = 4;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 4;
+				static const length_t cols = 4;
+				static const length_t rows = 4;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 		template <typename U, precision Q>
 		template <typename U, precision Q>
 		friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
 		friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);

+ 11 - 7
glm/detail/type_vec1.hpp

@@ -54,13 +54,17 @@ namespace glm
 		typedef tvec1<T, P> type;
 		typedef tvec1<T, P> type;
 		typedef tvec1<bool, P> bool_type;
 		typedef tvec1<bool, P> bool_type;
 		typedef T value_type;
 		typedef T value_type;
-#   if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 1;
-		static GLM_CONSTEXPR precision prec = P;
-#   else
-		static const length_t components = 1;
-		static const precision prec = P;
-#   endif
+
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 1;
+				static GLM_CONSTEXPR precision precision = P;
+#			else
+				static const length_t components = 1;
+				static const precision precision = P;
+#			endif
+#		endif//GLM_META_PROG_HELPERS
+
 		//////////////////////////////////////
 		//////////////////////////////////////
 		// Data
 		// Data
 
 

+ 10 - 7
glm/detail/type_vec2.hpp

@@ -54,13 +54,16 @@ namespace glm
 		typedef tvec2<T, P> type;
 		typedef tvec2<T, P> type;
 		typedef tvec2<bool, P> bool_type;
 		typedef tvec2<bool, P> bool_type;
 		typedef T value_type;
 		typedef T value_type;
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 2;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 2;
-		static const precision prec = P;
-#		endif
+
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 2;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 2;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 		//////////////////////////////////////
 		//////////////////////////////////////
 		// Data
 		// Data

+ 10 - 7
glm/detail/type_vec3.hpp

@@ -54,13 +54,16 @@ namespace glm
 		typedef tvec3<T, P> type;
 		typedef tvec3<T, P> type;
 		typedef tvec3<bool, P> bool_type;
 		typedef tvec3<bool, P> bool_type;
 		typedef T value_type;
 		typedef T value_type;
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 3;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 3;
-		static const precision prec = P;
-#		endif
+
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 3;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 3;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 		//////////////////////////////////////
 		//////////////////////////////////////
 		// Data
 		// Data

+ 10 - 7
glm/detail/type_vec4.hpp

@@ -108,13 +108,16 @@ namespace detail
 		typedef tvec4<T, P> type;
 		typedef tvec4<T, P> type;
 		typedef tvec4<bool, P> bool_type;
 		typedef tvec4<bool, P> bool_type;
 		typedef T value_type;
 		typedef T value_type;
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 4;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 4;
-		static const precision prec = P;
-#		endif
+
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 4;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 4;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 		//////////////////////////////////////
 		//////////////////////////////////////
 		// Data
 		// Data

+ 10 - 7
glm/gtc/quaternion.hpp

@@ -64,13 +64,16 @@ namespace glm
 	{
 	{
 		typedef tquat<T, P> type;
 		typedef tquat<T, P> type;
 		typedef T value_type;
 		typedef T value_type;
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 4;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 4;
-		static const precision prec = P;
-#		endif
+
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 4;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 4;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 	public:
 	public:
 		T x, y, z, w;
 		T x, y, z, w;

+ 10 - 7
glm/gtx/dual_quaternion.hpp

@@ -63,13 +63,16 @@ namespace glm
 	{
 	{
 		typedef T value_type;
 		typedef T value_type;
 		typedef glm::tquat<T, P> part_type;
 		typedef glm::tquat<T, P> part_type;
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 8;
-		static GLM_CONSTEXPR precision prec = P;
-#		else
-		static const length_t components = 8;
-		static const precision prec = P;
-#		endif
+
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 8;
+				static GLM_CONSTEXPR precision prec = P;
+#			else
+				static const length_t components = 8;
+				static const precision prec = P;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 	public:
 	public:
 		glm::tquat<T, P> real, dual;
 		glm::tquat<T, P> real, dual;

+ 13 - 11
glm/gtx/simd_mat4.hpp

@@ -71,17 +71,19 @@ namespace detail
 		typedef fmat4x4SIMD type;
 		typedef fmat4x4SIMD type;
 		typedef fmat4x4SIMD transpose_type;
 		typedef fmat4x4SIMD transpose_type;
 
 
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 4;
-		static GLM_CONSTEXPR length_t cols = 4;
-		static GLM_CONSTEXPR length_t rows = 4;
-		static GLM_CONSTEXPR precision prec = defaultp;
-#		else
-		static const length_t components = 4;
-		static const length_t cols = 4;
-		static const length_t rows = 4;
-		static const precision prec = defaultp;
-#		endif
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 4;
+				static GLM_CONSTEXPR length_t cols = 4;
+				static GLM_CONSTEXPR length_t rows = 4;
+				static GLM_CONSTEXPR precision prec = defaultp;
+#			else
+				static const length_t components = 4;
+				static const length_t cols = 4;
+				static const length_t rows = 4;
+				static const precision prec = defaultp;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 		GLM_FUNC_DECL length_t length() const;
 		GLM_FUNC_DECL length_t length() const;
 
 

+ 10 - 7
glm/gtx/simd_quat.hpp

@@ -75,13 +75,16 @@ namespace detail
 
 
 		typedef fquatSIMD type;
 		typedef fquatSIMD type;
 		typedef tquat<bool, defaultp> bool_type;
 		typedef tquat<bool, defaultp> bool_type;
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 4;
-		static GLM_CONSTEXPR precision prec = defaultp;
-#		else
-		static const length_t components = 4;
-		static const precision prec = defaultp;
-#		endif
+
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 4;
+				static GLM_CONSTEXPR precision prec = defaultp;
+#			else
+				static const length_t components = 4;
+				static const precision prec = defaultp;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
 		union
 		union

+ 10 - 7
glm/gtx/simd_vec4.hpp

@@ -98,13 +98,16 @@ namespace detail
 
 
 		typedef fvec4SIMD type;
 		typedef fvec4SIMD type;
 		typedef tvec4<bool, highp> bool_type;
 		typedef tvec4<bool, highp> bool_type;
-#		if GLM_HAS_CONSTEXPR
-		static GLM_CONSTEXPR length_t components = 4;
-		static GLM_CONSTEXPR precision prec = defaultp;
-#		else
-		static const length_t components = 4;
-		static const precision prec = defaultp;
-#		endif
+
+#		if GLM_META_PROG_HELPERS
+#			if GLM_HAS_CONSTEXPR
+				static GLM_CONSTEXPR length_t components = 4;
+				static GLM_CONSTEXPR precision prec = defaultp;
+#			else
+				static const length_t components = 4;
+				static const precision prec = defaultp;
+#			endif//GLM_HAS_CONSTEXPR
+#		endif//GLM_META_PROG_HELPERS
 
 
 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
 		union
 		union

+ 1 - 0
readme.md

@@ -58,6 +58,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
 - Added functions eulerAngleXYZ and extractEulerAngleXYZ #311
 - Added functions eulerAngleXYZ and extractEulerAngleXYZ #311
 - Added <glm/gtx/hash.hpp> to perform std::hash on GLM types #320
 - Added <glm/gtx/hash.hpp> to perform std::hash on GLM types #320
 - Added <glm/gtx/wrap.hpp> for texcoord wrapping
 - Added <glm/gtx/wrap.hpp> for texcoord wrapping
+- Added static components and precision members to all vector and quat types #350
 
 
 ##### Improvements:
 ##### Improvements:
 - Changed usage of __has_include to support Intel compiler #307
 - Changed usage of __has_include to support Intel compiler #307