rtiow: option to send Request::Line results as Line or Pixel.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bill Thiede 2019-10-21 21:27:12 -07:00
parent 848e9879cb
commit c903a743b5

View File

@ -496,22 +496,37 @@ fn render_worker(
Ok(req) => match req { Ok(req) => match req {
Request::Line { width, y } => { Request::Line { width, y } => {
trace!("tid {} width {} y {}", tid, width, y); trace!("tid {} width {} y {}", tid, width, y);
let (pixels, rays): (Vec<Vec3>, Vec<usize>) = (0..width) let batch = true;
.map(|x| render_pixel(scene, x, y)) if batch {
.collect::<Vec<(_, _)>>() let (pixels, rays): (Vec<Vec3>, Vec<usize>) = (0..width)
.into_iter() .map(|x| render_pixel(scene, x, y))
.unzip(); .collect::<Vec<(_, _)>>()
let rays = rays.iter().sum(); .into_iter()
output_chan .unzip();
.send(Response::Line { let rays = rays.iter().sum();
y, output_chan
pixels, .send(Response::Line {
rs: RenderStats { y,
rays, pixels,
pixels: width, rs: RenderStats {
}, rays,
}) pixels: width,
.expect("failed to send pixel response"); },
})
.expect("failed to send pixel response");
} else {
(0..width).for_each(|x| {
let (pixel, rays) = render_pixel(scene, x, y);
output_chan
.send(Response::Pixel {
x,
y,
pixel,
rs: RenderStats { rays, pixels: 1 },
})
.expect("failed to send pixel response");
});
}
} }
Request::Pixel { x, y } => { Request::Pixel { x, y } => {
trace!("tid {} x {} y {}", tid, x, y); trace!("tid {} x {} y {}", tid, x, y);
@ -632,7 +647,8 @@ pub fn render(scene: Scene, output_dir: &Path) -> std::result::Result<(), std::i
} }
let time_diff = time::Instant::now() - start_time; let time_diff = time::Instant::now() - start_time;
info!( info!(
"Summary: {}", "Runtime {} seconds {}",
time_diff.as_secs_f32(),
progress(&Default::default(), &current_stat, time_diff, pixel_total) progress(&Default::default(), &current_stat, time_diff, pixel_total)
); );