@babylonjs/loaders 7.20.1 → 7.21.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"MSFT_lod.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/MSFT_lod.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,yCAA2B;AAO9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGtD,MAAM,IAAI,GAAG,UAAU,CAAC;AAuBxB;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,QAAQ;IAiDjB;;OAEG;IACH,YAAY,MAAkB;QAnD9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAEnB;;WAEG;QACI,kBAAa,GAAG,EAAE,CAAC;QAE1B;;;;WAIG;QACI,+BAA0B,GAAG,IAAI,UAAU,EAAU,CAAC;QAE7D;;;;WAIG;QACI,mCAA8B,GAAG,IAAI,UAAU,EAAU,CAAC;QAIzD,gBAAW,GAAG,IAAI,KAAK,EAAe,CAAC;QAEvC,kBAAa,GAAqB,IAAI,CAAC;QACvC,oBAAe,GAAG,IAAI,KAAK,EAAkB,CAAC;QAC9C,qBAAgB,GAAG,IAAI,KAAK,EAAuB,CAAC;QACpD,oBAAe,GAAG,IAAI,KAAK,EAAe,CAAC;QAE3C,sBAAiB,GAAqB,IAAI,CAAC;QAC3C,wBAAmB,GAAG,IAAI,KAAK,EAAkB,CAAC;QAClD,yBAAoB,GAAG,IAAI,KAAK,EAAuB,CAAC;QACxD,wBAAmB,GAAG,IAAI,KAAK,EAAe,CAAC;QAMnD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,8FAA8F;QAC9F,oDAAoD;QACpD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,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CAAC,CAAC;iBACpC;aACJ;SACJ;QAED,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE;YACpC,eAAe,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;SACvC;IACL,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Deferred } from \"core/Misc/deferred\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { INode, IMaterial, IBuffer, IScene } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { IProperty, IMSFTLOD } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"MSFT_lod\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the MSFT_lod extension.\r\n */\r\n [NAME]?: Partial<{\r\n /**\r\n * Maximum number of LODs to load, starting from the lowest LOD.\r\n */\r\n maxLODsToLoad: number;\r\n }>;\r\n }\r\n}\r\n\r\ninterface IBufferInfo {\r\n start: number;\r\n end: number;\r\n loaded: Deferred<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/MSFT_lod/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class MSFT_lod implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 100;\r\n\r\n /**\r\n * Maximum number of LODs to load, starting from the lowest LOD.\r\n */\r\n public maxLODsToLoad = 10;\r\n\r\n /**\r\n * Observable raised when all node LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n public onNodeLODsLoadedObservable = new Observable<number>();\r\n\r\n /**\r\n * Observable raised when all material LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n public onMaterialLODsLoadedObservable = new Observable<number>();\r\n\r\n private _loader: GLTFLoader;\r\n\r\n private _bufferLODs = new Array<IBufferInfo>();\r\n\r\n private _nodeIndexLOD: Nullable<number> = null;\r\n private _nodeSignalLODs = new Array<Deferred<void>>();\r\n private _nodePromiseLODs = new Array<Array<Promise<any>>>();\r\n private _nodeBufferLODs = new Array<IBufferInfo>();\r\n\r\n private _materialIndexLOD: Nullable<number> = null;\r\n private _materialSignalLODs = new Array<Deferred<void>>();\r\n private _materialPromiseLODs = new Array<Array<Promise<any>>>();\r\n private _materialBufferLODs = new Array<IBufferInfo>();\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n // Options takes precedence. The maxLODsToLoad extension property is retained for back compat.\r\n // For new extensions, they should only use options.\r\n this.maxLODsToLoad = this._loader.parent.extensionOptions[NAME]?.maxLODsToLoad ?? this.maxLODsToLoad;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n\r\n this._nodeIndexLOD = null;\r\n this._nodeSignalLODs.length = 0;\r\n this._nodePromiseLODs.length = 0;\r\n this._nodeBufferLODs.length = 0;\r\n\r\n this._materialIndexLOD = null;\r\n this._materialSignalLODs.length = 0;\r\n this._materialPromiseLODs.length = 0;\r\n this._materialBufferLODs.length = 0;\r\n\r\n this.onMaterialLODsLoadedObservable.clear();\r\n this.onNodeLODsLoadedObservable.clear();\r\n }\r\n\r\n /** @internal */\r\n public onReady(): void {\r\n for (let indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {\r\n const promise = Promise.all(this._nodePromiseLODs[indexLOD]).then(() => {\r\n if (indexLOD !== 0) {\r\n this._loader.endPerformanceCounter(`Node LOD ${indexLOD}`);\r\n this._loader.log(`Loaded node LOD ${indexLOD}`);\r\n }\r\n\r\n this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);\r\n\r\n if (indexLOD !== this._nodePromiseLODs.length - 1) {\r\n this._loader.startPerformanceCounter(`Node LOD ${indexLOD + 1}`);\r\n this._loadBufferLOD(this._nodeBufferLODs, indexLOD + 1);\r\n if (this._nodeSignalLODs[indexLOD]) {\r\n this._nodeSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n\r\n this._loader._completePromises.push(promise);\r\n }\r\n\r\n for (let indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {\r\n const promise = Promise.all(this._materialPromiseLODs[indexLOD]).then(() => {\r\n if (indexLOD !== 0) {\r\n this._loader.endPerformanceCounter(`Material LOD ${indexLOD}`);\r\n this._loader.log(`Loaded material LOD ${indexLOD}`);\r\n }\r\n\r\n this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);\r\n\r\n if (indexLOD !== this._materialPromiseLODs.length - 1) {\r\n this._loader.startPerformanceCounter(`Material LOD ${indexLOD + 1}`);\r\n this._loadBufferLOD(this._materialBufferLODs, indexLOD + 1);\r\n if (this._materialSignalLODs[indexLOD]) {\r\n this._materialSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n\r\n this._loader._completePromises.push(promise);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>> {\r\n const promise = this._loader.loadSceneAsync(context, scene);\r\n this._loadBufferLOD(this._bufferLODs, 0);\r\n return promise;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IMSFTLOD, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n let firstPromise: Promise<TransformNode>;\r\n\r\n const nodeLODs = this._getLODs(extensionContext, node, this._loader.gltf.nodes, extension.ids);\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n for (let indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {\r\n const nodeLOD = nodeLODs[indexLOD];\r\n\r\n if (indexLOD !== 0) {\r\n this._nodeIndexLOD = indexLOD;\r\n this._nodeSignalLODs[indexLOD] = this._nodeSignalLODs[indexLOD] || new Deferred();\r\n }\r\n\r\n const assignWrap = (babylonTransformNode: TransformNode) => {\r\n assign(babylonTransformNode);\r\n babylonTransformNode.setEnabled(false);\r\n };\r\n\r\n const promise = this._loader.loadNodeAsync(`/nodes/${nodeLOD.index}`, nodeLOD, assignWrap).then((babylonMesh) => {\r\n if (indexLOD !== 0) {\r\n // TODO: should not rely on _babylonTransformNode\r\n const previousNodeLOD = nodeLODs[indexLOD - 1];\r\n if (previousNodeLOD._babylonTransformNode) {\r\n this._disposeTransformNode(previousNodeLOD._babylonTransformNode);\r\n delete previousNodeLOD._babylonTransformNode;\r\n }\r\n }\r\n\r\n babylonMesh.setEnabled(true);\r\n return babylonMesh;\r\n });\r\n\r\n this._nodePromiseLODs[indexLOD] = this._nodePromiseLODs[indexLOD] || [];\r\n\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n } else {\r\n this._nodeIndexLOD = null;\r\n this._nodePromiseLODs[indexLOD].push(promise);\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n return firstPromise!;\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _loadMaterialAsync(\r\n context: string,\r\n material: IMaterial,\r\n babylonMesh: Nullable<Mesh>,\r\n babylonDrawMode: number,\r\n assign: (babylonMaterial: Material) => void\r\n ): Nullable<Promise<Material>> {\r\n // Don't load material LODs if already loading a node LOD.\r\n if (this._nodeIndexLOD) {\r\n return null;\r\n }\r\n\r\n return GLTFLoader.LoadExtensionAsync<IMSFTLOD, Material>(context, material, this.name, (extensionContext, extension) => {\r\n let firstPromise: Promise<Material>;\r\n\r\n const materialLODs = this._getLODs(extensionContext, material, this._loader.gltf.materials, extension.ids);\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n for (let indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {\r\n const materialLOD = materialLODs[indexLOD];\r\n\r\n if (indexLOD !== 0) {\r\n this._materialIndexLOD = indexLOD;\r\n }\r\n\r\n const promise = this._loader\r\n ._loadMaterialAsync(`/materials/${materialLOD.index}`, materialLOD, babylonMesh, babylonDrawMode, (babylonMaterial) => {\r\n if (indexLOD === 0) {\r\n assign(babylonMaterial);\r\n }\r\n })\r\n .then((babylonMaterial) => {\r\n if (indexLOD !== 0) {\r\n assign(babylonMaterial);\r\n\r\n // TODO: should not rely on _data\r\n const previousDataLOD = materialLODs[indexLOD - 1]._data!;\r\n if (previousDataLOD[babylonDrawMode]) {\r\n this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);\r\n delete previousDataLOD[babylonDrawMode];\r\n }\r\n }\r\n\r\n return babylonMaterial;\r\n });\r\n\r\n this._materialPromiseLODs[indexLOD] = this._materialPromiseLODs[indexLOD] || [];\r\n\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n } else {\r\n this._materialIndexLOD = null;\r\n this._materialPromiseLODs[indexLOD].push(promise);\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n return firstPromise!;\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _loadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>> {\r\n // Defer the loading of uris if loading a node or material LOD.\r\n if (this._nodeIndexLOD !== null) {\r\n this._loader.log(`deferred`);\r\n const previousIndexLOD = this._nodeIndexLOD - 1;\r\n this._nodeSignalLODs[previousIndexLOD] = this._nodeSignalLODs[previousIndexLOD] || new Deferred<void>();\r\n return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(() => {\r\n return this._loader.loadUriAsync(context, property, uri);\r\n });\r\n } else if (this._materialIndexLOD !== null) {\r\n this._loader.log(`deferred`);\r\n const previousIndexLOD = this._materialIndexLOD - 1;\r\n this._materialSignalLODs[previousIndexLOD] = this._materialSignalLODs[previousIndexLOD] || new Deferred<void>();\r\n return this._materialSignalLODs[previousIndexLOD].promise.then(() => {\r\n return this._loader.loadUriAsync(context, property, uri);\r\n });\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>> {\r\n if (this._loader.parent.useRangeRequests && !buffer.uri) {\r\n if (!this._loader.bin) {\r\n throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);\r\n }\r\n\r\n const loadAsync = (bufferLODs: Array<IBufferInfo>, indexLOD: number) => {\r\n const start = byteOffset;\r\n const end = start + byteLength - 1;\r\n let bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n bufferLOD.start = Math.min(bufferLOD.start, start);\r\n bufferLOD.end = Math.max(bufferLOD.end, end);\r\n } else {\r\n bufferLOD = { start: start, end: end, loaded: new Deferred() };\r\n bufferLODs[indexLOD] = bufferLOD;\r\n }\r\n\r\n return bufferLOD.loaded.promise.then((data) => {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset - bufferLOD.start, byteLength);\r\n });\r\n };\r\n\r\n this._loader.log(`deferred`);\r\n\r\n if (this._nodeIndexLOD !== null) {\r\n return loadAsync(this._nodeBufferLODs, this._nodeIndexLOD);\r\n } else if (this._materialIndexLOD !== null) {\r\n return loadAsync(this._materialBufferLODs, this._materialIndexLOD);\r\n } else {\r\n return loadAsync(this._bufferLODs, 0);\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private _loadBufferLOD(bufferLODs: Array<IBufferInfo>, indexLOD: number): void {\r\n const bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n this._loader.log(`Loading buffer range [${bufferLOD.start}-${bufferLOD.end}]`);\r\n this._loader.bin!.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then(\r\n (data) => {\r\n bufferLOD.loaded.resolve(data);\r\n },\r\n (error) => {\r\n bufferLOD.loaded.reject(error);\r\n }\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * @returns an array of LOD properties from lowest to highest.\r\n * @param context\r\n * @param property\r\n * @param array\r\n * @param ids\r\n */\r\n private _getLODs<T>(context: string, property: T, array: ArrayLike<T> | undefined, ids: number[]): T[] {\r\n if (this.maxLODsToLoad <= 0) {\r\n throw new Error(\"maxLODsToLoad must be greater than zero\");\r\n }\r\n\r\n const properties: T[] = [];\r\n\r\n for (let i = ids.length - 1; i >= 0; i--) {\r\n properties.push(ArrayItem.Get(`${context}/ids/${ids[i]}`, array, ids[i]));\r\n if (properties.length === this.maxLODsToLoad) {\r\n return properties;\r\n }\r\n }\r\n\r\n properties.push(property);\r\n return properties;\r\n }\r\n\r\n private _disposeTransformNode(babylonTransformNode: TransformNode): void {\r\n const babylonMaterials: Material[] = [];\r\n const babylonMaterial = (babylonTransformNode as Mesh).material;\r\n if (babylonMaterial) {\r\n babylonMaterials.push(babylonMaterial);\r\n }\r\n for (const babylonMesh of babylonTransformNode.getChildMeshes()) {\r\n if (babylonMesh.material) {\r\n babylonMaterials.push(babylonMesh.material);\r\n }\r\n }\r\n\r\n babylonTransformNode.dispose();\r\n\r\n const babylonMaterialsToDispose = babylonMaterials.filter((babylonMaterial) => this._loader.babylonScene.meshes.every((mesh) => mesh.material != babylonMaterial));\r\n this._disposeMaterials(babylonMaterialsToDispose);\r\n }\r\n\r\n private _disposeMaterials(babylonMaterials: Material[]): void {\r\n const babylonTextures: { [uniqueId: number]: BaseTexture } = {};\r\n\r\n for (const babylonMaterial of babylonMaterials) {\r\n for (const babylonTexture of babylonMaterial.getActiveTextures()) {\r\n babylonTextures[babylonTexture.uniqueId] = babylonTexture;\r\n }\r\n\r\n babylonMaterial.dispose();\r\n }\r\n\r\n for (const uniqueId in babylonTextures) {\r\n for (const babylonMaterial of this._loader.babylonScene.materials) {\r\n if (babylonMaterial.hasTexture(babylonTextures[uniqueId])) {\r\n delete babylonTextures[uniqueId];\r\n }\r\n }\r\n }\r\n\r\n for (const uniqueId in babylonTextures) {\r\n babylonTextures[uniqueId].dispose();\r\n }\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_lod(loader));\r\n"]}
1
+ {"version":3,"file":"MSFT_lod.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/MSFT_lod.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,yCAA2B;AAO9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGtD,MAAM,IAAI,GAAG,UAAU,CAAC;AAuBxB;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,QAAQ;IAiDjB;;OAEG;IACH,YAAY,MAAkB;QAnD9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAEnB;;WAEG;QACI,kBAAa,GAAG,EAAE,CAAC;QAE1B;;;;WAIG;QACI,+BAA0B,GAAG,IAAI,UAAU,EAAU,CAAC;QAE7D;;;;WAIG;QACI,mCAA8B,GAAG,IAAI,UAAU,EAAU,CAAC;QAIzD,gBAAW,GAAG,IAAI,KAAK,EAAe,CAAC;QA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4B;QAClD,MAAM,eAAe,GAAwC,EAAE,CAAC;QAEhE,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE;YAC5C,KAAK,MAAM,cAAc,IAAI,eAAe,CAAC,iBAAiB,EAAE,EAAE;gBAC9D,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC;aAC7D;YAED,eAAe,CAAC,OAAO,EAAE,CAAC;SAC7B;QAED,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE;YACpC,KAAK,MAAM,eAAe,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE;gBAC/D,IAAI,eAAe,CAAC,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,EAAE;oBACvD,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;iBACpC;aACJ;SACJ;QAED,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE;YACpC,eAAe,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;SACvC;IACL,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Deferred } from \"core/Misc/deferred\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { INode, IMaterial, IBuffer, IScene } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { IProperty, IMSFTLOD } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"MSFT_lod\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the MSFT_lod extension.\r\n */\r\n [\"MSFT_lod\"]?: Partial<{\r\n /**\r\n * Maximum number of LODs to load, starting from the lowest LOD.\r\n */\r\n maxLODsToLoad: number;\r\n }>;\r\n }\r\n}\r\n\r\ninterface IBufferInfo {\r\n start: number;\r\n end: number;\r\n loaded: Deferred<ArrayBufferView>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/MSFT_lod/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class MSFT_lod implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 100;\r\n\r\n /**\r\n * Maximum number of LODs to load, starting from the lowest LOD.\r\n */\r\n public maxLODsToLoad = 10;\r\n\r\n /**\r\n * Observable raised when all node LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n public onNodeLODsLoadedObservable = new Observable<number>();\r\n\r\n /**\r\n * Observable raised when all material LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n public onMaterialLODsLoadedObservable = new Observable<number>();\r\n\r\n private _loader: GLTFLoader;\r\n\r\n private _bufferLODs = new Array<IBufferInfo>();\r\n\r\n private _nodeIndexLOD: Nullable<number> = null;\r\n private _nodeSignalLODs = new Array<Deferred<void>>();\r\n private _nodePromiseLODs = new Array<Array<Promise<any>>>();\r\n private _nodeBufferLODs = new Array<IBufferInfo>();\r\n\r\n private _materialIndexLOD: Nullable<number> = null;\r\n private _materialSignalLODs = new Array<Deferred<void>>();\r\n private _materialPromiseLODs = new Array<Array<Promise<any>>>();\r\n private _materialBufferLODs = new Array<IBufferInfo>();\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n // Options takes precedence. The maxLODsToLoad extension property is retained for back compat.\r\n // For new extensions, they should only use options.\r\n this.maxLODsToLoad = this._loader.parent.extensionOptions[NAME]?.maxLODsToLoad ?? this.maxLODsToLoad;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n\r\n this._nodeIndexLOD = null;\r\n this._nodeSignalLODs.length = 0;\r\n this._nodePromiseLODs.length = 0;\r\n this._nodeBufferLODs.length = 0;\r\n\r\n this._materialIndexLOD = null;\r\n this._materialSignalLODs.length = 0;\r\n this._materialPromiseLODs.length = 0;\r\n this._materialBufferLODs.length = 0;\r\n\r\n this.onMaterialLODsLoadedObservable.clear();\r\n this.onNodeLODsLoadedObservable.clear();\r\n }\r\n\r\n /** @internal */\r\n public onReady(): void {\r\n for (let indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {\r\n const promise = Promise.all(this._nodePromiseLODs[indexLOD]).then(() => {\r\n if (indexLOD !== 0) {\r\n this._loader.endPerformanceCounter(`Node LOD ${indexLOD}`);\r\n this._loader.log(`Loaded node LOD ${indexLOD}`);\r\n }\r\n\r\n this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);\r\n\r\n if (indexLOD !== this._nodePromiseLODs.length - 1) {\r\n this._loader.startPerformanceCounter(`Node LOD ${indexLOD + 1}`);\r\n this._loadBufferLOD(this._nodeBufferLODs, indexLOD + 1);\r\n if (this._nodeSignalLODs[indexLOD]) {\r\n this._nodeSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n\r\n this._loader._completePromises.push(promise);\r\n }\r\n\r\n for (let indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {\r\n const promise = Promise.all(this._materialPromiseLODs[indexLOD]).then(() => {\r\n if (indexLOD !== 0) {\r\n this._loader.endPerformanceCounter(`Material LOD ${indexLOD}`);\r\n this._loader.log(`Loaded material LOD ${indexLOD}`);\r\n }\r\n\r\n this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);\r\n\r\n if (indexLOD !== this._materialPromiseLODs.length - 1) {\r\n this._loader.startPerformanceCounter(`Material LOD ${indexLOD + 1}`);\r\n this._loadBufferLOD(this._materialBufferLODs, indexLOD + 1);\r\n if (this._materialSignalLODs[indexLOD]) {\r\n this._materialSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n\r\n this._loader._completePromises.push(promise);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>> {\r\n const promise = this._loader.loadSceneAsync(context, scene);\r\n this._loadBufferLOD(this._bufferLODs, 0);\r\n return promise;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IMSFTLOD, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n let firstPromise: Promise<TransformNode>;\r\n\r\n const nodeLODs = this._getLODs(extensionContext, node, this._loader.gltf.nodes, extension.ids);\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n for (let indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {\r\n const nodeLOD = nodeLODs[indexLOD];\r\n\r\n if (indexLOD !== 0) {\r\n this._nodeIndexLOD = indexLOD;\r\n this._nodeSignalLODs[indexLOD] = this._nodeSignalLODs[indexLOD] || new Deferred();\r\n }\r\n\r\n const assignWrap = (babylonTransformNode: TransformNode) => {\r\n assign(babylonTransformNode);\r\n babylonTransformNode.setEnabled(false);\r\n };\r\n\r\n const promise = this._loader.loadNodeAsync(`/nodes/${nodeLOD.index}`, nodeLOD, assignWrap).then((babylonMesh) => {\r\n if (indexLOD !== 0) {\r\n // TODO: should not rely on _babylonTransformNode\r\n const previousNodeLOD = nodeLODs[indexLOD - 1];\r\n if (previousNodeLOD._babylonTransformNode) {\r\n this._disposeTransformNode(previousNodeLOD._babylonTransformNode);\r\n delete previousNodeLOD._babylonTransformNode;\r\n }\r\n }\r\n\r\n babylonMesh.setEnabled(true);\r\n return babylonMesh;\r\n });\r\n\r\n this._nodePromiseLODs[indexLOD] = this._nodePromiseLODs[indexLOD] || [];\r\n\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n } else {\r\n this._nodeIndexLOD = null;\r\n this._nodePromiseLODs[indexLOD].push(promise);\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n return firstPromise!;\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _loadMaterialAsync(\r\n context: string,\r\n material: IMaterial,\r\n babylonMesh: Nullable<Mesh>,\r\n babylonDrawMode: number,\r\n assign: (babylonMaterial: Material) => void\r\n ): Nullable<Promise<Material>> {\r\n // Don't load material LODs if already loading a node LOD.\r\n if (this._nodeIndexLOD) {\r\n return null;\r\n }\r\n\r\n return GLTFLoader.LoadExtensionAsync<IMSFTLOD, Material>(context, material, this.name, (extensionContext, extension) => {\r\n let firstPromise: Promise<Material>;\r\n\r\n const materialLODs = this._getLODs(extensionContext, material, this._loader.gltf.materials, extension.ids);\r\n this._loader.logOpen(`${extensionContext}`);\r\n\r\n for (let indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {\r\n const materialLOD = materialLODs[indexLOD];\r\n\r\n if (indexLOD !== 0) {\r\n this._materialIndexLOD = indexLOD;\r\n }\r\n\r\n const promise = this._loader\r\n ._loadMaterialAsync(`/materials/${materialLOD.index}`, materialLOD, babylonMesh, babylonDrawMode, (babylonMaterial) => {\r\n if (indexLOD === 0) {\r\n assign(babylonMaterial);\r\n }\r\n })\r\n .then((babylonMaterial) => {\r\n if (indexLOD !== 0) {\r\n assign(babylonMaterial);\r\n\r\n // TODO: should not rely on _data\r\n const previousDataLOD = materialLODs[indexLOD - 1]._data!;\r\n if (previousDataLOD[babylonDrawMode]) {\r\n this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);\r\n delete previousDataLOD[babylonDrawMode];\r\n }\r\n }\r\n\r\n return babylonMaterial;\r\n });\r\n\r\n this._materialPromiseLODs[indexLOD] = this._materialPromiseLODs[indexLOD] || [];\r\n\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n } else {\r\n this._materialIndexLOD = null;\r\n this._materialPromiseLODs[indexLOD].push(promise);\r\n }\r\n }\r\n\r\n this._loader.logClose();\r\n return firstPromise!;\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _loadUriAsync(context: string, property: IProperty, uri: string): Nullable<Promise<ArrayBufferView>> {\r\n // Defer the loading of uris if loading a node or material LOD.\r\n if (this._nodeIndexLOD !== null) {\r\n this._loader.log(`deferred`);\r\n const previousIndexLOD = this._nodeIndexLOD - 1;\r\n this._nodeSignalLODs[previousIndexLOD] = this._nodeSignalLODs[previousIndexLOD] || new Deferred<void>();\r\n return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(() => {\r\n return this._loader.loadUriAsync(context, property, uri);\r\n });\r\n } else if (this._materialIndexLOD !== null) {\r\n this._loader.log(`deferred`);\r\n const previousIndexLOD = this._materialIndexLOD - 1;\r\n this._materialSignalLODs[previousIndexLOD] = this._materialSignalLODs[previousIndexLOD] || new Deferred<void>();\r\n return this._materialSignalLODs[previousIndexLOD].promise.then(() => {\r\n return this._loader.loadUriAsync(context, property, uri);\r\n });\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadBufferAsync(context: string, buffer: IBuffer, byteOffset: number, byteLength: number): Nullable<Promise<ArrayBufferView>> {\r\n if (this._loader.parent.useRangeRequests && !buffer.uri) {\r\n if (!this._loader.bin) {\r\n throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);\r\n }\r\n\r\n const loadAsync = (bufferLODs: Array<IBufferInfo>, indexLOD: number) => {\r\n const start = byteOffset;\r\n const end = start + byteLength - 1;\r\n let bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n bufferLOD.start = Math.min(bufferLOD.start, start);\r\n bufferLOD.end = Math.max(bufferLOD.end, end);\r\n } else {\r\n bufferLOD = { start: start, end: end, loaded: new Deferred() };\r\n bufferLODs[indexLOD] = bufferLOD;\r\n }\r\n\r\n return bufferLOD.loaded.promise.then((data) => {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset - bufferLOD.start, byteLength);\r\n });\r\n };\r\n\r\n this._loader.log(`deferred`);\r\n\r\n if (this._nodeIndexLOD !== null) {\r\n return loadAsync(this._nodeBufferLODs, this._nodeIndexLOD);\r\n } else if (this._materialIndexLOD !== null) {\r\n return loadAsync(this._materialBufferLODs, this._materialIndexLOD);\r\n } else {\r\n return loadAsync(this._bufferLODs, 0);\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private _loadBufferLOD(bufferLODs: Array<IBufferInfo>, indexLOD: number): void {\r\n const bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n this._loader.log(`Loading buffer range [${bufferLOD.start}-${bufferLOD.end}]`);\r\n this._loader.bin!.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then(\r\n (data) => {\r\n bufferLOD.loaded.resolve(data);\r\n },\r\n (error) => {\r\n bufferLOD.loaded.reject(error);\r\n }\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * @returns an array of LOD properties from lowest to highest.\r\n * @param context\r\n * @param property\r\n * @param array\r\n * @param ids\r\n */\r\n private _getLODs<T>(context: string, property: T, array: ArrayLike<T> | undefined, ids: number[]): T[] {\r\n if (this.maxLODsToLoad <= 0) {\r\n throw new Error(\"maxLODsToLoad must be greater than zero\");\r\n }\r\n\r\n const properties: T[] = [];\r\n\r\n for (let i = ids.length - 1; i >= 0; i--) {\r\n properties.push(ArrayItem.Get(`${context}/ids/${ids[i]}`, array, ids[i]));\r\n if (properties.length === this.maxLODsToLoad) {\r\n return properties;\r\n }\r\n }\r\n\r\n properties.push(property);\r\n return properties;\r\n }\r\n\r\n private _disposeTransformNode(babylonTransformNode: TransformNode): void {\r\n const babylonMaterials: Material[] = [];\r\n const babylonMaterial = (babylonTransformNode as Mesh).material;\r\n if (babylonMaterial) {\r\n babylonMaterials.push(babylonMaterial);\r\n }\r\n for (const babylonMesh of babylonTransformNode.getChildMeshes()) {\r\n if (babylonMesh.material) {\r\n babylonMaterials.push(babylonMesh.material);\r\n }\r\n }\r\n\r\n babylonTransformNode.dispose();\r\n\r\n const babylonMaterialsToDispose = babylonMaterials.filter((babylonMaterial) => this._loader.babylonScene.meshes.every((mesh) => mesh.material != babylonMaterial));\r\n this._disposeMaterials(babylonMaterialsToDispose);\r\n }\r\n\r\n private _disposeMaterials(babylonMaterials: Material[]): void {\r\n const babylonTextures: { [uniqueId: number]: BaseTexture } = {};\r\n\r\n for (const babylonMaterial of babylonMaterials) {\r\n for (const babylonTexture of babylonMaterial.getActiveTextures()) {\r\n babylonTextures[babylonTexture.uniqueId] = babylonTexture;\r\n }\r\n\r\n babylonMaterial.dispose();\r\n }\r\n\r\n for (const uniqueId in babylonTextures) {\r\n for (const babylonMaterial of this._loader.babylonScene.materials) {\r\n if (babylonMaterial.hasTexture(babylonTextures[uniqueId])) {\r\n delete babylonTextures[uniqueId];\r\n }\r\n }\r\n }\r\n\r\n for (const uniqueId in babylonTextures) {\r\n babylonTextures[uniqueId].dispose();\r\n }\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_lod(loader));\r\n"]}
@@ -120,8 +120,12 @@ type DefaultExtensionOptions<BaseExtensionOptions> = {
120
120
  */
121
121
  enabled?: boolean;
122
122
  } & BaseExtensionOptions;
123
- declare class GLTFLoaderOptions {
124
- constructor(options?: Partial<Readonly<GLTFLoaderOptions>>);
123
+ declare abstract class GLTFLoaderOptions {
124
+ protected copyFrom(options?: Partial<Readonly<GLTFLoaderOptions>>): void;
125
+ /**
126
+ * Raised when the asset has been parsed
127
+ */
128
+ abstract onParsed: (loaderData: IGLTFLoaderData) => void;
125
129
  /**
126
130
  * The coordinate system mode. Defaults to AUTO.
127
131
  */
@@ -211,6 +215,28 @@ declare class GLTFLoaderOptions {
211
215
  * You can also pass null if you don't want a root node to be created.
212
216
  */
213
217
  customRootNode?: Nullable<TransformNode>;
218
+ /**
219
+ * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
220
+ * Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)
221
+ */
222
+ abstract onMeshLoaded: (mesh: AbstractMesh) => void;
223
+ /**
224
+ * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
225
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
226
+ */
227
+ abstract onSkinLoaded: (node: TransformNode, skinnedNode: TransformNode) => void;
228
+ /**
229
+ * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
230
+ */
231
+ abstract onTextureLoaded: (texture: BaseTexture) => void;
232
+ /**
233
+ * Callback raised when the loader creates a material after parsing the glTF properties of the material.
234
+ */
235
+ abstract onMaterialLoaded: (material: Material) => void;
236
+ /**
237
+ * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.
238
+ */
239
+ abstract onCameraLoaded: (camera: Camera) => void;
214
240
  /**
215
241
  * Defines options for glTF extensions.
216
242
  */
@@ -228,6 +254,11 @@ export declare class GLTFFileLoader extends GLTFLoaderOptions implements IDispos
228
254
  static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader;
229
255
  /** @internal */
230
256
  static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader;
257
+ /**
258
+ * Creates a new glTF file loader.
259
+ * @param options The options for the loader
260
+ */
261
+ constructor(options?: Partial<Readonly<GLTFLoaderOptions>>);
231
262
  /**
232
263
  * Raised when the asset has been parsed
233
264
  */
@@ -262,7 +293,7 @@ export declare class GLTFFileLoader extends GLTFLoaderOptions implements IDispos
262
293
  */
263
294
  set onMeshLoaded(callback: (mesh: AbstractMesh) => void);
264
295
  /**
265
- * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
296
+ * Observable raised when the loader creates a skin after parsing the glTF properties of the skin node.
266
297
  * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
267
298
  * @param node - the transform node that corresponds to the original glTF skin node used for animations
268
299
  * @param skinnedNode - the transform node that is the skinned mesh itself or the parent of the skinned meshes
@@ -271,6 +302,12 @@ export declare class GLTFFileLoader extends GLTFLoaderOptions implements IDispos
271
302
  node: TransformNode;
272
303
  skinnedNode: TransformNode;
273
304
  }>;
305
+ private _onSkinLoadedObserver;
306
+ /**
307
+ * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
308
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
309
+ */
310
+ set onSkinLoaded(callback: (node: TransformNode, skinnedNode: TransformNode) => void);
274
311
  /**
275
312
  * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
276
313
  */
@@ -1,6 +1,6 @@
1
1
  import { Observable } from "@babylonjs/core/Misc/observable.js";
2
2
  import { Tools } from "@babylonjs/core/Misc/tools.js";
3
- import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader.js";
3
+ import { registerSceneLoaderPlugin } from "@babylonjs/core/Loading/sceneLoader.js";
4
4
  import { AssetContainer } from "@babylonjs/core/assetContainer.js";
5
5
  import { Logger } from "@babylonjs/core/Misc/logger.js";
6
6
  import { DataReader } from "@babylonjs/core/Misc/dataReader.js";
@@ -81,8 +81,7 @@ export var GLTFLoaderState;
81
81
  GLTFLoaderState[GLTFLoaderState["COMPLETE"] = 2] = "COMPLETE";
82
82
  })(GLTFLoaderState || (GLTFLoaderState = {}));
83
83
  class GLTFLoaderOptions {
84
- // eslint-disable-next-line babylonjs/available
85
- constructor(options) {
84
+ constructor() {
86
85
  // ----------
87
86
  // V2 options
88
87
  // ----------
@@ -174,10 +173,21 @@ class GLTFLoaderOptions {
174
173
  * Defines options for glTF extensions.
175
174
  */
176
175
  this.extensionOptions = {};
176
+ }
177
+ // eslint-disable-next-line babylonjs/available
178
+ copyFrom(options) {
177
179
  if (options) {
178
- for (const key in this) {
179
- const typedKey = key;
180
+ const copyOption = (option) => {
181
+ const typedKey = option;
180
182
  this[typedKey] = options[typedKey] ?? this[typedKey];
183
+ };
184
+ // Copy concrete properties
185
+ for (const option in this) {
186
+ copyOption(option);
187
+ }
188
+ // Copy abstract properties
189
+ for (const option of ["onParsed", "onMeshLoaded", "onSkinLoaded", "onTextureLoaded", "onMaterialLoaded", "onCameraLoaded"]) {
190
+ copyOption(option);
181
191
  }
182
192
  }
183
193
  }
@@ -186,22 +196,29 @@ class GLTFLoaderOptions {
186
196
  * File loader for loading glTF files into a scene.
187
197
  */
188
198
  export class GLTFFileLoader extends GLTFLoaderOptions {
189
- constructor() {
190
- super(...arguments);
191
- // --------------
192
- // Common options
193
- // --------------
199
+ /**
200
+ * Creates a new glTF file loader.
201
+ * @param options The options for the loader
202
+ */
203
+ constructor(options) {
204
+ super();
205
+ // --------------------
206
+ // Begin Common options
207
+ // --------------------
194
208
  /**
195
209
  * Raised when the asset has been parsed
196
210
  */
197
211
  this.onParsedObservable = new Observable();
212
+ // --------------
213
+ // End V1 options
214
+ // --------------
198
215
  /**
199
216
  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
200
217
  * Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)
201
218
  */
202
219
  this.onMeshLoadedObservable = new Observable();
203
220
  /**
204
- * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
221
+ * Observable raised when the loader creates a skin after parsing the glTF properties of the skin node.
205
222
  * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
206
223
  * @param node - the transform node that corresponds to the original glTF skin node used for animations
207
224
  * @param skinnedNode - the transform node that is the skinned mesh itself or the parent of the skinned meshes
@@ -271,6 +288,7 @@ export class GLTFFileLoader extends GLTFLoaderOptions {
271
288
  this._startPerformanceCounter = this._startPerformanceCounterDisabled;
272
289
  /** @internal */
273
290
  this._endPerformanceCounter = this._endPerformanceCounterDisabled;
291
+ this.copyFrom(options);
274
292
  }
275
293
  /**
276
294
  * Raised when the asset has been parsed
@@ -291,6 +309,16 @@ export class GLTFFileLoader extends GLTFLoaderOptions {
291
309
  }
292
310
  this._onMeshLoadedObserver = this.onMeshLoadedObservable.add(callback);
293
311
  }
312
+ /**
313
+ * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.
314
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh
315
+ */
316
+ set onSkinLoaded(callback) {
317
+ if (this._onSkinLoadedObserver) {
318
+ this.onSkinLoadedObservable.remove(this._onSkinLoadedObserver);
319
+ }
320
+ this._onSkinLoadedObserver = this.onSkinLoadedObservable.add((data) => callback(data.node, data.skinnedNode));
321
+ }
294
322
  /**
295
323
  * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
296
324
  */
@@ -890,9 +918,12 @@ export class GLTFFileLoader extends GLTFLoaderOptions {
890
918
  }
891
919
  _endPerformanceCounterDisabled(counterName) { }
892
920
  }
893
- // ----------
894
- // V1 options
895
- // ----------
921
+ // ------------------
922
+ // End Common options
923
+ // ------------------
924
+ // ----------------
925
+ // Begin V1 options
926
+ // ----------------
896
927
  /**
897
928
  * 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.
898
929
  * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
@@ -908,7 +939,5 @@ GLTFFileLoader.IncrementalLoading = true;
908
939
  GLTFFileLoader.HomogeneousCoordinates = false;
909
940
  GLTFFileLoader._MagicBase64Encoded = "Z2xURg"; // "glTF" base64 encoded (without the quotes!)
910
941
  GLTFFileLoader._logSpaces = " ";
911
- if (SceneLoader) {
912
- SceneLoader.RegisterPlugin(new GLTFFileLoader());
913
- }
942
+ registerSceneLoaderPlugin(new GLTFFileLoader());
914
943
  //# sourceMappingURL=glTFFileLoader.js.map