Class threedee.SceneNode
A scene node. Can be used directly to create invisible group nodes or can be
extended to implement other node types.
Defined in: SceneNode.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
addUpdater(updater)
Adds the specified node updater to this node.
|
|
appendChild(node)
Appends the specified node as a child node to this node.
|
|
Returns the effective transformation of this node by recursively
traversing the path up the root node and multiplying all found
transformations.
|
|
Returns the first child node of this node.
|
|
Returns the last child node of this node.
|
|
Returns the next sibling of this node.
|
|
Returns the parent node.
|
|
Returns the previous sibling of this node.
|
|
Returns the current transformation matrix.
|
|
Checks if this node has child nodes.
|
|
insertBefore(insertNode, referenceNode)
Inserts a new child node before the specified reference node.
|
|
removeChild(node)
Removes the specified child node from this node.
|
|
removeUpdater(updater)
Removes the specified node updater from this node.
|
|
render(buffer, transform)
Renders the node.
|
|
replaceChild(oldNode, newNode)
Replaces the specified old node with the specified new node.
|
|
setTransform(transform)
Sets the transformation matrix.
|
|
update(delta)
Updates the node with the specified time delta.
|
Method Detail
addUpdater(updater)
Adds the specified node updater to this node.
- Parameters:
- {!threedee.NodeUpdater} updater
- The updater to add
appendChild(node)
Appends the specified node as a child node to this node. If the node was
previously connected to a different parent node then it is first
disconnected from this parent.
- Parameters:
- {!threedee.SceneNode} node
- The node to append to this node
{!threedee.Matrix}
getEffectiveTransform()
Returns the effective transformation of this node by recursively
traversing the path up the root node and multiplying all found
transformations. Depending on the complexity of your scene graph this is
time-consuming so thing twice if you really need it.
- Returns:
- {!threedee.Matrix} The effective transformation.
{?threedee.SceneNode}
getFirstChild()
Returns the first child node of this node. If the node has no child nodes
then null is returned.
- Returns:
- {?threedee.SceneNode} The first child node or null if there are no child nodes
{?threedee.SceneNode}
getLastChild()
Returns the last child node of this node. If the node has no child nodes
then null is returned.
- Returns:
- {?threedee.SceneNode} The last child node or null if there are no child nodes
{?threedee.SceneNode}
getNextSibling()
Returns the next sibling of this node. If the node is the last child node
of its parent then null is returned because there can't be a next
sibling.
- Returns:
- {?threedee.SceneNode} The next sibling of this node or null if there is no next sibling
{?threedee.SceneNode}
getParentNode()
Returns the parent node. If the node has no root node yet then null is
returned.
- Returns:
- {?threedee.SceneNode} The parent node or null if there is none
{?threedee.SceneNode}
getPreviousSibling()
Returns the previous sibling of this node. If the node is the first child
node of its parent then null is returned because there can't be a
previous sibling.
- Returns:
- {?threedee.SceneNode} The previous sibling of this node or null if there is no previous sibling
{!threedee.Matrix}
getTransform()
Returns the current transformation matrix.
- Returns:
- {!threedee.Matrix} The current transformation matrix
{boolean}
hasChildNodes()
Checks if this node has child nodes.
- Returns:
- {boolean} True if this node has child nodes, false if not
insertBefore(insertNode, referenceNode)
Inserts a new child node before the specified reference node. If the new
node was already connected to a parent then it is disconnected from this
parent first.
- Parameters:
- {!threedee.SceneNode} insertNode
- The new node to insert.
- {!threedee.SceneNode} referenceNode
- The reference node.
removeChild(node)
Removes the specified child node from this node.
- Parameters:
- {!threedee.SceneNode} node
- The node to remove
removeUpdater(updater)
Removes the specified node updater from this node.
- Parameters:
- {!threedee.NodeUpdater} updater
- The updater to remove
render(buffer, transform)
Renders the node. Default implementation is doing nothing except calling
the render method of all child nodes.
- Parameters:
- {!threedee.PolygonBuffer} buffer
- The polygon buffer
- {!threedee.Matrix} transform
- The current transformation
replaceChild(oldNode, newNode)
Replaces the specified old node with the specified new node. If the new
node was already connected to a parent then it is disconnected from this
parent first.
- Parameters:
- {!threedee.SceneNode} oldNode
- The old node to be replaced by the new one
- {!threedee.SceneNode} newNode
- The new node to replace the old one
setTransform(transform)
Sets the transformation matrix.
- Parameters:
- {!threedee.Matrix} transform
- The transformation matrix to set
update(delta)
Updates the node with the specified time delta. Default implementation is
executing the connected node updaters and calling the update method of
all child nodes.
- Parameters:
- {number} delta
- The time elapsed since the last scene update (in nanoseconds)