Flexible Vertex Format Flags
The flexible vertex format (FVF) is used to describe the contents of vertices stored interleaved in a single data stream. A FVF code is generally used to specify data to be processed by fixed function vertex processing.
The following flags describe a vertex format. For information regarding vertex formats, see Vertex Formats.
- Flexible vertex format (FVF) flags
- D3DFVF_DIFFUSE
- Vertex format includes a diffuse color component.
- D3DFVF_NORMAL
- Vertex format includes a vertex normal vector. This flag cannot be used with the D3DFVF_XYZRHW flag.
- D3DFVF_PSIZE
- Vertex format specified in point size. This size is expressed in camera space units for vertices that are not transformed and lit, and in device-space units for transformed and lit vertices.
- D3DFVF_SPECULAR
- Vertex format includes a specular color component.
- D3DFVF_XYZ
- Vertex format includes the position of an untransformed vertex. This flag cannot be used with the D3DFVF_XYZRHW flag.
- D3DFVF_XYZRHW
- Vertex format includes the position of a transformed vertex. This flag cannot be used with the D3DFVF_XYZ or D3DFVF_NORMAL flags.
- D3DFVF_XYZB1 through D3DFVF_XYZB5
- Vertex format contains position data, and a corresponding number of weighting (beta) values to use for multimatrix vertex blending operations. Currently, Microsoft® Direct3D® can blend with up to three weighting values and four blending matrices. For more information on using blending matrices, see Indexed Vertex Blending.
- Texture-related FVF flags
- D3DFVF_TEX0 through D3DFVF_TEX8
- Number of texture coordinate sets for this vertex. The actual values for these flags are not sequential.
- D3DFVF_TEXTUREFORMAT1 through D3DFVF_TEXTUREFORMAT4
- Number of values that define a texture coordinate set. The D3DFVF_TEXTUREFORMAT1 indicates one-dimensional texture coordinates, D3DFVF_TEXTUREFORMAT2 indicates two-dimensional texture coordinates, and so on. These flags are rarely used alone; they are used with the D3DFVF_TEXCOORDSIZEn macros.
- Mask values
- D3DFVF_POSITION_MASK
- Mask for position bits.
- D3DFVF_RESERVED0 and D3DFVF_RESERVED2
- Mask values for reserved bits in the flexible vertex format. Do not use.
- D3DFVF_TEXCOUNT_MASK
- Mask value for texture flag bits.
- Miscellaneous
- D3DFVF_LASTBETA_UBYTE4
- When using indexed vertex blending and a fixed function FVF vertex shader, you must specify this flag for the vertex shader.
- D3DFVF_TEXCOUNT_SHIFT
- The number of bits by which to shift an integer value that identifies the number of a texture coordinates for a vertex. This value might be used as follows:
DWORD dwNumTextures = 1; // Vertex has only one set of
// coordinates.
// Shift the value for use when creating an FVF combination.
dwFVF = dwNumTextures<<D3DFVF_TEXCOUNT_SHIFT;
/*
* Now, create an FVF combination using the shifted value.
*/
The following example shows some other common flag combinations.
// Lightweight, untransformed vertex for lit, untextured,
// Gouraud-shaded content.
dwFVF = ( D3DFVF_XYZ | D3DFVF_DIFFUSE );
// Untransformed vertex for unlit, untextured, Gouraud-shaded
// content with diffuse material color specified per vertex.
dwFVF = ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE );
// Untransformed vertex for light-map-based lighting.
dwFVF = ( D3DFVF_XYZ | D3DFVF_TEX2 );
// Transformed vertex for light-map-based lighting
// with shared rhw.
dwFVF = ( D3DFVF_XYZRHW | D3DFVF_TEX2 );
// Heavyweight vertex for unlit, colored content with two
// sets of texture coordinates.
dwFVF = ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE |
D3DFVF_SPECULAR | D3DFVF_TEX2 );
See Also
Vertex Formats, Geometry Blending