LightCommands Module
Factory functions for lighting-related render commands. Each function mutates the LightContext2D immediately (during view population) and returns a Command2D for layer ordering.
Functions and values
| Function or value |
Description
|
Full Usage:
addDirectionalLight lightCtx layer light
Parameters:
LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
light : DirectionalLight2D
Returns: Command2D
Modifiers: inline |
Adds a directional light for the current frame. Mutates the light context immediately. The returned command is a layer placeholder.
|
Full Usage:
addOccluder lightCtx layer occluder
Parameters:
LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
occluder : Occluder2D
Returns: Command2D
Modifiers: inline |
Adds an occluder segment for the current frame. Used by the shadow system. Mutates the light context immediately. The returned command is a layer placeholder.
|
Full Usage:
addPointLight lightCtx layer light
Parameters:
LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
light : PointLight2D
Returns: Command2D
Modifiers: inline |
Adds a point light for the current frame. Mutates the light context immediately. The returned command is a layer placeholder.
|
Full Usage:
disableShadows lightCtx layer
Parameters:
LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
Returns: Command2D
Modifiers: inline |
Disables shadow raymarching for subsequent lit sprites in this context. Occluders are still collected but not uploaded to the shader. Mutates the light context immediately. The returned command is a layer placeholder.
|
Full Usage:
enableShadows lightCtx layer
Parameters:
LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
Returns: Command2D
Modifiers: inline |
Enables shadow raymarching for subsequent lit sprites in this context. Mutates the light context immediately. The returned command is a layer placeholder.
|
Full Usage:
endLighting lightCtx layer
Parameters:
LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
Returns: Command2D
Modifiers: inline |
Ends the current lighting pass. Deactivates the lit shader. Sprites after this point are unlit. Call again to re-enable lighting.
|
Full Usage:
litSprite lightCtx sprite
Parameters:
LightContext2D
sprite : SpriteState
Returns: Command2D
Modifiers: inline |
Draws a sprite with the current lighting state from the given light context. Activates the lit shader and uploads light uniforms on first call each frame.
|
Full Usage:
setAmbient lightCtx (layer, ambient)
Parameters:
LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
ambient : AmbientLight2D
Returns: Command2D
Modifiers: inline |
Sets the ambient light color for the current frame. Mutates the light context immediately. The returned command is a layer placeholder. (lightCtx) can be bound first for partial application.
|
Mibo.Raylib