view_volume(3G)
NAME
view_volume − define 3d viewing transformation matrix using a volume/viewport model
SYNOPSIS
C Syntax:
void view_volume(fildes,x1,y1,z1,x2,y2,z2);
int fildes;
float x1,y1,z1,x2,y2,z2;
FORTRAN77 Syntax:
subroutine view_volume(fildes,x1,y1,z1,x2,y2,z2);
integer*4 fildes
real x1,y1,z1,x2,y2,z2;
Pascal Syntax:
procedure view_volume(fildes:integer; real x1,y1,z1,x2,y2,z2);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
x1,y1,x2,y2,z1,z2
Boundaries of the new volume specified in world coordinates.
Discussion
This function is used to define a new viewing transformation matrix with a simple volume/viewport model. The viewing transformation matrix is the world- to device-coordinate transformation, and should include all user-defined non-linear transformations such as perspective. Modelling transformations that affect objects but not the view, such as object translations, rotations, uniform scaling, etc., should appear in modelling matrices pushed on the matrix stack.
If this function is called when the device is not in MODEL_XFORM mode, the matrix stack is flushed since old transformations based on the viewing transformation are invalidated. If this function is called when the device is in the MODEL_XFORM mode, the viewing matrix (at the bottom of the matrix stack) is changed without changing any of the matrices in the rest of the stack.
The new viewing transformation matrix is computed, based on the new volume bounds and the current viewport definition. The entire x and y range of the view_volume (in world coordinates) maps to the entire viewport (in vdcs) in a distorted fashion if the aspect ratios of the two are not the same. The entire range of the view_volume in the z dimension maps to the entire z range of the vdc_extent. Subsequent calls to view_port recalculate the viewing transformation matrix using the view volume established by this call and the new viewport until another starbase function establishes a new viewing transformation. The clip_depth and depth_cue_range are also reset to coincide with the current vdc_extent bounds in the z direction.
The coordinate systems used by Starbase can be conceptually defined as follows:
• User points are assumed to be defined in modelling coordinates. These points are transformed into world coordinates using a matrix called the modelling transformation matrix (if any matrices have been pushed on the stack). World coordinates are used to perform any rendering calculations needed.
• Next, the world coordinates are transformed to device coordinates by the viewing transformation matrix, which is usually the concatenation of user-defined viewing transformations and the vdc-to-device transformation matrix. When a device is opened, the viewing transformation matrix is simply the vdc-to-device coordinate transformation matrix.
Use matrix stack manipulation functions to place modelling transformation matrices on the matrix stack. Use view_camera, view_matrix, view_port, view_volume, or view_window to set viewing transformations.
• If a graphics device has been opened in MODEL_XFORM mode, the modelling transformation cannot be combined with the viewing transformation because special rendering calculations such as shading may be needed after the modelling-to-world-coordinate transformation. Therefore, matrices pushed on the stack are left undisturbed and all transformations from modelling coordinates to device coordinates are processed in two steps: modelling to world coordinates, followed by world to device coordinates.
• If a graphics device is not in MODEL_XFORM mode, the modelling and viewing transformations can be combined. Thus, the current viewing transformation matrix is post-concatenated to modelling matrices placed on the matrix stack, and subsequent output primitives are transformed, using only the top matrix on the matrix stack.
DEFAULTS
After gopen or a call to flush_matrices, the current viewing transformation matrix is the vdc-to-device units transformation matrix.
SEE ALSO
flush_matrices(3G), gopen(3G), inquire_sizes(3G), vdc_extent(3G), view_camera(3G), view_matrix(3G), view_port(3G), view_window(3G), Starbase Graphics Techniques.
Hewlett-Packard Company — HP-UX Release 9.03: April 1994