Platformer in OpenGL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.3 KiB

5 years ago
  1. #define GLM_ENABLE_EXPERIMENTAL
  2. #include <glm/vec2.hpp>
  3. #include <glm/vec3.hpp>
  4. #include <glm/vec4.hpp>
  5. #include <glm/gtx/vector_query.hpp>
  6. int test_areCollinear()
  7. {
  8. int Error(0);
  9. {
  10. bool TestA = glm::areCollinear(glm::vec2(-1), glm::vec2(1), 0.00001f);
  11. Error += TestA ? 0 : 1;
  12. }
  13. {
  14. bool TestA = glm::areCollinear(glm::vec3(-1), glm::vec3(1), 0.00001f);
  15. Error += TestA ? 0 : 1;
  16. }
  17. {
  18. bool TestA = glm::areCollinear(glm::vec4(-1), glm::vec4(1), 0.00001f);
  19. Error += TestA ? 0 : 1;
  20. }
  21. return Error;
  22. }
  23. int test_areOrthogonal()
  24. {
  25. int Error(0);
  26. bool TestA = glm::areOrthogonal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
  27. Error += TestA ? 0 : 1;
  28. return Error;
  29. }
  30. int test_isNormalized()
  31. {
  32. int Error(0);
  33. bool TestA = glm::isNormalized(glm::vec4(1, 0, 0, 0), 0.00001f);
  34. Error += TestA ? 0 : 1;
  35. return Error;
  36. }
  37. int test_isNull()
  38. {
  39. int Error(0);
  40. bool TestA = glm::isNull(glm::vec4(0), 0.00001f);
  41. Error += TestA ? 0 : 1;
  42. return Error;
  43. }
  44. int test_areOrthonormal()
  45. {
  46. int Error(0);
  47. bool TestA = glm::areOrthonormal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
  48. Error += TestA ? 0 : 1;
  49. return Error;
  50. }
  51. int main()
  52. {
  53. int Error(0);
  54. Error += test_areCollinear();
  55. Error += test_areOrthogonal();
  56. Error += test_isNormalized();
  57. Error += test_isNull();
  58. Error += test_areOrthonormal();
  59. return Error;
  60. }