Package com.sun.j3d.utils.universe
Class SimpleUniverse
java.lang.Object
javax.media.j3d.VirtualUniverse
com.sun.j3d.utils.universe.SimpleUniverse
- Direct Known Subclasses:
ConfiguredUniverse
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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a locale, a single ViewingPlatform, and and a Viewer object (both with their default values).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.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
(Canvas3D canvas, int numTransforms, LocaleFactory localeFactory) 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, URL userConfig) Deprecated.use ConfiguredUniverse constructors to read a configuration fileSimpleUniverse
(HiResCoord origin, int numTransforms, Canvas3D canvas, URL userConfig, LocaleFactory localeFactory) Deprecated.use ConfiguredUniverse constructors to read a configuration file -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Returns the Canvas3D object associated with this Java 3D Universe.getCanvas
(int canvasNum) Returns the Canvas3D object at the specified index associated with this Java 3D Universe.Returns the Locale object associated with this scene graph.static GraphicsConfiguration
Finds the preferredGraphicsConfiguration
object for the system.Returns the Viewer object associated with this scene graph.Returns the ViewingPlatform object associated with this scene graph.Methods inherited from class javax.media.j3d.VirtualUniverse
addGraphStructureChangeListener, addRenderingErrorListener, addShaderErrorListener, getAllLocales, getJ3DThreadPriority, getProperties, numLocales, removeAllLocales, removeGraphStructureChangeListener, removeLocale, removeRenderingErrorListener, removeShaderErrorListener, setJ3DThreadPriority
-
Field Details
-
locale
Locale reference needed to create the "view" portion of the scene graph. -
viewer
Viewer reference needed to create the "view" portion of the scene graph.
-
-
Constructor Details
-
SimpleUniverse
public SimpleUniverse()Creates a locale, a single ViewingPlatform, and and a Viewer object (both with their default values).- See Also:
-
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:
-
SimpleUniverse
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:
-
SimpleUniverse
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:
-
SimpleUniverse
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.localeFactory
- Factory for creating the locale- Since:
- Java 3D 1.5.1
- See Also:
-
SimpleUniverse
Deprecated.use ConfiguredUniverse constructors to read a configuration fileCreates 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:
-
SimpleUniverse
public SimpleUniverse(HiResCoord origin, int numTransforms, Canvas3D canvas, URL userConfig, LocaleFactory localeFactory) Deprecated.use ConfiguredUniverse constructors to read a configuration fileCreates 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:
-
SimpleUniverse
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
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 Details
-
getLocale
Returns the Locale object associated with this scene graph.- Returns:
- The Locale object used in the construction of this scene graph.
-
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
Returns the ViewingPlatform object associated with this scene graph.- Returns:
- The ViewingPlatform object of this scene graph.
-
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:
-
getCanvas
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
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
Finds the preferredGraphicsConfiguration
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.
-