public sealed class WaterBodyA body of water: a spline, a profile, and a kind.
Remarks
The kernel half of [§ D6](../../docs/plan/35-water.md#d6-a-water-body-is-a-spline-and-a-profile-and-there-is-no-new-spline). What a scene carries is a component naming a .vxspline and eleven numbers; what the arithmetic needs is a resolved curve and a profile, which is this. No new asset kind and no new spline type — a water body is authored with the same tools a road is, because it is the same object.
The shape is a signed distance to the body's boundary, and every kind produces one. An open body's boundary is its centreline pushed out by the profile's half-width; a closed body's is its own spline. That is what lets one Sample serve a river, a lake and an ocean, and it is why a transition between two of them is resolved by rasterising both rather than by a material that has to know which two it is between.
⚠ The polygon is built once, in the constructor. Point-in-polygon over a curve re-evaluated per query is the difference between a body a hundred pontoons can ask and one they cannot — and the evaluator's stated property is that ten thousand queries allocate nothing.
Fields and properties (10)
public const int BoundarySamplesHow finely a closed spline is flattened into the polygon queries test against.
public WaterBodyKind KindWhat kind of water it is.
public Spline SplineIts curve.
public WaterProfilePoint DefaultsWhat it is like where the profile says nothing.
public int PriorityWhich body wins where two overlap. Higher is on top.
public float SurfaceHeightWhere a closed body's surface sits, in world units.
public float ShoreFalloffHow wide the band is over which coverage falls to zero at the boundary, in metres.
public float BedRampHow far inside the boundary the bed reaches its full depth, in metres.
public bool IsSubtractiveWhether this body removes water rather than adding it.
public float ReachThe furthest from its curve this body reaches, in metres.
Methods (6)
public WaterBody(WaterBodyKind kind, Spline spline, ReadOnlySpan<WaterProfilePoint> profile = default(ReadOnlySpan<WaterProfilePoint>), WaterProfilePoint defaults = default(WaterProfilePoint))Creates one.
public WaterProfilePoint ProfileAt(float t)The profile at a parameter along the curve.
public WaterBodyContribution Sample(Vector2 ground)What this body says about a place on the ground.
public bool Contains(Vector2 ground)Whether a place on the ground is inside a closed body's boundary.
public bool Reaches(Vector2 centre, float halfExtent)Whether any part of this body reaches a square window on the ground plane.
public (Vector2 Low, Vector2 High) Bounds()Everything this body can touch on the ground plane, its shore falloff included.
Used by (18)
- BuiltVixen.Rendering.Water
- BuoyancyTestsVixen.Water.Tests
- LakeVixen.Water.Physics.Tests
- UnderwaterShapeTestsVixen.Rendering.Water.Tests
- WaterCarveVixen.Water
- WaterCarveTestsVixen.Water.Tests
- WaterDebugDrawVixen.Rendering.Water
- WaterEvaluatorTestsVixen.Water.Tests
- WaterFieldVixen.Water
- WaterFieldTestsVixen.Water.Tests
- WaterSurfaceMeshTestsVixen.Water.Tests
- WaterZoneStateVixen.Water
- WaterZoneSystemVixen.Rendering.Water
- WaterZoneSystemTestsVixen.Rendering.Water.Tests
- WaterZoneTestsVixen.Water.Tests
- WaterCarveCommandVixen.Editor.Water
- WaterEditVixen.Editor.Water
- WaterEditTestsVixen.Editor.Water.Tests