Module ROT.Lighting

Lighting Calculator.

based on a traditional FOV for multiple light sources and multiple passes.

Functions

init (reflectivityCallback, options) Constructor.
setFOV (fov) Set FOV Set the Field of View algorithm used to calculate light emission
setLight (x, y, color) Add or remove a light source
compute (lightingCallback) Compute.


Functions

init (reflectivityCallback, options)
Constructor.

Parameters:

  • reflectivityCallback Callback to retrieve cell reflectivity must return float(0..1)
    • x int x-position of cell
    • y int y-position of cell
  • options Options
    • passes int Number of passes. 1 equals to simple FOV of all light sources, >1 means a *highly simplified* radiosity-like algorithm. (default 1)
    • emissionThreshold int Cells with emissivity > threshold will be treated as light source in the next pass. (default 100)
    • range int Max light range (default 10)
setFOV (fov)
Set FOV Set the Field of View algorithm used to calculate light emission

Parameters:

  • fov userdata Class/Module used to calculate fov Must have compute(x, y, range, cb) method. Typically you would supply ROT.FOV.Precise:new() here.

Returns:

    ROT.Lighting self

See also:

setLight (x, y, color)
Add or remove a light source

Parameters:

  • x int x-position of light source
  • y int y-position of light source
  • color nil, string or table An string accepted by Color:fromString(str) or a color table. A nil value here will remove the light source at x, y

Returns:

    ROT.Lighting self

See also:

compute (lightingCallback)
Compute. Compute the light sources and lit cells

Parameters:

  • lightingCallback function Will be called with (x, y, color) for every lit cell

Returns:

    ROT.Lighting self
generated by LDoc 1.4.6 Last updated 2017-07-19 18:43:03