Header menu logo Mibo.Raylib

ShadowAtlas Type

Manages a texture atlas for multiple shadow maps. Supports directional, point (cubemap), and spot light shadows.

Constructors

Constructor Description

ShadowAtlas(config, biasConfig)

Full Usage: ShadowAtlas(config, biasConfig)

Parameters:
Returns: ShadowAtlas
config : ShadowAtlasConfig
biasConfig : ShadowBiasConfig
Returns: ShadowAtlas

Instance members

Instance member Description

this.ActiveCasterCount

Full Usage: this.ActiveCasterCount

Returns: int

Get the number of active caster regions (computed by PrepareUniforms).

Returns: int

this.AddCaster

Full Usage: this.AddCaster

Parameters:
Returns: int<MeasureProduct<ShadowCasterId, MeasureOne>> voption

Register a new shadow caster and allocate atlas regions. Returns the caster ID, or ValueNone if the atlas is full.

casterType : ShadowCasterType
lightPosition : Vector3
lightDirection : Vector3
lightTarget : Vector3
enabled : bool
biasOverride : float32 voption
Returns: int<MeasureProduct<ShadowCasterId, MeasureOne>> voption

this.Biases

Full Usage: this.Biases

Returns: float32 array
Returns: float32 array

this.CasterTypes

Full Usage: this.CasterTypes

Returns: int array
Returns: int array

Get all active casters (for iteration).

Returns: ValueCollection<int<MeasureProduct<ShadowCasterId, MeasureOne>>, ShadowCasterData>

this.Clear

Full Usage: this.Clear

Clear all casters and reset slot allocator. Call at start of each frame.

this.ClearRegion

Full Usage: this.ClearRegion

Parameters:
    regionIndex : int

Clear a specific region in the atlas.

regionIndex : int

this.Count

Full Usage: this.Count

Returns: int

Number of currently allocated casters.

Returns: int

this.Fbo

Full Usage: this.Fbo

Returns: RenderTexture2D

The depth-only FBO for the atlas.

Returns: RenderTexture2D

this.GetBias

Full Usage: this.GetBias

Parameters:
Returns: float32

Get bias for a caster type, respecting per-caster override.

caster : ShadowCasterData
Returns: float32

this.GetRegionScissor

Full Usage: this.GetRegionScissor

Parameters:
    regionIndex : int

Get scissor rectangle for a region index.

regionIndex : int

this.GetRegionViewport

Full Usage: this.GetRegionViewport

Parameters:
    regionIndex : int

Get viewport rectangle for a region index.

regionIndex : int

this.GetUVOffsetScale

Full Usage: this.GetUVOffsetScale

Parameters:
    regionIndex : int

Returns: Vector4

Get UV offset/scale for a region index.

regionIndex : int
Returns: Vector4

this.GridSize

Full Usage: this.GridSize

Returns: int

Grid size (rows/columns) of the atlas.

Returns: int

this.Initialize

Full Usage: this.Initialize

Creates the atlas FBO and depth texture. Must be called during pipeline initialization.

this.LightPositions

Full Usage: this.LightPositions

Returns: Vector3 array
Returns: Vector3 array

this.PrepareUniforms

Full Usage: this.PrepareUniforms

Prepare uniform arrays for upload to shader. Call this each frame before rendering.

this.RegionSize

Full Usage: this.RegionSize

Returns: int

Size of each region in pixels.

Returns: int

this.RemoveCaster

Full Usage: this.RemoveCaster

Parameters:

Remove a shadow caster and free its atlas regions.

id : int<MeasureProduct<ShadowCasterId, MeasureOne>>

this.RenderDebugOverlay

Full Usage: this.RenderDebugOverlay

Parameters:
    screenWidth : int
    screenHeight : int

Render the debug overlay showing atlas regions.

screenWidth : int
screenHeight : int

this.SetCasterViewProj

Full Usage: this.SetCasterViewProj

Parameters:

Set the view-projection matrix for a single-region caster.

id : int<MeasureProduct<ShadowCasterId, MeasureOne>>
vp : Matrix4x4

this.SetRegionViewProj

Full Usage: this.SetRegionViewProj

Parameters:

Set the view-projection matrix for a specific atlas region.

regionIndex : int
vp : Matrix4x4

this.Shutdown

Full Usage: this.Shutdown

Destroys the atlas FBO and releases resources. Must be called during pipeline shutdown.

this.UVOffsets

Full Usage: this.UVOffsets

Returns: Vector4 array
Returns: Vector4 array

this.UpdateCaster

Full Usage: this.UpdateCaster

Parameters:

Update a shadow caster's properties.

id : int<MeasureProduct<ShadowCasterId, MeasureOne>>
?lightPosition : Vector3
?lightDirection : Vector3
?lightTarget : Vector3
?enabled : bool
?biasOverride : float32 voption

this.ViewProjs

Full Usage: this.ViewProjs

Returns: Matrix4x4 array

Get prepared uniform arrays (call after PrepareUniforms).

Returns: Matrix4x4 array

Type something to start searching.