public sealed class WaterRipplesA sliding-window height field: the CPU half of § D12, and the reference the GPU is held to.
Remarks
Displacement, not geometry ([35 § D12](../../docs/plan/35-water.md#d12-ripples-are-a-sliding-window-height-field-and-they-are-displacement-not-geometry)). A texture of surface displacement and its velocity, advanced by a wave-equation step, with entities injecting into it — a character wading writes a moving depression, a boat writes a hull-shaped one, an impact writes an impulse. The result is added by WaterEvaluator, so a second boat rides the first one's wake and the buoyancy solver feels it.
⚠ This exists on the CPU even when a GPU simulation is running, and that is a stated behaviour rather than duplication. Buoyancy sampling a GPU texture cannot see the current frame's step without a stall, so the simulation is also run here at a lower resolution over the same injections — deterministic, jobbable, and compared against the device version at a stated tolerance that is not exact, unlike everything else in this assembly. That asymmetry is why the ripple contribution is separated from the wave sum in the evaluator's signature: the closed-form part is exact and the simulated part is not, and a caller that needs the exact one — the network path — asks for it alone by passing no ripples at all.
⚠ The window scrolls by shifting its contents, unlike WaterField, which forgets them. A field is a function of bodies and ground that can be recomputed; a simulation's state is its history, and throwing it away when the camera walks would delete every wake in the scene. So the shift is by whole texels — which is also why the origin snaps.
Fields and properties (6)
public WaterRippleSettings SettingsIts shape and its limits.
public Vector2 OriginWhere the window's low corner is, on the ground plane.
public int InjectionsHow many injections this step accepted.
public int OverflowedHow many it had to refuse, over the budget.
public int StepCountHow many steps have been taken.
public float PeakThe largest displacement anywhere in the field, in metres.
Methods (8)
public WaterRipples(in WaterRippleSettings settings, Vector2 origin = default(Vector2))Creates an empty simulation.
public void Clear()Forgets everything, keeping the window where it is.
public bool Follow(Vector2 centre)Moves the window to follow a point, carrying the state with it.
public bool Inject(Vector2 position, float radius, float amount)Adds a disturbance to the field.
public int Apply(WaterDisturbances queue)Injects every disturbance a step produced.
public void Step(float deltaTime)Advances the simulation by one fixed step.
public bool TryDisplacement(Vector2 position, out float displacement)public float At(int x, int z)What the field holds at one texel, unfiltered.
Used by (5)
- WaterDebugDrawVixen.Rendering.Water
- WaterDebugDrawTestsVixen.Rendering.Water.Tests
- WaterDisturbanceTestsVixen.Water.Tests
- WaterRippleSeamTestsVixen.Graphics.Golden.Tests
- WaterRippleTestsVixen.Water.Tests