Vertex Descriptor/Xbox 360

From Burnout Wiki

Structures

renderengine::VertexDescriptor

Offset Length Type Name Description Comments
0x0 0x4 int32_t m_refCount Always 0?
0x4 0x4 uint32_t m_typesFlags Type flags Bits are set by indexed usage of each element (1 << usage index)
0x8 0x2 uint16_t m_numElements Number of elements
0xA 0x1 uint8_t ? Always 1?
0xB 0x5 Padding
0x10 0x10 Element[1] m_elements Elements

renderengine::VertexDescriptor::Element

Offset Length Type Name Description Comments
0x0 0xB D3DVERTEXELEMENT9 ? Vertex elements
0xB 0x1 uint8_t ? Indexed usage See indexed usage
0xC 0x4 uint32_t elementClass Element class Always 1? See element class

D3DVERTEXELEMENT9

From the MS Learn page.

Offset Length Type Name Description Comments
0x0 0x2 WORD Stream Stream number.
0x2 0x2 WORD Offset Offset (if any) from the beginning of the stream to the start of the data.
0x4 0x4 DWORD Type Data type. One of several predefined types that define the data size. See D3DDECLTYPE
0x8 0x1 BYTE Method Tessellation method. Always D3DDECLMETHOD_DEFAULT. See D3DDECLMETHOD
0x9 0x1 BYTE Usage Defines the intended use of the data. D3DDECLUSAGE
0xA 0x1 BYTE UsageIndex Modifies the usage data to allow the user to specify multiple usage types.

Vertex size array

Following the rest of the resource is an array of bytes of the same length as the number of elements. They represent the vertex sizes.

Enumerations

D3DDECLTYPE

From the Microsoft Xbox 360 SDK and Burnout Paradise (2008-01-30 build)'s XDBs.

Name Value Comments
D3DDECLTYPE_FLOAT1 0x2C83A4 1D float expanded to (value, 0, 0, 1).
D3DDECLTYPE_FLOAT2 0x2C23A5 2D float expanded to (value, value, 0, 1).
D3DDECLTYPE_FLOAT3 0x2A23B9 3D float expanded to (value, value, value, 1).
D3DDECLTYPE_FLOAT4 0x1A23A6 4D float expanded to (value, value, value, value).
D3DDECLTYPE_INT1 0x2C83A1 1D signed int expanded to (value, 0, 0, 1).
D3DDECLTYPE_INT2 0x2C23A2 2D signed int expanded to (value, value, 0, 1).
D3DDECLTYPE_INT4 0x1A23A3 4D signed int expanded to (value, value, value, value).
D3DDECLTYPE_UINT1 0x2C82A1 1D unsigned int expanded to (value, 0, 0, 1).
D3DDECLTYPE_UINT2 0x2C22A2 2D unsigned int expanded to (value, value, 0, 1).
D3DDECLTYPE_UINT4 0x1A22A3 4D unsigned int expanded to (value, value, value, value).
D3DDECLTYPE_INT1N 0x2C81A1 Normalized, 1D signed int expanded to (value/0x7fffffff, 0, 0, 1).
D3DDECLTYPE_INT2N 0x2C21A2 Normalized, 2D signed int expanded to (value/0x7fffffff, value/0x7fffffff, 0, 1).
D3DDECLTYPE_INT4N 0x1A21A3 Normalized, 4D signed int expanded to (value/0x7fffffff, value/0x7fffffff, value/0x7fffffff, value/0x7fffffff).
D3DDECLTYPE_UINT1N 0x2C80A1 Normalized, 1D unsigned int expanded to (value/0xffffffff, 0, 0, 1).
D3DDECLTYPE_UINT2N 0x2C20A2 Normalized, 2D unsigned int expanded to (value/0xffffffff, value/0xffffffff, 0, 1).
D3DDECLTYPE_UINT4N 0x1A20A3 Normalized, 4D unsigned int expanded to (value/0xffffffff, value/0xffffffff, value/0xffffffff, value/0xffffffff).
D3DDECLTYPE_D3DCOLOR 0x182886 4D packed unsigned bytes mapped to 0 to 1 range. Input is in D3DCOLOR format (ARGB) expanded to (r, g, b, a).
D3DDECLTYPE_UBYTE4 0x1A2286 4D unsigned byte. See (U)BYTE4(N) format for details.
D3DDECLTYPE_BYTE4 0x1A2386 4D signed byte. See (U)BYTE4(N) format for details.
D3DDECLTYPE_UBYTE4N 0x1A2086 Each of 4 bytes is normalized by dividing by 255.0. See (U)BYTE4(N) format for details.
D3DDECLTYPE_BYTE4N 0x1A2186 Normalized, 4D signed byte. Each of the 4 bytes are normalized by dividing by 127.0. See (U)BYTE4(N) format for details.
D3DDECLTYPE_SHORT2 0x2C2359 2D signed short expanded to (value, value, 0, 1).
D3DDECLTYPE_SHORT4 0x1A235A 4D signed short expanded to (value, value, value, value).
D3DDECLTYPE_USHORT2 0x2C2259 2D unsigned short expanded to (value, value, 0, 1).
D3DDECLTYPE_USHORT4 0x1A225A 4D unsigned short expanded to (value, value, value, value).
D3DDECLTYPE_SHORT2N 0x2C2159 Normalized, 2D signed short, expanded to (value/32767.0, value/32767.0, 0, 1).
D3DDECLTYPE_SHORT4N 0x1A215A Normalized, 4D signed short, expanded to (value/32767.0, value/32767.0, value/32767.0, value/32767.0).
D3DDECLTYPE_USHORT2N 0x2C2059 Normalized, 2D unsigned short, expanded to (value/65535.0, value/65535.0, 0, 1).
D3DDECLTYPE_USHORT4N 0x1A205A Normalized 4D unsigned short, expanded to (value/65535.0, value/65535.0, value/65535.0, value/65535.0).
D3DDECLTYPE_UDEC3 0x2A2287 3D unsigned 10 10 10 format expanded to (value, value, value, 1). See (U)DEC3(N) format for details.
D3DDECLTYPE_DEC3 0x2A2387 3D signed 10 10 10 format expanded to (value, value, value, 1). See (U)DEC3(N) format for details.
D3DDECLTYPE_UDEC3N 0x2A2087 Normalized, 3D unsigned 10 10 10 format expanded to (v[0]/1023.0, v[1]/1023.0, v[2]/1023.0, 1). See (U)DEC3(N) format for details.
D3DDECLTYPE_DEC3N 0x2A2187 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1). See (U)DEC3(N) format for details.
D3DDECLTYPE_UDEC4 0x1A2287 4D unsigned 10 10 10 2 format expanded to (value, value, value, value).
D3DDECLTYPE_DEC4 0x1A2387 4D signed 10 10 10 2 format expanded to (value, value, value, value).
D3DDECLTYPE_UDEC4N 0x1A2087 4D unsigned 10 10 10 2 format expanded to (v[0]/1023.0, v[1]/1023.0, v[2]/1023.0, v[3]/3.0).
D3DDECLTYPE_DEC4N 0x1A2187 4D signed 10 10 10 2 format expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, v[3]/1.0).
D3DDECLTYPE_UHEND3 0x2A2290 3D unsigned 11 11 10 format expanded to (value, value, value, 1). See Packed 11:11:10 format for details.
D3DDECLTYPE_HEND3 0x2A2390 3D signed 11 11 10 format expanded to (value, value, value, 1). See Packed 11:11:10 format for details.
D3DDECLTYPE_UHEND3N 0x2A2090 Normalized, 3D unsigned 11 11 10 format expanded to (value/2047.0, value/2047.0, value/1023.0, 1). See Packed 11:11:10 format for details.
D3DDECLTYPE_HEND3N 0x2A2190 Normalized, 3D signed 11 11 10 format expanded to (value/1023.0, value/1023.0, value/511.0, 1). See Packed 11:11:10 format for details.
D3DDECLTYPE_UDHEN3 0x2A2291 3D unsigned 10 11 11 format expanded to (value, value, value, 1). See Packed 10:11:11 format for details.
D3DDECLTYPE_DHEN3 0x2A2391 3D signed 10 11 11 format expanded to (value, value, value, 1). See Packed 10:11:11 format for details.
D3DDECLTYPE_UDHEN3N 0x2A2191 Normalized, 3D unsigned 10 11 11 format expanded to (value/1023.0, value/2047.0, value/2047.0, 1). See Packed 10:11:11 format for details.
D3DDECLTYPE_DHEN3N 0x2A2191 Normalized, 3D signed 10 11 11 format expanded to (value/511.0, value/1023.0, value/1023.0, 1). See Packed 10:11:11 format for details.
D3DDECLTYPE_FLOAT16_2 0x2C235F Two 16-bit floating-point values expanded to (value, value, 0, 1).
D3DDECLTYPE_FLOAT16_4 0x1A2360 Four 16-bit floating-point values expanded to (value, value, value, value).
D3DDECLTYPE_UNUSED 0xFF800000 Type field in the declaration is unused. This is designed for use with D3DDECLMETHOD_UV and D3DDECLMETHOD_LOOKUPPRESAMPLED.

(U)DEC3(N) format

To generate a packed 32-bit value that can be used with D3DDECLTYPE_DEC3, D3DDDECLTYPE_UDEC3, and D3DDDECLTYPE_DEC3N, use the following macro:
#define MakeDEC3(x,y,z,w) ((x)+((y)<<10)+((z)<<20)+((w)<<30))

(U)BYTE4(N) format

To generate a packed 32-bit value that can be used with D3DDECLTYPE_BYTE4, D3DDECLTYPE_BYTE4N, D3DDECLTYPE_UBYTE4 and D3DDECLTYPE_UBYTE4N, use the following macro:
#define MakeUBYTE4(x,y,z,w) ((x)+((y)<<8)+((z)<<16)+((w)<<24))

Packed 10:11:11 format

To generate a packed 32-bit value that can be used with type such as D3DDECLTYPE_UDHEN3, use the following macro:
#define MakePacked_10_11_11(x,y,z) ((x) + ((y)<<10) + ((z)<<21))

Packed 11:11:10 format

To generate a packed 32-bit value that can be used with type such as D3DDECLTYPE_UHEND3, use the following macro:
#define MakePacked_11_11_10(x,y,z) ((x) + ((y)<<11) + ((z)<<22))

D3DDECLMETHOD

From the MS Learn page.

Name Value Comments
D3DDECLMETHOD_DEFAULT 0 Default value. The tessellator copies the vertex data (spline data for patches) as is, with no additional calculations. When the tessellator is used, this element is interpolated. Otherwise vertex data is copied into the input register. The input and output type can be any value.
D3DDECLMETHOD_PARTIALU 1 Computes the tangent at a point on the rectangle or triangle patch in the U direction. The input type can be D3DDECLTYPE_FLOAT3, D3DDECLTYPE_FLOAT4, D3DDECLTYPE_D3DCOLOR, D3DDECLTYPE_UBYTE4, D3DDECLTYPE_SHORT4. The output type is always D3DDECLTYPE_FLOAT3.
D3DDECLMETHOD_PARTIALV 2 Computes the tangent at a point on the rectangle or triangle patch in the V direction. The input type can be D3DDECLTYPE_FLOAT3, D3DDECLTYPE_FLOAT4, D3DDECLTYPE_D3DCOLOR, D3DDECLTYPE_UBYTE4, or D3DDECLTYPE_SHORT4. The output type is always D3DDECLTYPE_FLOAT3.
D3DDECLMETHOD_CROSSUV 3 Computes the normal at a point on the rectangle or triangle patch by taking the cross product of the two tangents. The input type can be D3DDECLTYPE_FLOAT[43], D3DDECLTYPE_D3DCOLOR, D3DDECLTYPE_UBYTE4, or D3DDECLTYPE_SHORT4. The output type is always D3DDECLTYPE_FLOAT3.
D3DDECLMETHOD_UV 4 Copy out the U, V values at a point on the rectangle or triangle patch. This results in a 2D float. The input type must be set to D3DDECLTYPE_UNUSED. The output data type is always D3DDECLTYPE_FLOAT2. The input stream and offset are also unused (but must be set to 0).
D3DDECLMETHOD_LOOKUP 5 Look up a displacement map. The input type can be D3DDECLTYPE_FLOAT2, D3DDECLTYPE_FLOAT3, or D3DDECLTYPE_FLOAT4. Only the .x and .y components are used for the texture map lookup. The output type is always D3DDECLTYPE_FLOAT1. The device must support displacement mapping. This constant is supported only by the programmable pipeline on N-patch data, if N-patches are enabled.
D3DDECLMETHOD_LOOKUPPRESAMPLED 6 Look up a presampled displacement map. The input type must be set to D3DDECLTYPE_UNUSED. The stream index and the stream offset must be set to 0. The output type for this operation is always D3DDECLTYPE_FLOAT1. The device must support displacement mapping. This constant is supported only by the programmable pipeline on N-patch data, if N-patches are enabled.

D3DDECLUSAGE

From the MS Learn page.

Name Value Comments
D3DDECLUSAGE_POSITION 0 Position data.
D3DDECLUSAGE_BLENDWEIGHT 1 Blending weight data.
D3DDECLUSAGE_BLENDINDICES 2 Blending indices data.
D3DDECLUSAGE_NORMAL 3 Vertex normal data.
D3DDECLUSAGE_PSIZE 4 Point size data.
D3DDECLUSAGE_TEXCOORD 5 Texture coordinate data.
D3DDECLUSAGE_TANGENT 6 Vertex tangent data.
D3DDECLUSAGE_BINORMAL 7 Vertex binormal data.
D3DDECLUSAGE_TESSFACTOR 8 Single positive floating-point value. Use D3DDECLUSAGE_TESSFACTOR with a usage index of 0 to specify a tessellation factor used in the tessellation unit to control the rate of tessellation.
D3DDECLUSAGE_COLOR 10 Vertex data contains diffuse or specular color.
D3DDECLUSAGE_FOG 11 Vertex data contains fog data.
D3DDECLUSAGE_DEPTH 12 Vertex data contains depth data.
D3DDECLUSAGE_SAMPLE 13 Vertex data contains sampler data.

Indexed usage

Name Value Comments
NA 0 0
D3DDECLUSAGE_POSITION 1 0
D3DDECLUSAGE_POSITION 2 0
D3DDECLUSAGE_NORMAL 3 0
D3DDECLUSAGE_COLOR 4 0
D3DDECLUSAGE_COLOR 5 1
D3DDECLUSAGE_TEXCOORD 6 0
D3DDECLUSAGE_TEXCOORD 7 1
D3DDECLUSAGE_TEXCOORD 8 2
D3DDECLUSAGE_TEXCOORD 9 3
D3DDECLUSAGE_TEXCOORD 10 4
D3DDECLUSAGE_TEXCOORD 11 5
D3DDECLUSAGE_TEXCOORD 12 6
D3DDECLUSAGE_TEXCOORD 13 7
D3DDECLUSAGE_BLENDINDICES 14 0
D3DDECLUSAGE_BLENDWEIGHT 15 0
D3DDECLUSAGE_POSITION 16 1
D3DDECLUSAGE_NORMAL 17 1
D3DDECLUSAGE_POSITION 18 0
D3DDECLUSAGE_POSITION 19 0
D3DDECLUSAGE_POSITION 20 0
D3DDECLUSAGE_TANGENT 21 0
D3DDECLUSAGE_BINORMAL 22 0
D3DDECLUSAGE_COLOR 23 2
D3DDECLUSAGE_FOG 24 0
D3DDECLUSAGE_PSIZE 25 0
D3DDECLUSAGE_BLENDINDICES 26 1
D3DDECLUSAGE_BLENDWEIGHT 27 1

renderengine::VertexDescriptor::ElementClass

Name Value Comments
ELEMENTCLASS_NA 0
ELEMENTCLASS_PERVERTEX 1
ELEMENTCLASS_PERINSTANCE 2
ELEMENTCLASS_FORCEENUMSIZEINT 0x7FFFFFFF