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 | The MESH section defines render meshes. | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Type | ||
! | ! Count | ||
! | ! Name | ||
! Notes | |||
|- | |- | ||
| | | [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]] | ||
| 1 | |||
| '''MESH Chunk Descriptor''' | |||
| Chunk ID is <code>MESH</code> | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| | | '''Render Mesh Count''' | ||
| | |||
|- | |- | ||
| | | [[#Render Mesh|Render Mesh]] | ||
| | | ''Render Mesh Count'' | ||
| '''Render Mesh Array''' | |||
| | |||
|} | |} | ||
==== Render Mesh ==== | |||
{|class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
! | ! Type | ||
! | ! Count | ||
! Name | |||
! Notes | |||
|- | |- | ||
| 0x0 | | 0x0 | ||
| | | u32 | ||
| {{unknown| | | 1 | ||
| {{unknown}} | |||
| Always 3? | |||
|- | |- | ||
| 0x4 | | 0x4 | ||
| | | u16 | ||
| '''Material | | 1 | ||
| '''Material Index''' | |||
| | |||
|- | |- | ||
| 0x6 | | 0x6 | ||
| u8 | |||
| 1 | | 1 | ||
| '''Vertex | | '''Vertex Buffer Index''' | ||
| | |||
|- | |- | ||
| 0x7 | | 0x7 | ||
| u8 | |||
| 1 | | 1 | ||
| '''Index | | '''Index Buffer Index''' | ||
| | |||
|- | |- | ||
| 0x8 | | 0x8 | ||
| | | u32 | ||
| '''Start | | 1 | ||
| '''Start Index''' | |||
| This is basically an offset into the selected index buffer. | |||
|- | |- | ||
| 0xC | | 0xC | ||
| | | u32 | ||
| '''Index | | 1 | ||
| '''Index Count''' | |||
| Number of indices for this mesh in the index buffer. | |||
|- | |- | ||
| 0x10 | | 0x10 | ||
| | | u32 | ||
| {{unknown | | 1 | ||
| {{unknown}} | |||
| | |||
|- | |- | ||
| 0x14 | | 0x14 | ||
| bool | |||
| 1 | | 1 | ||
| {{unknown | | {{unknown}} | ||
| | |||
|- | |- | ||
| 0x15 | | 0x15 | ||
| colspan= | | 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. | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Type | ||
! | ! Count | ||
! | ! Name | ||
! Notes | |||
|- | |- | ||
| | | [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]] | ||
| 1 | |||
| '''VBUF Chunk Descriptor''' | |||
| Chunk ID is <code>VBUF</code> | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| Vertex | | '''Vertex Buffer Count''' | ||
| | |||
|- | |- | ||
| | | [[#Vertex Buffer|Vertex Buffer]] | ||
| | | ''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" | ||
! | ! Type | ||
! | ! Count | ||
! | ! Name | ||
! Notes | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| '''Vertex | | '''Vertex Count''' | ||
| Number of vertices in the buffer. | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| ''' | | '''Vertex Component Count''' | ||
| Number of components in each vertex. | |||
|- | |- | ||
| | | [[#Vertex Component|Vertex Component]] | ||
| | | ''Vertex Component Count'' | ||
| '''Vertex | | '''Vertex Component Array''' | ||
| | | Definitions for each component in the vertex. | ||
|} | |} | ||
==== Vertex | ==== Vertex Component ==== | ||
{|class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
! | ! Type | ||
! | ! Count | ||
! Name | |||
! Notes | |||
|- | |- | ||
| 0x0 | | 0x0 | ||
| | | u32 | ||
| {{unknown | | 1 | ||
| {{unknown}} | |||
| | |||
|- | |- | ||
| 0x4 | | 0x4 | ||
| | | u32 | ||
| 1 | |||
| '''Offset''' | | '''Offset''' | ||
| Offset of this component within the vertex. | |||
|- | |- | ||
| 0x8 | | 0x8 | ||
| | | 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 | ||
| | | u32 | ||
| {{unknown | | 1 | ||
| {{unknown}} | |||
| | |||
|- | |- | ||
| 0x10 | | 0x10 | ||
| | | u32 | ||
|{{unknown| | | 1 | ||
| {{unknown}} | |||
| Likely component type/format | |||
|- | |- | ||
| 0x14 | | 0x14 | ||
| colspan= | | 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). | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Type | ||
! | ! Count | ||
! | ! Name | ||
! Notes | |||
|- | |- | ||
| | | [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]] | ||
| 1 | |||
| '''IBUF Chunk Descriptor''' | |||
| Chunk Descriptor is <code>IBUF</code> | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| Index | | '''Index Buffer Count''' | ||
| | |||
|- | |- | ||
| | | [[#Index Buffer|Index Buffer]] | ||
| | | ''Index Buffer Count'' | ||
| '''Index Buffer Array''' | |||
| | |||
|} | |} | ||
Line 788: | Line 831: | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
! | ! Type | ||
! | ! Name | ||
! Notes | |||
|- | |- | ||
| 0x0 | | 0x0 | ||
| | | u32 | ||
| '''Format''' | | '''Format''' | ||
| 1 means unsigned short; 2 means unsigned long. | |||
|- | |- | ||
| 0x4 | | 0x4 | ||
| colspan= | | colspan=3 {{unknown|End of Index Buffer}} | ||
|} | |} | ||
Line 807: | Line 852: | ||
== PAK Metadata == | == PAK Metadata == | ||
The | 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" | ||
! | ! Type | ||
! | ! Count | ||
! | ! Name | ||
! Notes | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| {{unknown| | | {{unknown}} | ||
| Always 4? | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| '''GPU | | '''GPU Section Offset''' | ||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| ''' | | '''Read Buffer Count''' | ||
| Number of read buffers making up the GPU section. | |||
|- | |- | ||
| | | [[#Read Buffer Info|Read Buffer Info]] | ||
| | | ''Read Buffer Count'' | ||
| ''' | | '''Read Buffer Array''' | ||
| Definitions for each read buffer. | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| ''' | | '''Vertex Buffer Count''' | ||
| Number of vertex buffers in the model. | |||
|- | |- | ||
| | | [[#Buffer Info|Buffer Info]] | ||
| | | ''Vertex Buffer Count'' | ||
| '''Vertex | | '''Vertex Buffer Info Array''' | ||
| Array containing all data needed to decompress each vertex buffer. | |||
|- | |- | ||
| | | u32 | ||
| | | 1 | ||
| ''' | | '''Index Buffer Count''' | ||
| | | Number of index buffers in the model. | ||
|- | |- | ||
| | | [[#Buffer Info|Buffer Info]] | ||
| ''Index Buffer Count'' | |||
| '''Index Buffer Info Array''' | |||
| Array containing all data needed to decompress each index buffer. | |||
|} | |} | ||
=== | === Read Buffer Info === | ||
For large models, the GPU section | 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 | ||
! | ! Type | ||
! | ! Name | ||
! Notes | |||
|- | |- | ||
| 0x0 | | 0x0 | ||
| | | u32 | ||
| '''Size''' | | '''Size''' | ||
| Size of the buffer. | |||
|- | |- | ||
| 0x4 | | 0x4 | ||
| | | u32 | ||
| '''Offset''' | | '''Offset''' | ||
| Offset of the buffer within the GPU section. | |||
|- | |- | ||
| 0x8 | | 0x8 | ||
| colspan= | | colspan=3 {{unknown|End of Read Buffer Info}} | ||
|} | |} | ||
=== | === Buffer Info === | ||
This structure is used for both vertex and index buffers. | |||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
! | ! Type | ||
! | ! Name | ||
! Notes | |||
|- | |- | ||
| 0x0 | | 0x0 | ||
| | | u32 | ||
| ''' | | '''Read Buffer Index''' | ||
| The read buffer that this buffer is inside of. | |||
|- | |- | ||
| 0x4 | | 0x4 | ||
| | | u32 | ||
| '''Start | | '''Start Offset''' | ||
| Starting offset of this buffer, relative to the start of the chosen read buffer. | |||
|- | |- | ||
| 0x8 | | 0x8 | ||
| | | u32 | ||
| '''Compressed | | '''Compressed Size''' | ||
| Size of the compressed data. | |||
|- | |- | ||
| 0xC | | 0xC | ||
| | | u32 | ||
| '''Decompressed | | '''Decompressed Size''' | ||
| Size of the data after being decompressed. | |||
|- | |- | ||
| 0x10 | | 0x10 | ||
| colspan= | | 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]] |