typedef struct _D3DTRIANGLE {
union {
WORD v1;
WORD wV1;
};
union {
WORD v2;
WORD wV2;
};
union {
WORD v3;
WORD wV3;
};
WORD wFlags;
} D3DTRIANGLE, *LPD3DTRIANGLE;
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.
Vertices describing the triangle.
Flags describing which edges of the triangle to enable. (This information is useful only in wireframe mode.) This value can be a combination of the following edge and strip and fan flags:
Edge flags
Edge defined by v1–v2.
Edge defined by v2–v3.
Edge defined by v3–v1.
All edges.
Strip and fan flags
The v1–v2 edge of the current triangle is adjacent to the v3–v1 edge of the previous triangle; that is, v1 is the previous v1, and v2 is the previous v3.
The v1–v2 edge of the current triangle is adjacent to the v2–v3 edge of the previous triangle; that is, v1 is the previous v3, and v2 is the previous v2.
Begin the strip or fan, loading all three vertices.
If this triangle is culled, also cull the specified number of subsequent triangles. This length must be greater than zero and less than 30.
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