Vertex Formats
A version of this page is also available for
4/8/2010
A flexible vertex format (FVF) code describes the contents of vertices stored interleaved in a single data stream. It generally specifies data to be processed by the fixed function vertex processing pipeline.
Microsoft® Direct3D® Mobile applications can define model vertices in several different ways. Support for flexible vertex formats (FVFs) makes it possible for your application to use only the vertex components it needs, eliminating those components that are not used. By using only the needed vertex components, your application can conserve memory and minimize the processing bandwidth required to render models. You describe how your vertices are formatted by using a combination of FVF flags (see D3DMFVF Values).
The rendering methods of the IDirect3DMobileDevice interface provides applications with methods that accept a combination of these flags, and uses them to determine how to render primitives. Basically, these flags tell the system which vertex components — position, weights, normal, colors, the number and format of texture coordinates — your application uses and, indirectly, which parts of the rendering pipeline you want Direct3D Mobile to apply to them. In addition, the presence or absence of a particular vertex format flag communicates to the system which vertex component fields are present in memory and which you have omitted.
One significant requirement that the system places on how you format your vertices is on the order in which the data appears. The following illustration shows the required order for all possible vertex components in memory, and their associated data types.
Note
Texture coordinates can be declared in different formats, allowing textures to be addressed using as few as one coordinate or as many as four texture coordinates (for 2-D projected texture coordinates). For more information, see Texture Coordinate Formats. Use the D3DMFVF_TEXCOORDSIZE Macros to create bit patterns that identify the texture coordinate formats that your vertex format uses.
No application will use every component — the reciprocal homogeneous W (RHW) and vertex normal fields are mutually exclusive. Nor will most applications try to use all eight sets of texture coordinates, but Direct3D Mobile has this capacity. There are several restrictions on which flags you can use with other flags. For example, you cannot use the D3DMFVF_XYZ and D3DMFVF_XYZRHW flags together, as this would indicate that your application is describing a vertex's position with both untransformed and transformed vertices.
The following topics provide additional information about vertex formats.
- Untransformed and Unlit Vertices
- Untransformed and Lit Vertices
- Transformed and Lit Vertices
- Transformed and Lit Vertex Functionality