feat: ✨ enable the 3D viewer in the WASM port (WIP)

Builds KiCad's 3D viewer for the browser (opt in with BUILD_3D_VIEWER=ON) and
wires up the legacy-GL emulation it needs.

- build-kicad-target.sh / docker/build.sh: BUILD_3D_VIEWER →
  -DKICAD_BUILD_3D_VIEWER_WASM=ON + -sLEGACY_GL_EMULATION + the GL js-library.
- wasm/shims/gl_immediate_shim.js: display-list emulation (record/replay board
  layers), fixed-function + GLU stubs, throw-guards for unsupported pnames, and
  per-context GLImmediate init for the viewer's SECOND WebGL context.
- tests/kicad/3d-viewer.spec.ts + utils/pcbnew-ready.ts: open View → 3D Viewer.
- bumps the kicad submodule (EMSCRIPTEN-guarded GL changes).

WIP: the viewer window + UI render and geometry draws (glError=0x0), but the
board is not yet visibly rendered — GLImmediate's FFP shader program isn't
linked on the viewer's 2nd WebGL context. Full status + next steps in
features/feat/add-3d-view/notes.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Istvan Matejcsok 2026-06-17 17:02:25 +02:00
commit 68c711e633
7 changed files with 560 additions and 107 deletions

View file

@ -87,6 +87,9 @@ const PCBNEW_FAMILY_SPECS = [
// boots pcbnew.html — must run on V8 (chromium-ci); on Firefox/x86 CI the
// ~190M module OOMs at instantiation and #canvas never appears (run 27626037849).
'**/pcbnew-move.spec.ts',
// 3D viewer specs boot pcbnew.html (3D-enabled build) — same V8 routing.
'**/3d-viewer.spec.ts',
'**/footprint-3d-preview.spec.ts',
];
const appsDir = 'apps';