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,6 +496,8 @@ fn render_worker(
Ok(req) => match req {
Request::Line { width, y } => {
trace!("tid {} width {} y {}", tid, width, y);
let batch = true;
if batch {
let (pixels, rays): (Vec<Vec3>, Vec<usize>) = (0..width)
.map(|x| render_pixel(scene, x, y))
.collect::<Vec<(_, _)>>()
@ -512,6 +514,19 @@ fn render_worker(
},
})
.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 } => {
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;
info!(
"Summary: {}",
"Runtime {} seconds {}",
time_diff.as_secs_f32(),
progress(&Default::default(), &current_stat, time_diff, pixel_total)
);