pub struct ParticleSimulation { /* private fields */ }Expand description
Lazy fixed-step replay. The first clip duration fixes a shared preparation; reusing one cache instance with a different duration is rejected explicitly. Mutating any builder setting creates a fresh preparation identity.
Implementations§
Source§impl ParticleSimulation
impl ParticleSimulation
Sourcepub fn style(self, style: ParticleStyle) -> Self
pub fn style(self, style: ParticleStyle) -> Self
Replaces presentation without invalidating the immutable physics snapshots.
Sourcepub fn try_render(
&self,
context: &SceneContext<'_>,
) -> Result<Node, ValidationError>
pub fn try_render( &self, context: &SceneContext<'_>, ) -> Result<Node, ValidationError>
Renders through the instance protocol using explicit clip metadata.
Source§impl ParticleSimulation
impl ParticleSimulation
Sourcepub fn new(seed: u64) -> Self
pub fn new(seed: u64) -> Self
Creates a lazy fixed-step simulation with an explicit deterministic seed. Cache the result in
SceneContext::cache rather than constructing one afresh for every frame.
Sourcepub fn duration(self, duration: Duration) -> Self
pub fn duration(self, duration: Duration) -> Self
Sets finite preparation duration; otherwise render inherits clip duration.
Sourcepub fn step(self, step: Duration) -> Self
pub fn step(self, step: Duration) -> Self
Sets an exact positive integer-tick step; no variable last integration step.
Sourcepub fn snapshot_interval(self, steps: u64) -> Self
pub fn snapshot_interval(self, steps: u64) -> Self
Requests snapshot spacing; memory admission may increase it automatically.
Sourcepub fn limits(self, limits: SimulationLimits) -> Self
pub fn limits(self, limits: SimulationLimits) -> Self
Replaces logical resource allowances.
Sourcepub fn emitter(self, emitter: impl ParticleEmitter + 'static) -> Self
pub fn emitter(self, emitter: impl ParticleEmitter + 'static) -> Self
Appends one fixed-boundary emitter, in declaration order.
Sourcepub fn modifier(self, modifier: impl ParticleModifier + 'static) -> Self
pub fn modifier(self, modifier: impl ParticleModifier + 'static) -> Self
Appends one deterministic operator; ordering is significant.
Sourcepub fn group_modifier(
self,
modifier: impl ParticleGroupModifier + 'static,
) -> Self
pub fn group_modifier( self, modifier: impl ParticleGroupModifier + 'static, ) -> Self
Adds a population operator before independent particle updates.
Sourcepub fn sub_emitter(self, emitter: SubEmitter) -> Self
pub fn sub_emitter(self, emitter: SubEmitter) -> Self
Adds a stable-order, bounded event emitter rule.
Sourcepub fn prewarm(self, duration: Duration) -> Self
pub fn prewarm(self, duration: Duration) -> Self
Prepares a steady-state lead-in without changing the visible clip duration.
Sourcepub fn loop_period(self, period: Duration) -> Self
pub fn loop_period(self, period: Duration) -> Self
Enables deterministic dual-phase seamless looping; two live populations share the limit.
Sourcepub fn time_remap(
self,
scale: f64,
offset: Duration,
allow_reverse: bool,
) -> Self
pub fn time_remap( self, scale: f64, offset: Duration, allow_reverse: bool, ) -> Self
Remaps query time. Negative scales require allow_reverse, which explicitly revives past particles.
Sourcepub fn workers(self, workers: usize) -> Self
pub fn workers(self, workers: usize) -> Self
Requests 1..=64 CPU workers; independent updates retain stable IDs and event order.
Sourcepub fn sample(&self, time: Time) -> Result<Arc<[Particle]>, ValidationError>
pub fn sample(&self, time: Time) -> Result<Arc<[Particle]>, ValidationError>
Queries at the containing fixed boundary, never integrating a variable remainder. Outside [0,duration) is empty. Source initialization is shared.
Sourcepub fn sample_in(
&self,
time: Time,
clip_duration: Option<Duration>,
) -> Result<Arc<[Particle]>, ValidationError>
pub fn sample_in( &self, time: Time, clip_duration: Option<Duration>, ) -> Result<Arc<[Particle]>, ValidationError>
Queries using explicit finite clip metadata when no duration was configured.
Sourcepub fn stats(&self) -> Result<SimulationStats, ValidationError>
pub fn stats(&self) -> Result<SimulationStats, ValidationError>
Returns preparation stats without evaluating a rendered frame.
Sourcepub fn events(&self, time: Time) -> Result<Vec<ParticleEvent>, ValidationError>
pub fn events(&self, time: Time) -> Result<Vec<ParticleEvent>, ValidationError>
Returns events at the containing fixed boundary, sorted by stable ID and trigger kind.