mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-22 16:02:54 +02:00
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 6b5bbb177d
, 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.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user