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

◆ drawImpl()

void fl::FlowFieldFP::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 984 of file flowfield.cpp.hpp.

984 {
985 syncParams();
986
987 s16x16 dt = s16x16(dt_ms * 0.001f);
988 s16x16 t = s16x16(t_ms * 0.001f);
989
990 i32 dt_raw = dt.raw();
991
992 flowPrepare(t);
993 switch (mParams.emitter_mode) {
994 case 0:
996 break;
997 case 1:
999 break;
1000 case 2:
1003 break;
1004 default:
1006 break;
1007 }
1008 flowAdvect(dt_raw);
1009
1010 // Output: convert Q16.16 grids to LED pixels
1011 int w = mState.width;
1012 int h = mState.height;
1013 const i32 *rp = mState.r.data();
1014 const i32 *gp = mState.g.data();
1015 const i32 *bp = mState.b.data();
1016 fl::span<CRGB> out = context.leds;
1017 for (int y = 0; y < h; y++) {
1018 int row_base = y * w;
1019 for (int x = 0; x < w; x++) {
1020 int i = row_base + x;
1021 u16 ledIdx = mXyMap.mapToIndex(static_cast<u16>(x), static_cast<u16>(y));
1022 out[ledIdx].r = q16_to_u8(rp[i]);
1023 out[ledIdx].g = q16_to_u8(gp[i]);
1024 out[ledIdx].b = q16_to_u8(bp[i]);
1025 }
1026 }
1027
1028 if (mParams.show_flow_vectors) {
1029 drawFlowVectors(context.leds);
1030 }
1031}
Params mParams
Definition flowfield.h:286
FlowFieldFPState mState
Definition flowfield.h:400
void emitLissajousLine(s16x16 t) FL_NO_EXCEPT
void syncParams() FL_NO_EXCEPT
static u8 q16_to_u8(i32 v) FL_NO_EXCEPT
void flowPrepare(s16x16 t) FL_NO_EXCEPT
void emitOrbitalDots(s16x16 t) FL_NO_EXCEPT
void drawFlowVectors(fl::span< CRGB > leds) FL_NO_EXCEPT
void flowAdvect(i32 dt_raw) FL_NO_EXCEPT
XYMap mXyMap
Definition fx2d.h:31

References drawFlowVectors(), emitLissajousLine(), emitOrbitalDots(), fl::FL_NO_EXCEPT, flowAdvect(), flowPrepare(), fl::FlowField::mParams, mState, fl::Fx2d::mXyMap, q16_to_u8(), fl::s16x16::raw(), syncParams(), fl::t, fl::x, and fl::y.

+ Here is the call graph for this function: