some tweaking
[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 /*u32 daynight_cache_ratios[DAYNIGHT_CACHE_COUNT] =
23 {
24         1000,
25         600,
26         300
27 };*/
28
29 u8 light_decode_table[LIGHT_MAX+1] = 
30 {
31 0,
32 7,
33 11,
34 15,
35 21,
36 29,
37 42,
38 53,
39 69,
40 85,
41 109,
42 135,
43 167,
44 205,
45 255,
46 };
47 /*u8 light_decode_table[LIGHT_MAX+1] = 
48 {
49 0,
50 6,
51 8,
52 11,
53 14,
54 19,
55 26,
56 34,
57 45,
58 61,
59 81,
60 108,
61 143,
62 191,
63 255,
64 };*/
65 /*u8 light_decode_table[LIGHT_MAX+1] = 
66 {
67 0,
68 3,
69 6,
70 10,
71 18,
72 25,
73 35,
74 50,
75 75,
76 95,
77 120,
78 150,
79 185,
80 215,
81 255,
82 };*/
83 /*u8 light_decode_table[LIGHT_MAX+1] = 
84 {
85 0,
86 5,
87 12,
88 22,
89 35,
90 50,
91 65,
92 85,
93 100,
94 120,
95 140,
96 160,
97 185,
98 215,
99 255,
100 };*/
101 // LIGHT_MAX is 14, 0-14 is 15 values
102 /*u8 light_decode_table[LIGHT_MAX+1] = 
103 {
104 0,
105 9,
106 12,
107 14,
108 16,
109 20,
110 26,
111 34,
112 45,
113 61,
114 81,
115 108,
116 143,
117 191,
118 255,
119 };*/
120
121 #if 0
122 /*
123 #!/usr/bin/python
124
125 from math import *
126 from sys import stdout
127
128 # We want 0 at light=0 and 255 at light=LIGHT_MAX
129 LIGHT_MAX = 14
130 #FACTOR = 0.69
131 FACTOR = 0.75
132
133 L = []
134 for i in range(1,LIGHT_MAX+1):
135     L.append(int(round(255.0 * FACTOR ** (i-1))))
136 L.append(0)
137
138 L.reverse()
139 for i in L:
140     stdout.write(str(i)+",\n")
141 */
142 u8 light_decode_table[LIGHT_MAX+1] = 
143 {
144 0,
145 6,
146 8,
147 11,
148 14,
149 19,
150 26,
151 34,
152 45,
153 61,
154 81,
155 108,
156 143,
157 191,
158 255,
159 };
160 #endif
161
162