Skip to main content

celestialsim/chunk_nodes/
scatter_compact.rs

1//! `celestial/chunk-scatter-compact` — CEL-73 scatter draw-list build. One
2//! thread per cached pool candidate of each VISIBLE chunk, per layer: gates by
3//! the LIVE `density`/height sliders and appends surviving transforms into
4//! the layer's indirect MultiMesh (count into the command buffer — no
5//! readback). This is the ONLY GPU work a slider edit re-runs.
6
7use crate::chunk_nodes::ChunkNode;
8use crate::chunk_pipeline::ChunkCtx;
9
10pub struct ChunkScatterCompact;
11
12impl ChunkNode for ChunkScatterCompact {
13    fn name(&self) -> &'static str {
14        "celestial/chunk-scatter-compact"
15    }
16
17    fn record(&mut self, ctx: &mut ChunkCtx<'_>) {
18        let vis = ctx.vis_count;
19        if vis == 0 || ctx.gpu.scatter_layer_count() == 0 {
20            return;
21        }
22        let list = ctx.list();
23        let mut rd = ctx.rd.clone();
24        for li in 0..ctx.gpu.scatter_layer_count() {
25            ctx.gpu.record_scatter_compact(&mut rd, list, li, vis);
26        }
27    }
28}