Using Fixed-Point Vertex Data
You can use fixed-point vertex data to increase the transforming and lighting speeds of 3D graphics drivers that do not implement transforming and lighting in hardware. Some drivers are capable of working faster on fixed-point data. You can determine if your driver uses floating-point math operations by examining the NativeFloat property of a DeviceCaps structure. If the property value is false, then using data in a fixed-point format is preferable for the device. All Windows Mobile Direct3D drivers are required to support both fixed-point and floating-point data.
Fixed-point vertex buffers are used in the same way that floating-point vertex buffers are used. The only differences are the format of the data they contain and the flexible vertex format specified when the vertex buffer is created.
If the data is not originally in a fixed-point format, you can construct a Mesh object that contains floating-point data and then convert it to fixed-point data with a call to the Clone method of the Mesh object.
The following table lists the VertexFormats enumeration values used to specify various flexible formats for floating-point and fixed-point data. This list is not comprehensive of the possibilities, but it does provide examples of how a fixed-point flexible vertex format differs from a floating-point flexible vertex format.
Format |
Floating-point specification |
Fixed-point specification |
---|---|---|
Position only |
VertexFormats.Position |
VertexFormats.PositionFixed |
Position and normal |
VertexFormats.Position | VertexFormats.Normal |
VertexFormats.PositionFixed | VertexFormats.NormalFixed |
Position and diffuse color |
VertexFormats.Position | VertexFormats.Diffuse |
VertexFormats.PositionFixed | VertexFormats.Diffuse |
Position and one 2D texture coordinate |
VertexFormats.Position | VertexFormats.Texture1 |
VertexFormats.PositionFixed | VertexFormats.Texture1 | VertexTextureCoordinate.Fixed(0) |
Position, normal, specular color, diffuse color, a 1D texture coordinate, and a 2D texture coordinate |
VertexFormats.Position | VertexFormats.Normal | VertexFormats.Diffuse | VertexFormats.Texture2 | VertexTextureCoordinate.Size1(0) |
VertexFormats.PositionFixed | VertexFormats.NormalFixed | VertexFormats.Diffuse | VertexFormats.Texture2 | VertexTextureCoordinate.Size1(0) | VertexTextureCoordinate.Fixed(0) | VertexTextureCoordinate.Fixed(1) |