API

Class FilesInput

Class used to help managing file picking and drag-n-drop

Index
  • Creates a new FilesInput

    Parameters

    • engine: AbstractEngine

      defines the rendering engine

    • scene: Nullable<Scene>

      defines the hosting scene

    • sceneLoadedCallback: Nullable<(sceneFile: File, scene: Scene) => void>

      callback called when scene (files provided) is loaded

    • progressCallback: Nullable<(progress: ISceneLoaderProgressEvent) => void>

      callback called to track progress

    • additionalRenderLoopLogicCallback: Nullable<() => void>

      callback called to add user logic to the rendering loop

    • textureLoadingCallback: Nullable<(remaining: number) => void>

      callback called when a texture is loading

    • startingProcessingFilesCallback: Nullable<(files?: File[]) => void>

      callback called when the system is about to process all files

    • onReloadCallback: Nullable<(sceneFile: File) => void>

      callback called when a reload is requested

    • errorCallback: Nullable<(sceneFile: File, scene: Nullable<Scene>, message: string) => void>

      callback call if an error occurs

    • useAppend: boolean = false

      defines if the file loaded must be appended (true) or have the scene replaced (false, default behavior)

    • dontInjectRenderLoop: boolean = false

      defines if the render loop mustn't be injected into engine (default is false). Used only if useAppend is false.

    Returns FilesInput

displayLoadingUI: boolean = true

If a loading UI should be displayed while loading a file

dontInjectRenderLoop: boolean = false

defines if the render loop mustn't be injected into engine (default is false). Used only if useAppend is false.

loadAsync: (
    sceneFile: File,
    onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void>,
) => Promise<Scene> = ...

Function used when loading the scene file

Type Declaration

onProcessFileCallback: (
    file: File,
    name: string,
    extension: string,
    setSceneFileToLoad: (sceneFile: File) => void,
) => boolean = ...

Callback called when a file is processed

Type Declaration

    • (
          file: File,
          name: string,
          extension: string,
          setSceneFileToLoad: (sceneFile: File) => void,
      ): boolean
    • Parameters

      • file: File
      • name: string
      • extension: string
      • setSceneFileToLoad: (sceneFile: File) => void

      Returns boolean

      false to abort the process

onProcessFilesErrorCallback: (files: File[]) => void = ...

Callback called when an accepted file selection does not contain a loadable scene.

useAppend: boolean = false

defines if the file loaded must be appended (true) or have the scene replaced (false, default behavior)

  • Clears the files and scene selection associated with the current load.

    Parameters

    • cancelActiveLoad: boolean = true

      whether an in-progress replacement load should be canceled, restoring FilesInput-managed loading UI and rendering

    Returns void

  • Calls this function to listen to drag'n'drop events on a specific DOM element

    Parameters

    • elementToMonitor: HTMLElement

      defines the DOM element to track

    Returns void