diff --git a/rtiow/src/renderer.rs b/rtiow/src/renderer.rs index 5355e9d..ce4583a 100644 --- a/rtiow/src/renderer.rs +++ b/rtiow/src/renderer.rs @@ -294,16 +294,8 @@ enum Request { } enum Response { - Pixel { - x: usize, - y: usize, - pixel: Vec3, - }, - Line { - width: usize, - y: usize, - pixels: Vec, - }, + Pixel { x: usize, y: usize, pixel: Vec3 }, + Line { y: usize, pixels: Vec }, } static PIXEL_COUNT: AtomicUsize = AtomicUsize::new(0); @@ -341,12 +333,16 @@ fn render_worker( Request::Line { width, y } => { trace!("tid {} width {} y {}", tid, width, y); let pixels = (0..width).map(|x| render_pixel(scene, x, y)).collect(); - output_chan.send(Response::Line { width, y, pixels }); + output_chan + .send(Response::Line { y, pixels }) + .expect("failed to send pixel response"); } Request::Pixel { x, y } => { trace!("tid {} x {} y {}", tid, x, y); let pixel = render_pixel(scene, x, y); - output_chan.send(Response::Pixel { x, y, pixel }); + output_chan + .send(Response::Pixel { x, y, pixel }) + .expect("failed to send line response"); } }, } @@ -378,12 +374,16 @@ pub fn render(scene: Scene, output_dir: &Path) -> std::result::Result<(), std::i let batch_line_requests = true; if batch_line_requests { for y in 0..h { - pixel_req_tx.send(Request::Line { width: w, y }); + pixel_req_tx + .send(Request::Line { width: w, y }) + .expect("failed to send line request"); } } else { for y in 0..h { for x in 0..w { - pixel_req_tx.send(Request::Pixel { x, y }); + pixel_req_tx + .send(Request::Pixel { x, y }) + .expect("failed to send pixel request"); } } } @@ -435,11 +435,7 @@ pub fn render(scene: Scene, output_dir: &Path) -> std::result::Result<(), std::i ]), ); } - Response::Line { - width: _, - y, - pixels, - } => { + Response::Line { y, pixels } => { for (x, pixel) in pixels.iter().enumerate() { let y_inv = scene.height - y - 1; img.put_pixel(