Skip to main content

Class: LocalShadowAtlas

The single shared depth atlas every shadowed local light renders into and every chunk material samples from. Fixed geometry: maxSlots shadow slots of CELLS_PER_SHADOW_SLOT square cells each, laid out row-major in cell units. Allocated lazily on the first shadowed light, so worlds that never grant a shadow never pay its memory.

Constructors​

constructor​

• new LocalShadowAtlas(atlasSize, slotSize): LocalShadowAtlas

Parameters​

NameType
atlasSizenumber
slotSizenumber

Returns​

LocalShadowAtlas

Accessors​

capacityCells​

• get capacityCells(): number

Returns​

number


capacitySlots​

• get capacitySlots(): number

Slots the current geometry can hold (each slot is 12 cells).

Returns​

number


cellSize​

• get cellSize(): number

Returns​

number


cellsPerRow​

• get cellsPerRow(): number

Returns​

number


depthTexture​

• get depthTexture(): DepthTexture

Returns​

DepthTexture


estimatedBytes​

• get estimatedBytes(): number

Bytes of GPU memory the atlas holds once allocated (color + depth).

Returns​

number


isAllocated​

• get isAllocated(): boolean

Returns​

boolean


size​

• get size(): number

Returns​

number

Methods​

cellIndex​

▸ cellIndex(slot, face, isDynamic): number

Cell index for a slot's face. Static faces occupy the first six cells of the slot's region, the dynamic overlay the next six.

Parameters​

NameType
slotnumber
facenumber
isDynamicboolean

Returns​

number


cellViewport​

▸ cellViewport(cell, out): void

Pixel-space viewport [x, y, size] of a cell.

Parameters​

NameType
cellnumber
out[number, number, number]

Returns​

void


dispose​

▸ dispose(): void

Returns​

void


ensureAllocated​

▸ ensureAllocated(): WebGLRenderTarget<Texture<unknown>>

Returns​

WebGLRenderTarget<Texture<unknown>>


resize​

▸ resize(atlasSize, slotSize): void

Resize for a quality-tier change. GPU memory is dropped immediately and reallocated lazily; the caller invalidates every slot.

Parameters​

NameType
atlasSizenumber
slotSizenumber

Returns​

void