MCPcopy Create free account
hub / github.com/FastLED/FastLED / drawImpl

Method drawImpl

src/fl/fx/2d/flowfield.cpp.hpp:434–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434void FlowFieldFloat::drawImpl(DrawContext context, u32 dt_ms, u32 t_ms) {
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:
441 emitLissajousLine(t);
442 break;
443 case 1:
444 emitOrbitalDots(t);
445 break;
446 case 2:
447 emitLissajousLine(t);
448 emitOrbitalDots(t);
449 break;
450 default:
451 emitLissajousLine(t);
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}
472
473} // namespace fl
474

Callers

nothing calls this directly

Calls 4

s16x16Class · 0.50
mapToIndexMethod · 0.45
dataMethod · 0.45
rawMethod · 0.45

Tested by

no test coverage detected