| 44 | } |
| 45 | |
| 46 | void Luminova::resetParticle(Particle &p, fl::u32 tt) { |
| 47 | // Position at center |
| 48 | const float cx = static_cast<float>(getWidth() - 1) * 0.5f; |
| 49 | const float cy = static_cast<float>(getHeight() - 1) * 0.5f; |
| 50 | p.x = cx; |
| 51 | p.y = cy; |
| 52 | |
| 53 | // Original used noise(I)*W, we approximate with 1D noise scaled to width |
| 54 | int I = static_cast<int>(tt / 50); |
| 55 | u8 n1 = inoise8(static_cast<u16>(I * 19)); |
| 56 | float noiseW = (static_cast<float>(n1) / 255.0f) * static_cast<float>(getWidth()); |
| 57 | |
| 58 | p.a = static_cast<float>(tt) * 1.25f + noiseW; |
| 59 | p.f = (tt & 1u) ? +1 : -1; |
| 60 | p.g = I; |
| 61 | p.s = 3.0f; |
| 62 | p.alive = true; |
| 63 | } |
| 64 | |
| 65 | void Luminova::plotDot(fl::span<CRGB> leds, int x, int y, u8 v) const { |
| 66 | if (!mXyMap.has(x, y)) { |