com.sun.j3d.utils.universe
Class SimpleUniverse

java.lang.Object
  extended by javax.media.j3d.VirtualUniverse
      extended by com.sun.j3d.utils.universe.SimpleUniverse
Direct Known Subclasses:
ConfiguredUniverse

public class SimpleUniverse
extends VirtualUniverse

This class sets up a minimal user environment to quickly and easily get a Java 3D program up and running. This utility class creates all the necessary objects on the "view" side of the scene graph. Specifically, this class creates a locale, a single ViewingPlatform, and a Viewer object (both with their default values). Many basic Java 3D applications will find that SimpleUniverse provides all necessary functionality needed by their applications. More sophisticated applications may find that they need more control in order to get extra functionality and will not be able to use this class.

See Also:
Viewer, ViewingPlatform

Field Summary
protected  Locale locale
          Locale reference needed to create the "view" portion of the scene graph.
protected  Viewer[] viewer
          Viewer reference needed to create the "view" portion of the scene graph.
 
Constructor Summary
SimpleUniverse()
          Creates a locale, a single ViewingPlatform, and and a Viewer object (both with their default values).
SimpleUniverse(Canvas3D canvas)
          Creates a locale, a single ViewingPlatform (with default values), and and a Viewer object.
SimpleUniverse(Canvas3D canvas, int numTransforms)
          Creates a locale, a single ViewingPlatform, and a Viewer object The Viewer object uses default values for everything but the canvas.
SimpleUniverse(HiResCoord origin, int numTransforms, Canvas3D canvas, java.net.URL userConfig)
          Deprecated. use ConfiguredUniverse constructors to read a configuration file
SimpleUniverse(HiResCoord origin, int numTransforms, Canvas3D canvas, java.net.URL userConfig, LocaleFactory localeFactory)
          Deprecated. use ConfiguredUniverse constructors to read a configuration file
SimpleUniverse(int numTransforms)
          Creates a locale, a single ViewingPlatform, and a Viewer object (with default values).
SimpleUniverse(ViewingPlatform viewingPlatform, Viewer viewer)
          Creates the "view" side of the scene graph.
SimpleUniverse(ViewingPlatform viewingPlatform, Viewer viewer, LocaleFactory localeFactory)
          Creates the "view" side of the scene graph.
 
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 SimpleUniverse.
 Canvas3D getCanvas()
          Returns the Canvas3D object associated with this Java 3D Universe.
 Canvas3D getCanvas(int canvasNum)
          Returns the Canvas3D object at the specified index associated with this Java 3D Universe.
 Locale getLocale()
          Returns the Locale object associated with this scene graph.
static java.awt.GraphicsConfiguration getPreferredConfiguration()
          Finds the preferred GraphicsConfiguration object for the system.
 Viewer getViewer()
          Returns the Viewer object associated with this scene graph.
 ViewingPlatform getViewingPlatform()
          Returns the ViewingPlatform object associated with this scene graph.
 
Methods inherited from class javax.media.j3d.VirtualUniverse
getAllLocales, getJ3DThreadPriority, getProperties, numLocales, removeAllLocales, removeLocale, setJ3DThreadPriority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locale

protected Locale locale
Locale reference needed to create the "view" portion of the scene graph.


viewer

protected Viewer[] viewer
Viewer reference needed to create the "view" portion of the scene graph.

Constructor Detail

SimpleUniverse

public SimpleUniverse()
Creates a locale, a single ViewingPlatform, and and a Viewer object (both with their default values).

See Also:
Locale, Viewer, ViewingPlatform

SimpleUniverse

public SimpleUniverse(int numTransforms)
Creates a locale, a single ViewingPlatform, and a Viewer object (with default values). The ViewingPlatform is created with the specified number of TransformGroups.

Parameters:
numTransforms - The number of transforms to be in the MultiTransformGroup object.
Since:
Java 3D 1.2.1
See Also:
Locale, Viewer, ViewingPlatform

SimpleUniverse

public SimpleUniverse(Canvas3D canvas)
Creates a locale, a single ViewingPlatform (with default values), and and a Viewer object. The Viewer object uses default values for everything but the canvas.

Parameters:
canvas - The canvas to associate with the Viewer object. Passing in null will cause this parameter to be ignored and a canvas to be created by the utility.
See Also:
Locale, Viewer, ViewingPlatform

SimpleUniverse

public SimpleUniverse(Canvas3D canvas,
                      int numTransforms)
Creates a locale, a single ViewingPlatform, and a Viewer object The Viewer object uses default values for everything but the canvas. The ViewingPlatform is created with the specified number of TransformGroups.

Parameters:
canvas - The canvas to associate with the Viewer object. Passing in null will cause this parameter to be ignored and a canvas to be created by the utility.
numTransforms - The number of transforms to be in the MultiTransformGroup object.
Since:
Java 3D 1.2.1
See Also:
Locale, Viewer, ViewingPlatform, MultiTransformGroup

SimpleUniverse

public SimpleUniverse(HiResCoord origin,
                      int numTransforms,
                      Canvas3D canvas,
                      java.net.URL userConfig)
Deprecated. use ConfiguredUniverse constructors to read a configuration file

Creates the "view" side of the scene graph. The passed in parameters override the default values where appropriate.

Parameters:
origin - The origin used to set the origin of the Locale object. If this object is null, then 0.0 is used.
numTransforms - The number of transforms to be in the MultiTransformGroup object.
canvas - The canvas to draw into. If this is null, it is ignored and a canvas will be created by the utility.
userConfig - The URL to the user's configuration file, used by the Viewer object. This is never examined and default values are always taken.
See Also:
Locale, Viewer, ViewingPlatform, MultiTransformGroup

SimpleUniverse

public SimpleUniverse(HiResCoord origin,
                      int numTransforms,
                      Canvas3D canvas,
                      java.net.URL userConfig,
                      LocaleFactory localeFactory)
Deprecated. use ConfiguredUniverse constructors to read a configuration file

Creates the "view" side of the scene graph. The passed in parameters override the default values where appropriate.

Parameters:
origin - The origin used to set the origin of the Locale object. If this object is null, then 0.0 is used.
numTransforms - The number of transforms to be in the MultiTransformGroup object.
canvas - The canvas to draw into. If this is null, it is ignored and a canvas will be created by the utility.
userConfig - The URL to the user's configuration file, used by the Viewer object. This is never examined and default values are always taken.
localeFactory - The Locale Factory which will instantiate the locale(s) for this universe.
See Also:
Locale, Viewer, ViewingPlatform, MultiTransformGroup

SimpleUniverse

public SimpleUniverse(ViewingPlatform viewingPlatform,
                      Viewer viewer)
Creates the "view" side of the scene graph. The passed in parameters override the default values where appropriate.

Parameters:
viewingPlatform - The viewingPlatform to use to create the "view" side of the scene graph.
viewer - The viewer object to use to create the "view" side of the scene graph.

SimpleUniverse

public SimpleUniverse(ViewingPlatform viewingPlatform,
                      Viewer viewer,
                      LocaleFactory localeFactory)
Creates the "view" side of the scene graph. The passed in parameters override the default values where appropriate.

Parameters:
viewingPlatform - The viewingPlatform to use to create the "view" side of the scene graph.
viewer - The viewer object to use to create the "view" side of the scene graph.
localeFactory - The factory used to create the Locale Object
Method Detail

getLocale

public Locale getLocale()
Returns the Locale object associated with this scene graph.

Returns:
The Locale object used in the construction of this scene graph.

getViewer

public Viewer getViewer()
Returns the Viewer object associated with this scene graph. SimpleUniverse creates a single Viewer object for use in the scene graph.

Returns:
The Viewer object associated with this scene graph.

getViewingPlatform

public ViewingPlatform getViewingPlatform()
Returns the ViewingPlatform object associated with this scene graph.

Returns:
The ViewingPlatform object of this scene graph.

getCanvas

public Canvas3D getCanvas()
Returns the Canvas3D object associated with this Java 3D Universe.

Returns:
A reference to the Canvas3D object associated with the Viewer object. This method is equivalent to calling getCanvas(0).
See Also:
Viewer

getCanvas

public Canvas3D getCanvas(int canvasNum)
Returns the Canvas3D object at the specified index associated with this Java 3D Universe.

Parameters:
canvasNum - The index of the Canvas3D object to retrieve. If there is no Canvas3D object for the given index, null is returned.
Returns:
A reference to the Canvas3D object associated with the Viewer object.

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.

getPreferredConfiguration

public static java.awt.GraphicsConfiguration getPreferredConfiguration()
Finds the preferred GraphicsConfiguration object for the system. This object can then be used to create the Canvas3D objet for this system.

Returns:
The best GraphicsConfiguration object for the system.

cleanup

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