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

◆ update()

void fl::WaveSimulation2D::update ( )

Definition at line 194 of file wave_simulation.cpp.

194 {
195 const vec2<int16_t> min_max = mChangeGrid.minMax();
196 const bool has_updates = min_max != vec2<int16_t>(0, 0);
197 for (uint8_t i = 0; i < mExtraFrames + 1; ++i) {
198 if (has_updates) {
199 // apply them
200 const uint32_t w = mChangeGrid.width();
201 const uint32_t h = mChangeGrid.height();
202 for (uint32_t x = 0; x < w; ++x) {
203 for (uint32_t y = 0; y < h; ++y) {
204 int16_t v16 = mChangeGrid(x, y);
205 if (v16 != 0) {
206 mSim->seti16(x, y, v16);
207 }
208 }
209 }
210 }
211 mSim->update();
212 }
213 // zero out mChangeGrid
214 mChangeGrid.clear();
215}
int y
Definition Audio.ino:72
int x
Definition Audio.ino:71
fl::Grid< int16_t > mChangeGrid
fl::scoped_ptr< WaveSimulation2D_Real > mSim

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