ProtectedcfgReflectorForSSRPass surface used for screen-space reflections (SSR). When set, it renders dynamic reflections on a ground plane.
ProtectednameThe underlying THREE.Mesh used for rendering. It can be replaced with a custom mesh that uses different geometry or material settings.
Objects that participate in the screen-space reflection (SSR) effect. These objects are used for reflective rendering in the scene.
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 mesh during GLTF parsing. Stores the current THREE.Mesh in this.obj.
The currently traversed mesh.
Example
import { Mesh, MeshPhysicalMaterial } from 'three';
import { Mesh3D } from 'illutions';
export class Cube extends Mesh3D {
// Called while illutions traverses the loaded 3D scene.
// The matching Three.js mesh from the GLTF scene is passed in here.
public override onTraverse(mesh: Mesh): void {
// Access the mesh material as a physical material.
const material = mesh.material as MeshPhysicalMaterial;
// Enable depth writing so the mesh correctly affects depth-based rendering.
material.depthWrite = true;
// Enable shadow casting and receiving for this mesh.
mesh.castShadow = true;
mesh.receiveShadow = true;
// Keep the mesh rendered even when Three.js thinks it is outside the camera frustum.
mesh.frustumCulled = false;
// Add the mesh to the SSR reflective objects list.
this.reflectivesSSR.push(mesh);
// Store the configured `THREE.Mesh` as the runtime object.
this.obj = mesh;
}
}
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.
Manages 3D meshes in illutions. Wraps a
THREE.Meshand provides support for scene integration and optional screen-space reflection (SSR) features.