From 38c9cd6cbac73fcf48e261df702c7bfc9ca78294 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 19 Jul 2015 00:25:33 +0200 Subject: [PATCH] Added GLM_META_PROG_HELPERS #350 --- glm/detail/type_mat2x2.hpp | 24 +++++++++++++----------- glm/detail/type_mat2x3.hpp | 24 +++++++++++++----------- glm/detail/type_mat2x4.hpp | 24 +++++++++++++----------- glm/detail/type_mat3x2.hpp | 24 +++++++++++++----------- glm/detail/type_mat3x4.hpp | 24 +++++++++++++----------- glm/detail/type_mat4x2.hpp | 24 +++++++++++++----------- glm/detail/type_mat4x3.hpp | 24 +++++++++++++----------- glm/detail/type_mat4x4.hpp | 24 +++++++++++++----------- glm/detail/type_vec1.hpp | 18 +++++++++++------- glm/detail/type_vec2.hpp | 17 ++++++++++------- glm/detail/type_vec3.hpp | 17 ++++++++++------- glm/detail/type_vec4.hpp | 17 ++++++++++------- glm/gtc/quaternion.hpp | 17 ++++++++++------- glm/gtx/dual_quaternion.hpp | 17 ++++++++++------- glm/gtx/simd_mat4.hpp | 24 +++++++++++++----------- glm/gtx/simd_quat.hpp | 17 ++++++++++------- glm/gtx/simd_vec4.hpp | 17 ++++++++++------- readme.md | 1 + 18 files changed, 199 insertions(+), 155 deletions(-) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index c2bc2b40..f3ea0f9e 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -54,17 +54,19 @@ namespace glm template friend tvec2 operator/(tvec2 const & v, tmat2x2 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: /// @cond DETAIL diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 5057ae46..cbd88424 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -50,17 +50,19 @@ namespace glm typedef tmat3x2 transpose_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: /// @cond DETAIL diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 7f682112..3deb880d 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -50,17 +50,19 @@ namespace glm typedef tmat4x2 transpose_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: /// @cond DETAIL diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index ab27b01f..69feddcf 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -50,17 +50,19 @@ namespace glm typedef tmat2x3 transpose_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: /// @cond DETAIL diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index c372fb27..193d48f9 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -50,17 +50,19 @@ namespace glm typedef tmat4x3 transpose_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: /// @cond DETAIL diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index d78b9f4d..8fb47a1b 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -50,17 +50,19 @@ namespace glm typedef tmat2x4 transpose_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: /// @cond DETAIL diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index f93f5c87..d5502baa 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -50,17 +50,19 @@ namespace glm typedef tmat3x4 transpose_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: // Data diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index 6e68f6f7..682a1f87 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -49,17 +49,19 @@ namespace glm typedef tmat4x4 transpose_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 friend tvec4 operator/(tmat4x4 const & m, tvec4 const & v); diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index f5d9d6c3..500a3ccb 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -54,13 +54,17 @@ namespace glm typedef tvec1 type; typedef tvec1 bool_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 diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 8b2a8ba6..0c4f0663 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -54,13 +54,16 @@ namespace glm typedef tvec2 type; typedef tvec2 bool_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 diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 2aef6ef7..a010e5d0 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -54,13 +54,16 @@ namespace glm typedef tvec3 type; typedef tvec3 bool_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 diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 31ae1a8d..574596a5 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -108,13 +108,16 @@ namespace detail typedef tvec4 type; typedef tvec4 bool_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 diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index a50e31b3..bb2c4494 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -64,13 +64,16 @@ namespace glm { typedef tquat 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: T x, y, z, w; diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 392a0005..87349caa 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -63,13 +63,16 @@ namespace glm { typedef T value_type; typedef glm::tquat 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: glm::tquat real, dual; diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index 3334dc53..0a81fd40 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -71,17 +71,19 @@ namespace detail typedef fmat4x4SIMD 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; diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index 3f0e05f3..600d49f7 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -75,13 +75,16 @@ namespace detail typedef fquatSIMD type; typedef tquat 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 union diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index 3958f2ce..27352c53 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -98,13 +98,16 @@ namespace detail typedef fvec4SIMD type; typedef tvec4 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 union diff --git a/readme.md b/readme.md index dd1f44a3..3fd18b07 100644 --- a/readme.md +++ b/readme.md @@ -58,6 +58,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Added functions eulerAngleXYZ and extractEulerAngleXYZ #311 - Added to perform std::hash on GLM types #320 - Added for texcoord wrapping +- Added static components and precision members to all vector and quat types #350 ##### Improvements: - Changed usage of __has_include to support Intel compiler #307