Vixen
dd8b0a81
csharp
public sealed class TerrainTileSource

A tile source over a terrain that is already in memory.

Read the guide page for this →

Remarks

⚠ Synchronous behind an asynchronous signature, and deliberately so. Compositing a tile's chain is arithmetic over arrays this object already holds; wrapping it in a thread would add a scheduling hop to a few microseconds of work. What the signature buys is that the file-backed source can replace this one without PageResidency changing.

⚠ Synchronous is not the same as single-threaded. The residency service dispatches every load through the thread pool whatever the source does with it, so several ReadAsync calls run at once and none of them may touch the terrain's composite, its dirty flags or a buffer of this object's own. Resolving is Prepare's, and the chain is built straight into the caller's destination.

Fields and properties (2)

  • public int TileSamples

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

  • public (int X, int Z) TileCounts

    How many tiles there are along each axis.

Methods (4)

  • public TerrainTileSource(Terrain terrain)

    Reads tiles out of a terrain.

  • public void Prepare()
  • public int RevisionOf(int tileX, int tileZ)
  • public 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 (2)

  • TerrainSceneRendererVixen.Rendering.Terrain
  • TerrainStreamingTestsVixen.Rendering.Terrain.Tests