Made quat, vec, mat type component length() static #565

This commit is contained in:
Christophe Riccio 2016-11-01 09:07:04 +01:00
parent 2e9f580615
commit 535040b207
15 changed files with 149 additions and 4 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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();

View File

@ -100,6 +100,8 @@ int test_vec1_size()
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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}