Package com.jme3.scene.control
Class LodControl
java.lang.Object
com.jme3.scene.control.AbstractControl
com.jme3.scene.control.LodControl
- All Implemented Interfaces:
- Savable,- Control,- JmeCloneable,- Cloneable
Determines what Level of Detail a spatial should be, based on how many pixels
 on the screen the spatial is taking up. The more pixels covered, the more
 detailed the spatial should be. It calculates the area of the screen that the
 spatial covers by using its bounding box. When initializing, it will ask the
 spatial for how many triangles it has for each LOD. It then uses that, along
 with the trisPerPixel value to determine what LOD it should be at. It
 requires the camera to do this. The controlRender method is called each frame
 and will update the spatial's LOD if the camera has moved by a specified
 amount.
- 
Field SummaryFields inherited from class com.jme3.scene.control.AbstractControlenabled, spatial
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcontrolRender(RenderManager rm, ViewPort vp) To be implemented in subclass.protected voidcontrolUpdate(float tpf) To be implemented in subclass.floatReturns the distance tolerance for changing LOD.floatReturns the triangles per pixel value.jmeClone()Performs a regular shallow clone of the object.voidread(JmeImporter im) voidsetDistTolerance(float distTolerance) Specifies the distance tolerance for changing the LOD level on the geometry.voidsetSpatial(Spatial spatial) voidsetTrisPerPixel(float trisPerPixel) Sets the triangles per pixel value.voidwrite(JmeExporter ex) Methods inherited from class com.jme3.scene.control.AbstractControlcloneFields, cloneForSpatial, getSpatial, isEnabled, render, setEnabled, updateMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jme3.util.clone.JmeCloneablecloneFields
- 
Constructor Details- 
LodControlpublic LodControl()Creates a newLodControl.
 
- 
- 
Method Details- 
getDistTolerancepublic float getDistTolerance()Returns the distance tolerance for changing LOD.- Returns:
- the distance tolerance for changing LOD.
- See Also:
 
- 
setDistTolerancepublic void setDistTolerance(float distTolerance) Specifies the distance tolerance for changing the LOD level on the geometry. The LOD level will only get changed if the geometry has moved this distance beyond the current LOD level.- Parameters:
- distTolerance- distance tolerance for changing LOD
 
- 
getTrisPerPixelpublic float getTrisPerPixel()Returns the triangles per pixel value.- Returns:
- the triangles per pixel value.
- See Also:
 
- 
setTrisPerPixelpublic void setTrisPerPixel(float trisPerPixel) Sets the triangles per pixel value. TheLodControlwill use this value as an error metric to determine which LOD level to use based on the geometry's area on the screen.- Parameters:
- trisPerPixel- triangles per pixel
 
- 
setSpatial- Specified by:
- setSpatialin interface- Control
- Overrides:
- setSpatialin class- AbstractControl
- Parameters:
- spatial- the spatial to be controlled. This should not be called from user code.
 
- 
jmeCloneDescription copied from interface:JmeCloneablePerforms a regular shallow clone of the object. Some fields may also be cloned but generally only if they will never be shared with other objects. (For example, local Vector3fs and so on.)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. - Specified by:
- jmeClonein interface- JmeCloneable
- Overrides:
- jmeClonein class- AbstractControl
- Returns:
- a new instance
 
- 
controlUpdateprotected void controlUpdate(float tpf) Description copied from class:AbstractControlTo be implemented in subclass.- Specified by:
- controlUpdatein class- AbstractControl
- Parameters:
- tpf- time per frame (in seconds)
 
- 
controlRenderDescription copied from class:AbstractControlTo be implemented in subclass.- Specified by:
- controlRenderin class- AbstractControl
- Parameters:
- rm- the RenderManager rendering the controlled Spatial (not null)
- vp- the ViewPort being rendered (not null)
 
- 
write- Specified by:
- writein interface- Savable
- Overrides:
- writein class- AbstractControl
- Throws:
- IOException
 
- 
read- Specified by:
- readin interface- Savable
- Overrides:
- readin class- AbstractControl
- Throws:
- IOException
 
 
-