?/TD>
Microsoft DirectX 9.0

D3DFVF


Flexible Vertex Format Constants

The flexible vertex format (FVF) is used to describe the contents of vertices stored interleaved in a single data stream. An 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.

Vertex data related flags

#defineDescription
D3DFVF_DIFFUSEVertex format includes a diffuse color component.
D3DFVF_NORMALVertex format includes a vertex normal vector. This flag cannot be used with the D3DFVF_XYZRHW flag.
D3DFVF_PSIZEVertex 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_SPECULARVertex format includes a specular color component.
D3DFVF_XYZVertex format includes the position of an untransformed vertex. This flag cannot be used with the D3DFVF_XYZRHW flag.
D3DFVF_XYZRHWVertex 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_XYZB5Vertex 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 about using blending matrices, see Indexed Vertex Blending.
D3DFVF_XYZWVertex format contains transformed and clipped x,y,z w data. ProcessVertices does not invoke the clipper, instead outputting data in clip coordinates. This constant is designed for, and can only be used with, the programmable vertex pipeline.

Texture-related flags

#defineDescription
D3DFVF_TEX0 - D3DFVF_TEX8Number of texture coordinate sets for this vertex. The actual values for these flags are not sequential.
D3DFVF_TEXCOORDSIZEn(coordIndex)Define a texture coordinate data set. n indicates the dimension of the texture coordinates. coordIndex indicates texture coordinate index number. See D3DFVF_TEXCOORDSIZEn and Texture_coordinates_and_Texture_Stages.

Mask values

#defineDescription
D3DFVF_POSITION_MASKMask for position bits.
D3DFVF_RESERVED0, D3DFVF_RESERVED2Mask values for reserved bits in the flexible vertex format. Do not use.
D3DFVF_TEXCOUNT_MASKMask value for texture flag bits.

Miscellaneous

#defineDescription
D3DFVF_LASTBETA_D3DCOLORThe last beta field in the vertex position data will be of type D3DCOLOR. The data in the beta fields are used with matrix palette skinning to specify matrix indices.
D3DFVF_LASTBETA_UBYTE4

The last beta field in the vertex position data will be of type UBYTE4. The data in the beta fields are used with matrix malette skinning to specify matrix indices.

// Given the following vertex data definition: 
struct VERTEXPOSITION
{
   float pos[3];
   union 
   {
      float beta[5];
      struct
      {
         float weights[4];
         DWORD MatrixIndices;  // Used as UBYTEs
      }
   }
};

Given the FVF is declared as: D3DFVF_XYZB5 | D3DFVF_LASTBETA_UBYTE4. Weight and MatrixInidices are included in beta[], where D3DFVF_LASTBETA_UBYTE4 says to interpret the last DWORD (beta[5]) as type UBYTE4.

The last beta is determined by the D3DRS_VERTEXBLEND, not by the number of betas in the position format. For example, if D3DRS_VERTEXBLEND is D3DVBF_2WEIGHTS and you have the position format above, the last beta will be beta[2] will be used as a DWORD with 4-byte indices.

D3DFVF_TEXCOUNT_SHIFTThe 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 shown below
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 examples show other common flag combinations.

// 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 );

Constant Information

Headerd3d9types.h
Minimum operating systemWindows 98

Related Topics



© 2002 Microsoft Corporation. All rights reserved.