Geometry (Donkey Kong Country Returns): Difference between revisions

m
no edit summary
>Aruki
mNo edit summary
>Aruki
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
The format for ''geometry'' in Donkey Kong Country Returns appears in the [[CMDL (Donkey Kong Country Returns)|CMDL]] and [[MREA (Metroid Prime 3)|MREA]] formats.
The format for ''geometry'' in Donkey Kong Country Returns appears in the [[CMDL (Donkey Kong Country Returns)|CMDL]] and [[MREA (Metroid Prime 3)|MREA]] formats.


{{research|minor|There are some unknown values in the surface header, and the possible vertex formats should be documented.}}
{{research|minor|There is an unknown value in the surface header, and the possible vertex formats should be documented.}}


__TOC__
__TOC__
Line 15: Line 15:
=== Vertex Coordinates ===
=== Vertex Coordinates ===


Vertex coords can be stored as either floats or signed shorts, depending whether flag 0x20 is set in the header. If they're shorts, then they need to be divided by 0x2000 to get the corresponding float value. Since they're signed numbers, that means that 0 to 0x7FFF correspond to the range 0.0-4.0, and 0x8000 to 0xFFFF correspond to the range -4.0-0.0.
In the CMDL format, vertex coords can be stored as either floats or signed shorts, depending whether flag 0x20 is set in the header. If they're shorts, then they need to be divided by 0x2000 to get the corresponding float value. Since they're signed numbers, that means that 0 to 0x7FFF correspond to the range 0.0-4.0, and 0x8000 to 0xFFFF correspond to the range -4.0-0.0. In the MREA format, these will always be stored as floats.


=== Normals ===
=== Normals ===


Vertex normals are usually stored as shorts. To get the corresponding float value, read as a signed short and divide by 0x4000.
In the CMDL format, vertex normals are usually stored as shorts. To get the corresponding float value, read as a signed short and divide by 0x4000. In the MREA format, normals are never packed into shorts and are always stored as floats.


=== Vertex Color ===
=== Vertex Color ===
Line 88: Line 88:
| u32
| u32
| 1
| 1
| {{unknown|Unknown}}
| '''Model Pointer Storage'''
| Always 0?
| Always 0. This is filled in at runtime with a pointer to the owner model.
|-
|-
| 0x14
| 0x14
| u32
| u32
| 1
| 1
| {{unknown|Unknown}}
| '''Next Surface Pointer Storage'''
| Always 0?
| Always 0. This is filled in at runtime with a pointer to the next sibling surface.
|-
|-
| 0x18
| 0x18
| u16
| u16
| 1
| 1
| {{unknown|Unknown}}
| '''Skin Matrix Bank Index'''
| Value varies, but is sometimes 0xFFFF
|  
|-
|-
| 0x1A
| 0x1A
Line 119: Line 119:
| 1
| 1
| '''Visibility Group Index'''
| '''Visibility Group Index'''
| This value will be 0xFF if this surface isn't in a visibility group. (Always 0xFF in MREA.)
|-
|-
| 0x1E
| 0x1E
| u16
| u8
| 1
| 1
| '''UV Array Index'''
| '''UV Array Index'''
| If 0, this surface uses the float UVs array; if 1, this surface uses the short UVs array
| If 0, this surface uses the float UVs array; if 1, this surface uses the short UVs array
|-
| 0x1F
| u8
| 1
| '''Extra Data Size'''
| Amount of space taken up by extra data. Always 0 on CMDLs, 0x18 on MREAs.
|-
|-
| 0x20
| 0x20
| colspan=4 {{unknown|End of surface header; primitive data starts}}
| u8
| ''Extra Data Size''
| '''Extra Data'''
| Empty on CMDL; contains a bounding box used for depth sorting on MREA.
|-
| colspan=5 {{unknown|End of surface header; pad to multiple of 32 before primitive data starts}}
|}
|}


Anonymous user