NAME
hwPolygon - define a closed, convex polygon
INHERITS FROM
hwSurface
hwOrient
PROPERTIES
Data *F The list of vertices, with from 3 to 11
floats per vertex
OptLevel 1I The optimization level; see hw(3) for details
vertex
DEFAULTS
OptLevel = HW_OPT_NONE
Data = NULL
DESCRIPTION
The hwPolygon class takes a list of vertices and displays them as a
closed polygonal surface. The parameters HasNormals, HasRGB, array
of hwFloat values; the number of values must be equal to n*FPV,
where FPV is the number of hwFloats present per vertex as described
by the hwVertex man page. The number n is derived from the size of
the Data array, and is the number of vertices in the polygon.
NOTE: As of this writing, non-convex polygons result in
system-dependent behavior, and are discouraged, as are non-planar
polygons.
C EXAMPLE
/* Draw a square two-sided polygon */
hwObject
poly;
hwFloat
verts[] = {0,0,0, 0,1,0, 1,1,0, 1,0,0};
poly = hwPolygon->create( hwPolygon );
poly->modify( poly, hwStrData, HW_MAKE_TYPE(HW_TYPE_FLOAT,4*3), verts );
HW_MODIFY_1B( poly, hwStrTwoSided, HW_TRUE );
poly->draw( poly, disp );
poly->destroy( poly );
OBJECT FILE EXAMPLE
# A square two-sided polygon
hwPolygon poly {
TwoSided = True
Data = {0,0,0, 0,1,0, 1,1,0, 1,0,0}
}
SEE ALSO
hw(3), hwSurface(3), hwOrient(3), hwVertex(3)