sceneGraph

Low level sceneGraph manipulation.

Methods

(static) addNode(node) → {Promise}

Add a node to the scene.

Parameters:
Name Type Description
node Node
Returns:
Type
Promise

(static) clone(ids, nodeMap, optionsopt)

Clone nodes. Given a list of ids, this will copy the node with a new id, and update the parent and child of each node. By passing in a map of old parent id to new parent id, the nodes can be cloned to a different location in the sceneGraph (or from one to another).

Parameters:
Name Type Attributes Description
ids Array

list of ids to clone

nodeMap Object

of {oldNodeId: newNodeId} Can be used for passing new parents, or new depencies.

options Object <optional>
Properties
Name Type Attributes Description
cloneDependencies Boolean <optional>

Clone dependencies as well.

Example
// clone children of 'MyModel' to 'NewParentNull'
const parentId = scene.find({ name: 'NewParentNull' });
const myModelId = scene.find({ name: 'MyModel' });
const nodesToClone = scene.filter({ from: { id: myModelId } });
sceneGraph.clone(nodesToClone, { [myModelId]: parentId });
// clone dependencies
sceneGraph.clone(nodesToClone, { [myModelId]: parentId }, {cloneDependencies: true});

(static) deleteNode(id) → {Promise}

Deletes a node

Parameters:
Name Type Description
id String

The node id

Returns:
Type
Promise