.\"## .\" $XConsortium: p386,v 5.2 94/04/17 20:58:57 rws Exp $ .\"## .\"## $XMCOPY .\"## Copyright (c) 1990, 1991 by Sun Microsystems, Inc. .\"## .\"## All Rights Reserved .\"## .\"## Permission to use, copy, modify, and distribute this software and its .\"## documentation for any purpose and without fee is hereby granted, .\"## provided that the above copyright notice appear in all copies and that .\"## both that copyright notice and this permission notice appear in .\"## supporting documentation, and that the name of Sun Microsystems, .\"## not be used in advertising or publicity .\"## pertaining to distribution of the software without specific, written .\"## prior permission. .\"## .\"## SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, .\"## INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO .\"## EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR .\"## CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF .\"## USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR .\"## OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\"## PERFORMANCE OF THIS SOFTWARE. .TH "SET VIEW REPRESENTATION" 3P "29 February 1991" .SH NAME SET VIEW REPRESENTATION \- define a \s-2\&2D\s+2 view representation entry on a workstation .IX "Viewing" "SET VIEW REPRESENTATION" .IX "Attribute Representations" "SET VIEW REPRESENTATION" .SH SYNOPSIS .SS C Syntax .ft B .ta 1.5i 3i .nf void pset_view_rep ( ws, index, rep ) Pint ws; \fIworkstation identifier\fP Pint index; \fIview index\fP Pview_rep *rep; \fIview representation\fP .fi .ft R .SS Required PHIGS Operating States (PHOP, WSOP, *, *) .SH DESCRIPTION .SS Purpose \s-2SET VIEW REPRESENTATION\s+2 defines a view representation entry in the workstation's view table, using a two-dimensional model. A view representation defines how the composited objects are to be represented in relation to the viewer. .LP A view representation controls the viewing stage of the transformation pipeline, which transforms coordinates in World Coordinates \s-2(WC)\s+2 to Normalized Projection Coordinates \s-2(NPC)\s+2, and optionally clips to the limits of \s-2NPC\s+2 space. .SS C Input Parameters .IP \fIws\fP The identifier of the workstation for which the view representation is being defined. .IP \fIindex\fP The view index of the entry being defined. .IP \fIrep\fP A pointer to a Pview_rep structure containing the values in the view representation, defined in phigs.h as follows: .nf .ta .5i +\w'Pclip_ind 'u +\w'orientation_matrix; 'u .sp .4 typedef struct { .sp .2 Pmatrix ori_matrix; /* view orientation matrix */ Pmatrix map_matrix; /* view mapping matrix */ Plimit clip_limit; /* clipping limits */ Pclip_ind xy_clip; /* x-y clipping indicator */ .sp .2 } Pview_rep; .sp .2 .fi .IP Pmatrix is defined in phigs.h as follows: .sp .2 typedef Pfloat Pmatrix[3][3]; .sp .4 .IP Plimit is defined in phigs.h as follows: .nf .ta .5i +\w'Pfloat 'u +\w'xmin; 'u .sp .4 typedef struct { .sp .2 Pfloat x_min; /* x min */ Pfloat x_max; /* x max */ Pfloat y_min; /* y min */ Pfloat y_max; /* y max */ .sp .2 } Plimit; .sp .2 .fi .IP Pclip_ind is defined in phigs.h as follows: .nf .ta .5i +\w'PIND_CLIP, 'u .sp .2 typedef enum { .sp .2 PIND_NO_CLIP, PIND_CLIP .sp .2 } Pclip_ind; .sp .2 .fi .IP The \fIori_matrix\fP is the 3 \(mu 3 homogeneous view orientation matrix, probably from \s-2EVALUATE VIEW ORIENTATION MATRIX\s+2. .IP The \fImap_matrix\fP is the 3 \(mu 3 homogeneous view mapping matrix, probably from \s-2EVALUATE VIEW MAPPING MATRIX\s+2. .IP The \fIclip_limit\fP contains the 4 Pfloat clipping limits: \fIx_min\fP, \fIx_max\fP, \fIy_min\fP, and \fIy_max\fP. .IP The \fIxy_clip\fP contains the \fIx-y\fP clip indicator for the \fIx\fP and \fIy\fP axes. .SS Execution \s-2SET VIEW REPRESENTATION\s+2 defines a view representation entry in the workstation's view table using a two-dimensional model. .LP The \fIcurrent view index\fP attribute applied to each output primitive at traversal time determines which view representation is used to map the primitive from \s-2WC\s+2 space to \s-2NPC\s+2 space, typically with a parallel or perspective projection. .LP This viewing process for each output primitive is accomplished in three stages: .IP 1. The \fIview orientation matrix\fP is applied to orient View Reference Coordinate \s-2(VRC)\s+2 space with respect to \s-2WC\s+2 space. Use the utility function \s-2EVALUATE VIEW ORIENTATION MATRIX\s+2 to generate this matrix from a \fIview reference point\fP and \fIview up vector\fP specified in \s-2WC\s+2. The view reference point becomes the origin of \s-2VRC\s+2 and the view up vector orients the \s-2VRC\s+2 \fIv\fP axis. .IP 2. The \fIview mapping matrix\fP is applied to map the \s-2VRC\s+2 system to the \s-2NPC\s+2 system. Use the utility function \s-2EVALUATE VIEW MAPPING MATRIX\s+2 to generate this matrix. The utility accepts a specified \fIview area\fP called a window in \s-2VRC\s+2 space to be mapped onto a specified \fIprojection viewport\fP in \s-2NPC\s+2 space. The projection is established in relation to the \fIprojection reference point\fP, also specified in \s-2VRC\s+2 space. The projection may be perspective or parallel, oblique or non-oblique. .IP 3. Clipping limits are optionally applied. The \fIview clipping limits\fP define an area of \s-2NPC\s+2. When a clipping indicator is set to \fIClipping\fP, any portion of an object beyond that limit is not displayed. .IP \fBNote\fP: These clipping limits are typically identical to the projection viewport provided to \s-2EVALUATE VIEW MAPPING MATRIX\s+2. If the clipping limits differ from the projection viewport, the object portions mapped by the \fIview mapping matrix\fP to be within the clipping limits in \s-2NPC\s+2 are displayed. .LP In any case, objects are subject to workstation clipping, which may not be disabled. The maximum volume of \s-2NPC\s+2 space that may be displayed is from 0 to 1 in all dimensions. .\".RE .LP The immediate visual effect of changing a view representation depends on the workstation's \fIdisplay update state\fP. When \s-2SET VIEW REPRESENTATION\s+2 is called, the display update state may prohibit immediate updating (that is, regeneration) of the workstation's display. In this case, the \fIview index\fP view table entry's \fIviewing transformation update state\fP is set to \s-2PENDING\s+2, and the following values for the entry are set to the values being \fIrequested\fP by the function invocation: .RS .ta 0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i .LP \(bu Requested view orientation matrix .LP \(bu Requested view mapping matrix .LP \(bu Requested view clipping limits .LP \(bu Requested \fIx-y\fP clipping indicator .ta .RE .LP The next time the workstation is updated, for any view table entry with the viewing transformation update state set to \s-2PENDING\s+2, the values stored in the \fIrequested\fP entries replace the corresponding \fIcurrent\fP values for that \fIview index\fP, and the view entry's viewing transformation update state is set to \s-2NOTPENDING\s+2. Then regeneration proceeds, and the new viewing representations take effect. .SS Default Representation View index 0 is the default for the \fIcurrent view index\fP in the traversal state list. View table entry 0 is the default view representation, and cannot be changed. The effect of the default representation is to map the \s-2VRC\s+2 rectangle [0,1] x [0,1] to the \s-2NPC\s+2 rectangle [0,1] \(mu [0,1] without scaling, rotation, or translation. It contains the following values: .sp .RS .\".ta 1.6i .ta 0.2i +0.5i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i .LP \(bu view orientation matrix \fIIdentity Matrix\fP .LP \(bu view mapping matrix \fIIdentity Matrix\fP .LP \(bu view clipping limits \fIXmin \(eq 0 Xmax \(eq 1 Ymin \(eq 0 Ymax \(eq 1\fP .LP \(bu \fIx-y\fP clipping indicator \fIPerform Clipping\fP .fi .RE .DT .SH ERRORS .IP 003 Ignoring function, function requires state (\s-2PHOP\s+2, \s-2WSOP\s+2, \s-2*\s+2, \s-2*\s+2) .IP 054 Ignoring function, the specified workstation is not open .IP 057 Ignoring function, specified workstation is of category \s-2MI\s+2 .IP 115 Ignoring function, the view index value is less than one .IP 150 Ignoring function, setting this view table entry would exceed the maximum number of entries allowed in the workstation's view table .IP 153 Ignoring function, invalid view clipping limits; \s-2XMIN \(>= XMAX, YMIN \(>= YMAX,\s+2 or \s-2ZMIN > ZMAX\s+2 .IP 154 Ignoring function, the view clipping limits are not within \s-2NPC\s+2 range .SH SEE ALSO .nf .IP .ta 0.5i .SM "SET VIEW INDEX (3P)" .SM "EVALUATE VIEW ORIENTATION MATRIX (3P)" .SM "EVALUATE VIEW MAPPING MATRIX (3P)" .SM "SET VIEW TRANSFORMATION INPUT PRIORITY (3P)" .SM "INQUIRE VIEW REPRESENTATION (3P)" .SM "UPDATE WORKSTATION (3P)" .SM "SET VIEW REPRESENTATION 3 (3P)" .fi