@babylonjs/loaders 5.0.0-rc.7 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.d.ts +4 -4
- package/OBJ/index.js +4 -4
- package/OBJ/mtlFileLoader.d.ts +41 -41
- package/OBJ/mtlFileLoader.js +232 -232
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +126 -126
- package/OBJ/objFileLoader.js +296 -296
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/OBJ/solidParser.d.ts +154 -154
- package/OBJ/solidParser.js +693 -693
- package/OBJ/solidParser.js.map +1 -1
- package/STL/index.d.ts +1 -1
- package/STL/index.js +1 -1
- package/STL/stlFileLoader.d.ts +64 -64
- package/STL/stlFileLoader.js +233 -233
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -60
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.d.ts +136 -136
- package/glTF/1.0/glTFLoader.js +1814 -1815
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.d.ts +63 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -250
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/1.0/index.d.ts +5 -5
- package/glTF/1.0/index.js +5 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -43
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -117
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -36
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -88
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -34
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -49
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -29
- package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -40
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -112
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -36
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -89
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -94
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -53
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -42
- package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -62
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -80
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -84
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -74
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -83
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -288
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -73
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -87
- package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -254
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -85
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -22
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -23
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -29
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -40
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -33
- package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -61
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -32
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -49
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -54
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -240
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -109
- package/glTF/2.0/Extensions/MSFT_lod.js +369 -369
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/index.d.ts +26 -26
- package/glTF/2.0/Extensions/index.js +26 -26
- package/glTF/2.0/glTFLoader.d.ts +406 -405
- package/glTF/2.0/glTFLoader.js +2366 -2366
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +5 -4
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +433 -433
- package/glTF/glTFFileLoader.js +927 -927
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -123
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +6 -5
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +15 -14
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -3
- package/legacy/legacy-glTF1FileLoader.js.map +1 -1
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +33 -32
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -3
- package/legacy/legacy-glTF2FileLoader.js.map +1 -1
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -4
- package/legacy/legacy-glTFFileLoader.js.map +1 -1
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +13 -12
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +13 -12
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +8 -7
- package/legacy/legacy.js.map +1 -1
- package/license.md +71 -0
- package/package.json +25 -6
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MSFT_lod.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/MSFT_lod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,yCAA2B;AAO9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGtD,IAAM,IAAI,GAAG,UAAU,CAAC;AAQxB;;GAEG;AACH;IAiDI;;;OAGG;IACH,kBAAY,MAAkB;QApD9B;;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;QAOnD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;I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EAAnC,KAAA,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAnC,cAAmC,EAAnC,IAAmC,EAAE;gBAA9D,IAAM,eAAe,SAAA;gBACtB,IAAI,eAAe,CAAC,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,EAAE;oBACvD,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;iBACpC;aACJ;SACJ;QAED,KAAK,IAAM,QAAQ,IAAI,eAAe,EAAE;YACpC,eAAe,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;SACvC;IACL,CAAC;IACL,eAAC;AAAD,CAAC,AAxZD,IAwZC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,QAAQ,CAAC,MAAM,CAAC,EAApB,CAAoB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Deferred } from \"core/Misc/deferred\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { INode, IMaterial, IBuffer, IScene } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { IProperty, IMSFTLOD } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"MSFT_lod\";\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/tree/master/extensions/2.0/Vendor/MSFT_lod)\r\n */\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 * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\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 /** @hidden */\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 * @param context\r\n * @param scene\r\n * @hidden\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 * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\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 * @param context\r\n * @param material\r\n * @param babylonMesh\r\n * @param babylonDrawMode\r\n * @param assign\r\n * @hidden\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 * @param context\r\n * @param property\r\n * @param uri\r\n * @hidden\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 * @param context\r\n * @param buffer\r\n * @param byteOffset\r\n * @param byteLength\r\n * @hidden\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 * Gets 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 = new Array<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 = new Array<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":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/MSFT_lod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,yCAA2B;AAO9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGtD,IAAM,IAAI,GAAG,UAAU,CAAC;AAQxB;;GAEG;AACH;IAiDI;;;OAGG;IACH,kBAAY,MAAkB;QApD9B;;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,U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,CAAC;QACnK,IAAI,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAEO,oCAAiB,GAAzB,UAA0B,gBAA4B;QAClD,IAAM,eAAe,GAAwC,EAAE,CAAC;QAEhE,KAA8B,UAAgB,EAAhB,qCAAgB,EAAhB,8BAAgB,EAAhB,IAAgB,EAAE;YAA3C,IAAM,eAAe,yBAAA;YACtB,KAA6B,UAAmC,EAAnC,KAAA,eAAe,CAAC,iBAAiB,EAAE,EAAnC,cAAmC,EAAnC,IAAmC,EAAE;gBAA7D,IAAM,cAAc,SAAA;gBACrB,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC;aAC7D;YAED,eAAe,CAAC,OAAO,EAAE,CAAC;SAC7B;QAED,KAAK,IAAM,QAAQ,IAAI,eAAe,EAAE;YACpC,KAA8B,UAAmC,EAAnC,KAAA,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAnC,cAAmC,EAAnC,IAAmC,EAAE;gBAA9D,IAAM,eAAe,SAAA;gBACtB,IAAI,eAAe,CAAC,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,EAAE;oBACvD,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;iBACpC;aACJ;SACJ;QAED,KAAK,IAAM,QAAQ,IAAI,eAAe,EAAE;YACpC,eAAe,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;SACvC;IACL,CAAC;IACL,eAAC;AAAD,CAAC,AAxZD,IAwZC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,QAAQ,CAAC,MAAM,CAAC,EAApB,CAAoB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport 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\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/tree/master/extensions/2.0/Vendor/MSFT_lod)\r\n */\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 * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\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 /** @hidden */\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 * @param context\r\n * @param scene\r\n * @hidden\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 * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\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 * @param context\r\n * @param material\r\n * @param babylonMesh\r\n * @param babylonDrawMode\r\n * @param assign\r\n * @hidden\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 * @param context\r\n * @param property\r\n * @param uri\r\n * @hidden\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 * @param context\r\n * @param buffer\r\n * @param byteOffset\r\n * @param byteLength\r\n * @hidden\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 * Gets 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 = new Array<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 = new Array<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,14 +1,14 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
3
|
-
import { IMaterial } from "../glTFLoaderInterfaces";
|
4
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
-
import { GLTFLoader } from "../glTFLoader";
|
6
|
-
/** @hidden */
|
7
|
-
export declare class MSFT_minecraftMesh implements IGLTFLoaderExtension {
|
8
|
-
readonly name = "MSFT_minecraftMesh";
|
9
|
-
enabled: boolean;
|
10
|
-
private _loader;
|
11
|
-
constructor(loader: GLTFLoader);
|
12
|
-
dispose(): void;
|
13
|
-
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
14
|
-
}
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { Material } from "@babylonjs/core/Materials/material.js";
|
3
|
+
import type { IMaterial } from "../glTFLoaderInterfaces";
|
4
|
+
import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
+
import { GLTFLoader } from "../glTFLoader";
|
6
|
+
/** @hidden */
|
7
|
+
export declare class MSFT_minecraftMesh implements IGLTFLoaderExtension {
|
8
|
+
readonly name = "MSFT_minecraftMesh";
|
9
|
+
enabled: boolean;
|
10
|
+
private _loader;
|
11
|
+
constructor(loader: GLTFLoader);
|
12
|
+
dispose(): void;
|
13
|
+
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
14
|
+
}
|
@@ -1,37 +1,37 @@
|
|
1
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
|
-
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
-
var NAME = "MSFT_minecraftMesh";
|
4
|
-
/** @hidden */
|
5
|
-
var MSFT_minecraftMesh = /** @class */ (function () {
|
6
|
-
function MSFT_minecraftMesh(loader) {
|
7
|
-
this.name = NAME;
|
8
|
-
this._loader = loader;
|
9
|
-
this.enabled = this._loader.isExtensionUsed(NAME);
|
10
|
-
}
|
11
|
-
MSFT_minecraftMesh.prototype.dispose = function () {
|
12
|
-
this._loader = null;
|
13
|
-
};
|
14
|
-
MSFT_minecraftMesh.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
15
|
-
var _this = this;
|
16
|
-
return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {
|
17
|
-
if (extra) {
|
18
|
-
if (!(babylonMaterial instanceof PBRMaterial)) {
|
19
|
-
throw new Error("".concat(extraContext, ": Material type not supported"));
|
20
|
-
}
|
21
|
-
var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);
|
22
|
-
if (babylonMaterial.needAlphaBlending()) {
|
23
|
-
babylonMaterial.forceDepthWrite = true;
|
24
|
-
babylonMaterial.separateCullingPass = true;
|
25
|
-
}
|
26
|
-
babylonMaterial.backFaceCulling = babylonMaterial.forceDepthWrite;
|
27
|
-
babylonMaterial.twoSidedLighting = true;
|
28
|
-
return promise;
|
29
|
-
}
|
30
|
-
return null;
|
31
|
-
});
|
32
|
-
};
|
33
|
-
return MSFT_minecraftMesh;
|
34
|
-
}());
|
35
|
-
export { MSFT_minecraftMesh };
|
36
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_minecraftMesh(loader); });
|
1
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
|
+
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
var NAME = "MSFT_minecraftMesh";
|
4
|
+
/** @hidden */
|
5
|
+
var MSFT_minecraftMesh = /** @class */ (function () {
|
6
|
+
function MSFT_minecraftMesh(loader) {
|
7
|
+
this.name = NAME;
|
8
|
+
this._loader = loader;
|
9
|
+
this.enabled = this._loader.isExtensionUsed(NAME);
|
10
|
+
}
|
11
|
+
MSFT_minecraftMesh.prototype.dispose = function () {
|
12
|
+
this._loader = null;
|
13
|
+
};
|
14
|
+
MSFT_minecraftMesh.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
15
|
+
var _this = this;
|
16
|
+
return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {
|
17
|
+
if (extra) {
|
18
|
+
if (!(babylonMaterial instanceof PBRMaterial)) {
|
19
|
+
throw new Error("".concat(extraContext, ": Material type not supported"));
|
20
|
+
}
|
21
|
+
var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);
|
22
|
+
if (babylonMaterial.needAlphaBlending()) {
|
23
|
+
babylonMaterial.forceDepthWrite = true;
|
24
|
+
babylonMaterial.separateCullingPass = true;
|
25
|
+
}
|
26
|
+
babylonMaterial.backFaceCulling = babylonMaterial.forceDepthWrite;
|
27
|
+
babylonMaterial.twoSidedLighting = true;
|
28
|
+
return promise;
|
29
|
+
}
|
30
|
+
return null;
|
31
|
+
});
|
32
|
+
};
|
33
|
+
return MSFT_minecraftMesh;
|
34
|
+
}());
|
35
|
+
export { MSFT_minecraftMesh };
|
36
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_minecraftMesh(loader); });
|
37
37
|
//# sourceMappingURL=MSFT_minecraftMesh.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MSFT_minecraftMesh.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/MSFT_minecraftMesh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,IAAM,IAAI,GAAG,oBAAoB,CAAC;AAElC,cAAc;AACd;IAMI,4BAAY,MAAkB;QALd,SAAI,GAAG,IAAI,CAAC;QAMxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAEM,oCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAEM,wDAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAsBC;QArBG,OAAO,UAAU,CAAC,cAAc,CAAU,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,YAAY,EAAE,KAAK;YACxF,IAAI,KAAK,EAAE;gBACP,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;oBAC3C,MAAM,IAAI,KAAK,CAAC,UAAG,YAAY,kCAA+B,CAAC,CAAC;iBACnE;gBAED,IAAM,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;gBAE7F,IAAI,eAAe,CAAC,iBAAiB,EAAE,EAAE;oBACrC,eAAe,CAAC,eAAe,GAAG,IAAI,CAAC;oBACvC,eAAe,CAAC,mBAAmB,GAAG,IAAI,CAAC;iBAC9C;gBAED,eAAe,CAAC,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC;gBAClE,eAAe,CAAC,gBAAgB,GAAG,IAAI,CAAC;gBAExC,OAAO,OAAO,CAAC;aAClB;YAED,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IACL,yBAAC;AAAD,CAAC,AAtCD,IAsCC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAA9B,CAA8B,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\n\r\nimport { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\n\r\nconst NAME = \"MSFT_minecraftMesh\";\r\n\r\n/** @hidden */\r\nexport class MSFT_minecraftMesh implements IGLTFLoaderExtension {\r\n public readonly name = NAME;\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtraAsync<boolean>(context, material, this.name, (extraContext, extra) => {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${extraContext}: Material type not supported`);\r\n }\r\n\r\n const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n\r\n if (babylonMaterial.needAlphaBlending()) {\r\n babylonMaterial.forceDepthWrite = true;\r\n babylonMaterial.separateCullingPass = true;\r\n }\r\n\r\n babylonMaterial.backFaceCulling = babylonMaterial.forceDepthWrite;\r\n babylonMaterial.twoSidedLighting = true;\r\n\r\n return promise;\r\n }\r\n\r\n return null;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_minecraftMesh(loader));\r\n"]}
|
1
|
+
{"version":3,"file":"MSFT_minecraftMesh.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/MSFT_minecraftMesh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,IAAM,IAAI,GAAG,oBAAoB,CAAC;AAElC,cAAc;AACd;IAMI,4BAAY,MAAkB;QALd,SAAI,GAAG,IAAI,CAAC;QAMxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAEM,oCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAEM,wDAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAsBC;QArBG,OAAO,UAAU,CAAC,cAAc,CAAU,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,YAAY,EAAE,KAAK;YACxF,IAAI,KAAK,EAAE;gBACP,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;oBAC3C,MAAM,IAAI,KAAK,CAAC,UAAG,YAAY,kCAA+B,CAAC,CAAC;iBACnE;gBAED,IAAM,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;gBAE7F,IAAI,eAAe,CAAC,iBAAiB,EAAE,EAAE;oBACrC,eAAe,CAAC,eAAe,GAAG,IAAI,CAAC;oBACvC,eAAe,CAAC,mBAAmB,GAAG,IAAI,CAAC;iBAC9C;gBAED,eAAe,CAAC,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC;gBAClE,eAAe,CAAC,gBAAgB,GAAG,IAAI,CAAC;gBAExC,OAAO,OAAO,CAAC;aAClB;YAED,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IACL,yBAAC;AAAD,CAAC,AAtCD,IAsCC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAA9B,CAA8B,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\n\r\nconst NAME = \"MSFT_minecraftMesh\";\r\n\r\n/** @hidden */\r\nexport class MSFT_minecraftMesh implements IGLTFLoaderExtension {\r\n public readonly name = NAME;\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtraAsync<boolean>(context, material, this.name, (extraContext, extra) => {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${extraContext}: Material type not supported`);\r\n }\r\n\r\n const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n\r\n if (babylonMaterial.needAlphaBlending()) {\r\n babylonMaterial.forceDepthWrite = true;\r\n babylonMaterial.separateCullingPass = true;\r\n }\r\n\r\n babylonMaterial.backFaceCulling = babylonMaterial.forceDepthWrite;\r\n babylonMaterial.twoSidedLighting = true;\r\n\r\n return promise;\r\n }\r\n\r\n return null;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_minecraftMesh(loader));\r\n"]}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
3
|
-
import { IMaterial } from "../glTFLoaderInterfaces";
|
4
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
-
import { GLTFLoader } from "../glTFLoader";
|
6
|
-
/** @hidden */
|
7
|
-
export declare class MSFT_sRGBFactors implements IGLTFLoaderExtension {
|
8
|
-
readonly name = "MSFT_sRGBFactors";
|
9
|
-
enabled: boolean;
|
10
|
-
private _loader;
|
11
|
-
constructor(loader: GLTFLoader);
|
12
|
-
dispose(): void;
|
13
|
-
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
14
|
-
}
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { Material } from "@babylonjs/core/Materials/material.js";
|
3
|
+
import type { IMaterial } from "../glTFLoaderInterfaces";
|
4
|
+
import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
+
import { GLTFLoader } from "../glTFLoader";
|
6
|
+
/** @hidden */
|
7
|
+
export declare class MSFT_sRGBFactors implements IGLTFLoaderExtension {
|
8
|
+
readonly name = "MSFT_sRGBFactors";
|
9
|
+
enabled: boolean;
|
10
|
+
private _loader;
|
11
|
+
constructor(loader: GLTFLoader);
|
12
|
+
dispose(): void;
|
13
|
+
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
14
|
+
}
|
@@ -1,37 +1,37 @@
|
|
1
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
|
-
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
-
var NAME = "MSFT_sRGBFactors";
|
4
|
-
/** @hidden */
|
5
|
-
var MSFT_sRGBFactors = /** @class */ (function () {
|
6
|
-
function MSFT_sRGBFactors(loader) {
|
7
|
-
this.name = NAME;
|
8
|
-
this._loader = loader;
|
9
|
-
this.enabled = this._loader.isExtensionUsed(NAME);
|
10
|
-
}
|
11
|
-
MSFT_sRGBFactors.prototype.dispose = function () {
|
12
|
-
this._loader = null;
|
13
|
-
};
|
14
|
-
MSFT_sRGBFactors.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
15
|
-
var _this = this;
|
16
|
-
return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {
|
17
|
-
if (extra) {
|
18
|
-
if (!(babylonMaterial instanceof PBRMaterial)) {
|
19
|
-
throw new Error("".concat(extraContext, ": Material type not supported"));
|
20
|
-
}
|
21
|
-
var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);
|
22
|
-
if (!babylonMaterial.albedoTexture) {
|
23
|
-
babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor);
|
24
|
-
}
|
25
|
-
if (!babylonMaterial.reflectivityTexture) {
|
26
|
-
babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor);
|
27
|
-
}
|
28
|
-
return promise;
|
29
|
-
}
|
30
|
-
return null;
|
31
|
-
});
|
32
|
-
};
|
33
|
-
return MSFT_sRGBFactors;
|
34
|
-
}());
|
35
|
-
export { MSFT_sRGBFactors };
|
36
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_sRGBFactors(loader); });
|
1
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
|
+
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
var NAME = "MSFT_sRGBFactors";
|
4
|
+
/** @hidden */
|
5
|
+
var MSFT_sRGBFactors = /** @class */ (function () {
|
6
|
+
function MSFT_sRGBFactors(loader) {
|
7
|
+
this.name = NAME;
|
8
|
+
this._loader = loader;
|
9
|
+
this.enabled = this._loader.isExtensionUsed(NAME);
|
10
|
+
}
|
11
|
+
MSFT_sRGBFactors.prototype.dispose = function () {
|
12
|
+
this._loader = null;
|
13
|
+
};
|
14
|
+
MSFT_sRGBFactors.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
15
|
+
var _this = this;
|
16
|
+
return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {
|
17
|
+
if (extra) {
|
18
|
+
if (!(babylonMaterial instanceof PBRMaterial)) {
|
19
|
+
throw new Error("".concat(extraContext, ": Material type not supported"));
|
20
|
+
}
|
21
|
+
var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);
|
22
|
+
if (!babylonMaterial.albedoTexture) {
|
23
|
+
babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor);
|
24
|
+
}
|
25
|
+
if (!babylonMaterial.reflectivityTexture) {
|
26
|
+
babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor);
|
27
|
+
}
|
28
|
+
return promise;
|
29
|
+
}
|
30
|
+
return null;
|
31
|
+
});
|
32
|
+
};
|
33
|
+
return MSFT_sRGBFactors;
|
34
|
+
}());
|
35
|
+
export { MSFT_sRGBFactors };
|
36
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_sRGBFactors(loader); });
|
37
37
|
//# sourceMappingURL=MSFT_sRGBFactors.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MSFT_sRGBFactors.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/MSFT_sRGBFactors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,IAAM,IAAI,GAAG,kBAAkB,CAAC;AAEhC,cAAc;AACd;IAMI,0BAAY,MAAkB;QALd,SAAI,GAAG,IAAI,CAAC;QAMxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAEM,kCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAEM,sDAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAsBC;QArBG,OAAO,UAAU,CAAC,cAAc,CAAU,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,YAAY,EAAE,KAAK;YACxF,IAAI,KAAK,EAAE;gBACP,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;oBAC3C,MAAM,IAAI,KAAK,CAAC,UAAG,YAAY,kCAA+B,CAAC,CAAC;iBACnE;gBAED,IAAM,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;gBAE7F,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE;oBAChC,eAAe,CAAC,WAAW,CAAC,kBAAkB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;iBAC/E;gBAED,IAAI,CAAC,eAAe,CAAC,mBAAmB,EAAE;oBACtC,eAAe,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;iBAC3F;gBAED,OAAO,OAAO,CAAC;aAClB;YAED,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IACL,uBAAC;AAAD,CAAC,AAtCD,IAsCC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\n\r\nimport { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\n\r\nconst NAME = \"MSFT_sRGBFactors\";\r\n\r\n/** @hidden */\r\nexport class MSFT_sRGBFactors implements IGLTFLoaderExtension {\r\n public readonly name = NAME;\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtraAsync<boolean>(context, material, this.name, (extraContext, extra) => {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${extraContext}: Material type not supported`);\r\n }\r\n\r\n const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n\r\n if (!babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor);\r\n }\r\n\r\n if (!babylonMaterial.reflectivityTexture) {\r\n babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor);\r\n }\r\n\r\n return promise;\r\n }\r\n\r\n return null;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_sRGBFactors(loader));\r\n"]}
|
1
|
+
{"version":3,"file":"MSFT_sRGBFactors.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/MSFT_sRGBFactors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,IAAM,IAAI,GAAG,kBAAkB,CAAC;AAEhC,cAAc;AACd;IAMI,0BAAY,MAAkB;QALd,SAAI,GAAG,IAAI,CAAC;QAMxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAEM,kCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAEM,sDAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAsBC;QArBG,OAAO,UAAU,CAAC,cAAc,CAAU,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,YAAY,EAAE,KAAK;YACxF,IAAI,KAAK,EAAE;gBACP,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;oBAC3C,MAAM,IAAI,KAAK,CAAC,UAAG,YAAY,kCAA+B,CAAC,CAAC;iBACnE;gBAED,IAAM,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;gBAE7F,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE;oBAChC,eAAe,CAAC,WAAW,CAAC,kBAAkB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;iBAC/E;gBAED,IAAI,CAAC,eAAe,CAAC,mBAAmB,EAAE;oBACtC,eAAe,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;iBAC3F;gBAED,OAAO,OAAO,CAAC;aAClB;YAED,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IACL,uBAAC;AAAD,CAAC,AAtCD,IAsCC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAA5B,CAA4B,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\n\r\nconst NAME = \"MSFT_sRGBFactors\";\r\n\r\n/** @hidden */\r\nexport class MSFT_sRGBFactors implements IGLTFLoaderExtension {\r\n public readonly name = NAME;\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtraAsync<boolean>(context, material, this.name, (extraContext, extra) => {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${extraContext}: Material type not supported`);\r\n }\r\n\r\n const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n\r\n if (!babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor);\r\n }\r\n\r\n if (!babylonMaterial.reflectivityTexture) {\r\n babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor);\r\n }\r\n\r\n return promise;\r\n }\r\n\r\n return null;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_sRGBFactors(loader));\r\n"]}
|
@@ -1,26 +1,26 @@
|
|
1
|
-
export * from "./EXT_lights_image_based";
|
2
|
-
export * from "./EXT_mesh_gpu_instancing";
|
3
|
-
export * from "./EXT_meshopt_compression";
|
4
|
-
export * from "./EXT_texture_webp";
|
5
|
-
export * from "./KHR_draco_mesh_compression";
|
6
|
-
export * from "./KHR_lights_punctual";
|
7
|
-
export * from "./KHR_materials_pbrSpecularGlossiness";
|
8
|
-
export * from "./KHR_materials_unlit";
|
9
|
-
export * from "./KHR_materials_clearcoat";
|
10
|
-
export * from "./KHR_materials_emissive_strength";
|
11
|
-
export * from "./KHR_materials_sheen";
|
12
|
-
export * from "./KHR_materials_specular";
|
13
|
-
export * from "./KHR_materials_ior";
|
14
|
-
export * from "./KHR_materials_variants";
|
15
|
-
export * from "./KHR_materials_transmission";
|
16
|
-
export * from "./KHR_materials_translucency";
|
17
|
-
export * from "./KHR_materials_volume";
|
18
|
-
export * from "./KHR_mesh_quantization";
|
19
|
-
export * from "./KHR_texture_basisu";
|
20
|
-
export * from "./KHR_texture_transform";
|
21
|
-
export * from "./KHR_xmp_json_ld";
|
22
|
-
export * from "./MSFT_audio_emitter";
|
23
|
-
export * from "./MSFT_lod";
|
24
|
-
export * from "./MSFT_minecraftMesh";
|
25
|
-
export * from "./MSFT_sRGBFactors";
|
26
|
-
export * from "./ExtrasAsMetadata";
|
1
|
+
export * from "./EXT_lights_image_based";
|
2
|
+
export * from "./EXT_mesh_gpu_instancing";
|
3
|
+
export * from "./EXT_meshopt_compression";
|
4
|
+
export * from "./EXT_texture_webp";
|
5
|
+
export * from "./KHR_draco_mesh_compression";
|
6
|
+
export * from "./KHR_lights_punctual";
|
7
|
+
export * from "./KHR_materials_pbrSpecularGlossiness";
|
8
|
+
export * from "./KHR_materials_unlit";
|
9
|
+
export * from "./KHR_materials_clearcoat";
|
10
|
+
export * from "./KHR_materials_emissive_strength";
|
11
|
+
export * from "./KHR_materials_sheen";
|
12
|
+
export * from "./KHR_materials_specular";
|
13
|
+
export * from "./KHR_materials_ior";
|
14
|
+
export * from "./KHR_materials_variants";
|
15
|
+
export * from "./KHR_materials_transmission";
|
16
|
+
export * from "./KHR_materials_translucency";
|
17
|
+
export * from "./KHR_materials_volume";
|
18
|
+
export * from "./KHR_mesh_quantization";
|
19
|
+
export * from "./KHR_texture_basisu";
|
20
|
+
export * from "./KHR_texture_transform";
|
21
|
+
export * from "./KHR_xmp_json_ld";
|
22
|
+
export * from "./MSFT_audio_emitter";
|
23
|
+
export * from "./MSFT_lod";
|
24
|
+
export * from "./MSFT_minecraftMesh";
|
25
|
+
export * from "./MSFT_sRGBFactors";
|
26
|
+
export * from "./ExtrasAsMetadata";
|
@@ -1,27 +1,27 @@
|
|
1
|
-
export * from "./EXT_lights_image_based.js";
|
2
|
-
export * from "./EXT_mesh_gpu_instancing.js";
|
3
|
-
export * from "./EXT_meshopt_compression.js";
|
4
|
-
export * from "./EXT_texture_webp.js";
|
5
|
-
export * from "./KHR_draco_mesh_compression.js";
|
6
|
-
export * from "./KHR_lights_punctual.js";
|
7
|
-
export * from "./KHR_materials_pbrSpecularGlossiness.js";
|
8
|
-
export * from "./KHR_materials_unlit.js";
|
9
|
-
export * from "./KHR_materials_clearcoat.js";
|
10
|
-
export * from "./KHR_materials_emissive_strength.js";
|
11
|
-
export * from "./KHR_materials_sheen.js";
|
12
|
-
export * from "./KHR_materials_specular.js";
|
13
|
-
export * from "./KHR_materials_ior.js";
|
14
|
-
export * from "./KHR_materials_variants.js";
|
15
|
-
export * from "./KHR_materials_transmission.js";
|
16
|
-
export * from "./KHR_materials_translucency.js";
|
17
|
-
export * from "./KHR_materials_volume.js";
|
18
|
-
export * from "./KHR_mesh_quantization.js";
|
19
|
-
export * from "./KHR_texture_basisu.js";
|
20
|
-
export * from "./KHR_texture_transform.js";
|
21
|
-
export * from "./KHR_xmp_json_ld.js";
|
22
|
-
export * from "./MSFT_audio_emitter.js";
|
23
|
-
export * from "./MSFT_lod.js";
|
24
|
-
export * from "./MSFT_minecraftMesh.js";
|
25
|
-
export * from "./MSFT_sRGBFactors.js";
|
26
|
-
export * from "./ExtrasAsMetadata.js";
|
1
|
+
export * from "./EXT_lights_image_based.js";
|
2
|
+
export * from "./EXT_mesh_gpu_instancing.js";
|
3
|
+
export * from "./EXT_meshopt_compression.js";
|
4
|
+
export * from "./EXT_texture_webp.js";
|
5
|
+
export * from "./KHR_draco_mesh_compression.js";
|
6
|
+
export * from "./KHR_lights_punctual.js";
|
7
|
+
export * from "./KHR_materials_pbrSpecularGlossiness.js";
|
8
|
+
export * from "./KHR_materials_unlit.js";
|
9
|
+
export * from "./KHR_materials_clearcoat.js";
|
10
|
+
export * from "./KHR_materials_emissive_strength.js";
|
11
|
+
export * from "./KHR_materials_sheen.js";
|
12
|
+
export * from "./KHR_materials_specular.js";
|
13
|
+
export * from "./KHR_materials_ior.js";
|
14
|
+
export * from "./KHR_materials_variants.js";
|
15
|
+
export * from "./KHR_materials_transmission.js";
|
16
|
+
export * from "./KHR_materials_translucency.js";
|
17
|
+
export * from "./KHR_materials_volume.js";
|
18
|
+
export * from "./KHR_mesh_quantization.js";
|
19
|
+
export * from "./KHR_texture_basisu.js";
|
20
|
+
export * from "./KHR_texture_transform.js";
|
21
|
+
export * from "./KHR_xmp_json_ld.js";
|
22
|
+
export * from "./MSFT_audio_emitter.js";
|
23
|
+
export * from "./MSFT_lod.js";
|
24
|
+
export * from "./MSFT_minecraftMesh.js";
|
25
|
+
export * from "./MSFT_sRGBFactors.js";
|
26
|
+
export * from "./ExtrasAsMetadata.js";
|
27
27
|
//# sourceMappingURL=index.js.map
|