BranchGroup objects can be compiled. Compiling a BranchGroup converts the BranchGroup object and
all of its ancestors to a more efficient form for the renderer. Compiling BranchGroup objects is
recommended as the last step before making it live. It is best to only compile the BranchGroup objects
inserted into Locales. Compilation is further discussed in sections 1.8 and 1.8.1.
BranchGroup compile() Method
void compile()
Compiles the source BranchGroup associated with this object by creating and caching a compiled scene
graph.
Concepts of compiled and live are implemented in the SceneGraphObject class. The two methods of the
SceneGraphObject class that relate to these concepts are shown in the SceneGraphObject methods
reference box below.
SceneGraphObject Methods (partial list)
SceneGraphObject is the superclass of nearly every class used to create a scene graph including Group,
Leaf, and NodeComponent. The SceneGraphObject provides a number of common methods and fields
for its subclasses; two of which are presented here. The methods of SceneGraphObject associated with
“compile” are covered in Section 1.8 Performance Basics.
boolean isCompiled()
Returns a flag indicating whether the node is part of a scene graph that has been compiled.
boolean isLive()
Returns a flag indicating whether the node is part of a live scene graph.
Note there is no “start the renderer” step in either the basic or simple recipes. The Java 3D renderer
starts running in an infinite loop when a branch graph containing an instance of View becomes live in a
virtual universe. Once started, the Java 3D renderer conceptually performs the operations shown in
Figure 1-10.