Package com.jme3.terrain.heightmap
Class HillHeightMap
java.lang.Object
com.jme3.terrain.heightmap.AbstractHeightMap
com.jme3.terrain.heightmap.HillHeightMap
- All Implemented Interfaces:
- HeightMap
HillHeightMap generates a height map base on the Hill
 Algorithm. Terrain is generated by growing hills of random size and height at
 random points in the heightmap. The terrain is then normalized and valleys
 can be flattened.- See Also:
- 
Field SummaryFields inherited from class com.jme3.terrain.heightmap.AbstractHeightMapfilter, heightData, heightScale, NORMALIZE_RANGE, size
- 
Constructor SummaryConstructorsConstructorDescriptionHillHeightMap(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.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidGenerates a new hill of random size and height at a random position in the heightmap.booleanload()Generates a heightmap using the Hill Algorithm and the attributes set by the constructor or the setters.voidsetIterations(int iterations) Sets the number of hills to grow.voidsetMaxRadius(float maxRadius) Sets the minimum radius of a hill.voidsetMinRadius(float minRadius) Sets the maximum radius of a hill.Methods inherited from class com.jme3.terrain.heightmap.AbstractHeightMaperodeTerrain, findMinMaxHeights, flatten, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getScaledHeightMap, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setHeightAtPoint, setHeightScale, setMagnificationFilter, setSize, smooth, smooth, unloadHeightMap
- 
Constructor Details- 
HillHeightMappublic HillHeightMap(int size, int iterations, float minRadius, float maxRadius, long seed) throws Exception Constructor sets the attributes of the hill system and generates the height map.- Parameters:
- size- size the size of the terrain to be generated
- iterations- the number of hills to grow
- minRadius- the minimum radius of a hill
- maxRadius- the maximum radius of a hill
- seed- the seed to generate the same heightmap again
- Throws:
- Exception- if size of the terrain is not greater than zero, or the number of iterations is not greater than zero
 
- 
HillHeightMapConstructor sets the attributes of the hill system and generates the height map by using a random seed.- Parameters:
- size- size the size of the terrain to be generated
- iterations- the number of hills to grow
- minRadius- the minimum radius of a hill
- maxRadius- the maximum radius of a hill
- Throws:
- Exception- if size of the terrain is not greater than zero, or number of iterations is not greater than zero
 
 
- 
- 
Method Details- 
loadpublic boolean load()Generates a heightmap using the Hill Algorithm and the attributes set by the constructor or the setters.- Returns:
- true if the load was successful, false otherwise.
 
- 
addHillGenerates a new hill of random size and height at a random position in the heightmap. This is the actual Hill algorithm. TheRandomobject is used to guarantee the same heightmap for the same seed and attributes.- Parameters:
- tempBuffer- the temporary height map buffer
- random- the random number generator
 
- 
setIterationsSets the number of hills to grow. More hills usually mean a nicer heightmap.- Parameters:
- iterations- the number of hills to grow
- Throws:
- Exception- if iterations is not greater than zero
 
- 
setMaxRadiusSets the minimum radius of a hill.- Parameters:
- maxRadius- the maximum radius of a hill
- Throws:
- Exception- if the maximum radius is not greater than zero or not greater than the minimum radius
 
- 
setMinRadiusSets the maximum radius of a hill.- Parameters:
- minRadius- the minimum radius of a hill
- Throws:
- Exception- if the minimum radius is not greater than zero or not lower than the maximum radius
 
 
-