diff --git a/pathtracer/Cargo.toml b/pathtracer/Cargo.toml index f80ec3b..eaaf50b 100644 --- a/pathtracer/Cargo.toml +++ b/pathtracer/Cargo.toml @@ -23,13 +23,16 @@ beevee = { path = "../beevee" } derive_more = "0.99.3" enum_dispatch = "0.2.1" image = "0.23.0" -indicatif = "0.14.0" rand = "0.7" rayon = "1.3.0" serde_yaml = "0.8" structopt = "0.3" tobj = "1.0" +[dependencies.indicatif] +version = "0.14" +features = ["with_rayon"] + [dependencies.nalgebra] version = "0.20.0" features = ["serde-serialize"] diff --git a/pathtracer/src/render/pathtrace/pathtracer.rs b/pathtracer/src/render/pathtrace/pathtracer.rs index e69184f..a5612ed 100644 --- a/pathtracer/src/render/pathtrace/pathtracer.rs +++ b/pathtracer/src/render/pathtrace/pathtracer.rs @@ -1,3 +1,4 @@ +use indicatif::ParallelProgressIterator; use rayon::prelude::*; use super::super::utils::{buffer_to_image, sample_hemisphere}; @@ -43,6 +44,7 @@ impl Pathtracer { // Ensure at least one round of shots let img_buf = (0..self.scene.shot_rays.max(1)) .into_par_iter() + .progress_with(p) .map(|_| { let mut buffer: Vec = Vec::new(); buffer.resize_with(total as usize, LinearColor::black); @@ -53,7 +55,6 @@ impl Pathtracer { buffer[i as usize] += self.pixel_ray(x as f32, y as f32); } } - p.inc(1); // Increment the number of passes buffer }) @@ -72,8 +73,6 @@ impl Pathtracer { }, ); - p.finish(); - buffer_to_image(img_buf, self.scene.shot_rays, width, height) }