From f580a0b9d4a03822743644c9fb07fa46b5d7c1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Thu, 19 Dec 2024 12:53:51 +0100 Subject: [PATCH] Fix gravity wall being intermittently broken when drawn while paused In fact, even when it was drawn while unpaused, there would be two different gravity masks being swapped between, and only one of them was what the user wanted. However, there wasn't as much difference between them, because one was just one frame more out of date than the other, so this was hard to notice. Broken since 6b5bbb177dd5, where I forgot that the gravity mask exists at all. The gravity mass input is thrown away every frame in Simulation, and so that commit applies to it well, but the gravity mask isn't. --- src/simulation/gravity/Fft.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/simulation/gravity/Fft.cpp b/src/simulation/gravity/Fft.cpp index ec43fbf80..d721c30e7 100644 --- a/src/simulation/gravity/Fft.cpp +++ b/src/simulation/gravity/Fft.cpp @@ -232,7 +232,8 @@ void Gravity::Exchange(GravityOutput &gravOut, GravityInput &gravIn, bool forceR std::memcmp(&fftGravity->gravIn.mask[{ 0, 0 }], &gravIn.mask[{ 0, 0 }], NCELL * sizeof(float))) { fftGravity->copyGravOut = true; - std::swap(gravIn, fftGravity->gravIn); + std::swap(gravIn.mass, fftGravity->gravIn.mass); + fftGravity->gravIn.mask = gravIn.mask; fftGravity->Dispatch(); } }