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

◆ update()

void fl::WaveSimulation2D::update ( )

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

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

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