FastLED 3.10.6
Loading...
Searching...
No Matches

◆ draw()

void fl::WaveFx::draw ( DrawContext context)
inlineoverridevirtual

Render wave to LED array.

Parameters
contextDraw context containing timestamp and LED buffer

Updates the wave simulation (if auto-update enabled) and maps wave values to LED colors using the current color mapper.

Implements fl::Fx.

Definition at line 370 of file wave.h.

370 {
371 // Update the wave simulation.
372 if (mAutoUpdates) {
373 mWaveSim.update();
374 }
375 // Map the wave values to the LEDs.
376 mCrgbMap->mapWaveToLEDs(mXyMap, mWaveSim, context.leds);
377 // #3122 A4 — post-process output blur as a cheaper alternative
378 // to SuperSample. Skipped entirely when amount == 0.
379 if (mOutputBlurAmount > 0) {
380 const fl::u32 w = mWaveSim.getWidth();
381 const fl::u32 h = mWaveSim.getHeight();
382 for (fl::u8 pass = 0; pass < mOutputBlurPasses; ++pass) {
383 fl::blur2d(context.leds, static_cast<fl::u8>(w),
384 static_cast<fl::u8>(h), mOutputBlurAmount,
385 mXyMap);
386 }
387 }
388 }
XYMap mXyMap
Definition fx2d.h:30
WaveCrgbMapPtr mCrgbMap
Definition wave.h:417
fl::u8 mOutputBlurPasses
Definition wave.h:420
fl::u8 mOutputBlurAmount
Definition wave.h:419
bool mAutoUpdates
Definition wave.h:418
WaveSimulation2D mWaveSim
Definition wave.h:416
unsigned char u8
Definition stdint.h:131
void blur2d(fl::span< CRGB > leds, u8 width, u8 height, fract8 blur_amount, const XYMap &xymap) FL_NO_EXCEPT
Definition blur.h:153

References fl::blur2d(), fl::DrawContext::leds, mAutoUpdates, mCrgbMap, mOutputBlurAmount, mOutputBlurPasses, mWaveSim, and fl::Fx2d::mXyMap.

+ Here is the call graph for this function: