FastLED 3.10.8
Loading...
Searching...
No Matches

◆ geti16()

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

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

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

References fl::FL_NO_EXCEPT, 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: