Module ROT.FOV.Precise

Precise Shadowcasting Field of View calculator.

The Precise shadow casting algorithm developed by Ondřej Žára for rot.js. See http://roguebasin.roguelikedevelopment.org/index.php?title=Precise_Shadowcasting_in_JavaScript

Functions

init (lightPassesCallback, options) Constructor.
compute (x, y, R, callback) Compute.


Functions

init (lightPassesCallback, options)
Constructor. Called with ROT.FOV.Precise:new()

Parameters:

  • lightPassesCallback function A function with two parameters (x, y) that returns true if a map cell will allow light to pass through
  • options Options
    • topology int Direction for light movement Accepted values: (4 or 8)
compute (x, y, R, callback)
Compute. Get visibility from a given point

Parameters:

  • x int x-position of center of FOV
  • y int y-position of center of FOV
  • R int radius of FOV (i.e.: At most, I can see for R cells)
  • callback A function that is called for every cell in view. Must accept four parameters.
    • x int x-position of cell that is in view
    • y int y-position of cell that is in view
    • r int The cell's distance from center of FOV
    • visibility number The cell's visibility rating (from 0-1). How well can you see this cell?
generated by LDoc 1.4.6 Last updated 2017-07-19 18:43:03