rtiow: fix bug in calculation of t in Scale hitable.

This commit is contained in:
Bill Thiede 2023-02-13 20:55:13 -08:00
parent 1076e6dcaf
commit deb46acb5a

View File

@ -11,21 +11,15 @@ where
H: Hit,
{
hitable: H,
scale: Vec3,
scale: f32,
}
impl<H> Scale<H>
where
H: Hit,
{
pub fn new<V>(hitable: H, scale: V) -> Scale<H>
where
V: Into<Vec3>,
{
Scale {
hitable,
scale: scale.into(),
}
pub fn new(hitable: H, scale: f32) -> Scale<H> {
Scale { hitable, scale }
}
}
@ -38,6 +32,7 @@ where
if let Some(rec) = self.hitable.hit(moved_r, t_min, t_max) {
return Some(HitRecord {
p: rec.p * self.scale,
t: rec.t * self.scale,
..rec
});
}