Fix PVS warning

This commit is contained in:
NADAL Jean-Baptiste
2024-02-28 10:37:53 +01:00
parent 78f1fee6cd
commit 9f109ffe30
2 changed files with 24 additions and 18 deletions

View File

@@ -74,25 +74,28 @@ int main(void)
// The large sphere in the middle is a unit sphere, translated upward slightly and colored green.
the_middle = new Sphere();
the_middle->set_transform(Matrix::translation(-0.5, 1, 0.5));
the_middle->material().set_color(Color(0.1, 1, 0.5));
the_middle->material().set_diffuse(0.7);
the_middle->material().set_specular(0.3);
Material &the_middle_material = the_middle->material();
the_middle_material.set_color(Color(0.1, 1, 0.5));
the_middle_material.set_diffuse(0.7);
the_middle_material.set_specular(0.3);
the_world.add_object(the_middle);
// The smaller green sphere on the right is scaled in half
the_right = new Sphere();
the_right->set_transform(Matrix::translation(1.5, 0.5, -0.5) * Matrix::scaling(0.5, 0.5, 0.5));
the_right->material().set_color(Color(0.5, 1, 0.1));
the_right->material().set_diffuse(0.7);
the_right->material().set_specular(0.3);
Material &the_right_material = the_right->material();
the_right_material.set_color(Color(0.5, 1, 0.1));
the_right_material.set_diffuse(0.7);
the_right_material.set_specular(0.3);
the_world.add_object(the_right);
// The smallest sphere is scaled by a third, before being translated
the_left = new Sphere();
the_left->set_transform(Matrix::translation(-1.5, 0.33, -0.75) * Matrix::scaling(0.33, 0.33, 0.33));
the_left->material().set_color(Color(1, 0.8, 0.1));
the_left->material().set_diffuse(0.7);
the_left->material().set_specular(0.3);
Material &the_left_material = the_left->material();
the_left_material.set_color(Color(1, 0.8, 0.1));
the_left_material.set_diffuse(0.7);
the_left_material.set_specular(0.3);
the_world.add_object(the_left);
// The Light source is white, shining from above and to the left

View File

@@ -58,25 +58,28 @@ int main(void)
// The large sphere in the middle is a unit sphere, translated upward slightly and colored green.
the_middle = new Sphere();
the_middle->set_transform(Matrix::translation(-0.5, 1, 0.5));
the_middle->material().set_color(Color(0.1, 1, 0.5));
the_middle->material().set_diffuse(0.7);
the_middle->material().set_specular(0.3);
Material &the_middle_material = the_middle->material();
the_middle_material.set_color(Color(0.1, 1, 0.5));
the_middle_material.set_diffuse(0.7);
the_middle_material.set_specular(0.3);
the_world.add_object(the_middle);
// The smaller green sphere on the right is scaled in half
the_right = new Sphere();
the_right->set_transform(Matrix::translation(1.5, 0.5, -0.5) * Matrix::scaling(0.5, 0.5, 0.5));
the_right->material().set_color(Color(0.5, 1, 0.1));
the_right->material().set_diffuse(0.7);
the_right->material().set_specular(0.3);
Material &the_right_material = the_right->material();
the_right_material.set_color(Color(0.5, 1, 0.1));
the_right_material.set_diffuse(0.7);
the_right_material.set_specular(0.3);
the_world.add_object(the_right);
// The smallest sphere is scaled by a third, before being translated
the_left = new Sphere();
the_left->set_transform(Matrix::translation(-1.5, 0.33, -0.75) * Matrix::scaling(0.33, 0.33, 0.33));
the_left->material().set_color(Color(1, 0.8, 0.1));
the_left->material().set_diffuse(0.7);
the_left->material().set_specular(0.3);
Material &the_left_material = the_left->material();
the_left_material.set_color(Color(1, 0.8, 0.1));
the_left_material.set_diffuse(0.7);
the_left_material.set_specular(0.3);
the_world.add_object(the_left);
// The Light source is white, shining from above and to the left