A component for providing a basic Level of Detail (LOD) mechanism.
Every LOD level is associated with an object, and rendering can be switched between them at the distances specified. Typically you would create, say, three meshes, one for far away (low detail), one for mid range (medium detail) and one for close up (high detail).
Example:
val lod = new LOD()
val material = MeshBasicMaterial(color = 0xffff00)
// Create spheres with 3 levels of detail and create new LOD levels for them
for (i <- 0 until 3) {
val geometry = IcosahedronGeometry(10, 3 - i)
val mesh = Mesh(geometry, material)
lod.addLevel(mesh, i * 75)
}
scene.add(lod)
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
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.
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.
Value parameters
- distance
-
The distance at which to display this level of detail (default: 0)
- hysteresis
-
Threshold used to avoid flickering at LOD boundaries, as a fraction of distance (default: 0)
- object
-
The 3D object to display at this level
Attributes
- Returns
-
A reference to this instance
Returns the currently active LOD level index.
Returns the currently active LOD level index.
Attributes
- Returns
-
The current active LOD level index
Returns a reference to the first 3D object that is greater than the given distance.
Returns a reference to the first 3D object that is greater than the given distance.
Value parameters
- distance
-
The LOD distance
Attributes
- Returns
-
The found 3D object, null if no 3D object has been found
Removes an existing level, based on the distance from the camera. Returns true when the level has been removed. Otherwise false.
Removes an existing level, based on the distance from the camera. Returns true when the level has been removed. Otherwise false.
Value parameters
- distance
-
Distance of the level to remove
Attributes
- Returns
-
Whether the level has been removed or not
Updates the LOD by computing which LOD level should be visible according to the current distance of the given camera.
Updates the LOD by computing which LOD level should be visible according to the current distance of the given camera.
Value parameters
- camera
-
The camera the scene is rendered with
Attributes
Inherited methods
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object
Attributes
- Inherited from:
- Object
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object
Attributes
- Inherited from:
- Object3D
Concrete fields
Whether the LOD object is updated automatically by the renderer per frame or not. If set to false, you have to call update in the render loop by yourself.
Whether the LOD object is updated automatically by the renderer per frame or not. If set to false, you have to call update in the render loop by yourself.
Attributes
This flag can be used for type testing.
This flag can be used for type testing.
Attributes
Inherited fields
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D
Attributes
- Inherited from:
- Object3D