public sealed class WaterZoneSystemFolds a world's zones and bodies into the fields everything else reads.
As a system
- Phase
- PreRender
Remarks
[35 § D3](../../docs/plan/35-water.md#d3-the-water-info-texture-is-the-interchange-and-it-is-a-zone-render)'s zone, wired to a scene. Every WaterBodyComponent is claimed by whichever zones' windows reach it, and each zone re-rasterises only when it has to.
⚠ A body with no zone renders nothing, and the count is what says so. That is Unreal's rule — AWaterZone must exist or nothing renders — kept because the field is the interchange every consumer reads. What is not kept is discovering it from a blank frame: ZonelessBodies is a number an author can look at, and it is the answer to "I placed a lake and there is no water".
⚠ Bodies are cached by identity, and that is what makes the whole amortisation real. A fold that built a fresh WaterBody every frame would hand the zone a different list every frame, mark the field dirty every frame, and re-rasterise every frame — which is the cost § D3's threshold exists to avoid, paid in full and invisibly. So a body is rebuilt only when its component or its transform actually changed, and the zone compares by reference.
In PreRender, after TransformSystem has written WorldTransform, so a body that moved this frame is rasterised where it now is rather than where it was.
Fields and properties (14)
public RenderView ViewThe view this centres its windows on.
public IWaterSplineSource? SplinesWhere a body's curve comes from.
public IWaterWaveSource? WavesWhere a zone's sea state comes from, for the zones that name a .vxwaves.
public IWaterGround GroundWhere the ground under the water is.
public int ZoneCountHow many zones the last fold saw.
public int BodyCountHow many bodies resolved to a curve.
public int ZonelessBodiesHow many bodies no zone's window reached.
public int UnresolvedBodiesHow many bodies named a spline nothing could supply.
public int UnresolvedWavesHow many zones named a .vxwaves that could not be used.
public int RebuiltBodiesHow many bodies were rebuilt by the last fold.
public SystemAccess Accesspublic IReadOnlyDictionary<Entity, WaterZoneState> StatesThe state of a zone, by the entity carrying it.
public IReadOnlyList<(Entity Entity, WaterZoneComponent Component)> ZonesWhat each zone entity said, as the last fold read it — with its names resolved.
public float WaterTimeThe simulation's water time, in seconds — the one clock the whole stack reads.
Methods (5)
public WaterZoneSystem(RenderView view)Folds a world's zones and bodies into the fields everything else reads.
public WaterQuery? QueryAt(Vector2 position)public IPostProcessShape? ShapeFor(Entity entity)public override JobHandle Update(in SystemContext context, JobHandle dependency)public void Fold(World world)Gathers this frame's zones and bodies and brings every field up to date.
Used by (13)
- AppGraphicsVixen.App.Hosting
- UnderwaterPassTestsVixen.Rendering.Water.Tests
- UnderwaterRendererVixen.Rendering.Water
- WaterClockSystemVixen.Rendering.Water
- WaterDebugDrawVixen.Rendering.Water
- WaterDebugDrawTestsVixen.Rendering.Water.Tests
- WaterHorizonImageTestsVixen.Graphics.Golden.Tests
- WaterMeshRendererVixen.Rendering.Water
- WaterOverlayVixen.Rendering.Water
- WaterRendererFactoryVixen.Rendering.Water
- WaterZoneSystemTestsVixen.Rendering.Water.Tests
- WaterPresenterVixen.Editor.App
- WaterSceneRunsTestsVixen.Editor.Assets.Tests