.\"##
.\" $XConsortium: p249,v 5.2 94/04/17 20:57:20 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.
.ds f \s-2QUADRILATERAL MESH 3 WITH DATA\s+2
.TH "QUADRILATERAL MESH 3 WITH DATA" 3P+ "29 February 1991"
.SH NAME
QUADRILATERAL MESH 3 WITH DATA \- creates a \s-2\&3D\s+2 quadrilateral mesh structure element that includes colour and shading data  
.IX "PHIGS Extension Functions" "QUADRILATERAL MESH 3 WITH DATA"
.IX "Filled Area Primitives" "QUADRILATERAL MESH 3 WITH DATA"
.IX "Primitives, Filled Area Primitives" "QUADRILATERAL MESH 3 WITH DATA"
.IX "Mesh" "QUADRILATERAL MESH 3 WITH DATA"
.SH SYNOPSIS
.SS C Syntax
.ft B
.ta 1.25i 3.75i
.nf
void
pquad_mesh3_data ( fflag, vflag, colour_model, dim, fdata, vdata )
Pint	fflag;	\fI what data per fill facet is available\fP
Pint	vflag;	\fI what data per vertex is available\fP
Pint	colour_model;	\fIcolour type\fP
Pint_size	*dim;		\fIdimension of cells (in vertices)\fP
Pfacet_data_arr3	*fdata;	\fIfacet data \fP
Pfacet_vdata_arr3	*vdata;	\fIvertex data \fP
.fi
.ft R
.SS Required PHIGS Operating States
(PHOP, *, STOP, *)
.SH DESCRIPTION
.SS Purpose
\s-2QUADRILATERAL MESH 3 WITH DATA\s+2 
creates a \s-2\&3D\s+2 quadrilateral mesh primitive with colour and shading
data.
.SS C Input Parameters
.IP \fIfflag\fR
The data per facet flag specifies the available data for
each quadrilateral of the quadrilateral mesh.
.sp
.nf
.ta .5i +\w'0    'u +\w'PFACET_COLOUR_NORMAL     'u
0	PFACET_NONE	\fINo Facet Data Specified\fP
1	PFACET_COLOUR	\fIFacet Colours Specified\fP
2	PFACET_NORMAL	\fIFacet Normal Specified\fP
3	PFACET_COLOUR_NORMAL	\fIFacet Normal and Colours Specified\fP 
.sp
.fi
.IP \fIvflag\fR
The data per vertex flag specifies the available data for
each vertex of the primitive.
.sp
.nf
.ta .5i +\w'0     'u +\w'PVERT_COORD_COLOUR_NORMAL   'u
0	PVERT_COORD	\fICoordinates Specified\fP
1	PVERT_COORD_COLOUR	\fICoordinates and Colours Specified\fP 
2	PVERT_COORD_NORMAL	\fICoordinates and Vertex Normal Specified\fP
3	PVERT_COORD_COLOUR_NORMAL	\fICoordinates, Vertex Colour, and Vertex Normal Specified\fP
.sp 
.fi
.IP \fIcolour_model\fR
The colour type for specified vertex colours.
.sp
.nf
.ta .5i +.5i +1.75i
	0	PINDIRECT	\fIColour Index Specified\fP
	1	PMODEL_RGB	\fIRed, Green, and Blue\fP
	2	PMODEL_CIELUV	\fICIE Colour Model\fP
	3	PMODEL_HSV	\fIHue, Saturation, and Value\fP
	4	PMODEL_HLS	\fIHue, Lightness, and Saturation\fP
.sp
.fi
.IP \fIdim\fR
A pointer to a Pint_size structure that specifies the number of vertices
along the \fIx\fP and \fIy\fP coordinates. Pint_size is defined in phigs.h as follows:
.sp .2
.nf
.ta .5i +\w'Pint     'u +\w'size_x;     'u
.sp .2
typedef struct {
.sp .2
	Pint	size_x;	/* number of vertices along the x-axis */
	Pint	size_y;	/* number of vertices along the y-axis */
.sp .2
} Pint_size;
.sp
.fi
.IP \fIfdata\fR
A pointer to a Pfacet_data_arr3 structure that specifies
the colour and/or normal information for each facet. 
Note that number of facets
= (size_x - 1) * (size_y - 1). Pfacet_data_arr3 is defined in phigs.h as follows:
.sp .2
.nf
.ta .5i +1i +1.25i
.sp .2
typedef union {
.sp .2	
	Pcoval	*colrs;	/* array (size_x - 1) * (size_y - 1) of colours */
	Pvec3	*norms;	/* array (size_x - 1) * (size_y - 1) of unit normals */
	Pconorm3	*conorms;	/* array (size_x - 1) * (size_y - 1) of colours and normals */
.sp .2
} Pfacet_data_arr3;
.IP
.fi	
Pcoval is defined in phigs.h as follows: 
.sp .2
.nf
.ta .5i +\w'Pcolr_rep     'u +\w'direct;     'u
.sp .2
typedef union {	
.sp .2
	Pint	index;	/* index in workstation colour bundle table */
	Pcolr_rep	direct;	/* direct colour components */
.sp .2
} Pcoval;
.sp .2
.fi
When \fIcolour_model\fP is \s-2PINDIRECT,\s+2 index is
used; otherwise, direct is used.
.IP
Pcolr_rep is defined in phigs.h as follows:
.ta .5i +1i +1i
.nf
.sp .2
typedef union {
.sp .2
	Prgb	rgb;	/* Red Green Blue colour specification */
	Pcieluv	cieluv;	/* CIE L*U*V* colour specification */
	Phls	hls;	/* Hue Lightness Saturation colour specification */
	Phsv	hsv;	/* Hue Saturation Value colour specification */
	Pdata	unsupp;	/* Colour in unsupported colour model */
.sp .2
} Pcolr_rep;
.sp .2
.fi
.IP
Prgb is defined in phigs.h as follows:
.nf
.ta .5i +1i +1i
.sp .2
typedef struct {
.sp .2
	Pfloat	red;	/* red, hue, etc */
	Pfloat	green;	/* green, saturation, lightness, etc */
	Pfloat	blue;	/* blue, value, saturation, etc */
.sp .2
} Prgb;
.fi
.IP
Pcieluv is defined in phigs.h as follows:
.nf
.ta .5i +1i +1i
.sp .2
typedef struct {
.sp .2
	Pfloat	cieluv_x;	/* x coefficient */
	Pfloat	cieluv_y;	/* y coefficient */
	Pfloat	cieluv_y_lum;	/* y luminance */
.sp .2
} Pcieluv;
.fi
.IP
Phls is defined in phigs.h as follows:
.nf
.ta .5i +1i +1i
.sp .2
typedef struct {
.sp .2
	Pfloat	hue;	/* hue */
	Pfloat	lightness;	/* lightness */
	Pfloat	satur;	/* saturation */
.sp .2
} Phls;
.fi
.IP
Phsv is defined in phigs.h as follows:
.nf
.ta .5i +1i +1i
.sp .2
typedef struct {
.sp .2
	Pfloat	hue;	/* hue */
	Pfloat	satur;	/* saturation */
	Pfloat	value;	/* value */
.sp .2
} Phsv;
.fi
.IP
Pdata is defined in phigs.h as follows:
.nf
.ta .5i +1i +1i
.sp .2
typedef struct {
.sp .2
	size_t	size;	/* size of data */	
	char	*data	/* pointer to data */
.sp .2
} Pdata;
.fi
.sp .4
Pvec3 is defined as:
.sp .2
.nf
.ta .5i +\w'Pfloat     'u +\w'delta_x;     'u
.sp .2
typedef struct {
.sp .2
	Pfloat	delta_x;	/* x magnitude */
	Pfloat	delta_y;	/* y magnitude */
	Pfloat	delta_z;	/* z magnitude */
.sp .2
} Pvec3;
.fi
.IP
Pconorm3 is defined as:
.sp .2
.nf
.ta .5i +\w'Pcoval     'u +\w'norm;     'u
.sp .2
typedef union {
.sp .2
	Pcoval	colr;	/* colour */
	Pvec3	norm;	/* unit normal */
.sp .2
} Pconorm3;
.fi
.IP
Pcoval and Pvec3 are defined above.
.sp .2
.IP \fIvdata\fR
A pointer to a Pfacet_vdata_arr3 structure that specifies
the quadrilateral mesh vertices and
optionally associated colour and normal information. 
Pfacet_vdata_arr3 is defined as:
.sp .2
.nf
.ta .5i +\w'Pptconorm3     'u +\w'*ptconorms;     'u
.sp .2
typedef union {	
.sp .2			
	Ppoint3	*points;	/* array of (size_x * size_y) of points */
	Pptco3	*ptcolrs;	/* array of (size_x * size_y) of points and colours */
	Pptnorm3	*ptnorms;	/* array of (size_x * size_y) of points and normals */
	Pptconorm3	*ptconorms;	/* array of (size_x * size_y) of points, colours, and normals */
	/* implementation-dependent types can go here */
.\"code=	/* implementation-dependent data pointer */
.sp .2
} Pfacet_vdata_arr3;
.IP
.fi
Ppoint3 is defined as: 
.sp .2
.nf
.ta .5i +\w'Pfloat     'u +\w'x;     'u
.sp .2
typedef struct {
.sp .2
	Pfloat	x;	/* x coordinate */
	Pfloat	y;	/* y coordinate */
	Pfloat	z;	/* z coordinate */
.sp .2
} Ppoint3;
.IP
.fi
Pptco3 is defined as:
.sp .2
.nf
.ta .5i +\w'Ppoint3     'u +\w'point;     'u
.sp .2
typedef struct {	
.sp .2
	Ppoint3	point;	/* point coordinates */
	Pcoval	colr;	/* colour */
.sp .2
} Pptco3;
.IP
.fi
Ppoint3 is defined above.
Pcoval is defined as:	 
.sp .2
.nf
.ta .5i +\w'Pcolr_rep     'u +\w'direct;     'u
.sp .2
typedef union {	
.sp .2
	Pint	ind;	/* index in workstation colour bundle table */
	Pcolr_rep	direct;	/* direct colour components */
.sp .2
} Pcoval;
.IP
.fi
Pcolr_rep is defined above.
Pptnorm3 is defined as:
.sp .2
.nf
.ta .5i +\w'Pvec3     'u +\w'norm;     'u
.sp .2
typedef struct {	
.sp .2
	Ppoint3	point;	/* point coordinates */
	Pvec3	norm;	/* unit normal */
.sp .2
} Pptnorm3;
.IP
.fi
Ppoint3 and Pvec3 are defined above.
Pptconorm3 is defined as: 
.sp .2
.nf
.ta .5i +\w'Ppoint3     'u +\w'norm;     'u
.sp .2
typedef struct {	
.sp .2
	Ppoint3	point;	/* point coordinates */
	Pcoval	colr;	/* colour */
	Pvec3	norm;	/* unit normal */
.sp .2
} Pptconorm3;		    
.IP
.fi
Ppoint3, Pcoval, and Pvec3 are defined above.
.fi
.SS Execution
Depending on the edit mode, a 
\s-2QUADRILATERAL MESH 3 WITH DATA\s+2
element is inserted into the open structure after the element
pointer, or it replaces the element pointed to by the element pointer. 
In either case, the element pointer is updated to point to the newly
created \s-2QUADRILATERAL MESH 3 WITH DATA\s+2 element.
.LP
When the structure is traversed, 
\s-2QUADRILATERAL MESH 3 WITH DATA\s+2
generates a three-dimensional mesh of (\fIm\fP-1) \(mu (\fIn\fP-1) 
quadrilaterals from a two-dimensional array of \fIm\fP \(mu \fIn\fP vertices.
Line segments form the boundary of each quadrilateral in the mesh.
Each quadrilateral can be rendered empty, hollow, shaded, or filled
with a colour, pattern, or hatch style. A mesh with \fIn\fP < 2 or 
\fIm\fP < 2 vertices can be created, but it is treated in a
workstation-dependent fashion.
.LP
\s-2QUADRILATERAL MESH 3 WITH DATA\s+2 uses the same attributes as the
\s-2FILL AREA SET 3 WITH DATA\s+2 primitive.
.LP
The 
\s-2QUADRILATERAL MESH 3 WITH DATA\s+2 element can specify the facet
colour and normal vector of each quadrilateral in the mesh, as well
as colours and normal vectors for each vertex.
These colours and normal vectors are used in conjunction with
the current lighting and depth-cueing attributes to colour and
shade the primitive. 
Note that unexpected lighting effects will result if the supplied
normals are not of unit length. 
.SS Attributes Applied
The attributes listed below are used to display the
\s-2QUADRILATERAL MESH 3 WITH DATA\s+2 primitive when the structure is traversed. The Aspect Source 
Flags (\s-2ASF\s+2s) tell where to access the output display attributes. 
These attributes can come directly from the traversal state list,
or they can be accessed indirectly, using the appropriate index 
in the traversal state list and the corresponding bundled 
representation in the PHIGS workstation state list.
.RS
.nf
.ta .5i +\w'back interior reflectance equation   'u 
.sp
interior colour			interior colour index \s-2ASF\s+2
back interior colour		back interior colour \s-2ASF\s+2
interior style			interior style \s-2ASF\s+2
back interior style		back interior style \s-2ASF\s+2
interior style index		interior style index \s-2ASF\s+2
back interior style index	back interior style index \s-2ASF\s+2
interior shading method		interior shading method \s-2ASF\s+2
back interior shading method	back interior shading method \s-2ASF\s+2
interior reflectance equation 	interior reflectance equation \s-2ASF\s+2
back interior reflectance equation	back interior reflectance equation \s-2ASF\s+2
area properties			area properties \s-2ASF\s+2
back area properties		back area properties \s-2ASF\s+2
interior index
edge colour			edge colour index \s-2ASF\s+2
edge flag			edge flag \s-2ASF\s+2
edgetype			edgetype \s-2ASF\s+2
edgewidth scale factor		edgewidth scale factor \s-2ASF\s+2
edge index
face distinguishing mode
face culling mode
depth cue index
light source state
name set
.fi
.RE
.sp .2
.SH ERRORS
.IP 005
Ignoring function, function requires state 
(\s-2PHOP\s+2, \s-2*\s+2, \s-2STOP\s+2, \s-2*\s+2)
.SH SEE ALSO
.nf
.IP
.ta 0.5i
.SM "FILL AREA SET 3 WITH DATA (3P+)"
.fi
