public class TerrainLodControl extends AbstractControl
Modifier and Type | Class and Description |
---|---|
protected class |
TerrainLodControl.UpdateLOD
Calculates the LOD of all child terrain patches.
|
Modifier and Type | Field and Description |
---|---|
protected Camera |
camera
The camera from render view port.
|
protected SafeArrayList<Vector3f> |
cameraLocations |
protected SafeArrayList<Camera> |
cameras
The list of cameras for when terrain supports multiple cameras (ie split screen)
|
protected boolean |
forceUpdate |
protected boolean |
hasResetLod |
protected java.util.concurrent.Future<java.util.HashMap<java.lang.String,UpdatedTerrainPatch>> |
indexer |
protected SafeArrayList<Vector3f> |
lastCameraLocations |
protected java.util.concurrent.atomic.AtomicBoolean |
lodCalcRunning |
protected LodCalculator |
lodCalculator |
protected Vector3f |
previousCameraLocation
The previous location of
camera . |
protected Terrain |
terrain |
protected boolean |
useRenderCamera
The flag of using a camera from render viewport instead cameras from
cameras . |
enabled, spatial
Constructor and Description |
---|
TerrainLodControl() |
TerrainLodControl(Camera camera) |
TerrainLodControl(Terrain terrain) |
TerrainLodControl(Terrain terrain,
Camera camera) |
TerrainLodControl(Terrain terrain,
java.util.List<Camera> cameras)
Only uses the first camera right now.
|
Modifier and Type | Method and Description |
---|---|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Implemented to perform deep cloning for this object, resolving
local cloned references using the specified cloner.
|
protected void |
controlRender(RenderManager rm,
ViewPort vp)
To be implemented in subclass.
|
protected void |
controlUpdate(float tpf)
To be implemented in subclass.
|
protected TerrainLodControl.UpdateLOD |
createLodUpdateTask(java.util.List<Vector3f> locations,
LodCalculator lodCalculator) |
void |
detachAndCleanUpControl()
Call this when you remove the terrain or this control from the scene.
|
void |
forceUpdate()
Force the LOD to update instantly, does not wait for the camera to move.
|
LodCalculator |
getLodCalculator() |
boolean |
isUseRenderCamera() |
java.lang.Object |
jmeClone()
Performs a regular shallow clone of the object.
|
protected DistanceLodCalculator |
makeLodCalculator() |
protected void |
prepareTerrain() |
void |
read(JmeImporter im) |
void |
setCamera(Camera camera) |
void |
setCameras(java.util.List<Camera> cameras) |
void |
setEnabled(boolean enabled) |
void |
setLodCalculator(LodCalculator lodCalculator) |
void |
setSpatial(Spatial spatial) |
void |
setTerrain(Terrain terrain) |
void |
setUseRenderCamera(boolean useRenderCamera) |
protected void |
updateLOD(LodCalculator lodCalculator) |
protected void |
updateLOD(SafeArrayList<Vector3f> locations,
LodCalculator lodCalculator) |
protected boolean |
updateLodOffCount(LodCalculator lodCalculator) |
void |
write(JmeExporter ex) |
cloneForSpatial, getSpatial, isEnabled, render, update
protected SafeArrayList<Camera> cameras
protected SafeArrayList<Vector3f> cameraLocations
protected SafeArrayList<Vector3f> lastCameraLocations
protected java.util.concurrent.atomic.AtomicBoolean lodCalcRunning
protected Camera camera
protected Terrain terrain
protected LodCalculator lodCalculator
protected java.util.concurrent.Future<java.util.HashMap<java.lang.String,UpdatedTerrainPatch>> indexer
protected boolean useRenderCamera
cameras
.protected boolean forceUpdate
protected boolean hasResetLod
public TerrainLodControl()
public TerrainLodControl(Terrain terrain)
public TerrainLodControl(Camera camera)
protected DistanceLodCalculator makeLodCalculator()
public void setUseRenderCamera(boolean useRenderCamera)
useRenderCamera
- true if need to use a camera from render view port.public boolean isUseRenderCamera()
protected void controlRender(RenderManager rm, ViewPort vp)
AbstractControl
controlRender
in class AbstractControl
protected void controlUpdate(float tpf)
AbstractControl
controlUpdate
in class AbstractControl
public void detachAndCleanUpControl()
protected void updateLOD(LodCalculator lodCalculator)
protected void updateLOD(SafeArrayList<Vector3f> locations, LodCalculator lodCalculator)
protected boolean updateLodOffCount(LodCalculator lodCalculator)
public void forceUpdate()
protected void prepareTerrain()
protected TerrainLodControl.UpdateLOD createLodUpdateTask(java.util.List<Vector3f> locations, LodCalculator lodCalculator)
public java.lang.Object jmeClone()
JmeCloneable
This method is separate from the regular clone() method so that objects might still maintain their own regular java clone() semantics (perhaps even using Cloner for those methods). However, because Java's clone() has specific features in the sense of Object's clone() implementation, it's usually best to have some path for subclasses to bypass the public clone() method that might be cloning fields and instead get at the superclass protected clone() methods. For example, through super.jmeClone() or another protected clone method that some base class eventually calls super.clone() in.
jmeClone
in interface JmeCloneable
jmeClone
in class AbstractControl
public void cloneFields(Cloner cloner, java.lang.Object original)
JmeCloneable
Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.
cloneFields
in interface JmeCloneable
cloneFields
in class AbstractControl
cloner
- The cloner that is performing the cloning operation. The
cloneFields method can call back into the cloner to make
clones of its subordinate fields.original
- The original object from which this object was cloned.
This is provided for the very rare case that this object needs
to refer to its original for some reason. In general, all of
the relevant values should have been transferred during the
shallow clone and this object need merely clone what it wants.public void setCamera(Camera camera)
public void setCameras(java.util.List<Camera> cameras)
public void setSpatial(Spatial spatial)
setSpatial
in interface Control
setSpatial
in class AbstractControl
spatial
- the spatial to be controlled. This should not be called
from user code.public void setTerrain(Terrain terrain)
public LodCalculator getLodCalculator()
public void setLodCalculator(LodCalculator lodCalculator)
public void setEnabled(boolean enabled)
setEnabled
in class AbstractControl
public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
write
in class AbstractControl
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
read
in class AbstractControl
java.io.IOException