rtiow: fix bug in calculation of t in Scale hitable.
This commit is contained in:
parent
1076e6dcaf
commit
deb46acb5a
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user