Package com.jme3.terrain.heightmap
Class CombinerHeightMap
java.lang.Object
com.jme3.terrain.heightmap.AbstractHeightMap
com.jme3.terrain.heightmap.CombinerHeightMap
- All Implemented Interfaces:
- HeightMap
Generates a new height map based on
 two provided height maps. These maps can either be added together
 or subtracted 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, meaning the two heightmaps have equal weight. This
 value can be adjusted at will, as long as the two factors sum to 1.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intConstant mode to denote adding the two heightmaps.static final intConstant mode to denote subtracting the two heightmaps.Fields inherited from class com.jme3.terrain.heightmap.AbstractHeightMapfilter, heightData, heightScale, NORMALIZE_RANGE, size
- 
Constructor SummaryConstructorsConstructorDescriptionCombinerHeightMap(AbstractHeightMap map1, float factor1, AbstractHeightMap map2, float factor2, int mode) Constructor combines two given heightmaps by the specified mode.CombinerHeightMap(AbstractHeightMap map1, AbstractHeightMap map2, int mode) Constructor combines two given heightmaps by the specified mode.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanload()loadbuilds a new heightmap based on the combination of two other heightmaps.voidsetFactors(float factor1, float factor2) setFactorssets the distribution of heightmaps.voidsetHeightMaps(AbstractHeightMap map1, AbstractHeightMap map2) setHeightMapssets the height maps to combine.voidsetMode(int mode) setModesets the mode of the combiner.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
- 
Field Details- 
ADDITIONpublic static final int ADDITIONConstant mode to denote adding the two heightmaps.- See Also:
 
- 
SUBTRACTIONpublic static final int SUBTRACTIONConstant mode to denote subtracting the two heightmaps.- See Also:
 
 
- 
- 
Constructor Details- 
CombinerHeightMapConstructor combines two given heightmaps by the specified mode. The heightmaps will be evenly distributed. The heightmaps must be of the same size.- Parameters:
- 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.
- Throws:
- Exception- if either map is null, their size do not match or the mode is invalid.
 
- 
CombinerHeightMappublic CombinerHeightMap(AbstractHeightMap map1, float factor1, AbstractHeightMap map2, float factor2, int mode) throws Exception Constructor combines two given heightmaps by the specified mode. The heightmaps will be distributed based on the given factors. 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. The heightmaps must also be of the same size.- Parameters:
- 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.
- Throws:
- Exception- if either map is null, their size do not match, the mode is invalid, or the factors do not add to 1.0.
 
 
- 
- 
Method Details- 
setFactorssetFactorssets 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.- Parameters:
- factor1- the factor for map1.
- factor2- the factor for map2.
- Throws:
- Exception- if the factors do not add to 1.0.
 
- 
setHeightMapssetHeightMapssets the height maps to combine. The size of the height maps must be the same.- Parameters:
- map1- the first height map.
- map2- the second height map.
- Throws:
- Exception- if either height map is null, or their sizes do not match.
 
- 
setModesetModesets the mode of the combiner. This may either be ADDITION or SUBTRACTION.- Parameters:
- mode- the mode of the combiner.
- Throws:
- Exception- if mode is not ADDITION or SUBTRACTION.
 
- 
loadpublic boolean load()loadbuilds a new heightmap based on the combination of two other heightmaps. The conditions of the combiner determine the final outcome of the heightmap.- Returns:
- boolean if the heightmap was successfully created.
 
 
-