Scene.destroy¶
Summary¶
Scene.destroy releases resources for all scene objects and clears all collections, including lights. It calls destroy() on meshes, point clouds, glyph fields, and nodelinks currently in the scene. After destruction, the scene can be reused but will be empty.
Syntax¶
Parameters¶
This method does not take parameters.
Returns¶
void - No value is returned; the call performs object/resource cleanup.
Type Details¶
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const scene = wgpu.createScene();
scene.add(wgpu.createMesh(wgpu.geometry.box(1, 1, 1), wgpu.material.unlit({ color: [0.8, 0.3, 0.2] })));
scene.addLight(wgpu.createLight.ambient({ intensity: 0.2 }));
scene.destroy();