pub struct ParticleLifetimeManager {
pub total_spawned: usize,
pub total_expired: usize,
pub min_observed_lifetime: f32,
pub max_observed_lifetime: f32,
}Expand description
Lifetime manager that also records spawn events for analysis.
Fields§
§total_spawned: usizeTotal particles ever spawned.
total_expired: usizeTotal particles that have died naturally.
min_observed_lifetime: f32Minimum observed lifetime seen.
max_observed_lifetime: f32Maximum observed lifetime seen.
Implementations§
Source§impl ParticleLifetimeManager
impl ParticleLifetimeManager
Sourcepub fn record_spawn(&mut self, lifetime: f32)
pub fn record_spawn(&mut self, lifetime: f32)
Record a spawn event with initial lifetime.
Sourcepub fn record_expiration(&mut self)
pub fn record_expiration(&mut self)
Record an expiration (natural death).
Sourcepub fn retire_expired(&mut self, buffer: &mut ParticleBuffer) -> usize
pub fn retire_expired(&mut self, buffer: &mut ParticleBuffer) -> usize
Scan a buffer and retire particles that have expired. Returns the number retired.
Sourcepub fn alive_fraction(&self, buffer: &ParticleBuffer) -> f32
pub fn alive_fraction(&self, buffer: &ParticleBuffer) -> f32
Alive fraction: alive / total_spawned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParticleLifetimeManager
impl RefUnwindSafe for ParticleLifetimeManager
impl Send for ParticleLifetimeManager
impl Sync for ParticleLifetimeManager
impl Unpin for ParticleLifetimeManager
impl UnsafeUnpin for ParticleLifetimeManager
impl UnwindSafe for ParticleLifetimeManager
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more