public sealed class WaterFieldPyramidA field's coverage and surface range, reduced so a quadtree descent can ask about a whole node.
Remarks
§ D4's coverage predicate, made cheap enough to be a predicate ([35 § D4](../../docs/plan/35-water.md#d4-the-surface-is-the-terrains-quadtree-with-a-different-height-source) — "a coarse mip of the info texture's alpha, tested per node during descent"). Water covers a small fraction of most zones, and descending into open ground to draw nothing is most of the tree; but answering "is any of this 128-metre square wet" by scanning its texels costs more than the descent saves.
Three reductions, not one. Coverage reduces by maximum, because the question is whether any of the node is wet. The surface height reduces by minimum and maximum, because a node's bounding box needs both and a box that does not contain the surface is a node culled away with water still in it.
⚠ Conservative in both directions, deliberately. A query rounds its rectangle outward to whole texels of whatever level answers it, so it can say "wet" about a node that is dry and never "dry" about one that is wet. The first costs a patch that draws nothing; the second is a lake with a straight edge through the middle of it.
⚠ The base level is the field's own resolution, which is odd. A field's samples include both edges — 257 over 512 m — so the reduction rounds up rather than halving, and the last column of an odd level is reduced from one texel rather than two. Assuming a power of two here would drop the field's far edge, which is the shoreline furthest from the camera and the one a flythrough shows.
Fields and properties (3)
public int LevelCountHow many levels there are, the base included.
public int ResolutionHow many texels the base level has along each axis.
public WaterFieldDescription DescriptionThe window the last Build covered.
Methods (4)
public WaterFieldPyramid(int resolution)Builds an empty pyramid over a field's shape.
public void Build(WaterField field)Reduces a field into the pyramid.
public bool AnyCoverage(Vector2 low, Vector2 high, float threshold = 0)Whether any part of a world-space rectangle has water in it.
public (float Minimum, float Maximum) SurfaceRange(Vector2 low, Vector2 high)The lowest and highest the surface gets over a world-space rectangle.
Used by (5)
- WaterMeshRendererVixen.Rendering.Water
- WaterPatchSourceVixen.Water
- WaterSurfaceMeshVixen.Water
- WaterSurfaceMeshTestsVixen.Water.Tests
- ZoneVixen.Rendering.Water