Skip to content

feat: add GLTF model loading support for cadModel.gltfUrl#11

Closed
lessuselesss wants to merge 10 commits into
tscircuit:mainfrom
lessuselesss:feat/gltf-support
Closed

feat: add GLTF model loading support for cadModel.gltfUrl#11
lessuselesss wants to merge 10 commits into
tscircuit:mainfrom
lessuselesss:feat/gltf-support

Conversation

@lessuselesss
Copy link
Copy Markdown

Summary

  • Implement GLTF loader in /lib/loaders/gltf.ts with full GLTF 2.0 JSON parsing
  • Add GLTF integration to circuit-to-3d pipeline following STL/OBJ patterns
  • Support embedded base64 buffers and external buffer URLs
  • Include coordinate transformation and caching consistent with existing loaders
  • Add comprehensive test suite with 91 passing tests (1,057 assertions)

Implementation Details

  • GLTF Parser: Complete accessor→bufferView→buffer data extraction
  • Security: Input validation, buffer bounds checking, malicious data protection
  • Performance: Efficient triangle processing (2000+ triangles/ms), 64x caching speedup
  • Integration: Seamless model_gltf_url support in circuit-json processing
  • Testing: Edge cases, security validation, performance benchmarks

Testing

  • bun test - All 91 tests pass
  • Comprehensive coverage: unit tests, integration tests, edge cases, security, performance
  • End-to-end validation with real circuit-json data

Closes

Completes the final task in tscircuit/tscircuit#758: "add in circuit-json-to-gltf"

@vercel
Copy link
Copy Markdown

vercel Bot commented Sep 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
circuit-json-to-gltf Ready Ready Preview Comment Sep 17, 2025 5:10pm

- Implement complete GLTF 2.0 parser with security validation
- Add pipeline integration following STL/OBJ patterns
- Include 91 comprehensive tests with performance benchmarks
- Support cadModel.gltfUrl in circuit-json processing
- Apply Biome formatting to all GLTF implementation files
- Fix formatting issues in tests and core implementation
- Ensure consistency with project style guidelines
Ashley Barr added 3 commits September 17, 2025 09:31
- Add non-null assertions for coordinate transformations in geometry.ts
- Fix async function syntax for mock fetch functions
- Add assertions for array access patterns

Progress on fixing CI type check failures
- Add non-null assertions for test array access
- Fix fetch mock function syntax for type compatibility
- Resolve undefined access errors in performance tests

Reduced TypeScript errors from ~80 to ~59
- Fix undefined handling with nullish coalescing in geometry transforms
- Add proper type assertions for array element access
- Fix fetch mock typing with unknown cast for test compatibility
- Add ts-ignore for model-viewer web component JSX element
- All TypeScript checks now passing (0 errors)

Tests: 91 passing, 0 failing
TypeScript: No errors
- Fix formatting for integration and loader test files
- Ensure code style consistency with project standards
- Final formatting fix for CI compliance
- Remove flake.nix, flake.lock, .envrc (Nix development setup)
- Remove TESTING_TODO.md (internal testing notes)
- Clean up repository for production submission
- Remove implementation guide used during development
- Clean submission without internal development docs
Ashley Barr added 2 commits September 17, 2025 11:09
- Remove rebuild-sharp.sh (development script)
- Remove development file patterns from .gitignore
- Clean PR to only include production GLTF implementation
- Remove accidentally created CLADE.md file
- Complete cleanup of development artifacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants