From 699e8d3039a94695d718228f9e118ddd2be2d001 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 16 May 2011 09:48:29 +0100 Subject: [PATCH 1/4] Added GTX_rotate_vector test file --- test/gtx/CMakeLists.txt | 2 +- test/gtx/gtx_rotate_vector.cpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 test/gtx/gtx_rotate_vector.cpp diff --git a/test/gtx/CMakeLists.txt b/test/gtx/CMakeLists.txt index 941cfadc..fca74f16 100644 --- a/test/gtx/CMakeLists.txt +++ b/test/gtx/CMakeLists.txt @@ -1,7 +1,7 @@ glmCreateTestGTC(gtx_bit) glmCreateTestGTC(gtx_noise) +glmCreateTestGTC(gtx_rotate_vector) glmCreateTestGTC(gtx_simd_vec4) glmCreateTestGTC(gtx_simd_mat4) glmCreateTestGTC(gtx_ulp) glmCreateTestGTC(gtx_vector_angle) - diff --git a/test/gtx/gtx_rotate_vector.cpp b/test/gtx/gtx_rotate_vector.cpp new file mode 100644 index 00000000..e69de29b From d71d20a6ef566c947e8035c3ff9da452723e0ec0 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 16 May 2011 09:52:53 +0100 Subject: [PATCH 2/4] Added test basic structure --- test/gtx/gtx_rotate_vector.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/gtx/gtx_rotate_vector.cpp b/test/gtx/gtx_rotate_vector.cpp index e69de29b..1e529695 100644 --- a/test/gtx/gtx_rotate_vector.cpp +++ b/test/gtx/gtx_rotate_vector.cpp @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-05-16 +// Updated : 2011-05-16 +// Licence : This source is under MIT licence +// File : test/gtx/rotate_vector.cpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include + +int test_() +{ + int Error = 0; + + + return Error; +} + +int main() +{ + int Error = 0; + Error += test_(); + + return Error; +} + + From 6734a5fda363f7e5aa24a3007a8e91884c7aebbe Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 16 May 2011 20:17:14 +0100 Subject: [PATCH 3/4] Updated white spaces --- glm/gtx/rotate_vector.hpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/glm/gtx/rotate_vector.hpp b/glm/gtx/rotate_vector.hpp index 2b420772..ce51e245 100644 --- a/glm/gtx/rotate_vector.hpp +++ b/glm/gtx/rotate_vector.hpp @@ -36,37 +36,38 @@ namespace glm //! From GLM_GTX_rotate_vector extension. template detail::tvec2 rotate( - const detail::tvec2& v, - T angle); + detail::tvec2 const & v, + T const & angle); //! Rotate a three dimensional vector around an axis. //! From GLM_GTX_rotate_vector extension. template detail::tvec3 rotate( - const detail::tvec3& v, - T angle, - const detail::tvec3& normal); + detail::tvec3 const & v, + T const & angle, + detail::tvec3 const & normal); //! Rotate a four dimensional vector around an axis. //! From GLM_GTX_rotate_vector extension. template detail::tvec4 rotate( - const detail::tvec4& v, T angle, - const detail::tvec3& normal); + detail::tvec4 const & v, + T const & angle, + detail::tvec3 const & normal); //! Rotate a three dimensional vector around the X axis. //! From GLM_GTX_rotate_vector extension. template detail::tvec3 rotateX( - const detail::tvec3& v, - T angle); + detail::tvec3 const & v, + T const & angle); //! Rotate a three dimensional vector around the Y axis. //! From GLM_GTX_rotate_vector extension. template detail::tvec3 rotateY( - const detail::tvec3& v, - T angle); + detail::tvec3 const & v, + T const & angle); //! Rotate a three dimensional vector around the Z axis. //! From GLM_GTX_rotate_vector extension. From 3f7ad22b59285c6528fe50076f4e20f6aa8c7d1d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 16 May 2011 20:29:24 +0100 Subject: [PATCH 4/4] Updated GTX_rotate_vector test, basic test structure --- test/gtx/gtx_rotate_vector.cpp | 72 ++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/test/gtx/gtx_rotate_vector.cpp b/test/gtx/gtx_rotate_vector.cpp index 1e529695..256cab6e 100644 --- a/test/gtx/gtx_rotate_vector.cpp +++ b/test/gtx/gtx_rotate_vector.cpp @@ -10,18 +10,84 @@ #include #include -int test_() +int test_rotate() { int Error = 0; - + glm::vec2 A = glm::rotate(glm::vec2(1, 0), 90.f); + + glm::vec3 B = glm::rotate(glm::vec3(1, 0, 0), 90.f, glm::vec3(0, 0, 1)); + + glm::vec4 C = glm::rotate(glm::vec4(1, 0, 0, 1), 90.f, glm::vec3(0, 0, 1)); + + glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), 90.f); + + glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), 90.f); + + glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), 90.f); + + glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1)); + + return Error; +} + +int test_rotateX() +{ + int Error = 0; + + glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), 90.f); + + return Error; +} + +int test_rotateY() +{ + int Error = 0; + + glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), 90.f); + + return Error; +} + + +int test_rotateZ() +{ + int Error = 0; + + glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), 90.f); + + return Error; +} + +int test_orientation() +{ + int Error = 0; + + glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1)); + return Error; } int main() { int Error = 0; - Error += test_(); + Error += test_rotate(); + Error += test_rotateX(); + Error += test_rotateY(); + Error += test_rotateZ(); + Error += test_orientation(); return Error; }