diff options
Diffstat (limited to 'src/tests/test_3d.cc')
| -rw-r--r-- | src/tests/test_3d.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tests/test_3d.cc b/src/tests/test_3d.cc index 33e6a04..88b8db9 100644 --- a/src/tests/test_3d.cc +++ b/src/tests/test_3d.cc @@ -33,10 +33,10 @@ void test_object_transform() { std::cout << "Testing Object Transform..." << std::endl; Object3D obj; obj.position = vec3(10, 0, 0); - + // Model matrix should translate by (10,0,0) mat4 m = obj.get_model_matrix(); - assert(near(m.m[12], 10.0f)); // Col 3, Row 0 is x translation in Col-Major? + assert(near(m.m[12], 10.0f)); // Col 3, Row 0 is x translation in Col-Major? // Wait, my mat4 struct: // r.m[12] = t.x; // Index 12 is translation X assert(near(m.m[12], 10.0f)); @@ -44,11 +44,12 @@ void test_object_transform() { // Rotate 90 deg Y obj.rotation = quat::from_axis(vec3(0, 1, 0), 1.570796f); m = obj.get_model_matrix(); - + // Transform point (1,0,0) -> Rot(0,0,-1) -> Trans(10,0,-1) vec4 p(1, 0, 0, 1); vec4 res = m * p; - assert(near(res.x, 10.0f)); // Rotated vector is (0,0,-1). + (10,0,0) translation -> (10,0,-1) + assert(near(res.x, 10.0f)); // Rotated vector is (0,0,-1). + (10,0,0) + // translation -> (10,0,-1) assert(near(res.z, -1.0f)); } |
