library: render: progress: fix refresh for pathtracing
This commit is contained in:
parent
b89e01107d
commit
82dee9fde5
|
@ -38,7 +38,7 @@ impl Pathtracer {
|
|||
);
|
||||
let total = width * height;
|
||||
|
||||
let p = super::super::progress::get_progressbar(self.scene.shot_rays as u64);
|
||||
let p = super::super::progress::get_passes_progressbar(self.scene.shot_rays);
|
||||
|
||||
// Ensure at least one round of shots
|
||||
let img_buf = (0..self.scene.shot_rays.max(1))
|
||||
|
|
|
@ -1,10 +1,26 @@
|
|||
use indicatif::ProgressBar;
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
|
||||
pub fn get_progressbar(total: u64) -> ProgressBar {
|
||||
pub fn get_progressbar(total: u64, style: &str) -> ProgressBar {
|
||||
let pb = ProgressBar::new(total);
|
||||
pb.set_draw_delta((total / 10000).max(1));
|
||||
pb.set_style(indicatif::ProgressStyle::default_bar().template(
|
||||
"{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {percent:>3}%: {pos}/{len} pixels (ETA: {eta})",
|
||||
));
|
||||
pb.set_style(ProgressStyle::default_bar().template(style));
|
||||
pb
|
||||
}
|
||||
|
||||
pub fn get_pixels_progressbar(total: u64) -> ProgressBar {
|
||||
get_progressbar(
|
||||
total,
|
||||
"{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {percent:>3}%: {pos}/{len} pixels (ETA: {eta})",
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_passes_progressbar(total: u32) -> ProgressBar {
|
||||
let pb = get_progressbar(
|
||||
total as u64,
|
||||
"{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {percent:>3}%: {pos}/{len} passes (ETA: {eta})",
|
||||
);
|
||||
|
||||
pb.enable_steady_tick(1000);
|
||||
|
||||
pb
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ impl Raytracer {
|
|||
);
|
||||
|
||||
let total = (image.width() * image.height()) as u64;
|
||||
let pb = super::super::progress::get_progressbar(total);
|
||||
let pb = super::super::progress::get_pixels_progressbar(total);
|
||||
|
||||
let pixel_func = if self.scene.shot_rays > 0 {
|
||||
Self::anti_alias_pixel
|
||||
|
|
Loading…
Reference in a new issue