javax.media.j3d
Class View
java.lang.Object
|
+--javax.media.j3d.View
- public class View
- extends java.lang.Object
The View object contains all parameters needed in rendering a
three dimensional scene from one viewpoint. A view contains a list
of Canvas3D objects that the view is rendered into. It exists outside
of the scene graph, but attaches to a ViewPlatform leaf node object
in the scene graph. It also contains a reference to a PhysicalBody
and a PhysicalEnvironment object.
The View object is the main Java 3D object for controlling the
Java 3D viewing model. All of the components that specify the
view transform used to render to the 3D canvases are either contained
in the View object or in objects that are referenced by the View
object.
Java 3D allows applications to specify multiple simultaneously active
View objects, each controlling its own set of canvases.
The Java 3D View object has several instance variables and methods,
but most are calibration variables or user-helping functions. The
viewing policies defined by the View object are described below.
Policies
The View object defines the following policies:
- View policy - informs Java 3D whether it should generate
the view using the head-tracked system of transformations or the
head-mounted system of transformations. These policies are attached
to the Java 3D View object. There are two view policies:
- SCREEN_VIEW - specifies that Java 3D should compute a new
viewpoint using the sequence of transforms appropriate to screen-based
head-tracked display environments (fish-tank VR/portals/VR-desks).
This is the default setting.
- HMD_VIEW - specifies that Java 3D should compute a new viewpoint
using the sequence of transforms appropriate to head mounted display
environments. This policy is not available in compatibility mode
(see the setCompatibilityModeEnable method description).
- Projection policy - specifies whether Java 3D should generate
a parallel projection or a perspective projection. This policy
is attached to the Java 3D View object. There are two projection
policies:
- PARALLEL_PROJECTION - specifies that a parallel projection
transform is computed.
- PERSPECTIVE_PROJECTION - specifies that a perspective projection
transform is computed. This is the default policy.
- Screen scale policy - specifies where the screen scale comes from.
There are two screen scale policies:
- SCALE_SCREEN_SIZE - specifies that the scale is derived from the
physical screen according to the following formula (this is the
default mode):
screenScale = physicalScreenWidth / 2.0
- SCALE_EXPLICIT - pecifies that the scale is taken directly from
the user-provided
screenScale
attribute (see the
setScreenScale method description).
- Window resize policy - specifies how Java 3D modifies the view
when users resize windows. When users resize or move windows,
Java 3D can choose to think of the window as attached either to
the physical world or to the virtual world. The window resize
policy allows an application to specify how the
view model will handle resizing requests.
There are two window resize policies:
- VIRTUAL_WORLD - implies that the original image remains the
same size on the screen but the user sees more or less of the
virtual world depending on whether the window grew or shrank
in size.
- PHYSICAL_WORLD - implies that the original image continues
to fill the window in the same way using more or less pixels
depending on whether the window grew or shrank in size.
- Window movement policy - specifies what part of the virtual
world Java 3D draws as a function of window placement on the screen.
There are two window movement policies:
- VIRTUAL_WORLD - implies that the image seen in the window
changes as the position of the window shifts on the screen.
(This mode acts as if the window were a window into the virtual
world.)
- PHYSICAL_WORLD - implies that the image seen in the window
remains the same no matter where the user positions the window
on the screen.
- Window eyepoint policy - comes into effect in a non-head-tracked
environment. The policy tells Java 3D how to construct a new view
frustum based on changes in the field of view and in the Canvas3D's
location on the screen. The policy only comes into effect when the
application changes a parameter that can change the placement of the
eyepoint relative to the view frustum.
There are three window eyepoint policies:
- RELATIVE_TO_SCREEN - tells Java 3D to interpret the eye's position
relative to the entire screen. No matter where an end user moves a
window (a Canvas3D), Java 3D continues to interpret the eye's position
relative to the screen. This implies that the view frustum changes shape
whenever an end user moves the location of a window on the screen.
In this mode, the field of view is read-only.
- RELATIVE_TO_WINDOW - specifies that Java 3D should interpret the
eye's position information relative to the window (Canvas3D). No matter
where an end user moves a window (a Canvas3D), Java 3D continues to
interpret the eye's position relative to that window. This implies
that the frustum remains the same no matter where the end user
moves the window on the screen. In this mode, the field of view
is read-only.
- RELATIVE_TO_FIELD_OF_VIEW - tells Java 3D that it should
modify the eyepoint position so it is located at the appropriate
place relative to the window to match the specified field of view.
This implies that the view frustum will change whenever the
application changes the field of view. In this mode, the eye
position is read-only. This is the default setting.
- RELATIVE_TO_COEXISTENCE - tells Java 3D to interpret the eye's
position in coexistence coordinates. In this mode, the eye position
is taken from the view (rather than the Canvas3D) and transformed from
coexistence coordinates to image plate coordinates for each
Canvas3D. The resulting eye position is relative to the screen. As
in RELATIVE_TO_SCREEN mode, this implies that the view frustum
changes shape whenever an end user moves the location of a window
on the screen. In this mode, the field of view is
read-only.
- Front and back clip policies - specifies how Java 3D
interprets clipping distances to both the near and far clip
planes. The policies can contain one of four values specifying
whether a distance measurement should be interpreted in
the physical or the virtual world and whether that distance
measurement should be interpreted relative to the physical
eyepoint or the physical screen.
The front and back clip policies
are specified separately. The front clip policy determines
where Java 3D places the front clipping plane. The back clip
policy determines where Java 3D places the back clipping plane.
The values for both front and back clipping planes are:
- VIRTUAL_EYE - specifies that the associated distance is from
the eye and in units of virtual distance.
- PHYSICAL_EYE - specifies that the associated distance is from
the eye and in units of physical distance (in meters).
- VIRTUAL_SCREEN - specifies that the associated distance is
from the screen and in units of virtual distance.
- PHYSICAL_SCREEN - specifies that the associated distance is
from the screen and in units of physical distance (in meters).
This is the default policy for both front and back clipping.
- Visibility policy - specifies how visible and invisible objects
are drawn. There are three visibility policies:
- VISIBILITY_DRAW_VISIBLE - only visible objects are drawn
(this is the default).
- VISIBILITY_DRAW_INVISIBLE - only invisible objects are drawn.
- VISIBILITY_DRAW_ALL - both visible and invisible
objects are drawn.
- Transparency sorting policy - specifies whether and how
transparent objects are sorted. Sorting multiple transparent
objects is necessary to avoid artifacts caused by overlapping
transparent objects. There are two transparency sorting
policies:
- TRANSPARENCY_SORT_NONE - no depth sorting of transparent
objects is performed (this is the default). Transparent objects
are drawn after opaque objects, but are not sorted from back to
front.
- TRANSPARENCY_SORT_GEOMETRY - transparent objects are
depth-sorted on a per-geometry basis. Each geometry object of each
transparent Shape3D node is drawn from back to front. Note that
this policy will not split geometry into smaller pieces, so
intersecting or intertwined objects may not be sorted
correctly. The method used for determining which geometry is closer
is implementation dependent.
Projection and Clip Parameters
The projection and clip parameters determine the view model's
field of view and the front and back clipping distances.
- Field of view - specifies the view model's horizontal
field of view in radians, when in the default non-head-tracked
mode. This value is ignored when the view model is operating
in head-tracked mode, or when the Canvas3D's window eyepoint
policy is set to a value other than the default setting of
RELATIVE_TO_FIELD_OF_VIEW.
- Front clip distance - specifies the distance away from the
clip origin, specified by the front clip policy variable, in
the direction of gaze where objects stop disappearing. Objects
closer than the clip origin (eye or screen)
plus the front clip distance are not drawn. Measurements are
done in the space (physical or virtual) that is specified by
the associated front clip policy parameter.
- Back clip distance - specifies the distance away from the
clip origin (specified by the back clip policy variable) in the
direction of gaze where objects begin disappearing. Objects
farther away from the clip origin (eye or
screen) plus the back clip distance are not drawn.
Measurements are done in the space (physical or virtual) that
is specified by the associated back clip policy
parameter. The View object's back clip distance is ignored
if the scene graph contains an active Clip leaf node.
There are several considerations to take into account when
choosing values for the front and back clip distances.
- The front clip distance must be greater than 0.0 in physical
eye coordinates.
- The front clipping plane must be in front of the back clipping
plane, that is, the front clip distance must be less than the
back clip distance in physical eye coordinates.
- The front and back clip distances, in physical eye coordinates,
must be less than the largest positive single-precision floating
point value, Float.MAX_VALUE. In practice, since these physical
eye coordinate distances are in meters, the values
should be much less than that.
- The ratio of the back distance divided by the front distance,
in physical eye coordinates, affects Z-buffer precision. This ratio
should be less than about 3000 to accommodate 16-bit Z-buffers.
Values of 100 to less than 1000 will produce better results.
Violating any of the above rules will result in undefined behavior.
In many cases, no picture will be drawn.
Frame Start Time, Duration, and Number
There are five methods used to get information about system
execution and performance:
getCurrentFrameStartTime
returns the time at which
the most recent rendering frame started.
getLastFrameDuration
returns the duration, in milliseconds, of
the most recently completed rendering frame.
getFrameNumber
returns the frame number for this view.
getMaxFrameStartTimes
retrieves the implementation-dependent
maximum number of frames whose start times will be recorded by
the system.
getFrameStartTimes
copies the last k frame start time values
into the user-specified array.
View Traversal and Behavior Scheduling
The following methods control the traversal, the rendering, and
the execution of the behavior scheduler for this view:
startBehaviorScheduler
starts the behavior scheduler
running after it has been stopped.
stopBehaviorScheduler
stops the behavior scheduler after all
currently-scheduled behaviors are executed.
isBehaviorSchedulerRunning
retrieves a flag that indicates
whether the behavior scheduler is currently running.
startView
starts traversing this view and starts the renderers
associated with all canvases attached to this view.
stopView
stops traversing this view after the current state of
the scene graph is reflected on all canvases attached to this
view.
isViewRunning
returns a flag indicating whether the traverser
is currently running on this view.
Note: The above six methods are heavy-weight methods intended
for verification and image capture (recording). They are not
intended to be used for flow control.
Scene Antialiasing
The following methods set and retrieve the scene antialiasing
flag. Scene antialiasing is either enabled or disabled for this
view. If enabled, the entire scene will be antialiased on each
canvas in which scene antialiasing is available. Scene
antialiasing is disabled by default.
Note that line and point antialiasing are independent of scene
antialiasing. If antialiasing is enabled for lines and points,
the lines and points will be antialiased prior to scene antialiasing.
If scene antialiasing is disabled, antialiased lines and points will
still be antialiased.
Note: Scene antialiasing is ignored in pure immediate mode,
but is supported in mixed-immediate mode.
Depth Buffer
The following two methods enable and disable automatic freezing
of the depth buffer for objects rendered during the transparent
rendering pass (that is, objects rendered using alpha blending)
for this view. If enabled, depth buffer writes are disabled
during the transparent rendering pass regardless of the value
of the depth-buffer-write-enable flag in the RenderingAttributes
object for a particular node. This flag is enabled by default.
Transparent objects include BLENDED transparent primitives
and antialiased lines
and points. Transparent objects do not include opaque objects
or primitives rendered with SCREEN_DOOR transparency.
Sensors
The following methods retrieve the sensor's location in the
virtual world:
getSensorToVworld
takes the sensor's last reading and
generates a sensor-to-vworld coordinate system transform. This
Transform3D object takes points in that sensor's local coordinate
system and transforms them into virtual world coordinates.
getSensorHotSpotInVworld
retrieves the specified sensor's
last hotspot location in virtual world coordinates.
Compatibility Mode
A camera-based view model allows application programmers to think
about the images displayed on the computer screen as if a virtual
camera took those images. Such a view model allows application
programmers to position and orient a virtual camera within a
virtual scene, to manipulate some parameters of the virtual
camera's lens (specify its field of view), and to specify the
locations of the near and far clipping planes.
Java 3D allows applications to enable compatibility mode for
room-mounted, non-head-tracked display environments, or to disable
compatibility mode using the following methods. Camera-based
viewing functions are only available in compatibility mode.
Use of these view-compatibility functions will disable some of
Java 3D's view model features and limit the portability of Java
3D programs. These methods are primarily intended to help
jump-start porting of existing applications.
Setting the Viewing Transform
The View object provides the following compatibility-mode
methods that operate on the viewing transform.
Setting the Projection Transform
The View object provides the following compatibility-mode
methods that operate on the projection transform:
The setLeftProjection
and setRightProjection
methods specify
a viewing frustum for the left and right eye that transforms
points in eye coordinates to clipping coordinates.
The getLeftProjection
and getRightProjection
methods return
the viewing frustum for the left and right eye.
- See Also:
Canvas3D
,
PhysicalBody
,
PhysicalEnvironment
,
ViewPlatform
,
TransparencyAttributes
Field Summary |
static int |
CYCLOPEAN_EYE_VIEW
Specifies that monoscopic view generated should be the view as seen
from the 'center eye', the fictional eye half-way between the left and
right eye. |
static int |
HMD_VIEW
Specifies that the viewing environment for this view is a
head-mounted display environment. |
static int |
LEFT_EYE_VIEW
Specifies that monoscopic view generated should be the view as seen
from the left eye. |
static int |
NOMINAL_FEET
Specifies a policy whereby the origin of physical or virtual
coordinates is relative to the position of the nominal feet. |
static int |
NOMINAL_HEAD
Specifies a policy whereby the origin of physical or virtual
coordinates is relative to the position of the nominal head. |
static int |
NOMINAL_SCREEN
Specifies a policy whereby the origin of physical or virtual
coordinates is relative to the screen. |
static int |
PARALLEL_PROJECTION
Specifies that Java 3D should generate a parallel projection matrix
for this View. |
static int |
PERSPECTIVE_PROJECTION
Specifies that Java 3D should generate a perspective projection matrix
for this View. |
static int |
PHYSICAL_EYE
Specifies that the associated distance is measured
from the eye in meters. |
static int |
PHYSICAL_SCREEN
Specifies that the associated distance is measured
from the screen in meters. |
static int |
PHYSICAL_WORLD
Policy for resizing and moving windows. |
static int |
RELATIVE_TO_COEXISTENCE
Policy for placing the eyepoint in non-head-tracked modes. |
static int |
RELATIVE_TO_FIELD_OF_VIEW
Policy for placing the eyepoint in non-head-tracked modes. |
static int |
RELATIVE_TO_SCREEN
Policy for placing the eyepoint in non-head-tracked modes. |
static int |
RELATIVE_TO_WINDOW
Policy for placing the eyepoint in non-head-tracked modes. |
static int |
RIGHT_EYE_VIEW
Specifies that monoscopic view generated should be the view as seen
from the right eye. |
static int |
SCALE_EXPLICIT
Specifies that the screen scale for this view is taken directly
from the user-provided screenScale parameter. |
static int |
SCALE_SCREEN_SIZE
Specifies that the screen scale for this view is derived from
the physical screen size. |
static int |
SCREEN_VIEW
Specifies that the viewing environment for this view is a
standard screen-based display environment. |
static int |
TRANSPARENCY_SORT_GEOMETRY
Policy that specifies that transparent objects
are sorted from back to front on a per-geometry basis. |
static int |
TRANSPARENCY_SORT_NONE
Policy that specifies that no sorting of transparent objects
is done. |
static int |
VIRTUAL_EYE
Specifies that the associated distance is measured
from the eye in virtual world coordinates. |
static int |
VIRTUAL_SCREEN
Specifies that the associated distance is measured
from the screen in virtual world coordinates. |
static int |
VIRTUAL_WORLD
Policy for resizing and moving windows. |
static int |
VISIBILITY_DRAW_ALL
Policy that specifies that both visible and invisible objects
should be drawn. |
static int |
VISIBILITY_DRAW_INVISIBLE
Policy that specifies that only invisible objects should be drawn. |
static int |
VISIBILITY_DRAW_VISIBLE
Policy that specifies that only visible objects should be drawn. |
Constructor Summary |
View()
Constructs a View object with default parameters. |
Method Summary |
void |
addCanvas3D(Canvas3D canvas3D)
Adds the given Canvas3D at the end of the list. |
void |
attachViewPlatform(ViewPlatform vp)
Attach viewPlatform structure to this view. |
java.util.Enumeration |
getAllCanvas3Ds()
Gets the enumeration object of all the Canvas3Ds. |
double |
getBackClipDistance()
Returns the view model's back clip distance. |
int |
getBackClipPolicy()
Returns the view model's current back clip policy. |
Canvas3D |
getCanvas3D(int index)
Gets the Canvas3D at the specified index position. |
boolean |
getCoexistenceCenteringEnable()
Retrieves the coexistenceCentering enable flag. |
boolean |
getCompatibilityModeEnable()
Retrieves the compatibility mode enable flag. |
long |
getCurrentFrameStartTime()
This method returns the time at which the most recent rendering
frame started. |
boolean |
getDepthBufferFreezeTransparent()
Retrieves the current value of the depth buffer freeze transparent
flag for this view. |
double |
getFieldOfView()
Returns the current field of view. |
long |
getFrameNumber()
This method returns the frame number for this view. |
long |
getFrameStartTimes(long[] times)
Copies the last k frame start time values into
the user-specified array. |
double |
getFrontClipDistance()
Returns the view model's front clip distance. |
int |
getFrontClipPolicy()
Returns the view model's current front clip policy. |
long |
getLastFrameDuration()
This method returns the duration, in milliseconds, of the most
recently completed rendering frame. |
void |
getLeftManualEyeInCoexistence(Point3d position)
Retrieves the position of the user-specified, manual left eye
in coexistence
coordinates and copies that value into the object provided. |
void |
getLeftProjection(Transform3D projection)
Compatibility mode method that retrieves the current
compatibility mode projection transform for the left eye and
places it into the specified object. |
boolean |
getLocalEyeLightingEnable()
Retrieves a flag that indicates whether or not local eye lighting
is enabled for this view. |
static int |
getMaxFrameStartTimes()
Retrieves the implementation-dependent maximum number of
frames whose start times will be recorded by the system. |
long |
getMinimumFrameCycleTime()
Retrieves the minimum frame cycle time, in milliseconds, for this view. |
int |
getMonoscopicViewPolicy()
Deprecated. As of Java 3D version 1.2, replaced by
Canvas3D.getMonoscopicViewPolicy |
PhysicalBody |
getPhysicalBody()
Returns a reference to the view model's PhysicalBody object. |
PhysicalEnvironment |
getPhysicalEnvironment()
Returns a reference to the view model's PhysicalEnvironment object. |
int |
getProjectionPolicy()
Retrieves the current projection policy for this View. |
void |
getRightManualEyeInCoexistence(Point3d position)
Retrieves the position of the user-specified, manual right eye
in coexistence
coordinates and copies that value into the object provided. |
void |
getRightProjection(Transform3D projection)
Compatibility mode method that retrieves the current
compatibility mode projection transform for the right eye and
places it into the specified object. |
boolean |
getSceneAntialiasingEnable()
Returns a flag that indicates whether or not scene antialiasing
is enabled for this view. |
double |
getScreenScale()
Returns the current screen scale value |
int |
getScreenScalePolicy()
Returns the current screen scale policy, one of:
SCALE_SCREEN_SIZE or SCALE_EXPLICIT. |
void |
getSensorHotspotInVworld(Sensor sensor,
Point3d position)
Retrieves the position of the specified Sensor's
hotspot in virtual-world coordinates
and copies that value into the position provided. |
void |
getSensorHotspotInVworld(Sensor sensor,
Point3f position)
Retrieves the position of the specified Sensor's
hotspot in virtual-world coordinates
and copies that value into the position provided. |
void |
getSensorToVworld(Sensor sensor,
Transform3D t)
Computes the sensor to virtual-world transform
and copies that value into the transform provided. |
boolean |
getTrackingEnable()
Returns a status flag indicating whether or not head tracking
is enabled. |
int |
getTransparencySortingPolicy()
Retrieves the current transparency sorting policy. |
void |
getUserHeadToVworld(Transform3D t)
Retrieves the user-head to virtual-world transform
and copies that value into the transform provided. |
boolean |
getUserHeadToVworldEnable()
Returns a status flag indicating whether or not
Java 3D is continuously updating the userHeadToVworldEnable transform. |
ViewPlatform |
getViewPlatform()
Retrieves the currently attached ViewPlatform object |
int |
getViewPolicy()
Retrieves the current view computation policy for this View. |
int |
getVisibilityPolicy()
Retrieves the current visibility policy. |
void |
getVpcToEc(Transform3D vpcToEc)
Compatibility mode method that retrieves the current
ViewPlatform Coordinates (VPC) system to
Eye Coordinates (EC) transform and copies it into the specified
object. |
int |
getWindowEyepointPolicy()
Returns the current window eyepoint policy, one of:
RELATIVE_TO_SCREEN, RELATIVE_TO_WINDOW, RELATIVE_TO_FIELD_OF_VIEW or
RELATIVE_TO_COEXISTENCE. |
int |
getWindowMovementPolicy()
Returns the current window movement policy,
one of: VIRTUAL_WORLD or PHYSICAL_WORLD. |
int |
getWindowResizePolicy()
Returns the current window resize policy, one of:
VIRTUAL_WORLD or PHYSICAL_WORLD. |
int |
indexOfCanvas3D(Canvas3D canvas3D)
Retrieves the index of the specified Canvas3D in
this View's list of Canvas3Ds |
void |
insertCanvas3D(Canvas3D canvas3D,
int index)
Inserts the Canvas3D at the given index position. |
boolean |
isBehaviorSchedulerRunning()
Retrieves a flag that indicates whether the behavior scheduler is
currently running. |
boolean |
isViewRunning()
Retrieves a flag that indicates whether the traverser is
currently running on this view. |
int |
numCanvas3Ds()
Returns the number of Canvas3Ds in this View. |
void |
removeAllCanvas3Ds()
Removes all Canvas3Ds from this View. |
void |
removeCanvas3D(Canvas3D canvas3D)
Removes the specified Canvas3D from this View's
list of Canvas3Ds. |
void |
removeCanvas3D(int index)
Removes the Canvas3D from the given index position. |
void |
renderOnce()
Renders one frame for a stopped View. |
void |
repaint()
Requests that this View be scheduled for rendering as soon as
possible. |
void |
setBackClipDistance(double distance)
Sets the view model's back clip distance. |
void |
setBackClipPolicy(int policy)
Sets the view model's back clip policy, the policy Java 3D uses
in computing where to place the back clip plane. |
void |
setCanvas3D(Canvas3D canvas3D,
int index)
Sets given Canvas3D at the given index position. |
void |
setCoexistenceCenteringEnable(boolean flag)
Sets the coexistenceCentering enable flag to true or false. |
void |
setCompatibilityModeEnable(boolean flag)
Sets the compatibility mode enable flag to true or false. |
void |
setDepthBufferFreezeTransparent(boolean flag)
Enables or disables automatic freezing of the depth buffer for
objects rendered
during the transparent rendering pass (i.e., objects rendered
using alpha blending) for this view. |
void |
setFieldOfView(double fieldOfView)
Sets the field of view used to compute the projection transform. |
void |
setFrontClipDistance(double distance)
Sets the view model's front clip distance. |
void |
setFrontClipPolicy(int policy)
Sets the view model's front clip policy, the policy Java 3D uses
in computing where to place the front clip plane. |
void |
setLeftManualEyeInCoexistence(Point3d position)
Sets the position of the manual left eye in coexistence
coordinates. |
void |
setLeftProjection(Transform3D projection)
Compatibility mode method that specifies a viewing frustum for
the left eye that transforms points in Eye Coordinates (EC) to
Clipping Coordinates (CC). |
void |
setLocalEyeLightingEnable(boolean flag)
Sets a flag that indicates whether the local eyepoint is used in
lighting calculations for perspective projections. |
void |
setMinimumFrameCycleTime(long minimumTime)
Sets the minimum frame cycle time, in milliseconds, for this
view. |
void |
setMonoscopicViewPolicy(int policy)
Deprecated. As of Java 3D version 1.2, replaced by
Canvas3D.setMonoscopicViewPolicy |
void |
setPhysicalBody(PhysicalBody physicalBody)
Sets the view model's physical body to the PhysicalBody object provided. |
void |
setPhysicalEnvironment(PhysicalEnvironment physicalEnvironment)
Sets the view model's physical environment to the PhysicalEnvironment
object provided. |
void |
setProjectionPolicy(int policy)
Sets the projection policy for this View. |
void |
setRightManualEyeInCoexistence(Point3d position)
Sets the position of the manual right eye in coexistence
coordinates. |
void |
setRightProjection(Transform3D projection)
Compatibility mode method that specifies a viewing frustum for
the right eye that transforms points in Eye Coordinates (EC) to
Clipping Coordinates (CC). |
void |
setSceneAntialiasingEnable(boolean flag)
Enables or disables scene antialiasing for this view. |
void |
setScreenScale(double scale)
Sets the screen scale value for this view. |
void |
setScreenScalePolicy(int policy)
Sets the screen scale policy for this view. |
void |
setTrackingEnable(boolean flag)
Turns head tracking on or off for this view. |
void |
setTransparencySortingPolicy(int policy)
Sets the transparency sorting policy for this view. |
void |
setUserHeadToVworldEnable(boolean flag)
Turns on or off the continuous
updating of the userHeadToVworld transform. |
void |
setViewPolicy(int policy)
Sets the policy for view computation. |
void |
setVisibilityPolicy(int policy)
Sets the visibility policy for this view. |
void |
setVpcToEc(Transform3D vpcToEc)
Compatibility mode method that specifies the ViewPlatform
Coordinates (VPC) to Eye Coordinates (EC) transform. |
void |
setWindowEyepointPolicy(int policy)
Sets the view model's window eyepoint policy. |
void |
setWindowMovementPolicy(int policy)
Sets the window movement policy. |
void |
setWindowResizePolicy(int policy)
Sets the window resize policy. |
void |
startBehaviorScheduler()
Starts the behavior scheduler running after it has been stopped. |
void |
startView()
Starts
traversing this view, and starts the renderers associated
with all canvases attached to this view. |
long[] |
stopBehaviorScheduler()
Stops the behavior scheduler after all
currently scheduled behaviors are executed. |
void |
stopView()
Stops traversing the scene graph for this
view after the current state of the scene graph is reflected on
all canvases attached to this view. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NOMINAL_HEAD
public static final int NOMINAL_HEAD
- Specifies a policy whereby the origin of physical or virtual
coordinates is relative to the position of the nominal head.
When used as a view attach policy, this sets the origin of view
platform coordinates to be at the eyepoint.
- See Also:
ViewPlatform.setViewAttachPolicy(int)
,
PhysicalEnvironment.setCoexistenceCenterInPworldPolicy(int)
,
Constant Field Values
NOMINAL_FEET
public static final int NOMINAL_FEET
- Specifies a policy whereby the origin of physical or virtual
coordinates is relative to the position of the nominal feet.
When used as a view attach policy, this sets the origin of view
platform coordinates to be at the ground plane.
- See Also:
ViewPlatform.setViewAttachPolicy(int)
,
PhysicalEnvironment.setCoexistenceCenterInPworldPolicy(int)
,
Constant Field Values
NOMINAL_SCREEN
public static final int NOMINAL_SCREEN
- Specifies a policy whereby the origin of physical or virtual
coordinates is relative to the screen.
When used as a view attach policy, this sets the origin of view
platform coordinates to be at the center of the window or screen,
in effect, allowing the user to view objects from an optimal viewpoint.
- See Also:
ViewPlatform.setViewAttachPolicy(int)
,
PhysicalEnvironment.setCoexistenceCenterInPworldPolicy(int)
,
Constant Field Values
SCALE_SCREEN_SIZE
public static final int SCALE_SCREEN_SIZE
- Specifies that the screen scale for this view is derived from
the physical screen size. This scale factor is computed as follows:
physical_screen_width / 2.0
This allows an application to define a world in a normalized
[-1,1] space and view it on a screen of any size.
- See Also:
setScreenScalePolicy(int)
,
Constant Field Values
SCALE_EXPLICIT
public static final int SCALE_EXPLICIT
- Specifies that the screen scale for this view is taken directly
from the user-provided screenScale parameter.
- See Also:
setScreenScalePolicy(int)
,
setScreenScale(double)
,
Constant Field Values
VIRTUAL_SCREEN
public static final int VIRTUAL_SCREEN
- Specifies that the associated distance is measured
from the screen in virtual world coordinates.
Policy for interpreting clip plane distances.
Used in specifying the policy in frontClipPolicy and backClipPolicy.
- See Also:
setFrontClipPolicy(int)
,
setBackClipPolicy(int)
,
Constant Field Values
PHYSICAL_SCREEN
public static final int PHYSICAL_SCREEN
- Specifies that the associated distance is measured
from the screen in meters.
Policy for interpreting clip plane distances.
Used in specifying the policy in frontClipPolicy and backClipPolicy.
- See Also:
setFrontClipPolicy(int)
,
setBackClipPolicy(int)
,
Constant Field Values
VIRTUAL_EYE
public static final int VIRTUAL_EYE
- Specifies that the associated distance is measured
from the eye in virtual world coordinates.
Policy for interpreting clip plane distances.
Used in specifying the policy in frontClipPolicy and backClipPolicy.
- See Also:
setFrontClipPolicy(int)
,
setBackClipPolicy(int)
,
Constant Field Values
PHYSICAL_EYE
public static final int PHYSICAL_EYE
- Specifies that the associated distance is measured
from the eye in meters.
Policy for interpreting clip plane distances.
Used in specifying the policy in frontClipPolicy and backClipPolicy.
- See Also:
setFrontClipPolicy(int)
,
setBackClipPolicy(int)
,
Constant Field Values
VIRTUAL_WORLD
public static final int VIRTUAL_WORLD
- Policy for resizing and moving windows.
Used in specifying windowResizePolicy and windowMovementPolicy.
VIRTUAL_WORLD specifies that the associated action takes place
in the virtual world as well as in the physical world.
- See Also:
setWindowResizePolicy(int)
,
setWindowMovementPolicy(int)
,
Constant Field Values
PHYSICAL_WORLD
public static final int PHYSICAL_WORLD
- Policy for resizing and moving windows.
Used in specifying windowResizePolicy and windowMovementPolicy.
PHYSICAL_WORLD specifies that the specified action takes place
only in the physical world.
- See Also:
setWindowResizePolicy(int)
,
setWindowMovementPolicy(int)
,
Constant Field Values
RELATIVE_TO_SCREEN
public static final int RELATIVE_TO_SCREEN
- Policy for placing the eyepoint in non-head-tracked modes.
Specifies that Java 3D should interpret the
given fixed eyepoint position as relative to the entire screen.
This implies
that the view frustum shape will change whenever a
user moves the location of a window on the screen.
- See Also:
setWindowEyepointPolicy(int)
,
Constant Field Values
RELATIVE_TO_WINDOW
public static final int RELATIVE_TO_WINDOW
- Policy for placing the eyepoint in non-head-tracked modes.
Specifies that Java 3D should interpret the
given fixed-eyepoint position as relative to the window.
- See Also:
setWindowEyepointPolicy(int)
,
Constant Field Values
RELATIVE_TO_FIELD_OF_VIEW
public static final int RELATIVE_TO_FIELD_OF_VIEW
- Policy for placing the eyepoint in non-head-tracked modes.
Specifies that Java 3D should
modify the position of the eyepoint to match any changes in field
of view; the view frustum will change whenever the application
program changes the field of view.
NOTE: when this policy is specified, the Z coordinate of
the derived eyepoint is used in place of
nominalEyeOffsetFromNominalScreen.
- See Also:
setWindowEyepointPolicy(int)
,
Constant Field Values
RELATIVE_TO_COEXISTENCE
public static final int RELATIVE_TO_COEXISTENCE
- Policy for placing the eyepoint in non-head-tracked modes.
Specifies that Java 3D should interpret the fixed eyepoint
position in the view as relative to the origin
of coexistence coordinates. This eyepoint is transformed from
coexistence coordinates to image plate coordinates for each
Canvas3D.
As in RELATIVE_TO_SCREEN mode, this implies
that the view frustum shape will change whenever a
user moves the location of a window on the screen.
- Since:
- Java 3D 1.2
- See Also:
setWindowEyepointPolicy(int)
,
Constant Field Values
LEFT_EYE_VIEW
public static final int LEFT_EYE_VIEW
- Specifies that monoscopic view generated should be the view as seen
from the left eye.
- See Also:
Canvas3D.setMonoscopicViewPolicy(int)
,
Constant Field Values
RIGHT_EYE_VIEW
public static final int RIGHT_EYE_VIEW
- Specifies that monoscopic view generated should be the view as seen
from the right eye.
- See Also:
Canvas3D.setMonoscopicViewPolicy(int)
,
Constant Field Values
CYCLOPEAN_EYE_VIEW
public static final int CYCLOPEAN_EYE_VIEW
- Specifies that monoscopic view generated should be the view as seen
from the 'center eye', the fictional eye half-way between the left and
right eye.
- See Also:
Canvas3D.setMonoscopicViewPolicy(int)
,
Constant Field Values
SCREEN_VIEW
public static final int SCREEN_VIEW
- Specifies that the viewing environment for this view is a
standard screen-based display environment.
In this mode, Java 3D will compute new viewpoints
using that sequence of transforms appropriate to screen-based,
display environments, that may or may not include head tracking
(e.g., a monoscopic screen, fish-tank VR, portals, VR-desks).
This is the default mode.
- See Also:
setViewPolicy(int)
,
Constant Field Values
HMD_VIEW
public static final int HMD_VIEW
- Specifies that the viewing environment for this view is a
head-mounted display environment.
In this mode, Java 3D will compute new viewpoints
using that sequence of transforms appropriate to head-mounted display
environments. These environments are generally head-tracked.
- See Also:
setViewPolicy(int)
,
Constant Field Values
PARALLEL_PROJECTION
public static final int PARALLEL_PROJECTION
- Specifies that Java 3D should generate a parallel projection matrix
for this View.
- See Also:
setProjectionPolicy(int)
,
Constant Field Values
PERSPECTIVE_PROJECTION
public static final int PERSPECTIVE_PROJECTION
- Specifies that Java 3D should generate a perspective projection matrix
for this View.
This is the default mode.
- See Also:
setProjectionPolicy(int)
,
Constant Field Values
VISIBILITY_DRAW_VISIBLE
public static final int VISIBILITY_DRAW_VISIBLE
- Policy that specifies that only visible objects should be drawn.
This is the default mode.
- Since:
- Java 3D 1.2
- See Also:
setVisibilityPolicy(int)
,
Constant Field Values
VISIBILITY_DRAW_INVISIBLE
public static final int VISIBILITY_DRAW_INVISIBLE
- Policy that specifies that only invisible objects should be drawn.
- Since:
- Java 3D 1.2
- See Also:
setVisibilityPolicy(int)
,
Constant Field Values
VISIBILITY_DRAW_ALL
public static final int VISIBILITY_DRAW_ALL
- Policy that specifies that both visible and invisible objects
should be drawn.
- Since:
- Java 3D 1.2
- See Also:
setVisibilityPolicy(int)
,
Constant Field Values
TRANSPARENCY_SORT_NONE
public static final int TRANSPARENCY_SORT_NONE
- Policy that specifies that no sorting of transparent objects
is done.
This is the default mode.
- Since:
- Java 3D 1.3
- See Also:
setTransparencySortingPolicy(int)
,
Constant Field Values
TRANSPARENCY_SORT_GEOMETRY
public static final int TRANSPARENCY_SORT_GEOMETRY
- Policy that specifies that transparent objects
are sorted from back to front on a per-geometry basis.
- Since:
- Java 3D 1.3
- See Also:
setTransparencySortingPolicy(int)
,
Constant Field Values
View
public View()
- Constructs a View object with default parameters. The default
values are as follows:
view policy : SCREEN_VIEW
projection policy : PERSPECTIVE_PROJECTION
screen scale policy : SCALE_SCREEN_SIZE
window resize policy : PHYSICAL_WORLD
window movement policy : PHYSICAL_WORLD
window eyepoint policy : RELATIVE_TO_FIELD_OF_VIEW
monoscopic view policy : CYCLOPEAN_EYE_VIEW
front clip policy : PHYSICAL_EYE
back clip policy : PHYSICAL_EYE
visibility policy : VISIBILITY_DRAW_VISIBLE
transparency sorting policy : TRANSPARENCY_SORT_NONE
coexistenceCentering flag : true
compatibility mode : false
left projection : identity
right projection : identity
vpc to ec transform : identity
physical body : null
physical environment : null
screen scale : 1.0
field of view : PI/4
left manual eye in coexistence : (-0.033, 0.0, 0.4572)
right manual eye in coexistence : (0.033, 0.0, 0.4572)
front clip distance : 0.1
back clip distance : 10.0
tracking enable : false
user head to vworld enable : false
list of Canvas3D objects : empty
depth buffer freeze transparent : true
scene antialiasing : false
local eye lighting : false
view platform : null
behavior scheduler running : true
view running : true
minimum frame cycle time : 0
setViewPolicy
public void setViewPolicy(int policy)
- Sets the policy for view computation.
This variable specifies how Java 3D uses its transforms in
computing new viewpoints.
- SCREEN_VIEW specifies that Java 3D should compute a new viewpoint
using the sequence of transforms appropriate to screen-based
head-tracked display environments (fish-tank VR/portals/VR-desks).
- HMD_VIEW specifies that Java 3D should compute a new viewpoint
using the sequence of transforms appropriate to head mounted
display environments.
The default view policy is SCREEN_VIEW.
- Parameters:
policy
- the new policy, one of SCREEN_VIEW or HMD_VIEW
- Throws:
java.lang.IllegalArgumentException
- if policy is a value other than
SCREEN_VIEW or HMD_VIEW
java.lang.IllegalStateException
- if the specified policy
is HMD_VIEW and if any canvas associated with this view is
a stereo canvas with a monoscopicEyePolicy of CYCLOPEAN_EYE_VIEW
getViewPolicy
public int getViewPolicy()
- Retrieves the current view computation policy for this View.
- Returns:
- one of: SCREEN_VIEW or HMD_VIEW.
setProjectionPolicy
public void setProjectionPolicy(int policy)
- Sets the projection policy for this View.
This variable specifies the type of projection transform that
will be generated. A value of PARALLEL_PROJECTION specifies that
a parallel projection transform is generated. A value of
PERSPECTIVE_PROJECTION specifies that
a perspective projection transform is generated.
The default projection policy is PERSPECTIVE.
- Parameters:
policy
- the new policy, one of PARALLEL_PROJECTION or
PERSPECTIVE_PROJECTION
- Throws:
java.lang.IllegalArgumentException
- if policy is a value other than
PARALLEL_PROJECTION or PERSPECTIVE_PROJECTION
getProjectionPolicy
public int getProjectionPolicy()
- Retrieves the current projection policy for this View.
- Returns:
- one of: PARALLEL_PROJECTION or PERSPECTIVE_PROJECTION.
setScreenScalePolicy
public void setScreenScalePolicy(int policy)
- Sets the screen scale policy for this view.
This policy specifies how the screen scale is derived.
The value is either SCALE_SCREEN_SIZE or SCALE_EXPLICIT.
A value of SCALE_SCREEN_SIZE specifies that the scale is derived
from the size of the physical screen. A value of SCALE_EXPLICIT
specifies that the scale is taken directly from the screenScale
parameter.
The default screen scale policy is SCALE_SCREEN_SIZE.
- Parameters:
policy
- the new policy, one of SCALE_SCREEN_SIZE or
SCALE_EXPLICIT.
getScreenScalePolicy
public int getScreenScalePolicy()
- Returns the current screen scale policy, one of:
SCALE_SCREEN_SIZE or SCALE_EXPLICIT.
- Returns:
- the current screen scale policy
setWindowResizePolicy
public void setWindowResizePolicy(int policy)
- Sets the window resize policy.
This variable specifies how Java 3D modifies the view when
users resize windows. The variable can contain one of
VIRTUAL_WORLD or PHYSICAL_WORLD.
A value of VIRTUAL_WORLD implies that the original image
remains the same size on the screen but the user sees more
or less of the virtual world depending on whether the window
grew or shrank in size.
A value of PHYSICAL_WORLD implies that the original image
continues to fill the window in the same way using more or
less pixels depending on whether the window grew or shrank
in size.
The default window resize policy is PHYSICAL_WORLD.
- Parameters:
policy
- the new policy, one of VIRTUAL_WORLD or PHYSICAL_WORLD
getWindowResizePolicy
public int getWindowResizePolicy()
- Returns the current window resize policy, one of:
VIRTUAL_WORLD or PHYSICAL_WORLD.
- Returns:
- the current window resize policy
setWindowMovementPolicy
public void setWindowMovementPolicy(int policy)
- Sets the window movement policy.
This variable specifies what part of the virtual world Java 3D
draws as a function of window placement on the screen. The
variable can contain one of VIRTUAL_WORLD or PHYSICAL_WORLD.
A value of VIRTUAL_WORLD implies that the image seen in the
window changes as the position of the window shifts on the
screen. (This mode acts as if the window were a window into
the virtual world.)
A value of PHYSICAL_WORLD implies that the image seen in the
window remains the same no matter where the user positions
the window on the screen.
The default window movement policy is PHYSICAL_WORLD.
- Parameters:
policy
- the new policy, one of VIRTUAL_WORLD or PHYSICAL_WORLD
getWindowMovementPolicy
public int getWindowMovementPolicy()
- Returns the current window movement policy,
one of: VIRTUAL_WORLD or PHYSICAL_WORLD.
- Returns:
- the current window movement policy
setWindowEyepointPolicy
public void setWindowEyepointPolicy(int policy)
- Sets the view model's window eyepoint policy.
This variable specifies how Java 3D handles the predefined eye
point in a non-head-tracked environment. The variable can contain
one of:
- RELATIVE_TO_SCREEN, Java 3D should interpret the
given fixed-eyepoint position as relative to the screen (this
implies that the view frustum shape will change whenever a
user moves the location of a window on the screen).
- RELATIVE_TO_WINDOW, Java 3D should interpret the
given fixed-eyepoint position as relative to the window. In this
mode, the X and Y values are taken as the center of the window and
the Z value is taken from the canvas eyepoint position.
- RELATIVE_TO_FIELD_OF_VIEW, Java 3D should
modify the position of the eyepoint to match any changes in field
of view (the view frustum will change whenever the application
program changes the field of view).
- RELATIVE_TO_COEXISTENCE, Java 3D should interpret the eye's
position in coexistence coordinates. In this mode, the eye position
is taken from the view (rather than the Canvas3D) and transformed from
coexistence coordinates to image plate coordinates for each
Canvas3D. The resulting eye position is relative to the screen (this
implies that the view frustum shape will change whenever a
user moves the location of a window on the screen).
The default window eyepoint policy is RELATIVE_TO_FIELD_OF_VIEW.
- Parameters:
policy
- the new policy, one of RELATIVE_TO_SCREEN,
RELATIVE_TO_WINDOW, RELATIVE_TO_FIELD_OF_VIEW, or
RELATIVE_TO_COEXISTENCE
getWindowEyepointPolicy
public int getWindowEyepointPolicy()
- Returns the current window eyepoint policy, one of:
RELATIVE_TO_SCREEN, RELATIVE_TO_WINDOW, RELATIVE_TO_FIELD_OF_VIEW or
RELATIVE_TO_COEXISTENCE.
- Returns:
- the current window eyepoint policy
setMonoscopicViewPolicy
public void setMonoscopicViewPolicy(int policy)
- Deprecated. As of Java 3D version 1.2, replaced by
Canvas3D.setMonoscopicViewPolicy
getMonoscopicViewPolicy
public int getMonoscopicViewPolicy()
- Deprecated. As of Java 3D version 1.2, replaced by
Canvas3D.getMonoscopicViewPolicy
setCoexistenceCenteringEnable
public void setCoexistenceCenteringEnable(boolean flag)
- Sets the coexistenceCentering enable flag to true or false.
If the coexistenceCentering flag is true, the center of
coexistence in image plate coordinates, as specified by the
trackerBaseToImagePlate transform, is translated to the center
of either the window or the screen in image plate coordinates,
according to the value of windowMovementPolicy.
By default, coexistenceCentering is enabled. It should be
disabled if the trackerBaseToImagePlate calibration transform
is set to a value other than the identity (for example, when
rendering to multiple screens or when head tracking is
enabled). This flag is ignored for HMD mode, or when the
coexistenceCenterInPworldPolicy is not
NOMINAL_SCREEN.
- Parameters:
flag
- the new coexistenceCentering enable flag- Since:
- Java 3D 1.2
getCoexistenceCenteringEnable
public boolean getCoexistenceCenteringEnable()
- Retrieves the coexistenceCentering enable flag.
- Returns:
- the current coexistenceCentering enable flag
- Since:
- Java 3D 1.2
setCompatibilityModeEnable
public void setCompatibilityModeEnable(boolean flag)
- Sets the compatibility mode enable flag to true or false.
Compatibility mode is disabled by default.
- Parameters:
flag
- the new compatibility mode enable flag
getCompatibilityModeEnable
public boolean getCompatibilityModeEnable()
- Retrieves the compatibility mode enable flag.
- Returns:
- the current compatibility mode enable flag
setLeftProjection
public void setLeftProjection(Transform3D projection)
- Compatibility mode method that specifies a viewing frustum for
the left eye that transforms points in Eye Coordinates (EC) to
Clipping Coordinates (CC).
If compatibility mode is disabled, then this transform is not used;
the actual projection is derived from other values.
In monoscopic mode, only the left eye projection matrix is used.
- Parameters:
projection
- the new left eye projection transform
- Throws:
RestrictedAccessException
- if compatibility mode is disabled.
setRightProjection
public void setRightProjection(Transform3D projection)
- Compatibility mode method that specifies a viewing frustum for
the right eye that transforms points in Eye Coordinates (EC) to
Clipping Coordinates (CC).
If compatibility mode is disabled, then this transform is not used;
the actual projection is derived from other values.
In monoscopic mode, the right eye projection matrix is ignored.
- Parameters:
projection
- the new right eye projection transform
- Throws:
RestrictedAccessException
- if compatibility mode is disabled.
getLeftProjection
public void getLeftProjection(Transform3D projection)
- Compatibility mode method that retrieves the current
compatibility mode projection transform for the left eye and
places it into the specified object.
- Parameters:
projection
- the Transform3D object that will receive the
projection
- Throws:
RestrictedAccessException
- if compatibility mode is disabled.
getRightProjection
public void getRightProjection(Transform3D projection)
- Compatibility mode method that retrieves the current
compatibility mode projection transform for the right eye and
places it into the specified object.
- Parameters:
projection
- the Transform3D object that will receive the
projection
- Throws:
RestrictedAccessException
- if compatibility mode is disabled.
setVpcToEc
public void setVpcToEc(Transform3D vpcToEc)
- Compatibility mode method that specifies the ViewPlatform
Coordinates (VPC) to Eye Coordinates (EC) transform.
If compatibility mode is disabled, then this transform
is derived from other values and is read-only.
- Parameters:
vpcToEc
- the new VPC to EC transform
- Throws:
RestrictedAccessException
- if compatibility mode is disabled.
BadTransformException
- if the transform is not affine.
getVpcToEc
public void getVpcToEc(Transform3D vpcToEc)
- Compatibility mode method that retrieves the current
ViewPlatform Coordinates (VPC) system to
Eye Coordinates (EC) transform and copies it into the specified
object.
- Parameters:
vpcToEc
- the object that will receive the vpcToEc transform.
- Throws:
RestrictedAccessException
- if compatibility mode is disabled.
setPhysicalBody
public void setPhysicalBody(PhysicalBody physicalBody)
- Sets the view model's physical body to the PhysicalBody object provided.
Java 3D uses the parameters in the PhysicalBody to ensure accurate
image and sound generation when in head-tracked mode.
- Parameters:
physicalBody
- the new PhysicalBody object
getPhysicalBody
public PhysicalBody getPhysicalBody()
- Returns a reference to the view model's PhysicalBody object.
- Returns:
- the view object's PhysicalBody object
setPhysicalEnvironment
public void setPhysicalEnvironment(PhysicalEnvironment physicalEnvironment)
- Sets the view model's physical environment to the PhysicalEnvironment
object provided.
- Parameters:
physicalEnvironment
- the new PhysicalEnvironment object
getPhysicalEnvironment
public PhysicalEnvironment getPhysicalEnvironment()
- Returns a reference to the view model's PhysicalEnvironment object.
- Returns:
- the view object's PhysicalEnvironment object
setScreenScale
public void setScreenScale(double scale)
- Sets the screen scale value for this view.
This is used when the screen scale policy is SCALE_EXPLICIT.
The default value is 1.0 (i.e., unscaled).
- Parameters:
scale
- the new screen scale
getScreenScale
public double getScreenScale()
- Returns the current screen scale value
- Returns:
- the current screen scale value
setFieldOfView
public void setFieldOfView(double fieldOfView)
- Sets the field of view used to compute the projection transform.
This is used when head tracking is disabled and when the Canvas3D's
windowEyepointPolicy is RELATIVE_TO_FIELD_OF_VIEW.
- Parameters:
fieldOfView
- the new field of view in radians
getFieldOfView
public double getFieldOfView()
- Returns the current field of view.
- Returns:
- the current field of view in radians
setLeftManualEyeInCoexistence
public void setLeftManualEyeInCoexistence(Point3d position)
- Sets the position of the manual left eye in coexistence
coordinates. This value determines eye placement when a head
tracker is not in use and the application is directly controlling
the eye position in coexistence coordinates. This value is
ignored when in head-tracked mode or when the
windowEyePointPolicy is not RELATIVE_TO_COEXISTENCE.
- Parameters:
position
- the new manual left eye position- Since:
- Java 3D 1.2
setRightManualEyeInCoexistence
public void setRightManualEyeInCoexistence(Point3d position)
- Sets the position of the manual right eye in coexistence
coordinates. This value determines eye placement when a head
tracker is not in use and the application is directly controlling
the eye position in coexistence coordinates. This value is
ignored when in head-tracked mode or when the
windowEyePointPolicy is not RELATIVE_TO_COEXISTENCE.
- Parameters:
position
- the new manual right eye position- Since:
- Java 3D 1.2
getLeftManualEyeInCoexistence
public void getLeftManualEyeInCoexistence(Point3d position)
- Retrieves the position of the user-specified, manual left eye
in coexistence
coordinates and copies that value into the object provided.
- Parameters:
position
- the object that will receive the position- Since:
- Java 3D 1.2
getRightManualEyeInCoexistence
public void getRightManualEyeInCoexistence(Point3d position)
- Retrieves the position of the user-specified, manual right eye
in coexistence
coordinates and copies that value into the object provided.
- Parameters:
position
- the object that will receive the position- Since:
- Java 3D 1.2
setFrontClipDistance
public void setFrontClipDistance(double distance)
- Sets the view model's front clip distance.
This value specifies the distance away from the eyepoint
in the direction of gaze where objects stop disappearing.
Objects closer to the eye than the front clip
distance are not drawn. The default value is 0.1 meters.
There are several considerations that need to be taken into
account when choosing values for the front and back clip
distances.
- The front clip distance must be greater than
0.0 in physical eye coordinates.
- The front clipping plane must be in front of the
back clipping plane, that is, the front clip distance
must be less than the back clip distance in physical eye
coordinates.
- The front and back clip distances, in physical
eye coordinates, must be less than the largest positive
single-precision floating point value,
Float.MAX_VALUE
.
In practice, since these physical eye coordinate distances are in
meters, the values should be much less than that.
- The ratio of the back distance divided by the front distance,
in physical eye coordinates, affects Z-buffer precision. This
ratio should be less than about 3000 in order to accommodate 16-bit
Z-buffers. Values of 100 to less than 1000 will produce better
results.
Violating any of the above rules will result in undefined
behavior. In many cases, no picture will be drawn.
- Parameters:
distance
- the new front clip distance- See Also:
setBackClipDistance(double)
getFrontClipDistance
public double getFrontClipDistance()
- Returns the view model's front clip distance.
- Returns:
- the current front clip distance
setBackClipDistance
public void setBackClipDistance(double distance)
- Sets the view model's back clip distance.
The parameter specifies the distance from the eyepoint
in the direction of gaze to where objects begin disappearing.
Objects farther away from the eye than the
back clip distance are not drawn.
The default value is 10.0 meters.
There are several considerations that need to be taken into
account when choosing values for the front and back clip
distances. These are enumerated in the description of
setFrontClipDistance.
Note that this attribute is only used if there is no Clip node
that is in scope of the view platform associated with this view.
- Parameters:
distance
- the new back clip distance- See Also:
setFrontClipDistance(double)
,
Clip.setBackDistance(double)
getBackClipDistance
public double getBackClipDistance()
- Returns the view model's back clip distance.
- Returns:
- the current back clip distance
getUserHeadToVworld
public void getUserHeadToVworld(Transform3D t)
- Retrieves the user-head to virtual-world transform
and copies that value into the transform provided.
- Parameters:
t
- the Transform3D object that will receive the transform
setFrontClipPolicy
public void setFrontClipPolicy(int policy)
- Sets the view model's front clip policy, the policy Java 3D uses
in computing where to place the front clip plane. The variable
can contain one of:
- VIRTUAL_EYE, to specify that the associated distance is
from the eye and in units of virtual distance
- PHYSICAL_EYE, to specify that the associated distance is
from the eye and in units of physical distance (meters)
- VIRTUAL_SCREEN, to specify that the associated distance is
from the screen and in units of virtual distance
- PHYSICAL_SCREEN, to specify that the associated distance is
from the screen and in units of physical distance (meters)
The default front clip policy is PHYSICAL_EYE.
- Parameters:
policy
- the new policy, one of PHYSICAL_EYE, PHYSICAL_SCREEN,
VIRTUAL_EYE, or VIRTUAL_SCREEN
getFrontClipPolicy
public int getFrontClipPolicy()
- Returns the view model's current front clip policy.
- Returns:
- one of:
VIRTUAL_EYE, PHYSICAL_EYE, VIRTUAL_SCREEN, or PHYSICAL_SCREEN
setBackClipPolicy
public void setBackClipPolicy(int policy)
- Sets the view model's back clip policy, the policy Java 3D uses
in computing where to place the back clip plane. The variable
can contain one of:
- VIRTUAL_EYE, to specify that the associated distance is
from the eye and in units of virtual distance
- PHYSICAL_EYE, to specify that the associated distance is
from the eye and in units of physical distance (meters)
- VIRTUAL_SCREEN, to specify that the associated distance is
from the screen and in units of virtual distance
- PHYSICAL_SCREEN, to specify that the associated distance is
from the screen and in units of physical distance (meters)
The default back clip policy is PHYSICAL_EYE.
- Parameters:
policy
- the new policy, one of PHYSICAL_EYE, PHYSICAL_SCREEN,
VIRTUAL_EYE, or VIRTUAL_SCREEN
getBackClipPolicy
public int getBackClipPolicy()
- Returns the view model's current back clip policy.
- Returns:
- one of:
VIRTUAL_EYE, PHYSICAL_EYE, VIRTUAL_SCREEN, or PHYSICAL_SCREEN
setVisibilityPolicy
public void setVisibilityPolicy(int policy)
- Sets the visibility policy for this view. This attribute
is one of:
- VISIBILITY_DRAW_VISIBLE, to specify that only visible objects
are drawn.
- VISIBILITY_DRAW_INVISIBLE, to specify that only invisible objects
are drawn.
- VISIBILITY_DRAW_ALL, to specify that both visible and
invisible objects are drawn.
The default visibility policy is VISIBILITY_DRAW_VISIBLE.
- Parameters:
policy
- the new policy, one of VISIBILITY_DRAW_VISIBLE,
VISIBILITY_DRAW_INVISIBLE, or VISIBILITY_DRAW_ALL.- Since:
- Java 3D 1.2
- See Also:
RenderingAttributes.setVisible(boolean)
getVisibilityPolicy
public int getVisibilityPolicy()
- Retrieves the current visibility policy.
- Returns:
- one of:
VISIBILITY_DRAW_VISIBLE,
VISIBILITY_DRAW_INVISIBLE, or VISIBILITY_DRAW_ALL.
- Since:
- Java 3D 1.2
setTransparencySortingPolicy
public void setTransparencySortingPolicy(int policy)
- Sets the transparency sorting policy for this view. This attribute
is one of:
- TRANSPARENCY_SORT_NONE, to specify that no depth sorting of
transparent objects is performed. Transparent objects are
drawn after opaque objects, but are not sorted from back to
front.
- TRANSPARENCY_SORT_GEOMETRY, to specify that transparent
objects are depth-sorted on a per-geometry basis. Each
geometry object of each transparent Shape3D node is drawn from
back to front. Note that this policy will not split geometry
into smaller pieces, so intersecting or intertwined objects may
not be sorted correctly.
The default policy is TRANSPARENCY_SORT_NONE.
- Parameters:
policy
- the new policy, one of TRANSPARENCY_SORT_NONE
or TRANSPARENCY_SORT_GEOMETRY.- Since:
- Java 3D 1.3
getTransparencySortingPolicy
public int getTransparencySortingPolicy()
- Retrieves the current transparency sorting policy.
- Returns:
- one of:
TRANSPARENCY_SORT_NONE or TRANSPARENCY_SORT_GEOMETRY.
- Since:
- Java 3D 1.3
setTrackingEnable
public void setTrackingEnable(boolean flag)
- Turns head tracking on or off for this view.
- Parameters:
flag
- specifies whether head tracking is enabled or
disabled for this view
getTrackingEnable
public boolean getTrackingEnable()
- Returns a status flag indicating whether or not head tracking
is enabled.
- Returns:
- a flag telling whether head tracking is enabled
setUserHeadToVworldEnable
public void setUserHeadToVworldEnable(boolean flag)
- Turns on or off the continuous
updating of the userHeadToVworld transform.
- Parameters:
flag
- enables or disables continuous updating
getUserHeadToVworldEnable
public boolean getUserHeadToVworldEnable()
- Returns a status flag indicating whether or not
Java 3D is continuously updating the userHeadToVworldEnable transform.
- Returns:
- a flag indicating if continuously updating userHeadToVworld
getSensorToVworld
public void getSensorToVworld(Sensor sensor,
Transform3D t)
- Computes the sensor to virtual-world transform
and copies that value into the transform provided.
The computed transforms takes points in the sensor's coordinate
system and produces the point's corresponding value in
virtual-world coordinates.
- Parameters:
sensor
- the sensor in questiont
- the object that will receive the transform
getSensorHotspotInVworld
public void getSensorHotspotInVworld(Sensor sensor,
Point3f position)
- Retrieves the position of the specified Sensor's
hotspot in virtual-world coordinates
and copies that value into the position provided.
This value is derived from other values and is read-only.
- Parameters:
sensor
- the sensor in questionposition
- the variable that will receive the position
getSensorHotspotInVworld
public void getSensorHotspotInVworld(Sensor sensor,
Point3d position)
- Retrieves the position of the specified Sensor's
hotspot in virtual-world coordinates
and copies that value into the position provided.
This value is derived from other values and is read-only.
- Parameters:
sensor
- the sensor in questionposition
- the variable that will receive the position
setCanvas3D
public void setCanvas3D(Canvas3D canvas3D,
int index)
- Sets given Canvas3D at the given index position.
- Parameters:
canvas3D
- the given Canvas3D to be setindex
- the position to be set
- Throws:
java.lang.IllegalStateException
- if the specified canvas is
a stereo canvas with a monoscopicEyePolicy of CYCLOPEAN_EYE_VIEW,
and the viewPolicy for this view is HMD_VIEW
IllegalSharingException
- if the specified canvas is
associated with another view
getCanvas3D
public Canvas3D getCanvas3D(int index)
- Gets the Canvas3D at the specified index position.
- Parameters:
index
- the position from which to get Canvas3D object
- Returns:
- the Canvas3D at the sprcified index position
getAllCanvas3Ds
public java.util.Enumeration getAllCanvas3Ds()
- Gets the enumeration object of all the Canvas3Ds.
- Returns:
- the enumeration object of all the Canvas3Ds.
numCanvas3Ds
public int numCanvas3Ds()
- Returns the number of Canvas3Ds in this View.
- Returns:
- the number of Canvas3Ds in this View
- Since:
- Java 3D 1.2
addCanvas3D
public void addCanvas3D(Canvas3D canvas3D)
- Adds the given Canvas3D at the end of the list.
- Parameters:
canvas3D
- the Canvas3D to be added
- Throws:
java.lang.IllegalStateException
- if the specified canvas is
a stereo canvas with a monoscopicEyePolicy of CYCLOPEAN_EYE_VIEW,
and the viewPolicy for this view is HMD_VIEW
IllegalSharingException
- if the specified canvas is
associated with another view
insertCanvas3D
public void insertCanvas3D(Canvas3D canvas3D,
int index)
- Inserts the Canvas3D at the given index position.
- Parameters:
canvas3D
- the Canvas3D to be insertedindex
- the position to be inserted at
- Throws:
java.lang.IllegalStateException
- if the specified canvas is
a stereo canvas with a monoscopicEyePolicy of CYCLOPEAN_EYE_VIEW,
and the viewPolicy for this view is HMD_VIEW
IllegalSharingException
- if the specified canvas is
associated with another view
removeCanvas3D
public void removeCanvas3D(int index)
- Removes the Canvas3D from the given index position.
- Parameters:
index
- the position of Canvas3D object to be removed
indexOfCanvas3D
public int indexOfCanvas3D(Canvas3D canvas3D)
- Retrieves the index of the specified Canvas3D in
this View's list of Canvas3Ds
- Parameters:
canvas3D
- the Canvas3D to be looked up.
- Returns:
- the index of the specified Canvas3D;
returns -1 if the object is not in the list.
- Since:
- Java 3D 1.3
removeCanvas3D
public void removeCanvas3D(Canvas3D canvas3D)
- Removes the specified Canvas3D from this View's
list of Canvas3Ds.
If the specified object is not in the list, the list is not modified.
- Parameters:
canvas3D
- the Canvas3D to be removed.
removeAllCanvas3Ds
public void removeAllCanvas3Ds()
- Removes all Canvas3Ds from this View.
- Since:
- Java 3D 1.3
getCurrentFrameStartTime
public long getCurrentFrameStartTime()
- This method returns the time at which the most recent rendering
frame started. It is defined as the number of milliseconds
since January 1, 1970 00:00:00 GMT.
Since multiple canvases might be attached to this View,
the start of a frame is defined as the point in time just prior
to clearing any canvas attached to this view.
- Returns:
- the time at which the most recent rendering frame started
getLastFrameDuration
public long getLastFrameDuration()
- This method returns the duration, in milliseconds, of the most
recently completed rendering frame. The time taken to render
all canvases attached to this view is measured. This duration
is computed as the difference between the start of the most recently
completed frame and the end of that frame.
Since multiple canvases might be attached to this View,
the start of a frame is defined as the point in time just prior
to clearing any canvas attached to this view--before preRender
is called for any canvas. Similarly, the end of a frame is
defined as the point in time just after swapping the buffer for
all canvases--after postSwap is called for all canvases.
Note that since the frame duration is measured from start to stop
for this view only, the value returned is not the same as
frame rate; it measures only the rendering time for this view.
- Returns:
- the duration, in milliseconds, of the most recently
completed rendering frame
getFrameNumber
public long getFrameNumber()
- This method returns the frame number for this view. The frame
number starts at 0 and is incremented at the start of each
frame--prior to clearing all the canvases attached to this
view.
- Returns:
- the current frame number for this view
getMaxFrameStartTimes
public static int getMaxFrameStartTimes()
- Retrieves the implementation-dependent maximum number of
frames whose start times will be recorded by the system. This
value is guaranteed to be at least 10 for all implementations
of the Java 3D API.
- Returns:
- the maximum number of frame start times recorded
getFrameStartTimes
public long getFrameStartTimes(long[] times)
- Copies the last k frame start time values into
the user-specified array. The most recent frame start time is
copied to location 0 of the array, the next most recent frame
start time is copied into location 1 of the array, and so forth.
If times.length is smaller than
maxFrameStartTimes, then only the last times.length values are
copied. If times.length is greater than maxFrameStartTimes,
then all array elements after index maxFrameStartTimes-1 are
set to 0.
- Returns:
- the frame number of the most recent frame in the array
- See Also:
setMinimumFrameCycleTime(long)
setMinimumFrameCycleTime
public void setMinimumFrameCycleTime(long minimumTime)
- Sets the minimum frame cycle time, in milliseconds, for this
view. The Java 3D renderer will ensure that the time between
the start of each successive frame is at least the specified
number of milliseconds. The default value is 0.
- Parameters:
minimumTime
- the minimum number of milliseconds between
successive frames
- Throws:
java.lang.IllegalArgumentException
- if minimumTime < 0
- Since:
- Java 3D 1.2
- See Also:
getFrameStartTimes(long[])
getMinimumFrameCycleTime
public long getMinimumFrameCycleTime()
- Retrieves the minimum frame cycle time, in milliseconds, for this view.
- Returns:
- the minimum frame cycle time for this view.
- Since:
- Java 3D 1.2
- See Also:
getFrameStartTimes(long[])
setDepthBufferFreezeTransparent
public void setDepthBufferFreezeTransparent(boolean flag)
- Enables or disables automatic freezing of the depth buffer for
objects rendered
during the transparent rendering pass (i.e., objects rendered
using alpha blending) for this view.
If enabled, depth buffer writes will be disabled during the
transparent rendering pass regardless of the value of
the depth buffer write enable flag in the RenderingAttributes
object for a particular node.
This flag is enabled by default.
- Parameters:
flag
- indicates whether automatic freezing of the depth buffer
for transparent/antialiased objects is enabled.- See Also:
RenderingAttributes.setDepthBufferWriteEnable(boolean)
getDepthBufferFreezeTransparent
public boolean getDepthBufferFreezeTransparent()
- Retrieves the current value of the depth buffer freeze transparent
flag for this view.
- Returns:
- a flag that indicates whether or not the depth
buffer is automatically frozen during the transparent rendering pass.
setSceneAntialiasingEnable
public void setSceneAntialiasingEnable(boolean flag)
- Enables or disables scene antialiasing for this view.
If enabled, the entire scene will be antialiased on
each canvas in which scene antialiasing is available.
Scene antialiasing is disabled by default.
NOTE: Scene antialiasing is ignored in pure immediate mode,
but is supported in mixed-immediate mode.
- Parameters:
flag
- indicates whether scene antialiasing is enabled- See Also:
Canvas3D.queryProperties()
getSceneAntialiasingEnable
public boolean getSceneAntialiasingEnable()
- Returns a flag that indicates whether or not scene antialiasing
is enabled for this view.
- Returns:
- a flag that indicates whether scene antialiasing is enabled
setLocalEyeLightingEnable
public void setLocalEyeLightingEnable(boolean flag)
- Sets a flag that indicates whether the local eyepoint is used in
lighting calculations for perspective projections.
If this flag is set to true, the view vector is calculated per-vertex
based on the direction from the actual eyepoint to the vertex.
If this flag is set to false, a single view vector is computed from
the eyepoint to the center of the view frustum. This is
called infinite eye lighting.
Local eye lighting is disabled by default, and is ignored for
parallel projections.
- Parameters:
flag
- indicates whether local eye lighting is enabled
getLocalEyeLightingEnable
public boolean getLocalEyeLightingEnable()
- Retrieves a flag that indicates whether or not local eye lighting
is enabled for this view.
- Returns:
- a flag that indicates whether local eye lighting is enabled
attachViewPlatform
public void attachViewPlatform(ViewPlatform vp)
- Attach viewPlatform structure to this view.
- Parameters:
vp
- the viewPlatform to be attached
getViewPlatform
public ViewPlatform getViewPlatform()
- Retrieves the currently attached ViewPlatform object
- Returns:
- the currently attached ViewPlatform
stopBehaviorScheduler
public final long[] stopBehaviorScheduler()
- Stops the behavior scheduler after all
currently scheduled behaviors are executed. Any frame-based
behaviors scheduled to wake up on the next frame will be
executed at least once before the behavior scheduler is
stopped.
NOTE: This is a heavy-weight method
intended for verification and image capture (recording); it
is not intended to be used for flow control.
- Returns:
- a pair of integers that specify the beginning and ending
time (in milliseconds since January 1, 1970 00:00:00 GMT)
of the behavior scheduler's last pass
- Throws:
java.lang.IllegalStateException
- if this method is called
from a Behavior method or from any Canvas3D render callback
method
startBehaviorScheduler
public final void startBehaviorScheduler()
- Starts the behavior scheduler running after it has been stopped.
- Throws:
java.lang.IllegalStateException
- if this method is called
from a Behavior method or from any Canvas3D render callback
method
isBehaviorSchedulerRunning
public final boolean isBehaviorSchedulerRunning()
- Retrieves a flag that indicates whether the behavior scheduler is
currently running.
- Returns:
- true if the behavior scheduler is running, false otherwise
- Throws:
java.lang.IllegalStateException
- if this method is called
from a Behavior method or from any Canvas3D render callback
method
stopView
public final void stopView()
- Stops traversing the scene graph for this
view after the current state of the scene graph is reflected on
all canvases attached to this view. The renderers associated
with these canvases are also stopped.
NOTE: This is a heavy-weight method
intended for verification and image capture (recording); it
is not intended to be used for flow control.
- Throws:
java.lang.IllegalStateException
- if this method is called
from a Behavior method or from any Canvas3D render callback
method
startView
public final void startView()
- Starts
traversing this view, and starts the renderers associated
with all canvases attached to this view.
- Throws:
java.lang.IllegalStateException
- if this method is called
from a Behavior method or from any Canvas3D render callback
method
isViewRunning
public final boolean isViewRunning()
- Retrieves a flag that indicates whether the traverser is
currently running on this view.
- Returns:
- true if the traverser is running, false otherwise
- Throws:
java.lang.IllegalStateException
- if this method is called
from a Behavior method or from any Canvas3D render callback
method
renderOnce
public void renderOnce()
- Renders one frame for a stopped View. Functionally, this
method is equivalent to
startView()
followed by
stopview()
, except that it is atomic, which
guarantees that only one frame is rendered.
- Throws:
java.lang.IllegalStateException
- if this method is called from
a Behavior method or from any Canvas3D render callback, or if
the view is currently running.- Since:
- Java 3D 1.2
repaint
public void repaint()
- Requests that this View be scheduled for rendering as soon as
possible. The repaint method may return before the frame has
been rendered. If the view is stopped, or if the view is
continuously running (for example, due to a free-running
interpolator), this method will have no effect. Most
applications will not need to call this method, since any
update to the scene graph or to viewing parameters will
automatically cause all affected views to be rendered.
- Since:
- Java 3D 1.2