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

◆ geti16()

int16_t fl::WaveSimulation2D::geti16 ( size_t x,
size_t y ) const

Definition at line 74 of file wave_simulation.cpp.

74 {
75 if (!has(x, y))
76 return 0;
77 int32_t sum = 0;
78 uint8_t mult = MAX(1, mMultiplier);
79 for (uint32_t j = 0; j < mult; ++j) {
80 for (uint32_t i = 0; i < mult; ++i) {
81 uint32_t xx = x * mult + i;
82 uint32_t yy = y * mult + j;
83 int32_t pt = mSim->geti16(xx, yy);
84 // int32_t ch_pt = mChangeGrid[(yy * mMultiplier) + xx];
85 int32_t ch_pt = mChangeGrid(xx, yy);
86 if (ch_pt != 0) { // we got a hit.
87 sum += ch_pt;
88 } else {
89 sum += pt;
90 }
91 }
92 }
93 int16_t out = static_cast<int16_t>(sum / (mult * mult));
94 return out;
95}
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
bool has(size_t x, size_t y) const
#define MAX(a, b)
Definition math_macros.h:11

References has(), MAX, mChangeGrid, mMultiplier, mSim, x, and y.

Referenced by geti16All(), geti8(), and getu8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: