Wind Sway
App: apps/wind_sway_demo/
Demonstrates the global frame-uniform block (engine PLM-236 / ADR 0072) — the universal
prerequisite for animated shaders (grass/tree wind sway, water waves, moving clouds). The engine
binds a { time, delta, frameIndex, wind } block at set 0, binding 4 every frame; a shader reads
plume3d_time() and the wind and animates on its own, with no per-draw uniform plumbing.
Run from root
Section titled “Run from root”% ./plume3d wind_sway_demoA green quad’s top edge sways and its colour pulses — both driven by the frame clock. The demo takes two screenshots ~0.7 s apart; because the clock has advanced between them, the two frames differ, proving the frame time reaches the GPU.
What it does
Section titled “What it does”-
Builds an NDC quad with
Graphics.newMeshand a shader loaded fromshaders/wind. -
Sets a global wind once, which the engine folds into the frame block:
Graphics.setWind(1.0, 0.0, 0.0, 1.0) // blow along +X at unit strength -
The shader
#include "plume3d.slang"and sways the tip by the frame clock × wind, then pulses its colour with time:float sway = sin(plume3d_time() * 2.0 + p.x * 3.0) * plume3d_windStrength() * 0.25 * tip;float pulse = 0.5 + 0.5 * sin(plume3d_time() * 3.0);
See Graphics.setWind and the frame-uniform note on
/api/graphics. Screenshot-verified (two frames differ).