Enum DistanceModel
pub enum DistanceModel {
Inverse {
ref_distance: f32,
max_distance: f32,
rolloff_factor: f32,
},
Linear {
ref_distance: f32,
max_distance: f32,
rolloff_factor: f32,
},
Exponential {
ref_distance: f32,
max_distance: f32,
rolloff_factor: f32,
},
}Expand description
Distance attenuation model.
Variants§
Inverse
Inverse distance falloff: gain = ref_dist / (ref_dist + rolloff * (dist - ref_dist)).
Linear
Linear distance falloff: gain = 1 - rolloff * (dist - ref_dist) / (max_dist - ref_dist).
Exponential
Exponential distance falloff: gain = (dist / ref_dist)^(-rolloff).
Implementations§
§impl DistanceModel
impl DistanceModel
pub fn calculate_gain(&self, distance: f32) -> f32
pub fn calculate_gain(&self, distance: f32) -> f32
Calculates distance attenuation gain in range [0.0, 1.0].
Trait Implementations§
§impl Clone for DistanceModel
impl Clone for DistanceModel
§fn clone(&self) -> DistanceModel
fn clone(&self) -> DistanceModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for DistanceModel
§impl Debug for DistanceModel
impl Debug for DistanceModel
§impl Default for DistanceModel
impl Default for DistanceModel
§fn default() -> DistanceModel
fn default() -> DistanceModel
Returns the “default value” for a type. Read more
§impl PartialEq for DistanceModel
impl PartialEq for DistanceModel
impl StructuralPartialEq for DistanceModel
Auto Trait Implementations§
impl Freeze for DistanceModel
impl RefUnwindSafe for DistanceModel
impl Send for DistanceModel
impl Sync for DistanceModel
impl Unpin for DistanceModel
impl UnsafeUnpin for DistanceModel
impl UnwindSafe for DistanceModel
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
Mutably borrows from an owned value. Read more