Skip to content

Loading a glb file with missing textures #1578

Answered by donmccurdy
Jacob-Branch asked this question in Q&A
Discussion options

You must be logged in to vote

Because glTF Transform does throw when trying to parse a .glb/.gltf with missing external resources, I think it would be necessary to parse the .glb header manually, copying the implementation here...

// Decode JSON chunk.
const jsonChunkHeader = new Uint32Array(glb.buffer, glb.byteOffset + 12, 2);
if (jsonChunkHeader[1] !== ChunkType.JSON) {
throw new Error('Missing required GLB JSON chunk.');
}
const jsonByteOffset = 20;
const jsonByteLength = jsonChunkHeader[0];
const jsonText = BufferUtils.decodeText(BufferUtils.toView(glb, jsonByteOffset, jsonByteLength

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Jacob-Branch
Comment options

Answer selected by Jacob-Branch
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