feat(ludic.physics): phys_own - a body owns a shape made for it alone, and phys_remove frees it with the body

A chunk's trunks and boulders put in and taken out made a new shape each time and freed none. The
table is by the body's index, made once at the world's size. tests/reuse_test: 1000 owned bodies put
and removed hold no more shapes and 32 bytes of heap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 13:52:07 +03:00
parent 404ee2ee3b
commit 5cd53d4024
6 changed files with 54 additions and 1 deletions

View file

@ -6,6 +6,7 @@ export function phys_open(physics_st: mut PhysicsState, max_bodies: int, threads
phys_close(physics_st)
ph_buffers()
physics_st.ph_world = jph_world_new(max_bodies, threads)
ph_own_reset(physics_st, max_bodies)
physics_st.ph_gen += 1
physics_st.ph_acc = 0.0
physics_st.ph_steps = 0