refactor(render3d): phase 16 - the collider store is gone; still things are bodies in ludic.physics

collide.ludic (circles in a cell grid that could not be removed) and its Render3dState fields are
deleted, and the reload example stops asserting colliders. A game still calling col_* must move to
ludic.physics first (Maroon Lake's src/solid).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 00:08:36 +03:00
parent d4fc9bbb91
commit e53f3197ac
5 changed files with 5 additions and 179 deletions

View file

@ -32,9 +32,7 @@ program Reload {
for i in 0 .. 400 {
let x = fi(i * 2 - 400)
layer_add(l, x, terrain_height(render3d_st, x, fi(30)), fi(30), F_ONE, F_ZERO, F_ZERO, F_ZERO)
col_add(render3d_st, x, fi(30), F_ONE)
}
col_build(render3d_st)
}
handler Boot(render3d_st: mut Render3dState) phase Start {
@ -52,15 +50,14 @@ program Reload {
water_init(render3d_st, fl(4.0), F_ZERO, F_ZERO, fi(200), fi(200))
populate(render3d_st)
var ok = true
ok = check("the first map has layers and colliders", len(render3d_st.sc_layers) == 1 and render3d_st.col_n == 400) and ok
ok = check("the first map has layers", len(render3d_st.sc_layers) == 1) and ok
# --- swap to a 3 km map with a sea and a lake above it
scatter_clear_all(render3d_st)
actor_clear_all(render3d_st)
col_reset(render3d_st)
water_bodies_clear(render3d_st)
terrain_lake(render3d_st, F_ZERO, F_ZERO, F_ZERO, F_ZERO, F_ZERO)
terrain_reload(render3d_st, "", F_ZERO, F_ZERO, F_ZERO, F_ZERO, F_ZERO, "", 1500)
ok = check("everything of the first map released", len(render3d_st.sc_layers) == 0 and render3d_st.col_n == 0 and render3d_st.wb_n == 0 and not render3d_st.water_on) and ok
ok = check("everything of the first map released", len(render3d_st.sc_layers) == 0 and render3d_st.wb_n == 0 and not render3d_st.water_on) and ok
ok = check("the new half", render3d_st.TERRAIN_HALF == 1500 and render3d_st.ter_heights != null and render3d_st.ter_height_tex != 0) and ok
ok = check("patch bounds rebuilt", render3d_st.cd_min != null and len(render3d_st.cd_min) == CD_LEVELS) and ok
ok = check("patches scale with the map", cd_size(render3d_st, 0) == f_mul(fi(32), fr(3000, 8192))) and ok
@ -70,18 +67,17 @@ program Reload {
let lake = water_body_add(render3d_st, fl(12.0), fi(600), fi(-400), fi(150), fi(100), false)
ok = check("two water bodies, the sea mirrored", sea == 0 and lake == 1 and render3d_st.wb_n == 2 and render3d_st.wb_primary == 0 and render3d_st.water_level == F_ZERO and render3d_st.water_on) and ok
populate(render3d_st)
ok = check("the new map takes layers and colliders", len(render3d_st.sc_layers) == 1 and render3d_st.col_n == 400 and render3d_st.col_side == 3000 / COL_CELL) and ok
ok = check("the new map takes layers", len(render3d_st.sc_layers) == 1) and ok
# a sea below the carved lake: set once, and not undone by a reload
terrain_sea(render3d_st, fl(-2.0))
terrain_lake(render3d_st, fl(12.0), fi(600), fi(-400), fi(150), fi(100))
ok = check("the sea is its own level", render3d_st.ter_sea_set and ter_sea_gen(render3d_st) == fl(-2.0) and render3d_st.ter_lake_level == fl(12.0)) and ok
# --- and back: the swap is repeatable
scatter_clear_all(render3d_st)
col_reset(render3d_st)
water_init(render3d_st, fl(4.0), F_ZERO, F_ZERO, fi(200), fi(200))
terrain_reload(render3d_st, "", F_ZERO, F_ZERO, F_ZERO, F_ZERO, F_ZERO, "", 1000)
populate(render3d_st)
ok = check("back to 2 km", render3d_st.TERRAIN_HALF == 1000 and len(render3d_st.cd_min) == CD_LEVELS and render3d_st.wb_n == 1 and render3d_st.col_side == 2000 / COL_CELL) and ok
ok = check("back to 2 km", render3d_st.TERRAIN_HALF == 1000 and len(render3d_st.cd_min) == CD_LEVELS and render3d_st.wb_n == 1) and ok
if ok { print("RELOAD OK") } else { print("RELOAD FAILED") }
quit()
}