115 {
116
117
118
120
121
124 uint16_t
z = millis32 /
invSpeedZ.as<uint16_t>();
125
126
127
128 uint16_t noise16 =
inoise16(
x << 8,
y << 8,
z << 8);
129
130
131 uint8_t noise_val = noise16 >> 8;
132
133
134
135
136
138
139
140
141 return qsub8(noise_val, subtraction_factor);
142}
UISlider scaleXY("Scale", 8, 1, 100, 1)
UISlider invSpeedZ("Inverse SpeedZ", 20, 1, 100, 1)
LIB8STATIC_ALWAYS_INLINE int8_t abs8(int8_t i)
Take the absolute value of a signed 8-bit uint8_t.
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8(uint8_t i, uint8_t j)
Subtract one byte from another, saturating at 0x00.
uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z, uint32_t t)
16-bit, fixed point implementation of Perlin's noise.