Class ROT.Lighting
Lighting computation, based on a traditional FOV for multiple light sources and multiple passes.
Defined in: <rot.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
ROT.Lighting(reflectivityCallback, options)
|
Method Attributes | Method Name and Description |
---|---|
compute(lightingCallback)
Compute the lighting
|
|
reset()
Reset the pre-computed topology values.
|
|
setFOV(fov)
Set the used Field-Of-View algo
|
|
setLight(x, y, color)
Set (or remove) a light source
|
|
setOptions(options)
Adjust options at runtime
|
Class Detail
ROT.Lighting(reflectivityCallback, options)
- Parameters:
- {function} reflectivityCallback
- Callback to retrieve cell reflectivity (0..1)
- {object} options Optional
- {int} options.passes Optional, Default: 1
- Number of passes. 1 equals to simple FOV of all light sources, >1 means a *highly simplified* radiosity-like algorithm.
- {int} options.emissionThreshold Optional, Default: 100
- Cells with emissivity > threshold will be treated as light source in the next pass.
- {int} options.range Optional, Default: 10
- Max light range
Method Detail
compute(lightingCallback)
Compute the lighting
- Parameters:
- {function} lightingCallback
- Will be called with (x, y, color) for every lit cell
reset()
Reset the pre-computed topology values. Call whenever the underlying map changes its light-passability.
setFOV(fov)
Set the used Field-Of-View algo
- Parameters:
- {ROT.FOV} fov
setLight(x, y, color)
Set (or remove) a light source
- Parameters:
- {int} x
- {int} y
- {null || string || number[3]} color
setOptions(options)
Adjust options at runtime
- Parameters:
- {object} options Optional
- See:
- ROT.Lighting