pcbjam/tests/apps/3d-webgl/3d_webgl_test.html
Istvan Matejcsok ce1473c9ab test(3d): screenshot-baseline TDD suite for the 3D viewer OpenGL->WebGL port — 47 native goldens + red-state WebGL harness
tests/3d-regression mirrors the gal-regression pattern at renderer scale:
shared C++ scenarios call real KiCad 3D-viewer code (opengl_utils, display
lists + DrawCulled stencil subtraction, MODEL_3D VBOs, private generators via
a rob-template accessor, and full reload()+Redraw() composites over a
synthetic BOARD_ADAPTER). A native macOS harness renders them on real OpenGL
into 47 committed goldens (bit-deterministic, FBO capture); the wasm harness
compiles the same TUs against wasm/stubs/gl_ffp_stub.c no-ops so every
scenario renders blank — the TDD red state (parity meter: 47/47 changed).
Comparisons use the CI pixelmatch engine via the new generic compare-dirs.ts
(floors.json levels; manifest.json cmp-guards registry drift).

Documents an upstream bug: appendPostMachiningGeometry's countersink path
adds middle quads without normals, silently erasing the walls of any
display list it is batched into (3d-post-machining.png keeps the lists
separate to record it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 15:45:58 +02:00

35 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>3D Renderer WebGL Test</title>
<style>
body { margin: 0; background: #202020; }
#canvas { display: block; width: 800px; height: 600px; }
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
let ready = false;
let wasmModule = null;
window._threeDTestReady = () => { ready = true; };
window.threeDTest = {
isReady: () => ready,
runScenario: (i) => wasmModule.ccall('runScenario', 'number', ['number'], [i]),
getTotalScenarios: () => wasmModule.ccall('getTotalScenarios', 'number', [], []),
getScenarioName: (i) => wasmModule.ccall('getScenarioName', 'string', ['number'], [i]),
getCanvasWidth: () => wasmModule.ccall('getCanvasWidth', 'number', [], []),
getCanvasHeight: () => wasmModule.ccall('getCanvasHeight', 'number', [], []),
};
</script>
<script src="3d_webgl_test.js"></script>
<script>
create3DTest({ canvas: document.getElementById('canvas') })
.then((mod) => { wasmModule = mod; })
.catch((err) => { console.error('[3d-webgl] module init failed:', err); });
</script>
</body>
</html>