CMDL (Tropical Freeze): Difference between revisions

no edit summary
>Aruki
No edit summary
>Aruki
No edit summary
Line 621: Line 621:
|}
|}


=== Meshes ===
=== Render Meshes ===


The MESH section does what the name suggests: it defines submeshes. The MESH section header is as follows:
The MESH section defines render meshes.


{| class="wikitable"
{| class="wikitable"
! Offset
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]
| 24
| 1
| '''MESH [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]'''
| '''MESH Chunk Descriptor'''
| Chunk ID is <code>MESH</code>
|-
|-
| 0x18
| u32
| 4
| 1
| Submesh count
| '''Render Mesh Count'''
|  
|-
|-
| 0x1C
| [[#Render Mesh|Render Mesh]]
| colspan=2 {{unknown|End of MESH header}}
| ''Render Mesh Count''
| '''Render Mesh Array'''
|  
|}
|}


Each submesh definition is structured as follows:
==== Render Mesh ====


{|class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 4
| u32
| {{unknown|'''Unknown'''; always 3?}}
| 1
| {{unknown}}
| Always 3?
|-
|-
| 0x4
| 0x4
| 2
| u16
| '''Material ID'''
| 1
| '''Material Index'''
|
|-
|-
| 0x6
| 0x6
| u8
| 1
| 1
| '''Vertex buffer ID'''
| '''Vertex Buffer Index'''
|
|-
|-
| 0x7
| 0x7
| u8
| 1
| 1
| '''Index buffer ID'''
| '''Index Buffer Index'''
|
|-
|-
| 0x8
| 0x8
| 4
| u32
| '''Start index'''
| 1
| '''Start Index'''
| This is basically an offset into the selected index buffer.
|-
|-
| 0xC
| 0xC
| 4
| u32
| '''Index count'''
| 1
| '''Index Count'''
| Number of indices for this mesh in the index buffer.
|-
|-
| 0x10
| 0x10
| 4
| u32
| {{unknown|'''Unknown'''}}
| 1
| {{unknown}}
|
|-
|-
| 0x14
| 0x14
| bool
| 1
| 1
| {{unknown|'''Unknown'''; usually seems to be either 0 or 1, possibly a bool value}}
| {{unknown}}
|
|-
|-
| 0x15
| 0x15
| colspan=2 {{unknown|End of submesh definition}}
| colspan=4 {{unknown|End of Render Mesh}}
|}
|}


Line 688: Line 711:


The VBUF section defines vertex buffers; each buffer can have different vertex types, with different strides and attributes.
The VBUF section defines vertex buffers; each buffer can have different vertex types, with different strides and attributes.
==== Header ====


{| class="wikitable"
{| class="wikitable"
! Offset
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]
| 24
| 1
| '''VBUF [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]'''
| '''VBUF Chunk Descriptor'''
| Chunk ID is <code>VBUF</code>
|-
|-
| 0x18
| u32
| 4
| 1
| Vertex buffer count
| '''Vertex Buffer Count'''
|
|-
|-
| 0x1C
| [[#Vertex Buffer|Vertex Buffer]]
| colspan=2 {{unknown|End of VBUF header}}
| ''Vertex Buffer Count''
| '''Vertex Buffer Array'''
| The model will contain a separate vertex buffer for every unique vertex configuration needed.
|}
|}


==== Vertex Buffer ====
==== Vertex Buffer ====


{|class="wikitable"
{| class="wikitable"
! Offset
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| u32
| 4
| 1
| '''Vertex count'''
| '''Vertex Count'''
| Number of vertices in the buffer.
|-
|-
| 0x4
| u32
| 4
| 1
| '''Attrib count''' (AC)
| '''Vertex Component Count'''
| Number of components in each vertex.
|-
|-
| 0x8
| [[#Vertex Component|Vertex Component]]
| 0x14 &times; AC
| ''Vertex Component Count''
| '''Vertex attributes'''
| '''Vertex Component Array'''
|-
| Definitions for each component in the vertex.
| colspan=3 {{unknown|End of vertex buffer}}
|}
|}


==== Vertex Attribute ====
==== Vertex Component ====


{|class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 4
| u32
| {{unknown|'''Unknown'''}}
| 1
| {{unknown}}
|
|-
|-
| 0x4
| 0x4
| 4
| u32
| 1
| '''Offset'''
| '''Offset'''
| Offset of this component within the vertex.
|-
|-
| 0x8
| 0x8
| 4
| u32
| 1
| '''Stride'''
| '''Stride'''
| Distance in bytes between elements of this component within the vertex buffer. (This is equivalent to the full size of a single vertex.)
|-
|-
| 0xC
| 0xC
| 4
| u32
| {{unknown|'''Unknown'''}}
| 1
| {{unknown}}
|
|-
|-
| 0x10
| 0x10
| 4
| u32
|{{unknown|'''Unknown''' (likely attrib type/format)}}
| 1
| {{unknown}}
| Likely component type/format
|-
|-
| 0x14
| 0x14
| colspan=2 {{unknown|End of attribute}}
| colspan=4 {{unknown|End of Vertex Component}}
|}
|}


=== Index Buffers ===
=== Index Buffers ===


Just like how the VBUF section defines vertex buffers, the IBUF section defines index buffers. Each index buffer only has one value associated with it, so it's fairly simple, and you generally will only see one or two index buffers per file.
Just like how the VBUF section defines vertex buffers, the IBUF section defines index buffers. Each index buffer only has one value associated with it, so it's fairly simple, and you generally will only see one or two index buffers per file (as there's only two possible index buffer configurations).
 
==== Header ====


{| class="wikitable"
{| class="wikitable"
! Offset
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]
| 24
| 1
| '''IBUF [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]'''
| '''IBUF Chunk Descriptor'''
| Chunk Descriptor is <code>IBUF</code>
|-
|-
| 0x18
| u32
| 4
| 1
| Index buffer count
| '''Index Buffer Count'''
|
|-
|-
| 0x1C
| [[#Index Buffer|Index Buffer]]
| colspan=2 {{unknown|End of IBUF header}}
| ''Index Buffer Count''
| '''Index Buffer Array'''
|  
|}
|}


Line 788: Line 831:
{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 4
| u32
| '''Format''' (1 means unsigned short; 2 means unsigned long)
| '''Format'''
| 1 means unsigned short; 2 means unsigned long.
|-
|-
| 0x4
| 0x4
| colspan=2 {{unknown|End of index buffer}}
| colspan=3 {{unknown|End of Index Buffer}}
|}
|}


Line 807: Line 852:
== PAK Metadata ==
== PAK Metadata ==


The pak metadata for the model formats contains mainly information related to the size and layout of the GPU section, and the metadata required to locate and decompress specific buffers within it.
The PAK metadata for the model formats contains mainly information related to the size and layout of the GPU section, and the metadata required to locate and decompress specific buffers within it.


{| class="wikitable"
{| class="wikitable"
! Offset
! Type
! Size
! Count
! Description
! Name
! Notes
|-
|-
| 0x0
| u32
| 4
| 1
| {{unknown|'''Unknown'''; always 4?}}
| {{unknown}}
| Always 4?
|-
|-
| 0x4
| u32
| 4
| 1
| '''GPU section offset'''
| '''GPU Section Offset'''
|-
|-
| 0x8
| u32
| 4
| 1
| '''GPU chunk count''' (CC)
| '''Read Buffer Count'''
| Number of read buffers making up the GPU section.
|-
|-
| 0xC
| [[#Read Buffer Info|Read Buffer Info]]
| 8 &times; CC
| ''Read Buffer Count''
| '''GPU chunk definitions'''
| '''Read Buffer Array'''
| Definitions for each read buffer.
|-
|-
| -
| u32
| 4
| 1
| '''Compressed vertex buffer count''' (VC)
| '''Vertex Buffer Count'''
| Number of vertex buffers in the model.
|-
|-
| -
| [[#Buffer Info|Buffer Info]]
| 0x10 &times; VC
| ''Vertex Buffer Count''
| '''Vertex buffer definitions'''
| '''Vertex Buffer Info Array'''
| Array containing all data needed to decompress each vertex buffer.
|-
|-
| -
| u32
| 4
| 1
| '''Compressed index buffer count''' (IC)
| '''Index Buffer Count'''
|-
| Number of index buffers in the model.
| -
| 0x10 &times; IC
| '''Index buffer definitions'''
|-
|-
| colspan = 3 {{unknown|End of pak metadata}}
| [[#Buffer Info|Buffer Info]]
| ''Index Buffer Count''
| '''Index Buffer Info Array'''
| Array containing all data needed to decompress each index buffer.
|}
|}


=== GPU Chunk ===
=== Read Buffer Info ===


For large models, the GPU section might be split up into multiple chunks, rather than read as one data buffer; all offsets into the GPU section will be relative to the start of the chosen chunk.
For large models, the GPU section may be split into multiple read buffers. All offsets into the GPU section will be relative to the beginning of the chosen buffer.


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 4
| u32
| '''Size'''
| '''Size'''
| Size of the buffer.
|-
|-
| 0x4
| 0x4
| 4
| u32
| '''Offset'''
| '''Offset'''
| Offset of the buffer within the GPU section.
|-
|-
| 0x8
| 0x8
| colspan=2 {{unknown|End of GPU chunk definition}}
| colspan=3 {{unknown|End of Read Buffer Info}}
|}
|}


=== Compressed Buffer ===
=== Buffer Info ===


The format for compressed buffer definitions is the same regardless of buffer type (vertex/index).
This structure is used for both vertex and index buffers.


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 4
| u32
| '''GPU chunk index'''
| '''Read Buffer Index'''
| The read buffer that this buffer is inside of.
|-
|-
| 0x4
| 0x4
| 4
| u32
| '''Start offset''' (relative to the start of the chosen GPU chunk)
| '''Start Offset'''
| Starting offset of this buffer, relative to the start of the chosen read buffer.
|-
|-
| 0x8
| 0x8
| 4
| u32
| '''Compressed size'''
| '''Compressed Size'''
| Size of the compressed data.
|-
|-
| 0xC
| 0xC
| 4
| u32
| '''Decompressed size'''
| '''Decompressed Size'''
| Size of the data after being decompressed.
|-
|-
| 0x10
| 0x10
| colspan=2 {{unknown|End of compressed buffer definition}}
| colspan=3 {{unknown|End of Buffer Info}}
|}
|}


[[Category:File Formats]]
[[Category:File Formats]]
[[Category:Donkey Kong Country: Tropical Freeze]]
[[Category:Donkey Kong Country: Tropical Freeze]]
Anonymous user