Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind

The shooter’s recipes are pinned: src/client/models.ts gets the test it never had #90

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`src/client/models.test.ts` pins all four recipes — `levelMesh`, `playerMesh`, `bombMesh`, `viewModelMesh` — through one `wellFormed` helper that asserts what the renderer and the atlas actually require: position, normal, uv and layer lengths agreeing per vertex, an index of whole triangles with every value inside the vertex count, no NaN anywhere, and every layer an integer inside `0..LAYERS - 1`…

shipped production is serving it deploy ae07c2d

opened this

src/client/models.test.ts pins all four recipes — levelMesh, playerMesh, bombMesh, viewModelMesh — through one wellFormed helper that asserts what the renderer and the atlas actually require: position, normal, uv and layer lengths agreeing per vertex, an index of whole triangles with every value inside the vertex count, no NaN anywhere, and every layer an integer inside 0..LAYERS - 1. Geometry is asserted only where it carries meaning: one box is 24 vertices and 36 indices with exactly the box's bounds, the empty level is an empty mesh rather than a throw, every kind in the weapons table answers a distinct model that sits down-and-right of the eye and runs down -Z, an unknown kind falls back to a single gun shape instead of throwing, and each recipe called twice returns equal data in fresh buffers. No vertex order and no fifteen-digit float is pinned, so rebuilding a box a different way does not break this.

One recipe surprised the test, which is the point of the issue: playerMesh stood 73.5 units tall against HULL.stand of 72, because the head was placed at a literal 67. scene.ts scales a ducking player by hullHeight(p) / HULL.stand about their feet, so that head poked above the hull standing and above the duck hull ducking. The fix in models.ts is two lines — import HULL, and crown the head at HULL.stand - HEAD / 2 — so the model is the hull by construction and the duck squash lands on 54 exactly. The model is 1.5 units (about 3 cm) shorter than it was; nothing else in the picture moved. static/app.*.js is rebuilt because the client source changed, which src/server.test.ts requires.

bun test is green at 498 passing, and the layer assertion was mutation-checked: setting the bomb's light to layer 9 fails the suite. To look at it in the preview: a standing player's head now tops out level with the ceiling of anything 72 units high, and a ducking one no longer clips through what it ducks under.

🤖 Generated with Claude Code

Closes #57

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs