Table of Contents

Class TileCoverBuilder

Builds opaque and fading draw lists from the visible footprint and residency.

public sealed class TileCoverBuilder
Inheritance
object
TileCoverBuilder

Remarks

This type chooses what to draw. It does not pin GPU layers; pinning is the streamer's job. Every draw item inherits the visible tile's world copy. Residency lookups stay offset-blind: one resident layer serves every copy of a tile.

Fields

Capacity

Maximum tiles in each of Opaque and Fading. Extra tiles increment DroppedCount.

public const int Capacity = 1024

Field Value

int

Fading

Fading quads from the last Build, valid through FadingCount.

public readonly TileDrawItem[] Fading

Field Value

TileDrawItem[]

MaxAncestorFallback

Inclusive cap on ancestor zoom steps searched for fallback imagery.

public const int MaxAncestorFallback = 10

Field Value

int

MaxDescendantFallback

Cap on descendant zoom steps searched for a full-covering child set.

public const int MaxDescendantFallback = 2

Field Value

int

Opaque

Opaque quads from the last Build, valid through OpaqueCount.

public readonly TileDrawItem[] Opaque

Field Value

TileDrawItem[]

Properties

AnyAlphaRamping

True when the last Build(List<TileCoord>, ITileResidency, FadeTracker, double, double) read any sub-unity alpha, including one a fading tile or ramping-opaque tile emitted AND one the fallback search read but never emitted (a dedupe or capacity drop still proves a real ramp in progress). A caller gating a rebuild on "did anything change" must rebuild every frame while this is true: the cover is a function of the clock, not just of discrete inputs.

public bool AnyAlphaRamping { get; }

Property Value

bool

DroppedCount

Quads that did not fit in Opaque or Fading.

public int DroppedCount { get; }

Property Value

int

ExactCount

Visible tiles drawn opaque at their own level this build.

public int ExactCount { get; }

Property Value

int

FadingCount

Number of valid entries in Fading.

public int FadingCount { get; }

Property Value

int

FallbackCount

Visible tiles that were not fully opaque at their own level, so fallback was attempted.

public int FallbackCount { get; }

Property Value

int

NextAlphaDeadline

Earliest time at which some alpha from the last Build(List<TileCoord>, ITileResidency, FadeTracker, double, double) crosses 1 - the moment the cover's structure can next change. Before this, with every other discrete input unchanged, RefreshAlphas(FadeTracker, double) alone is enough. PositiveInfinity when nothing is ramping.

public double NextAlphaDeadline { get; }

Property Value

double

OpaqueCount

Number of valid entries in Opaque.

public int OpaqueCount { get; }

Property Value

int

PartitionedFallback

True when Build(List<TileCoord>, ITileResidency, FadeTracker, double, double) should emit a non-overlapping partition instead of the flat cover's overlapping fallback quads. Displaced mode only; default false.

public bool PartitionedFallback { get; set; }

Property Value

bool

PinTruncatedCount

Referenced keys that did not fit in the last CollectReferencedKeys(long[]) buffer.

public int PinTruncatedCount { get; }

Property Value

int

UncoveredCount

Visible tiles with no resident imagery at any searched level, including themselves.

public int UncoveredCount { get; }

Property Value

int

Methods

Build(List<TileCoord>, ITileResidency, FadeTracker, double, double)

Builds draw lists for identity-level tiles at world copy 0.

public void Build(List<TileCoord> visible, ITileResidency residency, FadeTracker fades, double now, double zoomFrac = 0)

Parameters

visible List<TileCoord>

Tiles in view, without world copies.

residency ITileResidency

Current GPU layers by packed tile key.

fades FadeTracker

Per-key fade alphas at now.

now double

Current time in seconds, same clock as fades.

zoomFrac double

Fractional zoom, unitless; parent blend is gated to mid-fraction.

Build(List<VisibleTile>, ITileResidency, FadeTracker, double, double)

Builds opaque and fading draw lists for the visible tiles.

public void Build(List<VisibleTile> visible, ITileResidency residency, FadeTracker fades, double now, double zoomFrac = 0)

Parameters

visible List<VisibleTile>

Tiles in view, including world copies.

residency ITileResidency

Current GPU layers by packed tile key.

fades FadeTracker

Per-key fade alphas at now.

now double

Current time in seconds, same clock as fades.

zoomFrac double

Fractional zoom, unitless; parent blend is gated to mid-fraction.

Remarks

Draw items inherit each visible tile's world copy. Residency lookups ignore the copy: one resident layer serves every offset.

CollectReferencedKeys(long[])

Writes packed keys of tiles referenced by the last Build into result.

public int CollectReferencedKeys(long[] result)

Parameters

result long[]

Destination of packed tile keys, offset-blind.

Returns

int

Number of keys written, at most result.Length.

Remarks

The caller uses this list to pin. This method does not pin layers or keep tiles resident. Two world copies of one tile share one key.

RefreshAlphas(FadeTracker, double)

Rewrites only the alpha of each slot the last Build(List<TileCoord>, ITileResidency, FadeTracker, double, double) left ramping, without re-running candidate selection, residency, hysteresis, or floor-pin logic.

public bool RefreshAlphas(FadeTracker fades, double now)

Parameters

fades FadeTracker

Same fade tracker the last Build(List<TileCoord>, ITileResidency, FadeTracker, double, double) was called with.

now double

Current time in seconds, same clock as fades.

Returns

bool

True when every ramping slot's fresh alpha stayed below 1. False means a slot crossed 1 - a real structural change - and the caller must run a full Build(List<TileCoord>, ITileResidency, FadeTracker, double, double) instead of trusting this refresh.

Remarks

Valid only strictly before NextAlphaDeadline: this method never touches candidate selection, order, or dedupe, so it must not be called once a crossing may have moved any of those.

WasLevelCoverDrawn(TileCoord)

True when the last completed Build drew a different zoom over this tile's area.

public bool WasLevelCoverDrawn(TileCoord tile)

Parameters

tile TileCoord

Tile about to appear.

Returns

bool

True when an ancestor within MaxAncestorFallback or a descendant within MaxDescendantFallback was in the last opaque list.

Remarks

Use this as the level-transition test for fades: a tile switching in over such cover crossfades; a tile switching in where nothing drew appears instantly. Keys are offset-blind.