Change World to use a base group instead of storing all the world object.

Makes the code simpler and avoid some potential issues. Add to change a bit some test to make them pass properly.
This commit is contained in:
Godzil
2020-03-09 13:47:42 +00:00
parent 1510de3b36
commit e653855556
4 changed files with 24 additions and 49 deletions

View File

@@ -22,8 +22,8 @@ TEST(WorldTest, Creating_a_world)
{
World w;
ASSERT_EQ(w.lightCount, 0);
ASSERT_EQ(w.objectCount, 0);
ASSERT_EQ(w.getLightCount(), 0);
ASSERT_EQ(w.getObjectCount(), 0);
}
TEST(WorldTest, The_default_world)
@@ -41,9 +41,12 @@ TEST(WorldTest, The_default_world)
s2.setTransform(scaling(0.5, 0.5,0.5));
Shape *obj0 = w.getObject(0);
Shape *obj1 = w.getObject(1);
ASSERT_TRUE(w.lightIsIn(l));
ASSERT_TRUE(w.objectIsIn(s1));
ASSERT_TRUE(w.objectIsIn(s2));
ASSERT_EQ(*obj0, s1);
ASSERT_EQ(*obj1, s2);
}
TEST(WorldTest, Intersect_a_world_with_a_ray)