Documentation - v20.0.0-dev
    Preparing search index...

    Reader of the glTF 2.0 files, for the engine's MeshLoader: it reads in workers on this module (see FileReader), with three.js's GLTFLoader. One reader per extension: .gltf (buffers embedded, or beside the file) or .glb.

    One InputMesh per node of the default scene, parents first, one part per primitive (per instance with EXT_mesh_gpu_instancing); an empty node is an object without parts. Its uuid is the three.js object's (a file loaded twice is in the scene twice), its parentUuid its parent node's (none at the top: the scene, the file's root, is left out), its user data the node's (its extras, and its name unchanged: see GLTFLoader). The sharp edges of the triangles are computed. A line primitive (LINES, LINE_STRIP, LINE_LOOP, e.g. a 2D drawing's) is a geometry of lines (primitive 'lines'), drawn in its colour. Left out: the textures (neither fetched nor decoded), the vertex colours, the points, the skins and morph targets (the meshes in their rest pose). Meshopt compression is read, Draco is not.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • extension: "gltf" | "glb" = 'gltf'

        Extension of the files it reads: gltf or glb.

      Returns GltfReader

    Properties

    extension: "gltf" | "glb" = 'gltf'

    Extension of the files it reads: gltf or glb.

    workerCount?: number

    Workers to read with, each one file at a time; default: the cores but one, at most the scene's settings.loading.maxWorkers.

    Methods

    • Parses a glTF (JSON) or GLB (binary) file.

      Parameters

      • buffer: ArrayBuffer
      • name: string
      • resourcePath: string = ''

        Where its external buffers are, relative to it ('': none).

      Returns Promise<LoadedFile>

    • In a worker made by createWorker, makes a reader of this class (no constructor argument) and reads the files the engine sends it. Called at the bottom of the reader's module: does nothing on the main thread.

      Parameters

      • this: new () => FileReader
      • Optionalscope: LoadingScope

        Where the files come from; default: the worker's global scope, when in one.

      Returns void