Remove "death" functions from particle system

Without the "spawn another effect" binding (that was recently removed),
these serve no purpose.

Change-Id: Ica8cc3f444c6b749c634c41453501edfff9d9a23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356417
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2021-01-20 17:18:43 -05:00 committed by Skia Commit-Bot
parent 5501b59f16
commit 14d336eeb7

View File

@ -267,9 +267,6 @@ void SkParticleEffect::advanceTime(double now) {
fState.fAge += deltaTime / fState.fLifetime;
if (fState.fAge > 1) {
// We always run effectDeath when age crosses 1, whether we're looping or actually dying
this->runEffectScript("effectDeath");
if (fLooping) {
// If we looped, then run effectSpawn again (with the updated loop count)
fState.fLoopCount += sk_float_floor2int(fState.fAge);
@ -281,26 +278,21 @@ void SkParticleEffect::advanceTime(double now) {
}
}
// Advance age for existing particles, shuffle all dying particles to the end of the arrays
int numDyingParticles = 0;
// Advance age for existing particles, and remove any that have reached their end of life
for (int i = 0; i < fCount; ++i) {
fParticles.fData[SkParticles::kAge][i] +=
fParticles.fData[SkParticles::kLifetime][i] * deltaTime;
if (fParticles.fData[SkParticles::kAge][i] > 1.0f) {
// NOTE: This is fast, but doesn't preserve drawing order. Could be a problem...
for (int j = 0; j < SkParticles::kNumChannels; ++j) {
std::swap(fParticles.fData[j][i], fParticles.fData[j][fCount - 1]);
fParticles.fData[j][i] = fParticles.fData[j][fCount - 1];
}
std::swap(fStableRandoms[i], fStableRandoms[fCount - 1]);
fStableRandoms[i] = fStableRandoms[fCount - 1];
--i;
--fCount;
++numDyingParticles;
}
}
// Run the death script for all particles that just died
this->runParticleScript("death", fCount, numDyingParticles);
// Run 'effectUpdate' to adjust emitter properties
this->runEffectScript("effectUpdate");