diff options
Diffstat (limited to 'src/render.rs')
-rw-r--r-- | src/render.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/render.rs b/src/render.rs index dcda672..7d05aba 100644 --- a/src/render.rs +++ b/src/render.rs @@ -4,12 +4,11 @@ use crate::camera::film::FilmTile; use crate::camera::Camera; use crate::scene::Scene; +use crate::trace::Tracer; -use crate::core::{Vector2f, Spectrum}; +use crate::core::{Vector2f, Vector3f, Spectrum}; use crate::Float; -const HALF_PIXEL: Vector2f = Vector2f {x: 0.5, y: 0.5 }; - pub struct RenderTask { pub tile: Box<FilmTile>, samples: u32, @@ -18,6 +17,7 @@ pub struct RenderTask { pub struct RenderContext<'a> { pub scn: &'a Scene, pub cam: &'a Camera, + pub trc: &'a Tracer, } impl RenderTask { @@ -29,13 +29,7 @@ impl RenderTask { // Create a ray let (r, _) = ctx.cam.generate_ray(&Vector2f::new_xy(x as Float, y as Float)); - // Trace ray - if let Some(_) = ctx.scn.intersect(r) { - return Spectrum::new_rgb(0.5, 0.5, 0.0); - } - - Spectrum::new_rgb(0.0, 0.0, 0.0) - + ctx.trc.trace(ctx.scn, &r) } pub fn render(&mut self, ctx: &RenderContext) { |