Water.extm: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
imported>Zephenryus
(Added file specification for water.extm files)
 
mNo edit summary
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{lowercase}}
<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 Layout ===
==water.extm File Specification==
 
===water.extm File Layout===


Each file contains a 64×64 grid. For each vertex there is 8 bytes of data that describe the height of the mesh, the material type and flow speed.
Each file contains a 64×64 grid. For each vertex there is 8 bytes of data that describe the height of the mesh, the material type and flow speed.


=== Water Map Data ===
===Water Map Data===


Each entry in the water data table is 8 bytes long.
Each entry in the water data table is 8 bytes long.
Line 26: Line 29:
|2
|2
|Unsigned Short
|Unsigned Short
|<code>xAxisFlowRate</code>
|<code>xAxisFlowRate</code> 128 = no flow
|-
|-
|0x04
|0x04
|2
|2
|Unsigned Short
|Unsigned Short
|<code>zAxisFlowRate</code>
|<code>zAxisFlowRate</code> 128 = no flow
|-
|-
|0x05
|0x05
Line 44: Line 47:
|}
|}


<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>flowRate</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 < 64 * 64; index++) {
     uint x = index % 256;
     uint x = index % 64;
     uint z = index / 256;
     uint z = index / 64;
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 63: Line 66:
Flow Rates are calculated as <code>(flowRate * 2) - 1</code> and ranges from <code>-1</code> to <code>1</code>. On the x-axis this changes flow direction from East (<code>-1</code>) to West (<code>+1</code>) and on the z-axis from North (<code>-1</code>) to South (<code>+1</code>).
Flow Rates are calculated as <code>(flowRate * 2) - 1</code> and ranges from <code>-1</code> to <code>1</code>. On the x-axis this changes flow direction from East (<code>-1</code>) to West (<code>+1</code>) and on the z-axis from North (<code>-1</code>) to South (<code>+1</code>).


=== Material Index ===
===Material Index===


This data is stored in Terrain.Tex1.bfres.
This data is stored in Terrain.Tex1.bfres.
Line 75: Line 78:
!flag
!flag
!Google Translated
!Google Translated
|0  
|-
|Water  
|0
|水  
|Water
|Water  
|水
|Water  
|Water
|0  
|Water
|0
|Water
|Water
|-
|-
|1  
|1
|HotWater  
|HotWater
|熱湯  
|熱湯
|Water  
|Water
|Water_Hot  
|Water_Hot
|0  
|0
|Hot water
|Hot water
|-
|-
|2  
|2
|Poison  
|Poison
|毒水  
|毒水
|Water  
|Water
|Water_Poison  
|Water_Poison
|0  
|0
|Poison water
|Poison water
|-
|-
|3  
|3
|Lava  
|Lava
|溶岩  
|溶岩
|Lava  
|Lava
|Lava  
|Lava
|0  
|0
|Lava
|Lava
|-
|-
|4  
|4
|IceWater  
|IceWater
|冷たい水  
|冷たい水
|Water  
|Water
|Water_Ice  
|Water_Ice
|0  
|0
|Cold water
|Cold water
|-
|-
|5  
|5
|Mud  
|Mud
|泥沼  
|泥沼
|Bog  
|Bog
|Bog  
|Bog
|0  
|0
|Bog
|Bog
|-
|-
|6  
|6
|Clear01  
|Clear01
|透明水01  
|透明水01
|Water  
|Water
|Water  
|Water
|0  
|0
|Clear water 01
|Clear water 01
|-
|-
|7  
|7
|Sea  
|Sea
|海  
|海
|Water  
|Water
|Water  
|Water
|0  
|0
|Ocean
|Ocean
|}
|}
Line 143: Line 147:


[[Category:File formats]]
[[Category:File formats]]
[[Category:File extensions]]
[[Category:File extensions (STERA)]]
7

edits

Navigation menu