Package com.jme3.terrain
Class GeoMap
java.lang.Object
com.jme3.terrain.GeoMap
- All Implemented Interfaces:
- Savable
- Direct Known Subclasses:
- LODGeomap
Constructs heightfields to be used in Terrain.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncreateMesh(Vector3f scale, Vector2f tcScale, boolean center) intReturns the height of this Geomapfloat[]intfloatgetValue(int i) Returns the height value at the given index.floatgetValue(int x, int y) Returns the height value for a given point.intgetWidth()Returns the width of this GeomapbooleanisLoaded()Returns true if the Geomap data is loaded in memory If false, then the data is unavailable- must be loaded with load() before the methods getHeight/getNormal can be usedvoidread(JmeImporter im) voidwrite(JmeExporter ex) writeIndexArray(IntBuffer store) writeNormalArray(FloatBuffer store, Vector3f scale) Creates a normal array from the normal data in this GeomapwriteTexCoordArray(FloatBuffer store, Vector2f offset, Vector2f scale) writeVertexArray(FloatBuffer store, Vector3f scale, boolean center) Creates a vertex array from the height data in this Geomap The scale argument specifies the scale to use for the vertex buffer.
- 
Field Details- 
hdataprotected float[] hdata
- 
widthprotected int width
- 
heightprotected int height
- 
maxvalprotected int maxval
 
- 
- 
Constructor Details- 
GeoMappublic GeoMap()
- 
GeoMappublic GeoMap(float[] heightData, int width, int height, int maxval) 
 
- 
- 
Method Details- 
getHeightArraypublic float[] getHeightArray()
- 
getMaximumValuepublic int getMaximumValue()- Returns:
- The maximum possible value that getValue()can return. Mostly depends on the source data format (byte, short, int, etcetera).
 
- 
getValuepublic float getValue(int x, int y) Returns the height value for a given point. MUST return the same value as getHeight(y*getWidth()+x)- Parameters:
- x- the X coordinate
- y- the Y coordinate
- Returns:
- an arbitrary height looked up from the heightmap
- Throws:
- NullPointerException- If isLoaded() is false
 
- 
getValuepublic float getValue(int i) Returns the height value at the given index. zero index is top left of map, getWidth()*getHeight() index is lower right- Parameters:
- i- The index
- Returns:
- an arbitrary height looked up from the heightmap
- Throws:
- NullPointerException- If isLoaded() is false
 
- 
getWidthpublic int getWidth()Returns the width of this Geomap- Returns:
- the width of this Geomap
 
- 
getHeightpublic int getHeight()Returns the height of this Geomap- Returns:
- the height of this Geomap
 
- 
isLoadedpublic boolean isLoaded()Returns true if the Geomap data is loaded in memory If false, then the data is unavailable- must be loaded with load() before the methods getHeight/getNormal can be used- Returns:
- whether the geomap data is loaded in system memory
 
- 
writeNormalArrayCreates a normal array from the normal data in this Geomap- Parameters:
- store- A preallocated FloatBuffer where to store the data (optional), size must be >= getWidth()*getHeight()*3
- Returns:
- store, or a new FloatBuffer if store is null
- Throws:
- NullPointerException- If isLoaded() or hasNormalmap() is false
 
- 
writeVertexArrayCreates a vertex array from the height data in this Geomap The scale argument specifies the scale to use for the vertex buffer. For example, if scale is 10,1,10, then the greatest X value is getWidth()*10- Parameters:
- store- A preallocated FloatBuffer where to store the data (optional), size must be >= getWidth()*getHeight()*3
- scale- Created vertexes are scaled by this vector
- Returns:
- store, or a new FloatBuffer if store is null
- Throws:
- NullPointerException- If isLoaded() is false
 
- 
getUV
- 
getUV
- 
writeTexCoordArray
- 
writeIndexArray
- 
createMesh
- 
write- Specified by:
- writein interface- Savable
- Throws:
- IOException
 
- 
read- Specified by:
- readin interface- Savable
- Throws:
- IOException
 
 
-