D3DTRIANGLE

The D3DTRIANGLE structure describes the base type for all triangles. The triangle is the main rendering primitive.

For related information, see the D3DOP_TRIANGLE member in the D3DOPCODE enumerated type.

typedef struct _D3DTRIANGLE { 
    union { 
        WORD v1; 
        WORD wV1; 
    }; 
    union { 
        WORD v2; 
        WORD wV2; 
    }; 
    union { 
        WORD v3; 
        WORD wV3; 
    }; 
    WORD     wFlags; 
} D3DTRIANGLE, *LPD3DTRIANGLE; 
 

Members

wV1, wV2, and wV3
Vertices describing the triangle.
wFlags
This value can be a combination of the following flags:

Edge flags

These flags describe which edges of the triangle to enable. (This information is useful only in wireframe mode.)

D3DTRIFLAG_EDGEENABLE1
Edge defined by v1v2.
D3DTRIFLAG_EDGEENABLE2
Edge defined by v2v3.
D3DTRIFLAG_EDGEENABLE3
Edge defined by v3v1.
D3DTRIFLAG_EDGEENABLETRIANGLE
All edges.

Strip and fan flags

D3DTRIFLAG_EVEN
The v1v2 edge of the current triangle is adjacent to the v3v1 edge of the previous triangle; that is, v1 is the previous v1, and v2 is the previous v3.
D3DTRIFLAG_ODD
The v1v2 edge of the current triangle is adjacent to the v2v3 edge of the previous triangle; that is, v1 is the previous v3, and v2 is the previous v2.
D3DTRIFLAG_START
Begin the strip or fan, loading all three vertices.
D3DTRIFLAG_STARTFLAT(len)
Cull or render the triangles in the strip or fan based on the treatment of this triangle. That is, if this triangle is culled, also cull the specified number of subsequent triangles. If this triangle is rendered, also render the specified number of subsequent triangles.

This length must be greater than zero and less than 30.

Remarks

This structure can be used directly for all triangle fills. For flat shading, the color and specular components are taken from the first vertex. The three vertex indices v1, v2, and v3 are vertex indexes into the vertex list at the start of the execute buffer.

Enabled edges are visible in wireframe mode. When an application displays wireframe triangles that share an edge, it typically enables only one (or neither) edge to avoid drawing the edge twice.

The D3DTRIFLAG_ODD and D3DTRIFLAG_EVEN flags refer to the locations of a triangle in a conventional triangle strip or fan. If a triangle strip had five triangles, the following flags would be used to define the strip:

D3DTRIFLAG_START
D3DTRIFLAG_ODD
D3DTRIFLAG_EVEN
D3DTRIFLAG_ODD
D3DTRIFLAG_EVEN

Similarly, the following flags would define a triangle fan with five triangles:

D3DTRIFLAG_START
D3DTRIFLAG_EVEN
D3DTRIFLAG_EVEN
D3DTRIFLAG_EVEN
D3DTRIFLAG_EVEN

The following flags could define a flat triangle fan with five triangles:

D3DTRIFLAG_STARTFLAT(4)
D3DTRIFLAG_EVEN
D3DTRIFLAG_EVEN
D3DTRIFLAG_EVEN
D3DTRIFLAG_EVEN

For more information, see Triangle Strips and Triangle Fans.

QuickInfo

  Windows NT/2000: Requires Windows NT 4.0 SP3 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in d3dtypes.h.