Options
All
  • Public
  • Public/Protected
  • All
Menu

The glTF 2.0 loader

Hierarchy

  • GLTFLoader

Implements

  • IGLTFLoader

Index

Properties

_babylonLights: Light[]

Storage

DefaultSampler: BABYLON.GLTF2.Loader.ISampler

The default glTF sampler.

Accessors

  • get babylonScene(): Scene
  • The Babylon scene when loading the asset.

    Returns Scene

  • The BIN chunk of a binary glTF.

    Returns Nullable<IDataBuffer>

  • The object that represents the glTF JSON.

    Returns BABYLON.GLTF2.Loader.IGLTF

  • The parent file loader.

    Returns GLTFFileLoader

  • The root Babylon mesh when loading the asset.

    Returns Nullable<Mesh>

Methods

  • Creates a Babylon material from a glTF material.

    Parameters

    • context: string

      The context when loading the asset

    • material: BABYLON.GLTF2.Loader.IMaterial

      The glTF material property

    • babylonDrawMode: number

      The draw mode for the Babylon material

    Returns Material

    The Babylon material

  • endPerformanceCounter(counterName: string): void
  • Ends a performance counter.

    Parameters

    • counterName: string

      The name of the performance counter

    Returns void

  • isExtensionUsed(name: string): boolean
  • Checks for presence of an extension.

    Parameters

    • name: string

      The name of the extension to check

    Returns boolean

    A boolean indicating the presence of the given extension name in extensionsUsed

  • Loads a glTF animation.

    Parameters

    Returns Promise<AnimationGroup>

    A promise that resolves with the loaded Babylon animation group when the load is complete

  • loadBufferAsync(context: string, buffer: BABYLON.GLTF2.Loader.IBuffer, byteOffset: number, byteLength: number): Promise<ArrayBufferView>
  • Loads a glTF buffer.

    Parameters

    • context: string

      The context when loading the asset

    • buffer: BABYLON.GLTF2.Loader.IBuffer

      The glTF buffer property

    • byteOffset: number

      The byte offset to use

    • byteLength: number

      The byte length to use

    Returns Promise<ArrayBufferView>

    A promise that resolves with the loaded data when the load is complete

  • Loads a glTF buffer view.

    Parameters

    Returns Promise<ArrayBufferView>

    A promise that resolves with the loaded data when the load is complete

  • Loads a glTF camera.

    Parameters

    • context: string

      The context when loading the asset

    • camera: BABYLON.GLTF2.Loader.ICamera

      The glTF camera property

    • Optional assign: ((babylonCamera: Camera) => void)

      A function called synchronously after parsing the glTF properties

        • Parameters

          Returns void

    Returns Promise<Camera>

    A promise that resolves with the loaded Babylon camera when the load is complete

  • Loads a glTF image.

    Parameters

    Returns Promise<ArrayBufferView>

    A promise that resolves with the loaded data when the load is complete

  • Loads the alpha properties from a glTF material into a Babylon material. Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.

    Parameters

    Returns void

  • Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.

    Parameters

    Returns Promise<void>

    A promise that resolves when the load is complete

  • Loads properties from a glTF material into a Babylon material.

    Parameters

    Returns Promise<void>

    A promise that resolves when the load is complete

  • Loads a glTF node.

    Parameters

    • context: string

      The context when loading the asset

    • node: BABYLON.GLTF2.Loader.INode

      The glTF node property

    • Optional assign: ((babylonTransformNode: TransformNode) => void)

      A function called synchronously after parsing the glTF properties

    Returns Promise<TransformNode>

    A promise that resolves with the loaded Babylon mesh when the load is complete

  • Loads a glTF scene.

    Parameters

    Returns Promise<void>

    A promise that resolves when the load is complete

  • Loads a glTF texture info.

    Parameters

    • context: string

      The context when loading the asset

    • textureInfo: BABYLON.GLTF2.Loader.ITextureInfo

      The glTF texture info property

    • Optional assign: ((babylonTexture: BaseTexture) => void)

      A function called synchronously after parsing the glTF properties

    Returns Promise<BaseTexture>

    A promise that resolves with the loaded Babylon texture when the load is complete

  • loadUriAsync(context: string, property: IProperty, uri: string): Promise<ArrayBufferView>
  • Loads a glTF uri.

    Parameters

    • context: string

      The context when loading the asset

    • property: IProperty

      The glTF property associated with the uri

    • uri: string

      The base64 or relative uri

    Returns Promise<ArrayBufferView>

    A promise that resolves with the loaded data when the load is complete

  • log(message: string): void
  • Logs a message

    Parameters

    • message: string

      The message to log

    Returns void

  • logClose(): void
  • Decrements the indentation level.

    Returns void

  • logOpen(message: string): void
  • Increments the indentation level and logs a message.

    Parameters

    • message: string

      The message to log

    Returns void

  • startPerformanceCounter(counterName: string): void
  • Starts a performance counter.

    Parameters

    • counterName: string

      The name of the performance counter

    Returns void

  • AddPointerMetadata(babylonObject: IWithMetadata, pointer: string): void
  • Adds a JSON pointer to the _internalMetadata of the Babylon object at <object>._internalMetadata.gltf.pointers.

    Parameters

    • babylonObject: IWithMetadata

      the Babylon object with _internalMetadata

    • pointer: string

      the JSON pointer

    Returns void

  • LoadExtensionAsync<TExtension, TResult>(context: string, property: IProperty, extensionName: string, actionAsync: ((extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>)): Nullable<Promise<TResult>>
  • Helper method called by a loader extension to load an glTF extension.

    Type Parameters

    • TExtension = any

    • TResult = void

    Parameters

    • context: string

      The context when loading the asset

    • property: IProperty

      The glTF property to load the extension from

    • extensionName: string

      The name of the extension to load

    • actionAsync: ((extensionContext: string, extension: TExtension) => Nullable<Promise<TResult>>)

      The action to run

        • (extensionContext: string, extension: TExtension): Nullable<Promise<TResult>>
        • Parameters

          • extensionContext: string
          • extension: TExtension

          Returns Nullable<Promise<TResult>>

    Returns Nullable<Promise<TResult>>

    The promise returned by actionAsync or null if the extension does not exist

  • LoadExtraAsync<TExtra, TResult>(context: string, property: IProperty, extensionName: string, actionAsync: ((extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>)): Nullable<Promise<TResult>>
  • Helper method called by a loader extension to load a glTF extra.

    Type Parameters

    • TExtra = any

    • TResult = void

    Parameters

    • context: string

      The context when loading the asset

    • property: IProperty

      The glTF property to load the extra from

    • extensionName: string

      The name of the extension to load

    • actionAsync: ((extraContext: string, extra: TExtra) => Nullable<Promise<TResult>>)

      The action to run

        • (extraContext: string, extra: TExtra): Nullable<Promise<TResult>>
        • Parameters

          • extraContext: string
          • extra: TExtra

          Returns Nullable<Promise<TResult>>

    Returns Nullable<Promise<TResult>>

    The promise returned by actionAsync or null if the extra does not exist

  • UnregisterExtension(name: string): boolean
  • Unregisters a loader extension.

    Parameters

    • name: string

      The name of the loader extension.

    Returns boolean

    A boolean indicating whether the extension has been unregistered

Legend

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

Settings

Theme