public readonly record struct TerrainNodeRecordOne patch of terrain, as the vertex stage reads it.
Remarks
The C# half of TerrainNode in Terrain.rvn, and the two agree by construction or not at all. The host packs these bytes and the shader reads them as a struct — the same bargain GpuCulling describes, and the same reason the duplication is not a smell to be refactored away.
⚠ Twenty-four bytes, and the last four are declared padding. Five floats is twenty in C# and twenty-four in std430, because a struct's alignment is its widest member's — the float2's eight — and its size rounds up to a multiple of it. A host writing a twenty-byte stride into an array the shader reads at twenty-four does not fail: it draws patch one out of the middle of patch zero, and every patch after that is further wrong. Adding a field changes both files or neither.
Fields and properties (6)
public Vector2 OriginWhere the patch's low corner is, in sample coordinates.
public float StepHow many samples one step of the grid patch spans.
public float MorphHow far the patch has morphed towards its parent's grid, 0…1.
public float LevelWhich mip level of the atlas it reads.
public float Padding0Declared rather than left to the compiler, so the record is twenty-four bytes on both sides.
public static int SizeInBytesHow many bytes one of these is.
Methods (2)
public TerrainNodeRecord(Vector2 Origin, float Step, float Morph, float Level, float Padding0 = 0)One patch of terrain, as the vertex stage reads it.
public static TerrainNodeRecord Of(in TerrainLodNode node, int gridQuads, int maxLevel = 0)The record for a node the quadtree selected.
Used by (3)
- TerrainGridPatchTestsVixen.Rendering.Terrain.Tests
- TerrainRendererVixen.Rendering.Terrain
- TerrainShaderParityTestsVixen.Rendering.Terrain.Tests