Water.extm: Difference between revisions

Fixed some typos and added water material map image.
imported>Zephenryus
(Added file specification for water.extm files)
 
imported>Zephenryus
(Fixed some typos and added water material map image.)
Line 1: Line 1:
<onlyinclude>
<onlyinclude>
[[File:5000000000.water.extm.png|alt=Generated water material map of Hyrule Main Field|thumb|Generated water material map of Hyrule Main Field]]
<code>water.extm</code> files describe the water heightmap and the texture of the main field and add-on content field.
<code>water.extm</code> files describe the water heightmap and the texture of the main field and add-on content field.
</onlyinclude>
</onlyinclude>
== water.extm File Specification ==
== water.extm File Specification ==


Line 46: Line 48:
<code>height</code> and <code>flowSpeed</code> are stored as unsigned shorts, but seem to map to float values. These can be calculated by dividing by the max size of an unsigned short:
<code>height</code> and <code>flowSpeed</code> are stored as unsigned shorts, but seem to map to float values. These can be calculated by dividing by the max size of an unsigned short:


<syntaxhighlight lang="c" line='line'>
<syntaxhighlight lang="c" line="line">
32767 / 0xffff = 0.5
32767 / 0xffff = 0.5
</syntaxhighlight>
</syntaxhighlight>


<code>height</code> is furthur multiplied by another constant to get the final height (the constant is unknown at this time, but is close to <code>0x300 / 0xffff</code>).
<code>height</code> is further multiplied by another constant to get the final height (the constant is unknown at this time, but is close to <code>0x300 / 0xffff</code>).


<code>x</code> and <code>z</code><ref><code>z</code> is expected to be an integer quotient. The <code>floor</code> function can be used if integer division is not supported.</ref> can be calculated, while iterating through the data table:
<code>x</code> and <code>z</code><ref><code>z</code> is expected to be an integer quotient. The <code>floor</code> function can be used if integer division is not supported.</ref> can be calculated, while iterating through the data table:


<syntaxhighlight lang="c" line='line'>
<syntaxhighlight lang="c" line="line">
for (int index = 0; index < 256 * 256; index++) {
for (int index = 0; index < 256 * 256; index++) {
     uint x = index % 256;
     uint x = index % 256;
Anonymous user