MREA (Metroid Prime 3): Difference between revisions
imported>Jackoalan No edit summary |
>Aruki No edit summary |
||
Line 33: | Line 33: | ||
|0x3C | |0x3C | ||
|4 | |4 | ||
|''' | |'''Layer Count''' | ||
|- | |- | ||
|0x40 | |0x40 | ||
Line 69: | Line 69: | ||
{|class="wikitable" | {| class="wikitable" | ||
!FourCC | ! FourCC | ||
!Description | ! Description | ||
|- | |- | ||
|AABB | | AABB | ||
|Axis Aligned Bounding Boxes | | Axis Aligned Bounding Boxes | ||
|- | |- | ||
|APTL | | APTL | ||
|{{unknown|Unknown}} | | {{unknown|Unknown}} | ||
|- | |- | ||
|COLI | | COLI | ||
|Collision | | Collision | ||
|- | |- | ||
|DEPS | | DEPS | ||
|Dependencies | | Dependencies | ||
|- | |- | ||
|EGMC | | EGMC | ||
|{{unknown|Unknown}} | | {{unknown|Unknown}} | ||
|- | |- | ||
|GPUD | | GPUD | ||
|Submesh data, e.g, vertices, normals, etc. | | Submesh data, e.g, vertices, normals, etc. | ||
|- | |- | ||
|LITE | | LITE | ||
|Lights | | Lights | ||
|- | |- | ||
|LLTE | | LLTE | ||
|{{unknown|Unknown}} | | {{unknown|Unknown}} | ||
|- | |- | ||
|PFL2 | | PFL2 | ||
|Path file | | Path file | ||
|- | |- | ||
|PVS! | | PVS! | ||
|Area vis octree, used for culling unseen geometry | | Area vis octree, used for culling unseen geometry | ||
|- | |- | ||
|ROCT | | ROCT | ||
|{{unknown|Unknown}} | | {{unknown|Unknown}} | ||
|- | |- | ||
|RSOS | | RSOS | ||
|Revolution Shared | | RSO file list (Revolution Shared Object) | ||
|- | |- | ||
|SOBJ | | SOBJ | ||
|SCLY | | Script Object layers (SCLY) | ||
|- | |- | ||
|SGEN | | SGEN | ||
| | | Script Generator layer (SCGN) | ||
|- | |- | ||
|WOBJ | | WOBJ | ||
| | | World Object; always 0, points to the materials section | ||
|} | |} | ||
Revision as of 23:13, 13 May 2015
The .MREA file format is used to define areas in Metroid Prime 3 and Donkey Kong Country Returns. MREA files are broken up into many sections, and each section serves a specific purpose.
This file format needs more research Still a few sections we know nothing about. |
Universal Header
This header is shared between Metroid Prime and Donkey Kong Country, and is fairly straight forward.
Offset | Size | Description |
---|---|---|
0x0 | 4 | Magic Number 0xDEADBEEF |
0x4 | 4 | Version; see hub article |
0x8 | 48 | Transformation Matrix The position of the area in world-space |
0x38 | 4 | Mesh Count |
0x3C | 4 | Layer Count |
0x40 | 4 | Section Count |
0x0 | 4 | Compressed Block Count |
0x4 | 4 | Section Number Count |
Compressed Blocks
Compressed blocks are handled in the exact same manner as Metroid Prime 2, however with DKCR simply replace LZO with zlib.
Section Numbers
Section Numbers are preceded by the compressed blocks, each section is designated in the following:
let N=Section Number Count
Type | Description |
---|---|
FourCC | Section type |
Long | Section Number |
Repeat N
times, one for each section, and the sections sections are associated with the following FourCC values:
FourCC | Description |
---|---|
AABB | Axis Aligned Bounding Boxes |
APTL | Unknown |
COLI | Collision |
DEPS | Dependencies |
EGMC | Unknown |
GPUD | Submesh data, e.g, vertices, normals, etc. |
LITE | Lights |
LLTE | Unknown |
PFL2 | Path file |
PVS! | Area vis octree, used for culling unseen geometry |
ROCT | Unknown |
RSOS | RSO file list (Revolution Shared Object) |
SOBJ | Script Object layers (SCLY) |
SGEN | Script Generator layer (SCGN) |
WOBJ | World Object; always 0, points to the materials section |
Sections
Materials
Materials are identical to those found in CMDL files.
Mesh Headers
The WOBJ sections are unique: they don't have a valid section number, and are always set to 0, however they are always in the sections immediately following the Materials, simply iterate through the mesh count and read the following structs:
Main Header
Type | Description | Notes |
---|---|---|
long | Unknown | Most likely visor flags in MP3, unknown use and DKCR |
CTransform4f | Transformation Matrix | Meshes location in world space |
CAABox | Bounding Box | Likely used for Depth sorting as in previous games. |
Submesh Offsets
Type | Description | Notes |
---|---|---|
long (SC) | Submesh count | |
long | Submesh Offsets[SC] | Relative to the start first submesh, (i.e, the first offset points the the end of the first submesh) |
Following the submesh data are two unknown sections, they both seem to be arrays of flags or indices but nothing is known about them.
AROT
Following the WOBJ sections is usually AROT. AROT is a BSP Tree that appears to be used for shot-collision and possibly depth sorting, nothing is known about how to handle this section.
AABB
The AABB section is exactly what it sounds like, it's an array of Axis-Aligned Bounding Boxes, assembling a BVH tree. AABB starts with the number of bounding boxes with each one consisting of the following struct:
Type | Description | Notes |
---|---|---|
CAABox | Axis Aligned Bounding Box | Used to assist depth sorting, and/or collision |
long | Unknown | The first entry in the table always covers the entire, with this value always being -1 |
short | Self Index | 1 indexed position of this particular AABB entry, but ONLY if the previous value is -1. |
short | Self Index | 1 indexed position of this particular AABB entry, but ONLY if the previous value is -1. |
GPU Description Section (GPUD)
The GPUD section is a bit confusing at first glance, however it's really no different from the previous MREA version in terms of ordering. There is also one GPUD per WOBJ section
The section order is as follows:
Vertices
The vertices are always 32bit floats, even in DKCR
Normals
The normals are always 32bit floats.
Colors
Usually 0 filled and completely unused, it's stored in MREA simply for completeness.
Float Texcoords
Metroid Prime 3 uses these exclusively, even for lightmaps, which simplifies UV handling quite a bit.
Short Texcoords
This is only used in DKCR and can be used for anything, not just for lightmaps
Submeshes
The submesh format is exactly the same as the Geometry formats found in Metroid Prime 3 and DKCR.