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.

106 lines
3.7 KiB

5 years ago
  1. #include <glm/ext/matrix_relational.hpp>
  2. #include <glm/ext/matrix_double2x2.hpp>
  3. #include <glm/ext/matrix_double2x3.hpp>
  4. #include <glm/ext/matrix_double2x4.hpp>
  5. #include <glm/ext/matrix_double3x2.hpp>
  6. #include <glm/ext/matrix_double3x3.hpp>
  7. #include <glm/ext/matrix_double3x4.hpp>
  8. #include <glm/ext/matrix_double4x2.hpp>
  9. #include <glm/ext/matrix_double4x3.hpp>
  10. #include <glm/ext/matrix_double4x4.hpp>
  11. #include <glm/ext/vector_double2.hpp>
  12. #include <glm/ext/vector_double3.hpp>
  13. #include <glm/ext/vector_double4.hpp>
  14. #include <glm/ext/matrix_float2x2.hpp>
  15. #include <glm/ext/matrix_float2x3.hpp>
  16. #include <glm/ext/matrix_float2x4.hpp>
  17. #include <glm/ext/matrix_float3x2.hpp>
  18. #include <glm/ext/matrix_float3x3.hpp>
  19. #include <glm/ext/matrix_float3x4.hpp>
  20. #include <glm/ext/matrix_float4x2.hpp>
  21. #include <glm/ext/matrix_float4x3.hpp>
  22. #include <glm/ext/matrix_float4x4.hpp>
  23. #include <glm/ext/vector_float2.hpp>
  24. #include <glm/ext/vector_float3.hpp>
  25. #include <glm/ext/vector_float4.hpp>
  26. template <typename matType, typename vecType>
  27. static int test_equal()
  28. {
  29. typedef typename matType::value_type valType;
  30. valType const Epsilon = static_cast<valType>(0.001f);
  31. valType const One = static_cast<valType>(1);
  32. valType const Two = static_cast<valType>(2);
  33. int Error = 0;
  34. Error += glm::all(glm::equal(matType(One), matType(One), Epsilon)) ? 0 : 1;
  35. Error += glm::all(glm::equal(matType(One), matType(Two), vecType(Epsilon))) ? 1 : 0;
  36. return Error;
  37. }
  38. template <typename matType, typename vecType>
  39. static int test_notEqual()
  40. {
  41. typedef typename matType::value_type valType;
  42. valType const Epsilon = static_cast<valType>(0.001f);
  43. valType const One = static_cast<valType>(1);
  44. valType const Two = static_cast<valType>(2);
  45. int Error = 0;
  46. Error += !glm::any(glm::notEqual(matType(One), matType(One), Epsilon)) ? 0 : 1;
  47. Error += !glm::any(glm::notEqual(matType(One), matType(Two), vecType(Epsilon))) ? 1 : 0;
  48. return Error;
  49. }
  50. int main()
  51. {
  52. int Error = 0;
  53. Error += test_equal<glm::mat2x2, glm::vec2>();
  54. Error += test_equal<glm::mat2x3, glm::vec2>();
  55. Error += test_equal<glm::mat2x4, glm::vec2>();
  56. Error += test_equal<glm::mat3x2, glm::vec3>();
  57. Error += test_equal<glm::mat3x3, glm::vec3>();
  58. Error += test_equal<glm::mat3x4, glm::vec3>();
  59. Error += test_equal<glm::mat4x2, glm::vec4>();
  60. Error += test_equal<glm::mat4x3, glm::vec4>();
  61. Error += test_equal<glm::mat4x4, glm::vec4>();
  62. Error += test_equal<glm::dmat2x2, glm::dvec2>();
  63. Error += test_equal<glm::dmat2x3, glm::dvec2>();
  64. Error += test_equal<glm::dmat2x4, glm::dvec2>();
  65. Error += test_equal<glm::dmat3x2, glm::dvec3>();
  66. Error += test_equal<glm::dmat3x3, glm::dvec3>();
  67. Error += test_equal<glm::dmat3x4, glm::dvec3>();
  68. Error += test_equal<glm::dmat4x2, glm::dvec4>();
  69. Error += test_equal<glm::dmat4x3, glm::dvec4>();
  70. Error += test_equal<glm::dmat4x4, glm::dvec4>();
  71. Error += test_notEqual<glm::mat2x2, glm::vec2>();
  72. Error += test_notEqual<glm::mat2x3, glm::vec2>();
  73. Error += test_notEqual<glm::mat2x4, glm::vec2>();
  74. Error += test_notEqual<glm::mat3x2, glm::vec3>();
  75. Error += test_notEqual<glm::mat3x3, glm::vec3>();
  76. Error += test_notEqual<glm::mat3x4, glm::vec3>();
  77. Error += test_notEqual<glm::mat4x2, glm::vec4>();
  78. Error += test_notEqual<glm::mat4x3, glm::vec4>();
  79. Error += test_notEqual<glm::mat4x4, glm::vec4>();
  80. Error += test_notEqual<glm::dmat2x2, glm::dvec2>();
  81. Error += test_notEqual<glm::dmat2x3, glm::dvec2>();
  82. Error += test_notEqual<glm::dmat2x4, glm::dvec2>();
  83. Error += test_notEqual<glm::dmat3x2, glm::dvec3>();
  84. Error += test_notEqual<glm::dmat3x3, glm::dvec3>();
  85. Error += test_notEqual<glm::dmat3x4, glm::dvec3>();
  86. Error += test_notEqual<glm::dmat4x2, glm::dvec4>();
  87. Error += test_notEqual<glm::dmat4x3, glm::dvec4>();
  88. Error += test_notEqual<glm::dmat4x4, glm::dvec4>();
  89. return Error;
  90. }