Materials (Metroid Prime 3): Difference between revisions
→Material Format
>Aruki |
>Aruki |
||
Line 154: | Line 154: | ||
| - | | - | ||
| Unused | | Unused | ||
|} | |||
==== Vertex Attribute Flags ==== | |||
These flags are generally toggled in pairs, with each pair corresponding to a vertex attribute; if a pair is set, then vertices using this material will have the corresponding attribute. This is vital for reading geometry. Each pair is used to indicate the size of the attribute indices in the geometry data, with 3 meaning a 16-bit index and 2 meaning an 8-bit index. (This isn't actually used, though; the original game data always uses 16-bit indices.) | |||
GX supports up to 8 texture coords per vertex, but the game doesn't seem to allow you to assign more than 7 (though this could do with some double-checking). | |||
These are the possible attributes: | |||
{| class="wikitable" | |||
! Bit pair | |||
! Attribute | |||
|- | |||
| 0x3 | |||
| Position | |||
|- | |||
| 0xC | |||
| Normal | |||
|- | |||
| 0x30 | |||
| Color 0 | |||
|- | |||
| 0xC0 | |||
| Color 1 | |||
|- | |||
| 0x300 | |||
| Tex 0 | |||
|- | |||
| 0xC00 | |||
| Tex 1 | |||
|- | |||
| 0x3000 | |||
| Tex 2 | |||
|- | |||
| 0xC000 | |||
| Tex 3 | |||
|- | |||
| 0x30000 | |||
| Tex 4 | |||
|- | |||
| 0xC0000 | |||
| Tex 5 | |||
|- | |||
| 0x300000 | |||
| Tex 6 | |||
|} | |||
The top byte is structured differently; unlike the other flags, the bits in the top byte Are not set in pairs. Each individual bit indicates the presence of a different attribute. The indices in the geometry data are always 8 bits. | |||
{| class="wikitable" | |||
! Bit | |||
! Attribute | |||
|- | |||
| 0x1 | |||
| Position Matrix Index | |||
|- | |||
| 0x2 | |||
| Tex0 Matrix Index | |||
|- | |||
| 0x4 | |||
| Tex1 Matrix Index | |||
|- | |||
| 0x8 | |||
| Tex2 Matrix Index | |||
|- | |||
| 0x10 | |||
| Tex3 Matrix Index | |||
|- | |||
| 0x20 | |||
| Tex4 Matrix Index | |||
|- | |||
| 0x40 | |||
| Tex5 Matrix Index | |||
|- | |||
| 0x80 | |||
| Tex6 Matrix Index | |||
|} | |} | ||