It is possible to create an illegal scene graph. An example illegal scene graph is shown in Figure 1-3.
The scene graph depicted in Figure 1-3 is illegal because it violates the properties for a DAG. The
problem lies only with the two TransformGroup objects having the same Shape3D leaf object as
children. Remember a Leaf object may have only one parent. In other words, there can only be one path
from a Locale object to a leaf (or one path from a leaf to a Locale).
You may think the structure shown in Figure 1-3 defines three visual objects in a virtual universe. It
appears as though the scene graph defines two visual objects through re-use of the visual (Shape3D)
object on the right-hand side of the figure. Conceptually, each of the TransformGroup objects parenting
the shared instance of Shape3D could place an image of the visual object in different locations.
However, it is an illegal scene graph since the parent-child arcs do not form a tree. In this example, the
result is that the Shape3D object has more than one parent.
The discussion of the tree and DAG structures are correct. However, the Java 3D runtime system reports
the mistake in terms of child-parent relationships. One result of the tree structure limitation is that each
Shape3D object is restricted to one parent. For the example scene graph of Figure 1-3, a 'multiple parent'
exception is reported at runtime. Figure 1-4, with one parent for each Shape3D object, shows one
possible fix for this scene graph.