NAME

hwPolygon - define a closed, convex polygon

INHERITS FROM

PROPERTIES

Data *F The list of vertices, with from 3 to 11 floats per vertex
OptFlags 1I Optimization flags; see hw for details

DEFAULTS

OptFlags hwDefaultOptFlags
Data NULL

DESCRIPTION

The hwPolygon class takes a list of vertices and displays them as a closed polygonal surface. The parameters Data must be an 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 );
    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, hwSurface, hwOrient, hwVertex