mjbWorld program - Structure

There are 3 types of data that need to be held internally in the program.

  1. The Java 3D uses the scene graph structure which contains data used to render the scene
  2. The data for the tree control used to select and display parameters for the nodes.

These are all tree structures, so can we use one tree containing a set of classes which store all of this information? It might be possible by using the Java 3D scene graph structure classes and then extending them to hold the other information.

Scene Graph Structure

When it starts up mjbWorld creates a defualt scene graph under which the user can add their own structure consisting of whatever groups, shapes, etc. that they need to use.

This default scene graph provides a basic set of functionality so that the user does not need to wory about the basic infrastructure. This includes a view, a light and various handles, bounding boxes and pick behaviors to allow the user to manipulate the objects. If the application being built does not require these objects they can be edited out of the source code, but it may be worthwhile to keep them in while the program is being constructed to help build any 3D objects that will be needed

Tree Control

So there are two parallel trees, in most cases a node in the Scene Graph is paired with an instance of a mjbWorld class (with a name ending with 'Bean'). At the root of the tree some 'short cut' links have been added. For example a link has been added so that the user can go straight to the scene without having to drill down though the localle, branchgroup, etc.

The following diagrams shows how the classes are typically instanciated as the program is running. The classes on the right are the java3D scenegraph structure, on the left is the parallel customised structure to hold data specific to this program. The two structures are cross-linked.


rootBean is the corresponding class to VirtualUniverse in the scene graph structure.

rootBean is at the top of the hierachy and below it is localeBean

Classes written for this program Java3D classes (scene graph structure)




Classes written for this program Java3D classes (scene graph structure)

Model Interface


Java3D Modes used

mjbWorld supports the various Java3D modes:

Immediate Mode

In this mode shapes can be drawn individually by calling GraphicsContext3D.draw(Geometry geometry). This is used by the program to draw the control points, see below.

Pure Immediate Mode
Mixed Immediate Mode

Retained Mode

to use this mode attach branch group to locale making it live.

Retained Mode

Compiled-Retained Mode

to use this mode compile branch group - by pressing compile button



go back to Programmers guide main index

metadata block
see also:


Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.


Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2018 Martin John Baker - All rights reserved - privacy policy.