|
@@ -103,6 +103,9 @@ declare module BABYLON {
|
|
|
|
|
|
|
|
|
|
declare module BABYLON {
|
|
declare module BABYLON {
|
|
|
|
+ /**
|
|
|
|
+ * Coordinate system mode that will be used when loading from the gltf file
|
|
|
|
+ */
|
|
enum GLTFLoaderCoordinateSystemMode {
|
|
enum GLTFLoaderCoordinateSystemMode {
|
|
/**
|
|
/**
|
|
* Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
|
|
* Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
|
|
@@ -113,6 +116,9 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
FORCE_RIGHT_HANDED = 1,
|
|
FORCE_RIGHT_HANDED = 1,
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Animation mode that determines which animations should be started when a file is loaded
|
|
|
|
+ */
|
|
enum GLTFLoaderAnimationStartMode {
|
|
enum GLTFLoaderAnimationStartMode {
|
|
/**
|
|
/**
|
|
* No animation will start.
|
|
* No animation will start.
|
|
@@ -127,10 +133,22 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
ALL = 2,
|
|
ALL = 2,
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loaded gltf data
|
|
|
|
+ */
|
|
interface IGLTFLoaderData {
|
|
interface IGLTFLoaderData {
|
|
|
|
+ /**
|
|
|
|
+ * Loaded json string converted to an object
|
|
|
|
+ */
|
|
json: Object;
|
|
json: Object;
|
|
|
|
+ /**
|
|
|
|
+ * Loaded ArrayBufferView
|
|
|
|
+ */
|
|
bin: Nullable<ArrayBufferView>;
|
|
bin: Nullable<ArrayBufferView>;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Gltf extension interface
|
|
|
|
+ */
|
|
interface IGLTFLoaderExtension {
|
|
interface IGLTFLoaderExtension {
|
|
/**
|
|
/**
|
|
* The name of this extension.
|
|
* The name of this extension.
|
|
@@ -141,6 +159,9 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
enabled: boolean;
|
|
enabled: boolean;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loading state
|
|
|
|
+ */
|
|
enum GLTFLoaderState {
|
|
enum GLTFLoaderState {
|
|
/**
|
|
/**
|
|
* The asset is loading.
|
|
* The asset is loading.
|
|
@@ -155,29 +176,77 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
COMPLETE = 2,
|
|
COMPLETE = 2,
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * GLTF loader interface
|
|
|
|
+ */
|
|
interface IGLTFLoader extends IDisposable {
|
|
interface IGLTFLoader extends IDisposable {
|
|
|
|
+ /**
|
|
|
|
+ * Coordinate system that will be used when loading from the gltf file
|
|
|
|
+ */
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
|
|
+ /**
|
|
|
|
+ * Animation mode that determines which animations should be started when a file is loaded
|
|
|
|
+ */
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
|
|
+ /**
|
|
|
|
+ * If the materials in the file should automatically be compiled
|
|
|
|
+ */
|
|
compileMaterials: boolean;
|
|
compileMaterials: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * If a clip plane should be usede when loading meshes in the file
|
|
|
|
+ */
|
|
useClipPlane: boolean;
|
|
useClipPlane: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * If shadow generators should automatically be compiled
|
|
|
|
+ */
|
|
compileShadowGenerators: boolean;
|
|
compileShadowGenerators: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires each time a mesh is loaded
|
|
|
|
+ */
|
|
onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires each time a texture is loaded
|
|
|
|
+ */
|
|
onTextureLoadedObservable: Observable<BaseTexture>;
|
|
onTextureLoadedObservable: Observable<BaseTexture>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires each time a material is loaded
|
|
|
|
+ */
|
|
onMaterialLoadedObservable: Observable<Material>;
|
|
onMaterialLoadedObservable: Observable<Material>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires when the load has completed
|
|
|
|
+ */
|
|
onCompleteObservable: Observable<IGLTFLoader>;
|
|
onCompleteObservable: Observable<IGLTFLoader>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires when the loader is disposed
|
|
|
|
+ */
|
|
onDisposeObservable: Observable<IGLTFLoader>;
|
|
onDisposeObservable: Observable<IGLTFLoader>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fire when an extension is loaded
|
|
|
|
+ */
|
|
onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
|
|
+ /**
|
|
|
|
+ * Loader state
|
|
|
|
+ */
|
|
state: Nullable<GLTFLoaderState>;
|
|
state: Nullable<GLTFLoaderState>;
|
|
|
|
+ /**
|
|
|
|
+ * Imports one or more meshes from a loaded gltf file and adds them to the scene
|
|
|
|
+ */
|
|
importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<{
|
|
importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<{
|
|
meshes: AbstractMesh[];
|
|
meshes: AbstractMesh[];
|
|
particleSystems: ParticleSystem[];
|
|
particleSystems: ParticleSystem[];
|
|
skeletons: Skeleton[];
|
|
skeletons: Skeleton[];
|
|
animationGroups: AnimationGroup[];
|
|
animationGroups: AnimationGroup[];
|
|
}>;
|
|
}>;
|
|
|
|
+ /**
|
|
|
|
+ * Imports all objects from a loaded gltf file and adds them to the scene
|
|
|
|
+ */
|
|
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<void>;
|
|
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<void>;
|
|
}
|
|
}
|
|
|
|
+ /** File loader to load gltf files into a babylon scene */
|
|
class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
|
|
+ /** Creates a gltf 1.0 file loader */
|
|
static CreateGLTFLoaderV1: () => IGLTFLoader;
|
|
static CreateGLTFLoaderV1: () => IGLTFLoader;
|
|
|
|
+ /** Creates a gltf 2.0 file loader */
|
|
static CreateGLTFLoaderV2: () => IGLTFLoader;
|
|
static CreateGLTFLoaderV2: () => IGLTFLoader;
|
|
/**
|
|
/**
|
|
* Raised when the asset has been parsed.
|
|
* Raised when the asset has been parsed.
|
|
@@ -186,27 +255,39 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
onParsedObservable: Observable<IGLTFLoaderData>;
|
|
onParsedObservable: Observable<IGLTFLoaderData>;
|
|
private _onParsedObserver;
|
|
private _onParsedObserver;
|
|
|
|
+ /** Raised when the asset has been parsed. */
|
|
onParsed: (loaderData: IGLTFLoaderData) => void;
|
|
onParsed: (loaderData: IGLTFLoaderData) => void;
|
|
|
|
+ /**
|
|
|
|
+ * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders. Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled. Defaults to true.
|
|
|
|
+ */
|
|
static IncrementalLoading: boolean;
|
|
static IncrementalLoading: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters. Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates
|
|
|
|
+ */
|
|
static HomogeneousCoordinates: boolean;
|
|
static HomogeneousCoordinates: boolean;
|
|
/**
|
|
/**
|
|
- * The coordinate system mode (AUTO, FORCE_RIGHT_HANDED).
|
|
|
|
|
|
+ * The coordinate system mode (AUTO, FORCE_RIGHT_HANDED). Defaults to AUTO.
|
|
|
|
+ * - AUTO - Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
|
|
|
|
+ * - FORCE_RIGHT_HANDED - Sets the useRightHandedSystem flag on the scene.
|
|
*/
|
|
*/
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
/**
|
|
/**
|
|
- * The animation start mode (NONE, FIRST, ALL).
|
|
|
|
- */
|
|
|
|
|
|
+ * The animation start mode (NONE, FIRST, ALL). Defaults to FIRST.
|
|
|
|
+ * - NONE - No animation will start.
|
|
|
|
+ * - FIRST - The first animation will start.
|
|
|
|
+ * - ALL - All animations will start.
|
|
|
|
+ */
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
/**
|
|
/**
|
|
- * Set to true to compile materials before raising the success callback.
|
|
|
|
|
|
+ * Set to true to compile materials before raising the success callback. Defaults to false.
|
|
*/
|
|
*/
|
|
compileMaterials: boolean;
|
|
compileMaterials: boolean;
|
|
/**
|
|
/**
|
|
- * Set to true to also compile materials with clip planes.
|
|
|
|
|
|
+ * Set to true to also compile materials with clip planes. Defaults to false.
|
|
*/
|
|
*/
|
|
useClipPlane: boolean;
|
|
useClipPlane: boolean;
|
|
/**
|
|
/**
|
|
- * Set to true to compile shadow generators before raising the success callback.
|
|
|
|
|
|
+ * Set to true to compile shadow generators before raising the success callback. Defaults to false.
|
|
*/
|
|
*/
|
|
compileShadowGenerators: boolean;
|
|
compileShadowGenerators: boolean;
|
|
/**
|
|
/**
|
|
@@ -214,18 +295,27 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
readonly onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
readonly onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
private _onMeshLoadedObserver;
|
|
private _onMeshLoadedObserver;
|
|
|
|
+ /**
|
|
|
|
+ * Raised when the loader creates a mesh after parsing the glTF properties of the mesh. (onMeshLoadedObservable is likely desired instead.)
|
|
|
|
+ */
|
|
onMeshLoaded: (mesh: AbstractMesh) => void;
|
|
onMeshLoaded: (mesh: AbstractMesh) => void;
|
|
/**
|
|
/**
|
|
* Raised when the loader creates a texture after parsing the glTF properties of the texture.
|
|
* Raised when the loader creates a texture after parsing the glTF properties of the texture.
|
|
*/
|
|
*/
|
|
readonly onTextureLoadedObservable: Observable<BaseTexture>;
|
|
readonly onTextureLoadedObservable: Observable<BaseTexture>;
|
|
private _onTextureLoadedObserver;
|
|
private _onTextureLoadedObserver;
|
|
|
|
+ /**
|
|
|
|
+ * Method called when a texture has been loaded (onTextureLoadedObservable is likely desired instead.)
|
|
|
|
+ */
|
|
onTextureLoaded: (texture: BaseTexture) => void;
|
|
onTextureLoaded: (texture: BaseTexture) => void;
|
|
/**
|
|
/**
|
|
* Raised when the loader creates a material after parsing the glTF properties of the material.
|
|
* Raised when the loader creates a material after parsing the glTF properties of the material.
|
|
*/
|
|
*/
|
|
readonly onMaterialLoadedObservable: Observable<Material>;
|
|
readonly onMaterialLoadedObservable: Observable<Material>;
|
|
private _onMaterialLoadedObserver;
|
|
private _onMaterialLoadedObserver;
|
|
|
|
+ /**
|
|
|
|
+ * Method when the loader creates a material after parsing the glTF properties of the material. (onMaterialLoadedObservable is likely desired instead.)
|
|
|
|
+ */
|
|
onMaterialLoaded: (material: Material) => void;
|
|
onMaterialLoaded: (material: Material) => void;
|
|
/**
|
|
/**
|
|
* Raised when the asset is completely loaded, immediately before the loader is disposed.
|
|
* Raised when the asset is completely loaded, immediately before the loader is disposed.
|
|
@@ -234,12 +324,18 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
readonly onCompleteObservable: Observable<GLTFFileLoader>;
|
|
readonly onCompleteObservable: Observable<GLTFFileLoader>;
|
|
private _onCompleteObserver;
|
|
private _onCompleteObserver;
|
|
|
|
+ /**
|
|
|
|
+ * Raised when the asset is completely loaded, immediately before the loader is disposed. (onCompleteObservable is likely desired instead.)
|
|
|
|
+ */
|
|
onComplete: () => void;
|
|
onComplete: () => void;
|
|
/**
|
|
/**
|
|
* Raised after the loader is disposed.
|
|
* Raised after the loader is disposed.
|
|
*/
|
|
*/
|
|
readonly onDisposeObservable: Observable<GLTFFileLoader>;
|
|
readonly onDisposeObservable: Observable<GLTFFileLoader>;
|
|
private _onDisposeObserver;
|
|
private _onDisposeObserver;
|
|
|
|
+ /**
|
|
|
|
+ * Raised after the loader is disposed. (onDisposeObservable is likely desired instead.)
|
|
|
|
+ */
|
|
onDispose: () => void;
|
|
onDispose: () => void;
|
|
/**
|
|
/**
|
|
* Raised after a loader extension is created.
|
|
* Raised after a loader extension is created.
|
|
@@ -247,6 +343,9 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
private _onExtensionLoadedObserver;
|
|
private _onExtensionLoadedObserver;
|
|
|
|
+ /**
|
|
|
|
+ * Raised after a loader extension is created. (onExtensionLoadedObservable is likely desired instead.)
|
|
|
|
+ */
|
|
onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
|
|
onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
|
|
/**
|
|
/**
|
|
* Returns a promise that resolves when the asset is completely loaded.
|
|
* Returns a promise that resolves when the asset is completely loaded.
|
|
@@ -258,22 +357,65 @@ declare module BABYLON {
|
|
*/
|
|
*/
|
|
readonly loaderState: Nullable<GLTFLoaderState>;
|
|
readonly loaderState: Nullable<GLTFLoaderState>;
|
|
private _loader;
|
|
private _loader;
|
|
|
|
+ /**
|
|
|
|
+ * Name of the loader ("gltf")
|
|
|
|
+ */
|
|
name: string;
|
|
name: string;
|
|
|
|
+ /**
|
|
|
|
+ * Supported file extensions of the loader (.gltf, .glb)
|
|
|
|
+ */
|
|
extensions: ISceneLoaderPluginExtensions;
|
|
extensions: ISceneLoaderPluginExtensions;
|
|
/**
|
|
/**
|
|
* Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
|
* Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
|
*/
|
|
*/
|
|
dispose(): void;
|
|
dispose(): void;
|
|
|
|
+ /**
|
|
|
|
+ * Imports one or more meshes from a loaded gltf file and adds them to the scene
|
|
|
|
+ * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
|
|
|
|
+ * @param scene the scene the meshes should be added to
|
|
|
|
+ * @param data gltf data containing information of the meshes in a loaded file
|
|
|
|
+ * @param rootUrl root url to load from
|
|
|
|
+ * @param onProgress event that fires when loading progress has occured
|
|
|
|
+ * @returns a promise containg the loaded meshes, particles, skeletons and animations
|
|
|
|
+ */
|
|
importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
meshes: AbstractMesh[];
|
|
meshes: AbstractMesh[];
|
|
particleSystems: ParticleSystem[];
|
|
particleSystems: ParticleSystem[];
|
|
skeletons: Skeleton[];
|
|
skeletons: Skeleton[];
|
|
animationGroups: AnimationGroup[];
|
|
animationGroups: AnimationGroup[];
|
|
}>;
|
|
}>;
|
|
|
|
+ /**
|
|
|
|
+ * Imports all objects from a loaded gltf file and adds them to the scene
|
|
|
|
+ * @param scene the scene the objects should be added to
|
|
|
|
+ * @param data gltf data containing information of the meshes in a loaded file
|
|
|
|
+ * @param rootUrl root url to load from
|
|
|
|
+ * @param onProgress event that fires when loading progress has occured
|
|
|
|
+ * @returns a promise which completes when objects have been loaded to the scene
|
|
|
|
+ */
|
|
loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
|
|
loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
|
|
|
|
+ /**
|
|
|
|
+ * Load into an asset container.
|
|
|
|
+ * @param scene The scene to load into
|
|
|
|
+ * @param data The data to import
|
|
|
|
+ * @param rootUrl The root url for scene and resources
|
|
|
|
+ * @param onProgress The callback when the load progresses
|
|
|
|
+ * @returns The loaded asset container
|
|
|
|
+ */
|
|
loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<AssetContainer>;
|
|
loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<AssetContainer>;
|
|
|
|
+ /**
|
|
|
|
+ * If the data string can be loaded directly
|
|
|
|
+ * @param data string contianing the file data
|
|
|
|
+ * @returns if the data can be loaded directly
|
|
|
|
+ */
|
|
canDirectLoad(data: string): boolean;
|
|
canDirectLoad(data: string): boolean;
|
|
|
|
+ /**
|
|
|
|
+ * Rewrites a url by combining a root url and response url
|
|
|
|
+ */
|
|
rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
|
|
rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
|
|
|
|
+ /**
|
|
|
|
+ * Instantiates a gltf file loader plugin
|
|
|
|
+ * @returns the created plugin
|
|
|
|
+ */
|
|
createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
|
|
createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
|
|
private _parse(data);
|
|
private _parse(data);
|
|
private _getLoader(loaderData);
|
|
private _getLoader(loaderData);
|
|
@@ -690,9 +832,21 @@ declare module BABYLON.GLTF1 {
|
|
onMaterialLoadedObservable: Observable<Material>;
|
|
onMaterialLoadedObservable: Observable<Material>;
|
|
onCompleteObservable: Observable<IGLTFLoader>;
|
|
onCompleteObservable: Observable<IGLTFLoader>;
|
|
onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
|
|
+ /**
|
|
|
|
+ * State of the loader
|
|
|
|
+ */
|
|
state: Nullable<GLTFLoaderState>;
|
|
state: Nullable<GLTFLoaderState>;
|
|
dispose(): void;
|
|
dispose(): void;
|
|
private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
|
|
private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
|
|
|
|
+ /**
|
|
|
|
+ * Imports one or more meshes from a loaded gltf file and adds them to the scene
|
|
|
|
+ * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
|
|
|
|
+ * @param scene the scene the meshes should be added to
|
|
|
|
+ * @param data gltf data containing information of the meshes in a loaded file
|
|
|
|
+ * @param rootUrl root url to load from
|
|
|
|
+ * @param onProgress event that fires when loading progress has occured
|
|
|
|
+ * @returns a promise containg the loaded meshes, particles, skeletons and animations
|
|
|
|
+ */
|
|
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
meshes: AbstractMesh[];
|
|
meshes: AbstractMesh[];
|
|
particleSystems: ParticleSystem[];
|
|
particleSystems: ParticleSystem[];
|
|
@@ -700,6 +854,14 @@ declare module BABYLON.GLTF1 {
|
|
animationGroups: AnimationGroup[];
|
|
animationGroups: AnimationGroup[];
|
|
}>;
|
|
}>;
|
|
private _loadAsync(scene, data, rootUrl, onSuccess, onProgress?, onError?);
|
|
private _loadAsync(scene, data, rootUrl, onSuccess, onProgress?, onError?);
|
|
|
|
+ /**
|
|
|
|
+ * Imports all objects from a loaded gltf file and adds them to the scene
|
|
|
|
+ * @param scene the scene the objects should be added to
|
|
|
|
+ * @param data gltf data containing information of the meshes in a loaded file
|
|
|
|
+ * @param rootUrl root url to load from
|
|
|
|
+ * @param onProgress event that fires when loading progress has occured
|
|
|
|
+ * @returns a promise which completes when objects have been loaded to the scene
|
|
|
|
+ */
|
|
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
|
|
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
|
|
private _loadShadersAsync(gltfRuntime, onload);
|
|
private _loadShadersAsync(gltfRuntime, onload);
|
|
private _loadBuffersAsync(gltfRuntime, onLoad, onProgress?);
|
|
private _loadBuffersAsync(gltfRuntime, onLoad, onProgress?);
|
|
@@ -844,48 +1006,84 @@ declare module BABYLON.GLTF1 {
|
|
|
|
|
|
|
|
|
|
declare module BABYLON.GLTF2 {
|
|
declare module BABYLON.GLTF2 {
|
|
|
|
+ /** Array item which contains it's index in an array */
|
|
interface IArrayItem {
|
|
interface IArrayItem {
|
|
_index: number;
|
|
_index: number;
|
|
}
|
|
}
|
|
|
|
+ /** Array item helper methods */
|
|
class ArrayItem {
|
|
class ArrayItem {
|
|
|
|
+ /** Sets the index of each array element to its index in the array */
|
|
static Assign(values?: IArrayItem[]): void;
|
|
static Assign(values?: IArrayItem[]): void;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * GLTF2 module for babylon
|
|
|
|
+ */
|
|
declare module BABYLON.GLTF2 {
|
|
declare module BABYLON.GLTF2 {
|
|
|
|
+ /**
|
|
|
|
+ * Interface to access data and vertex buffer associated with a file
|
|
|
|
+ */
|
|
interface ILoaderAccessor extends IAccessor, IArrayItem {
|
|
interface ILoaderAccessor extends IAccessor, IArrayItem {
|
|
_data?: Promise<ArrayBufferView>;
|
|
_data?: Promise<ArrayBufferView>;
|
|
_babylonVertexBuffer?: Promise<VertexBuffer>;
|
|
_babylonVertexBuffer?: Promise<VertexBuffer>;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader's animation channel
|
|
|
|
+ */
|
|
interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem {
|
|
interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem {
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Container for animation keyframe data
|
|
|
|
+ */
|
|
interface ILoaderAnimationSamplerData {
|
|
interface ILoaderAnimationSamplerData {
|
|
input: Float32Array;
|
|
input: Float32Array;
|
|
interpolation: AnimationSamplerInterpolation;
|
|
interpolation: AnimationSamplerInterpolation;
|
|
output: Float32Array;
|
|
output: Float32Array;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Keyframe data
|
|
|
|
+ */
|
|
interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem {
|
|
interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem {
|
|
_data: Promise<ILoaderAnimationSamplerData>;
|
|
_data: Promise<ILoaderAnimationSamplerData>;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader animation
|
|
|
|
+ */
|
|
interface ILoaderAnimation extends IAnimation, IArrayItem {
|
|
interface ILoaderAnimation extends IAnimation, IArrayItem {
|
|
channels: ILoaderAnimationChannel[];
|
|
channels: ILoaderAnimationChannel[];
|
|
samplers: ILoaderAnimationSampler[];
|
|
samplers: ILoaderAnimationSampler[];
|
|
_babylonAnimationGroup?: AnimationGroup;
|
|
_babylonAnimationGroup?: AnimationGroup;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader buffer
|
|
|
|
+ */
|
|
interface ILoaderBuffer extends IBuffer, IArrayItem {
|
|
interface ILoaderBuffer extends IBuffer, IArrayItem {
|
|
_data?: Promise<ArrayBufferView>;
|
|
_data?: Promise<ArrayBufferView>;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader's buffer data
|
|
|
|
+ */
|
|
interface ILoaderBufferView extends IBufferView, IArrayItem {
|
|
interface ILoaderBufferView extends IBufferView, IArrayItem {
|
|
_data?: Promise<ArrayBufferView>;
|
|
_data?: Promise<ArrayBufferView>;
|
|
_babylonBuffer?: Promise<Buffer>;
|
|
_babylonBuffer?: Promise<Buffer>;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader's loaded camera data
|
|
|
|
+ */
|
|
interface ILoaderCamera extends ICamera, IArrayItem {
|
|
interface ILoaderCamera extends ICamera, IArrayItem {
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loaded image specified by url
|
|
|
|
+ */
|
|
interface ILoaderImage extends IImage, IArrayItem {
|
|
interface ILoaderImage extends IImage, IArrayItem {
|
|
_objectURL?: Promise<string>;
|
|
_objectURL?: Promise<string>;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loaded material data
|
|
|
|
+ */
|
|
interface ILoaderMaterial extends IMaterial, IArrayItem {
|
|
interface ILoaderMaterial extends IMaterial, IArrayItem {
|
|
_babylonData?: {
|
|
_babylonData?: {
|
|
[drawMode: number]: {
|
|
[drawMode: number]: {
|
|
@@ -895,11 +1093,20 @@ declare module BABYLON.GLTF2 {
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader mesh data
|
|
|
|
+ */
|
|
interface ILoaderMesh extends IMesh, IArrayItem {
|
|
interface ILoaderMesh extends IMesh, IArrayItem {
|
|
primitives: ILoaderMeshPrimitive[];
|
|
primitives: ILoaderMeshPrimitive[];
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader mesh data
|
|
|
|
+ */
|
|
interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem {
|
|
interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem {
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Node for traversing loader data
|
|
|
|
+ */
|
|
interface ILoaderNode extends INode, IArrayItem {
|
|
interface ILoaderNode extends INode, IArrayItem {
|
|
_parent: ILoaderNode;
|
|
_parent: ILoaderNode;
|
|
_babylonMesh?: Mesh;
|
|
_babylonMesh?: Mesh;
|
|
@@ -907,23 +1114,41 @@ declare module BABYLON.GLTF2 {
|
|
_babylonAnimationTargets?: Node[];
|
|
_babylonAnimationTargets?: Node[];
|
|
_numMorphTargets?: number;
|
|
_numMorphTargets?: number;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Sampler data
|
|
|
|
+ */
|
|
interface ILoaderSamplerData {
|
|
interface ILoaderSamplerData {
|
|
noMipMaps: boolean;
|
|
noMipMaps: boolean;
|
|
samplingMode: number;
|
|
samplingMode: number;
|
|
wrapU: number;
|
|
wrapU: number;
|
|
wrapV: number;
|
|
wrapV: number;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Sampler data
|
|
|
|
+ */
|
|
interface ILoaderSampler extends ISampler, IArrayItem {
|
|
interface ILoaderSampler extends ISampler, IArrayItem {
|
|
_data?: ILoaderSamplerData;
|
|
_data?: ILoaderSamplerData;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader's scene
|
|
|
|
+ */
|
|
interface ILoaderScene extends IScene, IArrayItem {
|
|
interface ILoaderScene extends IScene, IArrayItem {
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader's skeleton data
|
|
|
|
+ */
|
|
interface ILoaderSkin extends ISkin, IArrayItem {
|
|
interface ILoaderSkin extends ISkin, IArrayItem {
|
|
_babylonSkeleton?: Skeleton;
|
|
_babylonSkeleton?: Skeleton;
|
|
_loaded?: Promise<void>;
|
|
_loaded?: Promise<void>;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loader's texture
|
|
|
|
+ */
|
|
interface ILoaderTexture extends ITexture, IArrayItem {
|
|
interface ILoaderTexture extends ITexture, IArrayItem {
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Loaded GLTF data
|
|
|
|
+ */
|
|
interface ILoaderGLTF extends IGLTF {
|
|
interface ILoaderGLTF extends IGLTF {
|
|
accessors?: ILoaderAccessor[];
|
|
accessors?: ILoaderAccessor[];
|
|
animations?: ILoaderAnimation[];
|
|
animations?: ILoaderAnimation[];
|
|
@@ -942,14 +1167,40 @@ declare module BABYLON.GLTF2 {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+* Defines the GLTF2 module used to import/export GLTF 2.0 files
|
|
|
|
+*/
|
|
declare module BABYLON.GLTF2 {
|
|
declare module BABYLON.GLTF2 {
|
|
|
|
+ /**
|
|
|
|
+ * Interface for a meterial with a constructor
|
|
|
|
+ */
|
|
interface MaterialConstructor<T extends Material> {
|
|
interface MaterialConstructor<T extends Material> {
|
|
|
|
+ /**
|
|
|
|
+ * The material class
|
|
|
|
+ */
|
|
readonly prototype: T;
|
|
readonly prototype: T;
|
|
|
|
+ /**
|
|
|
|
+ * Instatiates a material
|
|
|
|
+ * @param name name of the material
|
|
|
|
+ * @param scene the scene the material will be added to
|
|
|
|
+ */
|
|
new (name: string, scene: Scene): T;
|
|
new (name: string, scene: Scene): T;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Used to load from a GLTF2 file
|
|
|
|
+ */
|
|
class GLTFLoader implements IGLTFLoader {
|
|
class GLTFLoader implements IGLTFLoader {
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_gltf: ILoaderGLTF;
|
|
_gltf: ILoaderGLTF;
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_babylonScene: Scene;
|
|
_babylonScene: Scene;
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_completePromises: Promise<void>[];
|
|
_completePromises: Promise<void>[];
|
|
private _disposed;
|
|
private _disposed;
|
|
private _state;
|
|
private _state;
|
|
@@ -962,26 +1213,87 @@ declare module BABYLON.GLTF2 {
|
|
private _requests;
|
|
private _requests;
|
|
private static _Names;
|
|
private static _Names;
|
|
private static _Factories;
|
|
private static _Factories;
|
|
|
|
+ /**
|
|
|
|
+ * @ignore, registers the loader
|
|
|
|
+ * @param name name of the loader
|
|
|
|
+ * @param factory function that converts a loader to a loader extension
|
|
|
|
+ */
|
|
static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
|
|
static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
|
|
|
|
+ /**
|
|
|
|
+ * Coordinate system that will be used when loading from the gltf file
|
|
|
|
+ */
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
|
|
+ /**
|
|
|
|
+ * Animation mode that determines which animations should be started when a file is loaded
|
|
|
|
+ */
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
|
|
+ /**
|
|
|
|
+ * If the materials in the file should automatically be compiled
|
|
|
|
+ */
|
|
compileMaterials: boolean;
|
|
compileMaterials: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * If a clip plane should be usede when loading meshes in the file
|
|
|
|
+ */
|
|
useClipPlane: boolean;
|
|
useClipPlane: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * If shadow generators should automatically be compiled
|
|
|
|
+ */
|
|
compileShadowGenerators: boolean;
|
|
compileShadowGenerators: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires when the loader is disposed
|
|
|
|
+ */
|
|
readonly onDisposeObservable: Observable<IGLTFLoader>;
|
|
readonly onDisposeObservable: Observable<IGLTFLoader>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires each time a mesh is loaded
|
|
|
|
+ */
|
|
readonly onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
readonly onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires each time a texture is loaded
|
|
|
|
+ */
|
|
readonly onTextureLoadedObservable: Observable<BaseTexture>;
|
|
readonly onTextureLoadedObservable: Observable<BaseTexture>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires each time a material is loaded
|
|
|
|
+ */
|
|
readonly onMaterialLoadedObservable: Observable<Material>;
|
|
readonly onMaterialLoadedObservable: Observable<Material>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires each time an extension is loaded
|
|
|
|
+ */
|
|
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
|
|
+ /**
|
|
|
|
+ * Observable that fires when the load has completed
|
|
|
|
+ */
|
|
readonly onCompleteObservable: Observable<IGLTFLoader>;
|
|
readonly onCompleteObservable: Observable<IGLTFLoader>;
|
|
|
|
+ /**
|
|
|
|
+ * The current state of the loader
|
|
|
|
+ */
|
|
readonly state: Nullable<GLTFLoaderState>;
|
|
readonly state: Nullable<GLTFLoaderState>;
|
|
|
|
+ /**
|
|
|
|
+ * Disposes of the loader
|
|
|
|
+ */
|
|
dispose(): void;
|
|
dispose(): void;
|
|
|
|
+ /**
|
|
|
|
+ * Imports one or more meshes from a loaded gltf file and adds them to the scene
|
|
|
|
+ * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
|
|
|
|
+ * @param scene the scene the meshes should be added to
|
|
|
|
+ * @param data gltf data containing information of the meshes in a loaded file
|
|
|
|
+ * @param rootUrl root url to load from
|
|
|
|
+ * @param onProgress event that fires when loading progress has occured
|
|
|
|
+ * @returns a promise containg the loaded meshes, particles, skeletons and animations
|
|
|
|
+ */
|
|
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
meshes: AbstractMesh[];
|
|
meshes: AbstractMesh[];
|
|
particleSystems: ParticleSystem[];
|
|
particleSystems: ParticleSystem[];
|
|
skeletons: Skeleton[];
|
|
skeletons: Skeleton[];
|
|
animationGroups: AnimationGroup[];
|
|
animationGroups: AnimationGroup[];
|
|
}>;
|
|
}>;
|
|
|
|
+ /**
|
|
|
|
+ * Imports all objects from a loaded gltf file and adds them to the scene
|
|
|
|
+ * @param scene the scene the objects should be added to
|
|
|
|
+ * @param data gltf data containing information of the meshes in a loaded file
|
|
|
|
+ * @param rootUrl root url to load from
|
|
|
|
+ * @param onProgress event that fires when loading progress has occured
|
|
|
|
+ * @returns a promise which completes when objects have been loaded to the scene
|
|
|
|
+ */
|
|
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
|
|
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
|
|
private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
|
|
private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
|
|
private _loadExtensions();
|
|
private _loadExtensions();
|
|
@@ -990,12 +1302,18 @@ declare module BABYLON.GLTF2 {
|
|
private _checkExtensions();
|
|
private _checkExtensions();
|
|
private _createRootNode();
|
|
private _createRootNode();
|
|
private _loadNodesAsync(nodes);
|
|
private _loadNodesAsync(nodes);
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;
|
|
_loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;
|
|
private _forEachPrimitive(node, callback);
|
|
private _forEachPrimitive(node, callback);
|
|
private _getMeshes();
|
|
private _getMeshes();
|
|
private _getSkeletons();
|
|
private _getSkeletons();
|
|
private _getAnimationGroups();
|
|
private _getAnimationGroups();
|
|
private _startAnimations();
|
|
private _startAnimations();
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadNodeAsync(context: string, node: ILoaderNode): Promise<void>;
|
|
_loadNodeAsync(context: string, node: ILoaderNode): Promise<void>;
|
|
private _loadMeshAsync(context, node, mesh, babylonMesh);
|
|
private _loadMeshAsync(context, node, mesh, babylonMesh);
|
|
private _loadPrimitiveAsync(context, node, mesh, primitive, babylonMesh);
|
|
private _loadPrimitiveAsync(context, node, mesh, primitive, babylonMesh);
|
|
@@ -1015,21 +1333,48 @@ declare module BABYLON.GLTF2 {
|
|
private _loadAnimationChannelAsync(context, animationContext, animation, channel, babylonAnimationGroup);
|
|
private _loadAnimationChannelAsync(context, animationContext, animation, channel, babylonAnimationGroup);
|
|
private _loadAnimationSamplerAsync(context, sampler);
|
|
private _loadAnimationSamplerAsync(context, sampler);
|
|
private _loadBufferAsync(context, buffer);
|
|
private _loadBufferAsync(context, buffer);
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadBufferViewAsync(context: string, bufferView: ILoaderBufferView): Promise<ArrayBufferView>;
|
|
_loadBufferViewAsync(context: string, bufferView: ILoaderBufferView): Promise<ArrayBufferView>;
|
|
private _loadAccessorAsync(context, accessor);
|
|
private _loadAccessorAsync(context, accessor);
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadVertexBufferViewAsync(context: string, bufferView: ILoaderBufferView, kind: string): Promise<Buffer>;
|
|
_loadVertexBufferViewAsync(context: string, bufferView: ILoaderBufferView, kind: string): Promise<Buffer>;
|
|
private _loadVertexAccessorAsync(context, accessor, kind);
|
|
private _loadVertexAccessorAsync(context, accessor, kind);
|
|
private _getDefaultMaterial(drawMode);
|
|
private _getDefaultMaterial(drawMode);
|
|
private _loadMaterialMetallicRoughnessPropertiesAsync(context, material, babylonMaterial);
|
|
private _loadMaterialMetallicRoughnessPropertiesAsync(context, material, babylonMaterial);
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Promise<void>;
|
|
_loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Promise<void>;
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_createMaterial<T extends Material>(type: MaterialConstructor<T>, name: string, drawMode: number): T;
|
|
_createMaterial<T extends Material>(type: MaterialConstructor<T>, name: string, drawMode: number): T;
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: PBRMaterial): Promise<void>;
|
|
_loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: PBRMaterial): Promise<void>;
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadMaterialAlphaProperties(context: string, material: ILoaderMaterial, babylonMaterial: PBRMaterial): void;
|
|
_loadMaterialAlphaProperties(context: string, material: ILoaderMaterial, babylonMaterial: PBRMaterial): void;
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadTextureAsync(context: string, textureInfo: ITextureInfo, assign: (texture: Texture) => void): Promise<void>;
|
|
_loadTextureAsync(context: string, textureInfo: ITextureInfo, assign: (texture: Texture) => void): Promise<void>;
|
|
private _loadSampler(context, sampler);
|
|
private _loadSampler(context, sampler);
|
|
private _loadImageAsync(context, image);
|
|
private _loadImageAsync(context, image);
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
|
|
_loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
|
|
private _onProgress();
|
|
private _onProgress();
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
static _GetProperty<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
|
|
static _GetProperty<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
|
|
private static _GetTextureWrapMode(context, mode);
|
|
private static _GetTextureWrapMode(context, mode);
|
|
private static _GetTextureSamplingMode(context, magFilter?, minFilter?);
|
|
private static _GetTextureSamplingMode(context, magFilter?, minFilter?);
|
|
@@ -1039,12 +1384,18 @@ declare module BABYLON.GLTF2 {
|
|
private _compileMaterialsAsync();
|
|
private _compileMaterialsAsync();
|
|
private _compileShadowGeneratorsAsync();
|
|
private _compileShadowGeneratorsAsync();
|
|
private _clear();
|
|
private _clear();
|
|
|
|
+ /**
|
|
|
|
+ * @ignore
|
|
|
|
+ */
|
|
_applyExtensions<T>(actionAsync: (extension: GLTFLoaderExtension) => Nullable<Promise<T>>): Nullable<Promise<T>>;
|
|
_applyExtensions<T>(actionAsync: (extension: GLTFLoaderExtension) => Nullable<Promise<T>>): Nullable<Promise<T>>;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module BABYLON.GLTF2 {
|
|
declare module BABYLON.GLTF2 {
|
|
|
|
+ /**
|
|
|
|
+ * Abstract class that can be implemented to extend existing gltf loader behavior.
|
|
|
|
+ */
|
|
abstract class GLTFLoaderExtension implements IGLTFLoaderExtension, IDisposable {
|
|
abstract class GLTFLoaderExtension implements IGLTFLoaderExtension, IDisposable {
|
|
enabled: boolean;
|
|
enabled: boolean;
|
|
readonly abstract name: string;
|
|
readonly abstract name: string;
|
|
@@ -1099,6 +1450,7 @@ declare module BABYLON.GLTF2.Extensions {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+/** Module defining extensions to gltf */
|
|
declare module BABYLON.GLTF2.Extensions {
|
|
declare module BABYLON.GLTF2.Extensions {
|
|
class KHR_draco_mesh_compression extends GLTFLoaderExtension {
|
|
class KHR_draco_mesh_compression extends GLTFLoaderExtension {
|
|
readonly name: string;
|
|
readonly name: string;
|