Class dnx.lr.NodeInstance
All Packages Class Hierarchy This Package Previous Next Index
Class dnx.lr.NodeInstance
java.lang.Object
|
+----dnx.util.DNXObject
|
+----dnx.lr.NodeInstance
- public class NodeInstance
- extends DNXObject
A NodeInstance represents a particular instance of a node.
If you DEF a node and then USE it multiple times, you conceptually
have the same node in each different place but a different instance
in each place. Each instance has a NodeInstance object associated
with it. Given a NodeInstance object, you can attach data to that
particular instance and retrieve its parent, children, and siblings.
Note that NodeInstance objects are only created as necessary, to
conserve space. However, this is invisible to the API user unless
you cross within the internal boundary (typically by subclassing
Traversal).
-
showInstanceNumber
-
-
showLinkedNodes
-
-
addAuxNodes(AuxNodeTreeContext)
-
-
debugPrint()
- Print out the subgraph rooted at this node instance onto
System.err.
-
deleteAuxNodes(AuxNodeTreeContext)
-
-
enumerateAuxNodes()
-
-
getActualNode()
- Return the actual Node to which this instance belongs.
-
getChild(int, int)
-
-
getChildObjectToViewerMatrix(Camera, Matrix4)
- Return the object-to-viewer matrix for children of this node instance.
-
getFirstChild()
- Return the first child of the given node instance, or null if
there are no children.
-
getLastChild()
- Return the last child of the given node instance, or null if
there are no children.
-
getNextChild(int, int)
-
-
getNextSibling()
- Return the next sibling of the given node instance, i.e.
-
getNodeTreeContext()
- Same as getActualNode().getNodeTreeContext().
-
getObjectToViewerMatrix(Camera, Matrix4)
- Return the object-to-viewer transformation matrix for the given
node instance (which must be uniquified) and specified camera.
-
getParent()
- Return the parent node instance of this instance.
-
getPrevChild(int, int)
-
-
getPrevSibling()
- Return the previous sibling of the given node instance,
i.e.
-
getPrimitiveNode()
- Return the non-prototype Node to which this instance belongs.
-
getPrimitiveNodeInstance()
- If this is an instance of a PrototypeNode, return the non-prototype
node at the root of the prototype; otherwise return THIS.
-
getProperty(Object)
- Get the value of a property.
-
getProperty(Object, Object)
- Get the value of a property.
-
getPropertyEqual(Object)
- Like getProperty() but compare keys with equals().
-
getPropertyEqual(Object, Object)
- Like getProperty() but compare keys with equals().
-
getSceneContext()
- Same as getActualNode().getSceneContext().
-
isUniquified()
-
-
locateChildFieldIndex(NodeInstance, IntReference)
- Locate the field that contains the node instance CHILD in it.
-
locateChildNodeIndex(NodeInstance, IntReference)
- Equivalent to locateChildFieldIndex() but returns the node index
directly and stores the field index into the passed IntReference
(which can be null if you don't care about the field index).
-
print(PrintAction)
- Print out the subgraph rooted at this node instance.
-
putProperty(Object, Object)
- Add an arbitrary property to a node instance.
-
putPropertyEqual(Object, Object)
- Like putProperty() but compare keys with equals().
-
removeProperty(Object)
- Remove a property from a node instance.
-
removePropertyEqual(Object)
- Like removeProperty() but compare keys with equals().
-
toInstanceString()
-
-
toString()
-
-
traverse(InstanceTraversal)
- Perform a traversal of this instance and any of its children.
-
unlink()
- Make this node instance no longer be linked to any others.
showInstanceNumber
public static boolean showInstanceNumber
showLinkedNodes
public static boolean showLinkedNodes
getActualNode
public final Node getActualNode()
- Return the actual Node to which this instance belongs.
Much of the time, you want to call getPrimitiveNode(), which
telescopes past PrototypeNodes.
getPrimitiveNode
public final Node getPrimitiveNode()
- Return the non-prototype Node to which this instance belongs.
If this node instance belongs to a PrototypeNode, this automatically
retrieves the non-prototype Node at the root.
getNodeTreeContext
public final NodeTreeContext getNodeTreeContext()
- Same as getActualNode().getNodeTreeContext().
getSceneContext
public final SceneContext getSceneContext()
- Same as getActualNode().getSceneContext().
getParent
public NodeInstance getParent()
- Return the parent node instance of this instance.
This will be null on non-uniquified node instances, but unless
you're within the LR internal boundary, you should never see
such a beast.
getChild
public NodeInstance getChild(int fieldInd,
int nodeInd)
getNextChild
public NodeInstance getNextChild(int fieldind,
int nodeind)
getPrevChild
public NodeInstance getPrevChild(int fieldind,
int nodeind)
getNextSibling
public NodeInstance getNextSibling()
- Return the next sibling of the given node instance, i.e. the next
child after this one of the same parent. If this is the last sibling,
null is returned.
getPrevSibling
public NodeInstance getPrevSibling()
- Return the previous sibling of the given node instance,
i.e. the previous child after this one of the same parent. If this
is the first sibling, null is returned.
getFirstChild
public NodeInstance getFirstChild()
- Return the first child of the given node instance, or null if
there are no children.
getLastChild
public NodeInstance getLastChild()
- Return the last child of the given node instance, or null if
there are no children.
getPrimitiveNodeInstance
public NodeInstance getPrimitiveNodeInstance()
- If this is an instance of a PrototypeNode, return the non-prototype
node at the root of the prototype; otherwise return THIS.
locateChildFieldIndex
public int locateChildFieldIndex(NodeInstance child,
IntReference nodeIndex)
- Locate the field that contains the node instance CHILD in it.
Return the index of the field directly, and store the index of
the node instance within the field into nodeIndex (which can be
null, if you don't care about the node index).
If the child is not found, -1 is returned.
locateChildNodeIndex
public int locateChildNodeIndex(NodeInstance child,
IntReference fieldIndex)
- Equivalent to locateChildFieldIndex() but returns the node index
directly and stores the field index into the passed IntReference
(which can be null if you don't care about the field index).
getObjectToViewerMatrix
public final void getObjectToViewerMatrix(Camera cam,
Matrix4 m)
- Return the object-to-viewer transformation matrix for the given
node instance (which must be uniquified) and specified camera.
This converts a point in the local space of the node instance to a
point in camera (viewer) space. Note that if you want the
object-to-world matrix, you should take the result of this method
and post-multiply by the viewer-to-world matrix of the camera. (It
has to be done this way because for some nodes, such as
BillboardNode, their contribution to the transformation depends on
the position of the camera.)
Note that the local space of transforming nodes (e.g. TransformNode)
does *NOT* include the transformation from the node itself.
Call getChildObjectViewerMatrix() if you want that.
If you pass in null for the camera, this function will act as if
the viewpoint is located at the origin in world space, and the returned
matrix will be an object-to-world matrix. You should NOT do this,
however, if there's any way to avoid it, because the resulting value
will be incorrrect if there are any BillboardNodes along the path from
this NodeInstance to the root. (One reason you might want to pass in
null is if you're trying to compute the viewer-to-world matrix of a
ViewNode; in such cases, it's reasonable to make results undefined if
the viewpoint sits inside of a BillboardNode.)
getChildObjectToViewerMatrix
public final void getChildObjectToViewerMatrix(Camera cam,
Matrix4 m)
- Return the object-to-viewer matrix for children of this node instance.
If this node instance is a transforming node (or is a prototype node
whose root is a transforming node), this will take into account the
transformation of that node.
isUniquified
public boolean isUniquified()
unlink
public void unlink()
- Make this node instance no longer be linked to any others. If
there are other instances of the node, we make a new node for
the instance and recursively proceed up the tree.
addAuxNodes
public void addAuxNodes(AuxNodeTreeContext geom)
deleteAuxNodes
public int deleteAuxNodes(AuxNodeTreeContext geom)
enumerateAuxNodes
public Enumeration enumerateAuxNodes()
putProperty
public void putProperty(Object key,
Object value)
- Add an arbitrary property to a node instance. This mechanism
allows you to attach instance-specific data to an instance.
Keys are compared using the `==' operator. Therefore, don't
use strings as keys; instead, use the Symbol object, by calling
Symbol.intern ("string") to convert a string into a Symbol.
If the key already exists, its value is replaced.
@see dnx.util.Symbol
@see dnx.util.PropertyList
getProperty
public Object getProperty(Object key)
- Get the value of a property. Keys are compared using the `=='
operator; this means that the keys should not be strings (use
Symbols instead). If the key is not found, null is returned.
@see dnx.util.Symbol
@see dnx.util.PropertyList
getProperty
public Object getProperty(Object key,
Object defalt)
- Get the value of a property. Keys are compared using the `=='
operator; this means that the keys should not be strings (use
Symbols instead). If the key is not found, DEFALT is returned.
@see dnx.util.Symbol
@see dnx.util.PropertyList
removeProperty
public boolean removeProperty(Object key)
- Remove a property from a node instance. Keys are compared
using the `==' operator; this means that the keys should not be
strings (use Symbols instead). Return value is true if the key
was found.
@see dnx.util.Symbol
@see dnx.util.PropertyList
putPropertyEqual
public void putPropertyEqual(Object key,
Object value)
- Like putProperty() but compare keys with equals().
getPropertyEqual
public Object getPropertyEqual(Object key)
- Like getProperty() but compare keys with equals().
getPropertyEqual
public Object getPropertyEqual(Object key,
Object defalt)
- Like getProperty() but compare keys with equals().
removePropertyEqual
public boolean removePropertyEqual(Object key)
- Like removeProperty() but compare keys with equals().
traverse
public final boolean traverse(InstanceTraversal trav)
- Perform a traversal of this instance and any of its children.
Return true if the traversal was terminated prematurely.
debugPrint
public void debugPrint()
- Print out the subgraph rooted at this node instance onto
System.err.
print
public void print(PrintAction a)
- Print out the subgraph rooted at this node instance.
toInstanceString
public String toInstanceString()
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index