diff --git a/test/gtc/gtc_type_precision.cpp b/test/gtc/gtc_type_precision.cpp index 4e110ad0..a1a7abcd 100644 --- a/test/gtc/gtc_type_precision.cpp +++ b/test/gtc/gtc_type_precision.cpp @@ -10,6 +10,7 @@ #include #include #include +#include static int test_scalar_size() { @@ -854,9 +855,33 @@ static int test_fvec_conversion() return Error; } +#include + +static int test_openmp() +{ + std::vector VectorA(1000); + std::vector VectorB(1000); + std::vector VectorC(1000); + + for (std::size_t i = 0; i < VectorA.size(); ++i) + { + VectorA[i] = glm::u8vec3(1, 1, 1); + VectorB[i] = glm::u8vec3(1, 1, 1); + } + + #pragma omp parallel for default(none) shared(VectorA, VectorB, VectorC) + for (int i = 0; i < VectorC.size(); ++i) + { + VectorC[i] = VectorA[i] + VectorB[i]; + } + + return 0; +} + int main() { int Error(0); + Error += test_openmp(); Error += test_scalar_size(); Error += test_fvec_size(); Error += test_fvec_precision(); diff --git a/test/gtx/CMakeLists.txt b/test/gtx/CMakeLists.txt index e268abc4..ce0ef6f8 100644 --- a/test/gtx/CMakeLists.txt +++ b/test/gtx/CMakeLists.txt @@ -1,4 +1,5 @@ glmCreateTestGTC(gtx_bit) +glmCreateTestGTC(gtx_euler_angle) glmCreateTestGTC(gtx_gradient_paint) glmCreateTestGTC(gtx_integer) glmCreateTestGTC(gtx_matrix_interpolation) diff --git a/test/gtx/gtx_euler_angle.cpp b/test/gtx/gtx_euler_angle.cpp new file mode 100644 index 00000000..a63a85ba --- /dev/null +++ b/test/gtx/gtx_euler_angle.cpp @@ -0,0 +1,35 @@ +// Code sample from Filippo Ramaciotti + +#define GLM_FORCE_RADIANS +#include +#include +#include +#include +#include + +using namespace glm; + +int main() +{ + f32 first = 1.046 ; + f32 second = 0.52 ; + f32 third = -0.785; + + fmat4 rotationEuler = eulerAngleYXZ(first, second, third); + + fmat4 rotationInvertedY = eulerAngleY(-1.f*first) * eulerAngleX(second) * eulerAngleZ(third); + fmat4 rotationDumb = glm::fmat4(); + rotationDumb = rotate(rotationDumb, first, glm::fvec3(0,1,0)); + rotationDumb = rotate(rotationDumb, second, glm::fvec3(1,0,0)); + rotationDumb = rotate(rotationDumb, third, glm::fvec3(0,0,1)); + + std::cout << glm::to_string(fmat3(rotationEuler)) << std::endl; + std::cout << glm::to_string(fmat3(rotationDumb)) << std::endl; + std::cout << glm::to_string(fmat3(rotationInvertedY )) << std::endl; + + std::cout <<"\nRESIDUAL\n"; + std::cout << glm::to_string(fmat3(rotationEuler-(rotationDumb))) << std::endl; + std::cout << glm::to_string(fmat3(rotationEuler-(rotationInvertedY ))) << std::endl; + + return 0; +} diff --git a/test/gtx/gtx_rotate_vector.cpp b/test/gtx/gtx_rotate_vector.cpp index e755906d..0e4e789f 100644 --- a/test/gtx/gtx_rotate_vector.cpp +++ b/test/gtx/gtx_rotate_vector.cpp @@ -12,29 +12,29 @@ int test_rotate() { - int Error = 0; - - glm::vec2 A = glm::rotate(glm::vec2(1, 0), 90.f); + int Error = 0; - glm::vec3 B = glm::rotate(glm::vec3(1, 0, 0), 90.f, glm::vec3(0, 0, 1)); + glm::vec2 A = glm::rotate(glm::vec2(1, 0), 90.f); - glm::vec4 C = glm::rotate(glm::vec4(1, 0, 0, 1), 90.f, glm::vec3(0, 0, 1)); + glm::vec3 B = glm::rotate(glm::vec3(1, 0, 0), 90.f, glm::vec3(0, 0, 1)); - glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), 90.f); + glm::vec4 C = glm::rotate(glm::vec4(1, 0, 0, 1), 90.f, glm::vec3(0, 0, 1)); - 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::vec3 D = glm::rotateX(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 E = glm::rotateX(glm::vec4(1, 0, 0, 1), 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; + 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()