javax.media.j3d
Class BranchGroup

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.Node
              |
              +--javax.media.j3d.Group
                    |
                    +--javax.media.j3d.BranchGroup

public class BranchGroup
extends Group

The BranchGroup serves as a pointer to the root of a scene graph branch; BranchGroup objects are the only objects that can be inserted into a Locale's set of objects.


Field Summary
static int ALLOW_DETACH
          For BranchGroup nodes, specifies that this BranchGroup allows detaching from its parent.
 
Fields inherited from class javax.media.j3d.Group
ALLOW_CHILDREN_EXTEND, ALLOW_CHILDREN_READ, ALLOW_CHILDREN_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_PICK, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
BranchGroup()
          Constructs and initializes a new BranchGroup node object.
 
Method Summary
 Node cloneNode(boolean forceDuplicate)
          Creates a new instance of the node.
 void compile()
          Compiles the source BranchGroup associated with this object and creates and caches a compiled scene graph.
 void detach()
          Detaches this BranchGroup from its parent.
 void duplicateNode(Node originalNode, boolean forceDuplicate)
          Copies all node information from originalNode into the current node.
 SceneGraphPath[] pickAll(PickShape pickShape)
          Returns an array referencing all the items that are pickable below this BranchGroup that intersect with PickShape.
 SceneGraphPath[] pickAllSorted(PickShape pickShape)
          Returns a sorted array of references to all the Pickable items that intersect with the pickShape.
 SceneGraphPath pickAny(PickShape pickShape)
          Returns a reference to any item that is Pickable below this BranchGroup which intersects with pickShape.
 SceneGraphPath pickClosest(PickShape pickShape)
          Returns a SceneGraphPath which references the pickable item which is closest to the origin of pickShape.
 
Methods inherited from class javax.media.j3d.Group
addChild, getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, insertChild, moveTo, numChildren, removeChild, setAlternateCollisionTarget, setChild, setCollisionBounds
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, getBounds, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_DETACH

public static final int ALLOW_DETACH
For BranchGroup nodes, specifies that this BranchGroup allows detaching from its parent.
Constructor Detail

BranchGroup

public BranchGroup()
Constructs and initializes a new BranchGroup node object.
Method Detail

compile

public final void compile()
Compiles the source BranchGroup associated with this object and creates and caches a compiled scene graph.

detach

public final void detach()
Detaches this BranchGroup from its parent.

pickAll

public final SceneGraphPath[] pickAll(PickShape pickShape)
Returns an array referencing all the items that are pickable below this BranchGroup that intersect with PickShape. The resultant array is unordered.
Parameters:
origin - The origin of the ray
direction - the direction of the ray
Throws:
java.lang.IllegalStateException - if BranchGroup is not live.
See Also:
SceneGraphPath, Locale.pickAll(javax.media.j3d.PickShape)

pickAllSorted

public final SceneGraphPath[] pickAllSorted(PickShape pickShape)
Returns a sorted array of references to all the Pickable items that intersect with the pickShape. Element [0] references the item closest to origin of PickShape successive array elements are further from the origin Note: If pickShape is of type PickBounds, the resultance array is unordered.
Throws:
java.lang.IllegalStateException - if BranchGroup is not live.
See Also:
SceneGraphPath, Locale.pickAllSorted(javax.media.j3d.PickShape), PickShape

pickClosest

public final SceneGraphPath pickClosest(PickShape pickShape)
Returns a SceneGraphPath which references the pickable item which is closest to the origin of pickShape. Note: If pickShape is of type PickBounds, the return is any pickable node below this BranchGroup.
Throws:
java.lang.IllegalStateException - if BranchGroup is not live.
See Also:
SceneGraphPath, Locale.pickClosest(javax.media.j3d.PickShape), PickShape

pickAny

public final SceneGraphPath pickAny(PickShape pickShape)
Returns a reference to any item that is Pickable below this BranchGroup which intersects with pickShape.
Throws:
java.lang.IllegalStateException - if BranchGroup is not live.
See Also:
SceneGraphPath, Locale.pickAny(javax.media.j3d.PickShape), PickShape

cloneNode

public Node cloneNode(boolean forceDuplicate)
Creates a new instance of the node. This routine is called by cloneTree to duplicate the current node.
Overrides:
cloneNode in class Group
Parameters:
forceDuplicate - when set to true, causes the duplicateOnCloneTree flag to be ignored. When false, the value of each node's duplicateOnCloneTree variable determines whether NodeComponent data is duplicated or copied.
See Also:
Node.cloneTree(), Node.cloneNode(boolean), Node.duplicateNode(javax.media.j3d.Node, boolean), NodeComponent.setDuplicateOnCloneTree(boolean)

duplicateNode

public void duplicateNode(Node originalNode,
                          boolean forceDuplicate)
Copies all node information from originalNode into the current node. This method is called from the cloneNode method which is, in turn, called by the cloneTree method.

For any NodeComponent objects contained by the object being duplicated, each NodeComponent object's duplicateOnCloneTree value is used to determine whether the NodeComponent 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 the forceDuplicate parameter in the cloneTree method to true.

Overrides:
duplicateNode in class Group
Parameters:
originalNode - the original node to duplicate.
forceDuplicate - when set to true, causes the duplicateOnCloneTree flag to be ignored. When false, the value of each node's duplicateOnCloneTree variable determines whether NodeComponent data is duplicated or copied.
See Also:
Group.cloneNode(boolean), Node.duplicateNode(javax.media.j3d.Node, boolean), Node.cloneTree(), NodeComponent.setDuplicateOnCloneTree(boolean)