feat: add GLB and GLTF 3D export formats#341
Closed
melmathari wants to merge 2 commits into
Closed
Conversation
3 tasks
Author
|
@seveibar open to suggestions, This PR implements GLB/GLTF export for the CLI, but I got a buffering issue that affects RunFrame integration to GLB.
As for runframe, I'd appreciate some pointers on how to get it working there as well. |
- Add 'glb' and 'gltf' to ALLOWED_FORMATS in export-snippet.ts - Implement GLB export using two-step GLTF→GLB conversion to fix buffer issues - GLTF export uses circuit-json-to-gltf directly (works perfectly) - GLB export uses gltf-import-export library to resolve buffer reference issues - Add comprehensive tests for both GLB and GLTF export formats - GLB files now work correctly in Babylon.js Sandbox and other 3D viewers Usage: tsci export circuit.tsx -f glb tsci export circuit.tsx -f gltf Fixes buffer compatibility issues that caused GLB files to fail in 3D viewers.
Member
|
Using the package |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add GLB and GLTF 3D Export Formats
/claim #329
Overview
This update introduces two new export formats for 3D circuit visualization:
Usage
View in 3D
Implementation
Extended existing export system in
lib/shared/export-snippet.ts. GLTF usescircuit-json-to-gltfdirectly while GLB uses two-step conversion (GLTF to GLB) withgltf-import-exportdue to buffer reference issues in direct GLB output. Added both formats toALLOWED_FORMATSandOUTPUT_EXTENSIONS.Issues We Found and Fixed
Problem: Direct GLB export from
circuit-json-to-gltfwithformat: "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.
Dependencies
circuit-json-to-gltf@^0.0.6- 3D conversiongltf-import-export@^1.0.22- GLB conversion (resolves buffer issues)Files Changed
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 updateNotes
Web interface GLB export requires separate PR to
@tscircuit/runframepackage @seveibarResolves
Implements the GLB export functionality requested in issue #333. Uses
circuit-json-to-gltffor GLTF generation, then converts to GLB withgltf-import-exportto resolve buffer compatibility issues.