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

    Loads files into scene.meshController, each read in a worker by the FileReader of its extension (addFileReader).

    • The files are placed relative to each other by their offset (LoadedFile.offset), the first one received becoming the scene's origin (Scene.origin): see applyFileOffsets.
    • Each object received goes through the ObjectImportController given with its file to load: updated, kept or not, told once read then once added; one without geometry is told read only, never added.
    • Each object kept is a new object of the scene, whatever its uuid: the duplicates are left out by the import controller (shouldKeepObject), e.g. an object already loaded. Objects are also left out when they are invalid (matrix not affine, geometry without vertices).
    • Objects are added by groups of about the scene's settings.loading.targetContainerSizeMB (or groupMeshes objects), each group in a Container of its exact size and one BoxTree subtree.
    • Workers are created by the first load and stopped once no load runs (idle, they keep their memory).

    The BoxTree follows a message later (see MeshController.boxTree), and is rebuilt by its worker once no group was added for settings.scene.boxTreeRebuildDelayMs: a better tree than the groups', at the end of the load, or at a pause in it (a slow download), the next group then dropping it if it was not done.

    Index

    Constructors

    Properties

    applyFileOffsets: boolean = true

    Whether the files are placed by their offset (LoadedFile.offset): each batch's matrices moved by its offset minus the scene's origin, the first offset received becoming that origin. Off, the matrices are used as given. Read when a load starts.

    scene: Scene
    signals: {
        ended: Signal<(progress: LoadProgress) => void>;
        started: Signal<(progress: LoadProgress) => void>;
        updated: Signal<(progress: LoadProgress) => void>;
    } = ...

    The progress of the current load. Connect before calling load. A throwing listener does not stop the load.

    Type Declaration

    Methods

    • Reads the files of the reader's extension; replaces (and stops) the previous reader.

      Parameters

      Returns void

    • Stops the load (stop) and disconnects the listeners of its signals.

      Returns void

    • Loads files in parallel; resolves with the final progress once the load is over. Loads are cumulative: files given while a load runs are added to it. A failing file is reported in progress.errors, the others still load. Never rejects.

      Parameters

      • sources: readonly FileSource[]
      • importController: ObjectImportController = ...

        Updates the objects of these files and tells which to keep, before they are queued, then is told those added (see ObjectImportController); default: all kept as read. Each call can give its own: the files of a load added to a running one keep theirs.

      Returns Promise<LoadProgress>

    • Stops the current load and ends it at once; the objects already added stay. Files not done fail with 'the loading was stopped'.

      Returns void