public class HillHeightMap extends AbstractHeightMap
HillHeightMap
generates a height map base on the Hill
Algorithm. Terrain is generatd by growing hills of random size and height at
random points in the heightmap. The terrain is then normalized and valleys
can be flattened.filter, heightData, heightScale, NORMALIZE_RANGE, size
Constructor and Description |
---|
HillHeightMap(int size,
int iterations,
float minRadius,
float maxRadius)
Constructor sets the attributes of the hill system and generates the
height map by using a random seed.
|
HillHeightMap(int size,
int iterations,
float minRadius,
float maxRadius,
long seed)
Constructor sets the attributes of the hill system and generates the
height map.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addHill(float[][] tempBuffer,
java.util.Random random)
Generates a new hill of random size and height at a random position in
the heightmap.
|
boolean |
load()
load populates the height map data. |
void |
setIterations(int iterations)
Sets the number of hills to grow.
|
void |
setMaxRadius(float maxRadius)
Sets the minimum radius of a hill.
|
void |
setMinRadius(float minRadius)
Sets the maximum radius of a hill.
|
erodeTerrain, findMinMaxHeights, flatten, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getScaledHeightMap, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setHeightAtPoint, setHeightScale, setMagnificationFilter, setSize, smooth, smooth, unloadHeightMap
public HillHeightMap(int size, int iterations, float minRadius, float maxRadius, long seed) throws java.lang.Exception
size
- size the size of the terrain to be generatediterations
- the number of hills to growminRadius
- the minimum radius of a hillmaxRadius
- the maximum radius of a hillseed
- the seed to generate the same heightmap againjava.lang.Exception
- if size of the terrain is not greater that zero, or number of
iterations is not greater that zeropublic HillHeightMap(int size, int iterations, float minRadius, float maxRadius) throws java.lang.Exception
size
- size the size of the terrain to be generatediterations
- the number of hills to growminRadius
- the minimum radius of a hillmaxRadius
- the maximum radius of a hilljava.lang.Exception
- if size of the terrain is not greater that zero, or number of
iterations is not greater that zeropublic boolean load()
HeightMap
load
populates the height map data. This is dependent on
the subclass's implementation.protected void addHill(float[][] tempBuffer, java.util.Random random)
Random
object is used to guarantee the same heightmap for the same seed and
attributes.tempBuffer
- the temporary height map bufferrandom
- the random number generatorpublic void setIterations(int iterations) throws java.lang.Exception
iterations
- the number of hills to growjava.lang.Exception
- if iterations if not greater than zeropublic void setMaxRadius(float maxRadius) throws java.lang.Exception
maxRadius
- the maximum radius of a hilljava.lang.Exception
- if the maximum radius if not greater than zero or not greater
than the minimum radiuspublic void setMinRadius(float minRadius) throws java.lang.Exception
minRadius
- the minimum radius of a hilljava.lang.Exception
- if the minimum radius is not greater than zero or not
lower than the maximum radius