Class SpotLight2

Extension of three.js SpotLight with additional properties for serialization and UI

Note - gltf serialization is handled by GLTFLightExtrasExtension

Hierarchy

Implements

Constructors

Properties

angle: number

Maximum extent of the spotlight, in radians, from its direction.

Should be no more than Math.PI/2.

Math.PI / 3

assetType: "light" = ...
castShadow: boolean

If set to true light will cast dynamic shadows.

Warning: This is expensive and requires tweaking to get shadows looking right. the SpotLightShadow for details.

false

children: IObject3D[]

Array with object's children.

THREE.Object3DGroup | Group for info on manually grouping objects.

[]

clone: (recursive?: boolean) => this

Returns a clone of this object and optionally all descendants.

Type declaration

    • (recursive?: boolean): this
    • Parameters

      • Optionalrecursive: boolean

        If true, descendants of the object are also cloned. Default true

      Returns this

color: Color

Color of the light. \

new THREE.Color(0xffffff) (white).

copy: (
    source: IObject3D | SpotLight,
    recursive?: boolean,
    ...args: any[],
) => this

Copies value of all the properties from the source to this instance.

decay: number

The amount the light dims along the distance of the light. In context of physically-correct rendering the default value should not be changed.

Expects a Float

2

dispatchEvent: (event: ILightEvent) => void

Fire an event type.

Type declaration

distance: number

When Default mode — When distance is zero, light does not attenuate. When distance is non-zero, light will attenuate linearly from maximum intensity at the light's position down to zero at this distance from the light.

When WebGLRenderer.useLegacyLights | legacy lighting mode is disabled — When distance is zero, light will attenuate according to inverse-square law to infinite distance. When distance is non-zero, light will attenuate according to inverse-square law until near the distance cutoff, where it will then attenuate quickly and smoothly to 0. Inherently, cutoffs are not physically correct.

Expects a Float

0.0

getObjectById: <T extends IObject3D = IObject3D>(id: number) => undefined | T

Searches through an object and its children, starting with the object itself, and returns the first with a matching id.

Type declaration

    • <T extends IObject3D = IObject3D>(id: number): undefined | T
    • Type Parameters

      Parameters

      • id: number

        Unique number of the object instance. Expects a Integer

      Returns undefined | T

Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object.

id

getObjectByName: <T extends IObject3D = IObject3D>(
    name: string,
) => undefined | T

Searches through an object and its children, starting with the object itself, and returns the first with a matching name.

Type declaration

Note that for most objects the name is an empty string by default

getObjectByProperty: <T extends IObject3D = IObject3D>(
    name: string,
    value: string,
) => undefined | T

Searches through an object and its children, starting with the object itself, and returns the first with a property that matches the value given.

Type declaration

    • <T extends IObject3D = IObject3D>(name: string, value: string): undefined | T
    • Type Parameters

      Parameters

      • name: string

        the property name to search for.

      • value: string

        value of the given property.

      Returns undefined | T

intensity: number

The light's intensity.

Changing the intensity will also change the light's power. When WebGLRenderer.useLegacyLights | legacy lighting mode is disabled — intensity is the luminous intensity of the light measured in candela (cd).

1

isSpotLight2: true
parent: null | IObject3D

Object's parent in the scene graph.

An object can have at most one parent.

null

penumbra: number

Percent of the SpotLight cone that is attenuated due to penumbra.

Takes values between zero and 1.

0.0

position: Vector3

This is set equal to Object3D.DEFAULT_UP (0, 1, 0), so that the light shines from the top down.

{@link Object3D.DEFAULT_UP}

refreshUi: (this: IObject3D) => void = iLightCommons.refreshUi
remove: (...object: IObject3D[]) => this

Removes a Object3D as child of this Object3D.

An arbitrary number of objects may be removed.

Group for info on manually grouping objects.

rotation: Euler

Object's local rotation (Euler angles), in radians.

new THREE.Euler() - that is (0, 0, 0, Euler.DEFAULT_ORDER).

setDirty: (
    this: ILight,
    options?: IObjectSetDirtyOptions,
    ...args: any[],
) => void = iLightCommons.setDirty

Dispatches 'objectUpdate' event on object.

shadowAspect: number
shadowBias: number
shadowFar: number
shadowFocus: number
shadowFov: number
shadowMapSize: Vector2
shadowNear: number
shadowRadius: number
traverse: (callback: (object: IObject3D) => void) => void

Executes the callback on this object and all descendants.

Type declaration

    • (callback: (object: IObject3D) => void): void
    • Parameters

      • callback: (object: IObject3D) => void

        A function with as first argument an Object3D object.

      Returns void

Note: Modifying the scene graph inside the callback is discouraged.

traverseAncestors: (callback: (object: IObject3D) => void) => void

Executes the callback on all ancestors.

Type declaration

    • (callback: (object: IObject3D) => void): void
    • Parameters

      • callback: (object: IObject3D) => void

        A function with as first argument an Object3D object.

      Returns void

Note: Modifying the scene graph inside the callback is discouraged.

traverseVisible: (callback: (object: IObject3D) => void) => void

Like traverse, but the callback will only be executed for visible objects

Type declaration

    • (callback: (object: IObject3D) => void): void
    • Parameters

      • callback: (object: IObject3D) => void

        A function with as first argument an Object3D object.

      Returns void

Descendants of invisible objects are not traversed.

uiConfig: UiObjectConfig
visible: boolean

Object gets rendered if true.

true

Accessors

Methods