jme.locale.external.data
Class MidPointHeightMap

java.lang.Object
  extended byjme.locale.external.data.AbstractHeightMap
      extended byjme.locale.external.data.MidPointHeightMap

public class MidPointHeightMap
extends AbstractHeightMap

MidPointHeightMap

Version:
1
Author:
Mark Powell

Field Summary
 
Fields inherited from class jme.locale.external.data.AbstractHeightMap
filter, heightData, heightScale, size
 
Constructor Summary
MidPointHeightMap(int size, float roughness)
          Constructor builds a new heightmap using the midpoint displacement algorithm.
 
Method Summary
 boolean load()
          load generates the heightfield using the Midpoint Displacement algorithm.
 void setRoughness(float roughness)
          setRoughness sets the new roughness value of the heightmap.
 
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
 

Constructor Detail

MidPointHeightMap

public MidPointHeightMap(int size,
                         float roughness)
Constructor builds a new heightmap using the midpoint displacement algorithm. Roughness determines how chaotic the terrain will be. Where 1 is perfectly self-similar, > 1 early iterations have a disproportionately large effect creating smooth terrain, and < 1 late iteraions have a disproportionately large effect creating chaotic terrain.

Parameters:
size - the size of the terrain, must be a power of 2.
roughness - how chaotic to make the terrain.
Throws:
MonkeyRuntimeException - if size is less than or equal to zero or roughtness is less than 0.
Method Detail

load

public boolean load()
load generates the heightfield using the Midpoint Displacement 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.

setRoughness

public void setRoughness(float roughness)
setRoughness sets the new roughness value of the heightmap. Roughness determines how chaotic the terrain will be. Where 1 is perfectly self-similar, > 1 early iterations have a disproportionately large effect creating smooth terrain, and < 1 late iteraions have a disproportionately large effect creating chaotic terrain.

Parameters:
roughness - how chaotic will the heightmap be.