Options
All
  • Public
  • Public/Protected
  • All
Menu

File loader for loading glTF files into a scene.

Hierarchy

  • GLTFFileLoader

Implements

Index

Constructors

Properties

alwaysComputeBoundingBox: boolean

Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.

alwaysComputeSkeletonRootNode: boolean

Defines if the loader should always compute the nearest common ancestor of the skeleton joints instead of using skin.skeleton. Defaults to false. Set this to true if loading assets with invalid skin.skeleton values.

animationStartMode: GLTFLoaderAnimationStartMode

The animation start mode. Defaults to FIRST.

compileMaterials: boolean

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

compileShadowGenerators: boolean

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

coordinateSystemMode: GLTFLoaderCoordinateSystemMode

The coordinate system mode. Defaults to AUTO.

createInstances: boolean

Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.

loadAllMaterials: boolean

If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.

loadOnlyMaterials: boolean

If true, load only the materials defined in the file. Defaults to false.

name: string

Name of the loader ("gltf")

onCameraLoadedObservable: Observable<Camera>

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

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.

onDisposeObservable: Observable<void>

Observable raised after the loader is disposed.

onErrorObservable: Observable<any>

Observable raised when an error occurs.

onExtensionLoadedObservable: Observable<BABYLON.IGLTFLoaderExtension>

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

onLoaderStateChangedObservable: Observable<Nullable<GLTFLoaderState>>

Observable raised when the loader state changes.

onMaterialLoadedObservable: Observable<Material>

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

onMeshLoadedObservable: Observable<AbstractMesh>

Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh. Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)

onParsedObservable: Observable<IGLTFLoaderData>

Raised when the asset has been parsed

onSkinLoadedObservable: Observable<{ node: TransformNode; skinnedNode: TransformNode }>

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

see

https://doc.babylonjs.com/divingDeeper/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh

param node

the transform node that corresponds to the original glTF skin node used for animations

param skinnedNode

the transform node that is the skinned mesh itself or the parent of the skinned meshes

onTextureLoadedObservable: Observable<BaseTexture>

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

onValidatedObservable: Observable<IGLTFValidationResults>

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

preprocessUrlAsync: (url: string) => Promise<string>

Type declaration

    • (url: string): Promise<string>
    • Function called before loading a url referenced by the asset.

      Parameters

      • url: string

      Returns Promise<string>

skipMaterials: boolean

If true, do not load any materials defined in the file. Defaults to false.

targetFps: number

When loading glTF animations, which are defined in seconds, target them to this FPS. Defaults to 60.

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: boolean

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

useRangeRequests: boolean

Defines if the loader should use range requests when load binary glTF files from HTTP. Enabling will disable offline support and glTF validator. Defaults to false.

useSRGBBuffers: boolean

If true, load the color (gamma encoded) textures into sRGB buffers (if supported by the GPU), which will yield more accurate results when sampling the texture. Defaults to true.

validate: boolean

Defines if the loader should validate the asset.

Accessors

  • get capturePerformanceCounters(): boolean
  • set capturePerformanceCounters(value: boolean): void
  • Defines if the loader should capture performance counters.

    Returns boolean

  • Defines if the loader should capture performance counters.

    Parameters

    • value: boolean

    Returns void

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

    Returns Nullable<GLTFLoaderState>

  • get loggingEnabled(): boolean
  • set loggingEnabled(value: boolean): void
  • Defines if the loader logging is enabled.

    Returns boolean

  • Defines if the loader logging is enabled.

    Parameters

    • value: boolean

    Returns void

  • set onCameraLoaded(callback: (camera: Camera) => void): void
  • Callback raised when the loader creates a camera after parsing the glTF properties of the camera.

    Parameters

    • callback: (camera: Camera) => void

    Returns void

  • set onComplete(callback: () => void): void
  • 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.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns void

  • set onDispose(callback: () => void): void
  • Callback raised after the loader is disposed.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns void

  • set onError(callback: (reason: any) => void): void
  • Callback raised when an error occurs.

    Parameters

    • callback: (reason: any) => void
        • (reason: any): void
        • Parameters

          • reason: any

          Returns void

    Returns void

  • set onMaterialLoaded(callback: (material: Material) => void): void
  • Callback raised when the loader creates a material after parsing the glTF properties of the material.

    Parameters

    Returns void

  • set onMeshLoaded(callback: (mesh: AbstractMesh) => void): void
  • Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh. Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)

    Parameters

    Returns void

  • Raised when the asset has been parsed

    Parameters

    Returns void

  • set onTextureLoaded(callback: (texture: BaseTexture) => void): void
  • Callback raised when the loader creates a texture after parsing the glTF properties of the texture.

    Parameters

    Returns void

  • set onValidated(callback: (results: IGLTFValidationResults) => void): void
  • Callback raised after a loader extension is created.

    Parameters

    • callback: (results: IGLTFValidationResults) => void
        • (results: IGLTFValidationResults): void
        • Parameters

          • results: IGLTFValidationResults

          Returns void

    Returns void

Methods

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

    Returns void

  • rewriteRootURL(rootUrl: string, responseURL?: string): string
  • The callback that allows custom handling of the root url based on the response url.

    Parameters

    • rootUrl: string

      the original root url

    • Optional responseURL: string

      the response url if available

    Returns string

    the new root url

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

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited constructor
  • Static method

Settings

Theme