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

◆ update()

void fl::WaveSimulation2D::update ( )

Definition at line 199 of file wave_simulation.cpp.

199 {
200 const vec2<i16> min_max = mChangeGrid.minMax();
201 const bool has_updates = min_max != vec2<i16>(0, 0);
202 for (u8 i = 0; i < mExtraFrames + 1; ++i) {
203 if (has_updates) {
204 // apply them
205 const u32 w = mChangeGrid.width();
206 const u32 h = mChangeGrid.height();
207 for (u32 x = 0; x < w; ++x) {
208 for (u32 y = 0; y < h; ++y) {
209 i16 v16 = mChangeGrid(x, y);
210 if (v16 != 0) {
211 mSim->seti16(x, y, v16);
212 }
213 }
214 }
215 }
216 mSim->update();
217 }
218 // zero out mChangeGrid
219 mChangeGrid.clear();
220}
int y
Definition simple.h:93
int x
Definition simple.h:92
fl::Grid< i16 > mChangeGrid
fl::unique_ptr< WaveSimulation2D_Real > mSim
unsigned char u8
Definition int.h:17

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