FastLED 3.9.15
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 434 of file flowfield.cpp.hpp.

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

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

+ Here is the call graph for this function: