diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 879b9e5e..d7f7c213 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -76,7 +76,7 @@ namespace glm /// Return the count of components of the vector typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length(){return 2;} + GLM_FUNC_DECL static 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/readme.md b/readme.md index 1b62ea97..11ab3747 100644 --- a/readme.md +++ b/readme.md @@ -51,13 +51,14 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ## Release notes -#### [GLM 0.9.8.2](https://github.com/g-truc/glm/tree/0.9.8) - 2016-XX-XX +#### [GLM 0.9.8.2](https://github.com/g-truc/glm/tree/0.9.8) - 2016-11-01 ##### Improvements: - Added Visual C++ 15 detection - Added Clang 4.0 detection - Added warning messages when using GLM_FORCE_CXX** but the compiler is known to not fully support the requested C++ version #555 - Refactored GLM_COMPILER_VC values +- Made quat, vec, mat type component length() static #565 ##### Fixes: - Fixed Visual C++ constexpr build error #555, #556 diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index 78c0e8d2..72f5469a 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -132,6 +132,20 @@ namespace cast } }//namespace cast +int test_size() +{ + int Error = 0; + + Error += 16 == sizeof(glm::mat2x2) ? 0 : 1; + Error += 32 == sizeof(glm::dmat2x2) ? 0 : 1; + Error += glm::mat2x2().length() == 2 ? 0 : 1; + Error += glm::dmat2x2().length() == 2 ? 0 : 1; + Error += glm::mat2x2::length() == 2 ? 0 : 1; + Error += glm::dmat2x2::length() == 2 ? 0 : 1; + + return Error; +} + int main() { int Error(0); @@ -140,6 +154,7 @@ int main() Error += test_ctr(); Error += test_operators(); Error += test_inverse(); + Error += test_size(); return Error; } diff --git a/test/core/core_type_mat2x3.cpp b/test/core/core_type_mat2x3.cpp index 36e4a594..bb6612cf 100644 --- a/test/core/core_type_mat2x3.cpp +++ b/test/core/core_type_mat2x3.cpp @@ -106,6 +106,20 @@ namespace cast } }//namespace cast +int test_size() +{ + int Error = 0; + + Error += 24 == sizeof(glm::mat2x3) ? 0 : 1; + Error += 48 == sizeof(glm::dmat2x3) ? 0 : 1; + Error += glm::mat2x3().length() == 2 ? 0 : 1; + Error += glm::dmat2x3().length() == 2 ? 0 : 1; + Error += glm::mat2x3::length() == 2 ? 0 : 1; + Error += glm::dmat2x3::length() == 2 ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -113,6 +127,7 @@ int main() Error += cast::test(); Error += test_ctr(); Error += test_operators(); + Error += test_size(); return Error; } diff --git a/test/core/core_type_mat2x4.cpp b/test/core/core_type_mat2x4.cpp index d2435f8d..5793b2cc 100644 --- a/test/core/core_type_mat2x4.cpp +++ b/test/core/core_type_mat2x4.cpp @@ -106,6 +106,20 @@ namespace cast } }//namespace cast +int test_size() +{ + int Error = 0; + + Error += 32 == sizeof(glm::mat2x4) ? 0 : 1; + Error += 64 == sizeof(glm::dmat2x4) ? 0 : 1; + Error += glm::mat2x4().length() == 2 ? 0 : 1; + Error += glm::dmat2x4().length() == 2 ? 0 : 1; + Error += glm::mat2x4::length() == 2 ? 0 : 1; + Error += glm::dmat2x4::length() == 2 ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -113,6 +127,7 @@ int main() Error += cast::test(); Error += test_ctr(); Error += test_operators(); + Error += test_size(); return Error; } diff --git a/test/core/core_type_mat3x2.cpp b/test/core/core_type_mat3x2.cpp index fdfa2083..449f5773 100644 --- a/test/core/core_type_mat3x2.cpp +++ b/test/core/core_type_mat3x2.cpp @@ -110,6 +110,20 @@ namespace cast } }//namespace cast +int test_size() +{ + int Error = 0; + + Error += 24 == sizeof(glm::mat3x2) ? 0 : 1; + Error += 48 == sizeof(glm::dmat3x2) ? 0 : 1; + Error += glm::mat3x2().length() == 3 ? 0 : 1; + Error += glm::dmat3x2().length() == 3 ? 0 : 1; + Error += glm::mat3x2::length() == 3 ? 0 : 1; + Error += glm::dmat3x2::length() == 3 ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -117,6 +131,7 @@ int main() Error += cast::test(); Error += test_ctr(); Error += test_operators(); + Error += test_size(); return Error; } diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index c8886a55..fa54cefe 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/test/core/core_type_mat3x3.cpp @@ -169,6 +169,20 @@ namespace cast } }//namespace cast +int test_size() +{ + int Error = 0; + + Error += 36 == sizeof(glm::mat3x3) ? 0 : 1; + Error += 72 == sizeof(glm::dmat3x3) ? 0 : 1; + Error += glm::mat3x3().length() == 3 ? 0 : 1; + Error += glm::dmat3x3().length() == 3 ? 0 : 1; + Error += glm::mat3x3::length() == 3 ? 0 : 1; + Error += glm::dmat3x3::length() == 3 ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -178,6 +192,7 @@ int main() Error += test_mat3x3(); Error += test_operators(); Error += test_inverse(); + Error += test_size(); return Error; } diff --git a/test/core/core_type_mat3x4.cpp b/test/core/core_type_mat3x4.cpp index 131f6862..112e10a5 100644 --- a/test/core/core_type_mat3x4.cpp +++ b/test/core/core_type_mat3x4.cpp @@ -110,6 +110,20 @@ namespace cast } }//namespace cast +int test_size() +{ + int Error = 0; + + Error += 48 == sizeof(glm::mat3x4) ? 0 : 1; + Error += 96 == sizeof(glm::dmat3x4) ? 0 : 1; + Error += glm::mat3x4().length() == 3 ? 0 : 1; + Error += glm::dmat3x4().length() == 3 ? 0 : 1; + Error += glm::mat3x4::length() == 3 ? 0 : 1; + Error += glm::dmat3x4::length() == 3 ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -117,6 +131,7 @@ int main() Error += cast::test(); Error += test_ctr(); Error += test_operators(); + Error += test_size(); return Error; } diff --git a/test/core/core_type_mat4x2.cpp b/test/core/core_type_mat4x2.cpp index eecdf1c7..247b041f 100644 --- a/test/core/core_type_mat4x2.cpp +++ b/test/core/core_type_mat4x2.cpp @@ -114,6 +114,20 @@ namespace cast } }//namespace cast +int test_size() +{ + int Error = 0; + + Error += 32 == sizeof(glm::mat4x2) ? 0 : 1; + Error += 64 == sizeof(glm::dmat4x2) ? 0 : 1; + Error += glm::mat4x2().length() == 4 ? 0 : 1; + Error += glm::dmat4x2().length() == 4 ? 0 : 1; + Error += glm::mat4x2::length() == 4 ? 0 : 1; + Error += glm::dmat4x2::length() == 4 ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -121,6 +135,7 @@ int main() Error += cast::test(); Error += test_ctr(); Error += test_operators(); + Error += test_size(); return Error; } diff --git a/test/core/core_type_mat4x3.cpp b/test/core/core_type_mat4x3.cpp index 309a86b4..6700aae3 100644 --- a/test/core/core_type_mat4x3.cpp +++ b/test/core/core_type_mat4x3.cpp @@ -114,6 +114,20 @@ namespace cast } }//namespace cast +int test_size() +{ + int Error = 0; + + Error += 48 == sizeof(glm::mat4x3) ? 0 : 1; + Error += 96 == sizeof(glm::dmat4x3) ? 0 : 1; + Error += glm::mat4x3().length() == 4 ? 0 : 1; + Error += glm::dmat4x3().length() == 4 ? 0 : 1; + Error += glm::mat4x3::length() == 4 ? 0 : 1; + Error += glm::dmat4x3::length() == 4 ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -121,6 +135,7 @@ int main() Error += cast::test(); Error += test_ctr(); Error += test_operators(); + Error += test_size(); return Error; } diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index 94cc3ace..0adaef71 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -294,6 +294,20 @@ struct repro glm::mat4* matrix; }; +int test_size() +{ + int Error = 0; + + Error += 64 == sizeof(glm::mat4) ? 0 : 1; + Error += 128 == sizeof(glm::dmat4) ? 0 : 1; + Error += glm::mat4().length() == 4 ? 0 : 1; + Error += glm::dmat4().length() == 4 ? 0 : 1; + Error += glm::mat4::length() == 4 ? 0 : 1; + Error += glm::dmat4::length() == 4 ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -306,6 +320,7 @@ int main() Error += test_inverse_mat4x4(); Error += test_operators(); Error += test_inverse(); + Error += test_size(); Error += perf_mul(); diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index 9177e380..b03057aa 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -93,14 +93,16 @@ int test_vec1_ctor() int test_vec1_size() { int Error = 0; - + Error += sizeof(glm::vec1) == sizeof(glm::mediump_vec1) ? 0 : 1; Error += 4 == sizeof(glm::mediump_vec1) ? 0 : 1; Error += sizeof(glm::dvec1) == sizeof(glm::highp_dvec1) ? 0 : 1; Error += 8 == sizeof(glm::highp_dvec1) ? 0 : 1; Error += glm::vec1().length() == 1 ? 0 : 1; Error += glm::dvec1().length() == 1 ? 0 : 1; - + Error += glm::vec1::length() == 1 ? 0 : 1; + Error += glm::dvec1::length() == 1 ? 0 : 1; + return Error; } diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index af7997af..97c7f9b1 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -265,6 +265,8 @@ int test_vec2_size() Error += 16 == sizeof(glm::highp_dvec2) ? 0 : 1; Error += glm::vec2().length() == 2 ? 0 : 1; Error += glm::dvec2().length() == 2 ? 0 : 1; + Error += glm::vec2::length() == 2 ? 0 : 1; + Error += glm::dvec2::length() == 2 ? 0 : 1; return Error; } diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index e6b894c7..c9370c17 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -239,6 +239,9 @@ int test_vec3_size() Error += 24 == sizeof(glm::highp_dvec3) ? 0 : 1; Error += glm::vec3().length() == 3 ? 0 : 1; Error += glm::dvec3().length() == 3 ? 0 : 1; + Error += glm::vec3::length() == 3 ? 0 : 1; + Error += glm::dvec3::length() == 3 ? 0 : 1; + return Error; } diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 86e302c7..9ada8878 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -315,6 +315,8 @@ int test_vec4_size() Error += 32 == sizeof(glm::highp_dvec4) ? 0 : 1; Error += glm::vec4().length() == 4 ? 0 : 1; Error += glm::dvec4().length() == 4 ? 0 : 1; + Error += glm::vec4::length() == 4 ? 0 : 1; + Error += glm::dvec4::length() == 4 ? 0 : 1; return Error; }