a9fe023ef2f0793f59383653541e34334ce27503
[oweals/minetest.git] / src / light.cpp
1 /*
2 Minetest-c55
3 Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "light.h"
21
22 /*
23
24 #!/usr/bin/python
25
26 from math import *
27 from sys import stdout
28
29 # We want 0 at light=0 and 255 at light=LIGHT_MAX
30 LIGHT_MAX = 15
31
32 L = []
33 for i in range(1,LIGHT_MAX+1):
34     L.append(int(round(255.0 * 0.69 ** (i-1))))
35         L.append(0)
36
37 L.reverse()
38 for i in L:
39         stdout.write(str(i)+",\n")
40
41 */
42
43 /*
44         The first value should be 0, the last value should be 255.
45 */
46 /*u8 light_decode_table[LIGHT_MAX+1] = 
47 {
48 0,
49 2,
50 3,
51 4,
52 6,
53 9,
54 13,
55 19,
56 28,
57 40,
58 58,
59 84,
60 121,
61 176,
62 255,
63 };*/
64
65 /*
66 #!/usr/bin/python
67
68 from math import *
69 from sys import stdout
70
71 # We want 0 at light=0 and 255 at light=LIGHT_MAX
72 LIGHT_MAX = 14
73 #FACTOR = 0.69
74 FACTOR = 0.75
75
76 L = []
77 for i in range(1,LIGHT_MAX+1):
78     L.append(int(round(255.0 * FACTOR ** (i-1))))
79 L.append(0)
80
81 L.reverse()
82 for i in L:
83     stdout.write(str(i)+",\n")
84 */
85 u8 light_decode_table[LIGHT_MAX+1] = 
86 {
87 0,
88 6,
89 8,
90 11,
91 14,
92 19,
93 26,
94 34,
95 45,
96 61,
97 81,
98 108,
99 143,
100 191,
101 255,
102 };
103
104 /*
105 #!/usr/bin/python
106
107 from math import *
108 from sys import stdout
109
110 # We want 0 at light=0 and 255 at light=LIGHT_MAX
111 LIGHT_MAX = 14
112 #FACTOR = 0.69
113 FACTOR = 0.75
114
115 maxlight = 255
116 minlight = 8
117
118 L = []
119 for i in range(1,LIGHT_MAX+1):
120     L.append(minlight+int(round((maxlight-minlight) * FACTOR ** (i-1))))
121     #L.append(int(round(255.0 * FACTOR ** (i-1))))
122 L.append(minlight)
123
124 L.reverse()
125 for i in L:
126     stdout.write(str(i)+",\n")
127 */
128 /*u8 light_decode_table[LIGHT_MAX+1] = 
129 {
130 8,
131 14,
132 16,
133 18,
134 22,
135 27,
136 33,
137 41,
138 52,
139 67,
140 86,
141 112,
142 147,
143 193,
144 255,
145 };*/
146
147