|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jmex.terrain.util.AbstractHeightMap
com.jmex.terrain.util.CombinerHeightMap
public class CombinerHeightMap
CombinerHeightMap
generates a new height map based on
two provided height maps. These had maps can either be added together
or substracted from each other. Each heightmap has a weight to
determine how much one will affect the other. By default it is set to
0.5, 0.5 and meaning the two heightmaps are averaged evenly. This
value can be adjusted at will, as long as the two factors are equal
to 1.0.
Field Summary | |
---|---|
static int |
ADDITION
Constant mode to denote adding the two heightmaps. |
static int |
SUBTRACTION
Constant mode to denote subtracting the two heightmaps. |
Fields inherited from class com.jmex.terrain.util.AbstractHeightMap |
---|
filter, heightData, heightScale, NORMALIZE_RANGE, size |
Constructor Summary | |
---|---|
CombinerHeightMap(AbstractHeightMap map1,
AbstractHeightMap map2,
int mode)
Constructor combines two given heightmaps by the specified mode. |
|
CombinerHeightMap(AbstractHeightMap map1,
float factor1,
AbstractHeightMap map2,
float factor2,
int mode)
Constructor combines two given heightmaps by the specified mode. |
Method Summary | |
---|---|
boolean |
load()
load builds a new heightmap based on the combination of
two other heightmaps. |
void |
setFactors(float factor1,
float factor2)
setFactors sets the distribution of heightmaps. |
void |
setHeightMaps(AbstractHeightMap map1,
AbstractHeightMap map2)
setHeightMaps sets the height maps to combine. |
void |
setMode(int mode)
setMode sets the mode of the combiner. |
Methods inherited from class com.jmex.terrain.util.AbstractHeightMap |
---|
erodeTerrain, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setHeightAtPoint, setHeightScale, setMagnificationFilter, setSize, unloadHeightMap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ADDITION
public static final int SUBTRACTION
Constructor Detail |
---|
public CombinerHeightMap(AbstractHeightMap map1, AbstractHeightMap map2, int mode)
map1
- the first heightmap to combine.map2
- the second heightmap to combine.mode
- denotes whether to add or subtract the heightmaps, may
be either ADDITION or SUBTRACTION.
JmeException
- if either map is null, their size
do not match or the mode is invalid.public CombinerHeightMap(AbstractHeightMap map1, float factor1, AbstractHeightMap map2, float factor2, int mode)
map1
- the first heightmap to combine.factor1
- the factor for map1.map2
- the second heightmap to combine.factor2
- the factor for map2.mode
- denotes whether to add or subtract the heightmaps, may
be either ADDITION or SUBTRACTION.
JmeException
- if either map is null, their size
do not match, the mode is invalid, or the factors do not add
to 1.0.Method Detail |
---|
public void setFactors(float factor1, float factor2)
setFactors
sets the distribution of heightmaps.
For example, if factor1 is 0.6 and factor2 is 0.4, then 60% of
map1 will be used with 40% of map2. The two factors must add up
to 1.0.
factor1
- the factor for map1.factor2
- the factor for map2.
JmeException
- if the factors do not add to 1.0.public void setHeightMaps(AbstractHeightMap map1, AbstractHeightMap map2)
setHeightMaps
sets the height maps to combine.
The size of the height maps must be the same.
map1
- the first height map.map2
- the second height map.
JmeException
- if the either heightmap is null, or their
sizes do not match.public void setMode(int mode)
setMode
sets the mode of the combiner. This may either
be ADDITION or SUBTRACTION.
mode
- the mode of the combiner.
JmeException
- if mode is not ADDITION or SUBTRACTION.public boolean load()
load
builds a new heightmap based on the combination of
two other heightmaps. The conditions of the combiner determine the
final outcome of the heightmap.
load
in class AbstractHeightMap
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |