Scene.remove¶
Summary¶
Scene.remove removes a Mesh, PointCloud, GlyphField, or NodeLink instance from the scene if it exists. Removing a missing object is a no-op. The method returns the same scene for chaining.
Syntax¶
Scene.remove(mesh: Mesh): Scene
Scene.remove(pointCloud: PointCloud): Scene
Scene.remove(glyphField: GlyphField): Scene
Scene.remove(nodeLink: NodeLink): Scene
const result = scene.remove(object);
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
mesh |
Mesh |
Conditional | Mesh instance to remove from scene.meshes. |
pointCloud |
PointCloud |
Conditional | Point cloud instance to remove from scene.pointClouds. |
glyphField |
GlyphField |
Conditional | Glyph field instance to remove from scene.glyphFields. |
nodeLink |
NodeLink |
Conditional | NodeLink instance to remove from scene.nodeLinks. |
Returns¶
Scene - The same scene instance after removal attempt.
Type Details¶
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const scene = wgpu.createScene();
const graph = wgpu.createNodeLink({
nodePositions: new Float32Array([
-0.5, 0.0, 0.0,
0.5, 0.0, 0.0
]),
edges: new Uint16Array([0, 1])
});
scene.add(graph);
scene.remove(graph);