MREA (Metroid Prime): Difference between revisions
Jump to navigation
Jump to search
no edit summary
>Aruki No edit summary |
>Aruki No edit summary |
||
Line 4: | Line 4: | ||
{{todo|There's a LOT of sections that are mostly known, but need some documentation written up. SCLY and collision need separate articles (although the unique parts of the collision format, like the octree, could maybe be documented here). The rest should probably stay on this page.}} | {{todo|There's a LOT of sections that are mostly known, but need some documentation written up. SCLY and collision need separate articles (although the unique parts of the collision format, like the octree, could maybe be documented here). The rest should probably stay on this page.}} | ||
{{research| | {{research|minor|Discounting unknowns within the actual data sections, the only things that aren't known are what the .}} | ||
== Format == | == Format == | ||
Line 14: | Line 14: | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
! | ! Type | ||
! | ! Count | ||
! Name | |||
! Notes | |||
|- | |- | ||
| 0x0 | | 0x0 | ||
| | | u32 | ||
| '''Magic''' | | 1 | ||
| '''Magic''' | |||
| Always <code>0xDEADBEEF</code>. | |||
|- | |- | ||
| 0x4 | | 0x4 | ||
| | | u32 | ||
| '''Version''' | | 1 | ||
| '''Version''' | |||
| See [[MREA (File Format)|hub article]] for a list of possible version numbers. | |||
|- | |- | ||
| 0x8 | | 0x8 | ||
| | | float | ||
| '''Transform | | 12 | ||
| '''Area Transform''' | |||
| Matrix that represents the area's transform from the origin. Most area data is pre-transformed, so this matrix is only used occasionally. | |||
|- | |- | ||
| 0x38 | | 0x38 | ||
| | | u32 | ||
| ''' | | 1 | ||
| '''World Model Count''' | |||
| Number of world models in this area. | |||
|- | |- | ||
| 0x3C | | 0x3C | ||
| | | u32 | ||
| '''Section | | 1 | ||
| '''Data Section Count''' | |||
| Number of data sections in the file. | |||
|- | |- | ||
| 0x40 | | 0x40 | ||
| | | u32 | ||
| '''Geometry | | 1 | ||
| '''World Geometry Section''' | |||
| Section index for [[#World Geometry|world geometry data]]. Always 0; starts on materials. | |||
|- | |- | ||
| 0x44 | | 0x44 | ||
| | | u32 | ||
| ''' | | 1 | ||
| '''Script Layers Section''' | |||
| Section index for [[#Script Layers|script layer data]]. | |||
|- | |- | ||
| 0x48 | | 0x48 | ||
| | | u32 | ||
| '''Collision | | 1 | ||
| '''Collision Section''' | |||
| Section index for [[#Collision|collision data]]. | |||
|- | |- | ||
| 0x4C | | 0x4C | ||
| | | u32 | ||
| '''Unknown | | 1 | ||
| '''Unknown Section''' | |||
| Section index for [[#Unknown Section|unknown data]]. | |||
|- | |- | ||
| 0x50 | | 0x50 | ||
| | | u32 | ||
| '''[[ | | 1 | ||
| '''Lights Section''' | |||
| Section index for [[#Lights|light data]]. | |||
|- | |- | ||
| 0x54 | | 0x54 | ||
| | | u32 | ||
| ''' | | 1 | ||
| '''Visibility Tree Section''' | |||
| Section index for [[#Visibility Tree|visibility tree data]]. | |||
|- | |- | ||
| 0x58 | | 0x58 | ||
| | | u32 | ||
| ''' | | 1 | ||
| '''Path Section''' | |||
| Section index for [[#Path|path data]]. | |||
|- | |- | ||
| 0x5C | | 0x5C | ||
| | | u32 | ||
| '''[[ | | 1 | ||
| '''Area Octree Section''' | |||
| Section index for [[#Area Octree|area octree data]]. | |||
|- | |- | ||
| 0x60 | | 0x60 | ||
| | | u32 | ||
| '''Section | | ''Data Section Count'' | ||
| '''Data Section Sizes''' | |||
| Array containing the size of each data section in the file. Every size is always a multiple of 32. | |||
|- | |- | ||
| colspan= | | colspan=5 {{unknown|End of header; pad to 32 bytes before first data section begins}} | ||
|} | |} | ||
Line 85: | Line 115: | ||
|- | |- | ||
| {{none}} | | {{none}} | ||
| [[#Geometry|Geometry]] | | [[#World Geometry|World Geometry]] | ||
|- | |- | ||
| <code>AROT</code> | | <code>AROT</code> | ||
Line 97: | Line 127: | ||
|- | |- | ||
| {{none}} | | {{none}} | ||
| {{unknown|Unknown}} | | {{unknown|[[#Unknown Section|Unknown]]}} | ||
|- | |- | ||
| <code>0xBABEDEAD</code> | | <code>0xBABEDEAD</code> | ||
Line 109: | Line 139: | ||
|} | |} | ||
==== Geometry ==== | ==== World Geometry ==== | ||
''See [[Materials (Metroid Prime)]] and [[Geometry (Metroid Prime)]]'' | ''See [[Materials (Metroid Prime)]] and [[Geometry (Metroid Prime)]]'' | ||
MREA files have one material section, followed by a number of | MREA files have one material section, followed by a number of world models, each of which has its own set of geometry sections. There's couple small differences you'll usually see on world models compared to regular CMDL ones: | ||
* Normals are ''always'' shorts, so vertex format 0 is never used. | * Normals are ''always'' shorts, so vertex format 0 is never used. | ||
* Most | * Most world models use lightmaps, so normally the first UV coordinate on each vertex will read from the short UV array. This isn't always the case, though; you need to make sure you check the material so you know where to read from. | ||
* Surfaces will usually have a bounding box in the extra data in the surface header. This bounding box is used for depth sorting. | * Surfaces will usually have a bounding box in the extra data in the surface header. This bounding box is used for depth sorting. | ||
* Each | * Each world model starts with an extra header section which is formatted like this: | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset | ! Offset | ||
! | ! Type | ||
! | ! Count | ||
! Name | |||
! Notes | |||
|- | |- | ||
| 0x0 | | 0x0 | ||
| | | [[#Visor Flags]] | ||
| 1 | |||
| '''Visor Flags''' | | '''Visor Flags''' | ||
| 32-bit bitfield that sets parameters controlling how the mesh renders in different visors. | |||
|- | |- | ||
| 0x4 | | 0x4 | ||
| | | float | ||
| '''Transform | | 12 | ||
| '''World Model Transform''' | |||
| World model's transform from the area's local origin. The geometry data is pre-transformed, so this matrix can largely be ignored. | |||
|- | |- | ||
| 0x34 | | 0x34 | ||
| | | float | ||
| ''' | | 6 | ||
| '''World Model Bounding Box''' | |||
| Pre-transformed axis-aligned bounding box for this model. | |||
|- | |- | ||
| 0x4C | | 0x4C |