Package javax.media.j3d
Class Node
- java.lang.Object
-
- javax.media.j3d.SceneGraphObject
-
- javax.media.j3d.Node
-
public abstract class Node extends SceneGraphObject
The Node class provides an abstract class for all Group and Leaf Nodes. It provides a common framework for constructing a Java 3D scene graph, specifically bounding volumes.For more information, see the Introduction to the Java 3D API.
NOTE: Applications should not extend this class directly.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALLOW_AUTO_COMPUTE_BOUNDS_READ
Specifies that this Node allows read access to its bounds auto compute information.static int
ALLOW_AUTO_COMPUTE_BOUNDS_WRITE
Specifies that this Node allows write access to its bounds auto compute information.static int
ALLOW_BOUNDS_READ
Specifies that this Node allows read access to its bounds information.static int
ALLOW_BOUNDS_WRITE
Specifies that this Node allows write access to its bounds information.static int
ALLOW_COLLIDABLE_READ
Specifies that this Node allows reading its collidability state.static int
ALLOW_COLLIDABLE_WRITE
Specifies that this Node allows write access its collidability state.static int
ALLOW_LOCAL_TO_VWORLD_READ
Specifies that this Node allows read access to its local coordinates to virtual world (Vworld) coordinates transform.static int
ALLOW_LOCALE_READ
Specifies that this Node allows read access to its Locale.static int
ALLOW_PARENT_READ
Specifies that this Node allows read access to its parent Group node.static int
ALLOW_PICKABLE_READ
Specifies that this Node allows reading its pickability state.static int
ALLOW_PICKABLE_WRITE
Specifies that this Node allows write access its pickability state.static int
ENABLE_COLLISION_REPORTING
Specifies that this Node will be reported in the collision SceneGraphPath if a collision occurs.static int
ENABLE_PICK_REPORTING
Specifies that this Node will be reported in the pick SceneGraphPath if a pick occurs.
-
Constructor Summary
Constructors Constructor Description Node()
Constructs a Node object with default parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
cloneNode(boolean forceDuplicate)
Used to create a new instance of the node.Node
cloneTree()
Duplicates all the nodes of the specified sub-graph.Node
cloneTree(boolean forceDuplicate)
Duplicates all the nodes of the specified sub-graph.Node
cloneTree(boolean forceDuplicate, boolean allowDanglingReferences)
Duplicates all the nodes of the specified sub-graph.Node
cloneTree(NodeReferenceTable referenceTable)
Duplicates all the nodes of the specified sub-graph.Node
cloneTree(NodeReferenceTable referenceTable, boolean forceDuplicate)
Duplicates all the nodes of the specified sub-graph.Node
cloneTree(NodeReferenceTable referenceTable, boolean forceDuplicate, boolean allowDanglingReferences)
Duplicates all the nodes of the specified sub-graph.void
duplicateNode(Node originalNode, boolean forceDuplicate)
Copies all node information fromoriginalNode
into the current node.Bounds
getBounds()
Returns the bounding object of a node.boolean
getBoundsAutoCompute()
Gets the value indicating if the automatic calcuation of geometric bounds of a node is on/off.boolean
getCollidable()
Returns the collidable value; this value determines whether this node and it's children, if a group node, can be considered for collision purposes; if it is set to false, then neither this node nor any children nodes will be traversed for collision purposes; the default value is true.Locale
getLocale()
Retrieves the locale to which this node is attached.void
getLocalToVworld(SceneGraphPath path, Transform3D t)
Retrieves the local coordinates to virtual world coordinates transform for the particular path in the scene graph ending with this node.void
getLocalToVworld(Transform3D t)
Retrieves the local coordinates to virtual world coordinates transform for this node in the scene graph.Node
getParent()
boolean
getPickable()
Returns true if thisNode
is pickable, false if it is not pickable.void
setBounds(Bounds bounds)
Sets the geometric bounds of a node.void
setBoundsAutoCompute(boolean autoCompute)
Turns the automatic calcuation of geometric bounds of a node on/off.void
setCollidable(boolean collidable)
Sets the collidable value; determines whether this node and any of its children, if a group node, can be considered for collision purposes.void
setPickable(boolean pickable)
When set totrue
thisNode
can be Picked.-
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
-
-
-
-
Field Detail
-
ENABLE_PICK_REPORTING
public static final int ENABLE_PICK_REPORTING
Specifies that this Node will be reported in the pick SceneGraphPath if a pick occurs. This capability is only specifiable for Group nodes; it is ignored for leaf nodes. The default for Group nodes is false. All interior nodes not needed for uniqueness in a SceneGraphPath that don't have ENABLE_PICK_REPORTING set to true will not be reported in the SceneGraphPath.- See Also:
SceneGraphPath
, Constant Field Values
-
ENABLE_COLLISION_REPORTING
public static final int ENABLE_COLLISION_REPORTING
Specifies that this Node will be reported in the collision SceneGraphPath if a collision occurs. This capability is only specifiable for Group nodes; it is ignored for leaf nodes. The default for Group nodes is false. All interior nodes not needed for uniqueness in a SceneGraphPath that don't have ENABLE_COLLISION_REPORTING set to true will not be reported in the SceneGraphPath.- See Also:
SceneGraphPath
, Constant Field Values
-
ALLOW_BOUNDS_READ
public static final int ALLOW_BOUNDS_READ
Specifies that this Node allows read access to its bounds information.- See Also:
- Constant Field Values
-
ALLOW_BOUNDS_WRITE
public static final int ALLOW_BOUNDS_WRITE
Specifies that this Node allows write access to its bounds information.- See Also:
- Constant Field Values
-
ALLOW_PICKABLE_READ
public static final int ALLOW_PICKABLE_READ
Specifies that this Node allows reading its pickability state.- See Also:
- Constant Field Values
-
ALLOW_PICKABLE_WRITE
public static final int ALLOW_PICKABLE_WRITE
Specifies that this Node allows write access its pickability state.- See Also:
- Constant Field Values
-
ALLOW_COLLIDABLE_READ
public static final int ALLOW_COLLIDABLE_READ
Specifies that this Node allows reading its collidability state.- See Also:
- Constant Field Values
-
ALLOW_COLLIDABLE_WRITE
public static final int ALLOW_COLLIDABLE_WRITE
Specifies that this Node allows write access its collidability state.- See Also:
- Constant Field Values
-
ALLOW_AUTO_COMPUTE_BOUNDS_READ
public static final int ALLOW_AUTO_COMPUTE_BOUNDS_READ
Specifies that this Node allows read access to its bounds auto compute information.- See Also:
- Constant Field Values
-
ALLOW_AUTO_COMPUTE_BOUNDS_WRITE
public static final int ALLOW_AUTO_COMPUTE_BOUNDS_WRITE
Specifies that this Node allows write access to its bounds auto compute information.- See Also:
- Constant Field Values
-
ALLOW_LOCAL_TO_VWORLD_READ
public static final int ALLOW_LOCAL_TO_VWORLD_READ
Specifies that this Node allows read access to its local coordinates to virtual world (Vworld) coordinates transform.- See Also:
- Constant Field Values
-
ALLOW_PARENT_READ
public static final int ALLOW_PARENT_READ
Specifies that this Node allows read access to its parent Group node.- Since:
- Java 3D 1.4
- See Also:
- Constant Field Values
-
ALLOW_LOCALE_READ
public static final int ALLOW_LOCALE_READ
Specifies that this Node allows read access to its Locale.- Since:
- Java 3D 1.4
- See Also:
- Constant Field Values
-
-
Method Detail
-
getParent
public Node getParent()
- Returns:
- the parent of this node, or null if this node has no parent
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setBounds
public void setBounds(Bounds bounds)
Sets the geometric bounds of a node.- Parameters:
bounds
- the bounding object for a node- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
getBounds
public Bounds getBounds()
Returns the bounding object of a node.- Returns:
- the node's bounding object
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphSceneGraphCycleException
- if there is a cycle in the scene graph
-
getCollidable
public boolean getCollidable()
Returns the collidable value; this value determines whether this node and it's children, if a group node, can be considered for collision purposes; if it is set to false, then neither this node nor any children nodes will be traversed for collision purposes; the default value is true. The collidable setting is the way that an application can perform collision culling.- Returns:
- the present collidable value for this node
-
setCollidable
public void setCollidable(boolean collidable)
Sets the collidable value; determines whether this node and any of its children, if a group node, can be considered for collision purposes.- Parameters:
collidable
- the new collidable value for this node
-
setBoundsAutoCompute
public void setBoundsAutoCompute(boolean autoCompute)
Turns the automatic calcuation of geometric bounds of a node on/off.- Parameters:
autoCompute
- indicates if the node's bounding object is automatically computed.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
getBoundsAutoCompute
public boolean getBoundsAutoCompute()
Gets the value indicating if the automatic calcuation of geometric bounds of a node is on/off.- Returns:
- the node's auto compute flag for the geometric bounding object
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
getLocalToVworld
public void getLocalToVworld(Transform3D t)
Retrieves the local coordinates to virtual world coordinates transform for this node in the scene graph. This is the composite of all transforms in the scene graph from the root down tothis
node. It is only valid for nodes that are part of a live scene graph. If the node is not part of a live scene graph then the coordinates are calculated as if the graph was attached at the origin of a locale.- Parameters:
t
- the object that will receive the local coordinates to Vworld coordinates transform.- Throws:
RestrictedAccessException
- if the node is compiled but not part of a live scene graphCapabilityNotSetException
- if appropriate capability is not set and this node is part of live or compiled scene graphIllegalSharingException
- if the node is a descendant of a SharedGroup node.
-
getLocalToVworld
public void getLocalToVworld(SceneGraphPath path, Transform3D t)
Retrieves the local coordinates to virtual world coordinates transform for the particular path in the scene graph ending with this node. This is the composite of all transforms in the scene graph from the root down tothis
node via the specified Link nodes. It is only valid for nodes that are part of a live scene graph.- Parameters:
path
- the specific path from the node to the Localet
- the object that will receive the local coordinates to Vworld coordinates transform.- Throws:
RestrictedAccessException
- if the node is not part of a live scene graphCapabilityNotSetException
- if appropriate capability is not set and this node is part of live scene graphjava.lang.IllegalArgumentException
- if the specified path does not contain a valid Locale, or if the last node in the path is different from this nodeIllegalSharingException
- if the node is not a descendant of a SharedGroup node.
-
getLocale
public Locale getLocale()
Retrieves the locale to which this node is attached. If the node is not part of a live scene graph, null is returned.- Returns:
- the locale to which this node is attached.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this node is part of live scene graphIllegalSharingException
- if the node is a descendant of a SharedGroup node.- Since:
- Java 3D 1.4
-
cloneTree
public Node cloneTree()
Duplicates all the nodes of the specified sub-graph. For Group Nodes the group node is duplicated via a call tocloneNode
and thencloneTree
is called for each child node. For Leaf Nodes, component data can either be duplicated or be made a reference to the original data. Leaf Node cloneTree behavior is determined by theduplicateOnCloneTree
flag found in every Leaf Node's component data class and by theforceDuplicate
paramter.- Returns:
- a reference to the cloned sub-graph.
- Throws:
DanglingReferenceException
- When a dangling reference is discovered during the cloneTree operation.RestrictedAccessException
- if this object is part of live or compiled scene graphSceneGraphCycleException
- if there is a cycle in the scene graph- See Also:
NodeComponent.setDuplicateOnCloneTree(boolean)
-
cloneTree
public Node cloneTree(boolean forceDuplicate)
Duplicates all the nodes of the specified sub-graph. For Group Nodes the group node is duplicated via a call tocloneNode
and thencloneTree
is called for each child node. For Leaf Nodes, component data can either be duplicated or be made a reference to the original data. Leaf Node cloneTree behavior is determined by theduplicateOnCloneTree
flag found in every Leaf Node's component data class and by theforceDuplicate
paramter.- Parameters:
forceDuplicate
- when set totrue
, causes theduplicateOnCloneTree
flag to be ignored. Whenfalse
, the value of each node'sduplicateOnCloneTree
determines whether data is duplicated or copied.- Returns:
- a reference to the cloned scene graph.
- Throws:
DanglingReferenceException
- When a dangling reference is discovered during the cloneTree operation.RestrictedAccessException
- if this object is part of live or compiled scene graphSceneGraphCycleException
- if there is a cycle in the scene graph- See Also:
NodeComponent.setDuplicateOnCloneTree(boolean)
-
cloneTree
public Node cloneTree(boolean forceDuplicate, boolean allowDanglingReferences)
Duplicates all the nodes of the specified sub-graph. For Group Nodes the group node is duplicated via a call tocloneNode
and thencloneTree
is called for each child node. For Leaf Nodes, component data can either be duplicated or be made a reference to the original data. Leaf Node cloneTree behavior is determined by theduplicateOnCloneTree
flag found in every Leaf Node's component data class and by theforceDuplicate
paramter.- Parameters:
forceDuplicate
- when set totrue
, causes theduplicateOnCloneTree
flag to be ignored. Whenfalse
, the value of each node'sduplicateOnCloneTree
determines whether data is duplicated or copied.allowDanglingReferences
- when set totrue
allows thecloneTree
method to complete even whan a dangling reference is discovered. When this parameter isfalse
aDanglingReferenceException
is generated as soon as cloneTree detects this situation.- Returns:
- a reference to the cloned scene graph.
- Throws:
DanglingReferenceException
- When a dangling reference is discovered during the cloneTree operation and theallowDanglingReference
parameter is false.RestrictedAccessException
- if this object is part of live or compiled scene graphSceneGraphCycleException
- if there is a cycle in the scene graph- See Also:
NodeComponent.setDuplicateOnCloneTree(boolean)
-
cloneTree
public Node cloneTree(NodeReferenceTable referenceTable)
Duplicates all the nodes of the specified sub-graph. For Group Nodes the group node is duplicated via a call tocloneNode
and thencloneTree
is called for each child node. For Leaf Nodes, component data can either be duplicated or be made a reference to the original data. Leaf Node cloneTree behavior is determined by theduplicateOnCloneTree
flag found in every Leaf Node's component data class and by theforceDuplicate
paramter.- Parameters:
referenceTable
- table that stores the mapping between original and cloned nodes. All previous values in the referenceTable will be cleared before the clone is made.- Returns:
- a reference to the cloned sub-graph.
- Throws:
DanglingReferenceException
- When a dangling reference is discovered during the cloneTree operation.RestrictedAccessException
- if this object is part of live or compiled scene graphSceneGraphCycleException
- if there is a cycle in the scene graph- Since:
- Java 3D 1.2
- See Also:
NodeComponent.setDuplicateOnCloneTree(boolean)
-
cloneTree
public Node cloneTree(NodeReferenceTable referenceTable, boolean forceDuplicate)
Duplicates all the nodes of the specified sub-graph. For Group Nodes the group node is duplicated via a call tocloneNode
and thencloneTree
is called for each child node. For Leaf Nodes, component data can either be duplicated or be made a reference to the original data. Leaf Node cloneTree behavior is determined by theduplicateOnCloneTree
flag found in every Leaf Node's component data class and by theforceDuplicate
paramter.- Parameters:
referenceTable
- table that stores the mapping between original and cloned nodes. All previous values in the referenceTable will be cleared before the clone is made.forceDuplicate
- when set totrue
, causes theduplicateOnCloneTree
flag to be ignored. Whenfalse
, the value of each node'sduplicateOnCloneTree
determines whether data is duplicated or copied.- Returns:
- a reference to the cloned scene graph.
- Throws:
DanglingReferenceException
- When a dangling reference is discovered during the cloneTree operation.RestrictedAccessException
- if this object is part of live or compiled scene graphSceneGraphCycleException
- if there is a cycle in the scene graph- Since:
- Java 3D 1.2
- See Also:
NodeComponent.setDuplicateOnCloneTree(boolean)
-
cloneTree
public Node cloneTree(NodeReferenceTable referenceTable, boolean forceDuplicate, boolean allowDanglingReferences)
Duplicates all the nodes of the specified sub-graph. For Group Nodes the group node is duplicated via a call tocloneNode
and thencloneTree
is called for each child node. For Leaf Nodes, component data can either be duplicated or be made a reference to the original data. Leaf Node cloneTree behavior is determined by theduplicateOnCloneTree
flag found in every Leaf Node's component data class and by theforceDuplicate
paramter.- Parameters:
referenceTable
- table that stores the mapping between original and cloned nodes. All previous values in the referenceTable will be cleared before the clone is made.forceDuplicate
- when set totrue
, causes theduplicateOnCloneTree
flag to be ignored. Whenfalse
, the value of each node'sduplicateOnCloneTree
determines whether data is duplicated or copied.allowDanglingReferences
- when set totrue
allows thecloneTree
method to complete even whan a dangling reference is discovered. When this parameter isfalse
aDanglingReferenceException
is generated as soon as cloneTree detects this situation.- Returns:
- a reference to the cloned scene graph.
- Throws:
DanglingReferenceException
- When a dangling reference is discovered during the cloneTree operation.RestrictedAccessException
- if this object is part of live or compiled scene graphSceneGraphCycleException
- if there is a cycle in the scene graph- Since:
- Java 3D 1.2
- See Also:
NodeComponent.setDuplicateOnCloneTree(boolean)
-
cloneNode
public Node cloneNode(boolean forceDuplicate)
Used to create a new instance of the node. This routine is called bycloneTree
to duplicate the current node.cloneNode
should be overridden by any user subclassed objects. All subclasses must have theircloneNode
method consist of the following lines:
NOTE: Applications should not call this method directly. It should only be called by the cloneTree method.public Node cloneNode(boolean forceDuplicate) { UserSubClass usc = new UserSubClass(); usc.duplicateNode(this, forceDuplicate); return usc; }
- Parameters:
forceDuplicate
- when set totrue
, causes theduplicateOnCloneTree
flag to be ignored. Whenfalse
, the value of each node'sduplicateOnCloneTree
variable determines whether NodeComponent data is duplicated or copied.- Throws:
RestrictedAccessException
- if this object is part of live or compiled scene graph- See Also:
cloneTree()
,duplicateNode(javax.media.j3d.Node, boolean)
,NodeComponent.setDuplicateOnCloneTree(boolean)
-
duplicateNode
public void duplicateNode(Node originalNode, boolean forceDuplicate)
Copies all node information fromoriginalNode
into the current node. This method is called from thecloneNode
method which is, in turn, called by thecloneTree
method.For any
NodeComponent
objects contained by the object being duplicated, eachNodeComponent
object'sduplicateOnCloneTree
value is used to determine whether theNodeComponent
should be duplicated in the new node or if just a reference to the current node should be placed in the new node. This flag can be overridden by setting theforceDuplicate
parameter in thecloneTree
method totrue
.
NOTE: Applications should not call this method directly. It should only be called by the cloneNode method.- Parameters:
originalNode
- the original node to duplicate.forceDuplicate
- when set totrue
, causes theduplicateOnCloneTree
flag to be ignored. Whenfalse
, the value of each node'sduplicateOnCloneTree
variable determines whether NodeComponent data is duplicated or copied.- See Also:
Group.cloneNode(boolean)
,duplicateNode(javax.media.j3d.Node, boolean)
,cloneTree()
,NodeComponent.setDuplicateOnCloneTree(boolean)
-
setPickable
public void setPickable(boolean pickable)
When set totrue
thisNode
can be Picked. Setting to false indicates that this node and it's children are ALL unpickable.- Parameters:
pickable
- Indicates if this node should be pickable or not
-
getPickable
public boolean getPickable()
Returns true if thisNode
is pickable, false if it is not pickable.
-
-