[WIP] stripe-pattern is now ok.
This commit is contained in:
@@ -77,10 +77,10 @@ int shadow_sphere(uint8_t a_canvas_pixels, double a_wall_size, uint8_t a_wall_z)
|
||||
if (the_intersec.is_defined())
|
||||
{
|
||||
Tuple the_point = the_ray.position(the_intersec.distance_t());
|
||||
Tuple the_normal = the_intersec.object().normal_at(the_point);
|
||||
Tuple the_normal = the_intersec.object()->normal_at(the_point);
|
||||
Tuple the_eye = -the_ray.direction();
|
||||
Color the_color =
|
||||
the_intersec.object().material().lighting(the_light, the_point, the_eye, the_normal, false);
|
||||
Color the_color = the_intersec.object()->material().lighting(nullptr, the_light, the_point, the_eye,
|
||||
the_normal, false);
|
||||
the_canvas.write_pixel(x, y, the_color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ int main(void)
|
||||
Material &the_floor_material = the_floor->material();
|
||||
the_floor_material.set_color(Color(1, 0.9, 0.9));
|
||||
the_floor_material.set_specular(0);
|
||||
the_floor_material.set_pattern(new StripePattern(Color(1, 1, 1), Color(0, 0, 0)));
|
||||
the_floor_material.set_pattern(new StripePattern(Color(1, 1, 1), Color(1, 0.9, 0.9)));
|
||||
the_world.add_object(the_floor);
|
||||
|
||||
// The large sphere in the middle is a unit sphere, translated upward slightly and colored green.
|
||||
@@ -62,6 +62,7 @@ int main(void)
|
||||
the_middle->set_transform(Matrix::translation(-0.5, 1, 0.5));
|
||||
Material &the_middle_material = the_middle->material();
|
||||
the_middle_material.set_color(Color(0.1, 1, 0.5));
|
||||
the_middle_material.set_pattern(new StripePattern(Color(1, 1, 1), 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);
|
||||
|
||||
Reference in New Issue
Block a user