Materials (Metroid Prime): Difference between revisions

no edit summary
>Aruki
(saving work so far. Just need to do material animations next.)
 
>Aruki
No edit summary
Line 577: Line 577:


=== Material Animations ===
=== Material Animations ===
The material animations section immediately follows the texgen flags. It starts with this short header:
{| class="wikitable"
! Offset
! Size
! Description
|-
| 0x0
| 4
| '''Material animations section size''' (includes animation count, so will be 4 at minimum)
|-
| 0x4
| 4
| '''Animation count'''
|}
The structure of the animations themselves is somewhat simple. Each animation has a 32-bit ''mode'' setting, followed by a number of float parameters. The number and usage of these float parameters varies depending on what mode is set. There are 7 possible modes, but only 2-5 are known.
For all of the following modes, let ''s'' be equal to ''seconds mod 900''.
==== Mode 2: UV Offset ====
This mode is used to scroll both U and V at the same time. It has four float parameters: ''offsetA'', ''offsetB'', ''scaleA'', and ''scaleB''.
<pre>uOffset = (s * scaleA) + offsetA;
vOffset = (s * scaleB) + offsetB;</pre>
==== Mode 3: Rotation ====
This mode rotates the material. It has two float parameters: ''offset'' and ''scale''.
<pre>angle = (s * scale) + offset;</pre>
The material is then rotated by ''angle'' degrees.
==== Mode 4/5: U/V Offset ====
This mode can be used to scroll U and V independently from each other. It has four float parameters. The offset calculation for these modes is unknown; however, the same code is used for both modes, with the only difference being whether the calculated offset is applied to U or V.


[[Category:File Formats]]
[[Category:File Formats]]
[[Category:Metroid Prime]]
[[Category:Metroid Prime]]
[[Category:Metroid Prime 2: Echoes]]
[[Category:Metroid Prime 2: Echoes]]
Anonymous user