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

◆ geti16()

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

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

86 {
87 if (!has(x, y))
88 return 0;
89 i32 sum = 0;
90 u8 mult = fl::max(1, mMultiplier);
91 for (u32 j = 0; j < mult; ++j) {
92 for (u32 i = 0; i < mult; ++i) {
93 u32 xx = x * mult + i;
94 u32 yy = y * mult + j;
95 i32 pt = mSim->geti16(xx, yy);
96 if (mUseChangeGrid) {
97 // i32 ch_pt = mChangeGrid[(yy * mMultiplier) + xx];
98 i32 ch_pt = mChangeGrid(xx, yy);
99 if (ch_pt != 0) { // we got a hit.
100 sum += ch_pt;
101 } else {
102 sum += pt;
103 }
104 } else {
105 sum += pt;
106 }
107 }
108 }
109 i16 out = static_cast<i16>(sum / (mult * mult));
110 return out;
111}
fl::Grid< i16 > mChangeGrid
bool has(fl::size x, fl::size y) const
fl::unique_ptr< WaveSimulation2D_Real > mSim
unsigned char u8
Definition stdint.h:131
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
Definition math.h:75

References has(), fl::max(), mChangeGrid, mMultiplier, mSim, mUseChangeGrid, fl::x, and fl::y.

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

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