doc updates; CMake works reasonably well now.
[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 6,
33 8,
34 11,
35 14,
36 19,
37 26,
38 34,
39 45,
40 61,
41 81,
42 108,
43 143,
44 191,
45 255,
46 };
47 /*u8 light_decode_table[LIGHT_MAX+1] = 
48 {
49 0,
50 3,
51 6,
52 10,
53 18,
54 25,
55 35,
56 50,
57 75,
58 95,
59 120,
60 150,
61 185,
62 215,
63 255,
64 };*/
65 /*u8 light_decode_table[LIGHT_MAX+1] = 
66 {
67 0,
68 5,
69 12,
70 22,
71 35,
72 50,
73 65,
74 85,
75 100,
76 120,
77 140,
78 160,
79 185,
80 215,
81 255,
82 };*/
83 // LIGHT_MAX is 14, 0-14 is 15 values
84 /*u8 light_decode_table[LIGHT_MAX+1] = 
85 {
86 0,
87 9,
88 12,
89 14,
90 16,
91 20,
92 26,
93 34,
94 45,
95 61,
96 81,
97 108,
98 143,
99 191,
100 255,
101 };*/
102
103 #if 0
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 L = []
116 for i in range(1,LIGHT_MAX+1):
117     L.append(int(round(255.0 * FACTOR ** (i-1))))
118 L.append(0)
119
120 L.reverse()
121 for i in L:
122     stdout.write(str(i)+",\n")
123 */
124 u8 light_decode_table[LIGHT_MAX+1] = 
125 {
126 0,
127 6,
128 8,
129 11,
130 14,
131 19,
132 26,
133 34,
134 45,
135 61,
136 81,
137 108,
138 143,
139 191,
140 255,
141 };
142 #endif
143
144