rtiow: option to send Request::Line results as Line or Pixel.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
848e9879cb
commit
c903a743b5
@ -496,22 +496,37 @@ fn render_worker(
|
||||
Ok(req) => match req {
|
||||
Request::Line { width, y } => {
|
||||
trace!("tid {} width {} y {}", tid, width, y);
|
||||
let (pixels, rays): (Vec<Vec3>, Vec<usize>) = (0..width)
|
||||
.map(|x| render_pixel(scene, x, y))
|
||||
.collect::<Vec<(_, _)>>()
|
||||
.into_iter()
|
||||
.unzip();
|
||||
let rays = rays.iter().sum();
|
||||
output_chan
|
||||
.send(Response::Line {
|
||||
y,
|
||||
pixels,
|
||||
rs: RenderStats {
|
||||
rays,
|
||||
pixels: width,
|
||||
},
|
||||
})
|
||||
.expect("failed to send pixel response");
|
||||
let batch = true;
|
||||
if batch {
|
||||
let (pixels, rays): (Vec<Vec3>, Vec<usize>) = (0..width)
|
||||
.map(|x| render_pixel(scene, x, y))
|
||||
.collect::<Vec<(_, _)>>()
|
||||
.into_iter()
|
||||
.unzip();
|
||||
let rays = rays.iter().sum();
|
||||
output_chan
|
||||
.send(Response::Line {
|
||||
y,
|
||||
pixels,
|
||||
rs: RenderStats {
|
||||
rays,
|
||||
pixels: width,
|
||||
},
|
||||
})
|
||||
.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(), ¤t_stat, time_diff, pixel_total)
|
||||
);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user