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