FastLED 3.9.15
Loading...
Searching...
No Matches

◆ update()

void fl::WaveSimulation2D::update ( )

Definition at line 198 of file wave_simulation.cpp.

198 {
199 const vec2<int16_t> min_max = mChangeGrid.minMax();
200 const bool has_updates = min_max != vec2<int16_t>(0, 0);
201 for (uint8_t i = 0; i < mExtraFrames + 1; ++i) {
202 if (has_updates) {
203 // apply them
204 const uint32_t w = mChangeGrid.width();
205 const uint32_t h = mChangeGrid.height();
206 for (uint32_t x = 0; x < w; ++x) {
207 for (uint32_t y = 0; y < h; ++y) {
208 int16_t v16 = mChangeGrid(x, y);
209 if (v16 != 0) {
210 mSim->seti16(x, y, v16);
211 }
212 }
213 }
214 }
215 mSim->update();
216 }
217 // zero out mChangeGrid
218 mChangeGrid.clear();
219}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:82
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:83
fl::Grid< int16_t > mChangeGrid
fl::scoped_ptr< WaveSimulation2D_Real > mSim

References mChangeGrid, mExtraFrames, mSim, x, and y.