Vixen
02b45cc4
csharp
public sealed class TerrainTilePages

The pool of tiles a terrain keeps resident, and what arrives and leaves it.

Read the guide page for this →

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.

Fields and properties (5)

  • public int PageSize

    How many bytes one page occupies in the pool.

  • public int SlotCount

    How many slots the pool has.

  • public int MaxPending

    How many tiles may be handed over in one frame.

  • public int Pending

    How many tiles are staged and waiting to be copied.

  • public int Resident

    How many tiles the pool holds.

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)

    Reads a page's bytes.

  • public bool Place(PageKey key, int slot, ReadOnlySpan<byte> bytes)

    Puts a loaded page's bytes into a slot.

  • 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 (3)

  • TerrainRendererVixen.Rendering.Terrain
  • TerrainStreamerVixen.Rendering.Terrain
  • TerrainStreamingTestsVixen.Rendering.Terrain.Tests