Rebase with master.

This commit is contained in:
Bill Thiede 2018-09-14 13:06:09 -07:00
parent ca4a385438
commit a4556212ed
2 changed files with 7 additions and 3 deletions

View File

@ -178,6 +178,8 @@ fn build_scene_cube(opt: &Opt) -> Scene {
let lookat = Vec3::new(0., 0., 0.); let lookat = Vec3::new(0., 0., 0.);
let dist_to_focus = (lookfrom - lookat).length(); let dist_to_focus = (lookfrom - lookat).length();
let aperture = 0.1; let aperture = 0.1;
let time_min = 0.;
let time_max = 1.;
let camera = Camera::new( let camera = Camera::new(
lookfrom, lookfrom,
lookat, lookat,
@ -186,6 +188,8 @@ fn build_scene_cube(opt: &Opt) -> Scene {
opt.width as f32 / opt.height as f32, opt.width as f32 / opt.height as f32,
aperture, aperture,
dist_to_focus, dist_to_focus,
time_min,
time_max,
); );
let world = HitableList::new(vec![ let world = HitableList::new(vec![
Box::new(Sphere::new( Box::new(Sphere::new(

View File

@ -23,9 +23,9 @@ impl Cube {
impl Hit for Cube { impl Hit for Cube {
fn hit(&self, r: Ray, t_min: f32, t_max: f32) -> Option<HitRecord> { fn hit(&self, r: Ray, t_min: f32, t_max: f32) -> Option<HitRecord> {
let oc = r.origin() - self.center; let oc = r.origin - self.center;
let a = dot(r.direction(), r.direction()); let a = dot(r.direction, r.direction);
let b = dot(oc, r.direction()); let b = dot(oc, r.direction);
let c = dot(oc, oc) - self.length * self.length; let c = dot(oc, oc) - self.length * self.length;
let discriminant = b * b - a * c; let discriminant = b * b - a * c;
if discriminant > 0. { if discriminant > 0. {