Java Reference
In-Depth Information
a room, and two VRML models in the laboratory. This higher level BG object also has an
attached picking behavior.
For the purpose of refreshing the displays of the oscilloscope and the signal generator,
the scene graph has two other lower level BG objects for attaching or detaching the two
respective display objects. The updating can then be done by using two associated Displa-
yUpdatingBehavior objects.
The scene graph also includes a view branch for managing the viewing platform or
user viewpoint. Appropriate navigating and collision detection behavior is attached to a
TG of this branch.
The code for the important high level functions for implementing the Applet for the
3D client Interface of the experiment is quite lengthy and is given in Appendices D and E.
Appendix D is the main Applet for the client interface. Certain statements in this appendix
invokes the code in Appendix E, which basically creates the scene graph for the application.
Note that the code are for the realization of a 3D world where the user can enter a virtual
laboratory by moving to press a button and walking through a door as shown in Figure 1.
After entering the laboratory, the user will see a 3D room with floor, ceiling, a few walls,
two windows with a view where aircrafts land and one door. To carry out the experiment,
the user can walk to a bench where an oscilloscope, a signal generator, a circuit board,
and a battery are placed.
As given in Appendix D, Section D.9 gives the entry to the main applet for the client
interface. This invokes the initialization function in Section D.3, which then loads the
VRML-based circuit board and the 3D scene. The handles to the navigation controls are
then obtained and the view mode is set up. After this, the pictures for texturing various
instruments and the 3D room are loaded.
The initialization function then invokes scene3d = new Scene3D in Section D.3 to create
a Java scene graph for the entire experiment. This Scene3D class is defined in Appendix E
and corresponds to the structure of Figure 4.
Specifically, Appendix E first uses the code in Section E.8 to create the appropriate
lighting environment by using spot, directional and ambient light sources. This section
then creates a Branch Group branchRoot, which corresponds to BG in Figure 4. All of the
light sources are added to this node as child nodes. Section E.7 is then invoked to obtain a
handle to BG so that the remaining parts of the scene graph can be constructed according
to the structure in Figure 4.
As an example, the Transform Group objTrans in the code segment corresponds to the
first TG node that lies just below the node BG in the scene graph, while the Transform
Group vpTrans corresponds to the TG in the View Platform branch of the scene graph.
According to the scene graph in Figure 4, the TG node corresponding to objTrans in the
code segment should have five child nodes. The one corresponding to the oscilloscope TG
is named osciTrans in the code segment. Similarly, the next one corresponding to the signal
generator TG is named sgTrans in the code segment.
Search WWH ::




Custom Search