public class ViewInfo extends Object
The architecture of the Java 3D 1.3 sample implementation introduces a
frame latency between updates to the application scene graph structure and
their effects on internal Java 3D state. getImagePlateToVworld
and other methods in the core Java 3D classes use a transform from view
platform coordinates to virtual world coordinates that can be out of date
with respect to the state of the view platform as set by the application.
When an application uses the transforms returned by those methods to update
view dependent parts of the scene graph, those updates might not be
synchronized with what the viewer actually sees.
The methods in this class work around this problem at the expense of
querying the application state of the scene graph to get the current
transform from view platform to virtual world coordinates. This can
involve a potential performance degradation, however, since the application
scene graph state is not designed for high performance queries. The view
platform must also have ALLOW_LOCAL_TO_VWORLD_READ
capability
set, which potentially inhibits internal scene graph optimization.
On the other hand, application behaviors that create the view platform
transformation directly will have access to it without the need to query it
from the scene graph; in that case, the transforms from physical
coordinates to view platform coordinates provided by this class are all
that are needed. The ALLOW_LOCAL_TO_VWORLD_READ
view platform
capability doesn't need to be set for these applications.
Other Synchronization Issues
Scene graph updates are guaranteed to take effect in the same frame only if run from the processStimulus() method of a Behavior. Updates from multiple behaviors are only guaranteed to take effect in the same frame if they're responding to a WakeupOnElapsedFrames(0) condition. Use a single behavior to perform view dependent updates if possible; otherwise, use WakeupOnElapsedFrames(0) and set behavior scheduling intervals to ensure that behaviors that need the current view platform transform are run after it's set. Updating scene graph elements from anything other than the Behavior thread, such as an external input thread or a renderer callback in Canvas3D, will not necessarily be synchronized with rendering.
Direct updates to geometry data have a different frame latency than updates to scene graph transforms and structure. In the Java 3D 1.3 architecture, updates to by-reference geometry arrays and texture data have a 1-frame latency, while updates to transforms and scene graph structure have a 2-frame latency. Because of bug 4799494, which is outstanding in Java 3D 1.3.1, updates to by-copy geometry arrays also have a 1-frame latency. It is therefore recommended that view dependent scene graph updates be limited to transforms and scene graph structure only.
If it is not possible to avoid updating geometry directly, then these updates must be delayed by one frame in order to remain synchronized with the view platform. This can be accomplished by creating an additional behavior to actually update the geometry, separate from the behavior that computes the changes that need to be made based on current view state. If the update behavior is awakened by a behavior post from the computing behavior then the update will be delayed by a single frame.
Implementation Notes
This utility is essentially a rewrite of a few private Java 3D core classes, but designed for public use and source code availability. The source code may be helpful in understanding some of the more complex aspects of the view model, especially with regards to various interactions between attributes which are not adequately documented. None of the actual core Java 3D source code is used, but the code is designed to comply with the view model as defined by the Java 3D Specification, so it can be considered an alternative implementation. This class will produce the same results as the Java 3D core implementation except for:
The last item deserves some mention. Java 3D provides no way to directly
query the tracked head position being used by the renderer. The View's
getUserHeadToVworld
method always incorporates a virtual world
transform that is out of date with respect to the application scene graph
state. ViewInfo reads data from the head tracking sensor directly, but
since head trackers are continuous input devices, getting the same data
that the renderer is using is unlikely. See the source code for the
private method getHeadInfo
in this class for more information
and possible workarounds.
Thread Safety
All transforms are lazily evaluated. The updateScreen
,
updateCanvas
, updateViewPlatform
,
updateView
, and updateHead
methods just set flags
indicating that derived transforms need to be recomputed; they are safe to
call from any thread. updateCanvas
, for example, can safely
be called from an AWT event listener.
Screens and view platforms can be shared between separate views in the Java 3D view model. To remain accurate, ViewInfo also allows this sharing. Since it is likely that a multi-view application has separate threads managing each view, potential concurrent modification of data associated with a screen or a view platform is internally synchronized in this class. It is safe for each thread to use its own instance of a ViewInfo corresponding to the view it is managing.
Otherwise, none of the other methods in this class are internally synchronized. Except for the update methods mentioned above, a single instance of ViewInfo should not be used by more than one concurrent thread without external synchronization.
Modifier and Type | Field and Description |
---|---|
static int |
CANVAS_AUTO_UPDATE
Indicates that updates to a Canvas3D associated with the View should
be automatically checked with each call to a public method in this
class.
|
static int |
HEAD_AUTO_UPDATE
Indicates that updates to the tracked head position should be
automatically checked with each call to a public method in this class.
|
static int |
PLATFORM_AUTO_UPDATE
Indicates that updates to the ViewPlatform
localToVworld
transform should be automatically checked with each call to a public
method in this class. |
static int |
SCREEN_AUTO_UPDATE
Indicates that updates to a Screen3D associated with the View should
be automatically checked with each call to a public method in this
class.
|
static int |
VIEW_AUTO_UPDATE
Indicates that updates to the View should be automatically checked
with each call to a public method in this class.
|
Constructor and Description |
---|
ViewInfo(View view)
Creates a new ViewInfo for the specified View.
|
ViewInfo(View view,
int autoUpdateFlags)
Creates a new ViewInfo for the specified View.
|
ViewInfo(View view,
int autoUpdateFlags,
Map screenMap,
Map viewPlatformMap)
Creates a new ViewInfo for the specified View.
|
Modifier and Type | Method and Description |
---|---|
static void |
clear()
Release all static memory references held by ViewInfo, if any.
|
void |
getCoexistenceToImagePlate(Canvas3D c3d,
Transform3D coe2ipl,
Transform3D coe2ipr)
Gets the current transforms from coexistence coordinates to image plate
coordinates and copies them into the given Transform3Ds.
|
void |
getCoexistenceToViewPlatform(Canvas3D c3d,
Transform3D coe2vp)
Gets the current transform from coexistence coordinates to
view platform coordinates and copies it into the given transform.
|
void |
getCoexistenceToVworld(Canvas3D c3d,
Transform3D coe2vw)
Gets the current transform from coexistence coordinates to virtual
world coordinates and copies it into the given transform.
|
void |
getEyeToImagePlate(Canvas3D c3d,
Transform3D e2ipl,
Transform3D e2ipr)
Gets the transforms from eye coordinates to image plate coordinates and
copies them into the Transform3Ds specified.
|
void |
getEyeToViewPlatform(Canvas3D c3d,
Transform3D e2vpl,
Transform3D e2vpr)
Gets the current transforms from eye coordinates to view platform
coordinates and copies them into the given Transform3Ds.
|
void |
getEyeToVworld(Canvas3D c3d,
Transform3D e2vwl,
Transform3D e2vwr)
Gets the current transforms from eye coordinates to virtual world
coordinates and copies them into the given Transform3Ds.
|
protected Transform3D |
getHeadTrackerToTrackerBase()
Returns a reference to a Transform3D containing the current transform
from head tracker coordinates to tracker base coordinates.
|
void |
getImagePlateToViewPlatform(Canvas3D c3d,
Transform3D ip2vpl,
Transform3D ip2vpr)
Gets the current transforms from image plate coordinates to view
platform coordinates and copies them into the given Transform3Ds.
|
void |
getImagePlateToVworld(Canvas3D c3d,
Transform3D ip2vwl,
Transform3D ip2vwr)
Gets the current transforms from image plate coordinates to virtual
world coordinates and copies them into the given Transform3Ds.
|
void |
getInverseProjection(Canvas3D c3d,
Transform3D cc2el,
Transform3D cc2er)
Gets the transforms from clipping coordinates to eye coordinates
and copies them into the given Transform3Ds.
|
void |
getInverseViewPlatformProjection(Canvas3D c3d,
Transform3D cc2vpl,
Transform3D cc2vpr)
Gets the transforms from clipping coordinates to view platform
coordinates and copies them into the given Transform3Ds.
|
void |
getInverseVworldProjection(Canvas3D c3d,
Transform3D cc2vwl,
Transform3D cc2vwr)
Gets the transforms from clipping coordinates to virtual world
coordinates and copies them into the given Transform3Ds.
|
double |
getPhysicalBackClipDistance(Canvas3D c3d)
Gets the back clip distance scaled to physical meters.
|
double |
getPhysicalFrontClipDistance(Canvas3D c3d)
Gets the front clip distance scaled to physical meters.
|
double |
getPhysicalHeight(Canvas3D c3d)
Gets the height of the specified canvas scaled to physical meters.
|
void |
getPhysicalLocation(Canvas3D c3d,
Point3d location)
Gets the location of the specified canvas relative to the image plate
origin.
|
double |
getPhysicalToViewPlatformScale(Canvas3D c3d)
Gets the scale factor from physical meters to view platform units.
|
double |
getPhysicalToVirtualScale(Canvas3D c3d)
Gets the scale factor from physical meters to virtual units.
|
double |
getPhysicalWidth(Canvas3D c3d)
Gets the width of the specified canvas scaled to physical meters.
|
void |
getPixelLocationInImagePlate(Canvas3D c3d,
int x,
int y,
Point3d location)
Gets the location of the AWT pixel value and copies it into the
specified Point3d.
|
void |
getProjection(Canvas3D c3d,
Transform3D e2ccl,
Transform3D e2ccr)
Gets the transforms from eye coordinates to clipping coordinates
and copies them into the given Transform3Ds.
|
void |
getSensorToVworld(Canvas3D c3d,
Sensor sensor,
Transform3D s2vw)
Gets a read from the specified sensor and transforms it to virtual
world coordinates.
|
void |
getTrackerBaseToViewPlatform(Canvas3D c3d,
Transform3D tb2vp)
Gets the transform from tracker base coordinates to view platform
coordinates and copies it into the specified Transform3D.
|
void |
getTrackerBaseToVworld(Canvas3D c3d,
Transform3D tb2vw)
Gets the transform from tracker base coordinates to virtual world
coordinates and copies it into the specified Transform3D.
|
void |
getViewPlatformToCoexistence(Canvas3D c3d,
Transform3D vp2coe)
Gets the current transform from view platform coordinates to
coexistence coordinates and copies it into the given transform.
|
void |
getViewPlatformToEye(Canvas3D c3d,
Transform3D vp2el,
Transform3D vp2er)
Gets the current transforms from view platform coordinates to eye
coordinates and copies them into the given Transform3Ds.
|
void |
updateCanvas(Canvas3D c3d)
Arrange for an update of cached canvas parameters.
|
void |
updateHead()
Arrange for an update of the cached head position if head tracking is
enabled.
|
void |
updateScreen(Screen3D s3d)
Arrange for an update of cached screen parameters.
|
void |
updateView()
Arrange for an update of cached view parameters.
|
void |
updateViewPlatform()
Arrange for an update of the cached
localToVworld
transform of the view platform. |
protected boolean |
useHeadTracking()
Returns
true if head tracking should be used. |
public static final int SCREEN_AUTO_UPDATE
public static final int CANVAS_AUTO_UPDATE
public static final int VIEW_AUTO_UPDATE
public static final int HEAD_AUTO_UPDATE
public static final int PLATFORM_AUTO_UPDATE
localToVworld
transform should be automatically checked with each call to a public
method in this class. The View must be attached to a ViewPlatform
which is part of a live scene graph, and the ViewPlatform node must
have its ALLOW_LOCAL_TO_VWORLD_READ
capability set.public ViewInfo(View view)
Applications are responsible for informing this class of changes to the
View, its Canvas3D and Screen3D components, the tracked head position,
and the ViewPlatform's localToVworld
transform. These
notifications are performed with the updateView
,
updateCanvas
, updateScreen
,
updateHead
, and updateViewPlatform
methods.
The View must be attached to a ViewPlatform. If the ViewPlatform is
attached to a live scene graph, then ALLOW_POLICY_READ
capability must be set on the ViewPlatform node.
view
- the View to useupdateView
,
updateCanvas(Canvas3D)
,
updateScreen(Screen3D)
,
updateHead
,
updateViewPlatform()
public ViewInfo(View view, int autoUpdateFlags)
ALLOW_POLICY_READ
capability must be set
on the ViewPlatform node.view
- the View to useautoUpdateFlags
- a logical OR
of any of the
VIEW_AUTO_UPDATE
, CANVAS_AUTO_UPDATE
,
SCREEN_AUTO_UPDATE
, HEAD_AUTO_UPDATE
, or
PLATFORM_AUTO_UPDATE
flags to control whether changes to
the View, its Canvas3D or Screen3D components, the tracked head
position, or the ViewPlatform's localToVworld
transform
are checked automatically with each call to a public method of this
class; if a flag is not set, then the application must inform this
class of updates to the corresponding datapublic ViewInfo(View view, int autoUpdateFlags, Map screenMap, Map viewPlatformMap)
ALLOW_POLICY_READ
capability must be set
on the ViewPlatform node.ViewInfo caches Screen3D and ViewPlatform data, but Screen3D and ViewPlatform instances are shared across multiple Views in the Java 3D view model. Since ViewInfo is per-View, all ViewInfo constructors except for this one use static references to manage the shared Screen3D and ViewPlatform objects. In this constructor, however, the caller supplies two Map instances to hold these references for all ViewInfo instances, so static references can be avoided; it can be used to wrap this class into a multi-view context that provides the required maps.
Alternatively, the other constructors can be used by calling
ViewInfo.clear
when done with ViewInfo, or by simply
retaining the static references until the JVM exits.
view
- the View to useautoUpdateFlags
- a logical OR
of any of the
VIEW_AUTO_UPDATE
, CANVAS_AUTO_UPDATE
,
SCREEN_AUTO_UPDATE
, HEAD_AUTO_UPDATE
, or
PLATFORM_AUTO_UPDATE
flags to control whether changes to
the View, its Canvas3D or Screen3D components, the tracked head
position, or the ViewPlatform's localToVworld
transform
are checked automatically with each call to a public method of this
class; if a flag is not set, then the application must inform this
class of updates to the corresponding datascreenMap
- a writeable Map to hold Screen3D informationviewPlatformMap
- a writeable Map to hold ViewPlatform informationpublic void getImagePlateToViewPlatform(Canvas3D c3d, Transform3D ip2vpl, Transform3D ip2vpr)
With a monoscopic canvas the image plate transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left image plate transform, and if the second argument is non-null it receives the right image plate transform. These transforms are always the same unless a head mounted display driven by a single stereo canvas is in use.
c3d
- the Canvas3D associated with the image plateip2vpl
- the Transform3D to receive the left transformip2vpr
- the Transform3D to receive the right transform, or nullpublic void getImagePlateToVworld(Canvas3D c3d, Transform3D ip2vwl, Transform3D ip2vwr)
With a monoscopic canvas the image plate transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left image plate transform, and if the second argument is non-null it receives the right image plate transform. These transforms are always the same unless a head mounted display driven by a single stereo canvas is in use.
The View must be attached to a ViewPlatform which is part of a live
scene graph, and the ViewPlatform node must have its
ALLOW_LOCAL_TO_VWORLD_READ
capability set.
c3d
- the Canvas3D associated with the image plateip2vwl
- the Transform3D to receive the left transformip2vwr
- the Transform3D to receive the right transform, or nullpublic void getCoexistenceToImagePlate(Canvas3D c3d, Transform3D coe2ipl, Transform3D coe2ipr)
true
and PHYSICAL_WORLD
respectively, which
will center coexistence coordinates to the middle of the canvas,
aligned with the screen (image plate). A movement policy of
VIRTUAL_WORLD
centers coexistence coordinates to the
middle of the screen.
If coexistence centering is turned off, then canvases and screens can
have arbitrary positions with respect to coexistence, set through the
the Screen3D trackerBaseToImagePlate
transform and the
PhysicalEnvironment coexistenceToTrackerBase
transform.
These are calibration constants used for multiple fixed screen displays.
For head mounted displays the transform is determined by the user head
position along with calibration parameters found in Screen3D and
PhysicalBody. (See the source code for the private method
getEyesHMD
for more information).
With a monoscopic canvas the image plate transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left image plate transform, and if the second argument is non-null it receives the right image plate transform. These transforms are always the same unless a head mounted display driven by a single stereo canvas is in use.
c3d
- the Canvas3D associated with the image platecoe2ipl
- the Transform3D to receive the left transformcoe2ipr
- the Transform3D to receive the right transform, or nullpublic void getViewPlatformToCoexistence(Canvas3D c3d, Transform3D vp2coe)
Java 3D constructs a view from the physical position of the eyes relative to the physical positions of the image plates; it then uses a view platform to position that physical configuration into the virtual world and from there computes the correct projections of the virtual world onto the physical image plates. Coexistence coordinates are used to place the physical positions of the view platform, eyes, head, image plate, sensors, and tracker base in relation to each other. The view platform is positioned with respect to the virtual world through the scene graph, so the view platform to coexistence transform defines the space in which the virtual world and physical world coexist.
This method requires a Canvas3D. A different transform may be returned for each canvas in the view if any of the following apply:
PHYSICAL_WORLD
, which
alters the scale depending upon the width of the canvas.
SCALE_SCREEN_SIZE
,
which alters the scale depending upon the width of the screen
associated with the canvas.
RELATIVE_TO_FIELD_OF_VIEW
with a view attach policy of NOMINAL_HEAD
in effect,
which sets the view platform Z offset in coexistence coordinates
based on the width of the canvas. These are the default policies.
The offset also follows the width of the canvas when the
NOMINAL_FEET
view attach policy is used.c3d
- the Canvas3D to usevp2coe
- the Transform3D to receive the transformpublic void getCoexistenceToViewPlatform(Canvas3D c3d, Transform3D coe2vp)
This method requires a Canvas3D. The returned transform may differ
across canvases for the same reasons as discussed in the description of
getViewPlatformToCoexistence
.
c3d
- the Canvas3D to usecoe2vp
- the Transform3D to receive the transformgetViewPlatformToCoexistence(Canvas3D, Transform3D)
public void getCoexistenceToVworld(Canvas3D c3d, Transform3D coe2vw)
The View must be attached to a ViewPlatform which is part of a live
scene graph, and the ViewPlatform node must have its
ALLOW_LOCAL_TO_VWORLD_READ
capability set.
This method requires a Canvas3D. The returned transform may differ
across canvases for the same reasons as discussed in the description of
getViewPlatformToCoexistence
.
c3d
- the Canvas3D to usecoe2vw
- the Transform3D to receive the transformgetViewPlatformToCoexistence(Canvas3D, Transform3D)
public void getEyeToImagePlate(Canvas3D c3d, Transform3D e2ipl, Transform3D e2ipr)
When head tracking is used the eye positions are taken from the head
position and set in relation to the image plates with each Screen3D's
trackerBaseToImagePlate
transform. Otherwise the window
eyepoint policy is used to derive the eyepoint relative to the image
plate. When using a head mounted display the eye position is
determined solely by calibration constants in Screen3D and
PhysicalBody; see the source code for the private method
getEyesHMD
for more information.
Eye coordinates are always aligned with image plate coordinates, so these transforms are always just translations. With a monoscopic canvas the eye transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left eye transform, and if the second argument is non-null it receives the right eye transform.
c3d
- the Canvas3D associated with the image platee2ipl
- the Transform3D to receive left transforme2ipr
- the Transform3D to receive right transform, or nullpublic void getEyeToViewPlatform(Canvas3D c3d, Transform3D e2vpl, Transform3D e2vpr)
With a monoscopic canvas the eye transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left eye transform, and if the second argument is non-null it receives the right eye transform.
This method requires a Canvas3D. When using a head mounted display,
head tracking with fixed screens, or a window eyepoint policy of
RELATIVE_TO_COEXISTENCE
, then the transforms returned may
be different for each canvas if stereo is not in use and they have
different monoscopic view policies. They may additionally differ in
scale across canvases with the PHYSICAL_WORLD
window
resize policy or the SCALE_SCREEN_SIZE
screen scale
policy, which alter the scale depending upon the width of the canvas or
the width of the screen respectively.
With window eyepoint policies of RELATIVE_TO_FIELD_OF_VIEW
,
RELATIVE_TO_SCREEN
, or RELATIVE_TO_WINDOW
,
then the transforms returned may differ across canvases due to
the following additional conditions:
RELATIVE_TO_WINDOW
or
RELATIVE_TO_SCREEN
, in which case the manual eye
position in image plate can be set differently for each
canvas.
RELATIVE_TO_FIELD_OF_VIEW
and the view attach policy is NOMINAL_SCREEN
, which
decouples the view platform's canvas Z offset from the eyepoint's
canvas Z offset.
RELATIVE_TO_FIELD_OF_VIEW
or RELATIVE_TO_WINDOW
, and a window movement policy
of VIRTUAL_WORLD
centers the view platform's X and Y
coordinates to the middle of the screen.
c3d
- the Canvas3D to usee2vpl
- the Transform3D to receive the left transforme2vpr
- the Transform3D to receive the right transform, or nullpublic void getViewPlatformToEye(Canvas3D c3d, Transform3D vp2el, Transform3D vp2er)
With a monoscopic canvas the eye transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left eye transform, and if the second argument is non-null it receives the right eye transform.
This method requires a Canvas3D. The transforms returned may differ
across canvases for all the same reasons discussed in the description
of getEyeToViewPlatform
.
c3d
- the Canvas3D to usevp2el
- the Transform3D to receive the left transformvp2er
- the Transform3D to receive the right transform, or nullgetEyeToViewPlatform(Canvas3D, Transform3D, Transform3D)
public void getEyeToVworld(Canvas3D c3d, Transform3D e2vwl, Transform3D e2vwr)
With a monoscopic canvas the eye transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left eye transform, and if the second argument is non-null it receives the right eye transform.
The View must be attached to a ViewPlatform which is part of a live
scene graph, and the ViewPlatform node must have its
ALLOW_LOCAL_TO_VWORLD_READ
capability set.
This method requires a Canvas3D. The transforms returned may differ
across canvases for all the same reasons discussed in the description
of getEyeToViewPlatform
.
c3d
- the Canvas3D to usee2vwl
- the Transform3D to receive the left transforme2vwr
- the Transform3D to receive the right transform, or nullgetEyeToViewPlatform(Canvas3D, Transform3D, Transform3D)
public void getProjection(Canvas3D c3d, Transform3D e2ccl, Transform3D e2ccr)
With a monoscopic canvas the projection transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left projection transform, and if the second argument is non-null it receives the right projection transform.
If either of the clip policies VIRTUAL_EYE
or
VIRTUAL_SCREEN
are used, then the View should be attached
to a ViewPlatform that is part of a live scene graph and that has its
ALLOW_LOCAL_TO_VWORLD_READ
capability set; otherwise, a
scale factor of 1.0 will be used for the scale factor from virtual
world units to view platform units.
c3d
- the Canvas3D to usee2ccl
- the Transform3D to receive left transforme2ccr
- the Transform3D to receive right transform, or nullpublic void getInverseProjection(Canvas3D c3d, Transform3D cc2el, Transform3D cc2er)
With a monoscopic canvas the projection transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left projection transform, and if the second argument is non-null it receives the right projection transform.
If either of the clip policies VIRTUAL_EYE
or
VIRTUAL_SCREEN
are used, then the View should be attached
to a ViewPlatform that is part of a live scene graph and that has its
ALLOW_LOCAL_TO_VWORLD_READ
capability set; otherwise, a
scale factor of 1.0 will be used for the scale factor from virtual
world units to view platform units.
c3d
- the Canvas3D to usecc2el
- the Transform3D to receive left transformcc2er
- the Transform3D to receive right transform, or nullpublic void getInverseViewPlatformProjection(Canvas3D c3d, Transform3D cc2vpl, Transform3D cc2vpr)
With a monoscopic canvas the projection transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left projection transform, and if the second argument is non-null it receives the right projection transform.
If either of the clip policies VIRTUAL_EYE
or
VIRTUAL_SCREEN
are used, then the View should be attached
to a ViewPlatform that is part of a live scene graph and that has its
ALLOW_LOCAL_TO_VWORLD_READ
capability set; otherwise, a
scale factor of 1.0 will be used for the scale factor from virtual
world units to view platform units.
c3d
- the Canvas3D to usecc2vpl
- the Transform3D to receive left transformcc2vpr
- the Transform3D to receive right transform, or nullpublic void getInverseVworldProjection(Canvas3D c3d, Transform3D cc2vwl, Transform3D cc2vwr)
With a monoscopic canvas the projection transform is copied to the first argument and the second argument is not used. For a stereo canvas the first argument receives the left projection transform, and if the second argument is non-null it receives the right projection transform.
The View must be attached to a ViewPlatform which is part of a live
scene graph, and the ViewPlatform node must have its
ALLOW_LOCAL_TO_VWORLD_READ
capability set.
c3d
- the Canvas3D to usecc2vwl
- the Transform3D to receive left transformcc2vwr
- the Transform3D to receive right transform, or nullpublic double getPhysicalFrontClipDistance(Canvas3D c3d)
Note that this is not necessarily the clip distance as set by
setFrontClipDistance
, even when the front clip policy
is PHYSICAL_SCREEN
or PHYSICAL_EYE
. If
the window resize policy is PHYSICAL_WORLD
, then physical
clip distances as specified are in fact scaled by the ratio of the
window width to the screen width. The Java 3D view model does this
to prevent the physical clip planes from moving with respect to the
virtual world when the window is resized.
If either of the clip policies VIRTUAL_EYE
or
VIRTUAL_SCREEN
are used, then the View should be attached
to a ViewPlatform that is part of a live scene graph and that has its
ALLOW_LOCAL_TO_VWORLD_READ
capability set; otherwise, a
scale factor of 1.0 will be used for the scale factor from virtual
world units to view platform units.
c3d
- the Canvas3D to usepublic double getPhysicalBackClipDistance(Canvas3D c3d)
Note that this is not necessarily the clip distance as set by
setBackClipDistance
, even when the back clip policy
is PHYSICAL_SCREEN
or PHYSICAL_EYE
. If
the window resize policy is PHYSICAL_WORLD
, then physical
clip distances as specified are in fact scaled by the ratio of the
window width to the screen width. The Java 3D view model does this
to prevent the physical clip planes from moving with respect to the
virtual world when the window is resized.
If either of the clip policies VIRTUAL_EYE
or
VIRTUAL_SCREEN
are used, then the View should be attached
to a ViewPlatform that is part of a live scene graph and that has its
ALLOW_LOCAL_TO_VWORLD_READ
capability set; otherwise, a
scale factor of 1.0 will be used for the scale factor from virtual
world units to view platform units.
c3d
- the Canvas3D to usepublic double getPhysicalToViewPlatformScale(Canvas3D c3d)
This method requires a Canvas3D. A different scale may be returned for each canvas in the view if any of the following apply:
PHYSICAL_WORLD
, which
alters the scale depending upon the width of the canvas.
SCALE_SCREEN_SIZE
,
which alters the scale depending upon the width of the screen
associated with the canvas.c3d
- the Canvas3D to usepublic double getPhysicalToVirtualScale(Canvas3D c3d)
This method requires a Canvas3D. A different scale may be returned
across canvases for the same reasons as discussed in the description of
getPhysicalToViewPlatformScale
.
The View must be attached to a ViewPlatform which is part of a live
scene graph, and the ViewPlatform node must have its
ALLOW_LOCAL_TO_VWORLD_READ
capability set.
c3d
- the Canvas3D to usegetPhysicalToViewPlatformScale(Canvas3D)
public double getPhysicalWidth(Canvas3D c3d)
setPhysicalScreenWidth
method of Screen3D, then
Java 3D will derive the screen width based on a screen resolution of 90
pixels/inch.c3d
- the Canvas3D to usepublic double getPhysicalHeight(Canvas3D c3d)
setPhysicalScreenHeight
method of Screen3D, then
Java 3D will derive the screen height based on a screen resolution of 90
pixels/inch.c3d
- the Canvas3D to usepublic void getPhysicalLocation(Canvas3D c3d, Point3d location)
c3d
- the Canvas3D to uselocation
- the output position, in meters, of the lower-left
corner of the canvas relative to the image plate lower-left corner; Z
is always 0.0public void getPixelLocationInImagePlate(Canvas3D c3d, int x, int y, Point3d location)
c3d
- the Canvas3D to usex
- the X coordinate of the pixel relative to the upper-left
corner of the canvasy
- the Y coordinate of the pixel relative to the upper-left
corner of the canvaslocation
- the output position, in meters, relative to the
lower-left corner of the image plate; Z is always 0.0public void getSensorToVworld(Canvas3D c3d, Sensor sensor, Transform3D s2vw)
ALLOW_LOCAL_TO_VWORLD_READ
capability set.
This method requires a Canvas3D. The returned transform may differ
across canvases for the same reasons as discussed in the description of
getViewPlatformToCoexistence
.
sensor
- the Sensor instance to reads2vw
- the output transformgetViewPlatformToCoexistence(Canvas3D, Transform3D)
public void getTrackerBaseToViewPlatform(Canvas3D c3d, Transform3D tb2vp)
This method requires a Canvas3D. The returned transform may differ
across canvases for the same reasons as discussed in the description of
getViewPlatformToCoexistence
.
c3d
- the Canvas3D to usetb2vp
- the output transformgetViewPlatformToCoexistence(Canvas3D, Transform3D)
public void getTrackerBaseToVworld(Canvas3D c3d, Transform3D tb2vw)
ALLOW_LOCAL_TO_VWORLD_READ
capability set.
This method requires a Canvas3D. The returned transform may differ
across canvases for the same reasons as discussed in the description of
getViewPlatformToCoexistence
.
c3d
- the Canvas3D to usetb2vw
- the output transformgetViewPlatformToCoexistence(Canvas3D, Transform3D)
public static void clear()
It is safe to continue using existing ViewInfo instances after calling this method; the data in the released maps will be re-derived as needed.
public void updateScreen(Screen3D s3d)
s3d
- the Screen3D to updatepublic void updateCanvas(Canvas3D c3d)
c3d
- the Canvas3D to updatepublic void updateView()
These do not include the attributes of the existing Canvas3D or
Screen3D components of the View, but do include the attributes of all
other components such as the PhysicalEnvironment and PhysicalBody, and
all attributes of the attached ViewPlatform except for its
localToVworld
transform. The screen and canvas components
as well as the ViewPlatform's localToVworld
are cached
separately.
This method should also be called if the ViewPlatform is replaced with
another using the View's attachViewPlatform
method, or if
any of the setCanvas3D
, addCanvas3D
,
insertCanvas3D
, removeCanvas3D
, or
removeAllCanvas3Ds
methods of View are called to change
the View's canvas list.
Calling this method causes most transforms to be re-derived. It should be used only when necessary.
public void updateHead()
public void updateViewPlatform()
localToVworld
transform of the view platform. If automatic update has not been
enabled for this transform, then this method should be called anytime
the view platform has been repositioned in the virtual world and a
transform involving virtual world coordinates is desired.
The View must be attached to a ViewPlatform which is part of a live
scene graph, and the ViewPlatform node must have its
ALLOW_LOCAL_TO_VWORLD_READ
capability set.
protected Transform3D getHeadTrackerToTrackerBase()
useHeadTracking
returns true and a head position
update is specified with updateHead
or the
HEAD_AUTO_UPDATE
constructor flag.
The default implementation uses the head tracking sensor specified by
the View's PhysicalEnvironment, and reads it by calling the sensor's
getRead
method directly. The result is a sensor reading
that may have been taken at a slightly different time from the one used
by the renderer. This method can be overridden to synchronize the two
readings through an external mechanism.
useHeadTracking()
,
updateHead
,
HEAD_AUTO_UPDATE
protected boolean useHeadTracking()
true
if head tracking should be used.
The default implementation returns true
if the View's
getTrackingEnable
method and the PhysicalEnvironment's
getTrackingAvailable
method both return true
.
These are the same conditions under which the Java 3D renderer uses
head tracking. This method can be overridden if there is any need to
decouple the head tracking status of ViewInfo from the renderer.
true
if ViewInfo should use head trackingCopyright © 2016–2022 SciJava. All rights reserved.