1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #include "../Tests.hpp"
- #include "core/math/View.hpp"
- using V3 = Core::Vector3;
- static void testFromAngles() {
- Core::View v;
- v.updateDirections(0.0f, 0.0f);
- CORE_TEST_VECTOR(V3(0.0f, 1.0f, 0.0f), v.getUp());
- CORE_TEST_VECTOR(V3(0.0f, -1.0f, 0.0f), v.getDown());
- CORE_TEST_VECTOR(V3(0.0f, 0.0f, -1.0f), v.getLeft());
- CORE_TEST_VECTOR(V3(0.0f, 0.0f, 1.0f), v.getRight());
- CORE_TEST_VECTOR(V3(1.0f, 0.0f, 0.0f), v.getFront());
- CORE_TEST_VECTOR(V3(-1.0f, 0.0f, 0.0f), v.getBack());
- }
- static void testFromQuaternion() {
- Core::View v;
- v.updateDirections(Core::Quaternion());
- CORE_TEST_VECTOR(V3(0.0f, 1.0f, 0.0f), v.getUp());
- CORE_TEST_VECTOR(V3(0.0f, -1.0f, 0.0f), v.getDown());
- CORE_TEST_VECTOR(V3(0.0f, 0.0f, -1.0f), v.getLeft());
- CORE_TEST_VECTOR(V3(0.0f, 0.0f, 1.0f), v.getRight());
- CORE_TEST_VECTOR(V3(1.0f, 0.0f, 0.0f), v.getFront());
- CORE_TEST_VECTOR(V3(-1.0f, 0.0f, 0.0f), v.getBack());
- }
- static void testUpdateMatrix() {
- Core::View v;
- CORE_TEST_STRING("[[0.00, 0.00, 0.00, 0.00], "
- "[0.00, 0.00, 0.00, 0.00], "
- "[0.00, 0.00, 0.00, 0.00], "
- "[0.00, 0.00, 0.00, 1.00]]",
- v.updateMatrix(Core::Vector3(1.0f, 2.0f, 3.0f)));
- }
- void Core::testView() {
- testFromAngles();
- testFromQuaternion();
- testUpdateMatrix();
- }
|