pub enum IntRange {
Linear {
min: i32,
max: i32,
},
Reversed(&'static IntRange),
}
Expand description
A distribution for an integer parameter’s range. All range endpoints are inclusive. Only linear ranges are supported for integers since hosts expect discrete parameters to have a fixed step size.
Variants§
Linear
The values are uniformly distributed between min
and max
.
Reversed(&'static IntRange)
A reversed range that goes from high to low instead of from low to high.
Implementations§
source§impl IntRange
impl IntRange
sourcepub fn normalize(&self, plain: i32) -> f32
pub fn normalize(&self, plain: i32) -> f32
Normalize a plain, unnormalized value. Will be clamped to the bounds of the range if the
normalized value exceeds [0, 1]
.
sourcepub fn unnormalize(&self, normalized: f32) -> i32
pub fn unnormalize(&self, normalized: f32) -> i32
Unnormalize a normalized value. Will be clamped to [0, 1]
if the plain, unnormalized value
would exceed that range.
sourcepub fn previous_step(&self, from: i32) -> i32
pub fn previous_step(&self, from: i32) -> i32
The range’s previous discrete step from a certain value.
sourcepub fn step_count(&self) -> usize
pub fn step_count(&self) -> usize
The number of steps in this range. Used for the host’s generic UI.
sourcepub fn inner_range(&self) -> Self
pub fn inner_range(&self) -> Self
If this range is wrapped in an adapter, like Reversed
, then return the wrapped range.