Package com.jme3.terrain.heightmap
Class ImageBasedHeightMap
java.lang.Object
com.jme3.terrain.heightmap.AbstractHeightMap
com.jme3.terrain.heightmap.ImageBasedHeightMap
- All Implemented Interfaces:
HeightMap
ImageBasedHeightMap
is a height map created from the grayscale
conversion of an image. The image used currently must have an equal height
and width, although future work could scale an incoming image to a specific
height and width.-
Field Summary
Fields inherited from class com.jme3.terrain.heightmap.AbstractHeightMap
filter, heightData, heightScale, NORMALIZE_RANGE, size
-
Constructor Summary
ConstructorDescriptionImageBasedHeightMap
(Image colorImage) Creates a HeightMap from an Image.ImageBasedHeightMap
(Image colorImage, float heightScale) -
Method Summary
Modifier and TypeMethodDescriptionprotected float
calculateHeight
(float red, float green, float blue) Get the grayscale value, or override in your own sub-classesprotected float
calculateHeight
(ColorRGBA color) protected ImageRaster
boolean
load()
Loads the image data from top left to bottom rightboolean
load
(boolean flipX, boolean flipY) void
Methods inherited from class com.jme3.terrain.heightmap.AbstractHeightMap
erodeTerrain, findMinMaxHeights, flatten, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getScaledHeightMap, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setHeightAtPoint, setHeightScale, setMagnificationFilter, setSize, smooth, smooth, unloadHeightMap
-
Field Details
-
colorImage
-
-
Constructor Details
-
ImageBasedHeightMap
Creates a HeightMap from an Image. The image will be converted to grayscale, and the grayscale values will be used to generate the height map. White is the highest point, and black is the lowest point. Currently, the Image used must be square (width == height), but future work could rescale the image.- Parameters:
colorImage
- Image to map to the height map.
-
ImageBasedHeightMap
-
-
Method Details
-
setImage
-
load
public boolean load()Loads the image data from top left to bottom right- Returns:
- true if the load was successful, false otherwise.
-
calculateHeight
protected float calculateHeight(float red, float green, float blue) Get the grayscale value, or override in your own sub-classes -
calculateHeight
-
getImageRaster
-
load
public boolean load(boolean flipX, boolean flipY)
-