Facepunch / sbox-sdf

Library providing marching cubes / squares mesh generation
MIT License
15 stars 7 forks source link

ClearAsync not clearing SdfWorld #29

Closed trundlr closed 5 months ago

trundlr commented 5 months ago

Trying to clear an Sdf2DWorld seems to be doing nothing. It seems to me that the clear code is running as expected, but there is no clearing happening.

ShadowBrian commented 5 months ago

As far as I can tell it's clearing the data but not updating the mesh to reflect it, and this is only apparent if you re-apply the same terrain data afterwards, leaving behind scorch marks and even chunks if you're making the terrain smaller, these chunks work fine again after loading a bigger map that encompasses them, it's a bit weird.

https://github.com/Facepunch/sbox-sdf/assets/11138884/acac08da-f9f9-41df-b602-994859cb9e56

This is me just clearing and re-applying the same terrain.

Here's me loading a smaller terrain, showing the leftover chunks not taking damage, then loading the bigger terrain and the chunks working fine

https://github.com/Facepunch/sbox-sdf/assets/11138884/9089a9bd-fcbd-4b7b-949f-1797ca6c6205

Metapyziks commented 5 months ago

Pushed a possible fix.

trundlr commented 5 months ago

This seemed to be working now - thanks ziks! Btw if you could upload a new version of the lib with this change, that'd be great. I assume you were waiting to know if the fix worked. :)

Metapyziks commented 5 months ago

Thanks for testing, published!