Partager via


Untransformed and Lit Vertices

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

If you include a D3DMFVF_XYZ flag, but not a D3DMFVF_NORMAL flag, in the vertex format description you use with the Microsoft® Direct3D® Mobile rendering methods, you are identifying your vertices as untransformed. For information about other dependencies and exclusions, see the description for the D3DMFVF Values.

By using untransformed and lit vertices, your application requests that Direct3D Mobile not perform any lighting calculations on your vertices, but it should still transform them using the previously set world, view, and projection matrices. Because the system is not doing lighting calculations, it does not need a vertex normal. The system uses the diffuse and specular components at each vertex for shading. These colors might be arbitrary, or they might be computed using your own lighting formulas. If you do not include a diffuse or specular component, the system uses the default colors. The default value for the diffuse color is 0xFFFFFFFF, and the default value for the specular color is 0x0.

Like the other vertex types, except for including a position and some amount of color information, you are free to include or disregard the texture coordinate sets in the unlit vertex format.

When you define your own vertex format, remember which vertex components your application needs, and make sure they appear in the required order by declaring a properly ordered structure. The following code example declares a valid untransformed and lit vertex, with diffuse and specular vertex colors, and three sets of texture coordinates.

//
// The vertex format description for this vertex would be:
// (D3DMFVF_XYZ_FLOAT | D3DMFVF_DIFFUSE |  D3DMFVF_SPECULAR
//  | D3DMFVF_TEX3)
//
typedef struct _LITVERTEX {
    float x, y, z;   // position
    DWORD Diffuse;   // diffuse color
    DWORD Specular;  // specular color
    float tu1, tv1;  // texture coordinates
    float tu2, tv2;
    float tu3, tv3;
} LITVERTEX, *LPLITVERTEX; 

The vertex description for the preceding structure is a combination of the D3DMFVF_XYZ_FLOAT, D3MDFVF_DIFFUSE, D3DMFVF_SPECULAR, and D3DMFVF_TEX3 flexible vertex format flags.

For more information, see Vertex Data Description.

See Also

Concepts

Vertex Formats