Microsoft DirectX 8.1 (Visual Basic)

Untransformed and Lit Vertices

If you include the D3DFVF_XYZ flag, but not the D3DFVF_NORMAL flag, in the vertex format description you use with the Microsoft® Direct3D® rendering methods, you are identifying your vertices as untransformed but already lit. For information about other dependencies and exclusions, see the description for the Flexible Vertex Format Flags.

By using untransformed and lit vertices, your application requests that Direct3D 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 isn't doing lighting calculations, it doesn't 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 don't 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: (D3DFVF_XYZ Or D3DFVF_DIFFUSE Or
'    D3DFVF_SPECULAR Or D3DFVF_TEX3)
'
Type LITVERTEX
    x As Single      ' position
    y As Single
    z As Single    
    Diffuse As Long  ' diffuse color    
    Specular As Long ' specular color    
    tu1 As Single ' texture coordinates
    tv1 As Single
    tu2 As Single
    tv2 As Single
    tu3 As Single
    tv3 As Single
End Type

The vertex description for the preceding structure is a combination of the D3DFVF_XYZ, D3DFVF_DIFFUSE, D3DFVF_SPECULAR, and D3DFVF_TEX3 flexible vertex format flags.