This commit is contained in:
2023-01-31 01:20:07 +01:00
parent b764470c77
commit 0a70a1e1de
4 changed files with 50 additions and 6 deletions

View File

@@ -30,8 +30,10 @@ fn ray_color(r: &Ray, world: &mut dyn Hittable, depth: i32) -> Color {
}
if world.hit(r, 0.001, INFINITY, &mut rec) {
let target = rec.p + random_in_hemisphere(&rec.normal);
return 0.5 * ray_color(&Ray::new(rec.p, target - rec.p), world, depth - 1)
let mut scattered = Ray::new_empty();
let mut attenuation = Color::new_empty();
if rec.mat_ptr
}
let unit_direction: Vec3 = r.direction().unit_vector();