library: render: move progressbar creation to module
This commit is contained in:
parent
70a923cf26
commit
6066fe00dc
|
@ -18,4 +18,5 @@ pub use pathtrace::*;
|
|||
mod raytrace;
|
||||
pub use raytrace::*;
|
||||
|
||||
pub(crate) mod progress;
|
||||
pub(crate) mod utils;
|
||||
|
|
10
pathtracer/src/render/progress.rs
Normal file
10
pathtracer/src/render/progress.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use indicatif::ProgressBar;
|
||||
|
||||
pub fn get_progressbar(total: u64) -> ProgressBar {
|
||||
let pb = ProgressBar::new(total);
|
||||
pb.set_draw_delta(total / 10000);
|
||||
pb.set_style(indicatif::ProgressStyle::default_bar().template(
|
||||
"{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {percent:>3}%: {pos}/{len} pixels (ETA: {eta})",
|
||||
));
|
||||
pb
|
||||
}
|
|
@ -40,11 +40,7 @@ impl Raytracer {
|
|||
);
|
||||
|
||||
let total = (image.width() * image.height()) as u64;
|
||||
let pb = indicatif::ProgressBar::new(total);
|
||||
pb.set_draw_delta(total / 10000);
|
||||
pb.set_style(indicatif::ProgressStyle::default_bar().template(
|
||||
"{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {percent:>3}%: {pos}/{len} pixels (ETA: {eta})",
|
||||
));
|
||||
let pb = super::super::progress::get_progressbar(total);
|
||||
|
||||
let pixel_func = if self.scene.shot_rays > 0 {
|
||||
Self::anti_alias_pixel
|
||||
|
|
Loading…
Reference in a new issue