|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.scene.Spatial
com.jme.scene.Geometry
com.jme.scene.TriMesh
com.jme.scene.lod.ClodMesh
com.jme.scene.lod.AreaClodMesh
com.jme.terrain.TerrainBlock
TerrainBlock defines the lowest level of the terrain system.
TerrainBlock is the actual part of the terrain system that
renders to the screen. The terrain is built from a heightmap defined by a one
dimenensional int array. The step scale is used to define the amount of units
each block line will extend. Clod can be used to allow for level of detail
control.
By directly creating a TerrainBlock yourself, you can generate
a brute force terrain. This is many times sufficient for small terrains on
modern hardware. If terrain is to be large, it is recommended that you make
use of the TerrainPage class.
| Field Summary |
| Fields inherited from class com.jme.scene.TriMesh |
indices, triangleQuantity |
| Fields inherited from class com.jme.scene.Geometry |
bound, color, colorBuf, normal, normBuf, texBuf, texture, vertBuf, vertex, vertQuantity |
| Fields inherited from class com.jme.scene.Spatial |
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
| Constructor Summary | |
|
TerrainBlock()
Empty Constructor to be used internally only. |
|
TerrainBlock(java.lang.String name)
For internal use only. |
|
TerrainBlock(java.lang.String name,
int size,
Vector3f stepScale,
int[] heightMap,
Vector3f origin,
boolean clod)
Constructor instantiates a new TerrainBlock object. |
protected |
TerrainBlock(java.lang.String name,
int size,
Vector3f stepScale,
int[] heightMap,
Vector3f origin,
boolean clod,
int totalSize,
Vector2f offset,
int offsetAmount)
Constructor instantiates a new TerrainBlock object. |
| Method Summary | |
int |
chooseTargetRecord(Renderer r)
chooseTargetRecord determines which level of detail to
use. |
float |
getHeight(float x,
float z)
getHeight returns the height of an arbitrary point on the
terrain. |
float |
getHeight(Vector2f position)
getHeight returns the height of an arbitrary point on the
terrain. |
float |
getHeight(Vector3f position)
getHeight returns the height of an arbitrary point on the
terrain. |
int[] |
getHeightMap()
Returns the height map this terrain block is using. |
Vector2f |
getOffset()
Returns the current offset amount. |
int |
getOffsetAmount()
Returns the offset amount this terrain block uses for textures. |
int |
getSize()
Returns the size of this terrain block. |
Vector3f |
getStepScale()
Returns the step scale that stretches the height map. |
int |
getTotalSize()
Returns the total size of the terrain. |
boolean |
isUseClod()
Returns true if this TerrainBlock was created as a clod. |
void |
setDetailTexture(int unit,
int repeat)
setDetailTexture sets the detail texture unit's repeat
value. |
void |
setHeightMap(int[] heightMap)
Sets the terrain's height map. |
void |
setOffset(Vector2f offset)
Sets the value for the current offset amount to use when building texture coordinates. |
void |
setOffsetAmount(int offsetAmount)
Sets the offset of this terrain texture map. |
void |
setSize(int size)
Sets the size of this terrain block. |
void |
setStepScale(Vector3f stepScale)
Sets the step scale of this terrain block's height map. |
void |
setTotalSize(int totalSize)
Sets the total size of the terrain . |
void |
setUseClod(boolean useClod)
If true, the terrain is created as a ClodMesh. |
| Methods inherited from class com.jme.scene.lod.AreaClodMesh |
getDistanceTolerance, getTrisPerPixel, setDistanceTolerance, setTargetRecord, setTrisPerPixel |
| Methods inherited from class com.jme.scene.lod.ClodMesh |
create, draw, getRecordQuantity, getRecords, getTargetRecord, setRecords |
| Methods inherited from class com.jme.scene.TriMesh |
clearBuffers, drawBounds, findCollisions, findTriangleCollision, findTrianglePick, findWorldRotMat, getIndexAsBuffer, getIndices, getMeshAsTriangles, getTriangle, getTriangle, getTriangleQuantity, hasCollision, hasTriangleCollision, putClone, reconstruct, setIndexBuffer, setIndices, updateCollisionTree, updateIndexBuffer |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TerrainBlock()
public TerrainBlock(java.lang.String name)
name - The name.AreaClodMesh.AreaClodMesh(java.lang.String)
public TerrainBlock(java.lang.String name,
int size,
Vector3f stepScale,
int[] heightMap,
Vector3f origin,
boolean clod)
TerrainBlock object. The
parameters and heightmap data are then processed to generate a
TriMesh object for renderering.
name - the name of the terrain block.size - the size of the heightmap.stepScale - the scale for the axes.heightMap - the height data.origin - the origin offset of the block.clod - true will use level of detail, false will not.
protected TerrainBlock(java.lang.String name,
int size,
Vector3f stepScale,
int[] heightMap,
Vector3f origin,
boolean clod,
int totalSize,
Vector2f offset,
int offsetAmount)
TerrainBlock object. The
parameters and heightmap data are then processed to generate a
TriMesh object for renderering.
name - the name of the terrain block.size - the size of the block.stepScale - the scale for the axes.heightMap - the height data.origin - the origin offset of the block.clod - true will use level of detail, false will not.totalSize - the total size of the terrain. (Higher if the block is part of
a TerrainPage tree.offset - the offset for texture coordinates.offsetAmount - the total offset amount. Used for texture coordinates.| Method Detail |
public int chooseTargetRecord(Renderer r)
chooseTargetRecord determines which level of detail to
use. If CLOD is not used, the index 0 is always returned.
chooseTargetRecord in class AreaClodMeshr - the renderer to use for determining the LOD record.
public void setDetailTexture(int unit,
int repeat)
setDetailTexture sets the detail texture unit's repeat
value.
unit - intrepeat - intpublic float getHeight(Vector2f position)
getHeight returns the height of an arbitrary point on the
terrain. If the point is between height point values, the height is
linearly interpolated. This provides smooth height calculations. If the
point provided is not within the bounds of the height map, the NaN float
value is returned (Float.NaN).
position - the vector representing the height location to check.
public float getHeight(Vector3f position)
getHeight returns the height of an arbitrary point on the
terrain. If the point is between height point values, the height is
linearly interpolated. This provides smooth height calculations. If the
point provided is not within the bounds of the height map, the NaN float
value is returned (Float.NaN).
position - the vector representing the height location to check. Only the
x and z values are used.
public float getHeight(float x,
float z)
getHeight returns the height of an arbitrary point on the
terrain. If the point is between height point values, the height is
linearly interpolated. This provides smooth height calculations. If the
point provided is not within the bounds of the height map, the NaN float
value is returned (Float.NaN).
x - the x coordinate to check.z - the z coordinate to check.
public int[] getHeightMap()
public int getOffsetAmount()
public Vector3f getStepScale()
public int getTotalSize()
public int getSize()
public void setUseClod(boolean useClod)
useClod - public Vector2f getOffset()
public void setOffset(Vector2f offset)
offset - The new texture offset.public boolean isUseClod()
public void setSize(int size)
size - The new size.public void setTotalSize(int totalSize)
totalSize - The new total size.public void setStepScale(Vector3f stepScale)
stepScale - The new step scale.public void setOffsetAmount(int offsetAmount)
offsetAmount - The new texture offset.public void setHeightMap(int[] heightMap)
heightMap - The new height map.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||