< Zurück | Inhalt | Weiter >

5.8 SharedGroup and link

java.lang.Object

|

+−−javax.media.j3d.SceneGraphObject

|

+−−javax.media.j3d.Node

|

+−−javax.media.j3d.Group

|

+−−javax.media.j3d.SharedGroup


The SharedGroup Node defines a scenegraph management Node that can be attached to several parent Nodes. The SharedGroup itself can be arbitrarily complex but must occur (as a whole) as a Leaf Node within the scenegraph. A SharedGroup must be wrapped in an instance of a Link object before being added to the scenegraph. The Link must have one unique parent.


SharedGroups cannot contain the following Nodes:


Background

Behavior−derived

Clip

Fog

Soundscape

ViewPlatform

java.lang.Object

|

+−−javax.media.j3d.SceneGraphObject

|

+−−javax.media.j3d.Node

|

+−−javax.media.j3d.Leaf

|

+−−javax.media.j3d.Link


The Link Node is used in association with a SharedGroup. Since the SharedGroup can appear in several locations in the scenegraph, and a Node object can only have a single parent Node, a unique Link Node must be used as a placeholder within the scenegraph for the SharedGroup Node. When the scenegraph is traversed, and the Link Node is encountered, the traversal algorithm will step into the SharedGroup that is internally referenced by the Link Node (figure 5.4).


image


Figure 5.4 A Switch Node with two child Link Nodes. Both Link Nodes reference the same SharedGroup (SG). This type of structure is not possible without using Link Nodes as a single Node can only have one parent Node


 

From NodesTest.java