次の方法で共有


Triangle Lists (Windows Embedded CE 6.0)

1/6/2010

A triangle list is a list of isolated triangles. They might or might not be near each other. A triangle list must have at least three vertices. The total number of vertices must be divisible by three.

Use triangle lists to create an object that is composed of disjoint pieces. For instance, one way to create a force-field wall in a 3-D game is to specify a large list of small, unconnected triangles. Then apply a material and texture that appears to emit light to the triangle list. Each triangle in the wall appears to glow. The scene behind the wall becomes partially visible through the gaps between the triangles, as a player might expect when looking at a force field.

Triangle lists are also useful for creating primitives that have sharp edges and are shaded with Gouraud shading.

The following illustration shows a rendered triangle list.

Ee490662.aca8a581-580a-4601-8ba8-5c057ee60a9a(en-US,WinEmbedded.60).gif

The triangle list primitive is identified by the D3DMPT_TRIANGLELIST element of the D3DMPRIMITIVETYPE enumeration.

The following code example shows how to create vertices for this triangle list.

struct CUSTOMVERTEX
{
    float x,y,z;
};

CUSTOMVERTEX Vertices[] = 
{
    {-5.0, -5.0, 0.0},
    { 0.0,  5.0, 0.0},
    { 5.0, -5.0, 0.0},
    {10.0,  5.0, 0.0},
    {15.0, -5.0, 0.0},
    {20.0,  5.0, 0.0}

};

The following code example shows how to use IDirect3DMobileDevice::DrawPrimitive to render this triangle list.

//
// It is assumed that d3dmDevice is a valid
// pointer to a IDirect3DMobileDevice interface.
//
d3dmDevice->DrawPrimitive( D3DMPT_TRIANGLELIST, 0, 2 );

See Also

Concepts

Device-Supported Primitive Types