[FEAT] Add shadow support

This commit is contained in:
2024-02-26 23:32:33 +01:00
parent 58938fbb0c
commit 0ce6bb15f0
14 changed files with 289 additions and 14 deletions

View File

@@ -331,7 +331,7 @@ SCENARIO("Lighting with the eye between the light and the surface", "[features/m
PointLight light = PointLight(Tuple::Point(0, 0, -10), Color(1, 1, 1));
WHEN("result <- lighting(m, light, position, eyev, normalv)")
{
Color result = m.lighting(light, position, eyev, normalv);
Color result = m.lighting(light, position, eyev, normalv, false);
THEN("result = color(1.9, 1.9, 1.9)")
{
REQUIRE(result == Color(1.9, 1.9, 1.9));
@@ -360,7 +360,7 @@ SCENARIO("Lighting with eye between the light & surface, eye offset 45°", "[fea
PointLight light = PointLight(Tuple::Point(0, 0, -10), Color(1, 1, 1));
WHEN("result <- lighting(m, light, position, eyev, normalv)")
{
Color result = m.lighting(light, position, eyev, normalv);
Color result = m.lighting(light, position, eyev, normalv, false);
THEN("result = color(1.0, 1.0, 1.0)")
{
REQUIRE(result == Color(1.0, 1.0, 1.0));
@@ -389,7 +389,7 @@ SCENARIO("Lighting with the eye opposite surface, light offset 45°", "[features
PointLight light = PointLight(Tuple::Point(0, 10, -10), Color(1, 1, 1));
WHEN("result <- lighting(m, light, position, eyev, normalv)")
{
Color result = m.lighting(light, position, eyev, normalv);
Color result = m.lighting(light, position, eyev, normalv, false);
THEN("result = color(0.7364, 0.7364, 0.7364)")
{
REQUIRE(result == Color(0.7364, 0.7364, 0.7364));
@@ -418,7 +418,7 @@ SCENARIO("Lighting with the eye in the path of the reflection vector", "[feature
PointLight light = PointLight(Tuple::Point(0, 10, -10), Color(1, 1, 1));
WHEN("result <- lighting(m, light, position, eyev, normalv)")
{
Color result = m.lighting(light, position, eyev, normalv);
Color result = m.lighting(light, position, eyev, normalv, false);
THEN("result = color(1.6364, 1.6364, 1.6364)")
{
REQUIRE(result == Color(1.6364, 1.6364, 1.6364));
@@ -447,7 +447,7 @@ SCENARIO("Lighting with the light behind the surface", "[features/materials.feat
PointLight light = PointLight(Tuple::Point(0, 0, 10), Color(1, 1, 1));
WHEN("result <- lighting(m, light, position, eyev, normalv)")
{
Color result = m.lighting(light, position, eyev, normalv);
Color result = m.lighting(light, position, eyev, normalv, false);
THEN("result = color(0.1, 0.1, 0.1)")
{
REQUIRE(result == Color(0.1, 0.1, 0.1));