DKC:TF > Material File (MTRL)

Meta data: NMaterialFormat::SMetaData

TypeDescription
CFormDescriptorForm descriptor

The data in this form is zlib compressed.

NMaterialFormat::SMaterialIdentifier

NMaterialFormat::CMaterialPermutation

TypeDescription
Uint32Shader id
Uint32Permutation id

MTRL Form

TypeDescription
CChunkDescriptorSGX2 chunk

SGX2 Chunk

TypeDescription
Uint32Flags
0x1: toc present
Uint32Size of toc. Only present if flags & 1.
NMaterialArchive::SMaterialArchiveTOCMaterial archive toc. Only present if flags & 1.
List<CShaderPart>Shader parts
List<NMaterialArchive::SMaterialImportDesc>Material import descs

NMaterialArchive::SMaterialArchiveTOC

TypeDescription
List<NMaterialArchive::SShaderSourceTOCEntry>Shader source toc entries
List<NMaterialArchive::SMaterialTOCEntry>Material toc entries

CShaderPart

A shader part contains a Gfx2 shader. Shader parts are referenced by the shader import descs.

TypeDescription
BoolState
CStringName
Uint32Data size
Data

NMaterialArchive::SMaterialImportDesc

TypeDescription
CFourCCMaterial type
Uint16Unknown (always 1)
List<NMaterialArchive::SShaderImportDesc>Shader import descs

NMaterialArchive::SShaderImportDesc

TypeDescription
Uint64Shader id
Uint32Shader part index for vertex shader
Uint32Shader part index for fragment shader
Uint32Shader part index for geometry shader
Uint32Unknown (always 0)
CShaderDefinesShader defines
List<Uint8>Additional data

CShaderDefines

TypeDescription
List<CString>Strings
Uint32Total length of shader define strings

Additional Shader Data

TypeDescription
NShaderCore::SAdditionalDataHeaderHeader
...Data buffer

NShaderCore::SAdditionalDataHeader

The first 6 offsets in the table below are relative to the start of the data buffer behind this header. The remaining offsets are relative to the start of the constant buffer.

TypeDescription
Uint32Offset to string table
Uint32Size of string table
Uint32Offset to serialized uniform table
Uint32Number of serialized uniforms
Uint32Offset of uniform block data table
Uint32Number of uniform block data entries
Uint32Offset to shader vertex layout entries
Uint32Number of shader vertex layout entries
Uint32Offset to bitmask (uint32) indicating which matrices are used by this shader
Uint32Always 1
Uint32Offset to constant buffer
Uint32Size of constant buffer
Uint32Offset to constant buffer refs for vertex shader
Uint32Number of constant buffer refs for vertex shader
Uint32Offset to constant buffer refs for pixel shader
Uint32Number of constant buffer refs for pixel shader
Uint32Offset to constant buffer refs for geometry shader
Uint32Number of constant buffer refs for geometry shader
Uint32Offset to serialized shader bindings
Uint32Number of serialized shader bindings

NShaderCore::SSerializedUniform

TypeDescription
Uint32Offset into string table
Uint32Uniform block data index
Uint32Offset into uniform block data divided by 4

CShaderUniformBlockData

TypeDescription
Uint32Size
Uint32Flags:
0x1: This block uses the global transform cache

SShaderVertexLayoutEntry

TypeDescription
Uint32Vertex component
Uint32Unknown

ECachedGraphicsTransform

ValueName
0uc_modelToWorldMatrix
1uc_worldToModelMatrix
2uc_worldToViewMatrix
3uc_projectionMatrix
4uc_modelViewMatrix
5uc_modelViewProjectionMatrix
6uc_projectionInverseMatrix
7uc_normalMatrix
8uc_customMatrix0

NShaderCore::SConstantBufferRef

TypeDescription
Uint32Uniform block location
Uint32Uniform block index

NShaderCore::SSerializedShaderBinding

TypeDescription
Uint32Offset into string table
Uint32Unknown
Uint32Unknown

NMaterialFormat::SMetaData

TypeDescription
Uint32Unknown (always 1)
Uint32Version (always 12)
Uint32Compressed data size
Uint32Decompressed data size
Uint32Offset to compressed data in material file