public class FOV extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
RIPPLE |
static int |
RIPPLE_LOOSE |
static int |
RIPPLE_TIGHT |
static int |
RIPPLE_VERY_LOOSE |
static int |
SHADOW |
Constructor and Description |
---|
FOV()
Creates a solver which will use the default SHADOW solver.
|
FOV(int type)
Creates a solver which will use the provided FOV solver type.
|
Modifier and Type | Method and Description |
---|---|
static double[][] |
addFOVs(double[][]... maps)
Adds multiple FOV maps together in the simplest way possible; does not check line-of-sight between FOV maps.
|
static double[][] |
addFOVs(Iterable<double[][]> maps)
Adds multiple FOV maps together in the simplest way possible; does not check line-of-sight between FOV maps.
|
double[][] |
calculateFOV(double[][] resistanceMap,
int startx,
int starty)
Calculates the Field Of View for the provided map from the given x, y
coordinates.
|
double[][] |
calculateFOV(double[][] resistanceMap,
int startx,
int starty,
double radius)
Calculates the Field Of View for the provided map from the given x, y
coordinates.
|
double[][] |
calculateFOV(double[][] resistanceMap,
int startX,
int startY,
double radius,
Radius radiusTechnique)
Calculates the Field Of View for the provided map from the given x, y
coordinates.
|
double[][] |
calculateFOV(double[][] resistanceMap,
int startX,
int startY,
double radius,
Radius radiusTechnique,
double angle,
double span)
Calculates the Field Of View for the provided map from the given x, y
coordinates.
|
double[][] |
calculateLOSMap(double[][] resistanceMap,
int startX,
int startY)
Calculates what cells are visible from (startX,startY) using the given resistanceMap; this can be given to
mixVisibleFOVs() to limit extra light sources to those visible from the starting point.
|
static double[][] |
mixVisibleFOVs(double[][] losMap,
double[][]... maps)
Adds together multiple FOV maps, but only adds to a position if it is visible in the given LOS map.
|
static double[][] |
mixVisibleFOVs(double[][] losMap,
Iterable<double[][]> maps)
Adds together multiple FOV maps, but only adds to a position if it is visible in the given LOS map.
|
public static final int RIPPLE
public static final int RIPPLE_LOOSE
public static final int RIPPLE_TIGHT
public static final int RIPPLE_VERY_LOOSE
public static final int SHADOW
public FOV()
public FOV(int type)
type
- public double[][] calculateFOV(double[][] resistanceMap, int startx, int starty)
resistanceMap
- the grid of cells to calculate on; the kind made by DungeonUtility.generateResistances()startx
- the horizontal component of the starting locationstarty
- the vertical component of the starting locationpublic double[][] calculateFOV(double[][] resistanceMap, int startx, int starty, double radius)
resistanceMap
- the grid of cells to calculate on; the kind made by DungeonUtility.generateResistances()startx
- the horizontal component of the starting locationstarty
- the vertical component of the starting locationradius
- the distance the light will extend topublic double[][] calculateFOV(double[][] resistanceMap, int startX, int startY, double radius, Radius radiusTechnique)
resistanceMap
- the grid of cells to calculate on; the kind made by DungeonUtility.generateResistances()startX
- the horizontal component of the starting locationstartY
- the vertical component of the starting locationradius
- the distance the light will extend toradiusTechnique
- provides a means to calculate the radius as desiredpublic double[][] calculateFOV(double[][] resistanceMap, int startX, int startY, double radius, Radius radiusTechnique, double angle, double span)
resistanceMap
- the grid of cells to calculate on; the kind made by DungeonUtility.generateResistances()startX
- the horizontal component of the starting locationstartY
- the vertical component of the starting locationradius
- the distance the light will extend toradiusTechnique
- provides a means to calculate the radius as desiredangle
- the angle in degrees that will be the center of the FOV cone, 0 points rightspan
- the angle in degrees that measures the full arc contained in the FOV conepublic static double[][] addFOVs(double[][]... maps)
maps
- an array or vararg of 2D double arrays, each usually returned by calculateFOV()public static double[][] addFOVs(Iterable<double[][]> maps)
maps
- an Iterable of 2D double arrays (most collections implement Iterable),
each usually returned by calculateFOV()public static double[][] mixVisibleFOVs(double[][] losMap, double[][]... maps)
losMap
- an LOS map such as one generated by calculateLOSMap()maps
- an array or vararg of 2D double arrays, each usually returned by calculateFOV()public static double[][] mixVisibleFOVs(double[][] losMap, Iterable<double[][]> maps)
losMap
- an LOS map such as one generated by calculateLOSMap()maps
- an Iterable of 2D double arrays, each usually returned by calculateFOV()public double[][] calculateLOSMap(double[][] resistanceMap, int startX, int startY)
resistanceMap
- the grid of cells to calculate on; the kind made by DungeonUtility.generateResistances()startX
- the center of the LOS map; typically the player's x-positionstartY
- the center of the LOS map; typically the player's y-positionCopyright © 2012–2016. All rights reserved.