Java Reference
In-Depth Information
Figure 11. Methods for camera based viewing model
public boolean getCompatibilityMode
public void setCompatibilityMode(boolean flag)
// Get current model
// Set on or off camera based model
public void frustum(
double left, double right,
double bottom, double top,
double near, double far)
// Create a perspective projection transform for
// a traditional camera based model
public void perspective(
double fovx,
double aspect,
double zNear, double zFar)
// Create a perspective projection transform for
// a traditional camera based model
public Transform3D getLeftProjection
public Transform3D getRightProjection
public void setLeftProjection(Transform3D projection)
public void setRightProjection(Transform3D projection)
// Get and set the viewing frustums for left and right eye so that eye coordinates are properly transformed // to get camera based view
however, that using these will not be compatible with developing advanced applications
using, say, head mounted displays.
Figure 12 shows the important code segment and results obtained in a simple example
illustrating the use of the methods for this compatibility mode provided by Java 3D. The
code segment takes relevant inputs from the user, calculates the relevant transformation
needed and then render the view.
The actionPerformed method corresponds to the last one in the overall code structure
of Figure 4, and is meant for processing the inputs from the user whenever a mouse click
is received over the window. The updateView method is a generic function for detecting
user inputs on the sets of buttons and returning value that has been changed. For instance,
for the parameter topVal, updateView detects topInc and topDec, and updates topLabel
accordingly. topVal is then passed as a parameter to the frustum method.
Search WWH ::

Custom Search