Microsoft DirectX 8.1 (Visual Basic) |
Many applications use this vertex type, as it frees them from implementing their own transformation and lighting engines. However, because the system is making calculations for you, it requires that you provide a certain amount of information with each vertex.
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 vertex format structure that includes a position, a vertex normal, a diffuse color, and two sets of texture coordinates.
' ' The vertex format description for this vertex would be: ' (D3DFVF_XYZ Or D3DFVF_NORMAL Or D3DFVF_DIFFUSE Or D3DFVF_TEX2) ' Type UNLITVERTEX x As Single ' Position y As Single z As Single nx As Single ' Normal ny As Single nz As Single Diffuse As Long ' diffuse color tu1 As Single ' texture coordinates tv1 As Single tu2 As Single ' texture coordinates tv2 As Single End Type
The vertex description for the preceding structure is a combination of the D3DFVF_XYZ, D3DFVF_NORMAL, D3DFVF_DIFFUSE, and D3DFVF_TEX2 flexible vertex format flags.
For more information, see Vertex Formats.