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

◆ geti16()

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

Definition at line 78 of file wave_simulation.cpp.

78 {
79 if (!has(x, y))
80 return 0;
81 i32 sum = 0;
82 u8 mult = MAX(1, mMultiplier);
83 for (u32 j = 0; j < mult; ++j) {
84 for (u32 i = 0; i < mult; ++i) {
85 u32 xx = x * mult + i;
86 u32 yy = y * mult + j;
87 i32 pt = mSim->geti16(xx, yy);
88 if (mUseChangeGrid) {
89 // i32 ch_pt = mChangeGrid[(yy * mMultiplier) + xx];
90 i32 ch_pt = mChangeGrid(xx, yy);
91 if (ch_pt != 0) { // we got a hit.
92 sum += ch_pt;
93 } else {
94 sum += pt;
95 }
96 } else {
97 sum += pt;
98 }
99 }
100 }
101 i16 out = static_cast<i16>(sum / (mult * mult));
102 return out;
103}
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:45
unsigned char u8
Definition int.h:17

References has(), MAX, mChangeGrid, mMultiplier, mSim, mUseChangeGrid, 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: