#[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 more