From 7b442174c8a20771ca20bbe2c665c987375698d8 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sat, 1 Feb 2025 19:35:55 +0100 Subject: [PATCH] Particle RandomScale is now cumulative and doesn't break interpolated scaling Don't allocate interpolation data for RandomRotationRange when not needed Hope this commit doesn't break some visuals; i'm not 100% sure. Some particle files may rely on this behavior to look as intended. --- BBGE/Emitter.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/BBGE/Emitter.cpp b/BBGE/Emitter.cpp index 8b16e79..db8bb9e 100644 --- a/BBGE/Emitter.cpp +++ b/BBGE/Emitter.cpp @@ -110,22 +110,20 @@ void Emitter::spawnParticle(float perc) p->pos += Vector(sinf(a)*finalRadius * data.randomSpawnMod.x, cosf(a)*finalRadius * data.randomSpawnMod.y); } - if (!(data.randomScale1 == 1 && data.randomScale1 == data.randomScale2)) { - // Legacy codepath -- breaks animated scaling float sz = lerp(data.randomScale1, data.randomScale2, rng.f01()); - p->scale = Vector(sz,sz); + p->scale *= sz; + if(p->scale.data) + p->scale.data->target *= sz; } - if (data.randomRotationRange > 0) { p->rot.z = rng.f01() * data.randomRotationRange; - p->rot.ensureData()->target.z += p->rot.z; + if(p->rot.data) + p->rot.data->target.z += p->rot.z; } - - if (data.randomVelocityMagnitude > 0) { float a = randAngle();