Package com.jme3.terrain.heightmap
Interface HeightMap
- All Known Implementing Classes:
AbstractHeightMap,CombinerHeightMap,FaultHeightMap,FluidSimHeightMap,FractalTileLoader.FloatBufferHeightMap,HillHeightMap,ImageBasedHeightMap,MidpointDisplacementHeightMap,ParticleDepositionHeightMap,RawHeightMap
public interface HeightMap
-
Method Summary
Modifier and TypeMethodDescriptionfloat[]getHeightMapreturns the entire grid of height data.floatgetInterpolatedHeight(float x, float z) getInterpolatedHeightreturns the height of a point that does not fall directly on the height posts.floatgetScaledHeightAtPoint(int x, int z) getScaledHeightAtPointreturns the scaled value at the point provided.float[]intgetSize()getSizereturns the size of one side the height map.floatgetTrueHeightAtPoint(int x, int z) getTrueHeightAtPointreturns the non-scaled value at the point provided.booleanload()loadpopulates the height map data.voidsetHeightAtPoint(float height, int x, int z) setHeightAtPointsets the height value for a given coordinate.voidsetHeightScale(float scale) setHeightScalesets the scale of the height values.voidsetMagnificationFilter(float filter) setFiltersets the erosion value for the filter.voidsetSize(int size) setSizesets the size of the terrain where the area is size x size.voidunloadHeightMapclears the data of the height map.
-
Method Details
-
getHeightMap
float[] getHeightMap()getHeightMapreturns the entire grid of height data.- Returns:
- the grid of height data.
-
getScaledHeightMap
float[] getScaledHeightMap() -
getInterpolatedHeight
float getInterpolatedHeight(float x, float z) getInterpolatedHeightreturns the height of a point that does not fall directly on the height posts.- Parameters:
x- the x coordinate of the point.z- the y coordinate of the point.- Returns:
- the interpolated height at this point.
-
getScaledHeightAtPoint
float getScaledHeightAtPoint(int x, int z) getScaledHeightAtPointreturns the scaled value at the point provided.- Parameters:
x- the x (east/west) coordinate.z- the z (north/south) coordinate.- Returns:
- the scaled value at (x, z).
-
getSize
int getSize()getSizereturns the size of one side the height map. Where the area of the height map is size x size.- Returns:
- the size of a single side.
-
getTrueHeightAtPoint
float getTrueHeightAtPoint(int x, int z) getTrueHeightAtPointreturns the non-scaled value at the point provided.- Parameters:
x- the x (east/west) coordinate.z- the z (north/south) coordinate.- Returns:
- the value at (x,z).
-
load
boolean load()loadpopulates the height map data. This is dependent on the subclass's implementation.- Returns:
- true if the load was successful, false otherwise.
-
setHeightAtPoint
void setHeightAtPoint(float height, int x, int z) setHeightAtPointsets the height value for a given coordinate. It is recommended that the height value be within the 0 - 255 range.- Parameters:
height- the new height for the coordinate.x- the x (east/west) coordinate.z- the z (north/south) coordinate.
-
setHeightScale
void setHeightScale(float scale) setHeightScalesets the scale of the height values. Typically, the height is a little too extreme and should be scaled to a smaller value (i.e. 0.25), to produce cleaner slopes.- Parameters:
scale- the scale to multiply height values by.
-
setMagnificationFilter
setFiltersets the erosion value for the filter. This value must be between 0 and 1, where 0.2 - 0.4 produces arguably the best results.- Parameters:
filter- the erosion value.- Throws:
Exception- if filter is less than 0 or greater than 1.
-
setSize
setSizesets the size of the terrain where the area is size x size.- Parameters:
size- the new size of the terrain.- Throws:
Exception- if the size is less than or equal to zero.
-
unloadHeightMap
void unloadHeightMap()unloadHeightMapclears the data of the height map. This insures it is ready for reloading.
-