TEST(Transformable_objects, can_be_moved) { Transformable t; EXPECT_EQ(vec3(0,0,0), t.position()); t.moveTo(1,1,1); EXPECT_EQ(vec3(1,1,1), t.position()); t.moveTo(vec3(5,5,5)); EXPECT_EQ(vec3(5,5,5), t.position()); t.move(vec3(-1,-1,-1), 3); EXPECT_EQ(vec3(2,2,2), t.position()); }
TEST(Transformable_objects, have_a_translation_matrix_to_move_form_model_space_to_world_space) { Transformable model; vec3 pInModelSpace(1,1,1), pInWorldSpace(2,3,4); model.moveTo(1,2,3); EXPECT_EQ(pInWorldSpace, (model.translationMatrix() * vec4(pInModelSpace,1)).xyz()); }
TEST(Transformable_objects, can_be_aligned_with_direction_using_alignWith) { Transformable t; t.moveTo(5,5,5); vec3 direction(1,0,-1); t.alignWith(direction); EXPECT_EQ(normalize(direction), t.forward()); EXPECT_EQ(vec3(5,5,5), t.position()); }