[WIP] Test 7 of refraction is in wip

This commit is contained in:
NADAL Jean-Baptiste
2024-03-11 18:43:31 +01:00
parent 47b1cc677e
commit 668a51c4f7
7 changed files with 328 additions and 29 deletions

View File

@@ -232,7 +232,7 @@ SCENARIO("An intersection encapsulates t and object", "[features/intersections.f
GIVEN("s <- sphere()")
{
Sphere s;
WHEN("intersection(3.5,s)")
WHEN("intersection(3.5, s)")
{
Intersection i(3.5, &s);
@@ -284,7 +284,7 @@ SCENARIO("Intersection could be compared", "[features/intersections.feature]")
GIVEN("s <- sphere()")
{
Sphere s;
AND_GIVEN("i1 <- intersection(3,s) and i2 <- intersection(4,s)")
AND_GIVEN("i1 <- intersection(3, s) and i2 <- intersection(4, s)")
{
Intersection i1(3.0, &s);
Intersection i2(4.0, &s);
@@ -324,13 +324,13 @@ SCENARIO("Aggregating intersections", "[features/intersections.feature]")
GIVEN("s <- sphere()")
{
Sphere s;
AND_GIVEN("i1 <- intersection(1,s)")
AND_GIVEN("i1 <- intersection(1, s)")
{
Intersection i1(1, &s);
AND_GIVEN("i2 <- intersection(2,s)")
AND_GIVEN("i2 <- intersection(2, s)")
{
Intersection i2(2, &s);
WHEN("xs <- intersections(i1,i2)")
WHEN("xs <- intersections(i1, i2)")
{
Intersections xs = Intersections({i1, i2});
THEN("xs.count = 2")
@@ -394,7 +394,7 @@ SCENARIO("Intersect sets the object on the intersection", "[features/spheres.fea
AND_GIVEN("s <- sphere()")
{
Sphere s;
WHEN("xs <- intersect(s,r)")
WHEN("xs <- intersect(s, r)")
{
Intersections xs = s.intersect(r);
THEN("xs.count = 2")
@@ -421,13 +421,13 @@ SCENARIO("The hit, when all intersections have positive t", "[features/intersect
GIVEN("s <- sphere()")
{
Sphere s;
AND_GIVEN("i1 <- intersection(1,s)")
AND_GIVEN("i1 <- intersection(1, s)")
{
Intersection i1(1, &s);
AND_GIVEN("i2 <- intersection(2,s)")
AND_GIVEN("i2 <- intersection(2, s)")
{
Intersection i2(2, &s);
AND_GIVEN("xs <- intersections(i1,i2)")
AND_GIVEN("xs <- intersections(i1, i2)")
{
Intersections xs = Intersections({i2, i1});
WHEN("i <- hit(xs)")
@@ -451,13 +451,13 @@ SCENARIO("The hit, when some intersections have negative t", "[features/intersec
GIVEN("s <- sphere()")
{
Sphere s;
AND_GIVEN("i1 <- intersection(-1,s)")
AND_GIVEN("i1 <- intersection(-1, s)")
{
Intersection i1(-1, &s);
AND_GIVEN("i2 <- intersection(2,s)")
AND_GIVEN("i2 <- intersection(2, s)")
{
Intersection i2(1, &s);
AND_GIVEN("xs <- intersections(i1,i2)")
AND_GIVEN("xs <- intersections(i1, i2)")
{
Intersections xs = Intersections({i2, i1});
WHEN("i <- hit(xs)")
@@ -481,13 +481,13 @@ SCENARIO("The hit, when all intersections have negative t", "[features/intersect
GIVEN("s <- sphere()")
{
Sphere s;
AND_GIVEN("i1 <- intersection(-2,s)")
AND_GIVEN("i1 <- intersection(-2, s)")
{
Intersection i1(-2, &s);
AND_GIVEN("i2 <- intersection(-1,s)")
AND_GIVEN("i2 <- intersection(-1, s)")
{
Intersection i2(-1, &s);
AND_GIVEN("xs <- intersections(i1,i2)")
AND_GIVEN("xs <- intersections(i1, i2)")
{
Intersections xs = Intersections({i1, i2});
WHEN("i <- hit(xs)")
@@ -512,16 +512,16 @@ SCENARIO("The hit is always the lowest nonnegative intersection", "[features/int
GIVEN("s <- sphere()")
{
Sphere s;
AND_GIVEN("i1 <- intersection(5,s)")
AND_GIVEN("i1 <- intersection(5, s)")
{
Intersection i1(5, &s);
AND_GIVEN("i2 <- intersection(7,s)")
AND_GIVEN("i2 <- intersection(7, s)")
{
Intersection i2(7, &s);
AND_GIVEN("i3 <- intersection(-3,s)")
AND_GIVEN("i3 <- intersection(-3, s)")
{
Intersection i3(-3, &s);
AND_GIVEN("i4 <- intersection(2,s)")
AND_GIVEN("i4 <- intersection(2, s)")
{
Intersection i4(2, &s);
AND_GIVEN("xs <- intersections(i1, i2, i3, i4)")
@@ -645,7 +645,7 @@ SCENARIO("Intersecting a scaled sphere with a ray", "[features/spheres.feature]"
AND_GIVEN("s <- Sphere()")
{
Sphere s;
WHEN("set_transform(s,scaling(2,2,2))")
WHEN("set_transform(s,scaling(2, 2, 2))")
{
s.set_transform(Matrix::scaling(2, 2, 2));
AND_WHEN("xs <- intersect(s,r)")