Files
texturecraft/crates/bake/src/progress.rs
T
Rebornim 4a56683bb9 Rebake the auto-rebake map inside a skew or cage stroke
A skew or cage stroke on a set that bakes from a high poly marks its UV
box; in Bake mode the app then bakes the set's auto-rebake map again
only there (one texel wider, for the paint map's sampling), keeps the
rest of the stored map and pads the whole map, so its pixels match a
whole bake. Maps scaled by their whole range (curvature, height,
thickness), UV-tiled sets and a map stored at another size bake whole.
A stroke painted while that bake runs is baked by the next one. The bake
crate gains bake_tiles_in with a texel box.
2026-11-27 06:12:44 +00:00

26 lines
569 B
Rust

use std::sync::atomic::{AtomicBool, AtomicU32, Ordering::Relaxed};
#[derive(Debug, Default)]
pub struct Progress {
/// Completed basis points, from 0 to 10,000
pub done: AtomicU32,
pub cancel: AtomicBool,
}
impl Progress {
/// The basis points of a finished bake
pub const DONE: u32 = 10_000;
pub fn new() -> Self {
Self::default()
}
pub fn fraction(&self) -> f32 {
self.done.load(Relaxed).min(Self::DONE) as f32 / Self::DONE as f32
}
pub fn cancel(&self) {
self.cancel.store(true, Relaxed);
}
}