com.sun.j3d.utils.universe
Class Viewer

java.lang.Object
  |
  +--com.sun.j3d.utils.universe.Viewer

public class Viewer
extends java.lang.Object

The Viewer class holds all the information that describes the physical and virtual "presence" in the Java 3D universe. The Viewer object consists of:

See Also:
Canvas3D, PhysicalEnvironment, PhysicalBody, View, ViewerAvatar

Field Summary
protected  ViewerAvatar avatar
           
protected  Canvas3D canvas
           
protected  java.awt.Frame j3dFrame
           
protected  java.awt.Panel j3dPanel
           
protected static PhysicalBody physicalBody
           
protected static PhysicalEnvironment physicalEnvironment
           
protected  View view
           
 
Constructor Summary
Viewer()
          Creates a default viewer object.
Viewer(Canvas3D userCanvas)
          Creates a default viewer object.
Viewer(Canvas3D userCanvas, java.net.URL userConfig)
          Creates a default viewer object.
Viewer(java.net.URL userConfig)
          Creates a default viewer object.
 
Method Summary
 AudioDevice createAudioDevice()
          Used to create and initialize the AudioDevice, used for sound rendering.
 ViewerAvatar getAvatar()
          Gets the geometry associated with the viewer's avatar.
 Canvas3D getCanvases()
          Returns the canvas associated with this Viewer object.
 java.awt.Frame getFrame()
          Returns the Frame created by this Viewer object.
 java.awt.Panel getPanel()
          Returns the Panel created by this Viewer object.
 PhysicalBody getPhysicalBody()
          Returns the PhysicalBody object associated with the Viewer object.
 PhysicalEnvironment getPhysicalEnvironment()
          Returns the PhysicalEnvironment object associated with the Viewer object.
 View getView()
          Returns the View object associated with the Viewer object.
 void setAvatar(ViewerAvatar avatar)
          Sets the geometry to be associated with the viewer's avatar.
 void setViewingPlatform(ViewingPlatform platform)
          Set the ViewingPlatform object used by this Viewer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canvas

protected Canvas3D canvas

view

protected View view

avatar

protected ViewerAvatar avatar

physicalBody

protected static PhysicalBody physicalBody

physicalEnvironment

protected static PhysicalEnvironment physicalEnvironment

j3dFrame

protected java.awt.Frame j3dFrame

j3dPanel

protected java.awt.Panel j3dPanel
Constructor Detail

Viewer

public Viewer()
Creates a default viewer object. The default values are used to create the PhysicalBody, 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

public Viewer(Canvas3D userCanvas)
Creates a default viewer object. The default values are used to create the PhysicalBody, PhysicalEnvironment. The View is created with a front clip distance of 0.1f and a back clip distance of 10.0f.
Parameters:
userCanvas - The Canavs3D object to render to. If this object is null a single RGB, double buffered and depth buffered Canvas3D object is created.

Viewer

public Viewer(java.net.URL userConfig)
Creates a default viewer object. The default values are used to create the 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.
Parameters:
userConfig - The URL of the user configuration file used to initialize the PhysicalBody object. If null, the default PhysicalBody values are used.

Viewer

public Viewer(Canvas3D userCanvas,
              java.net.URL userConfig)
Creates a default viewer object. The default values are used to create the PhysicalEnvironment. The View is created with a front clip distance of 0.1f and a back clip distance of 10.0f.
Parameters:
userCanvas - The Canavs3D object to render to. If this object is null a single RGB, double buffered and depth buffered Canvas3D object is created.
userConfig - The URL of the user configuration file used to initialize the PhysicalBody object. If null, the default PhysicalBody values are used.
Method Detail

getView

public View getView()
Returns the View object associated with the Viewer object.
Returns:
The View object of this Viewer.

setViewingPlatform

public void setViewingPlatform(ViewingPlatform platform)
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.

setAvatar

public void setAvatar(ViewerAvatar avatar)
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

public ViewerAvatar 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

public PhysicalBody getPhysicalBody()
Returns the PhysicalBody object associated with the Viewer object.
Returns:
A reference to the PhysicalBody object.

getPhysicalEnvironment

public PhysicalEnvironment getPhysicalEnvironment()
Returns the PhysicalEnvironment object associated with the Viewer object.
Returns:
A reference to the PhysicalEnvironment object.

getCanvases

public Canvas3D getCanvases()
Returns the canvas associated with this Viewer object.

getFrame

public java.awt.Frame getFrame()
Returns the Frame created by this Viewer object. If a Viewer is constructed without a Canvas3D object then the Viewer object will create a Canva3D object, a Panel to place the Canvas3D object into and a Frame to place the Panel in.
Returns:
The Frame created by this object. If a Frame was not created by the Viewer object, null is returned.

getPanel

public java.awt.Panel getPanel()
Returns the Panel created by this Viewer object. If a Viewer is constructed without a Canvas3D object then the Viewer object will create a Canva3D object, a Panel to place the Canvas3D object into and a Frame to place the Panel in.
Returns:
The Panel created by this object. If a Panel was not created by the Viewer object, null is returned.

createAudioDevice

public AudioDevice createAudioDevice()
Used to create and initialize the AudioDevice, used for sound rendering.
Parameters:
BranchGroup - The BranchGroup to attach to this Universe's Locale.
Returns:
reference to created AudioDevice, or null if error occurs.