LOD

THREE.LOD
See theLOD companion object
class LOD extends Object3D

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
class Object3D
class Object
trait Any
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def addLevel(`object`: Object3D, distance: Double, hysteresis: Double): 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.

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

def getCurrentLevel(): Int

Returns the currently active LOD level index.

Returns the currently active LOD level index.

Attributes

Returns

The current active LOD level index

def getObjectForDistance(distance: Double): Object3D | Null

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

def removeLevel(distance: Double): Boolean

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

def update(camera: Camera): Unit

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

def add(obj: Object3D*): this.type

Attributes

Inherited from:
Object3D
def applyMatrix4(matrix: Matrix4): Unit

Attributes

Inherited from:
Object3D
def applyQuaternion(q: Quaternion): this.type

Attributes

Inherited from:
Object3D
def attach(obj: Object3D): this.type

Attributes

Inherited from:
Object3D
def clear(): this.type

Attributes

Inherited from:
Object3D
def copy(source: Object3D, recursive: Boolean): this.type

Attributes

Inherited from:
Object3D
def getObjectById(id: Int): UndefOr[Object3D]

Attributes

Inherited from:
Object3D
def getObjectByName(name: String): UndefOr[Object3D]

Attributes

Inherited from:
Object3D
def getObjectByProperty(name: String, value: Any): UndefOr[Object3D]

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D
def getWorldScale(target: Vector3): Vector3

Attributes

Inherited from:
Object3D
def hasOwnProperty(v: String): Boolean

Attributes

Inherited from:
Object
def isPrototypeOf(v: Object): Boolean

Attributes

Inherited from:
Object
def jsClone(recursive: Boolean): this.type

Attributes

Inherited from:
Object3D
def localToWorld(vector: Vector3): Vector3

Attributes

Inherited from:
Object3D
def lookAt(x: Any, y: UndefOr[Double], z: UndefOr[Double]): Unit

Attributes

Inherited from:
Object3D
def propertyIsEnumerable(v: String): Boolean

Attributes

Inherited from:
Object
def raycast(raycaster: Object, intersects: Array[Object]): Unit

Attributes

Inherited from:
Object3D
def remove(ob: Object3D*): this.type

Attributes

Inherited from:
Object3D
def rotateOnAxis(axis: Vector3, angle: Double): this.type

Attributes

Inherited from:
Object3D
def rotateOnWorldAxis(axis: Vector3, angle: Double): this.type

Attributes

Inherited from:
Object3D
def rotateX(angle: Double): this.type

Attributes

Inherited from:
Object3D
def rotateY(angle: Double): this.type

Attributes

Inherited from:
Object3D
def rotateZ(angle: Double): this.type

Attributes

Inherited from:
Object3D
def setRotationFromAxisAngle(axis: Vector3, angle: Double): Unit

Attributes

Inherited from:
Object3D
def setRotationFromEuler(euler: Euler): Unit

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D
def toLocaleString(): String

Attributes

Inherited from:
Object
def translateOnAxis(axis: Vector3, distance: Double): this.type

Attributes

Inherited from:
Object3D
def translateX(distance: Double): this.type

Attributes

Inherited from:
Object3D
def translateY(distance: Double): this.type

Attributes

Inherited from:
Object3D
def translateZ(distance: Double): this.type

Attributes

Inherited from:
Object3D
def traverse(callback: Function1[Object3D, Unit]): Unit

Attributes

Inherited from:
Object3D
def traverseAncestors(callback: Function1[Object3D, Unit]): Unit

Attributes

Inherited from:
Object3D
def traverseVisible(callback: Function1[Object3D, Unit]): Unit

Attributes

Inherited from:
Object3D
def updateMatrix(): Unit

Attributes

Inherited from:
Object3D
def updateMatrixWorld(force: Boolean): Unit

Attributes

Inherited from:
Object3D
def updateWorldMatrix(updateParent: Boolean, updateChildren: Boolean): Unit

Attributes

Inherited from:
Object3D
def valueOf(): Any

Attributes

Inherited from:
Object
def worldToLocal(vector: Vector3): Vector3

Attributes

Inherited from:
Object3D

Concrete fields

var autoUpdate: Boolean

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

val isLOD: Boolean

This flag can be used for type testing.

This flag can be used for type testing.

Attributes

val levels: Array[LODLevel]

This array holds the LOD levels. Each level contains object, distance, and hysteresis properties.

This array holds the LOD levels. Each level contains object, distance, and hysteresis properties.

Attributes

Inherited fields

val `type`: String

Attributes

Inherited from:
Object3D
var castShadow: Boolean

Attributes

Inherited from:
Object3D
val children: Array[Object3D]

Attributes

Inherited from:
Object3D
var frustumCulled: Boolean

Attributes

Inherited from:
Object3D
val id: Int

Attributes

Inherited from:
Object3D
var layers: Object

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D
var matrixAutoUpdate: Boolean

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D
var matrixWorldNeedsUpdate: Boolean

Attributes

Inherited from:
Object3D
var name: String

Attributes

Inherited from:
Object3D
var parent: UndefOr[Object3D]

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D
var receiveShadow: Boolean

Attributes

Inherited from:
Object3D
var renderOrder: Double

Attributes

Inherited from:
Object3D

Attributes

Inherited from:
Object3D
var scale: Vector3

Attributes

Inherited from:
Object3D
var userData: Object

Attributes

Inherited from:
Object3D
val uuid: String

Attributes

Inherited from:
Object3D
var visible: Boolean

Attributes

Inherited from:
Object3D