Adding image data / buffers to NodeIO writeJSON #785
-
Hi, I'm developing a little nodejs web app with express.js, where i load, optimize and modify a lot of GLTF files, for then to return them to a third-party in json format. I can't seem to figure out how to include the image data and buffer in the json output from NodeIO. Is this not possible with this library or have i overlooked anything in the documentation? Any pointers are appreciated :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It should all be in the 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 |
Beta Was this translation helpful? Give feedback.
It should all be in the
resources
entry of the JSON. The output of writeJSON looks like this:https://gltf-transform.donmccurdy.com/interfaces/core.jsondocument.html