public class ConfiguredUniverse extends SimpleUniverse
ConfiguredUniverse can set up a viewing environment based upon the contents of a configuration file. This allows an application to run without change across a broad range of viewing configurations, such as windows on conventional desktops, stereo-enabled views, full screen immersive displays on single or multiple screens, or virtual reality installations including cave and head-mounted displays incorporating 6 degree of freedom sensor devices.
A configuration file may create InputDevice, Sensor, and ViewPlatformBehavior instances as well as Viewers and ViewingPlatforms. At least one Viewer must be provided by the configuration. If a ViewingPlatform is not provided, a default one will be created and the Viewer will be attached to it.
A configuration file may be specified directly by passing a URL to a ConfiguredUniverse constructor. Alternatively, a ConfigContainer may be created from a configuration file first, and then passed to an appropriate ConfiguredUniverse constructor. The latter technique allows Java system properties that affect Java 3D to be specified in the configuration file, as long as no references to a VirtualUniverse are made before creating the container.
If a configuration file or container is not provided, then ConfiguredUniverse creates a default viewing environment in the same way as SimpleUniverse. If one or more Canvas3D objects are provided, it will use them instead of creating new ones. All of the constructors provided by SimpleUniverse are also available here.
The syntax and description of the configuration file may be found here. Example config files can be found here.
Locale
,
Viewer
,
ViewingPlatform
,
ConfigContainer
,
The Java 3D Configuration File,
Example Configuration Fileslocale, viewer
Constructor and Description |
---|
ConfiguredUniverse()
Equivalent to
SimpleUniverse() . |
ConfiguredUniverse(Canvas3D canvas)
Equivalent to
SimpleUniverse(Canvas3D) . |
ConfiguredUniverse(Canvas3D[] canvases)
Creates a Locale, a single ViewingPlatform, and a Viewer object from
the given array of Canvas3D instances.
|
ConfiguredUniverse(Canvas3D[] canvases,
int transformCount)
Creates a Locale, a single ViewingPlatform with the specified number of
transforms, and a Viewer object using the given array of Canvas3D
instances.
|
ConfiguredUniverse(Canvas3D[] canvases,
int transformCount,
LocaleFactory localeFactory)
Creates a Locale, a single ViewingPlatform with the specified number of
transforms, and a Viewer object using the given array of Canvas3D
instances.
|
ConfiguredUniverse(Canvas3D canvas,
int transformCount)
Equivalent to
SimpleUniverse(Canvas3D, int) . |
ConfiguredUniverse(ConfigContainer userConfig)
Retrieves view-side scenegraph components from the given container to
create a universe with one Locale, one or more ViewingPlatforms, and at
least one Viewer object.
|
ConfiguredUniverse(ConfigContainer userConfig,
LocaleFactory localeFactory,
HiResCoord origin)
Retrieves view-side scenegraph components from the given container to
create a universe with one Locale created from the specified
LocaleFactory and origin, one or more ViewingPlatforms, and at least
one Viewer object.
|
ConfiguredUniverse(int transformCount)
Equivalent to
SimpleUniverse(int) . |
ConfiguredUniverse(URL userConfig)
Reads the configuration specified by the given URL to create a Locale,
one or more ViewingPlatforms, and at least one Viewer object.
|
ConfiguredUniverse(URL userConfig,
int transformCount)
Reads the configuration specified by the given URL to create a Locale,
one or more ViewingPlatforms with the specified number of transforms,
and at least one Viewer object.
|
ConfiguredUniverse(URL userConfig,
int transformCount,
boolean setVisible)
Reads the configuration specified by the given URL to create a Locale,
one or more ViewingPlatforms with the specified number of transforms,
and at least one Viewer object with optional visibility.
|
ConfiguredUniverse(URL userConfig,
LocaleFactory localeFactory)
Reads the configuration specified by the given URL to create a Locale
using the given LocaleFactory, one or more ViewingPlatforms, and at
least one Viewer object.
|
ConfiguredUniverse(URL userConfig,
LocaleFactory localeFactory,
boolean setVisible)
Reads the configuration specified by the given URL to create a Locale
using the given LocaleFactory, one or more ViewingPlatforms, and at
least one Viewer object with optional visibility.
|
ConfiguredUniverse(URL userConfig,
LocaleFactory localeFactory,
HiResCoord origin,
int transformCount,
boolean setVisible)
Reads the configuration specified by the given URL to create a Locale
using the specified LocaleFactory with the given origin, one or more
ViewingPlatforms with the specified number of transforms, and at least
one Viewer object with optional visibility.
|
ConfiguredUniverse(ViewingPlatform viewingPlatform,
Viewer viewer)
Equivalent to
SimpleUniverse(ViewingPlatform, Viewer) . |
ConfiguredUniverse(ViewingPlatform viewingPlatform,
Viewer viewer,
LocaleFactory localeFactory)
Equivalent to
SimpleUniverse(ViewingPlatform, Viewer,
LocalFactory) . |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Cleanup memory references used by ConfiguredUniverse.
|
ConfigContainer |
getConfigContainer()
Returns a container holding all the objects defined by the
configuration file used to create the ConfiguredUniverse.
|
static URL |
getConfigURL()
Returns the config file URL based on system properties.
|
static URL |
getConfigURL(String defaultURLString)
Returns the config file URL based on system properties.
|
Map |
getNamedBehaviors()
Returns all named ViewPlatformBehaviors defined by the configuration
file used to create the ConfiguredUniverse, if any.
|
Map |
getNamedSensors()
Returns all named Sensors defined by the configuration file used to
create the ConfiguredUniverse, if any.
|
Viewer |
getViewer(int index)
Returns the Viewer object specified by the given index.
|
Viewer[] |
getViewers()
Returns all of the Viewer objects associated with this scene graph.
|
void |
setVisible(boolean visible)
Call
setVisible() on all AWT components created by this
ConfiguredUniverse instance. |
addBranchGraph, getCanvas, getCanvas, getLocale, getPreferredConfiguration, getViewer, getViewingPlatform
addGraphStructureChangeListener, addRenderingErrorListener, addShaderErrorListener, getAllLocales, getJ3DThreadPriority, getProperties, numLocales, removeAllLocales, removeGraphStructureChangeListener, removeLocale, removeRenderingErrorListener, removeShaderErrorListener, setJ3DThreadPriority
public ConfiguredUniverse()
SimpleUniverse()
. Creates a
Locale, a single ViewingPlatform, and a Viewer object.SimpleUniverse()
,
Locale
,
Viewer
,
ViewingPlatform
public ConfiguredUniverse(int transformCount)
SimpleUniverse(int)
.
Creates a Locale, a single ViewingPlatform with the specified number of
transforms, and a Viewer object.transformCount
- the number of transforms in the
MultiTransformGroup object to be createdSimpleUniverse(int)
,
Locale
,
Viewer
,
ViewingPlatform
,
MultiTransformGroup
public ConfiguredUniverse(Canvas3D canvas)
SimpleUniverse(Canvas3D)
.
Creates a Locale, a single ViewingPlatform, and a Viewer object using
the given Canvas3D instance.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 utilitySimpleUniverse(Canvas3D)
,
Locale
,
Viewer
,
ViewingPlatform
public ConfiguredUniverse(Canvas3D canvas, int transformCount)
SimpleUniverse(Canvas3D, int)
.
Creates a Locale, a single ViewingPlatform with the specified number of
transforms, and a Viewer object with the given Canvas3D.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 utilitytransformCount
- the number of transforms in the
MultiTransformGroup object to be createdSimpleUniverse(Canvas3D, int)
,
Locale
,
Viewer
,
ViewingPlatform
,
MultiTransformGroup
public ConfiguredUniverse(ViewingPlatform viewingPlatform, Viewer viewer)
SimpleUniverse(ViewingPlatform, Viewer)
.
Creates the view side of the scene graph with the given ViewingPlatform
and Viewer.viewingPlatform
- the viewingPlatform to use to create
the view side of the scene graphviewer
- the viewer object to use to create
the view side of the scene graphSimpleUniverse(ViewingPlatform, Viewer)
,
ViewingPlatform
,
Viewer
public ConfiguredUniverse(ViewingPlatform viewingPlatform, Viewer viewer, LocaleFactory localeFactory)
SimpleUniverse(ViewingPlatform, Viewer,
LocalFactory)
. Creates the view side of the scene graph with
the given ViewingPlatform, Viewer, and Locale created by the specified
LocaleFactory.viewingPlatform
- the viewingPlatform to use to create
the view side of the scene graphviewer
- the viewer object to use to create
the view side of the scene graphlocaleFactory
- the factory object used to create the LocaleSimpleUniverse(ViewingPlatform, Viewer,
LocaleFactory)
,
ViewingPlatform
,
Viewer
,
LocaleFactory
public ConfiguredUniverse(Canvas3D[] canvases)
canvases
- the canvases to associate with the Viewer object;
passing in null will cause this parameter to be ignored and a canvas
to be created by the utilityLocale
,
Viewer
,
ViewingPlatform
public ConfiguredUniverse(Canvas3D[] canvases, int transformCount)
canvases
- the canvases to associate with the Viewer object;
passing in null will cause this parameter to be ignored and a canvas
to be created by the utilitytransformCount
- the number of transforms in the
MultiTransformGroup object to be createdLocale
,
Viewer
,
ViewingPlatform
,
MultiTransformGroup
public ConfiguredUniverse(Canvas3D[] canvases, int transformCount, LocaleFactory localeFactory)
canvases
- the canvases to associate with the Viewer object;
passing in null will cause this parameter to be ignored and a canvas
to be created by the utilitytransformCount
- the number of transforms in the
MultiTransformGroup object to be createdlocaleFactory
- the factory object used to create the LocaleLocale
,
Viewer
,
ViewingPlatform
,
MultiTransformGroup
public ConfiguredUniverse(URL userConfig)
userConfig
- the URL to the user's configuration file; passing in
null creates a default Viewer and ViewingPlatformLocale
,
Viewer
,
ViewingPlatform
public ConfiguredUniverse(URL userConfig, int transformCount)
userConfig
- the URL to the user's configuration file; passing in
null creates a default Viewer and ViewingPlatform with the specified
number of transformstransformCount
- the number of transforms in the
MultiTransformGroup objects to be createdLocale
,
Viewer
,
ViewingPlatform
,
MultiTransformGroup
public ConfiguredUniverse(URL userConfig, int transformCount, boolean setVisible)
setVisible
flag is true. The configuration file may also
create InputDevice, Sensor, and ViewPlatformBehavior instances.userConfig
- the URL to the user's configuration file; passing in
null creates a default Viewer with the specified visibility and a
ViewingPlatform with the specified number of transformstransformCount
- the number of transforms in the
MultiTransformGroup object to be createdsetVisible
- if true, calls setVisible(true)
on all
created window components; otherwise, they remain invisibleLocale
,
Viewer
,
ViewingPlatform
,
MultiTransformGroup
public ConfiguredUniverse(URL userConfig, LocaleFactory localeFactory)
userConfig
- the URL to the user's configuration file; passing in
null creates a default Viewer and ViewingPlatform with the specified
number of transformslocaleFactory
- the factory object used to create the LocaleLocale
,
Viewer
,
ViewingPlatform
public ConfiguredUniverse(URL userConfig, LocaleFactory localeFactory, boolean setVisible)
setVisible
flag is true.userConfig
- the URL to the user's configuration file; passing in
null creates a default Viewer with the specified visibility and a
default ViewingPlatformlocaleFactory
- the factory object used to create the LocalesetVisible
- if true, calls setVisible(true)
on all
created window components; otherwise, they remain invisibleLocale
,
Viewer
,
ViewingPlatform
public ConfiguredUniverse(URL userConfig, LocaleFactory localeFactory, HiResCoord origin, int transformCount, boolean setVisible)
setVisible
flag is true. The configuration file may also create InputDevice,
Sensor, and ViewPlatformBehavior instances.userConfig
- the URL to the user's configuration file; passing in
null creates a default Viewer with the specified visibility and a
ViewingPlatform with the specified number of transformslocaleFactory
- the factory object used to create the Localeorigin
- the origin used to set the origin of the Locale object;
if this object is null, then 0.0 is usedtransformCount
- the number of transforms in the
MultiTransformGroup object to be createdsetVisible
- if true, calls setVisible(true)
on all
created window components; otherwise, they remain invisibleLocale
,
Viewer
,
ViewingPlatform
,
MultiTransformGroup
public ConfiguredUniverse(ConfigContainer userConfig)
ConfiguredUniverse(ConfigContainer, null, null)
.userConfig
- container holding viewing configuration components;
must not be nullConfiguredUniverse(ConfigContainer, LocaleFactory, HiResCoord)
,
Locale
,
Viewer
,
ViewingPlatform
public ConfiguredUniverse(ConfigContainer userConfig, LocaleFactory localeFactory, HiResCoord origin)
This constructor and ConfiguredUniverse(ConfigContainer)
both accept ConfigContainer references directly and are the preferred
interfaces for constructing universes from configuration files. They
differ from the constructors that accept URL objects in the
following ways:
setViewingPlatform
method is called; it must wait
until its initialize
method is called.
userConfig
- container holding viewing configuration components;
must not be nulllocaleFactory
- the factory object used to create the Locale, or
nullorigin
- the origin used to set the origin of the Locale object;
if this object is null, then 0.0 is usedLocale
,
Viewer
,
ViewingPlatform
public Viewer getViewer(int index)
index
- The index of which Viewer object to return.public Viewer[] getViewers()
public void setVisible(boolean visible)
setVisible()
on all AWT components created by this
ConfiguredUniverse instance.visible
- boolean to be passed to the setVisible()
calls on the window components created by this
ConfiguredUniverse instancepublic static URL getConfigURL()
ConfigContainer.getConfigURL()
. The
current implementation of this method parses the j3d.configURL property
as a URL string. For example, the following command line would specify
that the config file is taken from the file "j3dconfig" in the current
directory:
java -Dj3d.configURL=file:j3dconfig ...
public static URL getConfigURL(String defaultURLString)
ConfigContainer.getConfigURL(String)
. The
current implementation of this method parses the j3d.configURL property
as a URL string. For example, the following command line would specify
that the config file is taken from the file "j3dconfig" in the current
directory:
java -Dj3d.configURL=file:j3dconfig ...
defaultURLString
- the default string used to construct
the URL if the appropriate system properties are not definedpublic Map getNamedSensors()
getConfigContainer().getNamedSensors()
.With the sole exception of the Sensor assigned to the head tracker, none of the Sensors defined in the configuration file are placed into the Sensor array maintained by PhysicalEnvironment. The head tracker Sensor is the only one read by the Java 3D core and must generate reads with a full 6 degrees of freedom (3D position and 3D orientation).
Other Sensors need not generate reads with a full 6 degrees of freedom, although their reads must be expressed using Transform3D. Some joysticks may provide only 2D relative X and Y axis movement; dials, levers, and sliders are 1D devices, and some devices may combine dials and levers to generate 3D positional data.
The index names to identify left / right / dominant / non-dominant hand Sensors in the PhysicalEnvironement Sensor array are not adequate to distinguish these differences, so this method allows applications to look up Sensors based on the names bound to them in the configuration file. There are no set rules on naming. Applications that use Sensors may set up conventions for generic devices such as "mouse6D" or "joystick2D" or specific product names.
public Map getNamedBehaviors()
getConfigContainer().getNamedViewPlatformBehaviors()
.public ConfigContainer getConfigContainer()
public void cleanup()
cleanup
in class SimpleUniverse
Copyright © 2016–2022 SciJava. All rights reserved.