jme.locale.external.data
Class FaultFractalHeightMap
java.lang.Object
jme.locale.external.data.AbstractHeightMap
jme.locale.external.data.FaultFractalHeightMap
- public class FaultFractalHeightMap
- extends AbstractHeightMap
FaultFractalHeightMap creates a heightmap based on the
Fault Formation fractal generation algorithm based on Jason Shankel's
paper from "Game Programming Gems". Terrain is generated by simulating
Earth quakes, where a random line is drawn through the heightmap and
one side is lifted by a factor. This is then run through a FIR filter
to simulate water errosion.
- Version:
- 1
- Author:
- Mark Powell
|
Constructor Summary |
FaultFractalHeightMap(int size,
int iterations,
int minDelta,
int maxDelta,
float filter)
Constructor sets the attributes of the fault fractal system and
generates the heightmap. |
|
Method Summary |
boolean |
load()
load generates the heightfield using the Fault Fractal
algorithm. |
void |
setIterations(int iterations)
setIterations sets the number of faults to generated during
the construction of the heightmap. |
void |
setMaxDelta(int maxDelta)
setMaxDelta sets the maximum height value for the fault
line varience. |
void |
setMinDelta(int minDelta)
setMinDelta sets the minimum height value for the
fault line varience. |
| Methods inherited from class jme.locale.external.data.AbstractHeightMap |
erodeTerrain, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setFilter, setHeightAtPoint, setHeightScale, setSize, unloadHeightMap |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FaultFractalHeightMap
public FaultFractalHeightMap(int size,
int iterations,
int minDelta,
int maxDelta,
float filter)
- Constructor sets the attributes of the fault fractal system and
generates the heightmap.
- Parameters:
size - the size of the terrain to be generated.iterations - the number of faults to generate.minDelta - the minimum varience in the height increase between
faults.maxDelta - the maximum varience in the height increase between
faults.filter - the filter used for erosion. Filter can be between 0 and
1, where 0 is no filtering and 1 is extreme filtering. Suggested
values are 0.2-0.4.
- Throws:
MonkeyRuntimeException - if size is not greater than zero,
iterations is not greater than zero, minDelta is more than
maxDelta and if filter is not between 0 and 1.
load
public boolean load()
load generates the heightfield using the Fault Fractal
algorithm. load uses the latest attributes, so a call
to load is recommended if attributes have changed using
the set methods.
- Specified by:
load in class AbstractHeightMap
- Returns:
- true if the load was successful, false otherwise.
setIterations
public void setIterations(int iterations)
setIterations sets the number of faults to generated during
the construction of the heightmap.
- Parameters:
iterations - the number of fault lines to generate.
- Throws:
MonkeyRuntimeException - if the number of faults is less than or
equal to zero.
setMinDelta
public void setMinDelta(int minDelta)
setMinDelta sets the minimum height value for the
fault line varience.
- Parameters:
minDelta - the minimum height value for the fault line varience.
- Throws:
MonkeyRuntimeException - if minDelta is greater than maxDelta.
setMaxDelta
public void setMaxDelta(int maxDelta)
setMaxDelta sets the maximum height value for the fault
line varience.
- Parameters:
maxDelta - the maximum height value for the fault line varience.
- Throws:
MonkeyRuntimeException - if maxDelta is less than minDelta.