Properties
.autoUpdate : boolean
Whether the LOD object is updated automatically by the renderer per frame
or not. If set to false, you have to call LOD#update in the
render loop by yourself.
Default is true.
.isLOD : boolean (readonly)
This flag can be used for type testing.
Default is true.
.levels : Array.<{object:Object3D, distance:number, hysteresis:number}>
This array holds the LOD levels.
Methods
.addLevel( object : Object3D, distance : number, hysteresis : number ) : LOD
Adds a mesh that will display at a certain distance and greater. Typically the further away the distance, the lower the detail on the mesh.
| object |
The 3D object to display at this level. |
| distance |
The distance at which to display this level of detail. Default is |
| hysteresis |
Threshold used to avoid flickering at LOD boundaries, as a fraction of distance. Default is |
- Returns: A reference to this instance.
.getCurrentLevel() : number
Returns the currently active LOD level index.
- Returns: The current active LOD level index.
.getObjectForDistance( distance : number ) : Object3D
Returns a reference to the first 3D object that is greater than the given distance.
| distance |
The LOD distance. |
- Returns: The found 3D object.
nullif no 3D object has been found.
.raycast( raycaster : Raycaster, intersects : Array.<Object> )
Computes intersection points between a casted ray and this LOD.
| raycaster |
The raycaster. |
| intersects |
The target array that holds the intersection points. |
- Overrides: Object3D#raycast
.removeLevel( distance : number ) : boolean
Removes an existing level, based on the distance from the camera.
Returns true when the level has been removed. Otherwise false.
| distance |
Distance of the level to remove. |
- Returns: Whether the level has been removed or not.
.update( camera : Camera )
Updates the LOD by computing which LOD level should be visible according to the current distance of the given camera.
| camera |
The camera the scene is rendered with. |