Adding shadows!

This commit is contained in:
Godzil
2020-02-20 17:46:03 +00:00
parent 5198888df6
commit cf5597ad6d
11 changed files with 145 additions and 24 deletions

View File

@@ -86,5 +86,17 @@ TEST(MaterialTest, Lighting_with_the_light_behind_the_surface)
Colour result = m.lighting(light, position, eyev, normalv);
ASSERT_EQ(result, Colour(0.1, 0.1, 0.1));
}
TEST(MaterialTest, Lighting_with_the_surface_in_shadow)
{
Vector eyev = Vector(0, 0, -1);
Vector normalv = Vector(0, 0, -1);
Light light = Light(POINT_LIGHT, Point(0, 0, -10), Colour(1, 1, 1));
bool inShadow = true;
Colour result = m.lighting(light, position, eyev, normalv, inShadow);
ASSERT_EQ(result, Colour(0.1, 0.1, 0.1));
}