Skip to content

Reading glb with external resource uri (with absolute paths) #644

Answered by donmccurdy
repalash asked this question in Q&A
Discussion options

You must be logged in to vote

If you use a method that takes a URI or path, these external references can be resolved:

const document = await io.readBinary('path/to/model.glb');
const jsonDocument = await io.readAsJSON('path/to/model.glb');

If the GLB is already in memory and that's not an option, then I think the only workaround the library currently supports would be to unpack the GLB container manually (example), append the resources you need to the resources map, and then parse it with io.readJSON(...).

Perhaps we could make that second method a bit easier by adding a second parameter to the binaryToJSON method, allowing you to "opt out" of the checks for external resources:

const jsonDocument = io.binaryToJSON(bi…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@repalash
Comment options

@repalash
Comment options

@donmccurdy
Comment options

Answer selected by donmccurdy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants