Rebase with master.
This commit is contained in:
parent
ca4a385438
commit
a4556212ed
@ -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(
|
||||
|
||||
@ -23,9 +23,9 @@ impl Cube {
|
||||
|
||||
impl Hit for Cube {
|
||||
fn hit(&self, r: Ray, t_min: f32, t_max: f32) -> Option<HitRecord> {
|
||||
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. {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user