diff --git a/rtiow/src/bin/tracer.rs b/rtiow/src/bin/tracer.rs index 6eefec5..313382c 100644 --- a/rtiow/src/bin/tracer.rs +++ b/rtiow/src/bin/tracer.rs @@ -178,6 +178,8 @@ fn build_scene_cube(opt: &Opt) -> Scene { let lookat = Vec3::new(0., 0., 0.); let dist_to_focus = (lookfrom - lookat).length(); let aperture = 0.1; + let time_min = 0.; + let time_max = 1.; let camera = Camera::new( lookfrom, lookat, @@ -186,6 +188,8 @@ fn build_scene_cube(opt: &Opt) -> Scene { opt.width as f32 / opt.height as f32, aperture, dist_to_focus, + time_min, + time_max, ); let world = HitableList::new(vec![ Box::new(Sphere::new( diff --git a/rtiow/src/cube.rs b/rtiow/src/cube.rs index b127e46..21b8e06 100644 --- a/rtiow/src/cube.rs +++ b/rtiow/src/cube.rs @@ -23,9 +23,9 @@ impl Cube { impl Hit for Cube { fn hit(&self, r: Ray, t_min: f32, t_max: f32) -> Option { - let oc = r.origin() - self.center; - let a = dot(r.direction(), r.direction()); - let b = dot(oc, r.direction()); + let oc = r.origin - self.center; + let a = dot(r.direction, r.direction); + let b = dot(oc, r.direction); let c = dot(oc, oc) - self.length * self.length; let discriminant = b * b - a * c; if discriminant > 0. {