|
@@ -15,7 +15,7 @@ declare module BABYLON {
|
|
extensions: ISceneLoaderPluginExtensions;
|
|
extensions: ISceneLoaderPluginExtensions;
|
|
importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
|
|
importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
|
|
load(scene: Scene, data: any, rootUrl: string): boolean;
|
|
load(scene: Scene, data: any, rootUrl: string): boolean;
|
|
- loadAssets(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): Nullable<AssetContainer>;
|
|
|
|
|
|
+ loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
|
|
private isBinary(data);
|
|
private isBinary(data);
|
|
private parseBinary(mesh, data);
|
|
private parseBinary(mesh, data);
|
|
private parseASCII(mesh, solidData);
|
|
private parseASCII(mesh, solidData);
|
|
@@ -82,7 +82,7 @@ declare module BABYLON {
|
|
private _loadMTL(url, rootUrl, onSuccess);
|
|
private _loadMTL(url, rootUrl, onSuccess);
|
|
importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
|
|
importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>, particleSystems: Nullable<ParticleSystem[]>, skeletons: Nullable<Skeleton[]>): boolean;
|
|
load(scene: Scene, data: string, rootUrl: string): boolean;
|
|
load(scene: Scene, data: string, rootUrl: string): boolean;
|
|
- loadAssets(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): Nullable<AssetContainer>;
|
|
|
|
|
|
+ loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
|
|
/**
|
|
/**
|
|
* Read the OBJ file and create an Array of meshes.
|
|
* Read the OBJ file and create an Array of meshes.
|
|
* Each mesh contains all information given by the OBJ and the MTL file.
|
|
* Each mesh contains all information given by the OBJ and the MTL file.
|
|
@@ -129,19 +129,40 @@ declare module BABYLON {
|
|
json: Object;
|
|
json: Object;
|
|
bin: Nullable<ArrayBufferView>;
|
|
bin: Nullable<ArrayBufferView>;
|
|
}
|
|
}
|
|
|
|
+ interface IGLTFLoaderExtension {
|
|
|
|
+ /**
|
|
|
|
+ * The name of this extension.
|
|
|
|
+ */
|
|
|
|
+ readonly name: string;
|
|
|
|
+ /**
|
|
|
|
+ * Whether this extension is enabled.
|
|
|
|
+ */
|
|
|
|
+ enabled: boolean;
|
|
|
|
+ }
|
|
|
|
+ enum GLTFLoaderState {
|
|
|
|
+ Loading = 0,
|
|
|
|
+ Ready = 1,
|
|
|
|
+ Complete = 2,
|
|
|
|
+ }
|
|
interface IGLTFLoader extends IDisposable {
|
|
interface IGLTFLoader extends IDisposable {
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
compileMaterials: boolean;
|
|
compileMaterials: boolean;
|
|
useClipPlane: boolean;
|
|
useClipPlane: boolean;
|
|
compileShadowGenerators: boolean;
|
|
compileShadowGenerators: boolean;
|
|
- onDisposeObservable: Observable<IGLTFLoader>;
|
|
|
|
onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
onTextureLoadedObservable: Observable<BaseTexture>;
|
|
onTextureLoadedObservable: Observable<BaseTexture>;
|
|
onMaterialLoadedObservable: Observable<Material>;
|
|
onMaterialLoadedObservable: Observable<Material>;
|
|
onCompleteObservable: Observable<IGLTFLoader>;
|
|
onCompleteObservable: Observable<IGLTFLoader>;
|
|
- importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void) => void;
|
|
|
|
- loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void) => void;
|
|
|
|
|
|
+ onDisposeObservable: Observable<IGLTFLoader>;
|
|
|
|
+ onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
|
|
+ state: Nullable<GLTFLoaderState>;
|
|
|
|
+ importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<{
|
|
|
|
+ meshes: AbstractMesh[];
|
|
|
|
+ particleSystems: ParticleSystem[];
|
|
|
|
+ skeletons: Skeleton[];
|
|
|
|
+ }>;
|
|
|
|
+ loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<void>;
|
|
}
|
|
}
|
|
class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
static CreateGLTFLoaderV1: () => IGLTFLoader;
|
|
static CreateGLTFLoaderV1: () => IGLTFLoader;
|
|
@@ -179,19 +200,19 @@ declare module BABYLON {
|
|
/**
|
|
/**
|
|
* Raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
|
* Raised when the loader creates a mesh after parsing the glTF properties of the mesh.
|
|
*/
|
|
*/
|
|
- onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
|
|
|
|
+ readonly onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
private _onMeshLoadedObserver;
|
|
private _onMeshLoadedObserver;
|
|
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.
|
|
*/
|
|
*/
|
|
- onTextureLoadedObservable: Observable<BaseTexture>;
|
|
|
|
|
|
+ readonly onTextureLoadedObservable: Observable<BaseTexture>;
|
|
private _onTextureLoadedObserver;
|
|
private _onTextureLoadedObserver;
|
|
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.
|
|
*/
|
|
*/
|
|
- onMaterialLoadedObservable: Observable<Material>;
|
|
|
|
|
|
+ readonly onMaterialLoadedObservable: Observable<Material>;
|
|
private _onMaterialLoadedObserver;
|
|
private _onMaterialLoadedObserver;
|
|
onMaterialLoaded: (Material: Material) => void;
|
|
onMaterialLoaded: (Material: Material) => void;
|
|
/**
|
|
/**
|
|
@@ -199,15 +220,26 @@ declare module BABYLON {
|
|
* For assets with LODs, raised when all of the LODs are complete.
|
|
* For assets with LODs, raised when all of the LODs are complete.
|
|
* For assets without LODs, raised when the model is complete, immediately after onSuccess.
|
|
* For assets without LODs, raised when the model is complete, immediately after onSuccess.
|
|
*/
|
|
*/
|
|
- onCompleteObservable: Observable<GLTFFileLoader>;
|
|
|
|
|
|
+ readonly onCompleteObservable: Observable<GLTFFileLoader>;
|
|
private _onCompleteObserver;
|
|
private _onCompleteObserver;
|
|
onComplete: () => void;
|
|
onComplete: () => void;
|
|
/**
|
|
/**
|
|
* Raised when the loader is disposed.
|
|
* Raised when the loader is disposed.
|
|
*/
|
|
*/
|
|
- onDisposeObservable: Observable<GLTFFileLoader>;
|
|
|
|
|
|
+ readonly onDisposeObservable: Observable<GLTFFileLoader>;
|
|
private _onDisposeObserver;
|
|
private _onDisposeObserver;
|
|
onDispose: () => void;
|
|
onDispose: () => void;
|
|
|
|
+ /**
|
|
|
|
+ * Raised after a loader extension is created.
|
|
|
|
+ * Set additional options for a loader extension in this event.
|
|
|
|
+ */
|
|
|
|
+ readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
|
|
+ private _onExtensionLoadedObserver;
|
|
|
|
+ onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
|
|
|
|
+ /**
|
|
|
|
+ * The loader state or null if not active.
|
|
|
|
+ */
|
|
|
|
+ readonly loaderState: Nullable<GLTFLoaderState>;
|
|
private _loader;
|
|
private _loader;
|
|
name: string;
|
|
name: string;
|
|
extensions: ISceneLoaderPluginExtensions;
|
|
extensions: ISceneLoaderPluginExtensions;
|
|
@@ -215,9 +247,13 @@ declare module BABYLON {
|
|
* 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;
|
|
- importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
|
|
|
|
- loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
|
|
|
|
- loadAssetsAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess: (assets: AssetContainer) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
|
|
|
|
|
|
+ importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
|
|
+ meshes: AbstractMesh[];
|
|
|
|
+ particleSystems: ParticleSystem[];
|
|
|
|
+ skeletons: Skeleton[];
|
|
|
|
+ }>;
|
|
|
|
+ loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
|
|
|
|
+ loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<AssetContainer>;
|
|
canDirectLoad(data: string): boolean;
|
|
canDirectLoad(data: string): boolean;
|
|
rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
|
|
rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
|
|
createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
|
|
createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
|
|
@@ -635,9 +671,17 @@ declare module BABYLON.GLTF1 {
|
|
onTextureLoadedObservable: Observable<BaseTexture>;
|
|
onTextureLoadedObservable: Observable<BaseTexture>;
|
|
onMaterialLoadedObservable: Observable<Material>;
|
|
onMaterialLoadedObservable: Observable<Material>;
|
|
onCompleteObservable: Observable<IGLTFLoader>;
|
|
onCompleteObservable: Observable<IGLTFLoader>;
|
|
|
|
+ onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
|
|
+ state: Nullable<GLTFLoaderState>;
|
|
dispose(): void;
|
|
dispose(): void;
|
|
- importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: SceneLoaderProgressEvent) => void, onError: (message: string) => void): boolean;
|
|
|
|
- loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: () => void, onProgress: (event: SceneLoaderProgressEvent) => void, onError: (message: string) => void): void;
|
|
|
|
|
|
+ private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress, onError);
|
|
|
|
+ importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
|
|
+ meshes: AbstractMesh[];
|
|
|
|
+ particleSystems: ParticleSystem[];
|
|
|
|
+ skeletons: Skeleton[];
|
|
|
|
+ }>;
|
|
|
|
+ private _loadAsync(scene, data, rootUrl, onSuccess, onProgress, onError);
|
|
|
|
+ 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?);
|
|
private _createNodes(gltfRuntime);
|
|
private _createNodes(gltfRuntime);
|
|
@@ -668,16 +712,6 @@ declare module BABYLON.GLTF1 {
|
|
*/
|
|
*/
|
|
static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
|
|
static SetUniform(shaderMaterial: ShaderMaterial | Effect, uniform: string, value: any, type: number): boolean;
|
|
/**
|
|
/**
|
|
- * If the uri is a base64 string
|
|
|
|
- * @param uri: the uri to test
|
|
|
|
- */
|
|
|
|
- static IsBase64(uri: string): boolean;
|
|
|
|
- /**
|
|
|
|
- * Decode the base64 uri
|
|
|
|
- * @param uri: the uri to decode
|
|
|
|
- */
|
|
|
|
- static DecodeBase64(uri: string): ArrayBuffer;
|
|
|
|
- /**
|
|
|
|
* Returns the wrap mode of the texture
|
|
* Returns the wrap mode of the texture
|
|
* @param mode: the mode value
|
|
* @param mode: the mode value
|
|
*/
|
|
*/
|
|
@@ -791,440 +825,259 @@ declare module BABYLON.GLTF1 {
|
|
|
|
|
|
|
|
|
|
declare module BABYLON.GLTF2 {
|
|
declare module BABYLON.GLTF2 {
|
|
- /**
|
|
|
|
- * Enums
|
|
|
|
- */
|
|
|
|
- enum EComponentType {
|
|
|
|
- BYTE = 5120,
|
|
|
|
- UNSIGNED_BYTE = 5121,
|
|
|
|
- SHORT = 5122,
|
|
|
|
- UNSIGNED_SHORT = 5123,
|
|
|
|
- UNSIGNED_INT = 5125,
|
|
|
|
- FLOAT = 5126,
|
|
|
|
- }
|
|
|
|
- enum EMeshPrimitiveMode {
|
|
|
|
- POINTS = 0,
|
|
|
|
- LINES = 1,
|
|
|
|
- LINE_LOOP = 2,
|
|
|
|
- LINE_STRIP = 3,
|
|
|
|
- TRIANGLES = 4,
|
|
|
|
- TRIANGLE_STRIP = 5,
|
|
|
|
- TRIANGLE_FAN = 6,
|
|
|
|
- }
|
|
|
|
- enum ETextureMagFilter {
|
|
|
|
- NEAREST = 9728,
|
|
|
|
- LINEAR = 9729,
|
|
|
|
- }
|
|
|
|
- enum ETextureMinFilter {
|
|
|
|
- NEAREST = 9728,
|
|
|
|
- LINEAR = 9729,
|
|
|
|
- NEAREST_MIPMAP_NEAREST = 9984,
|
|
|
|
- LINEAR_MIPMAP_NEAREST = 9985,
|
|
|
|
- NEAREST_MIPMAP_LINEAR = 9986,
|
|
|
|
- LINEAR_MIPMAP_LINEAR = 9987,
|
|
|
|
- }
|
|
|
|
- enum ETextureWrapMode {
|
|
|
|
- CLAMP_TO_EDGE = 33071,
|
|
|
|
- MIRRORED_REPEAT = 33648,
|
|
|
|
- REPEAT = 10497,
|
|
|
|
- }
|
|
|
|
- /**
|
|
|
|
- * Interfaces
|
|
|
|
- */
|
|
|
|
- interface IGLTFProperty {
|
|
|
|
- extensions?: {
|
|
|
|
- [key: string]: any;
|
|
|
|
- };
|
|
|
|
- extras?: any;
|
|
|
|
- }
|
|
|
|
- interface IGLTFChildRootProperty extends IGLTFProperty {
|
|
|
|
- name?: string;
|
|
|
|
- }
|
|
|
|
- interface IGLTFAccessorSparseIndices extends IGLTFProperty {
|
|
|
|
- bufferView: number;
|
|
|
|
- byteOffset?: number;
|
|
|
|
- componentType: EComponentType;
|
|
|
|
- }
|
|
|
|
- interface IGLTFAccessorSparseValues extends IGLTFProperty {
|
|
|
|
- bufferView: number;
|
|
|
|
- byteOffset?: number;
|
|
|
|
- }
|
|
|
|
- interface IGLTFAccessorSparse extends IGLTFProperty {
|
|
|
|
- count: number;
|
|
|
|
- indices: IGLTFAccessorSparseIndices;
|
|
|
|
- values: IGLTFAccessorSparseValues;
|
|
|
|
- }
|
|
|
|
- interface IGLTFAccessor extends IGLTFChildRootProperty {
|
|
|
|
- bufferView?: number;
|
|
|
|
- byteOffset?: number;
|
|
|
|
- componentType: EComponentType;
|
|
|
|
- normalized?: boolean;
|
|
|
|
- count: number;
|
|
|
|
- type: string;
|
|
|
|
- max: number[];
|
|
|
|
- min: number[];
|
|
|
|
- sparse?: IGLTFAccessorSparse;
|
|
|
|
- index: number;
|
|
|
|
- }
|
|
|
|
- interface IGLTFAnimationChannel extends IGLTFProperty {
|
|
|
|
- sampler: number;
|
|
|
|
- target: IGLTFAnimationChannelTarget;
|
|
|
|
- }
|
|
|
|
- interface IGLTFAnimationChannelTarget extends IGLTFProperty {
|
|
|
|
- node: number;
|
|
|
|
- path: string;
|
|
|
|
- }
|
|
|
|
- interface IGLTFAnimationSampler extends IGLTFProperty {
|
|
|
|
- input: number;
|
|
|
|
- interpolation?: string;
|
|
|
|
- output: number;
|
|
|
|
|
|
+ interface TypedArray extends ArrayBufferView {
|
|
|
|
+ [index: number]: number;
|
|
}
|
|
}
|
|
- interface IGLTFAnimation extends IGLTFChildRootProperty {
|
|
|
|
- channels: IGLTFAnimationChannel[];
|
|
|
|
- samplers: IGLTFAnimationSampler[];
|
|
|
|
- index: number;
|
|
|
|
- babylonAnimationGroup: AnimationGroup;
|
|
|
|
|
|
+ interface IArrayItem {
|
|
|
|
+ _index: number;
|
|
}
|
|
}
|
|
- interface IGLTFAsset extends IGLTFChildRootProperty {
|
|
|
|
- copyright?: string;
|
|
|
|
- generator?: string;
|
|
|
|
- version: string;
|
|
|
|
- minVersion?: string;
|
|
|
|
|
|
+ class ArrayItem {
|
|
|
|
+ static Assign(values?: IArrayItem[]): void;
|
|
}
|
|
}
|
|
- interface IGLTFBuffer extends IGLTFChildRootProperty {
|
|
|
|
- uri?: string;
|
|
|
|
- byteLength: number;
|
|
|
|
- index: number;
|
|
|
|
- loadedData?: ArrayBufferView;
|
|
|
|
- loadedObservable?: Observable<IGLTFBuffer>;
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+declare module BABYLON.GLTF2 {
|
|
|
|
+ interface ILoaderAccessor extends IAccessor, IArrayItem {
|
|
|
|
+ _data?: Promise<TypedArray>;
|
|
}
|
|
}
|
|
- interface IGLTFBufferView extends IGLTFChildRootProperty {
|
|
|
|
- buffer: number;
|
|
|
|
- byteOffset?: number;
|
|
|
|
- byteLength: number;
|
|
|
|
- byteStride?: number;
|
|
|
|
- index: number;
|
|
|
|
|
|
+ interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem {
|
|
|
|
+ _babylonAnimationGroup: AnimationGroup;
|
|
}
|
|
}
|
|
- interface IGLTFCameraOrthographic extends IGLTFProperty {
|
|
|
|
- xmag: number;
|
|
|
|
- ymag: number;
|
|
|
|
- zfar: number;
|
|
|
|
- znear: number;
|
|
|
|
|
|
+ interface ILoaderAnimationSamplerData {
|
|
|
|
+ input: Float32Array;
|
|
|
|
+ interpolation: AnimationSamplerInterpolation;
|
|
|
|
+ output: Float32Array;
|
|
}
|
|
}
|
|
- interface IGLTFCameraPerspective extends IGLTFProperty {
|
|
|
|
- aspectRatio: number;
|
|
|
|
- yfov: number;
|
|
|
|
- zfar: number;
|
|
|
|
- znear: number;
|
|
|
|
|
|
+ interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem {
|
|
|
|
+ _data: Promise<ILoaderAnimationSamplerData>;
|
|
}
|
|
}
|
|
- interface IGLTFCamera extends IGLTFChildRootProperty {
|
|
|
|
- orthographic?: IGLTFCameraOrthographic;
|
|
|
|
- perspective?: IGLTFCameraPerspective;
|
|
|
|
- type: string;
|
|
|
|
|
|
+ interface ILoaderAnimation extends IAnimation, IArrayItem {
|
|
|
|
+ channels: ILoaderAnimationChannel[];
|
|
|
|
+ samplers: ILoaderAnimationSampler[];
|
|
|
|
+ _babylonAnimationGroup: Nullable<AnimationGroup>;
|
|
}
|
|
}
|
|
- interface IGLTFImage extends IGLTFChildRootProperty {
|
|
|
|
- uri?: string;
|
|
|
|
- mimeType?: string;
|
|
|
|
- bufferView?: number;
|
|
|
|
- index: number;
|
|
|
|
|
|
+ interface ILoaderBuffer extends IBuffer, IArrayItem {
|
|
|
|
+ _data?: Promise<ArrayBufferView>;
|
|
}
|
|
}
|
|
- interface IGLTFMaterialNormalTextureInfo extends IGLTFTextureInfo {
|
|
|
|
- scale: number;
|
|
|
|
|
|
+ interface ILoaderBufferView extends IBufferView, IArrayItem {
|
|
|
|
+ _data?: Promise<ArrayBufferView>;
|
|
}
|
|
}
|
|
- interface IGLTFMaterialOcclusionTextureInfo extends IGLTFTextureInfo {
|
|
|
|
- strength: number;
|
|
|
|
|
|
+ interface ILoaderCamera extends ICamera, IArrayItem {
|
|
}
|
|
}
|
|
- interface IGLTFMaterialPbrMetallicRoughness {
|
|
|
|
- baseColorFactor: number[];
|
|
|
|
- baseColorTexture: IGLTFTextureInfo;
|
|
|
|
- metallicFactor: number;
|
|
|
|
- roughnessFactor: number;
|
|
|
|
- metallicRoughnessTexture: IGLTFTextureInfo;
|
|
|
|
|
|
+ interface ILoaderImage extends IImage, IArrayItem {
|
|
|
|
+ _objectURL?: Promise<string>;
|
|
}
|
|
}
|
|
- interface IGLTFMaterial extends IGLTFChildRootProperty {
|
|
|
|
- pbrMetallicRoughness?: IGLTFMaterialPbrMetallicRoughness;
|
|
|
|
- normalTexture?: IGLTFMaterialNormalTextureInfo;
|
|
|
|
- occlusionTexture?: IGLTFMaterialOcclusionTextureInfo;
|
|
|
|
- emissiveTexture?: IGLTFTextureInfo;
|
|
|
|
- emissiveFactor?: number[];
|
|
|
|
- alphaMode?: string;
|
|
|
|
- alphaCutoff: number;
|
|
|
|
- doubleSided?: boolean;
|
|
|
|
- index: number;
|
|
|
|
- babylonMaterial: Material;
|
|
|
|
|
|
+ interface ILoaderMaterial extends IMaterial, IArrayItem {
|
|
|
|
+ _babylonMaterial?: Material;
|
|
|
|
+ _babylonMeshes?: AbstractMesh[];
|
|
|
|
+ _loaded?: Promise<void>;
|
|
}
|
|
}
|
|
- interface IGLTFMeshPrimitive extends IGLTFProperty {
|
|
|
|
- attributes: {
|
|
|
|
- [name: string]: number;
|
|
|
|
- };
|
|
|
|
- indices?: number;
|
|
|
|
- material?: number;
|
|
|
|
- mode?: EMeshPrimitiveMode;
|
|
|
|
- targets?: {
|
|
|
|
- [name: string]: number;
|
|
|
|
- }[];
|
|
|
|
- vertexData: VertexData;
|
|
|
|
- targetsVertexData: VertexData[];
|
|
|
|
|
|
+ interface ILoaderMesh extends IMesh, IArrayItem {
|
|
|
|
+ primitives: ILoaderMeshPrimitive[];
|
|
}
|
|
}
|
|
- interface IGLTFMesh extends IGLTFChildRootProperty {
|
|
|
|
- primitives: IGLTFMeshPrimitive[];
|
|
|
|
- weights?: number[];
|
|
|
|
- index: number;
|
|
|
|
- hasVertexAlpha: boolean;
|
|
|
|
|
|
+ interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem {
|
|
}
|
|
}
|
|
- interface IGLTFNode extends IGLTFChildRootProperty {
|
|
|
|
- camera?: number;
|
|
|
|
- children?: number[];
|
|
|
|
- skin?: number;
|
|
|
|
- matrix?: number[];
|
|
|
|
- mesh?: number;
|
|
|
|
- rotation?: number[];
|
|
|
|
- scale?: number[];
|
|
|
|
- translation?: number[];
|
|
|
|
- weights?: number[];
|
|
|
|
- index: number;
|
|
|
|
- parent: IGLTFNode;
|
|
|
|
- babylonMesh: Mesh;
|
|
|
|
- babylonAnimationTargets?: Node[];
|
|
|
|
|
|
+ interface ILoaderNode extends INode, IArrayItem {
|
|
|
|
+ _parent: ILoaderNode;
|
|
|
|
+ _babylonMesh?: Mesh;
|
|
|
|
+ _primitiveBabylonMeshes?: Mesh[];
|
|
|
|
+ _babylonAnimationTargets?: Node[];
|
|
|
|
+ _numMorphTargets?: number;
|
|
}
|
|
}
|
|
- interface IGLTFSampler extends IGLTFChildRootProperty {
|
|
|
|
- magFilter?: ETextureMagFilter;
|
|
|
|
- minFilter?: ETextureMinFilter;
|
|
|
|
- wrapS?: ETextureWrapMode;
|
|
|
|
- wrapT?: ETextureWrapMode;
|
|
|
|
- index: number;
|
|
|
|
|
|
+ interface ILoaderSamplerData {
|
|
noMipMaps: boolean;
|
|
noMipMaps: boolean;
|
|
samplingMode: number;
|
|
samplingMode: number;
|
|
wrapU: number;
|
|
wrapU: number;
|
|
wrapV: number;
|
|
wrapV: number;
|
|
}
|
|
}
|
|
- interface IGLTFScene extends IGLTFChildRootProperty {
|
|
|
|
- nodes: number[];
|
|
|
|
- index: number;
|
|
|
|
|
|
+ interface ILoaderSampler extends ISampler, IArrayItem {
|
|
|
|
+ _data?: ILoaderSamplerData;
|
|
}
|
|
}
|
|
- interface IGLTFSkin extends IGLTFChildRootProperty {
|
|
|
|
- inverseBindMatrices?: number;
|
|
|
|
- skeleton?: number;
|
|
|
|
- joints: number[];
|
|
|
|
- index: number;
|
|
|
|
- babylonSkeleton: Skeleton;
|
|
|
|
|
|
+ interface ILoaderScene extends IScene, IArrayItem {
|
|
}
|
|
}
|
|
- interface IGLTFTexture extends IGLTFChildRootProperty {
|
|
|
|
- sampler?: number;
|
|
|
|
- source: number;
|
|
|
|
- index: number;
|
|
|
|
- url?: string;
|
|
|
|
- dataReadyObservable?: Observable<IGLTFTexture>;
|
|
|
|
- }
|
|
|
|
- interface IGLTFTextureInfo {
|
|
|
|
- index: number;
|
|
|
|
- texCoord?: number;
|
|
|
|
- }
|
|
|
|
- interface _IGLTF extends IGLTFProperty {
|
|
|
|
- accessors?: IGLTFAccessor[];
|
|
|
|
- animations?: IGLTFAnimation[];
|
|
|
|
- asset: IGLTFAsset;
|
|
|
|
- buffers?: IGLTFBuffer[];
|
|
|
|
- bufferViews?: IGLTFBufferView[];
|
|
|
|
- cameras?: IGLTFCamera[];
|
|
|
|
- extensionsUsed?: string[];
|
|
|
|
- extensionsRequired?: string[];
|
|
|
|
- images?: IGLTFImage[];
|
|
|
|
- materials?: IGLTFMaterial[];
|
|
|
|
- meshes?: IGLTFMesh[];
|
|
|
|
- nodes?: IGLTFNode[];
|
|
|
|
- samplers?: IGLTFSampler[];
|
|
|
|
- scene?: number;
|
|
|
|
- scenes?: IGLTFScene[];
|
|
|
|
- skins?: IGLTFSkin[];
|
|
|
|
- textures?: IGLTFTexture[];
|
|
|
|
|
|
+ interface ILoaderSkin extends ISkin, IArrayItem {
|
|
|
|
+ _babylonSkeleton: Nullable<Skeleton>;
|
|
|
|
+ _loaded?: Promise<void>;
|
|
|
|
+ }
|
|
|
|
+ interface ILoaderTexture extends ITexture, IArrayItem {
|
|
|
|
+ }
|
|
|
|
+ interface ILoaderGLTF extends IGLTF {
|
|
|
|
+ accessors?: ILoaderAccessor[];
|
|
|
|
+ animations?: ILoaderAnimation[];
|
|
|
|
+ buffers?: ILoaderBuffer[];
|
|
|
|
+ bufferViews?: ILoaderBufferView[];
|
|
|
|
+ cameras?: ILoaderCamera[];
|
|
|
|
+ images?: ILoaderImage[];
|
|
|
|
+ materials?: ILoaderMaterial[];
|
|
|
|
+ meshes?: ILoaderMesh[];
|
|
|
|
+ nodes?: ILoaderNode[];
|
|
|
|
+ samplers?: ILoaderSampler[];
|
|
|
|
+ scenes?: ILoaderScene[];
|
|
|
|
+ skins?: ILoaderSkin[];
|
|
|
|
+ textures?: ILoaderTexture[];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module BABYLON.GLTF2 {
|
|
declare module BABYLON.GLTF2 {
|
|
class GLTFLoader implements IGLTFLoader {
|
|
class GLTFLoader implements IGLTFLoader {
|
|
- _gltf: _IGLTF;
|
|
|
|
|
|
+ _gltf: ILoaderGLTF;
|
|
_babylonScene: Scene;
|
|
_babylonScene: Scene;
|
|
|
|
+ _completePromises: Promise<void>[];
|
|
private _disposed;
|
|
private _disposed;
|
|
|
|
+ private _state;
|
|
|
|
+ private _extensions;
|
|
private _rootUrl;
|
|
private _rootUrl;
|
|
- private _defaultMaterial;
|
|
|
|
|
|
+ private _rootBabylonMesh;
|
|
private _defaultSampler;
|
|
private _defaultSampler;
|
|
- private _rootNode;
|
|
|
|
- private _successCallback?;
|
|
|
|
private _progressCallback?;
|
|
private _progressCallback?;
|
|
- private _errorCallback?;
|
|
|
|
- private _renderReady;
|
|
|
|
private _requests;
|
|
private _requests;
|
|
- private _renderReadyObservable;
|
|
|
|
- private _renderPendingCount;
|
|
|
|
- private _loaderPendingCount;
|
|
|
|
- private _loaderTrackers;
|
|
|
|
- static Extensions: {
|
|
|
|
- [name: string]: GLTFLoaderExtension;
|
|
|
|
- };
|
|
|
|
- static RegisterExtension(extension: GLTFLoaderExtension): void;
|
|
|
|
|
|
+ private static _Names;
|
|
|
|
+ private static _Factories;
|
|
|
|
+ static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
animationStartMode: GLTFLoaderAnimationStartMode;
|
|
compileMaterials: boolean;
|
|
compileMaterials: boolean;
|
|
useClipPlane: boolean;
|
|
useClipPlane: boolean;
|
|
compileShadowGenerators: boolean;
|
|
compileShadowGenerators: boolean;
|
|
- onDisposeObservable: Observable<IGLTFLoader>;
|
|
|
|
- onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
|
|
- onTextureLoadedObservable: Observable<BaseTexture>;
|
|
|
|
- onMaterialLoadedObservable: Observable<Material>;
|
|
|
|
- onCompleteObservable: Observable<IGLTFLoader>;
|
|
|
|
|
|
+ readonly onDisposeObservable: Observable<IGLTFLoader>;
|
|
|
|
+ readonly onMeshLoadedObservable: Observable<AbstractMesh>;
|
|
|
|
+ readonly onTextureLoadedObservable: Observable<BaseTexture>;
|
|
|
|
+ readonly onMaterialLoadedObservable: Observable<Material>;
|
|
|
|
+ readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
|
|
|
|
+ readonly onCompleteObservable: Observable<IGLTFLoader>;
|
|
|
|
+ readonly state: Nullable<GLTFLoaderState>;
|
|
dispose(): void;
|
|
dispose(): void;
|
|
- importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
|
|
|
|
- loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void;
|
|
|
|
- private _loadAsync(nodeNames, scene, data, rootUrl, onSuccess?, onProgress?, onError?);
|
|
|
|
- private _onProgress();
|
|
|
|
- _executeWhenRenderReady(func: () => void): void;
|
|
|
|
- private _onRenderReady();
|
|
|
|
- private _onComplete();
|
|
|
|
|
|
+ importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{
|
|
|
|
+ meshes: AbstractMesh[];
|
|
|
|
+ particleSystems: ParticleSystem[];
|
|
|
|
+ skeletons: Skeleton[];
|
|
|
|
+ }>;
|
|
|
|
+ loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
|
|
|
|
+ private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
|
|
|
|
+ private _loadExtensions();
|
|
private _loadData(data);
|
|
private _loadData(data);
|
|
|
|
+ private _setupData();
|
|
|
|
+ private _createRootNode();
|
|
|
|
+ private _loadNodesAsync(nodes);
|
|
|
|
+ _loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;
|
|
private _getMeshes();
|
|
private _getMeshes();
|
|
private _getSkeletons();
|
|
private _getSkeletons();
|
|
private _startAnimations();
|
|
private _startAnimations();
|
|
- private _loadDefaultScene(nodeNames);
|
|
|
|
- private _loadScene(context, scene, nodeNames);
|
|
|
|
- _loadNode(context: string, node: IGLTFNode): void;
|
|
|
|
- private _loadMesh(context, node, mesh);
|
|
|
|
- private _loadAllVertexDataAsync(context, mesh, onSuccess);
|
|
|
|
- /**
|
|
|
|
- * Converts a data bufferview into a Float4 Texture Coordinate Array, based on the accessor component type
|
|
|
|
- * @param {ArrayBufferView} data
|
|
|
|
- * @param {IGLTFAccessor} accessor
|
|
|
|
- */
|
|
|
|
- private _convertToFloat4TextureCoordArray(context, data, accessor);
|
|
|
|
- /**
|
|
|
|
- * Converts a data bufferview into a Float4 Color Array, based on the accessor component type
|
|
|
|
- * @param {ArrayBufferView} data
|
|
|
|
- * @param {IGLTFAccessor} accessor
|
|
|
|
- */
|
|
|
|
- private _convertToFloat4ColorArray(context, data, accessor);
|
|
|
|
- private _loadVertexDataAsync(context, mesh, primitive, onSuccess);
|
|
|
|
- private _createMorphTargets(context, node, mesh);
|
|
|
|
- private _loadMorphTargets(context, node, mesh);
|
|
|
|
- private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
|
|
|
|
- private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
|
|
|
|
- private _loadTransform(node);
|
|
|
|
- private _loadSkinAsync(context, skin, onSuccess);
|
|
|
|
|
|
+ _loadNodeAsync(context: string, node: ILoaderNode): Promise<void>;
|
|
|
|
+ private _loadMeshAsync(context, node, mesh);
|
|
|
|
+ private _loadPrimitiveAsync(context, node, mesh, primitive);
|
|
|
|
+ private _loadVertexDataAsync(context, primitive, babylonMesh);
|
|
|
|
+ private _createMorphTargets(context, node, mesh, primitive, babylonMesh);
|
|
|
|
+ private _loadMorphTargetsAsync(context, primitive, babylonMesh, babylonVertexData);
|
|
|
|
+ private _loadMorphTargetVertexDataAsync(context, babylonVertexData, attributes, babylonMorphTarget);
|
|
|
|
+ private static _ConvertToFloat32Array(context, accessor, data);
|
|
|
|
+ private static _ConvertVec3ToVec4(context, data);
|
|
|
|
+ private static _LoadTransform(node, babylonNode);
|
|
|
|
+ private _loadSkinAsync(context, node, mesh, skin);
|
|
|
|
+ private _loadSkinInverseBindMatricesDataAsync(context, skin);
|
|
private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
|
|
private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
|
|
- private _loadBones(context, skin, inverseBindMatrixData);
|
|
|
|
- private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
|
|
|
|
|
|
+ private _loadBones(context, skin, inverseBindMatricesData);
|
|
|
|
+ private _loadBone(node, skin, inverseBindMatricesData, babylonBones);
|
|
private _getNodeMatrix(node);
|
|
private _getNodeMatrix(node);
|
|
- private _traverseNodes(context, indices, action, parentNode);
|
|
|
|
- _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void;
|
|
|
|
- private _loadAnimations();
|
|
|
|
- private _loadAnimation(context, animation);
|
|
|
|
- private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
|
|
|
|
- private _loadBufferAsync(context, buffer, onSuccess);
|
|
|
|
- private _loadBufferViewAsync(context, bufferView, onSuccess);
|
|
|
|
- private _loadAccessorAsync(context, accessor, onSuccess);
|
|
|
|
|
|
+ private _loadAnimationsAsync();
|
|
|
|
+ private _loadAnimationAsync(context, animation);
|
|
|
|
+ private _loadAnimationChannelAsync(context, animationContext, animation, channel, babylonAnimationGroup);
|
|
|
|
+ private _loadAnimationSamplerAsync(context, sampler);
|
|
|
|
+ private _loadBufferAsync(context, buffer);
|
|
|
|
+ private _loadBufferViewAsync(context, bufferView);
|
|
|
|
+ private _loadAccessorAsync(context, accessor);
|
|
private _buildArrayBuffer<T>(typedArray, data, byteOffset, count, numComponents, byteStride?);
|
|
private _buildArrayBuffer<T>(typedArray, data, byteOffset, count, numComponents, byteStride?);
|
|
- _addPendingData(data: any): void;
|
|
|
|
- _removePendingData(data: any): void;
|
|
|
|
- _addLoaderPendingData(data: any): void;
|
|
|
|
- _removeLoaderPendingData(data: any): void;
|
|
|
|
- _whenAction(action: () => void, onComplete: () => void): void;
|
|
|
|
private _getDefaultMaterial();
|
|
private _getDefaultMaterial();
|
|
- private _loadMaterialMetallicRoughnessProperties(context, material);
|
|
|
|
- _loadMaterial(context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): void;
|
|
|
|
- _createPbrMaterial(material: IGLTFMaterial): void;
|
|
|
|
- _loadMaterialBaseProperties(context: string, material: IGLTFMaterial): void;
|
|
|
|
- _loadMaterialAlphaProperties(context: string, material: IGLTFMaterial, colorFactor: number[]): void;
|
|
|
|
- _loadTexture(context: string, texture: IGLTFTexture, coordinatesIndex?: number): Texture;
|
|
|
|
|
|
+ private _loadMaterialMetallicRoughnessPropertiesAsync(context, material);
|
|
|
|
+ _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Promise<void>;
|
|
|
|
+ _createMaterial(material: ILoaderMaterial): PBRMaterial;
|
|
|
|
+ _loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial): Promise<void>;
|
|
|
|
+ _loadMaterialAlphaProperties(context: string, material: ILoaderMaterial): void;
|
|
|
|
+ _loadTextureAsync(context: string, textureInfo: ITextureInfo, assign: (texture: Texture) => void): Promise<void>;
|
|
private _loadSampler(context, sampler);
|
|
private _loadSampler(context, sampler);
|
|
- private _loadImageAsync(context, image, onSuccess);
|
|
|
|
- _loadUriAsync(context: string, uri: string, onSuccess: (data: ArrayBufferView) => void): void;
|
|
|
|
- _tryCatchOnError(handler: () => void): void;
|
|
|
|
- private static _AssignIndices(array?);
|
|
|
|
- static _GetProperty<T extends IGLTFProperty>(array?: ArrayLike<T>, index?: number): Nullable<T>;
|
|
|
|
- private static _GetTextureWrapMode(context, mode?);
|
|
|
|
|
|
+ private _loadImageAsync(context, image);
|
|
|
|
+ _loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
|
|
|
|
+ private _onProgress();
|
|
|
|
+ static _GetProperty<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;
|
|
|
|
+ private static _GetTextureWrapMode(context, mode);
|
|
private static _GetTextureSamplingMode(context, magFilter?, minFilter?);
|
|
private static _GetTextureSamplingMode(context, magFilter?, minFilter?);
|
|
private static _GetNumComponents(context, type);
|
|
private static _GetNumComponents(context, type);
|
|
- private _compileMaterialAsync(babylonMaterial, babylonMesh, onSuccess);
|
|
|
|
- private _compileMaterialsAsync(onSuccess);
|
|
|
|
- private _compileShadowGeneratorsAsync(onSuccess);
|
|
|
|
- private _abortRequests();
|
|
|
|
- private _releaseResources();
|
|
|
|
|
|
+ private static _ValidateUri(uri);
|
|
|
|
+ private _compileMaterialsAsync();
|
|
|
|
+ private _compileShadowGeneratorsAsync();
|
|
|
|
+ private _clear();
|
|
|
|
+ _applyExtensions<T>(actionAsync: (extension: GLTFLoaderExtension) => Nullable<Promise<T>>): Nullable<Promise<T>>;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module BABYLON.GLTF2 {
|
|
declare module BABYLON.GLTF2 {
|
|
- /**
|
|
|
|
- * Utils functions for GLTF
|
|
|
|
- */
|
|
|
|
- class GLTFUtils {
|
|
|
|
- /**
|
|
|
|
- * If the uri is a base64 string
|
|
|
|
- * @param uri: the uri to test
|
|
|
|
- */
|
|
|
|
- static IsBase64(uri: string): boolean;
|
|
|
|
- /**
|
|
|
|
- * Decode the base64 uri
|
|
|
|
- * @param uri: the uri to decode
|
|
|
|
- */
|
|
|
|
- static DecodeBase64(uri: string): ArrayBuffer;
|
|
|
|
- static ValidateUri(uri: string): boolean;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-declare module BABYLON.GLTF2 {
|
|
|
|
- abstract class GLTFLoaderExtension {
|
|
|
|
|
|
+ abstract class GLTFLoaderExtension implements IGLTFLoaderExtension {
|
|
enabled: boolean;
|
|
enabled: boolean;
|
|
readonly abstract name: string;
|
|
readonly abstract name: string;
|
|
- protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
|
|
|
|
- protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
|
|
|
|
- protected _loadRoot(loader: GLTFLoader, context: string, root: BABYLON.GLTF2._IGLTF): boolean;
|
|
|
|
- protected _loadScene(loader: GLTFLoader, context: string, scene: IGLTFScene): boolean;
|
|
|
|
- protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
|
|
|
|
- protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
|
|
|
|
- static _Extensions: GLTFLoaderExtension[];
|
|
|
|
- static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
|
|
|
|
- static LoadRoot(loader: GLTFLoader, context: string, root: BABYLON.GLTF2._IGLTF): boolean;
|
|
|
|
- static LoadScene(loader: GLTFLoader, context: string, scene: IGLTFScene): boolean;
|
|
|
|
- static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
|
|
|
|
- static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
|
|
|
|
- private static _ApplyExtensions(action);
|
|
|
|
|
|
+ protected _loader: GLTFLoader;
|
|
|
|
+ constructor(loader: GLTFLoader);
|
|
|
|
+ /** Override this method to modify the default behavior for loading scenes. */
|
|
|
|
+ protected _loadSceneAsync(context: string, node: ILoaderScene): Nullable<Promise<void>>;
|
|
|
|
+ /** Override this method to modify the default behavior for loading nodes. */
|
|
|
|
+ protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
|
|
|
|
+ /** Override this method to modify the default behavior for loading materials. */
|
|
|
|
+ protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
|
|
|
|
+ /** Override this method to modify the default behavior for loading uris. */
|
|
|
|
+ protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
|
|
|
|
+ /** Helper method called by a loader extension to load an glTF extension. */
|
|
|
|
+ protected _loadExtensionAsync<T>(context: string, property: IProperty, actionAsync: (context: string, extension: T) => Promise<void>): Nullable<Promise<void>>;
|
|
|
|
+ /** Helper method called by the loader to allow extensions to override loading scenes. */
|
|
|
|
+ static _LoadSceneAsync(loader: GLTFLoader, context: string, scene: ILoaderScene): Nullable<Promise<void>>;
|
|
|
|
+ /** Helper method called by the loader to allow extensions to override loading nodes. */
|
|
|
|
+ static _LoadNodeAsync(loader: GLTFLoader, context: string, node: ILoaderNode): Nullable<Promise<void>>;
|
|
|
|
+ /** Helper method called by the loader to allow extensions to override loading materials. */
|
|
|
|
+ static _LoadMaterialAsync(loader: GLTFLoader, context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
|
|
|
|
+ /** Helper method called by the loader to allow extensions to override loading uris. */
|
|
|
|
+ static _LoadUriAsync(loader: GLTFLoader, context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module BABYLON.GLTF2.Extensions {
|
|
declare module BABYLON.GLTF2.Extensions {
|
|
- class MSFTLOD extends GLTFLoaderExtension {
|
|
|
|
|
|
+ class MSFT_lod extends GLTFLoaderExtension {
|
|
|
|
+ readonly name: string;
|
|
/**
|
|
/**
|
|
- * Specify the minimal delay between LODs in ms (default = 250)
|
|
|
|
|
|
+ * Maximum number of LODs to load, starting from the lowest LOD.
|
|
*/
|
|
*/
|
|
- Delay: number;
|
|
|
|
- readonly name: string;
|
|
|
|
- protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
|
|
|
|
- protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
|
|
|
|
- private _loadNodeLOD(loader, context, nodes, index, onComplete);
|
|
|
|
- protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
|
|
|
|
- private _loadMaterialLOD(loader, context, materials, index, assign, onComplete);
|
|
|
|
|
|
+ maxLODsToLoad: number;
|
|
|
|
+ private _loadingNodeLOD;
|
|
|
|
+ private _loadNodeSignals;
|
|
|
|
+ private _loadingMaterialLOD;
|
|
|
|
+ private _loadMaterialSignals;
|
|
|
|
+ protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
|
|
|
|
+ protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
|
|
|
|
+ protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>;
|
|
|
|
+ /**
|
|
|
|
+ * Gets an array of LOD properties from lowest to highest.
|
|
|
|
+ */
|
|
|
|
+ private _getLODs<T>(context, property, array, ids);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module BABYLON.GLTF2.Extensions {
|
|
declare module BABYLON.GLTF2.Extensions {
|
|
- class KHRMaterialsPbrSpecularGlossiness extends GLTFLoaderExtension {
|
|
|
|
|
|
+ class KHR_materials_pbrSpecularGlossiness extends GLTFLoaderExtension {
|
|
readonly name: string;
|
|
readonly name: string;
|
|
- protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
|
|
|
|
- private _loadSpecularGlossinessProperties(loader, context, material, properties);
|
|
|
|
|
|
+ protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>;
|
|
|
|
+ private _loadSpecularGlossinessPropertiesAsync(loader, context, material, properties);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
declare module BABYLON.GLTF2.Extensions {
|
|
declare module BABYLON.GLTF2.Extensions {
|
|
- class KHRLights extends GLTFLoaderExtension {
|
|
|
|
|
|
+ class KHR_lights extends GLTFLoaderExtension {
|
|
readonly name: string;
|
|
readonly name: string;
|
|
- private applyCommonProperties(light, lightInfo);
|
|
|
|
- protected _loadScene(loader: GLTFLoader, context: string, scene: IGLTFScene): boolean;
|
|
|
|
- protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
|
|
|
|
- protected _loadRoot(loader: GLTFLoader, context: string, root: BABYLON.GLTF2._IGLTF): boolean;
|
|
|
|
|
|
+ protected _loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
|
|
|
|
+ protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>;
|
|
|
|
+ private readonly _lights;
|
|
}
|
|
}
|
|
}
|
|
}
|