pub struct ForceComposite {
pub fields: Vec<ForceField>,
pub blend_mode: ForceBlendMode,
pub global_scale: f32,
}Expand description
A group of force fields evaluated together with a blend mode.
Fields§
§fields: Vec<ForceField>§blend_mode: ForceBlendMode§global_scale: f32Implementations§
Source§impl ForceComposite
impl ForceComposite
pub fn new() -> Self
pub fn with_blend(self, mode: ForceBlendMode) -> Self
pub fn add(&mut self, field: ForceField)
pub fn remove(&mut self, id: ForceFieldId)
pub fn get_mut(&mut self, id: ForceFieldId) -> Option<&mut ForceField>
pub fn tick(&mut self, dt: f32)
Sourcepub fn net_acceleration(&self, particle: &Particle) -> Vec3
pub fn net_acceleration(&self, particle: &Particle) -> Vec3
Compute the net acceleration for a particle from all fields.
Sourcepub fn apply_to_particle(&self, particle: &mut Particle)
pub fn apply_to_particle(&self, particle: &mut Particle)
Apply all forces to a particle, accumulating into its acceleration.
Sourcepub fn apply_and_cull(&self, particles: &mut Vec<Particle>)
pub fn apply_and_cull(&self, particles: &mut Vec<Particle>)
Apply forces to a whole slice of particles and remove absorbed ones.
Trait Implementations§
Source§impl Clone for ForceComposite
impl Clone for ForceComposite
Source§fn clone(&self) -> ForceComposite
fn clone(&self) -> ForceComposite
Returns a duplicate 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 ForceComposite
impl Debug for ForceComposite
Auto Trait Implementations§
impl Freeze for ForceComposite
impl RefUnwindSafe for ForceComposite
impl Send for ForceComposite
impl Sync for ForceComposite
impl Unpin for ForceComposite
impl UnsafeUnpin for ForceComposite
impl UnwindSafe for ForceComposite
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
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.