Class GLTFLoader
Index
Properties
Accessors
Methods
Properties
_ babylon Lights
Storage
Static ReadonlyDefault Sampler
The default glTF sampler.
Accessors
babylon Scene
-
get babylonScene(): Scene
The Babylon scene when loading the asset.
Returns Scene
bin
-
get bin(): Nullable<IDataBuffer>
The BIN chunk of a binary glTF.
Returns Nullable<IDataBuffer>
gltf
-
The object that represents the glTF JSON.
Returns IGLTF
parent
-
The parent file loader.
Returns GLTFFileLoader
root Babylon Mesh
-
get rootBabylonMesh(): Nullable<TransformNode>
The root Babylon node when loading the asset.
Returns Nullable<TransformNode>
root Url
-
get rootUrl(): Nullable<string>
The root url when loading the asset.
Returns Nullable<string>
Methods
create Material
-
Creates a Babylon material from a glTF material.
Parameters
- context: string
The context when loading the asset
- material: IMaterial
The glTF material property
- babylonDrawMode: number
The draw mode for the Babylon material
Returns Material
The Babylon material
- context: string
end Performance Counter
-
Ends a performance counter.
Parameters
- counterName: string
The name of the performance counter
Returns void
- counterName: string
is Extension Used
-
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 - name: string
is Matching Material Type
-
Test if the given material is an instance of any PBR material type known to this loader.
Parameters
- material: Nullable<Material>
The material to test
Returns boolean
true if the material matches one of the loaded PBR implementations
- material: Nullable<Material>
load Animation Async
-
Loads a glTF animation.
Parameters
- context: string
The context when loading the asset
- animation: IAnimation
The glTF animation property
Returns Promise<AnimationGroup>
A promise that resolves with the loaded Babylon animation group when the load is complete
- context: string
load Buffer Async
-
loadBufferAsync(
context: string,
buffer: IBuffer,
byteOffset: number,
byteLength: number,
): Promise<ArrayBufferView<ArrayBufferLike>>Loads a glTF buffer.
Parameters
- context: string
The context when loading the asset
- buffer: IBuffer
The glTF buffer property
- byteOffset: number
The byte offset to use
- byteLength: number
The byte length to use
Returns Promise<ArrayBufferView<ArrayBufferLike>>
A promise that resolves with the loaded data when the load is complete
- context: string
load Buffer View Async
-
loadBufferViewAsync(
context: string,
bufferView: IBufferView,
): Promise<ArrayBufferView<ArrayBufferLike>>Loads a glTF buffer view.
Parameters
- context: string
The context when loading the asset
- bufferView: IBufferView
The glTF buffer view property
Returns Promise<ArrayBufferView<ArrayBufferLike>>
A promise that resolves with the loaded data when the load is complete
- context: string
load Camera Async
-
loadCameraAsync(
context: string,
camera: ICamera,
assign?: (babylonCamera: Camera) => void,
): Promise<Camera>Loads a glTF camera.
Parameters
- context: string
The context when loading the asset
- camera: ICamera
The glTF camera property
- assign: (babylonCamera: Camera) => void = ...
A function called synchronously after parsing the glTF properties
Returns Promise<Camera>
A promise that resolves with the loaded Babylon camera when the load is complete
- context: string
load Image Async
load Material Alpha Properties
-
loadMaterialAlphaProperties(
context: string,
material: IMaterial,
babylonMaterial: Material,
): voidLoads 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
- context: string
The context when loading the asset
- material: IMaterial
The glTF material property
- babylonMaterial: Material
The Babylon material
Returns void
- context: string
load Material Base Properties Async
-
loadMaterialBasePropertiesAsync(
context: string,
material: IMaterial,
babylonMaterial: Material,
): Promise<void>Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.
Parameters
- context: string
The context when loading the asset
- material: IMaterial
The glTF material property
- babylonMaterial: Material
The Babylon material
Returns Promise<void>
A promise that resolves when the load is complete
- context: string
load Material Properties Async
-
loadMaterialPropertiesAsync(
context: string,
material: IMaterial,
babylonMaterial: Material,
): Promise<void>Loads properties from a glTF material into a Babylon material.
Parameters
- context: string
The context when loading the asset
- material: IMaterial
The glTF material property
- babylonMaterial: Material
The Babylon material
Returns Promise<void>
A promise that resolves when the load is complete
- context: string
load Node Async
load Scene Async
-
Loads a glTF scene.
Parameters
- context: string
The context when loading the asset
- scene: IScene
The glTF scene property
Returns Promise<void>
A promise that resolves when the load is complete
- context: string
load Texture Info Async
-
loadTextureInfoAsync(
context: string,
textureInfo: ITextureInfo,
assign?: (babylonTexture: BaseTexture) => void,
): Promise<BaseTexture>Loads a glTF texture info.
Parameters
- context: string
The context when loading the asset
- textureInfo: ITextureInfo
The glTF texture info property
- 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
- context: string
load Uri Async
-
loadUriAsync(
context: string,
property: IProperty,
uri: string,
): Promise<ArrayBufferView<ArrayBufferLike>>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<ArrayBufferLike>>
A promise that resolves with the loaded data when the load is complete
- context: string
log
-
Logs a message
Parameters
- message: string
The message to log
Returns void
- message: string
log Close
-
Decrements the indentation level.
Returns void
log Open
-
Increments the indentation level and logs a message.
Parameters
- message: string
The message to log
Returns void
- message: string
start Performance Counter
-
Starts a performance counter.
Parameters
- counterName: string
The name of the performance counter
Returns void
- counterName: string
StaticAdd Pointer Metadata
-
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
- babylonObject: IWithMetadata
StaticLoad Extension Async
-
LoadExtensionAsync<TExtension = unknown, TResult = void>(
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 = unknown
- 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
Returns Nullable<Promise<TResult>>
The promise returned by actionAsync or null if the extension does not exist
StaticLoad Extra Async
-
LoadExtraAsync<TExtra = unknown, TResult = void>(
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 = unknown
- TResult = void
Parameters
Returns Nullable<Promise<TResult>>
The promise returned by actionAsync or null if the extra does not exist
StaticRegister Extension
-
Registers a loader extension.
Parameters
- name: string
The name of the loader extension.
- factory: GLTFExtensionFactory
The factory function that creates the loader extension.
Returns void
- name: string
The glTF 2.0 loader