public interface ITerrainTileSourceWhere a tile's height chain comes from.
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 TileSamplesHow many samples a tile is across, which fixes the page size.
(int X, int Z) TileCountsHow many tiles there are along each axis.
Methods (3)
void Prepare()Brings whatever ReadAsync reads up to date, on the caller's thread.
int RevisionOf(int tileX, int tileZ)What a tile's bytes are at, as a number that changes whenever they change.
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 (4)
- GatedSourceVixen.Rendering.Terrain.Tests
- TerrainStreamerVixen.Rendering.Terrain
- TerrainTilePagesVixen.Rendering.Terrain
- TerrainTileSourceVixen.Rendering.Terrain