Interface IGLTFLoaderExtension
enabled: boolean;
name: string;
order?: number;
createMaterial?(
context: string,
material: IMaterial,
babylonDrawMode: number,
): Nullable<Material>;
loadAnimationAsync?(
context: string,
animation: IAnimation,
): Nullable<Promise<AnimationGroup>>;
loadBufferAsync?(
context: string,
buffer: IBuffer,
byteOffset: number,
byteLength: number,
): Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>;
loadBufferViewAsync?(
context: string,
bufferView: IBufferView,
): Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>;
loadCameraAsync?(
context: string,
camera: ICamera,
assign: (babylonCamera: Camera) => void,
): Nullable<Promise<Camera>>;
loadMaterialPropertiesAsync?(
context: string,
material: IMaterial,
babylonMaterial: Material,
): Nullable<Promise<void>>;
loadNodeAsync?(
context: string,
node: GLTF2.INode,
assign: (babylonMesh: TransformNode) => void,
): Nullable<Promise<TransformNode>>;
loadSceneAsync?(context: string, scene: IScene): Nullable<Promise<void>>;
loadTextureInfoAsync?(
context: string,
textureInfo: ITextureInfo,
assign: (babylonTexture: BaseTexture) => void,
): Nullable<Promise<BaseTexture>>;
onLoading?(): void;
onReady?(): void | Promise<void>;
}
Hierarchy (View Summary)
- IGLTFLoaderExtension
- WebXRSpatialLayerType
- IGLTFLoaderExtension
Implemented by
- GLTF2.EXT_lights_area
- EXT_lights_ies
- EXT_lights_image_based
- GLTF2.EXT_mesh_gpu_instancing
- EXT_meshopt_compression
- GLTF2.EXT_texture_avif
- GLTF2.EXT_texture_webp
- ExtrasAsMetadata
- KHR_animation_pointer
- GLTF2.KHR_draco_mesh_compression
- KHR_gaussian_splatting
- GLTF2.KHR_interactivity
- KHR_lights
- KHR_materials_anisotropy
- KHR_materials_clearcoat
- KHR_materials_coat
- KHR_materials_diffuse_roughness
- GLTF2.KHR_materials_diffuse_transmission
- GLTF2.KHR_materials_dispersion
- GLTF2.KHR_materials_emissive_strength
- KHR_materials_fuzz
- GLTF2.KHR_materials_ior
- KHR_materials_iridescence
- KHR_materials_pbrSpecularGlossiness
- KHR_materials_sheen
- GLTF2.KHR_materials_specular
- GLTF2.KHR_materials_transmission
- KHR_materials_unlit
- KHR_materials_variants
- GLTF2.KHR_materials_volume
- GLTF2.KHR_materials_volume_scatter
- KHR_mesh_quantization
- KHR_node_hoverability
- KHR_node_selectability
- KHR_node_visibility
- GLTF2.KHR_texture_basisu
- KHR_texture_transform
- KHR_xmp_json_ld
- MSFT_audio_emitter
- MSFT_lod
Properties
enabled
Defines whether this extension is enabled.
Readonlyname
The name of this extension.
Optionalorder
Defines the order of this extension. The loader sorts the extensions using these values when loading.
Methods
Optionalcreate Material
-
createMaterial?(
context: string,
material: IMaterial,
babylonDrawMode: number,
): Nullable<Material>Define this method to modify the default behavior when creating materials.
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 Nullable<Material>
The Babylon material or null if not handled
- context: string
Optionalload Animation Async
-
Define this method to modify the default behavior when loading animations.
Parameters
- context: string
The context when loading the asset
- animation: IAnimation
The glTF animation property
Returns Nullable<Promise<AnimationGroup>>
A promise that resolves with the loaded Babylon animation group when the load is complete or null if not handled
- context: string
Optionalload Buffer Async
-
loadBufferAsync?(
context: string,
buffer: IBuffer,
byteOffset: number,
byteLength: number,
): Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>Define this method to modify the default behavior when loading buffers.
Parameters
- context: string
The context when loading the asset
- buffer: IBuffer
The glTF buffer property
- byteOffset: number
The byte offset to load
- byteLength: number
The byte length to load
Returns Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>
A promise that resolves with the loaded data when the load is complete or null if not handled
- context: string
Optionalload Buffer View Async
-
loadBufferViewAsync?(
context: string,
bufferView: IBufferView,
): Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>Define this method to modify the default behavior when loading buffer views.
Parameters
- context: string
The context when loading the asset
- bufferView: IBufferView
The glTF buffer view property
Returns Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>
A promise that resolves with the loaded data when the load is complete or null if not handled
- context: string
Optionalload Camera Async
-
loadCameraAsync?(
context: string,
camera: ICamera,
assign: (babylonCamera: Camera) => void,
): Nullable<Promise<Camera>>Define this method to modify the default behavior when loading cameras.
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 Nullable<Promise<Camera>>
A promise that resolves with the loaded Babylon camera when the load is complete or null if not handled
- context: string
Optionalload Material Properties Async
-
loadMaterialPropertiesAsync?(
context: string,
material: IMaterial,
babylonMaterial: Material,
): Nullable<Promise<void>>Define this method to modify the default behavior when loading material properties.
Parameters
- context: string
The context when loading the asset
- material: IMaterial
The glTF material property
- babylonMaterial: Material
The Babylon material
Returns Nullable<Promise<void>>
A promise that resolves when the load is complete or null if not handled
- context: string
Optionalload Node Async
-
loadNodeAsync?(
context: string,
node: GLTF2.INode,
assign: (babylonMesh: TransformNode) => void,
): Nullable<Promise<TransformNode>>Define this method to modify the default behavior when loading nodes.
Parameters
Returns Nullable<Promise<TransformNode>>
A promise that resolves with the loaded Babylon transform node when the load is complete or null if not handled
Optionalload Scene Async
-
Define this method to modify the default behavior when loading scenes.
Parameters
- context: string
The context when loading the asset
- scene: IScene
The glTF scene property
Returns Nullable<Promise<void>>
A promise that resolves when the load is complete or null if not handled
- context: string
Optionalload Texture Info Async
-
loadTextureInfoAsync?(
context: string,
textureInfo: ITextureInfo,
assign: (babylonTexture: BaseTexture) => void,
): Nullable<Promise<BaseTexture>>Define this method to modify the default behavior when loading texture infos.
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 Nullable<Promise<BaseTexture>>
A promise that resolves with the loaded Babylon texture when the load is complete or null if not handled
- context: string
Optionalon Loading
-
Called after the loader state changes to LOADING.
Returns void
Optionalon Ready
-
Called after the loader state changes to READY.
Returns void | Promise<void>
a promise when the extension has asynchronous readiness work
Interface for a glTF loader extension.