Vixen
c7401864
csharp
public sealed class WaterZoneSystem

Folds a world's zones and bodies into the fields everything else reads.

Read the guide page for this →

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 View

    The view this centres its windows on.

  • public IWaterSplineSource? Splines

    Where a body's curve comes from.

  • public IWaterWaveSource? Waves

    Where a zone's sea state comes from, for the zones that name a .vxwaves.

  • public IWaterGround Ground

    Where the ground under the water is.

  • public int ZoneCount

    How many zones the last fold saw.

  • public int BodyCount

    How many bodies resolved to a curve.

  • public int ZonelessBodies

    How many bodies no zone's window reached.

  • public int UnresolvedBodies

    How many bodies named a spline nothing could supply.

  • public int UnresolvedWaves

    How many zones named a .vxwaves that could not be used.

  • public int RebuiltBodies

    How many bodies were rebuilt by the last fold.

  • public SystemAccess Access
  • public IReadOnlyDictionary<Entity, WaterZoneState> States

    The state of a zone, by the entity carrying it.

  • public IReadOnlyList<(Entity Entity, WaterZoneComponent Component)> Zones

    What each zone entity said, as the last fold read it — with its names resolved.

  • public float WaterTime

    The simulation's water time, in seconds — the one clock the whole stack reads.

Methods (5)

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