/claim #329
This update introduces two new export formats for 3D circuit visualization:
# Export to GLB
tsci export circuit.tsx -f glb
# Export to GLTF
tsci export circuit.tsx -f gltf
# Check files were created
ls -la test-circuit.glb test-circuit.gltf
file test-circuit.glb # Should show "glTF binary model"
Extended existing export system in lib/shared/export-snippet.ts. GLTF uses circuit-json-to-gltf directly while GLB uses two-step conversion (GLTF to GLB) with gltf-import-export due to buffer reference issues in direct GLB output. Added both formats to ALLOWED_FORMATS and OUTPUT_EXTENSIONS.
Problem: Direct GLB export from circuit-json-to-gltf with format: "glb" created files that failed in 3D viewers with errors like:
Root Cause: Buffer reference issues in the GLB file structure - viewers couldn’t properly parse the binary buffer sections.
Solution: Two-step process:
circuit-json-to-gltf (works perfectly)gltf-import-export (creates buffer structure)Result: GLB files now work correctly in Babylon.js Sandbox, Three.js viewers, and other 3D applications.
circuit-json-to-gltf@^0.0.6 - 3D conversiongltf-import-export@^1.0.22 - GLB conversion (resolves buffer issues)package.json - Added dependencieslib/shared/export-snippet.ts - Added GLB/GLTF export casestests/cli/export/export-glb.test.ts - Tests for both formatsbun.lock - Lock file updateWeb interface GLB export requires separate PR to @tscircuit/runframe package @seveibar
Implements the GLB export functionality requested in issue #333. Uses circuit-json-to-gltf for GLTF generation, then converts to GLB with gltf-import-export to resolve buffer compatibility issues.
Mohamed Mathari
@nocodeventure
tscircuit
@tscircuit