Vixen
02b45cc4
csharp
public interface ITerrainTileSource

Where a tile's height chain comes from.

Read the guide page for this →

Remarks

The seam that decides whether this streams from disk or only into the atlas. TerrainStreamer is about which tiles a frame pays for; where their bytes are read from is this, and the two are separable because the residency service already is — LoadAsync is asynchronous precisely so that a source backed by a file does not stall the frame.

⚠ TerrainTileSource is the in-memory one and it is not a disk cache. A terrain the editor is sculpting is entirely in host memory by definition — it has an edit stack — so streaming it saves the upload and nothing else. That is still the expensive half: a 128×128-tile terrain is sixteen thousand block copies on its first frame, and a source's radius turns that into a few dozen. A file-backed source is what makes the host bytes optional too, and it needs a tile-addressable file, which TerrainStore's v1 layout is not.

Fields and properties (2)

  • int TileSamples

    How many samples a tile is across, which fixes the page size.

  • (int X, int Z) TileCounts

    How many tiles there are along each axis.

Methods (1)

  • ValueTask<int> ReadAsync(int tileX, int tileZ, Memory<byte> destination, CancellationToken cancellation)

    Reads one tile's whole mip chain, packed level after level.

Used by (3)

  • TerrainStreamerVixen.Rendering.Terrain
  • TerrainTilePagesVixen.Rendering.Terrain
  • TerrainTileSourceVixen.Rendering.Terrain