feat(ludic.physics): phys_shape_free - a shape let go hands its id to the next, so a ground by chunk grows nothing (23.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
96423634ad
commit
0c3c0c5e6a
5 changed files with 84 additions and 12 deletions
|
|
@ -32,23 +32,12 @@ export function phys_close(physics_st: mut PhysicsState) -> void {
|
|||
}
|
||||
}
|
||||
physics_st.ph_shapes = new []pointer
|
||||
List.clear(physics_st.ph_spare)
|
||||
List.clear(physics_st.ph_floats)
|
||||
List.clear(physics_st.ph_float_k)
|
||||
if physics_st.ph_facts != null { q_clear(physics_st.ph_facts) }
|
||||
}
|
||||
|
||||
function ph_keep(physics_st: mut PhysicsState, s: pointer) -> int {
|
||||
if s == null { return -1 }
|
||||
ph_buffers()
|
||||
push(physics_st.ph_shapes, s)
|
||||
return len(physics_st.ph_shapes) - 1
|
||||
}
|
||||
|
||||
function ph_shape(physics_st: PhysicsState, id: int) -> pointer {
|
||||
if physics_st.ph_shapes == null or id < 0 or id >= len(physics_st.ph_shapes) { return null }
|
||||
return physics_st.ph_shapes[id]
|
||||
}
|
||||
|
||||
# a crate: half extents in metres
|
||||
export function phys_box(physics_st: mut PhysicsState, hx: float, hy: float, hz: float) -> int { return ph_keep(physics_st, jph_shape_box(hx, hy, hz)) }
|
||||
export function phys_sphere(physics_st: mut PhysicsState, r: float) -> int { return ph_keep(physics_st, jph_shape_sphere(r)) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue