Package com.jme3.terrain.heightmap
Class RawHeightMap
java.lang.Object
com.jme3.terrain.heightmap.AbstractHeightMap
com.jme3.terrain.heightmap.RawHeightMap
- All Implemented Interfaces:
HeightMap
RawHeightMap
creates a height map from a RAW image file. The
greyscale image denotes height based on the value of the pixel for each
point. Where pure black the lowest point and pure white denotes the highest.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Format specification for 16 bit big endian heightmapsstatic final int
Format specification for 16 bit little endian heightmapsstatic final int
Format specification for 8 bit precision heightmapsFields inherited from class com.jme3.terrain.heightmap.AbstractHeightMap
filter, heightData, heightScale, NORMALIZE_RANGE, size
-
Constructor Summary
ConstructorDescriptionRawHeightMap
(float[] heightData) RawHeightMap
(InputStream stream, int size, int format, boolean swapxy) RawHeightMap
(String filename, int size) Constructor creates a newRawHeightMap
object and loads a RAW image file to use as a height field.RawHeightMap
(String filename, int size, int format, boolean swapXy) RawHeightMap
(URL resource, int size, int format, boolean swapxy) -
Method Summary
Modifier and TypeMethodDescriptionboolean
load()
load
fills the height data array with the appropriate data from the set RAW image.void
setFilename
(String filename) setFilename
sets the file to use for the RAW data.void
setHeightStream
(InputStream stream) setHeightStream
sets the stream to use for the RAW data.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
-
FORMAT_8BIT
public static final int FORMAT_8BITFormat specification for 8 bit precision heightmaps- See Also:
-
FORMAT_16BITLE
public static final int FORMAT_16BITLEFormat specification for 16 bit little endian heightmaps- See Also:
-
FORMAT_16BITBE
public static final int FORMAT_16BITBEFormat specification for 16 bit big endian heightmaps- See Also:
-
-
Constructor Details
-
RawHeightMap
Constructor creates a newRawHeightMap
object and loads a RAW image file to use as a height field. The greyscale image denotes the height of the terrain, where dark is low point and bright is high point. The values of the RAW correspond directly with the RAW values or 0 - 255.- Parameters:
filename
- the RAW file to use as the heightmap.size
- the size of the RAW (must be square).- Throws:
Exception
- if the filename is null or not RAW, and if the size is 0 or less.
-
RawHeightMap
public RawHeightMap(float[] heightData) -
RawHeightMap
- Throws:
Exception
-
RawHeightMap
- Throws:
Exception
-
RawHeightMap
- Throws:
Exception
-
-
Method Details
-
load
public boolean load()load
fills the height data array with the appropriate data from the set RAW image.- Returns:
- true if the load is successful, false otherwise.
- Throws:
RuntimeException
- if the RAW image has not been set
-
setFilename
setFilename
sets the file to use for the RAW data. A call toload
is required to put the changes into effect.- Parameters:
filename
- the new file to use for the height data.- Throws:
Exception
- if the file is null or not RAW.
-
setHeightStream
setHeightStream
sets the stream to use for the RAW data. A call toload
is required to put the changes into effect.- Parameters:
stream
- the new stream to use for the height data.- Throws:
Exception
- if the stream is null or not RAW.
-