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

◆ resetParticle()

void fl::Luminova::resetParticle ( Particle & p,
fl::u32 tick )
private

Definition at line 47 of file luminova.cpp.hpp.

47 {
48 // Position at center
49 const float cx = static_cast<float>(getWidth() - 1) * 0.5f;
50 const float cy = static_cast<float>(getHeight() - 1) * 0.5f;
51 p.x = cx;
52 p.y = cy;
53
54 // Original used noise(I)*W, we approximate with 1D noise scaled to width
55 int I = static_cast<int>(tt / 50);
56 u8 n1 = inoise8(static_cast<u16>(I * 19));
57 float noiseW = (static_cast<float>(n1) / 255.0f) * static_cast<float>(getWidth());
58
59 p.a = static_cast<float>(tt) * 1.25f + noiseW;
60 p.f = (tt & 1u) ? +1 : -1;
61 p.g = I;
62 p.s = 3.0f;
63 p.alive = true;
64}
u16 getWidth() const FL_NO_EXCEPT
Definition fx2d.h:25
u16 getHeight() const FL_NO_EXCEPT
Definition fx2d.h:24
fl::u8 inoise8(fl::u16 x, fl::u16 y, fl::u16 z) FL_NO_EXCEPT
8-Bit, fixed point implementation of Perlin's noise.
unsigned char u8
Definition stdint.h:131

References fl::FL_NO_EXCEPT, fl::Fx2d::getHeight(), fl::Fx2d::getWidth(), and inoise8().

+ Here is the call graph for this function: