ViewTests.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. #include "../Tests.hpp"
  2. #include "core/math/View.hpp"
  3. using V3 = Core::Vector3;
  4. static void testFromAngles() {
  5. Core::View v;
  6. v.updateDirections(0.0f, 0.0f);
  7. CORE_TEST_VECTOR(V3(0.0f, 1.0f, 0.0f), v.getUp());
  8. CORE_TEST_VECTOR(V3(0.0f, -1.0f, 0.0f), v.getDown());
  9. CORE_TEST_VECTOR(V3(0.0f, 0.0f, -1.0f), v.getLeft());
  10. CORE_TEST_VECTOR(V3(0.0f, 0.0f, 1.0f), v.getRight());
  11. CORE_TEST_VECTOR(V3(1.0f, 0.0f, 0.0f), v.getFront());
  12. CORE_TEST_VECTOR(V3(-1.0f, 0.0f, 0.0f), v.getBack());
  13. }
  14. static void testFromQuaternion() {
  15. Core::View v;
  16. v.updateDirections(Core::Quaternion());
  17. CORE_TEST_VECTOR(V3(0.0f, 1.0f, 0.0f), v.getUp());
  18. CORE_TEST_VECTOR(V3(0.0f, -1.0f, 0.0f), v.getDown());
  19. CORE_TEST_VECTOR(V3(0.0f, 0.0f, -1.0f), v.getLeft());
  20. CORE_TEST_VECTOR(V3(0.0f, 0.0f, 1.0f), v.getRight());
  21. CORE_TEST_VECTOR(V3(1.0f, 0.0f, 0.0f), v.getFront());
  22. CORE_TEST_VECTOR(V3(-1.0f, 0.0f, 0.0f), v.getBack());
  23. }
  24. void Core::testView() {
  25. testFromAngles();
  26. testFromQuaternion();
  27. }