CMDL (Donkey Kong Country Returns)

See CMDL (File Format) for the other revisions of this format.

The CMDL format is DKCR's model format. It's similar to the CMDL format found in the Metroid Prime trilogy, but with a lot of additions and changes, and some layout changes.

Format
Like the previous CMDL formats, DKCR CMDL files are split up into a number of 32-byte aligned sections. Every section both starts and ends on a 32-byte boundary. These are used to separate different parts of the file; different types of sections typically indicate different sets of data. The header declares the section count and the size of each one; using these is the only way to navigate the file.

Flags
The following flags are possible:

Visibility Groups
This section is present in the header if bit 0x10 is set, after the material set count and before the section sizes.

The following structure repeats for each group:

Finally, it ends with this before the sizes begin:

Materials
There's not much known about the material format currently; DKCR seems to use the same material format as Metroid Prime 3. The main difference in DKCR compared to Prime 3 is that in Prime 3, each material set would get its own section. In DKCR, every material set is in the same section. Each material set begins with a material count, and each material begins with its own size. The main thing that's needed to read geometry is the vertex attribute flags, which are located at 0xC in the material structure (not counting the size). [[Category: