pub struct ParticlePool {
pub stats: PoolStats,
/* private fields */
}Expand description
Pre-allocated pool of particles.
Fields§
§stats: PoolStatsImplementations§
Source§impl ParticlePool
impl ParticlePool
pub fn new(capacity: usize) -> Self
pub fn spawn(&mut self, particle: MathParticle) -> bool
pub fn tick(&mut self, dt: f32)
Sourcepub fn apply_field(&mut self, field: &ForceField, time: f32)
pub fn apply_field(&mut self, field: &ForceField, time: f32)
Apply a force field to all particles that have AFFECTED_BY_FIELDS.
Sourcepub fn apply_force(&mut self, force: Vec3)
pub fn apply_force(&mut self, force: Vec3)
Apply an explicit force to all particles (e.g. gravity, wind).
Sourcepub fn apply_gravity(&mut self, g: f32)
pub fn apply_gravity(&mut self, g: f32)
Apply gravity to all GRAVITY-flagged particles.
Sourcepub fn collide_floor(&mut self, restitution: f32)
pub fn collide_floor(&mut self, restitution: f32)
Collide all COLLIDES particles against an infinite floor at y=0.
pub fn iter(&self) -> impl Iterator<Item = &MathParticle>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut MathParticle>
pub fn count(&self) -> usize
pub fn capacity(&self) -> usize
pub fn is_full(&self) -> bool
Sourcepub fn export_gpu_buffer(&self) -> Vec<f32>
pub fn export_gpu_buffer(&self) -> Vec<f32>
Export live particle positions to a flat f32 buffer (x,y,z, r,g,b,a per particle).
Auto Trait Implementations§
impl Freeze for ParticlePool
impl RefUnwindSafe for ParticlePool
impl Send for ParticlePool
impl Sync for ParticlePool
impl Unpin for ParticlePool
impl UnsafeUnpin for ParticlePool
impl UnwindSafe for ParticlePool
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> 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.