Class Terrain

All Implemented Interfaces:
Pickable, Hintable, Savable

public class Terrain extends Node implements Pickable
An implementation of geometry clipmapping
  • Constructor Details

  • 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 class Node
      Parameters:
      time - The time in seconds between the last two consecutive frames (time per frame). See ReadOnlyTimer.getTimePerFrame()
    • draw

      public void draw(Renderer r)
      Description copied from class: Node
      draw calls the onDraw method for each child maintained by this node.
      Overrides:
      draw in class Node
      Parameters:
      r - the renderer to draw to.
      See Also:
    • 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 class Node
      Parameters:
      recurse - true to recurse down the scenegraph tree
      See Also:
    • updateShader

      public void updateShader(Renderer r)
      Initialize/Update shaders
      Parameters:
      r - the renderer
    • reloadShader

      public void reloadShader()
    • applyToClips

      protected void applyToClips()
    • regenerate

      public void regenerate(Renderer renderer)
    • 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
      Throws:
      InstantiationException
      IllegalAccessException
      InvocationTargetException
      NoSuchMethodException
    • getTextureClipmap

      public TextureClipmap getTextureClipmap()
    • getTextureClipmaps

      public List<TextureClipmap> getTextureClipmaps()
    • getGeometryClipmapShader

      public GLSLShaderObjectsState getGeometryClipmapShader()
    • setGeometryClipmapShader

      public void setGeometryClipmapShader(GLSLShaderObjectsState shaderState)
    • getPicker

      public ClipmapTerrainPicker getPicker()
    • supportsBoundsIntersectionRecord

      public boolean supportsBoundsIntersectionRecord()
      Specified by:
      supportsBoundsIntersectionRecord in interface Pickable
      Returns:
      true if this pickable supports intersectsWorldBoundsWhere. False if this method will always return null.
    • supportsPrimitivesIntersectionRecord

      public boolean supportsPrimitivesIntersectionRecord()
      Specified by:
      supportsPrimitivesIntersectionRecord in interface Pickable
      Returns:
      true if this pickable supports intersectsPrimitivesWhere. False if this method will always return null.
    • intersectsWorldBound

      public boolean intersectsWorldBound(Ray3 ray)
      Specified by:
      intersectsWorldBound in interface Pickable
      Parameters:
      ray - a ray, in world coordinates.
      Returns:
      true if the given ray intersects our world bounding volume. false if it does not.
    • intersectsWorldBoundsWhere

      public IntersectionRecord intersectsWorldBoundsWhere(Ray3 ray)
      Specified by:
      intersectsWorldBoundsWhere in interface Pickable
      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

      public IntersectionRecord intersectsPrimitivesWhere(Ray3 ray)
      Specified by:
      intersectsPrimitivesWhere in interface Pickable
      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

      public List<ClipmapLevel> getClipmaps()
    • setVertexShader

      public void setVertexShader(URL vertexShader)
    • setPixelShader

      public void setPixelShader(URL pixelShader)
    • addTextureClipmap

      public void addTextureClipmap(TextureClipmap textureClipmap)
    • 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

      public TextureState getClipTextureState()
    • setNormalClipmap

      public void setNormalClipmap(TextureClipmap normalClipmap)
    • getNormalClipmap

      public TextureClipmap getNormalClipmap()
    • getNormalUnit

      public int getNormalUnit()
    • setNormalUnit

      public void setNormalUnit(int unit)