Definition at line 314 of file flowfield.cpp.hpp.
314 {
318 float fade =
powf(0.5f, dt / halfLife);
319 float shift =
mParams.flow_shift;
320
321
322 for (
int y = 0;
y < h;
y++) {
324 for (
int x = 0;
x < w;
x++) {
325 float sx =
fmodPos((
float)
x - sh, (
float)w);
326 int ix0 = (int)
floorf(sx) % w;
327 int ix1 = (ix0 + 1) % w;
328 float f = sx -
floorf(sx);
329 float inv = 1.0f - f;
330 int src0 =
idx(
y, ix0);
331 int src1 =
idx(
y, ix1);
333 mTR[dst] =
mR[src0] * inv +
mR[src1] * f;
334 mTG[dst] =
mG[src0] * inv +
mG[src1] * f;
335 mTB[dst] =
mB[src0] * inv +
mB[src1] * f;
336 }
337 }
338
339
340 for (
int x = 0;
x < w;
x++) {
342 for (
int y = 0;
y < h;
y++) {
343 float sy =
fmodPos((
float)
y - sh, (
float)h);
344 int iy0 = (int)
floorf(sy) % h;
345 int iy1 = (iy0 + 1) % h;
346 float f = sy -
floorf(sy);
347 float inv = 1.0f - f;
348 int src0 =
idx(iy0,
x);
349 int src1 =
idx(iy1,
x);
354 }
355 }
356}
fl::vector< float > mYProf
Per-row values; drives horizontal shift.
static float fmodPos(float x, float m) FL_NO_EXCEPT
fl::vector< float > mXProf
Per-column values; drives vertical shift.
int idx(int y, int x) const FL_NO_EXCEPT
u16 getWidth() const FL_NO_EXCEPT
u16 getHeight() const FL_NO_EXCEPT
constexpr common_type_t< T, U > max(T a, U b) FL_NO_EXCEPT
FASTLED_FORCE_INLINE float fade(float t) FL_NO_EXCEPT
float powf(float base, float exponent) FL_NO_EXCEPT
float floorf(float value) FL_NO_EXCEPT
References fl::fade(), fl::FL_NO_EXCEPT, fl::floorf(), fmodPos(), fl::Fx2d::getHeight(), fl::Fx2d::getWidth(), idx(), fl::max(), mB, mG, fl::FlowField::mParams, mR, mTB, mTG, mTR, mXProf, mYProf, fl::powf(), fl::x, and fl::y.
Referenced by drawImpl().