Raw glTF asset, with its JSON and binary resources.

A JSONDocument is a plain object containing the raw JSON of a glTF file, and any binary or image resources referenced by that file. When modifying the file, it should generally be first converted to the more useful Document wrapper.

When loading glTF data that is in memory, or which the I/O utilities cannot otherwise access, you might assemble the JSONDocument yourself, then convert it to a Document with PlatformIO.readJSON(jsonDocument).

Usage:

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

    // URI → ArrayBuffer mapping.
    resources: {
        'image1.png': BufferUtils.trim(fs.readFileSync('image1.png')),
        'image2.png': BufferUtils.trim(fs.readFileSync('image2.png')),
    }
};

const doc = new NodeIO().readJSON(jsonDocument);

Hierarchy

  • JSONDocument
Function symbol, f(📦) → 📦, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy TypeDoc documentation Copyright 2020 under MIT license