Enum ambient_audio::Attenuation
source · pub enum Attenuation {
InverseQuadratic(f32),
Exponential(f32),
Smoothstep {
density: f32,
gradient: f32,
},
InversePoly {
quad: f32,
lin: f32,
constant: f32,
},
}
Expand description
Defines the attenuation.
See: https://www.desmos.com/calculator/mpbzwayz5f
Variants§
InverseQuadratic(f32)
1/(ax^2)
Exponential(f32)
e^(-ax)
Smoothstep
e^(-(density*x)^gradient)
InversePoly
1 / (1 + linx + quadx^2)
Increasing lin leads to a sharper falloff, while increasing quad
leads to a bell shaped
smaller area.
Setting lin=0
creates a smooth bell shaped falloff that approaches the physically correct
inverse square law, without the infinite peak near 0.
Implementations§
Trait Implementations§
source§impl Clone for Attenuation
impl Clone for Attenuation
source§fn clone(&self) -> Attenuation
fn clone(&self) -> Attenuation
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Attenuation
impl Debug for Attenuation
source§impl Default for Attenuation
impl Default for Attenuation
source§impl<'de> Deserialize<'de> for Attenuation
impl<'de> Deserialize<'de> for Attenuation
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Editor for Attenuation
impl Editor for Attenuation
source§impl Serialize for Attenuation
impl Serialize for Attenuation
impl Copy for Attenuation
Auto Trait Implementations§
impl RefUnwindSafe for Attenuation
impl Send for Attenuation
impl Sync for Attenuation
impl Unpin for Attenuation
impl UnwindSafe for Attenuation
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> ElementComponentName for T
impl<T> ElementComponentName for T
§fn element_component_name(&self) -> &'static str
fn element_component_name(&self) -> &'static str
Returns the name of the type implementing [ElementComponent].
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.