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.- Author:
- Mike Kienenberger
-
Field Summary
FieldsFields inherited from class com.jme3.terrain.heightmap.AbstractHeightMap
filter, heightData, heightScale, NORMALIZE_RANGE, size -
Constructor Summary
ConstructorsConstructorDescriptionImageBasedHeightMap(com.jme3.texture.Image colorImage) Creates a HeightMap from an Image.ImageBasedHeightMap(com.jme3.texture.Image colorImage, float heightScale) -
Method Summary
Modifier and TypeMethodDescriptionprotected floatcalculateHeight(float red, float green, float blue) Get the grayscale value, or override in your own sub-classesprotected floatcalculateHeight(com.jme3.math.ColorRGBA color) protected com.jme3.texture.image.ImageRasterbooleanload()Loads the image data from top left to bottom rightbooleanload(boolean flipX, boolean flipY) voidsetImage(com.jme3.texture.Image image) 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
protected com.jme3.texture.Image colorImage
-
-
Constructor Details
-
ImageBasedHeightMap
public ImageBasedHeightMap(com.jme3.texture.Image colorImage) 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
public ImageBasedHeightMap(com.jme3.texture.Image colorImage, float heightScale)
-
-
Method Details
-
setImage
public void setImage(com.jme3.texture.Image image) -
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
protected float calculateHeight(com.jme3.math.ColorRGBA color) -
getImageRaster
protected com.jme3.texture.image.ImageRaster getImageRaster() -
load
public boolean load(boolean flipX, boolean flipY)
-