Huge speed up by changing how Intersect are shared.

This commit is contained in:
Godzil
2020-03-12 00:11:26 +00:00
parent 0aa949c60b
commit b00bb75189
38 changed files with 116 additions and 153 deletions

View File

@@ -43,7 +43,7 @@ TEST(CubeTest, A_ray_intersects_a_cube)
for(i = 0; i < 7; i++)
{
Ray r = Ray(Origins[i], Directions[i]);
Intersect xs = c.intersect(r);
Intersect xs; c.intersect(r, xs);
ASSERT_EQ(xs.count(), 2);
EXPECT_EQ(xs[0].t, t1[i]);
@@ -77,7 +77,7 @@ TEST(CubeTest, A_ray_miss_a_cube)
for(i = 0; i < 6; i++)
{
Ray r = Ray(Origins[i], Directions[i]);
Intersect xs = c.intersect(r);
Intersect xs; c.intersect(r, xs);
ASSERT_EQ(xs.count(), 0);
}