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

◆ drawImpl()

void fl::FlowFieldFloat::drawImpl ( DrawContext context,
u32 dt_ms,
u32 t_ms )
overrideprotectedvirtual

Subclasses implement rendering given the time delta and total time.

Parameters
dt_msMilliseconds since last draw (capped to prevent huge jumps).
t_msMilliseconds since first draw.

Implements fl::FlowField.

Definition at line 435 of file flowfield.cpp.hpp.

435 {
436 float dt = dt_ms * 0.001f;
437 float t = t_ms * 0.001f;
438
439 flowPrepare(t);
440 switch (mParams.emitter_mode) {
441 case 0:
443 break;
444 case 1:
446 break;
447 case 2:
450 break;
451 default:
453 break;
454 }
455 flowAdvect(dt);
456
457 int w = (int)getWidth();
458 int h = (int)getHeight();
459 for (int y = 0; y < h; y++) {
460 for (int x = 0; x < w; x++) {
461 int ledIdx = mXyMap.mapToIndex(x, y);
462 int i = idx(y, x);
463 context.leds.data()[ledIdx].r = f2u8(mR[i]);
464 context.leds.data()[ledIdx].g = f2u8(mG[i]);
465 context.leds.data()[ledIdx].b = f2u8(mB[i]);
466 }
467 }
468
469 if (mParams.show_flow_vectors) {
470 drawFlowVectors(context.leds);
471 }
472}
Params mParams
Definition flowfield.h:286
fl::vector< float > mB
Definition flowfield.h:346
fl::vector< float > mG
Definition flowfield.h:346
void flowPrepare(float t) FL_NO_EXCEPT
void emitLissajousLine(float t) FL_NO_EXCEPT
void flowAdvect(float dt) FL_NO_EXCEPT
void drawFlowVectors(fl::span< CRGB > leds) FL_NO_EXCEPT
int idx(int y, int x) const FL_NO_EXCEPT
Definition flowfield.h:323
static u8 f2u8(float v) FL_NO_EXCEPT
void emitOrbitalDots(float t) FL_NO_EXCEPT
fl::vector< float > mR
Definition flowfield.h:346
XYMap mXyMap
Definition fx2d.h:31
u16 getWidth() const FL_NO_EXCEPT
Definition fx2d.h:25
u16 getHeight() const FL_NO_EXCEPT
Definition fx2d.h:24

References drawFlowVectors(), emitLissajousLine(), emitOrbitalDots(), f2u8(), fl::FL_NO_EXCEPT, flowAdvect(), flowPrepare(), fl::Fx2d::getHeight(), fl::Fx2d::getWidth(), idx(), mB, mG, fl::FlowField::mParams, mR, fl::Fx2d::mXyMap, fl::t, fl::x, and fl::y.

+ Here is the call graph for this function: