.\"## .\" $XConsortium: p387,v 5.2 94/04/17 20:58:58 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 3" 3P "29 February 1991" .SH NAME SET VIEW REPRESENTATION 3 \- define \s-2\&3D\s+2 view representation entry on a workstation .IX "Transformation Matrix" "SET VIEW REPRESENTATION 3" .IX "Viewing" "SET VIEW REPRESENTATION 3" .IX "Attribute Representations" "SET VIEW REPRESENTATION 3" .SH SYNOPSIS .SS C Syntax .ft B .ta 1.5i 3i .nf void pset_view_rep3 ( ws, index, rep ) Pint ws; \fIworkstation identifier\fP Pint index; \fIview index\fP Pview_rep3 *rep; \fIview representation\fP .fi .ft R .SS Required PHIGS Operating States (PHOP, WSOP, *, *) .SH DESCRIPTION .SS Purpose \s-2SET VIEW REPRESENTATION 3\s+2 defines a view representation entry in the workstation's view table, using a three-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 structure containing the values in the \s-2\&3D\s+2 view representation, defined as follows: .nf .ta .5i +\w'Pinterstyle 'u +\w'orientation_matrix; 'u .sp .4 typedef struct { .sp .2 Pmatrix3 ori_matrix; /* orientation matrix */ Pmatrix3 map_matrix; /* mapping matrix */ Plimit3 clip_limit; /* clipping limits */ Pclip_ind xy_clip; /* \fIx-y\fP clipping indicator */ Pclip_ind back_clip; /* back clipping indicator */ Pclip_ind front_clip; /* front clipping indicator */ .sp .2 } Pview_rep3; .sp .2 .fi .IP Pmatrix3 is defined in phigs.h as follows: .sp .2 typedef Pfloat Pmatrix3[4][4]; .IP Plimit3 is defined in phigs.h as follows: .sp .4 .nf .ta .5i +\w'Pfloat 'u +\w'xmin; 'u typedef struct { .sp .2 Pfloat x_min; /* x min */ Pfloat x_max; /* x max */ Pfloat y_min; /* y min */ Pfloat y_max; /* y max */ Pfloat z_min; /* z min */ Pfloat z_max; /* z max */ .sp .2 .fi } Plimit3; .bp .IP Pclip_ind is defined in phigs.h as follows: .nf .ta .5i +\w'PIND_CLIP, 'u .sp .4 typedef enum { .sp .2 PIND_NO_CLIP PIND_CLIP .sp .2 } Pclip_ind; .fi .IP The \fIori_matrix\fP is the 4 \(mu 4 homogeneous \fIview orientation matrix\fP, probably from \s-2EVALUATE VIEW ORIENTATION MATRIX 3\s+2. .IP The \fImap_matrix\fP is the 4 \(mu 4 homogeneous \fIview mapping matrix\fP, probably from \s-2EVALUATE VIEW MAPPING MATRIX 3\s+2. .IP The \fIclip_limit\fP contains the 6 Pfloat clipping limits: \fIxmin\fP, \fIxmax\fP, \fIymin\fP, \fIymax\fP, \fIzmin\fP, and \fIzmax\fP. .IP The \fIxy_clip\fP contains the \fIx-y\fP clip indicator for the \fIx\fP and \fIy\fP axes. .IP The \fIback_clip\fP contains the back clipping indicator, which controls clipping against the \fIback\fP plane, sometimes called the \fIyon\fP plane. .IP The \fIfront_clip\fP contains the front clipping indicator, which controls clipping against the \fIfront\fP plane, sometimes called the \fIfore\fP plane. .\".IP .\"Valid clipping indicators are one of the enumeration values: .\".ta .5i +1.5i +1i .\".nf .\" \fIClip Indicator Meaning\fP .\".sp .\" \s-2PIND_CLIP\s+2 ``Perform Clipping'' .\" \s-2PIND_NO_CLIP\s+2 ``Do not Clip'' .SS Execution \s-2SET VIEW REPRESENTATION 3\s+2 defines a view representation entry in the workstation's view table using a three-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 regard to \s-2WC\s+2 space. Use the utility function \s-2EVALUATE VIEW ORIENTATION MATRIX 3\s+2 to generate this matrix from a \fIview reference point\fP, \fIview plane normal vector\fP, and \fIview up vector\fP specified in \s-2WC\s+2. The view reference point becomes the origin of \s-2VRC\s+2; the view plane normal and the view up vector orient the \s-2VRC\s+2 space (\s-2VRC\s+2 \fIu\fP and \fIy\fP axes) in relation to the \s-2WC\s+2 axes. .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 3\s+2 to generate this matrix. The utility accepts a specified \fIview volume\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 3\s+2. If the clipping limits differ from the projection viewport, the object portions mapped by the view mapping matrix 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 .LP \(bu Requested back clipping indicator .LP \(bu Requested front 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 view index, 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 cube [0,1] \(mu [0,1] \(mu [0,1] in \s-2VRC\s+2 space to the cube [0,1] \(mu [0,1] \(mu [0,1] in \s-2NPC\s+2 space, without any scaling, rotation, or translation, and to clip the image in \s-2NPC\s+2 space at the boundaries of the same unit cube. It contains the following values: .RS .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 Zmin \(eq 0 Zmax \(eq 1\fP .LP \(bu \fIx-y\fP clipping indicator \fIPerform Clipping\fP .LP \(bu back clipping indicator \fIPerform Clipping\fP .LP \(bu front 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 (3P)" .fi