FastLED 3.10.8
Loading...
Searching...
No Matches

◆ update()

void fl::WaveSimulation2D::update ( )

Definition at line 220 of file wave_simulation.cpp.hpp.

220 {
221 if (mUseChangeGrid) {
222 const vec2<i16> min_max = mChangeGrid.minMax();
223 const bool has_updates = min_max != vec2<i16>(0, 0);
224 for (u8 i = 0; i < mExtraFrames + 1; ++i) {
225 if (has_updates) {
226 // apply them
227 const u32 w = mChangeGrid.width();
228 const u32 h = mChangeGrid.height();
229 for (u32 x = 0; x < w; ++x) {
230 for (u32 y = 0; y < h; ++y) {
231 i16 v16 = mChangeGrid(x, y);
232 if (v16 != 0) {
233 mSim->seti16(x, y, v16);
234 }
235 }
236 }
237 }
238 mSim->update();
239 }
240 // zero out mChangeGrid
241 mChangeGrid.clear();
242 } else {
243 // When change grid is disabled, just run the simulation updates
244 for (u8 i = 0; i < mExtraFrames + 1; ++i) {
245 mSim->update();
246 }
247 }
248}
fl::Grid< i16 > mChangeGrid
fl::unique_ptr< WaveSimulation2D_Real > mSim
unsigned char u8
Definition stdint.h:131

References fl::FL_NO_EXCEPT, mChangeGrid, mExtraFrames, mSim, mUseChangeGrid, fl::x, and fl::y.