#[repr(C)]pub struct ParticleParams {Show 16 fields
pub position: [f32; 3],
pub spread_cos: f32,
pub direction: [f32; 3],
pub speed_min: f32,
pub gravity: [f32; 3],
pub speed_max: f32,
pub color_start: [f32; 4],
pub color_end: [f32; 4],
pub lifetime_min: f32,
pub lifetime_max: f32,
pub size_start: f32,
pub size_end: f32,
pub dt: f32,
pub spawn_budget: u32,
pub random_seed: u32,
pub max_particles: u32,
}Expand description
Per-frame uniform consumed by the particle compute + render kernels. Carries
the resolved emitter tunables (position, direction, gravity, …) plus the
dynamic per-frame inputs the compute kernel needs to age + integrate +
respawn the pool. Pushed at compute buffer(2) and vertex buffer(1) of the
Metal particle passes, so the layout must stay in sync with
ParticleParams in shaders/particle_types.slang. 144 bytes.
Fields§
§position: [f32; 3]World-space spawn origin. packed_float3 in MSL: alignment 4, with
spread_cos packed into the trailing float slot of the float4.
spread_cos: f32Cosine of the emission cone’s half-angle. 1.0 = straight jet,
-1.0 = full sphere.
direction: [f32; 3]Unit-length mean emission direction.
speed_min: f32Lower bound of the initial speed range, in units per second.
gravity: [f32; 3]Constant per-frame acceleration applied to each particle.
speed_max: f32Upper bound of the initial speed range, in units per second.
color_start: [f32; 4]Linear-space RGBA at age = 0.
color_end: [f32; 4]Linear-space RGBA at age = lifetime.
lifetime_min: f32Lower bound of the particle lifetime range, in seconds.
lifetime_max: f32Upper bound of the particle lifetime range, in seconds.
size_start: f32Quad size at age = 0.
size_end: f32Quad size at age = lifetime.
dt: f32Frame delta time (seconds). Drives the age + integration step.
spawn_budget: u32Integer count of new particles the compute kernel may emit this frame. Carried atomically inside the kernel so threads racing for spawn slots only succeed up to this many times.
random_seed: u32Per-frame seed mixed with the thread id by the kernel’s cheap RNG.
max_particles: u32Pool size in slots; the kernel returns early past it.
Trait Implementations§
Source§impl Clone for ParticleParams
impl Clone for ParticleParams
Source§fn clone(&self) -> ParticleParams
fn clone(&self) -> ParticleParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ParticleParams
Source§impl Debug for ParticleParams
impl Debug for ParticleParams
impl NoUninit for ParticleParams
Auto Trait Implementations§
impl Freeze for ParticleParams
impl RefUnwindSafe for ParticleParams
impl Send for ParticleParams
impl Sync for ParticleParams
impl Unpin for ParticleParams
impl UnsafeUnpin for ParticleParams
impl UnwindSafe for ParticleParams
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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