diff --git a/rtiow/src/bin/tracer.rs b/rtiow/src/bin/tracer.rs index 67ec0f1..2fd39f0 100644 --- a/rtiow/src/bin/tracer.rs +++ b/rtiow/src/bin/tracer.rs @@ -1,6 +1,8 @@ extern crate rand; extern crate rtiow; +use std::time::Instant; + use rand::Rng; use rtiow::camera::Camera; @@ -101,9 +103,10 @@ fn random_scene() -> Vec> { } fn main() -> Result<(), std::io::Error> { + let start = Instant::now(); let mut rng = rand::thread_rng(); - let nx = 200; - let ny = 100; + let nx = 1200; + let ny = 800; let ns = 100; let (cam, world) = if BOOK_COVER { let lookfrom = Vec3::new(13., 2., 3.); @@ -184,5 +187,11 @@ fn main() -> Result<(), std::io::Error> { println!("{} {} {}", ir, ig, ib); } } + let runtime = start.elapsed(); + eprintln!( + "Render time {}.{} seconds", + runtime.as_secs(), + runtime.subsec_millis() + ); Ok(()) } diff --git a/rtiow/src/camera.rs b/rtiow/src/camera.rs index 7a815a6..1b961c6 100644 --- a/rtiow/src/camera.rs +++ b/rtiow/src/camera.rs @@ -29,7 +29,6 @@ pub struct Camera { vertical: Vec3, u: Vec3, v: Vec3, - w: Vec3, lens_radius: f32, } @@ -59,7 +58,6 @@ impl Camera { horizontal: 2. * half_width * focus_dist * u, vertical: 2. * half_height * focus_dist * v, origin, - w: (lookfrom - lookat).unit_vector(), u: cross(vup, w).unit_vector(), v: cross(w, u), lens_radius: aperture / 2.,