pub enum Quantization {
Bits(u8),
MaxError(f32),
Bounded {
range: f32,
max_error: f32,
},
}Expand description
How the quantization resolution (number of bits) for an attribute is
determined. All variants ultimately resolve to a bit count in 1..=30
(Draco’s cap) via Quantization::resolve.
Variants§
Bits(u8)
Explicit number of quantization bits.
MaxError(f32)
Derive the bit count from a maximum tolerated quantization error, measured against the attribute’s observed value range (the largest per-axis extent scanned from the data).
Bounded
Derive the bit count from a maximum tolerated error against a
caller-supplied domain, making the resolution independent of any single
mesh’s extent. range is the largest per-axis span of the bounding box
(see Quantization::from_bounding_box).
Implementations§
Source§impl Quantization
impl Quantization
Sourcepub fn from_bounding_box(min: &[f32], max: &[f32], max_error: f32) -> Self
pub fn from_bounding_box(min: &[f32], max: &[f32], max_error: f32) -> Self
Builds a Quantization::Bounded from an explicit axis-aligned bounding
box; the largest per-axis span sets the resolution.
Sourcepub fn resolve(self, observed_range: f32) -> u8
pub fn resolve(self, observed_range: f32) -> u8
Resolves this spec to a concrete number of quantization bits, clamped to
1..=30. observed_range is the largest per-axis extent of the data,
used only by Quantization::MaxError; other variants ignore it.
Trait Implementations§
Source§impl Clone for Quantization
impl Clone for Quantization
Source§fn clone(&self) -> Quantization
fn clone(&self) -> Quantization
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more