com.jme3.terrain
クラス GeoMap

java.lang.Object
  上位を拡張 com.jme3.terrain.GeoMap
すべての実装されたインタフェース:
Savable
直系の既知のサブクラス:
LODGeomap

public class GeoMap
extends java.lang.Object
implements Savable

Constructs heightfields to be used in Terrain.


コンストラクタの概要
GeoMap()
           
GeoMap(java.nio.FloatBuffer heightData, java.nio.ByteBuffer normalData, int width, int height, int maxval)
           
GeoMap(int width, int height, int maxval)
           
 
メソッドの概要
 GeoMap copySubGeomap(int x, int y, int w, int h)
          Copies a section of this geomap as a new geomap
 Mesh createMesh(Vector3f scale, Vector2f tcScale, boolean center)
           
 int getHeight()
          Returns the height of this Geomap
 java.nio.FloatBuffer getHeightData()
           
 int getMaximumValue()
           
 Vector3f getNormal(int x, int y, Vector3f store)
          Returns the normal at a point If store is null, then a new vector is returned, otherwise, the result is stored in the provided vector and then returned from this method
 Vector3f getNormal(int i, Vector3f store)
          Returns the normal at an index If store is null, then a new vector is returned, otherwise, the result is stored in the provided vector and then returned from this method See getHeight(int) for information about index lookup
 java.nio.ByteBuffer getNormalData()
           
 Vector2f getUV(int x, int y, Vector2f store)
           
 Vector2f getUV(int i, Vector2f store)
           
 float getValue(int i)
          Returns the height value at the given index.
 float getValue(int x, int y)
          Returns the height value for a given point.
 int getWidth()
          Returns the width of this Geomap
 boolean hasNormalmap()
          Returns true if this Geomap has a normalmap associated with it
 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
 void populateHdataFromMesh(Mesh mesh)
          Populate the height data from the supplied mesh.
 void read(JmeImporter im)
           
 void write(JmeExporter ex)
           
 java.nio.IntBuffer writeIndexArray(java.nio.IntBuffer store)
           
 java.nio.FloatBuffer writeNormalArray(java.nio.FloatBuffer store, Vector3f scale)
          Creates a normal array from the normal data in this Geomap
 java.nio.FloatBuffer writeTexCoordArray(java.nio.FloatBuffer store, Vector2f offset, Vector2f scale)
           
 java.nio.FloatBuffer writeVertexArray(java.nio.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.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

GeoMap

public GeoMap()

GeoMap

public GeoMap(java.nio.FloatBuffer heightData,
              java.nio.ByteBuffer normalData,
              int width,
              int height,
              int maxval)

GeoMap

public GeoMap(int width,
              int height,
              int maxval)
メソッドの詳細

getHeightData

public java.nio.FloatBuffer getHeightData()

getNormalData

public java.nio.ByteBuffer getNormalData()

getMaximumValue

public int getMaximumValue()
戻り値:
The maximum possible value that getValue() can return. Mostly depends on the source data format (byte, short, int, etc).

getValue

public float getValue(int x,
                      int y)
Returns the height value for a given point. MUST return the same value as getHeight(y*getWidth()+x)

パラメータ:
x - the X coordinate
y - the Y coordinate
例外:
java.lang.NullPointerException - If isLoaded() is false

getValue

public 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

パラメータ:
i - The index
例外:
java.lang.NullPointerException - If isLoaded() is false

getNormal

public Vector3f getNormal(int x,
                          int y,
                          Vector3f store)
Returns the normal at a point If store is null, then a new vector is returned, otherwise, the result is stored in the provided vector and then returned from this method

パラメータ:
x - the X coordinate
y - the Y coordinate
store - A preallocated vector for storing the normal data, optional
例外:
java.lang.NullPointerException - If isLoaded() or hasNormalmap() is false

getNormal

public Vector3f getNormal(int i,
                          Vector3f store)
Returns the normal at an index If store is null, then a new vector is returned, otherwise, the result is stored in the provided vector and then returned from this method See getHeight(int) for information about index lookup

パラメータ:
i - the index
store - A preallocated vector for storing the normal data, optional
例外:
java.lang.NullPointerException - If isLoaded() or hasNormalmap() is false

getWidth

public int getWidth()
Returns the width of this Geomap


getHeight

public int getHeight()
Returns the height of this Geomap


copySubGeomap

public GeoMap copySubGeomap(int x,
                            int y,
                            int w,
                            int h)
Copies a section of this geomap as a new geomap


hasNormalmap

public boolean hasNormalmap()
Returns true if this Geomap has a normalmap associated with it


isLoaded

public 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


writeNormalArray

public java.nio.FloatBuffer writeNormalArray(java.nio.FloatBuffer store,
                                             Vector3f scale)
Creates a normal array from the normal data in this Geomap

パラメータ:
store - A preallocated FloatBuffer where to store the data (optional), size must be >= getWidth()*getHeight()*3
例外:
java.lang.NullPointerException - If isLoaded() or hasNormalmap() is false

writeVertexArray

public java.nio.FloatBuffer writeVertexArray(java.nio.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. For example, if scale is 10,1,10, then the greatest X value is getWidth()*10

パラメータ:
store - A preallocated FloatBuffer where to store the data (optional), size must be >= getWidth()*getHeight()*3
scale - Created vertexes are scaled by this vector
例外:
java.lang.NullPointerException - If isLoaded() is false

getUV

public Vector2f getUV(int x,
                      int y,
                      Vector2f store)

getUV

public Vector2f getUV(int i,
                      Vector2f store)

writeTexCoordArray

public java.nio.FloatBuffer writeTexCoordArray(java.nio.FloatBuffer store,
                                               Vector2f offset,
                                               Vector2f scale)

writeIndexArray

public java.nio.IntBuffer writeIndexArray(java.nio.IntBuffer store)

createMesh

public Mesh createMesh(Vector3f scale,
                       Vector2f tcScale,
                       boolean center)

populateHdataFromMesh

public void populateHdataFromMesh(Mesh mesh)
Populate the height data from the supplied mesh. The mesh's dimensions should be the same as width and height of this geomap


write

public void write(JmeExporter ex)
           throws java.io.IOException
定義:
インタフェース Savable 内の write
例外:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
定義:
インタフェース Savable 内の read
例外:
java.io.IOException