pub struct DopplerRenderer {
pub c: f64,
pub observer_pos: Vec3,
pub intensity_shift: bool,
}Expand description
Renderer that shifts entity colors based on radial velocity toward observer.
Fields§
§c: f64§observer_pos: Vec3§intensity_shift: boolImplementations§
Source§impl DopplerRenderer
impl DopplerRenderer
pub fn new(c: f64, observer_pos: Vec3) -> Self
Sourcepub fn shifted_color(
&self,
base_color: Vec4,
entity_pos: Vec3,
entity_velocity: Vec3,
) -> Vec4
pub fn shifted_color( &self, base_color: Vec4, entity_pos: Vec3, entity_velocity: Vec3, ) -> Vec4
Compute the Doppler-shifted color for an entity.
Sourcepub fn frequency_ratio(&self, entity_pos: Vec3, entity_velocity: Vec3) -> f64
pub fn frequency_ratio(&self, entity_pos: Vec3, entity_velocity: Vec3) -> f64
Compute the Doppler frequency ratio (observed/emitted).
Sourcepub fn shift_colors(&self, entities: &[(Vec3, Vec3, Vec4)]) -> Vec<Vec4>
pub fn shift_colors(&self, entities: &[(Vec3, Vec3, Vec4)]) -> Vec<Vec4>
Batch process: shift colors for multiple entities.
Sourcepub fn intensity_factor(&self, entity_pos: Vec3, entity_velocity: Vec3) -> f32
pub fn intensity_factor(&self, entity_pos: Vec3, entity_velocity: Vec3) -> f32
Compute intensity scaling from Doppler effect. Intensity scales as (f_obs/f_source)^3 for a moving isotropic source.
Trait Implementations§
Source§impl Clone for DopplerRenderer
impl Clone for DopplerRenderer
Auto Trait Implementations§
impl Freeze for DopplerRenderer
impl RefUnwindSafe for DopplerRenderer
impl Send for DopplerRenderer
impl Sync for DopplerRenderer
impl Unpin for DopplerRenderer
impl UnsafeUnpin for DopplerRenderer
impl UnwindSafe for DopplerRenderer
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<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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.