public sealed class WaterZoneStateA zone's field, the window it covers, and the decision about when to rasterise it again.
Remarks
[35 § D3](../../docs/plan/35-water.md#d3-the-water-info-texture-is-the-interchange-and-it-is-a-zone-render)'s sliding window, as a thing with a lifetime. WaterZone is what an author states and WaterField is the arithmetic; this is what holds one, moves it, and says when it was last right.
⚠ The field is rasterised by the same code the surface query reads, and that is [§ D2](../../docs/plan/35-water.md#d2-one-evaluator-two-hosts-and-the-seam-is-a-test) rather than a shortcut. § D3 describes the info texture as a top-down render, with every body drawing into it through a material. That is the faster way to fill it and it is a second rasterisation of the same bodies — one on the device for the picture, one on the host for the boat — and nothing would hold the two together. Filling it from Rasterize and uploading the result means the shoreline the material shades and the depth the buoyancy solver reads are the same numbers by construction.
Which is affordable because of when it happens. The window is re-rasterised only when the view has scrolled past ScrollThreshold or something has changed — a hundred frames apart at a walk — so the cost is amortised over the frames between, and the per-frame cost is an upload of a texture that did not change, which is nothing. A device render would be the optimisation to reach for if that stops being true, and it would need a seam test of its own before it could be trusted.
Allocation-free after the first frame. The field's arrays are kept and the window is moved through them; a zone that reallocated on every scroll would allocate a megabyte every hundred frames, forever.
Fields and properties (6)
public WaterZone ZoneWhat the author stated.
public WaterField? FieldThe rasterised field, or null before the first update.
public WaterFieldDescription WindowThe window the field currently covers.
public int RasterCountHow many times the field has been rasterised.
public WaterZoneUpdate LastUpdateWhy the last Update did what it did.
public IReadOnlyList<WaterBody> BodiesThe bodies this zone rasterises.
Methods (6)
public WaterZoneState(in WaterZone zone)Creates a zone's state.
public void SetBodies(IReadOnlyList<WaterBody> replacement)Replaces the body list and marks the field stale.
public void Invalidate()Says that a body, the ground or something else the field reads has changed.
public void Reshape(in WaterZone zone)Changes the zone's shape, which invalidates everything about the field.
public WaterZoneUpdate Update(Vector2 view, IWaterGround ground)Brings the field up to date for a view, if it is not already.
public WaterQuery Query(in WaterWaveSpectrum spectrum, WaterAttenuation attenuation = default(WaterAttenuation))A query over this zone's field and a sea state.
Used by (12)
- UnderwaterShapeVixen.Rendering.Water
- UnderwaterShapeTestsVixen.Rendering.Water.Tests
- WaterDebugDrawVixen.Rendering.Water
- WaterDebugDrawTestsVixen.Rendering.Water.Tests
- WaterInfoTextureVixen.Rendering.Water
- WaterInfoTextureTestsVixen.Rendering.Water.Tests
- WaterMeshRendererVixen.Rendering.Water
- WaterOverlayVixen.Rendering.Water
- WaterZoneSystemVixen.Rendering.Water
- WaterZoneSystemTestsVixen.Rendering.Water.Tests
- WaterZoneTestsVixen.Water.Tests
- WaterPresenterVixen.Editor.App