com.vwp.j3d.utils.universe
Class MultiUniverse

java.lang.Object
  extended by VirtualUniverse
      extended by com.vwp.j3d.utils.universe.MultiUniverse

public class MultiUniverse
extends VirtualUniverse

This class sets up a user environment to quickly and easily get a Java 3D program up and running with more than one View and Canvas3D. This class bases on the SimpleUniverse and creates all the necessary objects on the "view" side of the scene graph. Specifically, this class creates a locale, ViewingPlatforms and Viewer objects (all with their default values).


Constructor Summary
MultiUniverse(int numTransforms)
          Creates a locale and prepares for the given number of transforms (and therefore View, ViewPlatform and Canvas3D objects).
 
Method Summary
 void addBranchGraph(BranchGroup bg)
          Used to add Nodes to the geometry side (as opposed to the view side) of the scene graph.
 void cleanup()
          Cleanup memory use and reference by MultiUniverse.
 View createView(Canvas3D canvas)
          This method attaches the given Canvas3D object to the universe and creates the required ViewPlatform and View object for it.
 Viewer getViewer(int num)
          Returns the Viewer object associated with this scene graph.
 ViewingPlatform getViewingPlatform(int num)
          Returns the ViewingPlatform object associated with this scene graph and with the specified Canvas3D-number.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiUniverse

public MultiUniverse(int numTransforms)
Creates a locale and prepares for the given number of transforms (and therefore View, ViewPlatform and Canvas3D objects). This constructor does not create the necessary views, to do that, use method

Parameters:
numTransforms - The number of View-Transforms and Canvas3D objects which have to becontrolled by this object
See Also:
createView(Canvas3D canvas)
Method Detail

createView

public View createView(Canvas3D canvas)
This method attaches the given Canvas3D object to the universe and creates the required ViewPlatform and View object for it. This method has to be called as often as much numTransforms habe been specified for this methods constructor. The created Viewer- and View objects can be accessed using the appropriate get-methods. The required number is identically with the number of createView()-calls related to the view.

Parameters:
canvas - the Canvas3D object which has to be attached to the Universe
Returns:
the View object which was created for this Canvas3Ds view

getViewer

public Viewer getViewer(int num)
Returns the Viewer object associated with this scene graph. MultiUniverse creates a Viewer object for every attached Canvas3D.

Parameters:
num - Specifies the number of the View which has to be returned. This number isequal to the number of createView()-calls which have been necessary to set up the View for the Canvas3D
Returns:
The Viewer object associated with this scene graph

getViewingPlatform

public ViewingPlatform getViewingPlatform(int num)
Returns the ViewingPlatform object associated with this scene graph and with the specified Canvas3D-number.

Parameters:
num - specifies the number of the View which has to be returned. This number isequal to the number of createView()-calls which have been necessary to set up the View for the Canvas3D
Returns:
The ViewingPlatform object of this scene graph.

addBranchGraph

public void addBranchGraph(BranchGroup bg)
Used to add Nodes to the geometry side (as opposed to the view side) of the scene graph. This is a short cut to getting the Locale object and calling that object's addBranchGraph() method.

Parameters:
bg - the BranchGroup to attach to this Universe's Locale.

cleanup

public void cleanup()
Cleanup memory use and reference by MultiUniverse. Typically it should be invoked by the applet's destroy method.