diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 0f94256f..92ff1582 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -29,6 +29,7 @@ #pragma once #include +#include /////////////////////////////////////////////////////////////////////////////////////////////////// // Version @@ -761,7 +762,8 @@ namespace glm { -#if defined(GLM_FORCE_SIZE_T_LENGTH) + typedef std::size_t size_t; +#if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC) typedef std::size_t length_t; #else typedef int length_t; diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 4a21ec7a..aedb8f7f 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -47,7 +47,11 @@ namespace glm typedef tmat2x2 type; typedef tmat2x2 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC template friend tvec2 operator/(tmat2x2 const & m, tvec2 const & v); diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index b016d9c7..b3639c71 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -46,8 +46,19 @@ namespace detail } }//namespace detail +#if GLM_FORCE_SIZE_FUNC template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2::length() const {return 2;} + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x2::size() const + { + return 2; + } +#else + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2::length() const + { + return 2; + } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 69bf8619..9c215f1b 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -48,7 +48,11 @@ namespace glm typedef tmat2x3 type; typedef tmat3x2 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC private: // Data diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index b97c2ce7..b5001b92 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x3::size() const + { + return 2; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x3::length() const { return 2; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 5eb9bcf5..ece80ae5 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -48,7 +48,11 @@ namespace glm typedef tmat2x4 type; typedef tmat4x2 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC private: // Data diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 5d441942..ab955988 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat2x4::size() const + { + return 2; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x4::length() const { return 2; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 52d42beb..6317d07b 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -48,7 +48,11 @@ namespace glm typedef tmat3x2 type; typedef tmat2x3 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC private: // Data diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 468a6e65..c689b5f8 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x2::size() const + { + return 3; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x2::length() const { return 3; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index ec0e4b4f..cd3342d5 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -47,7 +47,11 @@ namespace glm typedef tmat3x3 type; typedef tmat3x3 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC template friend tvec3 operator/(tmat3x3 const & m, tvec3 const & v); diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index 823cae80..3caf07f0 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -52,11 +52,19 @@ namespace detail } }//namespace detail +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x3::size() const + { + return 3; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x3::length() const { return 3; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index a3d793b5..301766bd 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -42,13 +42,17 @@ namespace glm { enum ctor{_null}; typedef T value_type; - typedef std::size_t size_type; + typedef size_t size_type; typedef tvec4 col_type; typedef tvec3 row_type; typedef tmat3x4 type; typedef tmat4x3 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC private: // Data diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 8365da0d..4003eb8e 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat3x4::size() const + { + return 3; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x4::length() const { return 3; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 61c99443..bb071030 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -48,7 +48,11 @@ namespace glm typedef tmat4x2 type; typedef tmat2x4 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC private: // Data diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index cb20ec18..d75cf0a1 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x2::size() const + { + return 4; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x2::length() const { return 4; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 2524a81f..acc7c4d3 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -48,7 +48,11 @@ namespace glm typedef tmat4x3 type; typedef tmat3x4 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC private: // Data diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index 1ec2ee45..40d84684 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x3::size() const + { + return 4; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x3::length() const { return 4; } +#endif ////////////////////////////////////// // Accesses @@ -699,4 +707,3 @@ namespace glm return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]); } } //namespace glm - diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index f31b41b4..a52b413e 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -47,7 +47,11 @@ namespace glm typedef tmat4x4 type; typedef tmat4x4 transpose_type; +#if GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC template friend tvec4 operator/(tmat4x4 const & m, tvec4 const & v); diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 4796c886..329300ca 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -88,11 +88,19 @@ namespace detail } }//namespace detail +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tmat4x4::size() const + { + return 4; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x4::length() const { return 4; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 26bc6944..64be0cc1 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -56,7 +56,13 @@ namespace glm ////////////////////////////////////// // Helper +#if GLM_FORCE_SIZE_FUNC + /// Return the count of components of the vector + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else + /// Return the count of components of the vector GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC ////////////////////////////////////// // Data diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 609de806..5ffd4c8f 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec1::size() const + { + return 1; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec1::length() const { return 1; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 43dfb3a3..aada46e1 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -57,7 +57,13 @@ namespace glm ////////////////////////////////////// // Helper +#if GLM_FORCE_SIZE_FUNC + /// Return the count of components of the vector + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else + /// Return the count of components of the vector GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC ////////////////////////////////////// // Data diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 8935fae3..a2994de2 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec2::size() const + { + return 2; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec2::length() const { return 2; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index e8196ed6..d073ba3c 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -57,7 +57,13 @@ namespace glm ////////////////////////////////////// // Helper +#if GLM_FORCE_SIZE_FUNC + /// Return the count of components of the vector + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else + /// Return the count of components of the vector GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC ////////////////////////////////////// // Data diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 145db7c2..dd137fe9 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec3::size() const + { + return 3; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec3::length() const { return 3; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index a40edd1a..42dc5f2f 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -80,7 +80,13 @@ namespace glm ////////////////////////////////////// // Helper +#if GLM_FORCE_SIZE_FUNC + /// Return the count of components of the vector + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else + /// Return the count of components of the vector GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC ////////////////////////////////////// // Data diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 39032092..8a94b05b 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -28,11 +28,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tvec4::size() const + { + return 4; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec4::length() const { return 4; } +#endif ////////////////////////////////////// // Accesses diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index ddb83734..6ac9812d 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -66,7 +66,13 @@ namespace glm public: T x, y, z, w; +#if GLM_FORCE_SIZE_FUNC + /// Return the count of components of a quaternion + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else + /// Return the count of components of a quaternion GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC // Constructors GLM_FUNC_DECL tquat(); diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 26a7c27b..484dc5ed 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -45,11 +45,19 @@ namespace detail }; }//namespace detail +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tquat::size() const + { + return 4; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tquat::length() const { return 4; } +#endif template GLM_FUNC_QUALIFIER tquat::tquat() : diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 5cd41b05..78a812d9 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -64,7 +64,13 @@ namespace glm public: glm::tquat real, dual; +#if GLM_FORCE_SIZE_FUNC + /// Return the count of components of a dual quaternion + GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; +#else + /// Return the count of components of a dual quaternion GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; +#endif//GLM_FORCE_SIZE_FUNC // Constructors GLM_FUNC_DECL tdualquat(); diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 8bf0f982..7d54e064 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -31,11 +31,19 @@ namespace glm { +#if GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR size_t tdualquat::size() const + { + return 8; + } +#else template GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tdualquat::length() const { return 8; } +#endif template GLM_FUNC_QUALIFIER tdualquat::tdualquat() : diff --git a/glm/gtx/rotate_vector.hpp b/glm/gtx/rotate_vector.hpp index d6b4b7f1..4fe09c81 100644 --- a/glm/gtx/rotate_vector.hpp +++ b/glm/gtx/rotate_vector.hpp @@ -57,7 +57,7 @@ namespace glm /// @param y A second vector /// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1]. /// - /// @see gtc_quaternion + /// @see gtx_rotate_vector template GLM_FUNC_DECL tvec3 slerp( tvec3 const & x, diff --git a/readme.txt b/readme.txt index 73666135..5fbc234b 100644 --- a/readme.txt +++ b/readme.txt @@ -60,6 +60,7 @@ GLM 0.9.6.0: 2014-XX-XX - Added GTX_range for C++ 11 compiler only #240 - Added Added closestPointOnLine function for tvec2 to GTX_closest_point #238 - Moved template types from 'detail' to 'glm' namespace #239, #244 +- Added GLM_FORCE_SIZE_FUNC to replace .length() by .size() #245 ================================================================================ GLM 0.9.5.4: 2014-06-21