Skip to content

Adding image data / buffers to NodeIO writeJSON #785

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

You must be logged in to vote

It should all be in the resources entry of the JSON. The output of writeJSON looks like this:

const jsonDocument = {
    // glTF JSON schema.
    json: {
        asset: {version: '2.0'},
        images: [{uri: 'image1.png'}, {uri: 'image2.png'}],
        ...
    },

    // URI → Uint8Array mapping.
    resources: {
        'image1.png': new Uint8Array(...),
        'image2.png': new Uint8Array(...),
    }
};

https://gltf-transform.donmccurdy.com/interfaces/core.jsondocument.html

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Ellink
Comment options

Answer selected by Ellink
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