public static class TerrainGridPatchThe grid every terrain patch is drawn from.
Remarks
One mesh, drawn many times. Every node a frame selects is this same lattice, scaled and placed by its TerrainNodeRecord — which is what makes a terrain one indirect instanced draw however many patches it takes. [docs/plan/31 § D3].
There are no vertices, and that is deliberate. A regular lattice's positions are two divisions of the vertex index, so the shader computes them from SV_VertexID and uploading 33² of them per frame would be sending it something it can count. The reflection confirms it: Terrain.reflect.json has an empty VertexInputs. What is uploaded is the index buffer, once, and one record per patch.
⚠ The winding is counter-clockwise seen from above, which is what the engine's cull-back convention wants for ground. Getting it backwards produces a terrain that is invisible from above and solid from below — a whole-screen version of the flipped-winding failure the diagnostic playbook describes, and one that looks like nothing drawing at all.
Methods (4)
public static int VertexCount(int gridQuads)How many vertices a patch of this many quads has.
public static int IndexCount(int gridQuads)How many indices a patch of this many quads needs.
public static int FillIndices(int gridQuads, Span<uint> indices)Fills the index buffer for a patch.
public static (int X, int Z) VertexOf(int vertex, int gridQuads)Where a vertex of the patch sits, before the morph.
Used by (4)
- TerrainGridPatchTestsVixen.Rendering.Terrain.Tests
- TerrainRendererVixen.Rendering.Terrain
- TerrainRendererTestsVixen.Rendering.Terrain.Tests
- TerrainShaderParityTestsVixen.Rendering.Terrain.Tests