intermediate fix for transition speedup (#4562)

- fixes FX speedup in fade transitions but its not a proper solution
This commit is contained in:
Damian Schneider 2025-02-17 19:32:43 +01:00 committed by GitHub
parent 46a3e3d353
commit a2de3d33bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -54,6 +54,7 @@ ParticleSystem2D::ParticleSystem2D(uint32_t width, uint32_t height, uint32_t num
smearBlur = 0; //no smearing by default
emitIndex = 0;
collisionStartIdx = 0;
lastRender = 0;
//initialize some default non-zero values most FX use
for (uint32_t i = 0; i < numSources; i++) {
@ -573,6 +574,9 @@ void ParticleSystem2D::pointAttractor(const uint32_t particleindex, PSparticle &
// warning: do not render out of bounds particles or system will crash! rendering does not check if particle is out of bounds
// firemode is only used for PS Fire FX
void ParticleSystem2D::ParticleSys_render() {
if(blendingStyle == BLEND_STYLE_FADE && SEGMENT.isInTransition() && lastRender + (strip.getFrameTime() >> 1) > strip.now) // fixes speedup during transitions TODO: find a better solution
return;
lastRender = strip.now;
CRGB baseRGB;
uint32_t brightness; // particle brightness, fades if dying
static bool useAdditiveTransfer = false; // use add instead of set for buffer transferring (must persist between calls)
@ -1254,6 +1258,7 @@ ParticleSystem1D::ParticleSystem1D(uint32_t length, uint32_t numberofparticles,
smearBlur = 0; //no smearing by default
emitIndex = 0;
collisionStartIdx = 0;
lastRender = 0;
// initialize some default non-zero values most FX use
for (uint32_t i = 0; i < numSources; i++) {
sources[i].source.ttl = 1; //set source alive
@ -1525,6 +1530,9 @@ void ParticleSystem1D::applyFriction(int32_t coefficient) {
// if wrap is set, particles half out of bounds are rendered to the other side of the matrix
// warning: do not render out of bounds particles or system will crash! rendering does not check if particle is out of bounds
void ParticleSystem1D::ParticleSys_render() {
if(blendingStyle == BLEND_STYLE_FADE && SEGMENT.isInTransition() && lastRender + (strip.getFrameTime() >> 1) > strip.now) // fixes speedup during transitions TODO: find a better solution
return;
lastRender = strip.now;
CRGB baseRGB;
uint32_t brightness; // particle brightness, fades if dying
// bool useAdditiveTransfer; // use add instead of set for buffer transferring

View File

@ -242,6 +242,7 @@ private:
uint8_t motionBlur; // motion blur, values > 100 gives smoother animations. Note: motion blurring does not work if particlesize is > 0
uint8_t smearBlur; // 2D smeared blurring of full frame
uint8_t effectID; // ID of the effect that is using this particle system, used for transitions
uint32_t lastRender; // last time the particles were rendered, intermediate fix for speedup
};
void blur2D(CRGB *colorbuffer, const uint32_t xsize, uint32_t ysize, const uint32_t xblur, const uint32_t yblur, const uint32_t xstart = 0, uint32_t ystart = 0, const bool isparticle = false);
@ -406,6 +407,7 @@ private:
uint8_t motionBlur; // enable motion blur, values > 100 gives smoother animations
uint8_t smearBlur; // smeared blurring of full frame
uint8_t effectID; // ID of the effect that is using this particle system, used for transitions
uint32_t lastRender; // last time the particles were rendered, intermediate fix for speedup
};
bool initParticleSystem1D(ParticleSystem1D *&PartSys, const uint32_t requestedsources, const uint8_t fractionofparticles = 255, const uint32_t additionalbytes = 0, const bool advanced = false);