com.jme3.terrain.heightmap
クラス AbstractHeightMap

java.lang.Object
  上位を拡張 com.jme3.terrain.heightmap.AbstractHeightMap
すべての実装されたインタフェース:
HeightMap
直系の既知のサブクラス:
CombinerHeightMap, FaultHeightMap, FluidSimHeightMap, FractalHeightMapGrid.FloatBufferHeightMap, Grayscale16BitHeightMap, HillHeightMap, ImageBasedHeightMap, MidpointDisplacementHeightMap, ParticleDepositionHeightMap, RawHeightMap

public abstract class AbstractHeightMap
extends java.lang.Object
implements HeightMap

AbstractHeightMap provides a base implementation of height data for terrain rendering. The loading of the data is dependent on the subclass. The abstract implementation provides a means to retrieve the height data and to save it. It is the general contract that any subclass provide a means of editing required attributes and calling load again to recreate a heightfield with these new parameters.


フィールドの概要
static float NORMALIZE_RANGE
          The range used to normalize terrain
 
コンストラクタの概要
AbstractHeightMap()
           
 
メソッドの概要
 void erodeTerrain()
          erodeTerrain is a convenience method that applies the FIR filter to a given height map.
 float[] findMinMaxHeights()
          Find the minimum and maximum height values.
 void flatten(byte flattening)
          Flattens out the valleys.
 float[] getHeightMap()
          getHeightMap returns the entire grid of height data.
 float getInterpolatedHeight(float x, float z)
          getInterpolatedHeight returns the height of a point that does not fall directly on the height posts.
 float getScaledHeightAtPoint(int x, int z)
          getScaledHeightAtPoint returns the scaled value at the point provided.
 float[] getScaledHeightMap()
          Build a new array of height data with the scaled values.
 int getSize()
          getSize returns the size of one side the height map.
 float getTrueHeightAtPoint(int x, int z)
          getTrueHeightAtPoint returns the non-scaled value at the point provided.
 void normalizeTerrain(float value)
          normalizeTerrain takes the current terrain data and converts it to values between 0 and value.
 boolean save(java.lang.String filename)
          save will save the heightmap data into a new RAW file denoted by the supplied filename.
 void setHeightAtPoint(float height, int x, int z)
          setHeightAtPoint sets the height value for a given coordinate.
 void setHeightScale(float scale)
          setHeightScale sets the scale of the height values.
 void setMagnificationFilter(float filter)
          setFilter sets the erosion value for the filter.
 void setSize(int size)
          setSize sets the size of the terrain where the area is size x size.
 void smooth(float np)
          Smooth the terrain.
 void unloadHeightMap()
          unloadHeightMap clears the data of the height map.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
インタフェース com.jme3.terrain.heightmap.HeightMap から継承されたメソッド
load
 

フィールドの詳細

NORMALIZE_RANGE

public static float NORMALIZE_RANGE
The range used to normalize terrain

コンストラクタの詳細

AbstractHeightMap

public AbstractHeightMap()
メソッドの詳細

unloadHeightMap

public void unloadHeightMap()
unloadHeightMap clears the data of the height map. This insures it is ready for reloading.

定義:
インタフェース HeightMap 内の unloadHeightMap

setHeightScale

public void setHeightScale(float scale)
setHeightScale sets 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.

定義:
インタフェース HeightMap 内の setHeightScale
パラメータ:
scale - the scale to multiply height values by.

setHeightAtPoint

public void setHeightAtPoint(float height,
                             int x,
                             int z)
setHeightAtPoint sets the height value for a given coordinate. It is recommended that the height value be within the 0 - 255 range.

定義:
インタフェース HeightMap 内の setHeightAtPoint
パラメータ:
height - the new height for the coordinate.
x - the x (east/west) coordinate.
z - the z (north/south) coordinate.

setSize

public void setSize(int size)
             throws java.lang.Exception
setSize sets the size of the terrain where the area is size x size.

定義:
インタフェース HeightMap 内の setSize
パラメータ:
size - the new size of the terrain.
例外:
java.lang.Exception
JmeException - if the size is less than or equal to zero.

setMagnificationFilter

public void setMagnificationFilter(float filter)
                            throws java.lang.Exception
setFilter sets the erosion value for the filter. This value must be between 0 and 1, where 0.2 - 0.4 produces arguably the best results.

定義:
インタフェース HeightMap 内の setMagnificationFilter
パラメータ:
filter - the erosion value.
例外:
java.lang.Exception
JmeException - if filter is less than 0 or greater than 1.

getTrueHeightAtPoint

public float getTrueHeightAtPoint(int x,
                                  int z)
getTrueHeightAtPoint returns the non-scaled value at the point provided.

定義:
インタフェース HeightMap 内の getTrueHeightAtPoint
パラメータ:
x - the x (east/west) coordinate.
z - the z (north/south) coordinate.
戻り値:
the value at (x,z).

getScaledHeightAtPoint

public float getScaledHeightAtPoint(int x,
                                    int z)
getScaledHeightAtPoint returns the scaled value at the point provided.

定義:
インタフェース HeightMap 内の getScaledHeightAtPoint
パラメータ:
x - the x (east/west) coordinate.
z - the z (north/south) coordinate.
戻り値:
the scaled value at (x, z).

getInterpolatedHeight

public float getInterpolatedHeight(float x,
                                   float z)
getInterpolatedHeight returns the height of a point that does not fall directly on the height posts.

定義:
インタフェース HeightMap 内の getInterpolatedHeight
パラメータ:
x - the x coordinate of the point.
z - the y coordinate of the point.
戻り値:
the interpolated height at this point.

getHeightMap

public float[] getHeightMap()
getHeightMap returns the entire grid of height data.

定義:
インタフェース HeightMap 内の getHeightMap
戻り値:
the grid of height data.

getScaledHeightMap

public float[] getScaledHeightMap()
Build a new array of height data with the scaled values.

定義:
インタフェース HeightMap 内の getScaledHeightMap
戻り値:

getSize

public int getSize()
getSize returns the size of one side the height map. Where the area of the height map is size x size.

定義:
インタフェース HeightMap 内の getSize
戻り値:
the size of a single side.

save

public boolean save(java.lang.String filename)
             throws java.lang.Exception
save will save the heightmap data into a new RAW file denoted by the supplied filename.

パラメータ:
filename - the file name to save the current data as.
戻り値:
true if the save was successful, false otherwise.
例外:
java.lang.Exception
JmeException - if filename is null.

normalizeTerrain

public void normalizeTerrain(float value)
normalizeTerrain takes the current terrain data and converts it to values between 0 and value.

パラメータ:
value - the value to normalize to.

findMinMaxHeights

public float[] findMinMaxHeights()
Find the minimum and maximum height values.

戻り値:
a float array with two value: min height, max height

erodeTerrain

public void erodeTerrain()
erodeTerrain is a convenience method that applies the FIR filter to a given height map. This simulates water errosion.

関連項目:
setFilter

flatten

public void flatten(byte flattening)
Flattens out the valleys. The flatten algorithm makes the valleys more prominent while keeping the hills mostly intact. This effect is based on what happens when values below one are squared. The terrain will be normalized between 0 and 1 for this function to work.

パラメータ:
flattening - the power of flattening applied, 1 means none

smooth

public void smooth(float np)
Smooth the terrain. For each node, its 8 neighbors heights are averaged and will participate in the node new height by a factor np between 0 and 1

パラメータ:
np - The factor to what extend the neighbors average has an influence. Value of 0 will ignore neighbors (no smoothing) Value of 1 will ignore the node old height.