aboutsummaryrefslogtreecommitdiff
path: root/advtrains/textures/advtrains_signal_off.png
blob: 8046e524f1e51daac2018d9232139a4956a04b49 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 04 00 00 00 04 00 08 06 00 00 00 7f 1d 2b .PNG........IHDR...............+
0020 83 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 13 00 .....bKGD..............pHYs.....
0040 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 e0 09 0d 0e 33 01 ac 18 73 22 00 00 16 87 49 ............tIME.....3...s"....I
0060 44 41 54 78 da ed dc c1 4d c3 40 10 86 51 40 5b 80 2b 98 42 9c 74 b0 94 4b 5c 82 0b 99 0a dc 01 DATx....M.@..Q@[.+.B.t..K\......
0080 dc 22 24 4e 48 1b 18 67 df ab c0 fa 0f 7b f8 34 f2 6b ef fd f3 05 00 00 00 78 6a 6f 26 00 00 00 ."$NH..g.....{.4.k.......xjo&...
00a0 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 ................................
00c0 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 ............@..........@........
00e0 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 ..@..........@..................
0100 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 ................................
0120 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 .........@..........@..........@
0140 00 00 00 00 00 c6 68 26 00 aa c9 4c 23 c0 83 44 84 11 00 60 52 2e 00 00 00 00 40 00 00 00 00 00 ......h&...L#..D...`R.....@.....
0160 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 .....@..........@..........@....
0180 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 ................................
01a0 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 .......................@........
01c0 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 c0 ..@..........@..........@.......
01e0 04 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 ................................
0200 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 ................................
0220 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 ................................
0240 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 ................................
0260 00 00 20 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 9c 40 33 01 00 00 c0 58 .........................@3....X
0280 99 69 04 ee 22 a2 c4 77 b8 00 00 00 00 80 09 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 .i.."..w........................
02a0 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 ................................
02c0 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 ................................
02e0 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 ................................
0300 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 60 02 00 00 00 78 7e .........................`....x~
0320 cd 04 00 00 30 de c7 ed 66 84 82 de 7b 37 02 d3 72 01 00 00 00 00 02 00 00 00 00 20 00 00 00 00 ....0...f...{7..r...............
0340 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 ................................
0360 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 ................................
0380 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 ................................
03a0 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 26 00 00 00 00 ...........................&....
03c0 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 ................................
03e0 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 ...........@..........@.........
0400 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 .@..........@...................
0420 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 ................................
0440 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 ........@..........@..........@.
0460 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 .........@......................
0480 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 ................................
04a0 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 .....@..........@..........@....
04c0 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 ......@.........................
04e0 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 ................................
0500 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 ..@..........@..........@.......
0520 00 00 00 e0 87 66 02 00 60 b4 e3 38 8c 00 4c f9 3e 2d cb 62 64 ca 72 01 00 00 00 00 13 70 01 00 .....f..`..8..L.>-.bd.r......p..
0540 00 00 0f 70 bd 5c 8c 00 94 e2 02 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 ...p.\..............@..........@
0560 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 00 00 ..........@..........@..........
0580 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 ................................
05a0 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 ......@..........@..........@...
05c0 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 4c 00 00 00 00 02 00 00 00 00 20 00 .......@............L...........
05e0 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 ................................
0600 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 ................................
0620 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 ................................
0640 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 ................................
0660 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 ................................
0680 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 ................................
06a0 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 ................................
06c0 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 ................................
06e0 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 ................................
0700 20 00 00 00 00 00 43 34 13 00 d5 44 84 11 00 00 60 30 17 00 00 00 00 20 00 00 00 00 00 02 00 00 ......C4...D....`0..............
0720 00 00 70 0a fe 01 00 9c ce ba ae 46 80 e2 b6 6d 33 02 00 14 e3 02 00 00 00 00 04 00 00 00 00 40 ..p........F...m3..............@
0740 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 ..........@..........@..........
0760 40 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 @...............................
0780 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 .................@..........@...
07a0 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 4c .......@..........@............L
07c0 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 ................................
07e0 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 ................................
0800 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 ................................
0820 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 ................................
0840 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 ................................
0860 00 00 c0 9f 68 26 00 00 00 18 2b 22 8c 40 39 2e 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 ....h&....+".@9.....@..........@
0880 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 ..........@..........@..........
08a0 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 ................................
08c0 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 .................@..........@...
08e0 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 c0 04 00 00 00 20 00 .......@..........@.............
0900 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 ................................
0920 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 ................................
0940 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 ................................
0960 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 ................................
0980 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 ................................
09a0 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 ................................
09c0 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 ................................
09e0 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 ................................
0a00 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 ................................
0a20 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 00 00 00 ................................
0a40 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 ................................
0a60 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 ................................
0a80 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 ................................
0aa0 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 ................................
0ac0 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 ................................
0ae0 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 ................................
0b00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 ................................
0b20 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 ................................
0b40 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 ................................
0b60 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 ................................
0b80 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 ................................
0ba0 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 ................................
0bc0 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 ................................
0be0 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 ................................
0c00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 ................................
0c20 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 ................................
0c40 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 ................................
0c60 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 ................................
0c80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 ................................
0ca0 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 ................................
0cc0 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 ................................
0ce0 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 ................................
0d00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 ................................
0d20 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 ................................
0d40 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 ................................
0d60 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 ................................
0d80 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 ................................
0da0 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 ................................
0dc0 00 00 20 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 ................................
0de0 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 02 00 00 00 00 20 00 ................................
0e00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 ................................
0e20 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 ................................
0e40 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 ................................
0e60 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 26 00 ..............................&.
0e80 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 ................................
0ea0 00 00 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 ..............@..........@......
0ec0 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 ....@..........@................
0ee0 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 ................................
0f00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 ...........@..........@.........
0f20 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 .@..........@...................
0f40 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 ................................
0f60 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 ........@..........@..........@.
0f80 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 .........@......................
0fa0 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 ................................
0fc0 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 .....@..........@..........@....
0fe0 00 04 00 00 00 00 40 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 ......@.........................
1000 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 .......................@........
1020 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 ..@..........@..........@.......
1040 00 00 00 40 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 ...@............................
1060 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 ....................@..........@
1080 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 ..........@..........@..........
10a0 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 ................................
10c0 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 .................@..........@...
10e0 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 .......@..........@.............
1100 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 ................................
1120 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 ..............@..........@......
1140 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 ....@..........@................
1160 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 ................................
1180 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 fe 45 33 01 ...........@..........@......E3.
11a0 00 00 00 95 65 a6 11 06 70 01 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 ....e...p.......................
11c0 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 80 00 00 00 00 00 08 ................................
11e0 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 08 00 00 00 00 80 00 00 00 00 00 ................................
1200 08 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 20 00 00 00 00 ................................
1220 00 02 00 00 00 00 20 00 00 00 00 00 02 00 00 00 00 08 00 26 00 00 00 00 01 00 00 00 00 10 00 00 ...................&............
1240 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 ................................
1260 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 ...@..........@..........@......
1280 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 ....@...........................
12a0 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 ................................
12c0 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 @..........@..........@.........
12e0 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 .@..............................
1300 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 .............................@..
1320 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 ........@..........@..........@.
1340 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 ................................
1360 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 ..........................@.....
1380 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 .....@..........@..........@....
13a0 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 ................................
13c0 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 ............@..........@........
13e0 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 01 00 ..@..........@..........@.......
1400 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 ................................
1420 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 .........@..........@..........@
1440 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 ..........@.....................
1460 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 ................................
1480 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 ......@..........@..........@...
14a0 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 .......@........................
14c0 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 ................................
14e0 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 ...@..........@..........@......
1500 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 ....@...........................
1520 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 ................................
1540 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 @..........@..........@.........
1560 00 40 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 .@..............................
1580 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 04 00 00 00 00 40 00 00 .............................@..
15a0 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 ........@..........@..........@.
15c0 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 ................................
15e0 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 ...............@..........@.....
1600 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 .....@..........@..........@....
1620 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 ................................
1640 00 00 01 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 ............@..........@........
1660 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 10 00 00 00 00 00 01 00 ..@..........@..................
1680 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 00 00 00 00 10 00 00 00 00 00 01 ................................
16a0 00 00 00 00 10 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 04 00 00 00 00 40 .........@..........@..........@
16c0 00 00 00 00 00 04 00 00 00 00 40 00 00 00 00 00 be 69 26 00 ce 66 df 77 23 00 00 c0 2f b9 00 00 ..........@......i&..f.w#.../...
16e0 00 00 80 09 7c 01 4a ff 21 f2 22 67 5a 66 00 00 00 00 49 45 4e 44 ae 42 60 82 ....|.J.!."gZf....IEND.B`.
n1167'>1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "content_mapblock.h"

#include "main.h" // For g_settings
#include "mapblock_mesh.h" // For MapBlock_LightColor() and MeshCollector
#include "settings.h"
#include "nodedef.h"
#include "tile.h"
#include "gamedef.h"
#include "util/numeric.h"
#include "util/directiontables.h"

// Create a cuboid.
//  collector - the MeshCollector for the resulting polygons
//  box       - the position and size of the box
//  tiles     - the tiles (materials) to use (for all 6 faces)
//  tilecount - number of entries in tiles, 1<=tilecount<=6
//  c         - vertex colour - used for all
//  txc       - texture coordinates - this is a list of texture coordinates
//              for the opposite corners of each face - therefore, there
//              should be (2+2)*6=24 values in the list. Alternatively, pass
//              NULL to use the entire texture for each face. The order of
//              the faces in the list is up-down-right-left-back-front
//              (compatible with ContentFeatures). If you specified 0,0,1,1
//              for each face, that would be the same as passing NULL.
void makeCuboid(MeshCollector *collector, const aabb3f &box,
	TileSpec *tiles, int tilecount,
	video::SColor &c, const f32* txc)
{
	assert(tilecount >= 1 && tilecount <= 6);

	v3f min = box.MinEdge;
	v3f max = box.MaxEdge;
 
 
 
	if(txc == NULL)
	{
		static const f32 txc_default[24] = {
			0,0,1,1,
			0,0,1,1,
			0,0,1,1,
			0,0,1,1,
			0,0,1,1,
			0,0,1,1
		};
		txc = txc_default;
	}

	video::S3DVertex vertices[24] =
	{
		// up
		video::S3DVertex(min.X,max.Y,max.Z, 0,1,0, c, txc[0],txc[1]),
		video::S3DVertex(max.X,max.Y,max.Z, 0,1,0, c, txc[2],txc[1]),
		video::S3DVertex(max.X,max.Y,min.Z, 0,1,0, c, txc[2],txc[3]),
		video::S3DVertex(min.X,max.Y,min.Z, 0,1,0, c, txc[0],txc[3]),
		// down
		video::S3DVertex(min.X,min.Y,min.Z, 0,-1,0, c, txc[4],txc[5]),
		video::S3DVertex(max.X,min.Y,min.Z, 0,-1,0, c, txc[6],txc[5]),
		video::S3DVertex(max.X,min.Y,max.Z, 0,-1,0, c, txc[6],txc[7]),
		video::S3DVertex(min.X,min.Y,max.Z, 0,-1,0, c, txc[4],txc[7]),
		// right
		video::S3DVertex(max.X,max.Y,min.Z, 1,0,0, c, txc[ 8],txc[9]),
		video::S3DVertex(max.X,max.Y,max.Z, 1,0,0, c, txc[10],txc[9]),
		video::S3DVertex(max.X,min.Y,max.Z, 1,0,0, c, txc[10],txc[11]),
		video::S3DVertex(max.X,min.Y,min.Z, 1,0,0, c, txc[ 8],txc[11]),
		// left
		video::S3DVertex(min.X,max.Y,max.Z, -1,0,0, c, txc[12],txc[13]),
		video::S3DVertex(min.X,max.Y,min.Z, -1,0,0, c, txc[14],txc[13]),
		video::S3DVertex(min.X,min.Y,min.Z, -1,0,0, c, txc[14],txc[15]),
		video::S3DVertex(min.X,min.Y,max.Z, -1,0,0, c, txc[12],txc[15]),
		// back
		video::S3DVertex(max.X,max.Y,max.Z, 0,0,1, c, txc[16],txc[17]),
		video::S3DVertex(min.X,max.Y,max.Z, 0,0,1, c, txc[18],txc[17]),
		video::S3DVertex(min.X,min.Y,max.Z, 0,0,1, c, txc[18],txc[19]),
		video::S3DVertex(max.X,min.Y,max.Z, 0,0,1, c, txc[16],txc[19]),
		// front
		video::S3DVertex(min.X,max.Y,min.Z, 0,0,-1, c, txc[20],txc[21]),
		video::S3DVertex(max.X,max.Y,min.Z, 0,0,-1, c, txc[22],txc[21]),
		video::S3DVertex(max.X,min.Y,min.Z, 0,0,-1, c, txc[22],txc[23]),
		video::S3DVertex(min.X,min.Y,min.Z, 0,0,-1, c, txc[20],txc[23]),
	};

	for(int i = 0; i < tilecount; i++)
				{
				switch (tiles[i].rotation)
				{
				case 0:
					break;
				case 1: //R90
					for (int x = 0; x < 4; x++)
						vertices[i*4+x].TCoords.rotateBy(90,irr::core::vector2df(0, 0));
					break;
				case 2: //R180
					for (int x = 0; x < 4; x++)
						vertices[i*4+x].TCoords.rotateBy(180,irr::core::vector2df(0, 0));
					break;
				case 3: //R270
					for (int x = 0; x < 4; x++)
						vertices[i*4+x].TCoords.rotateBy(270,irr::core::vector2df(0, 0));
					break;
				case 4: //FXR90
					for (int x = 0; x < 4; x++){
						vertices[i*4+x].TCoords.X = 1.0 - vertices[i*4+x].TCoords.X;
						vertices[i*4+x].TCoords.rotateBy(90,irr::core::vector2df(0, 0));
					}
					break;
				case 5: //FXR270
					for (int x = 0; x < 4; x++){
						vertices[i*4+x].TCoords.X = 1.0 - vertices[i*4+x].TCoords.X;
						vertices[i*4+x].TCoords.rotateBy(270,irr::core::vector2df(0, 0));
					}
					break;
				case 6: //FYR90
					for (int x = 0; x < 4; x++){
						vertices[i*4+x].TCoords.Y = 1.0 - vertices[i*4+x].TCoords.Y;
						vertices[i*4+x].TCoords.rotateBy(90,irr::core::vector2df(0, 0));
					}
					break;
				case 7: //FYR270
					for (int x = 0; x < 4; x++){
						vertices[i*4+x].TCoords.Y = 1.0 - vertices[i*4+x].TCoords.Y;
						vertices[i*4+x].TCoords.rotateBy(270,irr::core::vector2df(0, 0));
					}
					break;
				case 8: //FX
					for (int x = 0; x < 4; x++){
						vertices[i*4+x].TCoords.X = 1.0 - vertices[i*4+x].TCoords.X;
					}
					break;
				case 9: //FY
					for (int x = 0; x < 4; x++){
						vertices[i*4+x].TCoords.Y = 1.0 - vertices[i*4+x].TCoords.Y;
					}
					break;
				default:
					break;
				}
			}
	u16 indices[] = {0,1,2,2,3,0};
	// Add to mesh collector
	for(s32 j=0; j<24; j+=4)
	{
		int tileindex = MYMIN(j/4, tilecount-1);
		collector->append(tiles[tileindex],
				vertices+j, 4, indices, 6);
	}
}

void mapblock_mesh_generate_special(MeshMakeData *data,
		MeshCollector &collector)
{
	INodeDefManager *nodedef = data->m_gamedef->ndef();

	// 0ms
	//TimeTaker timer("mapblock_mesh_generate_special()");

	/*
		Some settings
	*/
	bool new_style_water = g_settings->getBool("new_style_water");
	
	float node_liquid_level = 1.0;
	if(new_style_water)
		node_liquid_level = 0.85;
	
	v3s16 blockpos_nodes = data->m_blockpos*MAP_BLOCKSIZE;

	for(s16 z=0; z<MAP_BLOCKSIZE; z++)
	for(s16 y=0; y<MAP_BLOCKSIZE; y++)
	for(s16 x=0; x<MAP_BLOCKSIZE; x++)
	{
		v3s16 p(x,y,z);

		MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes+p);
		const ContentFeatures &f = nodedef->get(n);

		// Only solidness=0 stuff is drawn here
		if(f.solidness != 0)
			continue;
		
		switch(f.drawtype){
		default:
			infostream<<"Got "<<f.drawtype<<std::endl;
			assert(0);
			break;
		case NDT_AIRLIKE:
			break;
		case NDT_LIQUID:
		{
			/*
				Add water sources to mesh if using new style
			*/
			TileSpec tile_liquid = f.special_tiles[0];
			TileSpec tile_liquid_bfculled = getNodeTile(n, p, v3s16(0,0,0), data);

			bool top_is_same_liquid = false;
			MapNode ntop = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y+1,z));
			content_t c_flowing = nodedef->getId(f.liquid_alternative_flowing);
			content_t c_source = nodedef->getId(f.liquid_alternative_source);
			if(ntop.getContent() == c_flowing || ntop.getContent() == c_source)
				top_is_same_liquid = true;

			u16 l = getInteriorLight(n, 0, data);
			video::SColor c = MapBlock_LightColor(f.alpha, l, decode_light(f.light_source));

			/*
				Generate sides
			 */
			v3s16 side_dirs[4] = {
				v3s16(1,0,0),
				v3s16(-1,0,0),
				v3s16(0,0,1),
				v3s16(0,0,-1),
			};
			for(u32 i=0; i<4; i++)
			{
				v3s16 dir = side_dirs[i];

				MapNode neighbor = data->m_vmanip.getNodeNoEx(blockpos_nodes + p + dir);
				content_t neighbor_content = neighbor.getContent();
				const ContentFeatures &n_feat = nodedef->get(neighbor_content);
				MapNode n_top = data->m_vmanip.getNodeNoEx(blockpos_nodes + p + dir+ v3s16(0,1,0));
				content_t n_top_c = n_top.getContent();

				if(neighbor_content == CONTENT_IGNORE)
					continue;

				/*
					If our topside is liquid and neighbor's topside
					is liquid, don't draw side face
				*/
				if(top_is_same_liquid && (n_top_c == c_flowing ||
						n_top_c == c_source || n_top_c == CONTENT_IGNORE))
					continue;

				// Don't draw face if neighbor is blocking the view
				if(n_feat.solidness == 2)
					continue;

				bool neighbor_is_same_liquid = (neighbor_content == c_source
						|| neighbor_content == c_flowing);

				// Don't draw any faces if neighbor same is liquid and top is
				// same liquid
				if(neighbor_is_same_liquid && !top_is_same_liquid)
					continue;

				// Use backface culled material if neighbor doesn't have a
				// solidness of 0
				const TileSpec *current_tile = &tile_liquid;
				if(n_feat.solidness != 0 || n_feat.visual_solidness != 0)
					current_tile = &tile_liquid_bfculled;

				video::S3DVertex vertices[4] =
				{
					video::S3DVertex(-BS/2,0,BS/2,0,0,0, c, 0,1),
					video::S3DVertex(BS/2,0,BS/2,0,0,0, c, 1,1),
					video::S3DVertex(BS/2,0,BS/2, 0,0,0, c, 1,0),
					video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c, 0,0),
				};

				/*
					If our topside is liquid, set upper border of face
					at upper border of node
				*/
				if(top_is_same_liquid)
				{
					vertices[2].Pos.Y = 0.5*BS;
					vertices[3].Pos.Y = 0.5*BS;
				}
				/*
					Otherwise upper position of face is liquid level
				*/
				else
				{
					vertices[2].Pos.Y = (node_liquid_level-0.5)*BS;
					vertices[3].Pos.Y = (node_liquid_level-0.5)*BS;
				}
				/*
					If neighbor is liquid, lower border of face is liquid level
				*/
				if(neighbor_is_same_liquid)
				{
					vertices[0].Pos.Y = (node_liquid_level-0.5)*BS;
					vertices[1].Pos.Y = (node_liquid_level-0.5)*BS;
				}
				/*
					If neighbor is not liquid, lower border of face is
					lower border of node
				*/
				else
				{
					vertices[0].Pos.Y = -0.5*BS;
					vertices[1].Pos.Y = -0.5*BS;
				}

				for(s32 j=0; j<4; j++)
				{
					if(dir == v3s16(0,0,1))
						vertices[j].Pos.rotateXZBy(0);
					if(dir == v3s16(0,0,-1))
						vertices[j].Pos.rotateXZBy(180);
					if(dir == v3s16(-1,0,0))
						vertices[j].Pos.rotateXZBy(90);
					if(dir == v3s16(1,0,-0))
						vertices[j].Pos.rotateXZBy(-90);

					// Do this to not cause glitches when two liquids are
					// side-by-side
					/*if(neighbor_is_same_liquid == false){
						vertices[j].Pos.X *= 0.98;
						vertices[j].Pos.Z *= 0.98;
					}*/

					vertices[j].Pos += intToFloat(p, BS);
				}

				u16 indices[] = {0,1,2,2,3,0};
				// Add to mesh collector
				collector.append(*current_tile, vertices, 4, indices, 6);
			}

			/*
				Generate top
			 */
			if(top_is_same_liquid)
				continue;
			
			video::S3DVertex vertices[4] =
			{
				video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c, 0,1),
				video::S3DVertex(BS/2,0,BS/2, 0,0,0, c, 1,1),
				video::S3DVertex(BS/2,0,-BS/2, 0,0,0, c, 1,0),
				video::S3DVertex(-BS/2,0,-BS/2, 0,0,0, c, 0,0),
			};

			v3f offset(p.X*BS, p.Y*BS + (-0.5+node_liquid_level)*BS, p.Z*BS);
			for(s32 i=0; i<4; i++)
			{
				vertices[i].Pos += offset;
			}

			u16 indices[] = {0,1,2,2,3,0};
			// Add to mesh collector
			collector.append(tile_liquid, vertices, 4, indices, 6);
		break;}
		case NDT_FLOWINGLIQUID:
		{
			/*
				Add flowing liquid to mesh
			*/
			TileSpec tile_liquid = f.special_tiles[0];
			TileSpec tile_liquid_bfculled = f.special_tiles[1];

			bool top_is_same_liquid = false;
			MapNode ntop = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y+1,z));
			content_t c_flowing = nodedef->getId(f.liquid_alternative_flowing);
			content_t c_source = nodedef->getId(f.liquid_alternative_source);
			if(ntop.getContent() == c_flowing || ntop.getContent() == c_source)
				top_is_same_liquid = true;
			
			u16 l = 0;
			// If this liquid emits light and doesn't contain light, draw
			// it at what it emits, for an increased effect
			u8 light_source = nodedef->get(n).light_source;
			if(light_source != 0){
				//l = decode_light(undiminish_light(light_source));
				l = decode_light(light_source);
				l = l | (l<<8);
			}
			// Use the light of the node on top if possible
			else if(nodedef->get(ntop).param_type == CPT_LIGHT)
				l = getInteriorLight(ntop, 0, data);
			// Otherwise use the light of this node (the liquid)
			else
				l = getInteriorLight(n, 0, data);
			video::SColor c = MapBlock_LightColor(f.alpha, l, decode_light(f.light_source));
			
			u8 range = rangelim(nodedef->get(c_flowing).liquid_range, 0, 8);

			// Neighbor liquid levels (key = relative position)
			// Includes current node
			std::map<v3s16, f32> neighbor_levels;
			std::map<v3s16, content_t> neighbor_contents;
			std::map<v3s16, u8> neighbor_flags;
			const u8 neighborflag_top_is_same_liquid = 0x01;
			v3s16 neighbor_dirs[9] = {
				v3s16(0,0,0),
				v3s16(0,0,1),
				v3s16(0,0,-1),
				v3s16(1,0,0),
				v3s16(-1,0,0),
				v3s16(1,0,1),
				v3s16(-1,0,-1),
				v3s16(1,0,-1),
				v3s16(-1,0,1),
			};
			for(u32 i=0; i<9; i++)
			{
				content_t content = CONTENT_AIR;
				float level = -0.5 * BS;
				u8 flags = 0;
				// Check neighbor
				v3s16 p2 = p + neighbor_dirs[i];
				MapNode n2 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p2);
				if(n2.getContent() != CONTENT_IGNORE)
				{
					content = n2.getContent();

					if(n2.getContent() == c_source)
						level = (-0.5+node_liquid_level) * BS;
					else if(n2.getContent() == c_flowing){
						u8 liquid_level = (n2.param2&LIQUID_LEVEL_MASK) - (LIQUID_LEVEL_MAX+1-range);
						level = (-0.5 + ((float)liquid_level+ 0.5) / (float)range * node_liquid_level) * BS;
					}

					// Check node above neighbor.
					// NOTE: This doesn't get executed if neighbor
					//       doesn't exist
					p2.Y += 1;
					n2 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p2);
					if(n2.getContent() == c_source ||
							n2.getContent() == c_flowing)
						flags |= neighborflag_top_is_same_liquid;
				}
				
				neighbor_levels[neighbor_dirs[i]] = level;
				neighbor_contents[neighbor_dirs[i]] = content;
				neighbor_flags[neighbor_dirs[i]] = flags;
			}

			// Corner heights (average between four liquids)
			f32 corner_levels[4];
			
			v3s16 halfdirs[4] = {
				v3s16(0,0,0),
				v3s16(1,0,0),
				v3s16(1,0,1),
				v3s16(0,0,1),
			};
			for(u32 i=0; i<4; i++)
			{
				v3s16 cornerdir = halfdirs[i];
				float cornerlevel = 0;
				u32 valid_count = 0;
				u32 air_count = 0;
				for(u32 j=0; j<4; j++)
				{
					v3s16 neighbordir = cornerdir - halfdirs[j];
					content_t content = neighbor_contents[neighbordir];
					// If top is liquid, draw starting from top of node
					if(neighbor_flags[neighbordir] &
							neighborflag_top_is_same_liquid)
					{
						cornerlevel = 0.5*BS;
						valid_count = 1;
						break;
					}
					// Source is always the same height
					else if(content == c_source)
					{
						cornerlevel = (-0.5+node_liquid_level)*BS;
						valid_count = 1;
						break;
					}
					// Flowing liquid has level information
					else if(content == c_flowing)
					{
						cornerlevel += neighbor_levels[neighbordir];
						valid_count++;
					}
					else if(content == CONTENT_AIR)
					{
						air_count++;
					}
				}
				if(air_count >= 2)
					cornerlevel = -0.5*BS+0.2;
				else if(valid_count > 0)
					cornerlevel /= valid_count;
				corner_levels[i] = cornerlevel;
			}

			/*
				Generate sides
			*/

			v3s16 side_dirs[4] = {
				v3s16(1,0,0),
				v3s16(-1,0,0),
				v3s16(0,0,1),
				v3s16(0,0,-1),
			};
			s16 side_corners[4][2] = {
				{1, 2},
				{3, 0},
				{2, 3},
				{0, 1},
			};
			for(u32 i=0; i<4; i++)
			{
				v3s16 dir = side_dirs[i];

				/*
					If our topside is liquid and neighbor's topside
					is liquid, don't draw side face
				*/
				if(top_is_same_liquid &&
						neighbor_flags[dir] & neighborflag_top_is_same_liquid)
					continue;

				content_t neighbor_content = neighbor_contents[dir];
				const ContentFeatures &n_feat = nodedef->get(neighbor_content);
				
				// Don't draw face if neighbor is blocking the view
				if(n_feat.solidness == 2)
					continue;
				
				bool neighbor_is_same_liquid = (neighbor_content == c_source
						|| neighbor_content == c_flowing);
				
				// Don't draw any faces if neighbor same is liquid and top is
				// same liquid
				if(neighbor_is_same_liquid == true
						&& top_is_same_liquid == false)
					continue;

				// Use backface culled material if neighbor doesn't have a
				// solidness of 0
				const TileSpec *current_tile = &tile_liquid;
				if(n_feat.solidness != 0 || n_feat.visual_solidness != 0)
					current_tile = &tile_liquid_bfculled;
				
				video::S3DVertex vertices[4] =
				{