GLTFFileLoader

File loader for loading glTF files into a scene.

Hierarchy

  • GLTFFileLoader

Implements

Index

Properties

animationStartMode

animationStartMode: GLTFLoaderAnimationStartMode

The animation start mode. Defaults to FIRST.

compileMaterials

compileMaterials: boolean

Defines if the loader should compile materials before raising the success callback. Defaults to false.

compileShadowGenerators

compileShadowGenerators: boolean

Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.

coordinateSystemMode

coordinateSystemMode: GLTFLoaderCoordinateSystemMode

The coordinate system mode. Defaults to AUTO.

extensions

Supported file extensions of the loader (.gltf, .glb)

loaderState

The loader state or null if the loader is not active.

name

name: string

Name of the loader ("gltf")

onCameraLoaded

onCameraLoaded: function

Callback raised when the loader creates a camera after parsing the glTF properties of the camera.

Type declaration

    • Parameters

      Returns void

onCameraLoadedObservable

onCameraLoadedObservable: Observable<Camera>

Observable raised when the loader creates a camera after parsing the glTF properties of the camera.

onComplete

onComplete: function

Callback raised when the asset is completely loaded, immediately before the loader is disposed.

Type declaration

    • (): void
    • Returns void

onCompleteObservable

onCompleteObservable: Observable<GLTFFileLoader>

Observable raised when the asset is completely loaded, immediately before the loader is disposed. For assets with LODs, raised when all of the LODs are complete. For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.

onDispose

onDispose: function

Callback raised after the loader is disposed.

Type declaration

    • (): void
    • Returns void

onDisposeObservable

onDisposeObservable: Observable<GLTFFileLoader>

Observable raised after the loader is disposed.

onExtensionLoaded

onExtensionLoaded: function

Callback raised after a loader extension is created.

Type declaration

onExtensionLoadedObservable

onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>

Observable raised after a loader extension is created. Set additional options for a loader extension in this event.

onMaterialLoaded

onMaterialLoaded: function

Callback raised when the loader creates a material after parsing the glTF properties of the material.

Type declaration

onMaterialLoadedObservable

onMaterialLoadedObservable: Observable<Material>

Observable raised when the loader creates a material after parsing the glTF properties of the material.

onMeshLoaded

onMeshLoaded: function

Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.

Type declaration

onMeshLoadedObservable

onMeshLoadedObservable: Observable<AbstractMesh>

Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.

onParsed

onParsed: function

Raised when the asset has been parsed

Type declaration

onParsedObservable

onParsedObservable: Observable<IGLTFLoaderData>

Raised when the asset has been parsed

onTextureLoaded

onTextureLoaded: function

Callback raised when the loader creates a texture after parsing the glTF properties of the texture.

Type declaration

onTextureLoadedObservable

onTextureLoadedObservable: Observable<BaseTexture>

Observable raised when the loader creates a texture after parsing the glTF properties of the texture.

preprocessUrlAsync

preprocessUrlAsync: function

Function called before loading a url referenced by the asset.

Type declaration

    • (url: string): Promise<string>
    • Parameters

      • url: string

      Returns Promise<string>

rewriteRootURL

rewriteRootURL: function

Rewrites a url by combining a root url and response url.

Type declaration

    • (rootUrl: string, responseURL?: string): string
    • Parameters

      • rootUrl: string
      • Optional responseURL: string

      Returns string

transparencyAsCoverage

transparencyAsCoverage: boolean

Defines if the Alpha blended materials are only applied as coverage. If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials. If true, no extra effects are applied to transparent pixels.

useClipPlane

useClipPlane: boolean

Defines if the loader should also compile materials with clip planes. Defaults to false.

Static CreateGLTFLoaderV1

CreateGLTFLoaderV1: function

Factory function that creates a glTF 1.0 loader

Type declaration

Static CreateGLTFLoaderV2

CreateGLTFLoaderV2: function

Factory function that creates a glTF 2.0 loader

Type declaration

Static HomogeneousCoordinates

HomogeneousCoordinates: boolean

Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters. Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.

Static IncrementalLoading

IncrementalLoading: boolean

Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders. Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled. Defaults to true.

Methods

canDirectLoad

  • canDirectLoad(data: string): boolean
  • If the data string can be loaded directly.

    Parameters

    • data: string

      string contianing the file data

    Returns boolean

    if the data can be loaded directly

createPlugin

dispose

  • dispose(): void
  • Disposes the loader, releases resources during load, and cancels any outstanding requests.

    Returns void

importMeshAsync

  • importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: function): Promise<object>
  • Imports one or more meshes from the loaded glTF data and adds them to the scene

    Parameters

    • meshesNames: any

      a string or array of strings of the mesh names that should be loaded from the file

    • scene: Scene

      the scene the meshes should be added to

    • data: any

      the glTF data to load

    • rootUrl: string

      root url to load from

    • Optional onProgress: function

      event that fires when loading progress has occured

    Returns Promise<object>

    a promise containg the loaded meshes, particles, skeletons and animations

loadAssetContainerAsync

  • loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: function): Promise<AssetContainer>
  • Load into an asset container.

    Parameters

    • scene: Scene

      The scene to load into

    • data: string | ArrayBuffer

      The data to import

    • rootUrl: string

      The root url for scene and resources

    • Optional onProgress: function

      The callback when the load progresses

    Returns Promise<AssetContainer>

    The loaded asset container

loadAsync

  • loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: function): Promise<void>
  • Imports all objects from the loaded glTF data and adds them to the scene

    Parameters

    • scene: Scene

      the scene the objects should be added to

    • data: string | ArrayBuffer

      the glTF data to load

    • rootUrl: string

      root url to load from

    • Optional onProgress: function

      event that fires when loading progress has occured

    Returns Promise<void>

    a promise which completes when objects have been loaded to the scene

whenCompleteAsync

  • whenCompleteAsync(): Promise<void>
  • Returns a promise that resolves when the asset is completely loaded.

    Returns Promise<void>

    a promise that resolves when the asset is completely loaded.

Generated using TypeDoc