Class GLTFFileLoader
Hierarchy
- GLTFFileLoader
Implements
Index
Constructors
Properties
- always
Compute Bounding Box - always
Compute Skeleton Root Node - animation
Start Mode - compile
Materials - compile
Shadow Generators - coordinate
System Mode - create
Instances - load
All Materials - load
Only Materials - name
- on
Camera Loaded Observable - on
Complete Observable - on
Dispose Observable - on
Error Observable - on
Extension Loaded Observable - on
Loader State Changed Observable - on
Material Loaded Observable - on
Mesh Loaded Observable - on
Parsed Observable - on
Skin Loaded Observable - on
Texture Loaded Observable - on
Validated Observable - preprocess
Url Async - skip
Materials - target
Fps - transparency
As Coverage - use
Clip Plane - use
Range Requests - useSRGBBuffers
- validate
Accessors
Methods
Constructors
constructor
Returns GLTFFileLoader
Properties
always Compute Bounding BoxSearch playground for alwaysComputeBoundingBox
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.
always Compute Skeleton Root NodeSearch playground for alwaysComputeSkeletonRootNode
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.
animation Start ModeSearch playground for animationStartMode
The animation start mode. Defaults to FIRST.
compile MaterialsSearch playground for compileMaterials
Defines if the loader should compile materials before raising the success callback. Defaults to false.
compile Shadow GeneratorsSearch playground for compileShadowGenerators
Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
coordinate System ModeSearch playground for coordinateSystemMode
The coordinate system mode. Defaults to AUTO.
create InstancesSearch playground for createInstances
Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.
load All MaterialsSearch playground for loadAllMaterials
If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.
load Only MaterialsSearch playground for loadOnlyMaterials
If true, load only the materials defined in the file. Defaults to false.
nameSearch playground for name
Name of the loader ("gltf")
Readonly on Camera Loaded ObservableSearch playground for onCameraLoadedObservable
Observable raised when the loader creates a camera after parsing the glTF properties of the camera.
Readonly on Complete ObservableSearch playground for onCompleteObservable
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.
Readonly on Dispose ObservableSearch playground for onDisposeObservable
Observable raised after the loader is disposed.
Readonly on Error ObservableSearch playground for onErrorObservable
Observable raised when an error occurs.
Readonly on Extension Loaded ObservableSearch playground for onExtensionLoadedObservable
Observable raised after a loader extension is created. Set additional options for a loader extension in this event.
on Loader State Changed ObservableSearch playground for onLoaderStateChangedObservable
Observable raised when the loader state changes.
Readonly on Material Loaded ObservableSearch playground for onMaterialLoadedObservable
Observable raised when the loader creates a material after parsing the glTF properties of the material.
Readonly on Mesh Loaded ObservableSearch playground for onMeshLoadedObservable
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, ...)
on Parsed ObservableSearch playground for onParsedObservable
Raised when the asset has been parsed
Readonly on Skin Loaded ObservableSearch playground for onSkinLoadedObservable
Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
Readonly on Texture Loaded ObservableSearch playground for onTextureLoadedObservable
Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
Readonly on Validated ObservableSearch playground for onValidatedObservable
Observable raised after validation when validate is set to true. The event data is the result of the validation.
preprocess Url AsyncSearch playground for preprocessUrlAsync
Type declaration
Function called before loading a url referenced by the asset.
Parameters
url: string
Returns Promise<string>
skip MaterialsSearch playground for skipMaterials
If true, do not load any materials defined in the file. Defaults to false.
target FpsSearch playground for targetFps
When loading glTF animations, which are defined in seconds, target them to this FPS. Defaults to 60.
transparency As CoverageSearch playground for transparencyAsCoverage
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.
use Clip PlaneSearch playground for useClipPlane
Defines if the loader should also compile materials with clip planes. Defaults to false.
use Range RequestsSearch playground for useRangeRequests
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.
useSRGBBuffersSearch playground for useSRGBBuffers
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.
validateSearch playground for validate
Defines if the loader should validate the asset.
Accessors
capture Performance Counters
Defines if the loader should capture performance counters.
Returns boolean
Defines if the loader should capture performance counters.
Parameters
value: boolean
Returns void
loader State
The loader state or null if the loader is not active.
Returns Nullable<GLTFLoaderState>
logging Enabled
Defines if the loader logging is enabled.
Returns boolean
Defines if the loader logging is enabled.
Parameters
value: boolean
Returns void
on Camera Loaded
on Complete
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)
Returns void
Returns void
on Dispose
Callback raised after the loader is disposed.
Parameters
callback: (() => void)
Returns void
Returns void
on Error
Callback raised when an error occurs.
Parameters
callback: ((reason: any) => void)
Parameters
reason: any
Returns void
Returns void
on Extension Loaded
Callback raised after a loader extension is created.
Parameters
callback: ((extension: BABYLON.IGLTFLoaderExtension) => void)
Parameters
extension: BABYLON.IGLTFLoaderExtension
Returns void
Returns void
on Material Loaded
on Mesh Loaded
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
callback: ((mesh: AbstractMesh) => void)
Parameters
mesh: AbstractMesh
Returns void
Returns void
on Parsed
Raised when the asset has been parsed
Parameters
callback: ((loaderData: IGLTFLoaderData) => void)
Parameters
loaderData: IGLTFLoaderData
Returns void
Returns void
on Texture Loaded
Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
Parameters
callback: ((texture: BaseTexture) => void)
Parameters
texture: BaseTexture
Returns void
Returns void
on Validated
Callback raised after a loader extension is created.
Parameters
callback: ((results: IGLTFValidationResults) => void)
Parameters
results: IGLTFValidationResults
Returns void
Returns void
Methods
disposeSearch playground for dispose
Disposes the loader, releases resources during load, and cancels any outstanding requests.
Returns void
Optional rewrite RootURLSearch playground for rewriteRootURL
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
when Complete AsyncSearch playground for whenCompleteAsync
Returns a promise that resolves when the asset is completely loaded.
Returns Promise<void>
a promise that resolves when the asset is completely loaded.
File loader for loading glTF files into a scene.