Freigeben über


Vertex Data Description (Windows CE 5.0)

Send Feedback

Vertices can have several types of data associated with them. All vertices have a position vector to locate them in space. Additionally, the following type of data may be associated with any given vertex as well: a specular color value, a diffuse color value, a normal vector, and some sets of texture coordinates.

The complete set of data associated with a vertex is defined by a flexible vertex format (FVF). In practice, an FVF is a 32 bit value interpreted as a set of flags encoded into a ULONG data value. Each FVF is combination of these flags representing the unique combination of properties associated with a vertex and each vertex is a set of values for those properties. For specific FVFs, see D3DMFVF Values

Vertices are stored in vertex buffers. You can create a vertex buffer by calling the IDirect3DMobileDevice::CreateVertexBuffer method. One of the parameters passed to this method is the FVF for the vertex buffer. This means that all vertices in a vertex buffer must be of the same format.

Texture Data

A vertex may contain up to 4 sets of texture coordinates. Each set of texture coordinates may be one, two, or three-dimensional. The number of sets of texture coordinates is specified in bits 8, 9, and 10 of the FVF value. The following code shows the mask and shift operation used to retrieve the number of texture coordinates present in an FVF.

((FVF & D3DMFVF_TEXCOUNT_MASK) >> D3DMFVF_TEXCOUNT_SHIFT)

The number of dimensions per texture coordinate set is encoded into the low byte of the high word of the FVF value. Each possible coordinate set is denoted by two bits. The value of the two bits may be D3DMFVF_TEXCOORDCOUNT1, D3DMFVF_TEXCOORDCOUNT2, or D3DMFVF_TEXCOORDCOUNT3.

The second coordinate set is specified in the low bits of the byte specifying the number of dimensions. The first set is in the next higher two bits and so on.

The following table shows how bits 16 - 23 of the FVF specify texture dimensionality.

Bits Meaning
16 and 17 Coordinate set 0
18 and 19 Coordinate set 1
20 and 21 Coordinate set 2
22 and 23 Coordinate set 3

The format of each set of texture coordinates is encoded into the high byte of the FVF value. Two bits are allocated to each coordinate set, similar to the number of dimensions. The first coordinate set's format occupies bits 24 and 25. The second coordinate set occupies the 26 and 27, and so on.

When constructing FVF values, use the macros D3DMFVF_TEXCOORDFLOAT and D3DMFVF_TEXCOORDFIXED to specify the numerical format, IEEE 32-bit floating point or signed 16.16 fixed point, of a texture coordinate set. Your application can use either floating or fix point formats for coordinates in its FVF's texture coordinates set, but not a combination of the two. All of your application's FVF texture coordinates sets must use the same numerical format.

See Also

Transformation

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.