Share via


VertexElementFormat Enumeration

Defines vertex element formats.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public enum VertexElementFormat

Members

  Member name Description
Single Single-component, 32-bit floating-point, expanded to (float, 0, 0, 1).
Vector2 Two-component, 32-bit floating-point, expanded to (float, Float32 value, 0, 1).
Vector3 Three-component, 32-bit floating point, expanded to (float, float, float, 1).
Vector4 Four-component, 32-bit floating point, expanded to (float, float, float, float).
HalfVector2 Two-component, 16-bit floating point expanded to (value, value, value, value). This type is valid for vertex shader version 2.0 or higher.
HalfVector4 Four-component, 16-bit floating-point expanded to (value, value, value, value). This type is valid for vertex shader version 2.0 or higher.
Rgba64 Normalized, four-component, unsigned short, expanded to (first byte/65535.0, second byte/65535.0, third byte/65535.0, fourth byte/65535.0). This type is valid for vertex shader version 2.0 or higher.
Color Four-component, packed, unsigned byte, mapped to 0 to 1 range. Input is in Int32 format (ARGB) expanded to (R, G, B, A).
Rgba32 Four-component byte with each byte normalized by dividing the component with 255.0f. This type is valid for vertex shader version 2.0 or higher.
Rg32 Normalized, two-component, unsigned short, expanded to (first byte/65535.0, second byte/65535.0, 0, 1). This type is valid for vertex shader version 2.0 or higher.
NormalizedShort2 Normalized, two-component, signed short, expanded to (first short/32767.0, second short/32767.0, 0, 1). This type is valid for vertex shader version 2.0 or higher.
NormalizedShort4 Normalized, four-component, signed short, expanded to (first short/32767.0, second short/32767.0, third short/32767.0, fourth short/32767.0). This type is valid for vertex shader version 2.0 or higher.
Normalized101010 Three-component, signed, 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1).
Short2 Two-component, signed short expanded to (value, value, 0, 1).
Short4 Four-component, signed short expanded to (value, value, value, value).
Byte4 Four-component, unsigned byte.
UInt101010 Three-component, unsigned, 10 10 10 format expanded to (value, value, value, 1).
Unused Type field in the declaration is unused. This is designed for use with VertexElementMethod.UV and VertexElementMethod.LookUpPresampled.

Remarks

Vertex data is declared with an array of VertexElement structures. Each element in the array contains a vertex declaration method. These values can be passed into the constructor or to the VertexElementMethod property.

A mapping of each Direct3D 9 format name to the VertexElementFormat equivalent is listed in the following table.

Direct3D 9 Vertex Format VertexElementFormat equivalent
Floating Point
Float32D3DDECLTYPE_FLOAT1Single
D3DDECLTYPE_FLOAT2Vector2
D3DDECLTYPE_FLOAT3Vector3
D3DDECLTYPE_FLOAT4Vector4
Float16D3DDECLTYPE_FLOAT16_2HalfVector2
D3DDECLTYPE_FLOAT16_4HalfVector4
Unsigned Normalized
64 bppD3DDECLTYPE_USHORT4NRgba64
32 bppD3DDECLTYPE_D3DCOLORColor
D3DDECLTYPE_UBYTE4NRgba32
D3DDECLTYPE_USHORT2NRg32
Signed Normalized
D3DDECLTYPE_SHORT2NNormalizedShort2
D3DDECLTYPE_SHORT4NNormalizedShort4
D3DDECLTYPE_DEC3NNormalized101010
Signed Integer
D3DDECLTYPE_SHORT2Short2
D3DDECLTYPE_SHORT4Short4
Unsigned Integer
D3DDECLTYPE_UBYTE4Byte4
D3DDECLTYPE_UDEC3UInt101010

See Also

Reference

VertexElement Constructor
VertexElement.VertexElementFormat Property
GraphicsDeviceCapabilities.DeclarationTypeCaps Properties
VertexElementMethod Enumeration
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista