Skip to content

Commit

Permalink
chore: use color.is_finite() helper in sample()
Browse files Browse the repository at this point in the history
  • Loading branch information
Walther committed Oct 9, 2023
1 parent dbdf0ae commit 3f73203
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions clovers-cli/src/draw_cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ fn sample(
let v = (y + rng.gen::<Float>()) / height;
let ray: Ray = scene.camera.get_ray(u, v, rng);
let new_color = colorize(&ray, scene, 0, max_depth, rng);
// skip NaN and Infinity
if new_color.r.is_finite() && new_color.g.is_finite() && new_color.b.is_finite() {
return Some(new_color);
if new_color.is_finite() {
return Some(new_color.into());
}
None
}

0 comments on commit 3f73203

Please sign in to comment.