Materials (Metroid Prime): Difference between revisions
Jump to navigation
Jump to search
→Mode 3: Rotation
>Aruki |
>Aruki |
||
Line 630: | Line 630: | ||
This mode rotates the texture. It has two float parameters: ''offset'' and ''scale''. | This mode rotates the texture. It has two float parameters: ''offset'' and ''scale''. | ||
<pre>angle = (s * scale) + offset;</pre> | <pre>float angle = (s * scale) + offset; | ||
float acos = cos(angle); | |||
float asin = sin(angle); | |||
float translateX = (1.0 - (acos - asin)) * 0.5; | |||
float translateY = (1.0 - (asin + acos)) * 0.5;</pre> | |||
The texture is | The resulting texture matrix is laid out as: | ||
<pre>acos, -asin, 0.0, translateX, | |||
asin, acos, 0.0, translateY, | |||
0.0, 0.0, 1.0, 0.0</pre> | |||
==== Mode 4/5: U/V Offset ==== | ==== Mode 4/5: U/V Offset ==== |