Skip to content

Commit b282762

Browse files
committed
Particle System tests
1 parent 95243da commit b282762

File tree

4 files changed

+801
-6
lines changed

4 files changed

+801
-6
lines changed

wled00/FXparticleSystem.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#if !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D)) // not both disabled
1616
#include "FXparticleSystem.h"
17+
#include "particle_simd.h"
1718
// local shared functions (used both in 1D and 2D system)
1819
static int32_t calcForce_dv(const int8_t force, uint8_t& counter);
1920
static bool checkBoundsAndWrap(int32_t& position, const int32_t max, const int32_t particleradius, const bool wrap); // returns false if out of bounds by more than particleradius
@@ -561,16 +562,26 @@ void ParticleSystem2D::render() {
561562
blend = LINEARBLEND_NOWRAP;
562563
}
563564

564-
if (motionBlur) { // motion-blurring active
565+
uint32_t numPixels = (maxXpixel + 1) * (maxYpixel + 1);
566+
567+
if (motionBlur) {
568+
#if HAS_PIE_SIMD
569+
fast_color_scale_simd(framebuffer, motionBlur, numPixels);
570+
#else
565571
for (int32_t y = 0; y <= maxYpixel; y++) {
566572
int index = y * (maxXpixel + 1);
567573
for (int32_t x = 0; x <= maxXpixel; x++) {
568-
fast_color_scale(framebuffer[index], motionBlur); // note: could skip if only globalsmear is active but usually they are both active and scaling is fast enough
574+
fast_color_scale(framebuffer[index], motionBlur);
569575
index++;
570576
}
571577
}
572-
} else { // no blurring: clear buffer
573-
memset(framebuffer, 0, (maxXpixel + 1) * (maxYpixel + 1) * sizeof(CRGB));
578+
#endif
579+
} else {
580+
#if HAS_PIE_SIMD
581+
clear_buffer_simd(framebuffer, numPixels * sizeof(CRGB));
582+
#else
583+
memset(framebuffer, 0, numPixels * sizeof(CRGB));
584+
#endif
574585
}
575586

576587
// go over particles and render them to the buffer

wled00/FXparticleSystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ static inline int32_t limitSpeed(const int32_t speed) {
4747
#define MAXSOURCES_2D 64
4848
#define SOURCEREDUCTIONFACTOR 6
4949
#elif defined(CONFIG_IDF_TARGET_ESP32P4)
50-
#define MAXPARTICLES_2D 8192
51-
#define MAXSOURCES_2D 1024
50+
#define MAXPARTICLES_2D 16384
51+
#define MAXSOURCES_2D 2048
5252
#define SOURCEREDUCTIONFACTOR 2
5353
#else
5454
#define MAXPARTICLES_2D 2048

0 commit comments

Comments
 (0)