| 19 | } |
| 20 | |
| 21 | void Fx2dTo1d::draw(DrawContext context) { |
| 22 | // Step 1: Render 2D effect to internal grid |
| 23 | DrawContext grid_context(context.now, fl::span<CRGB>(mGrid.get(), mFx2d->getNumLeds())); |
| 24 | mFx2d->draw(grid_context); |
| 25 | |
| 26 | // Step 2: Sample from grid to 1D output using fl::sample |
| 27 | const XYMap &xyMap = mFx2d->getXYMap(); |
| 28 | SampleMode mode = static_cast<SampleMode>(mInterpolationMode); |
| 29 | |
| 30 | for (u16 i = 0; i < mNumLeds; i++) { |
| 31 | vec2f pos = mScreenMap[i]; |
| 32 | context.leds[i] = fl::sample(mGrid.get(), xyMap, pos.x, pos.y, mode); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | fl::string Fx2dTo1d::fxName() const { |
| 37 | return fl::string("Fx2dTo1d(") + mFx2d->fxName() + ")"; |
nothing calls this directly
no test coverage detected