com.jme3.terrain.geomipmap
Class TerrainLodControl
java.lang.Object
com.jme3.scene.control.AbstractControl
com.jme3.terrain.geomipmap.TerrainLodControl
- All Implemented Interfaces:
- Savable, Control
- Direct Known Subclasses:
- MultiTerrainLodControl, TerrainGridLodControl
public class TerrainLodControl
- extends AbstractControl
Tells the terrain to update its Level of Detail.
It needs the cameras to do this, and there could possibly
be several cameras in the scene, so it accepts a list
of cameras.
NOTE: right now it just uses the first camera passed in,
in the future it will use all of them to determine what
LOD to set.
This control serializes, but it does not save the Camera reference.
This camera reference has to be manually added in when you load the
terrain to the scene!
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
cameras
protected java.util.List<Camera> cameras
lodCalculator
protected LodCalculator lodCalculator
lastCameraLocations
protected java.util.List<Vector3f> lastCameraLocations
executor
protected java.util.concurrent.ExecutorService executor
indexer
protected java.util.concurrent.Future<java.util.HashMap<java.lang.String,UpdatedTerrainPatch>> indexer
TerrainLodControl
public TerrainLodControl()
TerrainLodControl
public TerrainLodControl(Terrain terrain,
Camera camera)
TerrainLodControl
public TerrainLodControl(Terrain terrain,
java.util.List<Camera> cameras)
- Only uses the first camera right now.
- Parameters:
terrain
- to act upon (must be a Spatial)cameras
- one or more cameras to reference for LOD calc
controlRender
protected void controlRender(RenderManager rm,
ViewPort vp)
- Description copied from class:
AbstractControl
- To be implemented in subclass.
- Specified by:
controlRender
in class AbstractControl
createExecutorService
protected java.util.concurrent.ExecutorService createExecutorService()
controlUpdate
protected void controlUpdate(float tpf)
- Description copied from class:
AbstractControl
- To be implemented in subclass.
- Specified by:
controlUpdate
in class AbstractControl
updateLOD
protected void updateLOD(java.util.List<Vector3f> locations,
LodCalculator lodCalculator)
prepareTerrain
protected void prepareTerrain()
getLodThread
protected TerrainLodControl.UpdateLOD getLodThread(java.util.List<Vector3f> locations,
LodCalculator lodCalculator)
isLodCalcRunning
protected boolean isLodCalcRunning()
setLodCalcRunning
protected void setLodCalcRunning(boolean running)
cloneForSpatial
public Control cloneForSpatial(Spatial spatial)
- Description copied from interface:
Control
- Creates a clone of the Control, the given Spatial is the cloned
version of the spatial to which this control is attached to.
- Returns:
- A clone of this control for the spatial
setCamera
public void setCamera(Camera camera)
setCameras
public void setCameras(java.util.List<Camera> cameras)
setSpatial
public void setSpatial(Spatial spatial)
- Specified by:
setSpatial
in interface Control
- Overrides:
setSpatial
in class AbstractControl
- Parameters:
spatial
- the spatial to be controlled. This should not be called
from user code.
setTerrain
public void setTerrain(Terrain terrain)
getLodCalculator
public LodCalculator getLodCalculator()
setLodCalculator
public void setLodCalculator(LodCalculator lodCalculator)
setEnabled
public void setEnabled(boolean enabled)
- Overrides:
setEnabled
in class AbstractControl
write
public void write(JmeExporter ex)
throws java.io.IOException
- Specified by:
write
in interface Savable
- Overrides:
write
in class AbstractControl
- Throws:
java.io.IOException
read
public void read(JmeImporter im)
throws java.io.IOException
- Specified by:
read
in interface Savable
- Overrides:
read
in class AbstractControl
- Throws:
java.io.IOException