Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Write JSONDocument to GLB-formatted Uint8Array #1473

Closed
mattrossman opened this issue Jul 26, 2024 · 1 comment
Closed

Feature Request: Write JSONDocument to GLB-formatted Uint8Array #1473

mattrossman opened this issue Jul 26, 2024 · 1 comment
Labels
feature New enhancement or request

Comments

@mattrossman
Copy link

Is your feature request related to a problem? Please describe.

I have a JSONDocument that I need to export as-is to GLB format.

Describe the solution you'd like

A function for writing JSONDocument directly to GLB format.

Describe alternatives you've considered

I could call readJson() to convert the JSONDocument to a Document and then call writeBinary() on that document. However, this forces the document to pass through glTF-Transform's resource graph which may modify its contents.

What I've had to do instead is copy/paste bits of the glTF I/O code from Three.js to write the GLB file, but would prefer to use glTF-Transform as my all in one glTF import/export solution.

Additional context

Seeing as there's a binaryToJSON() function for reading a GLB-formatted Uint8Array directly to JSONDocument, it seems reasonable to have a JSONToBinary() function for the inverse behavior (or whatever capitalization is preferred).

@mattrossman mattrossman added the feature New enhancement or request label Jul 26, 2024
@mattrossman
Copy link
Author

Just saw this is discussed in #746 and #1280 (was searching for "JSONDocument" before posting this), closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New enhancement or request
Projects
None yet
Development

No branches or pull requests

1 participant