ft: 9: diffuse materials

This commit is contained in:
2026-04-15 15:18:33 +02:00
parent 5d18a57799
commit e8f84b590b
6 changed files with 332 additions and 15 deletions

View File

@@ -28,7 +28,9 @@ impl Hit {
for hittable in hittables {
if let Some(hit) = hittable.hit(r) {
// hit happens in front of camera and is closer than closest
if *hit.t() > 0. && (closest.is_none() || closest.as_ref().unwrap().t() > hit.t()) {
if *hit.t() > 0.001
&& (closest.is_none() || closest.as_ref().unwrap().t() > hit.t())
{
closest = Some(hit);
}
}