Package com.sun.j3d.utils.universe
Class Viewer
java.lang.Object
com.sun.j3d.utils.universe.Viewer
The Viewer class holds all the information that describes the physical
and virtual "presence" in the Java 3D universe. The Viewer object
consists of:
- Physical Objects
- Canvas3D's - used to render with.
- PhysicalEnvironment - holds characteristics of the hardware platform being used to render on.
- PhysicalBody - holds the physical characteristics and personal preferences of the person who will be viewing the Java 3D universe.
- Virtual Objects
- View - the Java 3D View object.
- ViewerAvatar - the geometry that is used by Java 3D to represent the person viewing the Java 3D universe.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionViewer()
Creates a default viewer object.Deprecated.create a ConfiguredUniverse to use a configuration fileCreates a default viewer object.Creates a default viewer object.Viewer
(Canvas3D[] userCanvases, PhysicalBody userBody, PhysicalEnvironment userEnvironment, boolean setVisible) Creates a viewer object.Deprecated.create a ConfiguredUniverse to use a configuration file -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Removes all Viewer mappings from the Viewer map.Used to create and initialize a default AudioDevice3D used for sound rendering.Gets the geometry associated with the viewer's avatar.Returns the 0th Canvas3D object associated with this Viewer objectgetCanvas3D
(int canvasNum) Returns the Canvas3D object at the specified index associated with this Viewer object.Canvas3D[]
Returns all the Canvas3D objects associated with this Viewer object.Deprecated.superceded by getCanvas3D()float
Retrieves the dynamic video resize factor of this viewer.boolean
Returns a status flag indicating whether or not dynamic video resize compensation is enabled.getFrame()
Deprecated.AWT Frame components are no longer created by the Viewer class.getJFrame
(int frameNum) Returns the JFrame object created by this Viewer object at the specified index.JFrame[]
Returns all the JFrames created by this Viewer object.getJPanel
(int panelNum) Returns the JPanel object created by this Viewer object at the specified index.JPanel[]
Returns all the JPanel objects created by this Viewer object.getPanel()
Deprecated.AWT Panel components are no longer created by the Viewer class.Returns the PhysicalBody object associated with the Viewer object.Returns the PhysicalEnvironment object associated with the Viewer object.Returns the Universe to which this Viewer is attachedgetView()
Returns the View object associated with the Viewer object.static Viewer
Get the Viewer associated with the view object.Get the ViewingPlatform object used by this Viewer.boolean
Returns a status flag indicating whether or not dynamic video size is enabled.static Viewer
removeViewerMapEntry
(View view) Removes the entry associated with the view object.void
setAvatar
(ViewerAvatar avatar) Sets the geometry to be associated with the viewer's avatar.void
setDvrEnable
(boolean dvr) Turns on or off dynamic video size.void
setDvrFactor
(float dvr) Set the dynamic video resize factor for this viewer.void
setDvrResizeCompensationEnable
(boolean dvrRCE) Turns on or off dynamic video resize compensation.void
setViewingPlatform
(ViewingPlatform platform) Set the ViewingPlatform object used by this Viewer.void
setVisible
(boolean visible) Call setVisible() on all Window components created by this Viewer.
-
Constructor Details
-
Viewer
public Viewer()Creates a default viewer object. The default values are used to create the PhysicalBody and PhysicalEnvironment. A single RGB, double buffered and depth buffered Canvas3D object is created. The View is created with a front clip distance of 0.1f and a back clip distance of 10.0f. -
Viewer
Creates a default viewer object. The default values are used to create the PhysicalBody and PhysicalEnvironment. The View is created with a front clip distance of 0.1f and a back clip distance of 10.0f.- Parameters:
userCanvas
- the Canvas3D object to be used for rendering; if this is null then a single RGB, double buffered and depth buffered Canvas3D object is created- Since:
- Java3D 1.1
-
Viewer
Creates a default viewer object. The default values are used to create the PhysicalBody and PhysicalEnvironment. The View is created with a front clip distance of 0.1f and a back clip distance of 10.0f.- Parameters:
userCanvases
- the Canvas3D objects to be used for rendering; if this is null then a single RGB, double buffered and depth buffered Canvas3D object is created- Since:
- Java3D 1.3
-
Viewer
public Viewer(Canvas3D[] userCanvases, PhysicalBody userBody, PhysicalEnvironment userEnvironment, boolean setVisible) Creates a viewer object. The Canvas3D objects, PhysicalEnvironment, and PhysicalBody are taken from the arguments.- Parameters:
userCanvases
- the Canvas3D objects to be used for rendering; if this is null then a single RGB, double buffered and depth buffered Canvas3D object is createduserBody
- the PhysicalBody to use for this Viewer; if it is null, a default PhysicalBody object is createduserEnvironment
- the PhysicalEnvironment to use for this Viewer; if it is null, a default PhysicalEnvironment object is createdsetVisible
- determines if the Frames should be set to visible once created- Since:
- Java3D 1.3
-
Viewer
Deprecated.create a ConfiguredUniverse to use a configuration fileCreates a default Viewer object. The default values are used to create the PhysicalEnvironment and PhysicalBody. A single RGB, double buffered and depth buffered Canvas3D object is created. The View is created with a front clip distance of 0.1f and a back clip distance of 10.0f.- Parameters:
userConfig
- the URL of the user configuration file used to initialize the PhysicalBody object; this is always ignored- Since:
- Java3D 1.1
-
Viewer
Deprecated.create a ConfiguredUniverse to use a configuration fileCreates a default viewer object. The default values are used to create the PhysicalEnvironment and PhysicalBody. The View is created with a front clip distance of 0.1f and a back clip distance of 10.0f.- Parameters:
userCanvas
- the Canvas3D object to be used for rendering; if this is null then a single RGB, double buffered and depth buffered Canvas3D object is createduserConfig
- the URL of the user configuration file used to initialize the PhysicalBody object; this is always ignored- Since:
- Java3D 1.1
-
-
Method Details
-
getViewer
Get the Viewer associated with the view object.- Parameters:
view
- The View object for inquiry.- Returns:
- The Viewer object associated with this View object. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.
- Since:
- Java 3D 1.3.1
-
removeViewerMapEntry
Removes the entry associated with the view object.- Parameters:
view
- The View object to be removed.- Returns:
- The Viewer object associated with this View object. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.
- Since:
- Java 3D 1.3.1
-
clearViewerMap
public static void clearViewerMap()Removes all Viewer mappings from the Viewer map. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.- Since:
- Java 3D 1.3.1
-
isDvrEnabled
public boolean isDvrEnabled()Returns a status flag indicating whether or not dynamic video size is enabled. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.- Since:
- Java 3D 1.3.1
-
setDvrEnable
public void setDvrEnable(boolean dvr) Turns on or off dynamic video size. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.- Parameters:
dvr
- enables or disables dynamic video size.- Since:
- Java 3D 1.3.1
-
getDvrFactor
public float getDvrFactor()Retrieves the dynamic video resize factor of this viewer. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.- Since:
- Java 3D 1.3.1
-
setDvrFactor
public void setDvrFactor(float dvr) Set the dynamic video resize factor for this viewer. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.- Parameters:
dvr
- set the dynamic video resize factor for this viewer.- Since:
- Java 3D 1.3.1
-
setDvrResizeCompensationEnable
public void setDvrResizeCompensationEnable(boolean dvrRCE) Turns on or off dynamic video resize compensation. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.- Parameters:
dvrRCE
- enables or disables dynamic video resize compensation.- Since:
- Java 3D 1.3.1
-
getDvrResizeCompensationEnable
public boolean getDvrResizeCompensationEnable()Returns a status flag indicating whether or not dynamic video resize compensation is enabled. Note: This method is targeted for SUN framebuffer XVR-4000 and later hardware that support video size extension.- Since:
- Java 3D 1.3.1
-
setVisible
public void setVisible(boolean visible) Call setVisible() on all Window components created by this Viewer.- Parameters:
visible
- boolean to be passed to the setVisible() calls on the Window components created by this Viewer- Since:
- Java3D 1.3
-
getView
Returns the View object associated with the Viewer object.- Returns:
- The View object of this Viewer.
-
setViewingPlatform
Set the ViewingPlatform object used by this Viewer.- Parameters:
platform
- The ViewingPlatform object to set for this Viewer object. Use null to unset the current value and not assign assign a new ViewingPlatform object.
-
getViewingPlatform
Get the ViewingPlatform object used by this Viewer.- Returns:
- The ViewingPlatform object used by this Viewer object.
-
setAvatar
Sets the geometry to be associated with the viewer's avatar. The avatar is the geometry used to represent the viewer in the virtual world.- Parameters:
avatar
- The geometry to associate with this Viewer object. Passing in null will cause any geometry associated with the Viewer to be removed from the scen graph.
-
getAvatar
Gets the geometry associated with the viewer's avatar. The avatar is the geometry used to represent the viewer in the virtual world.- Returns:
- The root of the scene graph that is used to represent the viewer's avatar.
-
getPhysicalBody
Returns the PhysicalBody object associated with the Viewer object.- Returns:
- A reference to the PhysicalBody object.
-
getPhysicalEnvironment
Returns the PhysicalEnvironment object associated with the Viewer object.- Returns:
- A reference to the PhysicalEnvironment object.
-
getCanvas3D
Returns the 0th Canvas3D object associated with this Viewer object- Returns:
- a reference to the 0th Canvas3D object associated with this Viewer object
- Since:
- Java3D 1.3
-
getCanvas3D
Returns the Canvas3D object at the specified index associated with this Viewer object.- 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 a Canvas3D object associated with this Viewer object
- Since:
- Java3D 1.3
-
getCanvas3Ds
Returns all the Canvas3D objects associated with this Viewer object.- Returns:
- an array of references to the Canvas3D objects associated with this Viewer object
- Since:
- Java3D 1.3
-
getCanvases
Deprecated.superceded by getCanvas3D()Returns the canvas associated with this Viewer object. -
getFrame
Deprecated.AWT Frame components are no longer created by the Viewer class.This method is no longer supported since Java 3D 1.3.- Throws:
UnsupportedOperationException
- if called.
-
getJFrame
Returns the JFrame object created by this Viewer object at the specified index. If a Viewer is constructed without any Canvas3D objects then the Viewer object will create a Canva3D object, a JPanel containing the Canvas3D object, and a JFrame to place the JPanel in.NOTE: When running under JDK 1.4 or newer, the JFrame always directly contains the JPanel which contains the Canvas3D. When running under JDK 1.3.1 and creating a borderless full screen through a configuration file, the JFrame will instead contain a JWindow which will contain the JPanel and Canvas3D.
- Parameters:
frameNum
- the index of the JFrame object to retrieve; if there is no JFrame object for the given index, null is returned- Returns:
- a reference to JFrame object created by this Viewer object
- Since:
- Java3D 1.3
-
getJFrames
Returns all the JFrames created by this Viewer object. If a Viewer is constructed without any Canvas3D objects then the Viewer object will create a Canva3D object, a JPanel containing the Canvas3D object, and a JFrame to place the JPanel in.NOTE: When running under JDK 1.4 or newer, the JFrame always directly contains the JPanel which contains the Canvas3D. When running under JDK 1.3.1 and creating a borderless full screen through a configuration file, the JFrame will instead contain a JWindow which will contain the JPanel and Canvas3D.
- Returns:
- an array of references to the JFrame objects created by this Viewer object, or null if no JFrame objects were created
- Since:
- Java3D 1.3
-
getPanel
Deprecated.AWT Panel components are no longer created by the Viewer class.This method is no longer supported since Java 3D 1.3.- Throws:
UnsupportedOperationException
- if called.
-
getJPanel
Returns the JPanel object created by this Viewer object at the specified index. If a Viewer is constructed without any Canvas3D objects then the Viewer object will create a Canva3D object and a JPanel into which to place the Canvas3D object.- Parameters:
panelNum
- the index of the JPanel object to retrieve; if there is no JPanel object for the given index, null is returned- Returns:
- a reference to a JPanel object created by this Viewer object
- Since:
- Java3D 1.3
-
getJPanels
Returns all the JPanel objects created by this Viewer object. If a Viewer is constructed without any Canvas3D objects then the Viewer object will create a Canva3D object and a JPanel into which to place the Canvas3D object.- Returns:
- an array of references to the JPanel objects created by this Viewer object, or null or no JPanel objects were created
- Since:
- Java3D 1.3
-
createAudioDevice
Used to create and initialize a default AudioDevice3D used for sound rendering.- Returns:
- reference to created AudioDevice, or null if error occurs.
-
getUniverse
Returns the Universe to which this Viewer is attached- Returns:
- the Universe to which this Viewer is attached
- Since:
- Java 3D 1.3
-