org.xith3d.terrain.legacy.heightmap
Class MillerFractal
java.lang.Object
org.xith3d.terrain.legacy.heightmap.HeightMap
org.xith3d.terrain.legacy.heightmap.MillerFractal
- All Implemented Interfaces:
- java.io.Serializable, Terrain
public class MillerFractal
- extends HeightMap
- implements Terrain
Generates a heightmap using the "Miller" algorithm based on random fractals.
It is an implementation of a varient of that alogirthm which is described by
Paul Martz here:
http://www.gameprogrammer.com/fractal.html.
- See Also:
- Serialized Form
|
Constructor Summary |
MillerFractal(int powerOfTwo,
float startingHeight,
float roughness,
java.util.Random rg)
Initialises the miller fractal generator. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MillerFractal
public MillerFractal(int powerOfTwo,
float startingHeight,
float roughness,
java.util.Random rg)
- Initialises the miller fractal generator.
- Parameters:
powerOfTwo - number which will be raised to the power of to too calculate the width and height of the terrainstartingHeight - base heightroughness - how random, or "rough" the terrain will berg - Random number generator to use
generateTerrain
public void generateTerrain()
- generates terrain using the Miller algorithm
- Specified by:
generateTerrain in interface Terrain
generateGeometry
public GeometryArray generateGeometry(float startX,
float startY,
float stepX,
float stepY)
- Description copied from interface:
Terrain
- Build 3D geometry from terrain
- Specified by:
generateGeometry in interface Terrain