createMesh#destroy¶
Summary¶
createMesh#destroy is idempotent. It detaches the mesh from every tracked scene, releases morph GPU buffers and its skin instance, disposes its transform (detaching parent and children), and releases one geometry and material reference. Shared geometry/material resources survive while other retained references remain; referenced textures follow their separate lifetime.
Syntax¶
Parameters¶
None.
Returns¶
void
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const geometry = wgpu.geometry.box(1, 1, 1);
const material = wgpu.material.unlit({ color: [0.9, 0.6, 0.2], opacity: 1.0 });
const mesh = wgpu.createMesh(geometry, material);
mesh.destroy();