Class Terrain
java.lang.Object
com.ardor3d.scenegraph.Spatial
com.ardor3d.scenegraph.Node
com.ardor3d.extension.terrain.client.Terrain
An implementation of geometry clipmapping
-
Field Summary
Fields inherited from class com.ardor3d.scenegraph.Spatial
_controllers, _delegateMap, _dirtyMark, _frustumIntersects, _listener, _localTransform, _name, _parent, _queueDistance, _renderStateList, _sceneHints, _userData, _worldBound, _worldTransform, ON_DIRTY_ATTACHED, ON_DIRTY_BOUNDING, ON_DIRTY_RENDERSTATE, ON_DIRTY_TRANSFORM, ON_DIRTY_TRANSFORM_ONLY
-
Constructor Summary
ConstructorDescriptionTerrain
(Camera camera, List<TerrainCache> cacheList, int clipSideSize, TerrainConfiguration terrainConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTextureClipmap
(TextureClipmap textureClipmap) protected void
void
draw
calls the onDraw method for each child maintained by this node.float
getHeightAt
(double x, double z) int
int
int
int
boolean
intersectsWorldBound
(Ray3 ray) void
makePickable
(Class<? extends AbstractBresenhamTracer> tracerClass, int maxChecks, Vector3 initialSpacing) void
regenerate
(Renderer renderer) void
void
setCullingEnabled
(boolean cullingEnabled) void
setGeometryClipmapShader
(GLSLShaderObjectsState shaderState) void
setHeightRange
(float heightRangeMin, float heightRangeMax) void
setMinVisibleLevel
(int level) set the minimum (highest resolution) clipmap level visiblevoid
setNormalClipmap
(TextureClipmap normalClipmap) void
setNormalUnit
(int unit) void
setPixelShader
(URL pixelShader) void
setTextureMinVisibleLevel
(int level) convenience function to set minimum (highest resolution) texture clipmap level on all TextureClipmaps held by this terrainvoid
setVertexShader
(URL vertexShader) void
setVisibleLevels
(int visibleLevels) void
shutdown()
boolean
boolean
protected void
updateChildren
(double time) Override to allow objects like Node to update their children.void
Initialize/Update shadersvoid
updateWorldBound
(boolean recurse) updateWorldBound
merges the bounds of all the children maintained by this node.Methods inherited from class com.ardor3d.scenegraph.Node
acceptVisitor, attachChild, attachChildAt, detachAllChildren, detachChild, detachChildAt, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getClassTag, getNumberOfChildren, hasChild, makeCopy, makeInstanced, propagateDirtyDown, read, sortLights, swapChildren, updateWorldRenderStates, updateWorldTransform, write
Methods inherited from class com.ardor3d.scenegraph.Spatial
addController, addTranslation, addTranslation, applyWorldRenderStates, clearControllers, clearDirty, clearDirty, clearRenderState, getController, getControllerCount, getControllers, getCurrentRenderDelegate, getLastFrustumIntersection, getListener, getLocalLastFrustumIntersection, getLocalRenderState, getLocalRenderStates, getName, getParent, getParentHintable, getRenderDelegate, getRotation, getScale, getSceneHints, getTransform, getTranslation, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, isDirty, localToWorld, markDirty, markDirty, onDraw, propagateBoundToRoot, propagateDirtyUp, propagateStatesFromRoot, propageEventUp, removeController, removeController, removeFromParent, setLastFrustumIntersection, setListener, setName, setParent, setRenderDelegate, setRenderState, setRotation, setRotation, setScale, setScale, setScale, setTransform, setTranslation, setTranslation, setUserData, setWorldRotation, setWorldRotation, setWorldScale, setWorldScale, setWorldScale, setWorldTransform, setWorldTranslation, setWorldTranslation, toString, updateControllers, updateGeometricState, updateGeometricState, updateWorldRenderStates, worldToLocal
-
Constructor Details
-
Terrain
public Terrain(Camera camera, List<TerrainCache> cacheList, int clipSideSize, TerrainConfiguration terrainConfiguration)
-
-
Method Details
-
updateChildren
protected void updateChildren(double time) Description copied from class:Spatial
Override to allow objects like Node to update their children.- Overrides:
updateChildren
in classNode
- Parameters:
time
- The time in seconds between the last two consecutive frames (time per frame). SeeReadOnlyTimer.getTimePerFrame()
-
draw
Description copied from class:Node
draw
calls the onDraw method for each child maintained by this node. -
updateWorldBound
public void updateWorldBound(boolean recurse) Description copied from class:Node
updateWorldBound
merges the bounds of all the children maintained by this node. This will allow for faster culling operations.- Overrides:
updateWorldBound
in classNode
- Parameters:
recurse
- true to recurse down the scenegraph tree- See Also:
-
updateShader
Initialize/Update shaders- Parameters:
r
- the renderer
-
reloadShader
public void reloadShader() -
applyToClips
protected void applyToClips() -
regenerate
-
getVisibleLevels
public int getVisibleLevels()- Returns:
- the visibleLevels
-
setVisibleLevels
public void setVisibleLevels(int visibleLevels) - Parameters:
visibleLevels
- the visibleLevels to set
-
setHeightRange
public void setHeightRange(float heightRangeMin, float heightRangeMax) -
setCullingEnabled
public void setCullingEnabled(boolean cullingEnabled) -
makePickable
public void makePickable(Class<? extends AbstractBresenhamTracer> tracerClass, int maxChecks, Vector3 initialSpacing) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException -
getTextureClipmap
-
getTextureClipmaps
-
getGeometryClipmapShader
-
setGeometryClipmapShader
-
getPicker
-
supportsBoundsIntersectionRecord
public boolean supportsBoundsIntersectionRecord()- Specified by:
supportsBoundsIntersectionRecord
in interfacePickable
- Returns:
- true if this pickable supports intersectsWorldBoundsWhere. False if this method will always return null.
-
supportsPrimitivesIntersectionRecord
public boolean supportsPrimitivesIntersectionRecord()- Specified by:
supportsPrimitivesIntersectionRecord
in interfacePickable
- Returns:
- true if this pickable supports intersectsPrimitivesWhere. False if this method will always return null.
-
intersectsWorldBound
- Specified by:
intersectsWorldBound
in interfacePickable
- Parameters:
ray
- a ray, in world coordinates.- Returns:
- true if the given ray intersects our world bounding volume. false if it does not.
-
intersectsWorldBoundsWhere
- Specified by:
intersectsWorldBoundsWhere
in interfacePickable
- Parameters:
ray
- a ray, in world coordinates.- Returns:
- an intersection record containing information about where the ray intersected our bounding volume, or null if it does not.
-
intersectsPrimitivesWhere
- Specified by:
intersectsPrimitivesWhere
in interfacePickable
- Parameters:
ray
- a ray, in world coordinates.- Returns:
- an intersection record containing information about where the ray intersected our primitives, or null if it does not.
-
getClipmaps
-
setVertexShader
-
setPixelShader
-
addTextureClipmap
-
setMinVisibleLevel
public void setMinVisibleLevel(int level) set the minimum (highest resolution) clipmap level visible- Parameters:
level
- clamped to valid range
-
getMinVisibleLevel
public int getMinVisibleLevel() -
setTextureMinVisibleLevel
public void setTextureMinVisibleLevel(int level) convenience function to set minimum (highest resolution) texture clipmap level on all TextureClipmaps held by this terrain- Parameters:
level
- the minimum visible level to set
-
getTextureMinVisibleLevel
public int getTextureMinVisibleLevel() -
getHeightAt
public float getHeightAt(double x, double z) -
shutdown
public void shutdown() -
getClipTextureState
-
setNormalClipmap
-
getNormalClipmap
-
getNormalUnit
public int getNormalUnit() -
setNormalUnit
public void setNormalUnit(int unit)
-