pub struct ScalarEncoding {
pub power: u8,
pub root: u8,
pub scale_bits: u32,
}Expand description
How a scalar is stored in the lanes of an output: stored = (value / scale)^(root / power), so the value is
stored^(power / root) * scale (the scale given by its f32 bits). Power and root 1 are linear; power 2 a square root
stored (a value kept in a perceptual range), 4 a fourth root; root 2 a square stored (a value the lighting takes the
square root of).
Fields§
§power: u8The power the stored value is raised to, to give the value over the scale: 1 for none, 2 for the square root stored, 4 for the fourth root. Never 0.
root: u8The root taken of the stored value raised to power: 1 for none, 2 for the square stored. Never 0.
scale_bits: u32The scale’s f32 bits (1.0 for none): bits so the encoding compares and hashes exactly; it is written as the
number scale.
Implementations§
Source§impl ScalarEncoding
impl ScalarEncoding
Sourcepub fn linear_over(scale: f32) -> Self
pub fn linear_over(scale: f32) -> Self
Stored as the value over scale, no power.
Sourcepub fn square_root_of(scale: f32) -> Self
pub fn square_root_of(scale: f32) -> Self
Stored as the square root of the value over scale.
Sourcepub fn power_of(power: u8, scale: f32) -> Self
pub fn power_of(power: u8, scale: f32) -> Self
Stored as the powerth root of the value over scale (power 0 is taken as 1: no power).
Trait Implementations§
Source§impl Clone for ScalarEncoding
impl Clone for ScalarEncoding
impl Copy for ScalarEncoding
Source§impl Debug for ScalarEncoding
impl Debug for ScalarEncoding
impl Eq for ScalarEncoding
Source§impl Hash for ScalarEncoding
impl Hash for ScalarEncoding
Source§impl PartialEq for ScalarEncoding
impl PartialEq for ScalarEncoding
Source§impl Serialize for ScalarEncoding
impl Serialize for ScalarEncoding
impl StructuralPartialEq for ScalarEncoding
Auto Trait Implementations§
impl Forget for ScalarEncoding
impl Freeze for ScalarEncoding
impl RefUnwindSafe for ScalarEncoding
impl Send for ScalarEncoding
impl Sync for ScalarEncoding
impl Unpin for ScalarEncoding
impl UnsafeUnpin for ScalarEncoding
impl UnwindSafe for ScalarEncoding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.