ProtectedcfgProtectednameThe underlying THREE.Light object that defines illumination parameters and behavior. It can be replaced to represent various light types such as point, directional, or spot lights.
The active Three.js renderer used by this object. It is exposed for advanced use cases that require renderer-dependent Three.js APIs, such as reading the canvas size, pixel ratio, drawing buffer size, or updating renderer-based helper objects like cube cameras.
The THREE.Scene instance this object belongs to.
Registers a listener that is called whenever the specified event occurs.
The event type to listen for.
Callback invoked when the event occurs.
A function that unsubscribes the listener.
Returns the object's screen position in canvas coordinates.
Camera used for projection to canvas coordinates.
The projected screen position in canvas coordinates, or null if no THREE.Object3D is assigned.
Called once after the THREE.Scene, the THREE.WebGLRenderer or THREE.WebGPURenderer, the EnvCtrls are initialized and an existing GLTF model has been loaded and traversed.
Called once after the THREE.Scene is initialized, before an existing GLTF model is loaded.
Called for each traversed light during .gltf parsing. Stores the current THREE.Light in this.obj.
The currently traversed THREE.Light.
Example
import { SpotLight } from 'three';
import { Light3D } from 'illutions';
export class Spot extends Light3D {
// Called while illutions traverses the loaded 3D scene.
// The matching Three.js light from the GLTF scene is passed in here.
public override onTraverse(light: SpotLight): void {
// Limit the effective range of the spotlight.
light.distance = 10;
// Use physically realistic light falloff.
light.decay = 2;
// Enable shadow casting for this light.
light.castShadow = true;
// Store the configured 'THREE.Light' as the runtime light object.
this.obj = light;
}
}
Called on every animation frame update.
Time elapsed since the previous frame in seconds.
Removes a previously registered listener for the specified event.
The event type to remove the listener from.
Callback to remove from the event listeners.
The
Light3Dclass represents a managed light source.