Commit graph

1 commit

Author SHA1 Message Date
Kelsi
6b5f9938a3 refactor(editor): extract addBox into shared cli_box_emitter
36 procedural mesh primitives in cli_gen_mesh.cpp each open-
coded the same ~30-line lambda for emitting a flat-shaded
axis-aligned box (per-face vertices for unique normals,
6 faces × 4 verts × 2 tris). Hoist the implementation into
cli_box_emitter.{hpp,cpp} as addFlatBox(WoweeModel&, ...)
with two overloads:

  • addFlatBox(wom, cx, cy, cz, hx, hy, hz)
    center + half-extents form, used by 34 primitives
  • addFlatBox(wom, glm::vec3 lo, glm::vec3 hi)
    lo/hi corners form, used by --gen-mesh-archway and
    --gen-mesh-fence which compute corners directly

Each lambda site collapses from ~30 lines to a 3-line thin
wrapper: cli_gen_mesh.cpp drops from 7374 to 6989 lines.
Output bytes verified identical via --info-mesh-stats
(firepit surface area 2.1100 m² unchanged, vertex/triangle
counts match across firepit/canopy/dock/archway/fence).

Future box-based primitives now opt in by including one
header instead of pasting the lambda again.
2026-05-09 11:24:35 -07:00