public sealed class TerrainTilePagesThe pool of tiles a terrain keeps resident, and what arrives and leaves it.
Remarks
The pool is host memory holding chains that are about to be copied into the atlas, and a slot is one tile's chain. It is not the atlas itself: a copy into a texture needs a command list, which arrives on the frame's thread long after a load came back off one of the pool's threads. Drain is the hand-over.
⚠ A refusal is a frame lost and not an error — Place's own bargain. The pending list is bounded because the renderer can only record so many copies in one frame, so a camera that jumps across a large terrain fills it, and the pages that do not fit are asked for again next frame.
⚠ A page is a chain and the revision it was read at, in that order, and the revision is why the second half exists. A load runs for as many frames as the thread pool takes to get to it, and the terrain underneath it is one an editor may be sculpting — so a chain that arrives is a statement about a tile as it was, and whether it is still true is a question only the frame thread can answer. Place asks it, and refuses what has gone out of date; the tile is then simply not resident, the grid asks for it again next frame, and the one after that has the stroke in it.
Fields and properties (7)
public const int HeaderSizeHow many bytes of a page come before its chain.
public int PageSizeHow many bytes one page occupies in the pool.
public int SlotCountHow many slots the pool has.
public int MaxPendingHow many tiles may be handed over in one frame.
public int PendingHow many tiles are staged and waiting to be copied.
public int ResidentHow many tiles the pool holds.
public long StaleArrivalsHow many arrivals were thrown away because their tile changed under them.
Methods (6)
public TerrainTilePages(ITerrainTileSource source, int slots)Creates a pool over a source.
public bool IsResident(int tileX, int tileZ)Whether a tile's chain is in the pool.
public ValueTask<int> LoadAsync(PageKey key, Memory<byte> destination, CancellationToken cancellation)public bool Place(PageKey key, int slot, ReadOnlySpan<byte> bytes)public void Evict(PageKey key, int slot)Says a page is no longer resident, and its slot is about to be reused.
public void Drain(TerrainTileHandler into)Hands over the tiles that have arrived since the last call.
Used by (4)
- TerrainRendererVixen.Rendering.Terrain
- TerrainSceneRendererVixen.Rendering.Terrain
- TerrainStreamerVixen.Rendering.Terrain
- TerrainStreamingTestsVixen.Rendering.Terrain.Tests