Skip to main content

Module reaction_diffusion

Module reaction_diffusion 

Source
Expand description

Reaction-diffusion scene: a Gray-Scott simulation evolving on a fixed internal grid via the reusable PingPongField (ADR-0012). The engine’s first stateful scene — each frame’s field depends on the previous frame’s, held in a texture and stepped by a simulation shader — unlocking the organic, restructuring look (nested contours, cellular tissue, a hatched maze) stateless scenes can’t produce.

Phase 1 is a walking skeleton: a fixed number of sub-steps per frame and a grayscale present. The fixed-timestep accumulator (Phase 2), audio-reactive named parameters (Phase 3), and the iso-contour/hatch look (Phase 4) land on top of this. All randomness is the seeded initial scatter (NFR 6): the field is a pure function of the seed + the fixed-dt step sequence.

GPU resources are built lazily, on first render. The scene stores a device handle and constructs its pipelines/textures only when it is first drawn (see Resources). This keeps the resources off the device until the scene is actually shown, and — importantly — lets the headless capture tests build the full roster on the DX12 WARP software adapter: WARP mis-renders the pre-existing fragment-field pipeline once this scene’s full set of feedback resources coexists on the device (a cumulative software-rasterizer quirk with no wgpu validation error; real hardware is unaffected). Deferring construction means a capture that never activates this scene never builds those resources, so the other scenes’ captures stay correct; a capture that does activate it builds them and renders this scene normally.

Structs§

ReactionDiffusionScene
Gray-Scott reaction-diffusion on a ping-pong field, driven by named preset parameters (ADR-0002 layer 2): feed/kill pick the regime, flow scales the diffusion, and a rising inject edge stamps a seeded blob of growth.

Constants§

PARAMS
Parameter vocabulary — see fragment_field::PARAMS. Keep in sync with set_param below.