org.xith3d.terrain.legacy
Class Terrain

java.lang.Object
  extended by org.xith3d.terrain.legacy.Terrain
All Implemented Interfaces:
GroundHeightInterface

public class Terrain
extends java.lang.Object
implements GroundHeightInterface

A terrain class.


Constructor Summary
Terrain(int maxLevel, int bankLevel)
           
 
Method Summary
 void addData(TerrainSampleInterface sample)
           
 void addData(TerrainSampleInterface sample, float minDetail)
           
 void buildDatabase(java.lang.String filename, TerrainSampleInterface hm, TerrainSampleInterface lm, float minHighDetail, float minLowDetail)
           
 void buildDatabase(TerrainSampleInterface hm, float minDetail)
          Builds the terrain one bank at a time.
 void compressBanks()
          Rebuilds the banks by getting rid of the deleted nodes and shifting all the nodes towards the front of the bank.
 int CountNodes()
           
 int CountNodes(TerrainSquareHandle sq)
          Debugging function.
 void cullStaticData(float threshold, int maxLevelToCull)
           
 float getCurY(float x, float z)
           
 int getDepth()
           
 int getWidth()
           
 float getY(float x, float z)
          This returns the Y value for a given X and Z world coordinate
 void load(java.lang.String filename)
           
 void open(java.lang.String filename)
           
 void printBankUsage()
           
 float recomputeError()
           
static void releaseCorner(TerrainCornerData o)
           
 int render(TerrainRenderInterface r)
           
 void Update(TerrainSquareHandle sq, TerrainCornerData cd, float[] ViewerLocation, float Detail)
          Refresh the vertex enabled states in the tree, according to the location of the viewer.
 void update(org.openmali.vecmath2.Tuple3f loc, float detail)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Terrain

public Terrain(int maxLevel,
               int bankLevel)
Method Detail

getWidth

public int getWidth()

getDepth

public int getDepth()

load

public void load(java.lang.String filename)
          throws java.io.IOException
Throws:
java.io.IOException

open

public void open(java.lang.String filename)
Parameters:
filename -

compressBanks

public void compressBanks()
Rebuilds the banks by getting rid of the deleted nodes and shifting all the nodes towards the front of the bank. Very useful after a call to CullStatic


printBankUsage

public void printBankUsage()

releaseCorner

public static void releaseCorner(TerrainCornerData o)

CountNodes

public int CountNodes()

CountNodes

public int CountNodes(TerrainSquareHandle sq)
Debugging function. Counts the number of nodes in this subtree.

Parameters:
sq -
Returns:
the number of nodes

getY

public float getY(float x,
                  float z)
Description copied from interface: GroundHeightInterface
This returns the Y value for a given X and Z world coordinate

Specified by:
getY in interface GroundHeightInterface

getCurY

public float getCurY(float x,
                     float z)

recomputeError

public float recomputeError()

cullStaticData

public void cullStaticData(float threshold,
                           int maxLevelToCull)

update

public void update(org.openmali.vecmath2.Tuple3f loc,
                   float detail)

Update

public void Update(TerrainSquareHandle sq,
                   TerrainCornerData cd,
                   float[] ViewerLocation,
                   float Detail)
Refresh the vertex enabled states in the tree, according to the location of the viewer. May force creation or deletion of qsquares in areas which need to be interpolated.


addData

public void addData(TerrainSampleInterface sample)

addData

public void addData(TerrainSampleInterface sample,
                    float minDetail)

render

public int render(TerrainRenderInterface r)

buildDatabase

public void buildDatabase(TerrainSampleInterface hm,
                          float minDetail)
Builds the terrain one bank at a time. Each bank is compressed before moving on to the next bank.

Parameters:
hm -
minDetail -

buildDatabase

public void buildDatabase(java.lang.String filename,
                          TerrainSampleInterface hm,
                          TerrainSampleInterface lm,
                          float minHighDetail,
                          float minLowDetail)
                   throws java.io.IOException
Parameters:
filename -
hm -
lm -
Throws:
java.io.IOException