142 {
143
144
145
146
147 uint8_t dataSmoothing = 0;
149 dataSmoothing = 200 - (
speed * 4);
150 }
151
152 for (uint16_t i = 0; i <
width; i++) {
153 int ioffset =
scale * i;
154 for (uint16_t j = 0; j <
height; j++) {
155 int joffset =
scale * j;
156
158
159
160
161
162
163 data =
qsub8(data, 16);
165
166 if (dataSmoothing) {
168 uint8_t newdata =
scale8(olddata, dataSmoothing) +
169 scale8(data, 256 - dataSmoothing);
170 data = newdata;
171 }
172
174 }
175 }
176
178
179
182}
fl::scoped_array< uint8_t > noise
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8(uint8_t i, uint8_t j)
Subtract one byte from another, saturating at 0x00.
uint8_t inoise8(uint16_t x, uint16_t y, uint16_t z)
8-Bit, fixed point implementation of Perlin's noise.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...