Aviatrix3D 1.0

org.j3d.aviatrix3d
Class ViewEnvironment

java.lang.Object
  extended byorg.j3d.aviatrix3d.ViewEnvironment

public class ViewEnvironment
extends java.lang.Object

Abstract representation of the physical environment setup used to connect a virtual Viewpoint object to the real one that is rendered on a drawable surface.

Version:
$Revision: 1.10 $
Author:
Justin Couch

Field Summary
static int ORTHOGRAPHIC_PROJECTION
          The projection type is perspective mode
static int PERSPECTIVE_PROJECTION
          The projection type is perspective mode
 
Constructor Summary
ViewEnvironment()
          Create a default instance of this class with stereo false, perspective projection and field of view set to 45 degrees.
 
Method Summary
 void generateViewFrustum(double[] viewFrustum)
          From the current view setup of FoV, near and far clipping distances and the aspectRatio ratio, generate the 6 parameters that describe a view frustum.
 double getAspectRatio()
          Get the currently set aspect ratio.
 double getFarClipDistance()
          Get the current setting of the far clip plane.
 double getFieldOfView()
          Get the currently set field of view.
 double getNearClipDistance()
          Get the current setting of the far clip plane.
 int getProjectionType()
          Check to see if stereo has been enabled for this environment.
 boolean getStereoEnabled()
          Check to see if stereo has been enabled for this environment.
 java.awt.Rectangle getViewport()
          Get the currently set dimensions of the viewport.
 void setAspectRatio(double aspect)
          Set aspect ratio, which is the ratio of window Width / Height.
 void setClipDistance(double near, double far)
          Set the near clipping distance to be used by the application.
 void setFarClipDistance(double d)
          Set the far clipping distance to be used by the application.
 void setFieldOfView(double angle)
          Set the field of view to be used.
 void setNearClipDistance(double d)
          Set the near clipping distance to be used by the application.
 void setProjectionType(int type)
          Set the perspective projection flag used for this environment.
 void setStereoEnabled(boolean stereo)
          Set the stereo flag used for this environment.
 void setViewport(java.awt.Rectangle size)
          Set an explicit viewport dimensions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERSPECTIVE_PROJECTION

public static final int PERSPECTIVE_PROJECTION
The projection type is perspective mode

See Also:
Constant Field Values

ORTHOGRAPHIC_PROJECTION

public static final int ORTHOGRAPHIC_PROJECTION
The projection type is perspective mode

See Also:
Constant Field Values
Constructor Detail

ViewEnvironment

public ViewEnvironment()
Create a default instance of this class with stereo false, perspective projection and field of view set to 45 degrees.

Method Detail

setStereoEnabled

public void setStereoEnabled(boolean stereo)
Set the stereo flag used for this environment.

Parameters:
stereo - True if stereo should be rendered

getStereoEnabled

public boolean getStereoEnabled()
Check to see if stereo has been enabled for this environment.

Returns:
true if stereo rendering is to be used

setProjectionType

public void setProjectionType(int type)
                       throws java.lang.IllegalArgumentException
Set the perspective projection flag used for this environment.

Parameters:
type - One of ORTHOGRAPHIC_PROJECTION or PERSPECTIVE_PROJECTION
Throws:
java.lang.IllegalArgumentException - The type is not valid

getProjectionType

public int getProjectionType()
Check to see if stereo has been enabled for this environment.

Returns:
true if stereo rendering is to be used

setFieldOfView

public void setFieldOfView(double angle)
                    throws java.lang.IllegalArgumentException
Set the field of view to be used. The value supplied must be in degrees.

Parameters:
angle - The angle in degress
Throws:
java.lang.IllegalArgumentException - The angle is less than or equal to zero

getFieldOfView

public double getFieldOfView()
Get the currently set field of view. The field of view is specified in degrees.

Returns:
A value 0 <= x <= 180;

setAspectRatio

public void setAspectRatio(double aspect)
Set aspect ratio, which is the ratio of window Width / Height. An aspect ratio of <= 0 will be calculated from the current window or viewport dimensions.

Parameters:
aspect - The new aspectRatio ratio.

getAspectRatio

public double getAspectRatio()
Get the currently set aspect ratio. Width / Height.

Returns:
The aspect ratio

setViewport

public void setViewport(java.awt.Rectangle size)
Set an explicit viewport dimensions. If set, this will be the explicit viewport size to use when rendering to the surface. If an aspect ratio is not set, then this will be used to define the implicit ratio. If set to null, the system should use the entire surface space. If no aspect ratio is set ( <= 0) this can be used to imply the view frustum.

Note that if explicit coordinates are provided, the end user application should also add window listener events to the surface and adjust the values accordingly.

Parameters:
size - The new dimensions to use or null to clear

getViewport

public java.awt.Rectangle getViewport()
Get the currently set dimensions of the viewport. If none are currently set, this will return null, otherwise it will return the object representing the complete size;

Returns:
The current viewport size, or null

setNearClipDistance

public void setNearClipDistance(double d)
Set the near clipping distance to be used by the application.

Parameters:
d - The distance to set the near clip plane to

getNearClipDistance

public double getNearClipDistance()
Get the current setting of the far clip plane.

Returns:
The current value, which is less than the far plane

setClipDistance

public void setClipDistance(double near,
                            double far)
Set the near clipping distance to be used by the application.

Parameters:
near - The distance to set the near clip plane
far - The distance to the far clip plane

setFarClipDistance

public void setFarClipDistance(double d)
Set the far clipping distance to be used by the application.

Parameters:
d - The distance to set the near clip plane to

getFarClipDistance

public double getFarClipDistance()
Get the current setting of the far clip plane.

Returns:
The current value, which is greater than the near plane

generateViewFrustum

public void generateViewFrustum(double[] viewFrustum)
From the current view setup of FoV, near and far clipping distances and the aspectRatio ratio, generate the 6 parameters that describe a view frustum. These parameters are what could be used as arguments to the glFrustum call. The parameter order is: [x min, x max, y min, y max, z near, z far]

Parameters:
viewFrustum - An array at least 6 in length for the values generated

Aviatrix3D 1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2005 j3d.org