ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 64 00 00 00 64 08 06 00 00 00 70 e2 95 | .PNG........IHDR...d...d.....p.. |
0020 | 54 00 00 2f 63 49 44 41 54 78 da ec 9b 07 78 54 65 d6 c7 43 32 e9 09 21 90 84 2a e2 5a 68 21 65 | T../cIDATx....xTe..C2..!..*.Zh!e |
0040 | 32 e9 15 52 67 92 49 ef 75 26 bd 77 40 50 9a f4 2a 5d 14 50 01 a5 83 48 11 95 22 4d 45 45 40 b0 | 2..Rg.I.u&.w@P..*].P...H.."MEE@. |
0060 | e0 aa 6b dd b5 ac a2 bb ae eb 16 77 fe df b9 67 6e ee 9d f2 01 61 fd 76 fd 76 1f e6 79 ce 73 df | ..k........w...gn....a.v.v..y.s. |
0080 | fb de 3b 99 99 f3 7b 4f 7d 6f 6c 6e bd 6e bd 6e bd 6e bd 6e bd 6e bd 6e bd 6e bd 6e ea e5 5f 6e | ..;...{O}oln.n.n.n.n.n.n.n.n.._n |
00a0 | 6b 76 1e 58 a1 b0 f1 af b0 b5 b9 f5 fa 37 bf 02 2a ec 48 ec 65 10 e5 76 ce 24 4e d2 75 02 73 eb | kv.X.........7..*.H.e..v.$N.u.s. |
00c0 | f5 6f 78 05 12 08 7f 13 65 fb 96 d8 d9 f9 97 db 45 06 94 db cd 26 99 4a e3 7b 4c ef a7 39 9b 5b | .ox.....e.......E....&.J.{L..9.[ |
00e0 | af 7f 99 55 28 2c ad 64 24 c9 14 52 fa bb fe 65 76 10 84 ee 39 1d a0 53 54 fa 57 d8 79 cb f7 8d | ...U(,.d$..R...ev...9..ST.W.y... |
0100 | bc e5 c6 fe b5 71 c3 6e 00 /*
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.
*/
#pragma once
inline u32 time_to_daynight_ratio(float time_of_day, bool smooth)
{
float t = time_of_day;
if(t < 0)
t += ((int)(-t)/24000)*24000;
if(t >= 24000)
t -= ((int)(t)/24000)*24000;
if(t > 12000)
t = 24000 - t;
float values[][2] = {
{4250+125, 150},
{4500+125, 150},
{4750+125, 250},
{5000+125, 350},
{5250+125, 500},
{5500+125, 675},
{5750+125, 875},
{6000+125, 1000},
{6250+125, 1000},
};
if(!smooth){
float lastt = values[0][0];
for(u32 i=1; i<sizeof(values)/sizeof(*values); i++){
float t0 = 34 83 4a 5d 18 cc 7f | .t.......hp1.....r..M..G.4.J]... |
0480 | 2e 10 c1 42 a6 c9 40 ac b2 2b eb 2c ca fa dc 0a 98 fd 35 03 7c e2 42 29 a8 5f 8c 9c e0 63 1f 54 | ...B..@..+.,......5.|.B)._...c.T |
04a0 | e8 d4 4a 30 ae 0a 20 82 f5 ce 48 99 e3 6e 68 38 e9 85 89 6f 13 88 4b 3e e8 7c c3 9b a5 eb 0d 01 | ..J0......H..nh8...o..K>.|...... |
04c0 | 8a 0f 3a ce 7b 23 73 a5 07 42 ab 9d 0d ca 52 09 cc 6a ca c0 86 28 8b 9d a4 c2 86 e6 fe 53 83 ba | ..:.{#s..B....R..j...(.......S.. |
04e0 | 25 10 fb 1b 00 60 b9 49 60 72 b2 20 06 75 03 7d f6 d7 ca 42 e7 93 82 42 55 15 ce ec 92 74 fb fa | %....`.I`r...u.}...B...BU....t.. |
0500 | b3 d2 bb 2f f7 80 60 28 46 79 83 e7 78 3c f1 1d 1f 34 9c f0 42 d2 4c 77 84 54 4a 50 be 26 28 4d | .../..`(Fy..x<...4..B.Lw.TJP.&(M |
0520 | 64 1d fd 03 0b ec 6d ff 23 c1 04 ea cc 81 58 07 64 31 06 5c 3b 73 92 03 7f 2f a0 89 16 62 f0 37 | d.....m.#.....X.d1.\;s.../...b.7 |
0540 | 06 75 08 ae 27 ba cd d5 90 bf d1 c3 d0 79 c1 db cc 2a e8 68 2d 0c 48 04 75 d9 08 a6 82 62 4c ec | .u..'........y...*.h-.H.u....bL. |
0560 | 44 57 c1 ba 38 ee 10 90 d7 48 d2 02 4a 9c fb ca 19 9b d3 7f 86 1b 0b b0 02 22 2a 58 0a de 72 dd | DW..8....H..J............"*X..r. |
0580 | a1 ed 11 e9 9a a4 6c 39 c8 5b 88 f5 7b 64 97 a5 aa a6 b9 a5 7d d1 74 da 0b 93 af f4 80 a0 a3 00 | ......l9.[..{d......}.t......... |
05a0 | 83 c5 c7 5a 2e 8a f3 16 6e ac 93 e6 f3 36 f4 33 44 b5 ba 30 64 ff 42 b6 98 27 28 41 08 0b 28 72 | ...Z....n....6.3D..0d.B..'(A..(r |
05c0 | 94 a2 3e c5 aa ff ff 69 af 5f 4f 50 5f 2b 01 31 cf aa 2c 81 c8 d7 64 2b 30 b9 96 66 7e 64 11 b3
float f = (t - values[i-1][0]) / td0;
return f * values[i][1] + (1.0 - f) * values[i-1][1];
}
return 1000;
}
|