Module ROT.FOV.Recursive

Recursive Shadowcasting Field of View calculator.

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

Functions

init (lightPassesCallback, options) Constructor.
compute (x, y, R, callback) Compute.
compute180 (x, y, R, dir, callback) Compute 180.
compute90 (x, y, R, dir, callback) Compute 90.


Functions

init (lightPassesCallback, options)
Constructor. Called with ROT.FOV.Recursive: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 boolean Indicates if the cell is seen
compute180 (x, y, R, dir, callback)
Compute 180. Get visibility from a given point for a 180 degree arc

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)
  • dir int viewing direction (use ROT.DIR index for values)
  • 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 boolean Indicates if the cell is seen
compute90 (x, y, R, dir, callback)
Compute 90. Get visibility from a given point for a 90 degree arc

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)
  • dir int viewing direction (use ROT.DIR index for values)
  • 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 boolean Indicates if the cell is seen
generated by LDoc 1.4.6 Last updated 2017-07-19 18:43:03