Interface MeshApiInterface

The Mesh API encapsulates object that concerns mesh loading.

interface MeshApiInterface {
    loadScene(path: string, onLoad: ((groups: Group<Object3DEventMap>[]) => void)): void;
    setRequestHeader(requestHeader: {
        [header: string]: string;
    }): void;
    setUrlModifier(callback?: ((url: string) => string)): void;
}

Methods

  • Given URL path the method will recursively load the .gltf file content.

    Parameters

    • path: string

      URL with .gltf root file.

    • onLoad: ((groups: Group<Object3DEventMap>[]) => void)

      Called when the mesh is loaded with groups argument.

        • (groups): void
        • Parameters

          • groups: Group<Object3DEventMap>[]

          Returns void

    Returns void

  • This method sets request headers for instance the authorization token etc.

    Parameters

    • requestHeader: {
          [header: string]: string;
      }

      dictionary with headers to set.

      • [header: string]: string

    Returns void

  • If provided, the callback will be passed to each resource URL before a request is sent. The callback may return the original URL, or a new URL to override loading behavior. This behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.

    Parameters

    • Optionalcallback: ((url: string) => string)

      URL modifier callback. Called with url argument, and must return resolved URL.

        • (url): string
        • Parameters

          • url: string

          Returns string

    Returns void