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;
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 v1–v2. | |
D3DTRIFLAG_EDGEENABLE2 | |
Edge defined by v2–v3. | |
D3DTRIFLAG_EDGEENABLE3 | |
Edge defined by v3–v1. | |
D3DTRIFLAG_EDGEENABLETRIANGLE | |
All edges. |
Strip and fan flags
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 Fans.
Windows NT: Use version 4.0 or later.
Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in d3dtypes.h.