Geometry (Metroid Prime): Difference between revisions
Jump to navigation
Jump to search
→Format
>Aruki |
>Aruki (→Format) |
||
Line 171: | Line 171: | ||
| GX_NRM_XYZ / GX_S16 | | GX_NRM_XYZ / GX_S16 | ||
| GX_TEX_ST / GX_S16 | | GX_TEX_ST / GX_S16 | ||
|} | |||
=== Surface Group IDs === | |||
This section (and the following one) appears starting in Metroid Prime 2. In MP2, surfaces in world geometry are now merged together to create as few meshes as possible (meshes are now only split when the vertex count exceeds 65535). Two extra data sections are present to manage the resulting super-meshes to enable the game to extract smaller meshes out when needed. | |||
This first section assigns a group ID to each surface, forming smaller meshes. This ID is used in various places that operate on world geometry, including in the [[AROT (MREA Section)|area octree]] as well as in the [[EGMC (File Format)|EGMC format]] to map PointOfInterest scans to world geometry, among others. | |||
{| class="wikitable" | |||
! Type | |||
! Count | |||
! Name | |||
! Notes | |||
|- | |||
| u16 | |||
| 1 | |||
| '''Surface Count''' | |||
| Matches the world model surface count | |||
|- | |||
| [[#Surface Group ID|Surface Group ID]] | |||
| ''Surface Count'' | |||
| '''Surface Group ID Array''' | |||
| Sequentially assigns a surface group ID to every surface in the mesh. | |||
|} | |||
==== Surface Group ID ==== | |||
{| class="wikitable" | |||
! Offset | |||
! Type | |||
! Name | |||
! Notes | |||
|- | |||
| 0x0 | |||
| u16 | |||
| '''Model-Relative Surface Group ID''' | |||
| This is the ID of the group this surface belongs to, relative to the groups in this model (starting from 0). | |||
|- | |||
| 0x2 | |||
| u16 | |||
| '''Surface Group ID''' | |||
| Same ID, except area-relative (starting where the previous world model's group IDs left off). | |||
|} | |||
=== Surface Lookup Table === | |||
This is the second new section introduced in Metroid Prime 2. It provides a mapping of each surface group to the surfaces contained in it, so that surfaces can be quickly accessed by group ID. | |||
{| class="wikitable" | |||
! Type | |||
! Count | |||
! Name | |||
! Notes | |||
|- | |||
| u16 | |||
| 1 | |||
| '''Surface Group Count''' | |||
| | |||
|- | |||
| u16 | |||
| ''Surface Group Count'' | |||
| '''Lookup Table Index Array''' | |||
| The value of each element corresponds to the end index of the surfaces for this group in the lookup table. Each element is equal to the previous element + the number of surfaces contained in this group. | |||
|- | |||
| u16 | |||
| ''Surface Count'' | |||
| '''Surface Lookup Table''' | |||
| List of surface indices ordered by group ID. | |||
|} | |} | ||