API Reference › Light › Light.occlude
method

Light.occlude

Light.occlude(x, y, width, height)

Registers an axis-aligned rectangle (screen space) that blocks light: for every Light.point that follows, any pixel whose ray from the light centre crosses this rectangle — or lies inside it — is left in shadow, carving a hard umbra behind the wall. Register the geometry that should cast shadows this frame, then draw the lights. Occluders persist until Light.clear_occluders, so call that once per frame first; up to 64 occluders are kept.

Example

program Demo {
  property Wall { x: int = 0, y: int = 0 }
  model Block { Wall }
  handler Render phase Update {
    Screen.clear(0)
    Light.clear_occluders()
    Light.occlude(120, 80, 8, 48)                 # a pillar
    Light.point(60, 100, 120, Color.rgb(255, 240, 200), 1.0)
    Screen.show()
  }
}
← All symbols