[FEAT] Material add transparency and refractive_index into material
This commit is contained in:
@@ -280,3 +280,43 @@ SCENARIO("The reflected color at the maximum recursive depth", "[features/world.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
SCENARIO("Transparency and Refractive Index for the default material", "[features/materials.feature]")
|
||||
{
|
||||
GIVEN("m <- material()")
|
||||
{
|
||||
Material m;
|
||||
THEN("m.transparency = 0.0")
|
||||
{
|
||||
REQUIRE(m.transparency() == 0.0);
|
||||
}
|
||||
AND_THEN("m.refractive_index = 1.0")
|
||||
{
|
||||
REQUIRE(m.refractive_index() == 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
SCENARIO("A helper for producing a sphere with a glassy material", "[features/spheres.feature]")
|
||||
{
|
||||
GIVEN("s <- glass_sphere()")
|
||||
{
|
||||
Sphere s = Sphere::Glass();
|
||||
THEN("s.transform = identity_matrix")
|
||||
{
|
||||
REQUIRE(s.transform() == Matrix::identity());
|
||||
}
|
||||
AND_THEN("s.material.transparency = 1.0")
|
||||
{
|
||||
REQUIRE(s.material().transparency() == 1.0);
|
||||
}
|
||||
AND_THEN("s.material.refractive_index = 1.5")
|
||||
{
|
||||
REQUIRE(s.material().refractive_index() == 1.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user