API

Interface ISceneLoaderPluginBase

Interface used to define the base of ISceneLoaderPlugin and ISceneLoaderPluginAsync

interface ISceneLoaderPluginBase {
    extensions: string | ISceneLoaderPluginExtensions;
    name: string;
    canDirectLoad?(data: string): boolean;
    directLoad?(scene: Scene, data: string): unknown;
    loadFile?(
        scene: Scene,
        fileOrUrl: string | ArrayBufferView<ArrayBufferLike> | File,
        rootUrl: string,
        onSuccess: (data: unknown, responseURL?: string) => void,
        onProgress?: (ev: ISceneLoaderProgressEvent) => void,
        useArrayBuffer?: boolean,
        onError?: (request?: WebRequest, exception?: LoadFileError) => void,
        name?: string,
    ): Nullable<IFileRequest>;
    rewriteRootURL?(rootUrl: string, responseURL?: string): string;
}

Hierarchy (View Summary)

Index
extensions: string | ISceneLoaderPluginExtensions

The file extensions supported by the plugin.

name: string

The friendly name of the plugin.

  • The callback that returns the data to pass to the plugin if the data can be directly loaded.

    Parameters

    • scene: Scene

      scene loading this data

    • data: string

      string containing the data

    Returns unknown

    data to pass to the plugin

  • The callback called when loading from a url.

    Parameters

    • scene: Scene

      scene loading this url

    • fileOrUrl: string | ArrayBufferView<ArrayBufferLike> | File

      file or url to load

    • rootUrl: string

      root url to use to load assets

    • onSuccess: (data: unknown, responseURL?: string) => void

      callback called when the file successfully loads

    • OptionalonProgress: (ev: ISceneLoaderProgressEvent) => void

      callback called while file is loading (if the server supports this mode)

    • OptionaluseArrayBuffer: boolean

      defines a boolean indicating that date must be returned as ArrayBuffer

    • OptionalonError: (request?: WebRequest, exception?: LoadFileError) => void

      callback called when the file fails to load

    • Optionalname: string

      defines the name of the file when loading a binary file

    Returns Nullable<IFileRequest>

    a file request object

  • The callback that allows custom handling of the root url based on the response url.

    Parameters

    • rootUrl: string

      the original root url

    • OptionalresponseURL: string

      the response url if available

    Returns string

    the new root url