Fullres book cover and add timing.

Squelch clippy warning in camera.rs.
This commit is contained in:
Bill Thiede 2018-09-11 09:08:32 -07:00
parent 823e75da88
commit 0c9edd9e61
2 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,8 @@
extern crate rand; extern crate rand;
extern crate rtiow; extern crate rtiow;
use std::time::Instant;
use rand::Rng; use rand::Rng;
use rtiow::camera::Camera; use rtiow::camera::Camera;
@ -101,9 +103,10 @@ fn random_scene() -> Vec<Box<Hit>> {
} }
fn main() -> Result<(), std::io::Error> { fn main() -> Result<(), std::io::Error> {
let start = Instant::now();
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let nx = 200; let nx = 1200;
let ny = 100; let ny = 800;
let ns = 100; let ns = 100;
let (cam, world) = if BOOK_COVER { let (cam, world) = if BOOK_COVER {
let lookfrom = Vec3::new(13., 2., 3.); let lookfrom = Vec3::new(13., 2., 3.);
@ -184,5 +187,11 @@ fn main() -> Result<(), std::io::Error> {
println!("{} {} {}", ir, ig, ib); println!("{} {} {}", ir, ig, ib);
} }
} }
let runtime = start.elapsed();
eprintln!(
"Render time {}.{} seconds",
runtime.as_secs(),
runtime.subsec_millis()
);
Ok(()) Ok(())
} }

View File

@ -29,7 +29,6 @@ pub struct Camera {
vertical: Vec3, vertical: Vec3,
u: Vec3, u: Vec3,
v: Vec3, v: Vec3,
w: Vec3,
lens_radius: f32, lens_radius: f32,
} }
@ -59,7 +58,6 @@ impl Camera {
horizontal: 2. * half_width * focus_dist * u, horizontal: 2. * half_width * focus_dist * u,
vertical: 2. * half_height * focus_dist * v, vertical: 2. * half_height * focus_dist * v,
origin, origin,
w: (lookfrom - lookat).unit_vector(),
u: cross(vup, w).unit_vector(), u: cross(vup, w).unit_vector(),
v: cross(w, u), v: cross(w, u),
lens_radius: aperture / 2., lens_radius: aperture / 2.,