Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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:

- 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.

If the Viewer object is created without any Canvas3D's, or indirectly through a configuration file, it will create the Canvas3D's as needed. The default Viewer creates one Canvas3D. If the Viewer object creates the Canvas3D's, it will also create a JPanel and JFrame for each Canvas3D. Dynamic video resize is a new feature in Java 3D 1.3.1. This feature provides a means for doing swap synchronous resizing of the area that is to be magnified (or passed through) to the output video resolution. This functionality allows an application to draw into a smaller viewport in the framebuffer in order to reduce the time spent doing pixel fill. The reduced size viewport is then magnified up to the video output resolution using the SUN_video_resize extension. This extension is only implemented in XVR-4000 and later hardware with back end video out resizing capability. If video size compensation is enable, the line widths, point sizes and pixel operations will be scaled internally with the resize factor to approximately compensate for video resizing. The location of the pixel ( x, y ) in the resized framebuffer = ( floor( x * factor + 0.5 ), floor( y * factor + 0.5 ) )

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

Constructor Summary
`Viewer()` Creates a default viewer object.
`Viewer(Canvas3D userCanvas)` Creates a default viewer object.
`Viewer(Canvas3D[] userCanvases)` Creates a default viewer object.
`Viewer(Canvas3D[] userCanvases, PhysicalBody userBody, PhysicalEnvironment userEnvironment, boolean setVisible)` Creates a viewer object.
`Viewer(Canvas3D userCanvas, java.net.URL userConfig)` Deprecated. create a ConfiguredUniverse to use a configuration file
`Viewer(java.net.URL userConfig)` Deprecated. create a ConfiguredUniverse to use a configuration file

Method Summary
`static void` | `clearViewerMap()` Removes all Viewer mappings from the Viewer map.
`AudioDevice` | `createAudioDevice()` Used to create and initialize a default AudioDevice3D used for sound rendering.
`ViewerAvatar` | `getAvatar()` Gets the geometry associated with the viewer's avatar.
`Canvas3D` | `getCanvas3D()` Returns the 0th Canvas3D object associated with this Viewer object
`Canvas3D` | `getCanvas3D(int canvasNum)` Returns the Canvas3D object at the specified index associated with this Viewer object.
`Canvas3D[]` | `getCanvas3Ds()` Returns all the Canvas3D objects associated with this Viewer object.
`Canvas3D` | `getCanvases()` Deprecated. superceded by getCanvas3D()
`float` | `getDvrFactor()` Retrieves the dynamic video resize factor of this viewer.
`boolean` | `getDvrResizeCompensationEnable()` Returns a status flag indicating whether or not dynamic video resize compensation is enabled.
`java.awt.Frame` | `getFrame()` Deprecated. AWT Frame components are no longer created by the Viewer class.
`javax.swing.JFrame` | `getJFrame(int frameNum)` Returns the JFrame object created by this Viewer object at the specified index.
`javax.swing.JFrame[]` | `getJFrames()` Returns all the JFrames created by this Viewer object.
`javax.swing.JPanel` | `getJPanel(int panelNum)` Returns the JPanel object created by this Viewer object at the specified index.
`javax.swing.JPanel[]` | `getJPanels()` Returns all the JPanel objects created by this Viewer object.
`java.awt.Panel` | `getPanel()` Deprecated. AWT Panel components are no longer created by the Viewer class.
`PhysicalBody` | `getPhysicalBody()` Returns the PhysicalBody object associated with the Viewer object.
`PhysicalEnvironment` | `getPhysicalEnvironment()` Returns the PhysicalEnvironment object associated with the Viewer object.
`SimpleUniverse` | `getUniverse()` Returns the Universe to which this Viewer is attached
`View` | `getView()` Returns the View object associated with the Viewer object.
`static Viewer` | `getViewer(View view)` Get the Viewer associated with the view object.
`ViewingPlatform` | `getViewingPlatform()` Get the ViewingPlatform object used by this Viewer.
`boolean` | `isDvrEnabled()` 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### 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

    public Viewer(Canvas3D userCanvas)

  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

    public Viewer(Canvas3D[] userCanvases)

  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 created
    `userBody` - the PhysicalBody to use for this Viewer; if it is null, a default PhysicalBody object is created
    `userEnvironment` - the PhysicalEnvironment to use for this Viewer; if it is null, a default PhysicalEnvironment object is created
    `setVisible` - determines if the Frames should be set to visible once created
  Since:
    Java3D 1.3

### Viewer

    public Viewer(java.net.URL userConfig)

  Deprecated. create a ConfiguredUniverse to use a configuration file

  Creates 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

    public Viewer(Canvas3D userCanvas,
                  java.net.URL userConfig)

  Deprecated. create a ConfiguredUniverse to use a configuration file

  Creates 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 created
    `userConfig` - the URL of the user configuration file used to initialize the PhysicalBody object; this is always ignored
  Since:
    Java3D 1.1

Method Detail

### getViewer

    public static Viewer getViewer(View view)

  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

    public static Viewer removeViewerMapEntry(View view)

  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

    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.

### getViewingPlatform

    public ViewingPlatform getViewingPlatform()

  Get the ViewingPlatform object used by this Viewer.

  Returns:
    The ViewingPlatform object used by this Viewer 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.

### getCanvas3D

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

    public Canvas3D getCanvas3D(int canvasNum)

  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

    public Canvas3D[] 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

    public Canvas3D getCanvases()

  Deprecated. superceded by getCanvas3D()

  Returns the canvas associated with this Viewer object.

### getFrame

    public java.awt.Frame 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:
    `java.lang.UnsupportedOperationException` - if called.

### getJFrame

    public javax.swing.JFrame getJFrame(int frameNum)

  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

    public javax.swing.JFrame[] 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

    public java.awt.Panel 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:
    `java.lang.UnsupportedOperationException` - if called.

### getJPanel

    public javax.swing.JPanel getJPanel(int panelNum)

  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

    public javax.swing.JPanel[] 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

    public AudioDevice createAudioDevice()

  Used to create and initialize a default AudioDevice3D used for sound rendering.

  Returns:
    reference to created AudioDevice, or null if error occurs.

### getUniverse

    public SimpleUniverse getUniverse()

  Returns the Universe to which this Viewer is attached

  Returns:
    the Universe to which this Viewer is attached
  Since:
    Java 3D 1.3

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD