FastLED 3.9.15
Loading...
Searching...
No Matches

◆ resetParticle()

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

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

46 {
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}
u16 getWidth() const
Definition fx2d.h:24
u16 getHeight() const
Definition fx2d.h:23
fl::u8 inoise8(fl::u16 x, fl::u16 y, fl::u16 z)
unsigned char u8
Definition stdint.h:131

References fl::Luminova::Particle::a, fl::Luminova::Particle::alive, fl::Luminova::Particle::f, fl::Luminova::Particle::g, fl::Fx2d::getHeight(), fl::Fx2d::getWidth(), inoise8(), fl::Luminova::Particle::s, fl::Luminova::Particle::x, and fl::Luminova::Particle::y.

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: