public sealed class TerrainRendererDraws a terrain: one indexed instanced call over the patches a quadtree chose.
Remarks
[docs/plan/31 § T2]. The selection and the morph are arithmetic in Vixen.Terrain and are tested without a device; this is the part that needs one — the textures, the records, the descriptor set and the draw.
⚠ An atlas of per-tile blocks, which is the split of the layout the plan asked for without the split of the texture it did not. A tile is the unit of load ([§ D13]); a CDLOD patch straddles a tile boundary except by luck, and a texture per tile would make every straddling patch either two draws or a shader sampling two textures. One texture holding a TileSamples² block per tile is both: one thing to bind, and a block to upload, evict and mip on its own. See TerrainAtlas for why the blocks duplicate their boundary samples rather than sharing them.
⚠ And it is what makes the mip chain legal at all. A 2×2 reduction of the atlas never crosses a block boundary, because every block is a power of two starting at a multiple of one. Reducing the packed grid instead would mix two tiles at every level — [§ D2]'s seam arriving through the mip chain.
Only what changed is re-uploaded. Upload asks the terrain which tiles Resolve dirtied and copies those rows; a stroke on one tile of a hundred moves one hundredth of the bytes. Uploading the whole heightmap per frame would make a 33 MB transfer the cost of moving the brush.
Fields and properties (17)
public const int MaxLayersThe most weight-blended layers a terrain can carry.
public const int MaxWeightMapsHow many weightmap textures that is.
public Terrain TerrainThe terrain being drawn.
public TextureViewHandle HolesThe hole mask, for anything that has to stop where the ground does.
public SamplerHandle HoleSamplerAnd how it is read — clamped, unfiltered, at level 0.
public TerrainStreamer? StreamingWhich tiles are loaded, or null while every tile always is.
public List<StreamingSource> StreamingSourcesWhere the world has to be loaded around, in the terrain's own space.
public float StreamingRadiusHow far around a source a terrain's fine levels are kept, in metres.
public ITerrainTextures? TexturesWhat turns a layer's texture reference into something to sample.
public int ResolvedTexturesHow many layer textures the last Upload resolved.
public TerrainLodTree TreeThe quadtree the selection descends.
public int PatchCountHow many patches the last Upload chose.
public TerrainSplat SplatWhat the generated splat material compiles as, from the terrain's layer list.
public int DrawsHow many draws the last Record made.
public int TrianglesHow many triangles the last Record submitted.
public int CapacityHow many patch records the buffer can hold.
public long UploadedBytesHow many bytes the last Upload copied into the heightmap.
Methods (4)
public TerrainRenderer(IGraphicsDevice device, Terrain terrain, TerrainShaders shaders, RenderOutput output, TerrainLodRanges ranges, int gridQuads = 32)Creates a renderer for one terrain.
public int Upload(ICommandList commands, in TerrainView view)Chooses this frame's patches and stages what the device needs.
public void Record(ICommandList commands)Draws this frame's patches.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (3)
- TerrainRendererTestsVixen.Rendering.Terrain.Tests
- TerrainStreamingTestsVixen.Rendering.Terrain.Tests
- ScenePresenterVixen.Editor.App