Skip to content

Shader Information

widberg edited this page Feb 7, 2024 · 13 revisions

Shaders

The shader source files can be found in the shaders directory in the root game directory.

Only 43 bytes are stack allocated for the shader file name with the extension relative to the shaders directory. Since these are hardcoded into the executable and none of them overrun this buffer it is not a big deal. Files with the extension phl and vhl are pixel shader and vertex shader HLSL source code; the "hl" in the extensions is assumed to be short for HLSL. Files with h as the extension are header files which are not themselves shaders but include shared definitions and will be included in shader source code. There is also a fx.psh file with the contents Deprecated: Delete this file ( use fx.phl instead ) , no other files have this extension (psh = pixel shader?, maybe the old extension they used).

Definitions Utility Functions

There is a utility function that fills a string buffer with shader definitions based on the preset index.

Preset Definitions
0 "bRadiosity+bRadiosityNormal"
2 "bRadiosity+bVLight+bRadiosityNormal"
3 "bVLight"
4 "bRadiosity+bRadiosityNormal+bShadowMap"
5 "bShadowMap"
7 "bShadowMap"

There is another function that first calls the previous function and then appends more flags based on bits set in another parameter. Here is the list of masks and which definitions they add in the order that the definitions are appended.

Mask Definitions
0x002 "+bEnvmap"
0x010 "+bSpecular"
0x008 "+bNormal+bCompression"
0x020 "+bNormalLocal+bCompression"
0x004 "+bOcclusion"
0x080 "+bAddNormalLocal+bCompression"
0x040 "+bDirt"
0x100 "+bCubemap"

This second utility function only succeeds for certain combinations of preset, index, and constant. This is used in loops to gate whether a shader is generated for certain indices and is rather complicated.

Shader Cache

The shader cache is stored at %AppData%\FUEL\cache which on my system is C:\Users\widberg\AppData\Roaming\FUEL\cache. An example filename in this directory is ground#ph_gbuffer#40d7df818d#.psc. In this file name ground is the basename of the shader source file without the extension; only 128 bytes are stack allocated for this buffer and the length is not checked. ph_gbuffer is the name of the shader used in the executable; only 24 bytes are stack allocated for this buffer and the length is not checked. 40d7df818d is the primary CRC32 hash of the basename, shader name, and each of the defines, except for bCompil, taken individually added together, all vsprintf formatted with "%0x8d#"; presumably they meant "%08x#", or similar, to make a 0-left-padded 8 digit hexadecimal number, 4 bytes, instead the number is not padded and there is an 8d tacked on after the hash. Strangely, enough this hash does not take into account the contents of the shader source so editing the file would not change the hash. And of course # is a separator to avoid false positive cache hits, another solution to this problem would have been to prepend the length of the strings. Finally, the file extension psc is used for pixel shaders, and vsc is used for vertex shaders; presumably the "sc" stands for shader cache.

When constructing a shader, if a cache entry is found, it is used; otherwise, the shader is compiled and cached so that it will be loaded from the cache the next time. Adding the command DisableShaderCompile to the top of user.tsc will speed up load times dramatically by avoiding reading/writing to/from the shader cache.

Shader Instantiations

Bear with me, this gets complicated. As the shaders are loaded, they get inserted into a tree-like structure where each node is a singly linked list that points to a subtree and the next node at the current level. The nodes also store an index, the metric by which the linked list is sorted, and a pointer to a shader instantiation if it is a leaf node. All leaf nodes have a depth of 5. With that in mind, a shader instantiation in this tree can be found via a "path" through the tree of length 5, i.e., [7, 43, 0, 0, 1] denoting which index at each level to follow.

Now, what is a shader instantiation? A shader instantiation is a vertex declaration, see below, and an array of up to 3 vertex shader, pixel shader pairs. So, in addition to the path we should consider an index in this array.

A JSON file containing a synthesized (pointers resolved and useless info stripped) version of this in memory tree can be found at synthesized_shader_tree.json. This contains all paths, filenames, shader names, vertex declarations, and shader definitions. Fair warning there are 17093 unique paths, so this file is huge. The scripts and pattern I used to generate this can be found at dump_shader_pointers.js/shader_tree.hexpat/synthesize_shader_tree.py.

Vertex Declarations

In Direct3D 9 vertex declarations are defined by an array of D3DVERTEXELEMENT9 structures.

A sandbox for D3DVERTEXELEMENT9 with FUEL's vertex declarations can be found on Compiler Explorer https://godbolt.org/z/rqT7EvTo8.

GroundVertex_Z::GetDecl()

D3DVERTEXELEMENT9 GroundVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    { 0u, 28u, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 3u },
    { 0u, 36u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 4u },
    { 0u, 40u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 5u },
    { 0u, 44u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 6u },
    { 0u, 48u, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 7u },
    { 0u, 56u, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 8u },
    { 0u, 64u, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 9u },
    D3DDECL_END()
};

GroundVertex_Z::GetShadowDecl()

D3DVERTEXELEMENT9 GroundVertex_Z_GetShadowDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    { 0u, 28u, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 3u },
    D3DDECL_END()
};

GroundWaterVertex_Z::GetDecl()

D3DVERTEXELEMENT9 GroundWaterVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    D3DDECL_END()
};

GroundElementVertex_Z::GetDecl()

D3DVERTEXELEMENT9 GroundElementVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    { 0u, 20u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 3u },
    { 0u, 24u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 4u },
    { 0u, 28u, D3DDECLTYPE_SHORT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 5u },
    { 0u, 32u, D3DDECLTYPE_SHORT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 6u },
    D3DDECL_END()
};

GroundElementVertex_Z::GetShadowDecl()

D3DVERTEXELEMENT9 GroundElementVertex_Z_GetShadowDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    D3DDECL_END()
};

SkyVertex_Z::GetDecl()

D3DVERTEXELEMENT9 SkyVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_FLOAT16_2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT16_2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 0u, 20u, D3DDECLTYPE_FLOAT16_2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2u },
    D3DDECL_END()
};

GlobalMeshVertex_Z::GetDecl()

D3DVERTEXELEMENT9 GlobalMeshVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 24u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    D3DDECL_END()
};

GlobalMeshVertex_Z::GetShadowDecl()

D3DVERTEXELEMENT9 GlobalMeshVertex_Z_GetShadowDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    D3DDECL_END()
};

RotshapeVertex_Z::GetDecl()

D3DVERTEXELEMENT9 RotshapeVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 20u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 3u },
    { 0u, 24u, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    { 0u, 28u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 32u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0u },
    D3DDECL_END()
};

RotshapeVertex_Z::GetShadowDecl()

D3DVERTEXELEMENT9 RotshapeVertex_Z_GetShadowDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 20u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 3u },
    { 0u, 24u, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    D3DDECL_END()
};

VertexND_Z::GetDecl()

D3DVERTEXELEMENT9 VertexND_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    D3DDECL_END()
};

VertexND_Z::GetWaterDecl()

D3DVERTEXELEMENT9 VertexND_Z_GetWaterDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 1u, 0u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 4u },
    D3DDECL_END()
};

VertexND_Z::GetShadowDecl()

D3DVERTEXELEMENT9 VertexND_Z_GetShadowDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    D3DDECL_END()
};

VertexND_Z::GetMorphDecl()

D3DVERTEXELEMENT9 VertexND_Z_GetMorphDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 1u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    D3DDECL_END()
};

VertexGouraud_Z::GetDecl()

D3DVERTEXELEMENT9 VertexGouraud_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 0u, 36u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0u },
    D3DDECL_END()
};

VertexGouraud_Z::GetWaterDecl()

D3DVERTEXELEMENT9 VertexGouraud_Z_GetWaterDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 1u, 0u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 4u },
    D3DDECL_END()
};

Vertex4Blend_Z::GetDecl()

D3DVERTEXELEMENT9 Vertex4Blend_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0u },
    { 0u, 44u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    D3DDECL_END()
};

Vertex4Blend_Z::GetMorphDecl()

D3DVERTEXELEMENT9 Vertex4Blend_Z_GetMorphDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_SHORT2N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 24u, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0u },
    { 0u, 28u, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    { 1u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 4u },
    { 2u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 5u },
    { 3u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 6u },
    { 4u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 7u },
    D3DDECL_END()
};

Vertex1Blend_Z::GetDecl()

D3DVERTEXELEMENT9 Vertex1Blend_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0u },
    { 0u, 44u, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    D3DDECL_END()
};

Vertex1Blend_Z::GetMorphDecl()

D3DVERTEXELEMENT9 Vertex1Blend_Z_GetMorphDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 16u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    { 0u, 20u, D3DDECLTYPE_SHORT2N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 24u, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    { 1u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 3u },
    { 2u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 4u },
    { 3u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 5u },
    { 4u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 6u },
    D3DDECL_END()
};

VertexVolume_Z::GetDecl()

D3DVERTEXELEMENT9 VertexVolume_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0u },
    D3DDECL_END()
};

VertexVolume1Blend_Z::GetDecl()

D3DVERTEXELEMENT9 VertexVolume1Blend_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 24u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    { 0u, 36u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 3u },
    D3DDECL_END()
};

VertexFlare_Z::GetDecl()

D3DVERTEXELEMENT9 VertexFlare_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 1u },
    { 0u, 24u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 2u },
    D3DDECL_END()
};

VertexParticle_Z::GetDecl()

D3DVERTEXELEMENT9 VertexParticle_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0u },
    { 0u, 28u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 40u, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0u },
    D3DDECL_END()
};

Vertex2D_Z::GetDecl()

D3DVERTEXELEMENT9 Vertex2D_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    D3DDECL_END()
};

Vertex3D_Z::GetDecl()

D3DVERTEXELEMENT9 Vertex3D_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0u },
    { 0u, 32u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    D3DDECL_END()
};

SpecialEffectsVertex_Z::GetDecl()

D3DVERTEXELEMENT9 SpecialEffectsVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 24u, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    D3DDECL_END()
};

SpecialEffectsTrailVertex_Z::GetDecl()

D3DVERTEXELEMENT9 SpecialEffectsTrailVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 24u, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 0u, 32u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2u },
    { 0u, 48u, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3u },
    D3DDECL_END()
};

SpecialEffectsVertexStatic_Z::GetDecl()

D3DVERTEXELEMENT9 SpecialEffectsVertexStatic_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 24u, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 0u, 32u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2u },
    { 0u, 48u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3u },
    { 0u, 64u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 4u },
    { 0u, 80u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 5u },
    { 0u, 96u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 6u },
    D3DDECL_END()
};

TornadoVertex_Z::GetDecl()

D3DVERTEXELEMENT9 TornadoVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 24u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 0u, 40u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2u },
    { 0u, 52u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3u },
    D3DDECL_END()
};

SandStormVertex_Z::GetDecl()

D3DVERTEXELEMENT9 SandStormVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 16u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 32u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 0u, 48u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2u },
    { 0u, 64u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3u },
    D3DDECL_END()
};

TornadoSmokeVertex_Z::GetDecl()

D3DVERTEXELEMENT9 TornadoSmokeVertex_Z_GetDecl[] = {
    { 0u, 0u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0u },
    { 0u, 12u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0u },
    { 0u, 24u, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1u },
    { 0u, 32u, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2u },
    { 0u, 44u, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3u },
    D3DDECL_END()
};

Home
FAQ

For FMTK Users and Mod Developers

Read the Docs

For FMTK Developers

Asobo BigFile Format Specification
Asobo Classes
      Animation_Z
      Binary_Z
      Bitmap_Z
      Camera_Z
      CollisionVol_Z
      Fonts_Z
      GameObj_Z
      GenWorld_Z
      GwRoad_Z
      Keyframer*_Z
      Light_Z
      LightData_Z
      Lod_Z
      LodData_Z
      Material_Z
      MaterialAnim_Z
      MaterialObj_Z
      Mesh_Z
      MeshData_Z
      Node_Z
      Omni_Z
      Particles_Z
      ParticlesData_Z
      RotShape_Z
      RotShapeData_Z
      Rtc_Z
      Skel_Z
      Skin_Z
      Sound_Z
      Spline_Z
      SplineGraph_Z
      Surface_Z
      SurfaceDatas_Z
      UserDefine_Z
      Warp_Z
      World_Z
      WorldRef_Z
Asobo File Format Idioms
Asobo CRC32
Asobo LZ Compression
Asobo Arithmetic Coding Compression
Asobo Save Game File Format Specification
Asobo Audio Formats
TotemTech/ToonTech/Zouna/ACE/BSSTech/Opal Timeline
Zouna Modding Resources
Miscellaneous

Clone this wiki locally