GLTFFileLoader

File loader for loading glTF files into a scene.

Hierarchy

  • GLTFFileLoader

Implements

Index

Properties

animationStartMode

Find examples in Playground
animationStartMode: GLTFLoaderAnimationStartMode

The animation start mode. Defaults to FIRST.

capturePerformanceCounters

Find examples in Playground
capturePerformanceCounters: boolean

Defines if the loader should capture performance counters.

compileMaterials

Find examples in Playground
compileMaterials: boolean

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

compileShadowGenerators

Find examples in Playground
compileShadowGenerators: boolean

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

coordinateSystemMode

Find examples in Playground
coordinateSystemMode: GLTFLoaderCoordinateSystemMode

The coordinate system mode. Defaults to AUTO.

extensions

Find examples in Playground

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

loaderState

Find examples in Playground

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

loggingEnabled

Find examples in Playground
loggingEnabled: boolean

Defines if the loader logging is enabled.

name

Find examples in Playground
name: string

Name of the loader ("gltf")

onCameraLoaded

Find examples in Playground
onCameraLoaded: function

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

Type declaration

    • Parameters

      Returns void

onCameraLoadedObservable

Find examples in Playground
onCameraLoadedObservable: Observable<Camera>

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

onComplete

Find examples in Playground
onComplete: function

Callback 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.

Type declaration

    • (): void
    • Returns void

onCompleteObservable

Find examples in Playground
onCompleteObservable: Observable<void>

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

Find examples in Playground
onDispose: function

Callback raised after the loader is disposed.

Type declaration

    • (): void
    • Returns void

onDisposeObservable

Find examples in Playground
onDisposeObservable: Observable<void>

Observable raised after the loader is disposed.

onError

Find examples in Playground
onError: function

Callback raised when an error occurs.

Type declaration

    • (reason: any): void
    • Parameters

      • reason: any

      Returns void

onErrorObservable

Find examples in Playground
onErrorObservable: Observable<any>

Observable raised when an error occurs.

onExtensionLoaded

Find examples in Playground
onExtensionLoaded: function

Callback raised after a loader extension is created.

Type declaration

onExtensionLoadedObservable

Find examples in Playground
onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>

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

onMaterialLoaded

Find examples in Playground
onMaterialLoaded: function

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

Type declaration

onMaterialLoadedObservable

Find examples in Playground
onMaterialLoadedObservable: Observable<Material>

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

onMeshLoaded

Find examples in Playground
onMeshLoaded: function

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

Type declaration

onMeshLoadedObservable

Find examples in Playground
onMeshLoadedObservable: Observable<AbstractMesh>

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

onParsed

Find examples in Playground
onParsed: function

Raised when the asset has been parsed

Type declaration

onParsedObservable

Find examples in Playground
onParsedObservable: Observable<IGLTFLoaderData>

Raised when the asset has been parsed

onTextureLoaded

Find examples in Playground
onTextureLoaded: function

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

Type declaration

onTextureLoadedObservable

Find examples in Playground
onTextureLoadedObservable: Observable<BaseTexture>

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

onValidated

Find examples in Playground
onValidated: function

Callback raised after a loader extension is created.

Type declaration

onValidatedObservable

Find examples in Playground
onValidatedObservable: Observable<IGLTFValidationResults>

Observable raised after validation when validate is set to true. The event data is the result of the validation.

preprocessUrlAsync

Find examples in Playground
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

Find examples in Playground
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

Find examples in Playground
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

Find examples in Playground
useClipPlane: boolean

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

validate

Find examples in Playground
validate: boolean

Defines if the loader should validate the asset.

Methods

canDirectLoad

Find examples in Playground
  • 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

Find examples in Playground

dispose

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

    Returns void

importMeshAsync

Find examples in Playground
  • importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: function, fileName?: string): 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

    • Optional fileName: string

      Defines the name of the file to load

    Returns Promise<object>

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

loadAssetContainerAsync

Find examples in Playground
  • loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: function, fileName?: string): 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

    • Optional fileName: string

      Defines the name of the file to load

    Returns Promise<AssetContainer>

    The loaded asset container

loadAsync

Find examples in Playground
  • loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: function, fileName?: string): 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

    • Optional fileName: string

      Defines the name of the file to load

    Returns Promise<void>

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

whenCompleteAsync

Find examples in Playground
  • 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