pub struct ParticleSystem {
pub pool: ParticlePool,
pub forces: Vec<ParticleForce>,
pub position: Vec3,
pub transform: Mat4,
pub gravity: Vec3,
pub time: f32,
pub enabled: bool,
pub world_space: bool,
pub max_trail_len: usize,
/* private fields */
}Expand description
A self-contained particle system with its own pool, forces, and emitters.
Fields§
§pool: ParticlePool§forces: Vec<ParticleForce>§position: Vec3§transform: Mat4§gravity: Vec3§time: f32§enabled: bool§world_space: bool§max_trail_len: usizeImplementations§
Source§impl ParticleSystem
impl ParticleSystem
pub fn new(capacity: usize) -> Self
pub fn with_gravity(self, g: Vec3) -> Self
pub fn with_position(self, p: Vec3) -> Self
pub fn add_force(self, f: ParticleForce) -> Self
Sourcepub fn burst(
&mut self,
shape: &EmitterShape,
count: u32,
template: &ParticleTemplate,
)
pub fn burst( &mut self, shape: &EmitterShape, count: u32, template: &ParticleTemplate, )
Emit count particles from a shape with a template.
pub fn tick(&mut self, dt: f32)
pub fn trails(&self) -> &HashMap<usize, Vec<Vec3>>
Sourcepub fn export_gpu_buffer(&self) -> Vec<f32>
pub fn export_gpu_buffer(&self) -> Vec<f32>
Export all active particles as a GPU-ready flat buffer.
Auto Trait Implementations§
impl Freeze for ParticleSystem
impl RefUnwindSafe for ParticleSystem
impl Send for ParticleSystem
impl Sync for ParticleSystem
impl Unpin for ParticleSystem
impl UnsafeUnpin for ParticleSystem
impl UnwindSafe for ParticleSystem
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.