Vertex Descriptor/PC
Structures
renderengine::VertexDescriptor
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | uint32_t | ? | Always 1? | |
0x4 | 0x4 | IDirect3DVertexDeclaration9* | ? | Vertex declaration interface | nullptr in asset. Set in memory |
0x8 | 0x4 | uint32_t | ? | Type flags | Bits are set by indexed usage of each element (1 << usage index) |
0xC | 0x1 | uint8_t | ? | Number of elements | |
0xD | 0x1 | uint8_t | ? | Number of streams | |
0xE | 0x2 | uint16_t | ? | Address hash | Null in file. Set in memory |
0x10 | 0x10 | Element[1] | ? | Vertex elements |
renderengine::VertexDescriptor::Element
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x1 | uint8_t | ? | Stream index | |
0x1 | 0x1 | uint8_t | ? | Vertex size | |
0x2 | 0x2 | uint16_t | ? | Offset | |
0x4 | 0x1 | D3DDECLTYPE | ? | Type | |
0x5 | 0x3 | Padding | |||
0x8 | 0x1 | D3DDECLMETHOD | ? | Tessellation method | |
0x9 | 0x1 | D3DDECLUSAGE | ? | Usage | -1 if indexed usage is used |
0xA | 0x1 | uint8_t | ? | Usage index | -1 if indexed usage is used |
0xB | 0x1 | uint8_t | ? | Indexed usage | See indexed usage |
0xC | 0x4 | uint32_t | ? | Element class | See element class |
Enumerations
D3DDECLTYPE
Name | Value | Comments |
---|---|---|
D3DDECLTYPE_FLOAT1 | 0 | One-component float expanded to (float, 0, 0, 1). |
D3DDECLTYPE_FLOAT2 | 1 | Two-component float expanded to (float, float, 0, 1). |
D3DDECLTYPE_FLOAT3 | 2 | Three-component float expanded to (float, float, float, 1). |
D3DDECLTYPE_FLOAT4 | 3 | Four-component float expanded to (float, float, float, float). |
D3DDECLTYPE_D3DCOLOR | 4 | Four-component, packed, unsigned bytes mapped to 0 to 1 range. Input is a D3DCOLOR and is expanded to RGBA order. |
D3DDECLTYPE_UBYTE4 | 5 | Four-component, unsigned byte. |
D3DDECLTYPE_SHORT2 | 6 | Two-component, signed short expanded to (value, value, 0, 1). |
D3DDECLTYPE_SHORT4 | 7 | Four-component, signed short expanded to (value, value, value, value). |
D3DDECLTYPE_UBYTE4N | 8 | Four-component byte with each byte normalized by dividing with 255.0f. |
D3DDECLTYPE_SHORT2N | 9 | Normalized, two-component, signed short, expanded to (first short/32767.0, second short/32767.0, 0, 1). |
D3DDECLTYPE_SHORT4N | 10 | Normalized, four-component, signed short, expanded to (first short/32767.0, second short/32767.0, third short/32767.0, fourth short/32767.0). |
D3DDECLTYPE_USHORT2N | 11 | Normalized, two-component, unsigned short, expanded to (first short/65535.0, short short/65535.0, 0, 1). |
D3DDECLTYPE_USHORT4N | 12 | Normalized, four-component, unsigned short, expanded to (first short/65535.0, second short/65535.0, third short/65535.0, fourth short/65535.0). |
D3DDECLTYPE_UDEC3 | 13 | Three-component, unsigned, 10 10 10 format expanded to (value, value, value, 1). |
D3DDECLTYPE_DEC3N | 14 | Three-component, signed, 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1). |
D3DDECLTYPE_FLOAT16_2 | 15 | Two-component, 16-bit, floating point expanded to (value, value, 0, 1). |
D3DDECLTYPE_FLOAT16_4 | 16 | Four-component, 16-bit, floating point expanded to (value, value, value, value). |
D3DDECLTYPE_UNUSED | 17 | Type field in the declaration is unused. This is designed for use with D3DDECLMETHOD_UV and D3DDECLMETHOD_LOOKUPPRESAMPLED. |
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 |