diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 4d86b72a..3ec4ed19 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -24,6 +24,14 @@ namespace glm col_type value[2]; public: + // -- Accesses -- + + typedef length_t length_type; + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; } + + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; + // -- Constructors -- GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; @@ -66,14 +74,6 @@ namespace glm GLM_FUNC_DECL GLM_EXPLICIT mat(mat<3, 4, T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x); - // -- Accesses -- - - typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 2;} - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; - // -- Unary arithmetic operators -- GLM_FUNC_DECL mat<2, 2, T, P> & operator=(mat<2, 2, T, P> const & v) GLM_DEFAULT; diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 01eb777a..bcaae3bd 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -25,6 +25,14 @@ namespace glm col_type value[2]; public: + // -- Accesses -- + + typedef length_t length_type; + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; } + + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; + // -- Constructors -- GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; @@ -67,14 +75,6 @@ namespace glm GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x); - // -- Accesses -- - - typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 2;} - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; - // -- Unary arithmetic operators -- GLM_FUNC_DECL mat<2, 3, T, P> & operator=(mat<2, 3, T, P> const & m) GLM_DEFAULT; diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index cfe61f4e..dc4d2087 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -25,6 +25,14 @@ namespace glm col_type value[2]; public: + // -- Accesses -- + + typedef length_t length_type; + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; } + + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; + // -- Constructors -- GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; @@ -69,14 +77,6 @@ namespace glm GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x); - // -- Accesses -- - - typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 2;} - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; - // -- Unary arithmetic operators -- GLM_FUNC_DECL mat<2, 4, T, P> & operator=(mat<2, 4, T, P> const & m) GLM_DEFAULT; diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index f738dc60..a488c970 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -25,6 +25,14 @@ namespace glm col_type value[3]; public: + // -- Accesses -- + + typedef length_t length_type; + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; } + + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; + // -- Constructors -- GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; @@ -74,14 +82,6 @@ namespace glm GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x); - // -- Accesses -- - - typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 3;} - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; - // -- Unary arithmetic operators -- GLM_FUNC_DECL mat<3, 2, T, P> & operator=(mat<3, 2, T, P> const & m) GLM_DEFAULT; diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 1a9f3365..6e7f70e4 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -24,6 +24,14 @@ namespace glm col_type value[3]; public: + // -- Accesses -- + + typedef length_t length_type; + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; } + + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; + // -- Constructors -- GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; @@ -73,14 +81,6 @@ namespace glm GLM_FUNC_DECL GLM_EXPLICIT mat(mat<3, 4, T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x); - // -- Accesses -- - - typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 3;} - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; - // -- Unary arithmetic operators -- GLM_FUNC_DECL mat<3, 3, T, P> & operator=(mat<3, 3, T, P> const & m) GLM_DEFAULT; diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 77d2143e..8437bc07 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -25,6 +25,14 @@ namespace glm col_type value[3]; public: + // -- Accesses -- + + typedef length_t length_type; + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; } + + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; + // -- Constructors -- GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; @@ -74,14 +82,6 @@ namespace glm GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x); - // -- Accesses -- - - typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 3;} - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; - // -- Unary arithmetic operators -- GLM_FUNC_DECL mat<3, 4, T, P> & operator=(mat<3, 4, T, P> const & m) GLM_DEFAULT; diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index feff316e..ab999dfe 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -25,6 +25,14 @@ namespace glm col_type value[4]; public: + // -- Accesses -- + + typedef length_t length_type; + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; } + + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; + // -- Constructors -- GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; @@ -79,14 +87,6 @@ namespace glm GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 3, T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT mat(mat<3, 4, T, P> const & x); - // -- Accesses -- - - typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 4;} - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; - // -- Unary arithmetic operators -- GLM_FUNC_DECL mat<4, 2, T, P> & operator=(mat<4, 2, T, P> const & m) GLM_DEFAULT; diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 2efa8699..c6ac5595 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -25,6 +25,14 @@ namespace glm col_type value[4]; public: + // -- Accesses -- + + typedef length_t length_type; + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; } + + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; + // -- Constructors -- GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; @@ -79,14 +87,6 @@ namespace glm GLM_FUNC_DECL GLM_EXPLICIT mat(mat<4, 2, T, P> const & x); GLM_FUNC_DECL GLM_EXPLICIT mat(mat<3, 4, T, P> const & x); - // -- Accesses -- - - typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 4;} - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; - // -- Unary arithmetic operators -- GLM_FUNC_DECL mat<4, 3, T, P> & operator=(mat<4, 3, T, P> const & m) GLM_DEFAULT; diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index e0d109ac..17063ac2 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -27,7 +27,7 @@ namespace glm // -- Accesses -- typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 4;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;} GLM_FUNC_DECL col_type & operator[](length_type i); GLM_FUNC_DECL col_type const & operator[](length_type i) const; diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 8f877eda..e05ae88d 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -78,7 +78,7 @@ namespace glm /// Return the count of components of the vector typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 1;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 1;} GLM_FUNC_DECL T & operator[](length_type i); GLM_FUNC_DECL T const & operator[](length_type i) const; diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 1eb81c92..bf6966e9 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -79,7 +79,7 @@ namespace glm /// Return the count of components of the vector typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 2;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;} GLM_FUNC_DECL T& operator[](length_type i); GLM_FUNC_DECL T const& operator[](length_type i) const; diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index bd95530a..814c5a90 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -79,7 +79,7 @@ namespace glm /// Return the count of components of the vector typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 3;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 3;} GLM_FUNC_DECL T & operator[](length_type i); GLM_FUNC_DECL T const & operator[](length_type i) const; diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 6ecb1602..141b20d7 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -82,7 +82,7 @@ namespace glm /// Return the count of components of the vector typedef length_t length_type; - GLM_FUNC_DECL static length_type length(){return 4;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;} GLM_FUNC_DECL T & operator[](length_type i); GLM_FUNC_DECL T const & operator[](length_type i) const; diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index edf07faa..b10873cd 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -70,7 +70,7 @@ namespace glm typedef length_t length_type; /// Return the count of components of a quaternion - GLM_FUNC_DECL static length_type length(){return 4;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;} GLM_FUNC_DECL T & operator[](length_type i); GLM_FUNC_DECL T const & operator[](length_type i) const; diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 1fa23f57..d7a27c9e 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -49,7 +49,7 @@ namespace glm typedef length_t length_type; /// Return the count of components of a dual quaternion - GLM_FUNC_DECL static length_type length(){return 2;} + GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;} GLM_FUNC_DECL part_type & operator[](length_type i); GLM_FUNC_DECL part_type const & operator[](length_type i) const; diff --git a/readme.md b/readme.md index 5882061a..c40bc99f 100644 --- a/readme.md +++ b/readme.md @@ -74,7 +74,8 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Removed GCC shadow warnings #595 - Added error for including of different versions of GLM #619 - Added GLM_FORCE_IGNORE_VERSION to ignore error caused by including different version of GLM #619 -- Reduced warnings when using very strict compilation flags #646 +- Reduced warnings when using very strict compilation flags #646 +- length() member functions are constexpr #657 #### Fixes: - Removed doxygen references to GTC_half_float which was removed in 0.9.4