pub struct IfsPacked {
pub linear: [[f32; 4]; 4],
pub translate: [[f32; 4]; 2],
pub cumulative_p: [f32; 4],
pub fixed: [[f32; 4]; 2],
pub root_recip: f32,
}Expand description
What the compute step receives: the four linear parts, the four translations
packed two per vec4, and the cumulative probabilities the shader
compares a unit draw against.
Cumulative rather than raw because the shader’s job is then three compares
against a rising table instead of a running sum it would have to recompute
per particle per step. The last entry is 1.0 by construction and is never
read — the fourth map is the else arm, which is also what makes a draw of
exactly 1.0 land somewhere legal.
Fields§
§linear: [[f32; 4]; 4]Per map: a, b, c, d.
translate: [[f32; 4]; 2]Four (e, f) translation pairs, two per row.
cumulative_p: [f32; 4]c0, c1, c2, 1.0.
fixed: [[f32; 4]; 2]The four respawn targets (ADR-0087), packed two (x, y) per row exactly
as translate is. Straight from fixed_points, so
the padded slots already duplicate a drawn map and the shader picks one of
four with no branch and no knowledge of the probability table.
root_recip: f32The reciprocal of skeleton_scale (ADR-0088) — what the step shader
multiplies a raw nearest-fixed-point distance by to get the [0, 1]-ish
colour coordinate it stores on the particle.
Shipped as a reciprocal rather than as the diameter because the shader then multiplies where it would otherwise divide, per particle per step.
Implementations§
Source§impl IfsPacked
impl IfsPacked
Sourcepub const ZERO: Self
pub const ZERO: Self
The all-zero payload the four map families upload.
They never read it — the step shader’s IFS arm is the only consumer — but the uniform is one struct for every family, so it has to carry something. Zeros rather than a stray fern: a family that reached this data by mistake then draws nothing rather than a second figure.