Use Float4::splat() in AccelRay methods.

This commit is contained in:
Nathan Vegdahl 2018-06-29 17:28:39 -07:00
parent 6d21a30840
commit 989914b878

View File

@ -66,7 +66,7 @@ impl AccelRay {
AccelRay { AccelRay {
orig: ray.orig, orig: ray.orig,
dir_inv: Vector { dir_inv: Vector {
co: Float4::new(1.0, 1.0, 1.0, 1.0) / ray.dir.co, co: Float4::splat(1.0) / ray.dir.co,
}, },
max_t: ray.max_t, max_t: ray.max_t,
time: ray.time, time: ray.time,
@ -78,14 +78,14 @@ impl AccelRay {
pub fn update_from_world_ray(&mut self, wr: &Ray) { pub fn update_from_world_ray(&mut self, wr: &Ray) {
self.orig = wr.orig; self.orig = wr.orig;
self.dir_inv = Vector { self.dir_inv = Vector {
co: Float4::new(1.0, 1.0, 1.0, 1.0) / wr.dir.co, co: Float4::splat(1.0) / wr.dir.co,
}; };
} }
pub fn update_from_xformed_world_ray(&mut self, wr: &Ray, mat: &Matrix4x4) { pub fn update_from_xformed_world_ray(&mut self, wr: &Ray, mat: &Matrix4x4) {
self.orig = wr.orig * *mat; self.orig = wr.orig * *mat;
self.dir_inv = Vector { self.dir_inv = Vector {
co: Float4::new(1.0, 1.0, 1.0, 1.0) / (wr.dir * *mat).co, co: Float4::splat(1.0) / (wr.dir * *mat).co,
}; };
} }