LightContext2D Type
Central GPU-state holder for 2D lighting. Owns two compiled effects
(plain and normal-mapped) loaded from embedded .mgfx resources via
ShaderLoader.
Mirrors the raylib LightContext2D. The context collects lights and
occluders each frame (via the DirLights/PointLights/OccludersResizeArrays), then uploads them as shader uniforms on the first lit
sprite draw. Uniforms are uploaded to both effects so the renderer
can switch between plain and normal-mapped per sprite without re-uploading.
The user is responsible for calling Reset() at the start of each
frame's view (the renderer does not call it).
Constructors
| Constructor |
Description
|
Full Usage:
LightContext2D(gd, ?litEffect, ?litNormalMapEffect, ?maxDirLights, ?maxPointLights, ?maxOccluders, ?softness, ?maxShadowDistance)
Parameters:
GraphicsDevice
?litEffect : Effect
?litNormalMapEffect : Effect
?maxDirLights : int
?maxPointLights : int
?maxOccluders : int
?softness : float32
?maxShadowDistance : float32
Returns: LightContext2D
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.Ambient
|
|
|
|
|
|
Full Usage:
this.EnsureLocationsCached
|
Caches shader parameter locations for both effects (idempotent). |
|
|
|
The normal-map effect's
|
|
|
|
|
Full Usage:
this.Reset
|
Clears all lights, occluders, and resets state. Call at the start of each frame's view (the renderer does not call this). |
Full Usage:
this.ShaderActive
|
|
Full Usage:
this.ShadowsEnabled
|
|
Full Usage:
this.UniformsDirty
|
|
Full Usage:
this.UploadUniforms
|
Uploads all light/occluder uniforms to both effects. |
Mibo