PEXOCCPolyTriangle - Generalized Triangle Primitive (5.2)


Synopsis

     void PEXOCCPolyTriangle(
          PEXOCC context,
          unsigned int num_facets,
          PEXPointer facet_data,
          unsigned int num_verts,
          PEXPointer vertices
      )

Arguments

context
An OC context returned by a successful PEXCreateOCC call.

display (OCC)
A pointer to a display structure returned by a successful XOpenDisplay call.

resource_id (OCC)
The resource identifier of the renderer or structure.

req_type (OCC)
The request type for the output command (PEXOCRender, PEXOCStore, PEXOCRenderSingle or PEXOCStoreSingle).

facet_attributes (OCC)
A mask indicating the facet attributes provided (PEXGANone, PEXGAColor, PEXGANormal or PEXGAFloatData).

surface_vertex_attributes (OCC)
A mask indicating the vertex attributes provided (PEXGANone, PEXGAColor, PEXGANormal, PEXGAEdges, PEXGAFloatData, or PEXGA2D).

color_type (OCC)
The type of color data provided (PEXColorTypeIndexed, PEXColorTypeRGB, PEXColorTypeCIE, PEXColorTypeHSV, PEXColorTypeHLS, PEXColorTypeRGB8, PEXColorTypeRGB16, PEXColorTypeRGBA, PEXColorTypeRGBA8, or PEXColorTypeRGBA16).

facet_fp_data_count (OCC)
Number of floats per facet provided.

surface_vertex_fp_data_count (OCC)
Number of floats per vertex provided.

num_facets
The number of facets.

facet_data
A pointer to the facet data. See Facet / Vertex Data Formats.

num_verts
The number of vertices.

vertices
A pointer to the vertex data defining the polytriangle See Facet / Vertex Data Formats.

data_model (OCC)
Specifies the data model used to represent the geometric data.

data_model_specs (OCC)
Offset and size data for the PEXDataStride or PEXDataUnpacked data models.

Returns

None.

Description

Invoke PEXOCCPolyTriangle to create a primitive output command to independently render each triangle in a set of independent triangles and/or triangle fans and/or triangle strips (PEXOCTriangleStripFanSetWithData).

A PolyTriangle is defined by a list of vertices in modeling coordinates. The vertices form any combination of triangle subprimitives: triangle strips, triangle fans, and independent triangles.

If you define facet and/or vertex colors, then they are of the type specified by color_type. Otherwise the implementation ignores color_type.

Facet and vertex normals are assumed to be unit length vectors. If you specify a normal that is not unit length, then the result is implementation-dependent.

If you set the PEXGAFloatData bit of the facet attributes and/or surface vertex attributes, then you must supply extended floating-point data with each facet and/or vertex, respectively. If you set the PEXGAFloatData facet attribute bit, then facet_fp_data_count indicates the number of floating-point values for each facet. If you set the PEXGAFloatData vertex attribute bit, then surface_vert_fp_data_count indicates the number of floating-point values for each vertex. If you set only one floating-point data attribute bit, then the implementation ignores the count corresponding to the other floating-point data attribute bit. If neither floating-point data attribute bit is set, then implementation ignores both facet_fp_data_count and surface_vertex_fp_data_count.

If you indicate that facet data is present with the facet attributes, you must supply facet data for each facet (triangle).

If you set the PEXGA2D surface vertex attribute, then the vertex coordinates are of type PEXCoord2D instead of type PEXCoord.

This primitive uses vertex control bits that determine how the vertex is used in the next triangle subprimitive. These bits are stored in the edge data for each vertex, so the edge data must be supplied, by the caller, even if no edge controls are desired. These vertex control bits of the bitmask are required since they are the control bits which define the subprimitives by defining the connectivity of the vertices. Interpretation of Vertex Control Bits shows how the control bits associated with each vertex define how the vertex is used in the definition of a triangle subprimitive.

Interpretation of Vertex Control Bits


-----------------------------------------------------------------------------------------------
0x00000008  0x00000004  Description
-----------------------------------------------------------------------------------------------
 0           0           The vertex is the first vertex of a triangle subprimitive.
 0           1           Drops the oldest vertex of the previous three vertices to form the
                          next triangle in a triangle strip.
 1           0           Drops the middle vertex of the three previous vertices to form the
                          next triangle in a triangle fan.
 1           1           The vertex defines the second or third vertex in the first triangle of
                          a triangle subprimitive.
 
-----------------------------------------------------------------------------------------------

The implementation ignores the control bits for the first and second vertices of the PolyTriangle. Instead it is assumed that they are 00 and 11, respectively. Therefore, it is permissible for a PolyTriangle which defines a single triangle subprimitive to set the control bits of all the vertices to 01 (for a triangle strip) or 10 (for a triangle fan).

If you set the PEXGAEdges bit of surface_vertex_attributes, then edge flags are additionally specified in the required vertex edge bitmask. This edge data is used if the pipeline state's surface edge flag is PEXOn. Interpretation of Edge Flag Bits indicates for each vertex vi (as defined by the control bits) which edges the bits control. If the edges vertex attribute is not set, then all the edges are drawn if the pipeline state's surface edge flag is PEXOn.

Interpretation of Edge Flag Bits


-----------------------------------------
Vertex  Edge Flag Bit  Corresponding Edge
-----------------------------------------
v0      0x00000001     None
        0x00000002     None
v1      0x00000001     Edge (v0, v1)
        0x00000002     None
vi(a)   0x00000001     Edge (vi-1, vi)
        0x00000002     Edge (vi-2, vi)
-----------------------------------------
(a)
Where i is (2..n) inclusive. vi represents the current vertex, vi-1 the previous vertex, and vi-2 the oldest vertex of the three vertices defining a subprimitive triangle.

Clipping is similar to Fill Area 3D. See Fill Areas

The basic surface, styled and shaded surface, edge, and data mapping attribute sets are applied to this primitive.

If you specify a PolyTriangle that contains one or more subprimitives with fewer than three vertices, then the primitive is stored in a structure when included in a PEXStoreElements request. However, the output command has no visual effect when rendered. Such a primitive has no visual effect when included in a PEXRenderOutputCommands request

Errors

BadPEXOutputCommand
The output command contains an invalid value.

BadPEXRenderer
The specified renderer resource identifier is invalid.

BadPEXStructure
The specified structure resource identifier is invalid.

See Also

For primitives similar to this one, see:

There are no PEXlib 5.1 compatibility primitives similar to this one.

For attributes that affect this primitive, see,

For an overview, see Output Command Functions.