Header menu logo Mibo

LightCommands Module

Factory functions that create lighting Command2D values. Light-accumulation commands mutate the LightContext2D eagerly and return a NoopLight purely for layer-sort ordering.

Functions and values

Function or value Description

addDirectionalLight lightCtx layer light

Full Usage: addDirectionalLight lightCtx layer light

Parameters:
Returns: Command2D
Modifiers: inline

Adds a directional light. Mutates the context eagerly.

lightCtx : LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
light : DirectionalLight2D
Returns: Command2D

addOccluder lightCtx layer occluder

Full Usage: addOccluder lightCtx layer occluder

Parameters:
Returns: Command2D
Modifiers: inline

Adds an occluder segment. Mutates the context eagerly.

lightCtx : LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
occluder : Occluder2D
Returns: Command2D

addPointLight lightCtx layer light

Full Usage: addPointLight lightCtx layer light

Parameters:
Returns: Command2D
Modifiers: inline

Adds a point light. Mutates the context eagerly.

lightCtx : LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
light : PointLight2D
Returns: Command2D

disableShadows lightCtx layer

Full Usage: disableShadows lightCtx layer

Parameters:
Returns: Command2D
Modifiers: inline

Disables shadows. Mutates the context eagerly.

lightCtx : LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
Returns: Command2D

enableShadows lightCtx layer

Full Usage: enableShadows lightCtx layer

Parameters:
Returns: Command2D
Modifiers: inline

Enables shadows. Mutates the context eagerly.

lightCtx : LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
Returns: Command2D

endLighting lightCtx layer

Full Usage: endLighting lightCtx layer

Parameters:
Returns: Command2D
Modifiers: inline

Ends the current lighting block, marking uniforms dirty.

lightCtx : LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
Returns: Command2D

litAnimatedSprite lightCtx layer dest animSprite

Full Usage: litAnimatedSprite lightCtx layer dest animSprite

Parameters:
Returns: Command2D
Modifiers: inline

Draws an animated sprite with the current lighting state. Automatically extracts texture, source rect, origin, rotation, color, and normal map from the AnimatedSprite and its SpriteSheet. Handles FlipX/FlipY by negating the source rect width/height.

lightCtx : LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
dest : Rectangle
animSprite : AnimatedSprite
Returns: Command2D

litSprite lightCtx sprite

Full Usage: litSprite lightCtx sprite

Parameters:
Returns: Command2D
Modifiers: inline

Creates a lit-sprite command.

lightCtx : LightContext2D
sprite : SpriteState
Returns: Command2D

setAmbient lightCtx (layer, ambient)

Full Usage: setAmbient lightCtx (layer, ambient)

Parameters:
Returns: Command2D
Modifiers: inline

Sets the ambient light color. Mutates the context eagerly.

lightCtx : LightContext2D
layer : int<MeasureProduct<RenderLayer, MeasureOne>>
ambient : AmbientLight2D
Returns: Command2D

Type something to start searching.