Figure 1-6 Recipe for Writing Java 3D Programs
This recipe ignores some detail but illustrates the fundamental concept of all Java 3D programming:
creating each branch graph of the scene graph is the majority of the programming. Rather than expand
on this recipe, the next section explains an easier way to construct a very similar scene graph with less
programming.
1.4.1 A Simple Recipe for Writing Java 3D Programs
Java 3D programs written using the basic recipe have view branch graphs with identical structure. The
regularity of view branch graph structure is also found in the SimpleUniverse Utility class. Instances of
SimpleUniverse perform steps 2, 3, and 4 from the basic recipe. Using the SimpleUniverse class in Java
3D programming significantly reduces the time and effort needed to create the view branch graph.
Consequently, the programmer has more time to concentrate on the content. This is what writing a Java
3D program is really about.
The SimpleUniverse is a good starting point for Java 3D programming because it allows the programmer
to ignore the view branch graph. However, using the SimpleUniverse does not allow having multiple
views of the virtual universe.
The SimpleUniverse class is used in all the programming examples in this tutorial. Programmers who
need more information on View, ViewPlatform, PhysicalBody, and PhysicalEnvironment classes are
referred to other references. See Appendix B for a list of references.
SimpleUniverse Class
The SimpleUniverse object constructor creates a scene graph including VirtualUniverse and Locale
objects, and a complete view branch graph. The view branch graph created by SimpleUniverse uses
instances of ViewingPlatform and Viewer convenience classes in place of the core classes used to create
the view branch graph. Note the SimpleUniverse only indirectly uses the View and ViewPlatform
objects of the Java 3D core. The SimpleUniverse object supplies the functionality of all of the objects
inside the large box in Figure 1-7.
The com.sun.j3d.utils.universe package contains the SimpleUniverse, ViewingPlatform, and
Viewer convenience utility classes.