public readonly record struct WaterNodeRecordOne patch of water a frame draws, as the vertex stage reads it.
Remarks
The C# half of WaterNode in WaterMesh.rvn, and the two agree by construction or not at all. The host packs these bytes and the shader reads them as a struct — TerrainNodeRecord's bargain, and the same reason the duplication is not a smell to be refactored away.
⚠ Sixteen bytes exactly, which is the one thing that has to be checked rather than assumed. A float2 aligns to eight, so a struct containing one aligns to eight and rounds its size up to a multiple of eight — two floats after it land at 8 and 12 and the total is 16 with nothing left over. Adding a fifth field takes it to 24 in std430 and 20 in C#, and a host writing a twenty-byte stride into an array read at twenty-four draws patch one out of the middle of patch zero.
⚠ The origin is world metres and not texels, which is the one place this differs from the terrain's record — see WaterNode for why.
Fields and properties (4)
public Vector2 OriginWhere the patch's low corner is, on the ground plane, in world metres.
public float StepHow many metres one step of the grid patch spans.
public float MorphHow far the patch has morphed towards its parent's grid, 0…1.
public static int SizeInBytesHow many bytes one of these is.
Methods (2)
public WaterNodeRecord(Vector2 Origin, float Step, float Morph)One patch of water a frame draws, as the vertex stage reads it.
public static WaterNodeRecord Of(in TerrainLodNode node, Vector2 windowOrigin, float metresPerQuad, int gridQuads)The record for a node the selector chose.
Used by (2)
- WaterSurfacePassVixen.Rendering.Water
- WaterSurfacePassTestsVixen.Rendering.Water.Tests