1#ifndef FASTLED_INTERNAL
2#define FASTLED_INTERNAL
27 for (
size_t i = 0; i <
mParticles.size(); ++i) {
33 if (max_particles <= 0) {
36 if (
static_cast<int>(
mParticles.size()) == max_particles) {
40 mParticles.resize(
static_cast<size_t>(max_particles));
41 for (
size_t i = 0; i <
mParticles.size(); ++i) {
48 const float cx =
static_cast<float>(
getWidth() - 1) * 0.5f;
49 const float cy =
static_cast<float>(
getHeight() - 1) * 0.5f;
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());
58 p.
a =
static_cast<float>(tt) * 1.25f + noiseW;
59 p.
f = (tt & 1u) ? +1 : -1;
69 const u16 idx =
mXyMap.mapToIndex(
static_cast<u16
>(
x),
static_cast<u16
>(
y));
76 int R =
static_cast<int>(
fl::ceil(r));
78 int cx =
static_cast<int>(fx + (fx >= 0.0f ? 0.5f : -0.5f));
79 int cy =
static_cast<int>(fy + (fy >= 0.0f ? 0.5f : -0.5f));
81 for (
int dy = -R; dy <= R; ++dy) {
82 for (
int dx = -R; dx <= R; ++dx) {
83 float d2 =
static_cast<float>(dx * dx + dy * dy);
85 float fall = 1.0f - (d2 / (r2 + 0.0001f));
86 float vf = 255.0f * fall;
87 if (vf < 0.0f) vf = 0.0f;
88 if (vf > 255.0f) vf = 255.0f;
89 u8 v =
static_cast<u8>(vf);
104 size_t idx =
static_cast<size_t>(
mTick %
static_cast<fl::u32
>(
mParticles.size()));
109 for (
size_t i = 0; i <
mParticles.size(); ++i) {
123 float tOver99 =
static_cast<float>(
mTick) / 99.0f;
124 u8 n2 =
inoise8(
static_cast<u16
>(tOver99 * 4096.0f),
static_cast<u16
>(p.
g * 37));
125 float n2c = (
static_cast<int>(n2) - 128) / 255.0f;
128 float aa = p.
a *
static_cast<float>(p.
f);
u16 xyMap(u16 x, u16 y) const
void resetParticle(Particle &p, fl::u32 tick)
void plotDot(fl::span< CRGB > leds, int x, int y, u8 v) const
void plotSoftDot(fl::span< CRGB > leds, float fx, float fy, float s) const
Luminova(const XYMap &xyMap, const Params ¶ms=Params())
fl::vector< Particle > mParticles
void draw(DrawContext context) override
void setMaxParticles(int max_particles)
Internal FastLED header for implementation files.
fl::u8 inoise8(fl::u16 x, fl::u16 y, fl::u16 z)
constexpr enable_if< is_fixed_point< T >::value, T >::type ceil(T x) FL_NOEXCEPT
void fadeToBlackBy(CRGB *leds, fl::u16 num_leds, fl::u8 fadeBy)
float sinf(float value) FL_NOEXCEPT
void blur2d(fl::span< CRGB > leds, u8 width, u8 height, fract8 blur_amount, const XYMap &xymap) FL_NOEXCEPT
float cosf(float value) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT
Base definition for an LED controller.