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

◆ geti16()

i16 fl::WaveSimulation2D::geti16 ( fl::size x,
fl::size y ) const

Definition at line 75 of file wave_simulation.cpp.

75 {
76 if (!has(x, y))
77 return 0;
78 i32 sum = 0;
79 u8 mult = MAX(1, mMultiplier);
80 for (u32 j = 0; j < mult; ++j) {
81 for (u32 i = 0; i < mult; ++i) {
82 u32 xx = x * mult + i;
83 u32 yy = y * mult + j;
84 i32 pt = mSim->geti16(xx, yy);
85 // i32 ch_pt = mChangeGrid[(yy * mMultiplier) + xx];
86 i32 ch_pt = mChangeGrid(xx, yy);
87 if (ch_pt != 0) { // we got a hit.
88 sum += ch_pt;
89 } else {
90 sum += pt;
91 }
92 }
93 }
94 i16 out = static_cast<i16>(sum / (mult * mult));
95 return out;
96}
int y
Definition simple.h:93
int x
Definition simple.h:92
fl::Grid< i16 > mChangeGrid
bool has(fl::size x, fl::size y) const
fl::unique_ptr< WaveSimulation2D_Real > mSim
#define MAX(a, b)
Definition math_macros.h:37
unsigned char u8
Definition int.h:17

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: