Skip to main content

TrajectoryModel

Trait TrajectoryModel 

Source
pub trait TrajectoryModel: Send + Sync {
    // Required methods
    fn spawned(&self, from: Time, to: Time) -> Range<u64> ⓘ;
    fn birth_time(&self, index: u64) -> Time;
    fn state(
        &self,
        index: u64,
        age_seconds: f32,
    ) -> Result<Option<Particle>, ValidationError>;

    // Provided methods
    fn duration(&self) -> Option<Duration> { ... }
    fn analytic_upload(
        &self,
        _age_seconds: f32,
        _primitive: InstanceKind,
        _align_to_velocity: bool,
    ) -> Result<Option<AnalyticInstanceUpload>, ValidationError> { ... }
    fn analytic_bounds(
        &self,
        _age_seconds: f32,
    ) -> Result<Option<Rect>, ValidationError> { ... }
}
Expand description

A whole random-access particle trajectory, not separately composable forces.

Required Methods§

Source

fn spawned(&self, from: Time, to: Time) -> Range<u64> ⓘ

Stable IDs born in [from,to).

Source

fn birth_time(&self, index: u64) -> Time

Exact integer-tick birth time of one stable ID.

Source

fn state( &self, index: u64, age_seconds: f32, ) -> Result<Option<Particle>, ValidationError>

Complete state at this age; None means absent/dead.

Provided Methods§

Source

fn duration(&self) -> Option<Duration>

Optional finite natural duration for timeline registration.

Source

fn analytic_upload( &self, _age_seconds: f32, _primitive: InstanceKind, _align_to_velocity: bool, ) -> Result<Option<AnalyticInstanceUpload>, ValidationError>

Optional seeded initial-state upload for supported random-access models. Custom models and unsupported precision retain the ordinary evaluated path.

Source

fn analytic_bounds( &self, _age_seconds: f32, ) -> Result<Option<Rect>, ValidationError>

Conservative extent of every particle center at this age, for models whose Self::analytic_upload lets the GPU evaluate positions. Returning None keeps the ordinary evaluated path.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§