com.jme3.terrain
インタフェース Terrain

既知の実装クラスの一覧:
TerrainGrid, TerrainQuad

public interface Terrain

Terrain can be one or many meshes comprising of a, probably large, piece of land. Terrain is Y-up in the grid axis, meaning gravity acts in the -Y direction. Level of Detail (LOD) is supported and expected as terrains can get very large. LOD can also be disabled if you so desire, however some terrain implementations can choose to ignore useLOD(boolean). Terrain implementations should extend Node, or at least Spatial.


メソッドの概要
 void adjustHeight(java.util.List<Vector2f> xz, java.util.List<java.lang.Float> height)
          Raise/lower the height at many points.
 void adjustHeight(Vector2f xzCoordinate, float delta)
          Raise/lower the height in one call (instead of getHeight then setHeight).
 void generateEntropy(ProgressMonitor monitor)
          Pre-calculate entropy values.
 float getHeight(Vector2f xz)
          Get the real-world height of the terrain at the specified X-Z coorindate.
 float[] getHeightMap()
          Get the heightmap of the entire terrain.
 float getHeightmapHeight(Vector2f xz)
          Get the heightmap height at the specified X-Z coordinate.
 Material getMaterial()
          Returns the material that this terrain uses.
 int getMaxLod()
          This is calculated by the specific LOD algorithm.
 int getTerrainSize()
          Used for painting to get the number of vertices along the edge of the terrain.
 float getTextureCoordinateScale()
          Get the scale of the texture coordinates.
 void setHeight(java.util.List<Vector2f> xz, java.util.List<java.lang.Float> height)
          Set the height at many points.
 void setHeight(Vector2f xzCoordinate, float height)
          Set the height at the specified X-Z coordinate.
 void setLocked(boolean locked)
          Lock or unlock the meshes of this terrain.
 void update(java.util.List<Vector3f> location)
          Called by an LodControl.
 

メソッドの詳細

getHeight

float getHeight(Vector2f xz)
Get the real-world height of the terrain at the specified X-Z coorindate.

パラメータ:
xz - the X-Z world coordinate
戻り値:
the height at the given point

getHeightmapHeight

float getHeightmapHeight(Vector2f xz)
Get the heightmap height at the specified X-Z coordinate. This does not count scaling and snaps the XZ coordinate to the nearest (rounded) heightmap grid point.

パラメータ:
xz - world coordinate
戻り値:
the height, unscaled and uninterpolated

setHeight

void setHeight(Vector2f xzCoordinate,
               float height)
Set the height at the specified X-Z coordinate. To set the height of the terrain and see it, you will have to unlock the terrain meshes by calling terrain.setLocked(false) before you call setHeight().

パラメータ:
xzCoordinate - coordinate to set the height
height - that will be set at the coordinate

setHeight

void setHeight(java.util.List<Vector2f> xz,
               java.util.List<java.lang.Float> height)
Set the height at many points. The two lists must be the same size. Each xz coordinate entry matches to a height entry, 1 for 1. So the first coordinate matches to the first height value, the last to the last etc.

パラメータ:
xz - a list of coordinates where the hight will be set
height - the heights that match the xz coordinates

adjustHeight

void adjustHeight(Vector2f xzCoordinate,
                  float delta)
Raise/lower the height in one call (instead of getHeight then setHeight).

パラメータ:
xzCoordinate - world coordinate to adjust the terrain height
delta - +- value to adjust the height by

adjustHeight

void adjustHeight(java.util.List<Vector2f> xz,
                  java.util.List<java.lang.Float> height)
Raise/lower the height at many points. The two lists must be the same size. Each xz coordinate entry matches to a height entry, 1 for 1. So the first coordinate matches to the first height value, the last to the last etc.

パラメータ:
xz - a list of coordinates where the hight will be adjusted
height - +- value to adjust the height by, that matches the xz coordinates

getHeightMap

float[] getHeightMap()
Get the heightmap of the entire terrain. This can return null if that terrain object does not store the height data. Infinite or "paged" terrains will not be able to support this, so use with caution.


getMaxLod

int getMaxLod()
This is calculated by the specific LOD algorithm. A value of one means that the terrain is showing full detail. The higher the value, the more the terrain has been generalized and the less detailed it will be.


update

void update(java.util.List<Vector3f> location)
Called by an LodControl. Calculates the level of detail of the terrain and adjusts its geometry. This is where the Terrain's LOD algorithm will change the detail of the terrain based on how far away this position is from the particular terrain patch.

パラメータ:
location: - the Camera's location. A list of one camera location is normal if you just have one camera in your scene.

setLocked

void setLocked(boolean locked)
Lock or unlock the meshes of this terrain. Locked meshes are un-editable but have better performance. This should call the underlying getMesh().setStatic()/setDynamic() methods.

パラメータ:
locked - or unlocked

generateEntropy

void generateEntropy(ProgressMonitor monitor)
Pre-calculate entropy values. Some terrain systems support entropy calculations to determine LOD changes. Often these entropy calculations are expensive and can be cached ahead of time. Use this method to do that.


getMaterial

Material getMaterial()
Returns the material that this terrain uses. This does not necessarily have to guarantee the material return is the only material used in the whole terrain structure.


getTerrainSize

int getTerrainSize()
Used for painting to get the number of vertices along the edge of the terrain. This is an un-scaled size, and should represent the vertex count (ie. the texture coord count) along an edge of a square terrain. In the standard TerrainQuad default implementation, this will return the "totalSize" of the terrain (512 or so).


getTextureCoordinateScale

float getTextureCoordinateScale()
Get the scale of the texture coordinates. Normally if the texture is laid on the terrain and not scaled so that the texture does not repeat, then each texture coordinate (on a vertex) will be 1/(terrain size). That is: the coverage between each consecutive texture coordinate will be a percentage of the total terrain size. So if the terrain is 512 vertexes wide, then each texture coord will cover 1/512 (or 0.00195) percent of the texture. This is used for converting between tri-planar texture scales and regular texture scales.