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.
- See Also:
Canvas3D
,
PhysicalBody
,
PhysicalEnvironment
,
ViewPlatform
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 |
NOMINAL_SCREEN_SCALED
Deprecated. All view attach policies are now affected by the screen
scale, so this policy is identical to NOMINAL_SCREEN, which should
be used instead. |
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_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 |
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. |
Constructor Summary |
View()
Constructs a View object with default parameters. |
Method Summary |
void |
addAudioDevice(AudioDevice device)
Deprecated. Use PhysicalEnvironment.setAudioDevice(AudioDevice)
instead of View.addAudioDevice(AudioDevice) |
void |
addCanvas3D(Canvas3D canvas3D)
Adds the given canvas3D at the end of the list. |
void |
addInputDevice(InputDevice device)
Deprecated. Use PhysicalEnvironment.addInputDevice(InputDevice)
instead of View.addInputDevice(InputDevice) |
java.util.Enumeration |
allAudioDevices()
Deprecated. Use PhysicalEnvironment.getAudioDevice() instead of
View.allAudioDevices() |
java.util.Enumeration |
allInputDevices()
Deprecated. Use PhysicalEnvironment.getAllInputDevices() instead of
View.allInputDevices() |
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 from the given index position. |
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 |
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. |
int |
getMonoscopicViewPolicy()
Returns policy on how Java 3D generates monoscopic view. |
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 |
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 last known
hotspot position in virtual-world coordinates
and copies that value into the vector provided. |
void |
getSensorHotspotInVworld(Sensor sensor,
Point3f position)
Retrieves the position of the specified Sensor's last known
hotspot position in virtual-world coordinates
and copies that value into the vector 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. |
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. |
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, or RELATIVE_TO_FIELD_OF_VIEW. |
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. |
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. |
void |
removeCanvas3D(Canvas3D canvas3D)
Removes the given canvas3D. |
void |
removeCanvas3D(int index)
Removes the canvas3D from the given index position. |
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 |
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 |
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 |
setMonoscopicViewPolicy(int policy)
Specifies how Java 3D generates monoscopic view. |
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 |
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 |
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 |
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)
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)
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)
NOMINAL_SCREEN_SCALED
public static final int NOMINAL_SCREEN_SCALED
- Deprecated. All view attach policies are now affected by the screen
scale, so this policy is identical to NOMINAL_SCREEN, which should
be used instead.
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)
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)
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)
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)
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)
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)
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)
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)
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.
Used in specifying the window eyepoint policy.
- See Also:
setWindowEyepointPolicy(int)
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.
Used in specifying the window eyepoint policy.
- See Also:
setWindowEyepointPolicy(int)
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.
Used in specifying the window eyepoint policy.
NOTE: when this policy is specified, the Z coordinate of
the derived eyepoint is used in place of
nominalEyeOffsetFromNominalScreen.
- See Also:
setWindowEyepointPolicy(int)
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:
setMonoscopicViewPolicy(int)
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:
setMonoscopicViewPolicy(int)
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:
setMonoscopicViewPolicy(int)
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)
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)
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)
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)
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
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
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
setViewPolicy
public final 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
getViewPolicy
public final int getViewPolicy()
- Retrieves the current view computation policy for this View.
- Returns:
- one of: SCREEN_VIEW or HMD_VIEW.
setProjectionPolicy
public final 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 final int getProjectionPolicy()
- Retrieves the current projection policy for this View.
- Returns:
- one of: PARALLEL_PROJECTION or PERSPECTIVE_PROJECTION.
setScreenScalePolicy
public final 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 final int getScreenScalePolicy()
- Returns the current screen scale policy, one of:
SCALE_SCREEN_SIZE or SCALE_EXPLICIT.
- Returns:
- the current screen scale policy
setWindowResizePolicy
public final 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 final int getWindowResizePolicy()
- Returns the current window resize policy, one of:
VIRTUAL_WORLD or PHYSICAL_WORLD.
- Returns:
- the current window resize policy
setWindowMovementPolicy
public final 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 final int getWindowMovementPolicy()
- Returns the current window movement policy,
one of: VIRTUAL_WORLD or PHYSICAL_WORLD.
- Returns:
- the current window movement policy
setWindowEyepointPolicy
public final 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)
The default window eyepoint policy is RELATIVE_TO_FIELD_OF_VIEW.
- Parameters:
policy
- the new policy, one of RELATIVE_TO_SCREEN,
RELATIVE_TO_WINDOW, or RELATIVE_TO_FIELD_OF_VIEW
getWindowEyepointPolicy
public final int getWindowEyepointPolicy()
- Returns the current window eyepoint policy, one of:
RELATIVE_TO_SCREEN, RELATIVE_TO_WINDOW, or RELATIVE_TO_FIELD_OF_VIEW.
- Returns:
- the current window eyepoint policy
setMonoscopicViewPolicy
public final void setMonoscopicViewPolicy(int policy)
- Specifies how Java 3D generates monoscopic view. If set to
LEFT_EYE_VIEW, the view generated corresponds to view as seen from
the left eye. If set to RIGHT_EYE_VIEW, the view generated corresponds
to the view as seen from the right eye. If set to CYCLOPEAN_EYE_VIEW,
the view generated corresponds to the view as seen from the 'center
eye', the fictional eye half-way between the left and right eye.
The default monoscopic view policy is CYCLOPEAN_EYE_VIEW.
- Parameters:
policy
- one of LEFT_EYE_VIEW, RIGHT_EYE_VIEW or
CYCLOPEAN_EYE_VIEW.
getMonoscopicViewPolicy
public final int getMonoscopicViewPolicy()
- Returns policy on how Java 3D generates monoscopic view.
- Returns:
- policy one of LEFT_EYE_VIEW, RIGHT_EYE_VIEW or
CYCLOPEAN_EYE_VIEW.
setCompatibilityModeEnable
public final 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 final boolean getCompatibilityModeEnable()
- Retrieves the compatibility mode enable flag.
- Returns:
- the current compatibility mode enable flag
setLeftProjection
public final 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 final 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 final 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 final 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 final 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 final 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 final 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 final PhysicalBody getPhysicalBody()
- Returns a reference to the view model's PhysicalBody object.
- Returns:
- the view object's PhysicalBody object
setPhysicalEnvironment
public final void setPhysicalEnvironment(PhysicalEnvironment physicalEnvironment)
- Sets the view model's physical environment to the PhysicalEnvironment
object provided.
- Parameters:
physicalEnvironment
- the new PhysicalEnvironment object
getPhysicalEnvironment
public final PhysicalEnvironment getPhysicalEnvironment()
- Returns a reference to the view model's PhysicalEnvironment object.
- Returns:
- the view object's PhysicalEnvironment object
setScreenScale
public final 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 final double getScreenScale()
- Returns the current screen scale value
- Returns:
- the current screen scale value
setFieldOfView
public final 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 final double getFieldOfView()
- Returns the current field of view.
- Returns:
- the current field of view in radians
setFrontClipDistance
public final 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 final double getFrontClipDistance()
- Returns the view model's front clip distance.
- Returns:
- the current front clip distance
setBackClipDistance
public final 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 final double getBackClipDistance()
- Returns the view model's back clip distance.
- Returns:
- the current back clip distance
getUserHeadToVworld
public final 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 final 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 final 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 final 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 final int getBackClipPolicy()
- Returns the view model's current back clip policy.
- Returns:
- one of:
VIRTUAL_EYE, PHYSICAL_EYE, VIRTUAL_SCREEN, or PHYSICAL_SCREEN
setTrackingEnable
public final 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 final 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 final void setUserHeadToVworldEnable(boolean flag)
- Turns on or off the continuous
updating of the userHeadToVworld transform.
- Parameters:
flag
- enables or disables continuous updating
getUserHeadToVworldEnable
public final 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 final 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 final void getSensorHotspotInVworld(Sensor sensor,
Point3f position)
- Retrieves the position of the specified Sensor's last known
hotspot position in virtual-world coordinates
and copies that value into the vector provided.
This value is derived from other values and is read-only.
- Parameters:
sensor
- the sensor in questionposition
- the vector that will receive the position
getSensorHotspotInVworld
public final void getSensorHotspotInVworld(Sensor sensor,
Point3d position)
- Retrieves the position of the specified Sensor's last known
hotspot position in virtual-world coordinates
and copies that value into the vector provided.
This value is derived from other values and is read-only.
- Parameters:
sensor
- the sensor in questionposition
- the vector that will receive the position
setCanvas3D
public final 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
getCanvas3D
public final Canvas3D getCanvas3D(int index)
- Gets the canvas3D from the given index position.
- Parameters:
index
- the position from which to get Canvas3D object- Returns:
- canvas3D the canvas3D at index position
getAllCanvas3Ds
public final java.util.Enumeration getAllCanvas3Ds()
- Gets the enumeration object of all the canvas3Ds.
- Returns:
- the enumeration object of all the canvas3Ds.
addCanvas3D
public final void addCanvas3D(Canvas3D canvas3D)
- Adds the given canvas3D at the end of the list.
- Parameters:
canvas3D
- the canvas3D to be added
insertCanvas3D
public final 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
removeCanvas3D
public final void removeCanvas3D(int index)
- Removes the canvas3D from the given index position.
- Parameters:
index
- the position of Canvas3D object to be removed
removeCanvas3D
public final void removeCanvas3D(Canvas3D canvas3D)
- Removes the given canvas3D.
- Parameters:
canvas3D
- the canvas3D to be removed
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,
while the end of a frame is defined as the point in time
just after swapping the buffer for all canvases.
- 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 prior to clearing all
the canvases attached to this view.
- Returns:
- the 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
setDepthBufferFreezeTransparent
public final 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 final 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 final 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.
- Parameters:
flag
- indicates whether scene antialiasing is enabled
getSceneAntialiasingEnable
public final 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 final 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 final 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 final void attachViewPlatform(ViewPlatform vp)
- Attach viewPlatform structure to this view.
- Parameters:
vp
- the viewPlatform to be attached
getViewPlatform
public final 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
addInputDevice
public final void addInputDevice(InputDevice device)
- Deprecated. Use PhysicalEnvironment.addInputDevice(InputDevice)
instead of View.addInputDevice(InputDevice)
allInputDevices
public final java.util.Enumeration allInputDevices()
- Deprecated. Use PhysicalEnvironment.getAllInputDevices() instead of
View.allInputDevices()
addAudioDevice
public final void addAudioDevice(AudioDevice device)
- Deprecated. Use PhysicalEnvironment.setAudioDevice(AudioDevice)
instead of View.addAudioDevice(AudioDevice)
allAudioDevices
public final java.util.Enumeration allAudioDevices()
- Deprecated. Use PhysicalEnvironment.getAudioDevice() instead of
View.allAudioDevices()