|
Aviatrix3D 2.0 Beta 2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j3d.aviatrix3d.SceneGraphObject
org.j3d.aviatrix3d.ViewEnvironment
Representation of the physical environment setup used to connect a virtual Viewpoint object to the real one that is rendered on a drawable surface.
Most of the properties of this class are changed during the app update observer callback cycle.
Frustum Generation
The view frustum is generated depends on the aspect ratio. If the user sets an explicit aspect ratio, this is used in preference. If no aspect ratio is set (or the value set to <= 0) then the dimensions of the viewport that this is contained within are used to automatically calculate an aspect ratio.
The aspect ratio is not set by default.
Stereo supportIf the output device is capable of supporting stereo rendering, this class can be used to enable it. Since the stereo flags are supplied here, that allows the end user to control which layer(s) should be rendered in stereo and which should not. For example, a HUD may want to have a text overlay that has no depth applied, rendered over the top of the main layer, which has stereo applied. One environment has the flag set, the other does not.
By default, stereo is disabled.
Field of View and aspect ratio
The field of view calculation defines the viewing angle that is used in the Y axis - definition the minimum and maximum Y extents for the view frustum. If an explicit aspect ratio is set then the X extents are calculated using that, otherwise the dimensions of the viewport are used to calculate an aspect ratio, and finally the X extents.
Field Summary | |
static int |
ORTHOGRAPHIC_PROJECTION
The projection type is perspective mode |
static int |
PERSPECTIVE_PROJECTION
The projection type is perspective mode |
static int |
VIEW_HEIGHT
Index into the viewport size array for the height |
static int |
VIEW_WIDTH
Index into the viewport size array for the width |
static int |
VIEW_X
Index into the viewport size array for the X position |
static int |
VIEW_Y
Index into the viewport size array for the Y position |
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
alive, LISTENER_SET_NOT_LIVE_MESSAGE, updateHandler, WRITE_TIMING_MSG |
Method Summary | |
void |
generateViewFrustum(double[] frustum)
Generate a frustum based on the projectionType. |
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. |
void |
getPixelLocationInSurface(float x,
float y,
javax.vecmath.Point3f position)
Convert a pixel location to surface coordinates. |
void |
getPixelLocationInSurface(float x,
float y,
javax.vecmath.Point3f offset,
javax.vecmath.Point3f position)
Convert a pixel location to surface coordinates. |
int |
getProjectionType()
Check to see if stereo has been enabled for this environment. |
void |
getViewFrustum(double[] frustum)
Get the frustum based on the projectionType. |
int[] |
getViewportDimensions()
Get the currently set dimensions of the viewport. |
boolean |
isStereoEnabled()
Check to see if stereo has been enabled for this environment. |
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 |
setOrthoParams(double left,
double right,
double bottom,
double top)
Set the Orthographic view parameters. |
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 org.j3d.aviatrix3d.SceneGraphObject |
checkForCyclicChild, checkForCyclicParent, dataChanged, getUserData, isLive, setLive, setUpdateHandler, setUserData |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PERSPECTIVE_PROJECTION
public static final int ORTHOGRAPHIC_PROJECTION
public static final int VIEW_X
public static final int VIEW_Y
public static final int VIEW_WIDTH
public static final int VIEW_HEIGHT
Method Detail |
public boolean isStereoEnabled()
isStereoEnabled
in interface ViewEnvironmentCullable
public int getProjectionType()
getProjectionType
in interface ViewEnvironmentCullable
public int[] getViewportDimensions()
getViewportDimensions
in interface ViewEnvironmentCullable
public void getViewFrustum(double[] frustum)
getViewFrustum
in interface ViewEnvironmentCullable
frustum
- An array at least 6 in length for the values generatedpublic double getFieldOfView()
getFieldOfView
in interface ViewEnvironmentCullable
public void setStereoEnabled(boolean stereo)
stereo
- True if stereo should be rendered
InvalidWriteTimingException
- An attempt was made to write outside
of the ApplicationUpdateObserver callback methodpublic void setProjectionType(int type) throws java.lang.IllegalArgumentException
type
- One of ORTHOGRAPHIC_PROJECTION or PERSPECTIVE_PROJECTION
InvalidWriteTimingException
- An attempt was made to write outside
of the ApplicationUpdateObserver callback method
java.lang.IllegalArgumentException
- The type is not validpublic void setFieldOfView(double angle) throws java.lang.IllegalArgumentException
angle
- The angle in degress
java.lang.IllegalArgumentException
- The angle is less than or equal to zero
InvalidWriteTimingException
- An attempt was made to write outside
of the ApplicationUpdateObserver callback methodpublic void setAspectRatio(double aspect)
aspect
- The new aspectRatio ratio.
InvalidWriteTimingException
- An attempt was made to write outside
of the ApplicationUpdateObserver callback methodpublic double getAspectRatio()
public void setNearClipDistance(double d)
d
- The distance to set the near clip plane to
InvalidWriteTimingException
- An attempt was made to write outside
of the ApplicationUpdateObserver callback methodpublic double getNearClipDistance()
public void setClipDistance(double near, double far)
near
- The distance to set the near clip planefar
- The distance to the far clip plane
InvalidWriteTimingException
- An attempt was made to write outside
of the ApplicationUpdateObserver callback methodpublic void setFarClipDistance(double d)
d
- The distance to set the near clip plane to
InvalidWriteTimingException
- An attempt was made to write outside
of the ApplicationUpdateObserver callback methodpublic double getFarClipDistance()
public void setOrthoParams(double left, double right, double bottom, double top)
left
- The left plane coordinateright
- The right plane coordinatebottom
- The bottom plane coordinatetop
- The top plane coordinatepublic void generateViewFrustum(double[] frustum)
frustum
- An array at least 6 in length for the values generatedpublic void getPixelLocationInSurface(float x, float y, javax.vecmath.Point3f position)
x
- The X coordinatey
- The Y coordinateposition
- The converted position. It must be preallocated.public void getPixelLocationInSurface(float x, float y, javax.vecmath.Point3f offset, javax.vecmath.Point3f position)
x
- The X coordinatey
- The Y coordinateoffset
- Any Eye offset amount needed for a canvas offset or nullposition
- The converted position. It must be preallocated.
|
Aviatrix3D 2.0 Beta 2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |