You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bugfixes in PS, improvements to PS Fireworks 1D (wled#4673)
- fixed inconsitencies in size rendering
- fixed palette being wrapped in color by position and color by age modes
- Fixed bug in memory layout: for some unknown reason, if flags come before particles, last flag is sometimes overwritten, changing memory laout seems to fix that
- New color modes in PS Fireworks 1D:
- custom3 slider < 16: lower saturation (check1: single color or multi-color explosions)
- custom3 slider <= 23: full saturation (check1: single color or multi-color explosions)
- custom3 slider > 23: color by speed (check 1 has not effect here)
- custom slider = max: color by age or color by position (depends on check1)
PartSys->particleMoveUpdate(PartSys->sources[0].source, PartSys->sources[0].sourceFlags); // increase speed by calling the move function twice, also ages twice
10708
+
PartSys->particleMoveUpdate(PartSys->sources[0].source, PartSys->sources[0].sourceFlags); // increase rocket speed by calling the move function twice, also ages twice
for (uint32_t e = 0; e < explosionsize; e++) { // emit explosion particles
10727
-
if (SEGMENT.check1) // colorful mode
10728
-
PartSys->sources[0].source.hue = hw_random16(); //random color for each particle
10729
-
PartSys->sprayEmit(PartSys->sources[0]); // emit a particle
10725
+
int idx = PartSys->sprayEmit(PartSys->sources[0]); // emit a particle
10726
+
if(SEGMENT.custom3 > 23) {
10727
+
if(SEGMENT.custom3 == 31) { // highest slider value
10728
+
PartSys->setColorByAge(SEGMENT.check1); // color by age if colorful mode is enabled
10729
+
PartSys->setColorByPosition(!SEGMENT.check1); // color by position otherwise
10730
+
}
10731
+
else { // if custom3 is set to high value (but not highest), set particle color by initial speed
10732
+
PartSys->particles[idx].hue = map(abs(PartSys->particles[idx].vx), 0, PartSys->sources[0].var, 0, 16 + hw_random16(200)); // set hue according to speed, use random amount of palette width
10733
+
PartSys->particles[idx].hue += PartSys->sources[0].source.hue; // add hue offset of the rocket (random starting color)
10734
+
}
10735
+
}
10736
+
else {
10737
+
if (SEGMENT.check1) // colorful mode
10738
+
PartSys->sources[0].source.hue = hw_random16(); //random color for each particle
10739
+
}
10730
10740
}
10731
10741
}
10732
10742
}
10733
-
if ((SEGMENT.call & 0x01) == 0 && PartSys->sources[0].sourceFlags.custom1 == false) // every second frame and not in standby
10743
+
if ((SEGMENT.call & 0x01) == 0 && PartSys->sources[0].sourceFlags.custom1 == false && PartSys->sources[0].source.ttl > 50) // every second frame and not in standby and not about to explode
if (PartSys->particles[i].ttl > 10) PartSys->particles[i].ttl -= 10; //ttl is linked to brightness, this allows to use higher brightness but still a short spark lifespan
// a pointer MUST be 4 byte aligned. sizeof() in a struct/class is always aligned to the largest element. if it contains a 32bit, it will be padded to 4 bytes, 16bit is padded to 2byte alignment.
966
974
// The PS is aligned to 4 bytes, a PSparticle is aligned to 2 and a struct containing only byte sized variables is not aligned at all and may need to be padded when dividing the memoryblock.
967
975
// by making sure that the number of sources and particles is a multiple of 4, padding can be skipped here as alignent is ensured, independent of struct sizes.
particleFlags[emitIndex].collide = emitter.sourceFlags.collide;// TODO: could just set all flags (asByte) but need to check if that breaks any of the FX
// a pointer MUST be 4 byte aligned. sizeof() in a struct/class is always aligned to the largest element. if it contains a 32bit, it will be padded to 4 bytes, 16bit is padded to 2byte alignment.
1731
1744
// The PS is aligned to 4 bytes, a PSparticle is aligned to 2 and a struct containing only byte sized variables is not aligned at all and may need to be padded when dividing the memoryblock.
1732
1745
// by making sure that the number of sources and particles is a multiple of 4, padding can be skipped here as alignent is ensured, independent of struct sizes.
PSdataEnd = reinterpret_cast<uint8_t *>(advPartProps + numParticles);// since numParticles is a multiple of 4, this is always aligned to 4 bytes. No need to add padding bytes here
0 commit comments