j3d.org Aviatrix3D

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.6 $
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 aspect 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.
 void setAspectRatio(double aspect)
          Set aspect ratio.
 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.
 
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;

getAspectRatio

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

Returns:
The aspect ratio

setAspectRatio

public void setAspectRatio(double aspect)
Set aspect ratio. Width / Height. An aspect ratio of <= 0 will be calculated from the current window dimenstions.

Parameters:
aspect - The new aspect ratio.

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

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

j3d.org Aviatrix3D

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