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>
75 lines
2.1 KiB
Shell
Executable file
75 lines
2.1 KiB
Shell
Executable file
#!/bin/bash
|
|
#
|
|
# Build script for the 3D-renderer WebGL test harness (WASM).
|
|
#
|
|
# Builds the shared 3D scenarios (tests/3d-regression/scenarios) + real KiCad
|
|
# 3D-viewer TUs against the FFP no-op stubs (wasm/stubs/gl_ffp_stub.c) — the
|
|
# TDD red state for the OpenGL->WebGL port. Output: tests/apps/3d-webgl/.
|
|
#
|
|
# Requires the wxWidgets WASM build (scripts/build-wx-wasm.sh) and the sysroot
|
|
# headers (boost/glm) in build-wasm/sysroot.
|
|
#
|
|
# Usage:
|
|
# ./scripts/build-3d-webgl-test.sh # Clean build (default)
|
|
# ./scripts/build-3d-webgl-test.sh --no-clean # Incremental build
|
|
# ./scripts/build-3d-webgl-test.sh --debug # Debug build with source maps
|
|
#
|
|
# Modeled on scripts/build-gal-webgl-test.sh (no shader-generation step — the
|
|
# FFP renderer has no GLSL yet; the port will add one here).
|
|
#
|
|
|
|
source "$(dirname "$0")/common/logging.sh"
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
JOBS="${JOBS:-$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)}"
|
|
|
|
QUIET=1 source "$SCRIPT_DIR/common/env.sh"
|
|
|
|
TEST_DIR="$PROJECT_ROOT/tests/3d-regression/wasm"
|
|
OUTPUT_DIR="$PROJECT_ROOT/tests/apps/3d-webgl"
|
|
|
|
echo "Building 3D WebGL Test (red-state harness)..."
|
|
echo " Test dir: $TEST_DIR"
|
|
echo " Output dir: $OUTPUT_DIR"
|
|
|
|
if ! command -v em++ &> /dev/null; then
|
|
echo "ERROR: em++ not found. Run: ./scripts/setup-emsdk.sh"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -x "$PROJECT_ROOT/build-wasm/wxwidgets/wx-config" ]; then
|
|
echo "ERROR: wxWidgets WASM build missing. Run: ./scripts/build-wx-wasm.sh"
|
|
exit 1
|
|
fi
|
|
|
|
echo " Emscripten: $(em++ --version 2>&1 | head -1)"
|
|
|
|
DEBUG_BUILD=0
|
|
CLEAN_BUILD=1
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--debug) DEBUG_BUILD=1 ;;
|
|
--no-clean) CLEAN_BUILD=0 ;;
|
|
esac
|
|
done
|
|
|
|
cd "$TEST_DIR"
|
|
|
|
if [ "$CLEAN_BUILD" = "1" ]; then
|
|
make clean || true
|
|
fi
|
|
|
|
rm -f "$OUTPUT_DIR"/*.js "$OUTPUT_DIR"/*.wasm
|
|
|
|
if [ "$DEBUG_BUILD" = "1" ]; then
|
|
make -j"$JOBS" DEBUG=1
|
|
else
|
|
make -j"$JOBS"
|
|
fi
|
|
|
|
echo "Build successful: $OUTPUT_DIR/3d_webgl_test.{js,wasm,html}"
|
|
echo "Serve with: cd tests && npm run serve -> /3d-webgl/3d_webgl_test.html"
|