debug wireframe: allowance areas option (off, floating spots, all edges) from an exact port of the engine floor test, capped by level memory

This commit is contained in:
MineTec committed 2026-11-08 17:41:19 +01:00
1 parent db08cf8bf3
commit 8b3c38fe56
8 files changed
+917 -15

No files matched your search

+34
View File
@@ -149,6 +149,40 @@ CutSceneTrigger camera moves only as points).
(≤ 2000 extra vertices per tile model, on average ~1–2× as many triangles as the original).
* Test level T1L9 (test world) has no debug version (the testlevel mod takes precedence).
## Allowance areas (LlamaMod option `debug-wireframe.allowance`, 2026-11-08)
Choice `off` (default) / `tips` ("Floating spots") / `all` ("All edges"). Shows the floor test's edge
allowance: the engine accepts a floor polygon up to `tol = −0x40 − ((0x1000 − ny·32) >> 6)` (≈0.016–0.023)
outside each edge plane; at sharp corners this becomes a sliver up to tol / sin(θ/2) long
(geometry.md "Floor test: inclusion rule …"). Colour **pink 255,60,200**.
* Code: `mods/debug/FloorTest` = bit-exact port of FUN_004036d0's floor branch (same as `tools/floortest.py`;
the sine table is `rint(sin(2πi/4096)·4096)`, identical to DAT_00574318), `mods/debug/AllowanceAreas`.
All geometry uses the engine's plane scale (n·p = d/32 with |n| = 127), not `Collision.decode`'s d/4096,
so the bands sit ~0.8 % further from the model origin than the green wireframe.
* **tips**: for every placed tile and every up-facing collision polygon (not material 17 = skipped for the
llama, not 30 = no floor) and every corner whose tolerance corner lies ≥ `MIN_REACH` (0.05) beyond the
true corner, the area beyond the corner (tolerance region ∩ half-plane past the corner) is sampled in up to
40 rows × 7 points. A sample counts when the exact engine test, with the feet on that polygon's plane,
picks this polygon, the point is outside the polygon without tolerance, and no other passing floor of the
cell is less than `MIN_GAP` (0.05) below (material-30 floors count as none). Samples outside the tile's
cell are dropped (the engine only tests the cell's tiles). Kept when the winning samples reach ≥ 0.05
outside the polygon: translucent strip (alpha 150) through the winning part of each row + an opaque
centre line (4 mm), at the plane height + 0.012, in the tile's marker cell model (no collision).
Strat object collision (crates as strats, platforms) is not considered.
* **all**: per TRAK model, every up-facing floor polygon (same material filter) gets an opaque ring from
its true corners to its tolerance corners (2n vertices, 2n triangles), appended to the model overlay like
the wireframe (tile transform, alt models free). Tolerance corners further than 1.5 out are clamped.
* Budget: if TEXT+TRAK+MAP+STPC+LGPC would exceed 12 MB (16 MB level arena) the level is rebuilt without
allowance geometry and the apply log says "allowance areas left out: level too large". Not reached in
any original level; a model whose overlay would pass 7900 vertices keeps its wireframe without bands.
* Numbers (all 33 levels): tips 0–1454 slivers per level (river t1l3m00x most, t1l4m002 394),
WAD +0–2.0 MB, ≤ 2 s per level; all: +0.02–2.9 MB, arena max 11.1 MB (t1l3m003).
t1l4m002 crate (tile 443): poly 15 corner 2 (reach 0.18, contains Kuzco's spot 57.204/43.733),
poly 11 corner 2 (0.175), polys 10/14 (0.11/0.13) on the other end, 12/13 barely (0.05).
* Tests: `AllowanceAreasTest` (exact port vs. 44 floortest.py points, sine table vs. groove.exe,
slivers of t1l4m002, no slivers on the flat start ground, band counts, process in each mode).
## Statistics per level (build of 2026-11-06)
Marker categories are the internal keys of `debugviz.py`: ausgang = exit, geheimnis = secret,