Slight tweak to how ray offsets are done.

This commit is contained in:
Nathan Vegdahl 2016-06-29 15:00:44 -07:00
parent 52acee33af
commit f1df7a3b1a
2 changed files with 10 additions and 2 deletions

View File

@ -89,6 +89,14 @@ impl Sub for Point {
} }
} }
impl Sub<Vector> for Point {
type Output = Point;
fn sub(self, other: Vector) -> Point {
Point { co: self.co - other.co }
}
}
impl Mul<Matrix4x4> for Point { impl Mul<Matrix4x4> for Point {
type Output = Point; type Output = Point;

View File

@ -268,8 +268,8 @@ impl LightPath {
let la = dot(rnor, shadow_vec.normalized()).max(0.0); let la = dot(rnor, shadow_vec.normalized()).max(0.0);
self.light_attenuation = XYZ::from_spectral_sample(&XYZ::new(la, la, la) self.light_attenuation = XYZ::from_spectral_sample(&XYZ::new(la, la, la)
.to_spectral_sample(self.wavelength)); .to_spectral_sample(self.wavelength));
*ray = Ray::new(pos + shadow_vec.normalized() * 0.0001, *ray = Ray::new(pos + rnor * 0.0001,
shadow_vec, shadow_vec - rnor * 0.0001,
self.time, self.time,
true); true);