@babylonjs/loaders 7.22.5 → 7.23.1
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/objFileLoader.d.ts +4 -5
- package/OBJ/objFileLoader.js +3 -4
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.metadata.d.ts +4 -0
- package/OBJ/objFileLoader.metadata.js +5 -0
- package/OBJ/objFileLoader.metadata.js.map +1 -0
- package/SPLAT/index.d.ts +1 -0
- package/SPLAT/index.js +1 -0
- package/SPLAT/index.js.map +1 -1
- package/SPLAT/splatFileLoader.d.ts +36 -29
- package/SPLAT/splatFileLoader.js +354 -52
- package/SPLAT/splatFileLoader.js.map +1 -1
- package/SPLAT/splatFileLoader.metadata.d.ts +11 -0
- package/SPLAT/splatFileLoader.metadata.js +10 -0
- package/SPLAT/splatFileLoader.metadata.js.map +1 -0
- package/SPLAT/splatLoadingOptions.d.ts +9 -0
- package/SPLAT/splatLoadingOptions.js +2 -0
- package/SPLAT/splatLoadingOptions.js.map +1 -0
- package/STL/stlFileLoader.d.ts +3 -4
- package/STL/stlFileLoader.js +3 -5
- package/STL/stlFileLoader.js.map +1 -1
- package/STL/stlFileLoader.metadata.d.ts +8 -0
- package/STL/stlFileLoader.metadata.js +8 -0
- package/STL/stlFileLoader.metadata.js.map +1 -0
- package/dynamic.d.ts +5 -0
- package/dynamic.js +48 -0
- package/dynamic.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +3 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +3 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +3 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_avif.js +3 -1
- package/glTF/2.0/Extensions/EXT_texture_avif.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.js +3 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +3 -2
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.js +3 -2
- package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +3 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.d.ts +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.js +3 -2
- package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +3 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.js +3 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.js +4 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +3 -2
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +3 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js +3 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +3 -2
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +3 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.js +3 -1
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +3 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +3 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/dynamic.d.ts +4 -0
- package/glTF/2.0/Extensions/dynamic.js +136 -0
- package/glTF/2.0/Extensions/dynamic.js.map +1 -0
- package/glTF/2.0/glTFLoader.d.ts +6 -6
- package/glTF/2.0/glTFLoader.js +24 -28
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtensionRegistry.d.ts +25 -0
- package/glTF/2.0/glTFLoaderExtensionRegistry.js +30 -0
- package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -0
- package/glTF/glTFFileLoader.d.ts +4 -6
- package/glTF/glTFFileLoader.js +9 -17
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFFileLoader.metadata.d.ts +13 -0
- package/glTF/glTFFileLoader.metadata.js +18 -0
- package/glTF/glTFFileLoader.metadata.js.map +1 -0
- package/package.json +3 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_draco_mesh_compression.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_draco_mesh_compression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+DAAiD;AAE5E,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAQnD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"KHR_draco_mesh_compression.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_draco_mesh_compression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+DAAiD;AAE5E,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAQnD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,C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a,CAAC,WAAW,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAC;YAC7D,aAAa,CAAC,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;YAEjD,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,UAAU,CAAqB,CAAC;YAC5H,IAAI,CAAC,UAAU,CAAC,qBAAqB,EAAE;gBACnC,UAAU,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,UAAU,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBAC9H,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,OAAO,CAAC;oBAC3E,OAAO,gBAAgB,CAAC,iCAAiC,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;wBACjJ,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;oBACpD,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;aACN;YAED,OAAO,UAAU,CAAC,qBAAqB,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import { DracoCompression } from \"core/Meshes/Compression/dracoCompression\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { Geometry } from \"core/Meshes/geometry\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport { MeshPrimitiveMode } from \"babylonjs-gltf2interface\";\r\nimport type { IKHRDracoMeshCompression } from \"babylonjs-gltf2interface\";\r\nimport type { IMeshPrimitive, IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_draco_mesh_compression\";\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 KHR_draco_mesh_compression extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_draco_mesh_compression\"]: {};\r\n }\r\n}\r\n\r\ninterface IBufferViewDraco extends IBufferView {\r\n _dracoBabylonGeometry?: Promise<Geometry>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_draco_mesh_compression/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_draco_mesh_compression 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 * The draco compression used to decode vertex data or DracoCompression.Default if not defined\r\n */\r\n public dracoCompression?: DracoCompression;\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 whether to use the normalized flag from the glTF accessor instead of the Draco data. Defaults to true.\r\n */\r\n public useNormalizedFlagFromAccessor = true;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n delete this.dracoCompression;\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRDracoMeshCompression, Geometry>(context, primitive, this.name, (extensionContext, extension) => {\r\n if (primitive.mode != undefined) {\r\n if (primitive.mode !== MeshPrimitiveMode.TRIANGLES && primitive.mode !== MeshPrimitiveMode.TRIANGLE_STRIP) {\r\n throw new Error(`${context}: Unsupported mode ${primitive.mode}`);\r\n }\r\n }\r\n\r\n const attributes: { [kind: string]: number } = {};\r\n const normalized: { [kind: string]: boolean } = {};\r\n const loadAttribute = (name: string, kind: string) => {\r\n const uniqueId = extension.attributes[name];\r\n if (uniqueId == undefined) {\r\n return;\r\n }\r\n\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n\r\n attributes[kind] = uniqueId;\r\n\r\n if (this.useNormalizedFlagFromAccessor) {\r\n const accessor = ArrayItem.TryGet(this._loader.gltf.accessors, primitive.attributes[name]);\r\n if (accessor) {\r\n normalized[kind] = accessor.normalized || false;\r\n }\r\n }\r\n };\r\n\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\r\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\r\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\r\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind);\r\n\r\n const bufferView = ArrayItem.Get(extensionContext, this._loader.gltf.bufferViews, extension.bufferView) as IBufferViewDraco;\r\n if (!bufferView._dracoBabylonGeometry) {\r\n bufferView._dracoBabylonGeometry = this._loader.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n const dracoCompression = this.dracoCompression || DracoCompression.Default;\r\n return dracoCompression._decodeMeshToGeometryForGltfAsync(babylonMesh.name, this._loader.babylonScene, data, attributes, normalized).catch((error) => {\r\n throw new Error(`${context}: ${error.message}`);\r\n });\r\n });\r\n }\r\n\r\n return bufferView._dracoBabylonGeometry;\r\n });\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_draco_mesh_compression(loader));\r\n"]}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { GLTFLoader } from "../glTFLoader.js";
|
2
1
|
import { FlowGraphCoordinator } from "@babylonjs/core/FlowGraph/flowGraphCoordinator.js";
|
3
2
|
import { FlowGraph } from "@babylonjs/core/FlowGraph/flowGraph.js";
|
4
3
|
import { convertGLTFToSerializedFlowGraph } from "./interactivityFunctions.js";
|
5
4
|
import { InteractivityPathToObjectConverter } from "./interactivityPathToObjectConverter.js";
|
5
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
6
6
|
const NAME = "KHR_interactivity";
|
7
7
|
/**
|
8
8
|
* Loader extension for KHR_interactivity
|
@@ -37,5 +37,6 @@ export class KHR_interactivity {
|
|
37
37
|
coordinator.start();
|
38
38
|
}
|
39
39
|
}
|
40
|
-
|
40
|
+
unregisterGLTFExtension(NAME);
|
41
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_interactivity(loader));
|
41
42
|
//# sourceMappingURL=KHR_interactivity.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_interactivity.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"KHR_interactivity.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,0DAA4C;AAC3E,OAAO,EAAE,SAAS,EAAE,+CAAiC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAajC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAY1B;;;OAGG;IACH,YAAoB,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;QAfvC;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAaxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,cAAc,GAAG,IAAI,kCAAkC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpF,CAAC;IAEM,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACpD,OAAO;SACV;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QACxC,MAAM,uBAAuB,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAsC,CAAC;QAErG,MAAM,IAAI,GAAG,gCAAgC,CAAC,uBAAuB,CAAC,CAAC;QACvE,MAAM,WAAW,GAAG,IAAI,oBAAoB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACxD,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAE3E,WAAW,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { IKHRInteractivity } from \"babylonjs-gltf2interface\";\r\nimport type { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { FlowGraphCoordinator } from \"core/FlowGraph/flowGraphCoordinator\";\r\nimport { FlowGraph } from \"core/FlowGraph/flowGraph\";\r\nimport { convertGLTFToSerializedFlowGraph } from \"./interactivityFunctions\";\r\nimport { InteractivityPathToObjectConverter } from \"./interactivityPathToObjectConverter\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_interactivity\";\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 KHR_interactivity extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_interactivity\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * Loader extension for KHR_interactivity\r\n */\r\nexport class KHR_interactivity implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _pathConverter?: InteractivityPathToObjectConverter;\r\n\r\n /**\r\n * @internal\r\n * @param _loader\r\n */\r\n constructor(private _loader: GLTFLoader) {\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n this._pathConverter = new InteractivityPathToObjectConverter(this._loader.gltf);\r\n }\r\n\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._pathConverter;\r\n }\r\n\r\n public onReady(): void {\r\n if (!this._loader.babylonScene || !this._pathConverter) {\r\n return;\r\n }\r\n const scene = this._loader.babylonScene;\r\n const interactivityDefinition = this._loader.gltf.extensions?.KHR_interactivity as IKHRInteractivity;\r\n\r\n const json = convertGLTFToSerializedFlowGraph(interactivityDefinition);\r\n const coordinator = new FlowGraphCoordinator({ scene });\r\n FlowGraph.Parse(json, { coordinator, pathConverter: this._pathConverter });\r\n\r\n coordinator.start();\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_interactivity(loader));\r\n"]}
|
@@ -5,6 +5,7 @@ import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
5
5
|
import { SpotLight } from "@babylonjs/core/Lights/spotLight.js";
|
6
6
|
import { Light } from "@babylonjs/core/Lights/light.js";
|
7
7
|
import { GLTFLoader, ArrayItem } from "../glTFLoader.js";
|
8
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
8
9
|
const NAME = "KHR_lights_punctual";
|
9
10
|
/**
|
10
11
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_lights_punctual/README.md)
|
@@ -85,5 +86,6 @@ export class KHR_lights {
|
|
85
86
|
});
|
86
87
|
}
|
87
88
|
}
|
88
|
-
|
89
|
+
unregisterGLTFExtension(NAME);
|
90
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_lights(loader));
|
89
91
|
//# sourceMappingURL=KHR_lights_punctual.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_lights_punctual.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_lights_punctual.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAChE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AACpD,OAAO,EAAE,SAAS,EAAE,4CAA8B;AAClD,OAAO,EAAE,KAAK,EAAE,wCAA0B;AAO1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"KHR_lights_punctual.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_lights_punctual.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAChE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AACpD,OAAO,EAAE,SAAS,EAAE,4CAA8B;AAClD,OAAO,EAAE,KAAK,EAAE,wCAA0B;AAO1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAanC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,UAAU;IAenB;;OAEG;IACH,YAAY,MAAkB;QAjB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAexB,IAAI,CAAC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from \"core/types\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\nimport { Light } from \"core/Lights/light\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\n\r\nimport type { IKHRLightsPunctual_LightReference } from \"babylonjs-gltf2interface\";\r\nimport { KHRLightsPunctual_LightType } from \"babylonjs-gltf2interface\";\r\nimport type { INode, IKHRLightsPunctual_Light } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_lights_punctual\";\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 KHR_lights_punctual extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_lights_punctual\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_lights_punctual/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_lights 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 /** hidden */\r\n private _loader: GLTFLoader;\r\n private _lights?: IKHRLightsPunctual_Light[];\r\n\r\n /**\r\n * @internal\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 /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._lights;\r\n }\r\n\r\n /** @internal */\r\n public onLoading(): void {\r\n const extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n const extension = extensions[this.name] as any;\r\n this._lights = extension.lights;\r\n ArrayItem.Assign(this._lights);\r\n }\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<IKHRLightsPunctual_LightReference, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n this._loader._allMaterialsDirtyRequired = true;\r\n\r\n return this._loader.loadNodeAsync(context, node, (babylonMesh) => {\r\n let babylonLight: Light;\r\n\r\n const light = ArrayItem.Get(extensionContext, this._lights, extension.light);\r\n const name = light.name || babylonMesh.name;\r\n\r\n this._loader.babylonScene._blockEntityCollection = !!this._loader._assetContainer;\r\n\r\n switch (light.type) {\r\n case KHRLightsPunctual_LightType.DIRECTIONAL: {\r\n const babylonDirectionalLight = new DirectionalLight(name, Vector3.Backward(), this._loader.babylonScene);\r\n babylonDirectionalLight.position.setAll(0);\r\n babylonLight = babylonDirectionalLight;\r\n break;\r\n }\r\n case KHRLightsPunctual_LightType.POINT: {\r\n babylonLight = new PointLight(name, Vector3.Zero(), this._loader.babylonScene);\r\n break;\r\n }\r\n case KHRLightsPunctual_LightType.SPOT: {\r\n const babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, this._loader.babylonScene);\r\n babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;\r\n babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;\r\n babylonLight = babylonSpotLight;\r\n break;\r\n }\r\n default: {\r\n this._loader.babylonScene._blockEntityCollection = false;\r\n throw new Error(`${extensionContext}: Invalid light type (${light.type})`);\r\n }\r\n }\r\n\r\n babylonLight._parentContainer = this._loader._assetContainer;\r\n this._loader.babylonScene._blockEntityCollection = false;\r\n light._babylonLight = babylonLight;\r\n\r\n babylonLight.falloffType = Light.FALLOFF_GLTF;\r\n babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();\r\n babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;\r\n babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;\r\n babylonLight.parent = babylonMesh;\r\n\r\n this._loader._babylonLights.push(babylonLight);\r\n\r\n GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);\r\n\r\n assign(babylonMesh);\r\n });\r\n });\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_lights(loader));\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
3
4
|
const NAME = "KHR_materials_anisotropy";
|
4
5
|
/**
|
5
6
|
* [Specification](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_anisotropy)
|
@@ -53,5 +54,6 @@ export class KHR_materials_anisotropy {
|
|
53
54
|
return Promise.all(promises).then(() => { });
|
54
55
|
}
|
55
56
|
}
|
56
|
-
|
57
|
+
unregisterGLTFExtension(NAME);
|
58
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_materials_anisotropy(loader));
|
57
59
|
//# sourceMappingURL=KHR_materials_anisotropy.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_anisotropy.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_anisotropy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"KHR_materials_anisotropy.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_anisotropy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAaxC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,wBAAwB;IAkBjC;;OAEG;IACH,YAAY,MAAkB;QApB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAQf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,2BAA2B,CAAC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAC9F,OAAO,UAAU,CAAC,kBAAkB,CAA0B,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE;YACxH,MAAM,QAAQ,GAAG,IAAI,KAAK,EAAgB,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC5F,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,gBAAgB,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;YAClG,OAAO,OA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BRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsAnisotropy } from \"babylonjs-gltf2interface\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_materials_anisotropy\";\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 KHR_materials_anisotropy extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_materials_anisotropy\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_anisotropy)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_anisotropy 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 = 195;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\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 /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsAnisotropy>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadIridescencePropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadIridescencePropertiesAsync(context: string, properties: IKHRMaterialsAnisotropy, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n babylonMaterial.anisotropy.isEnabled = true;\r\n\r\n babylonMaterial.anisotropy.intensity = properties.anisotropyStrength ?? 0;\r\n babylonMaterial.anisotropy.angle = properties.anisotropyRotation ?? 0;\r\n\r\n if (properties.anisotropyTexture) {\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/anisotropyTexture`, properties.anisotropyTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Anisotropy Intensity)`;\r\n babylonMaterial.anisotropy.texture = texture;\r\n })\r\n );\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_materials_anisotropy(loader));\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
3
4
|
const NAME = "KHR_materials_clearcoat";
|
4
5
|
/**
|
5
6
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)
|
@@ -85,5 +86,6 @@ export class KHR_materials_clearcoat {
|
|
85
86
|
return Promise.all(promises).then(() => { });
|
86
87
|
}
|
87
88
|
}
|
88
|
-
|
89
|
+
unregisterGLTFExtension(NAME);
|
90
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_materials_clearcoat(loader));
|
89
91
|
//# sourceMappingURL=KHR_materials_clearcoat.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_clearcoat.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_clearcoat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"KHR_materials_clearcoat.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_clearcoat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAavC;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,uBAAuB;IAkBhC;;OAEG;IACH,YAAY,MAAkB;QApB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAQf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,2BAA2B,CAAC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAC9F,OAAO,UAAU,CAAC,kBAAkB,CAAyB,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE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AC,QAAQ,EAAE,CAAC,oBAAoB,CAAC;YACnF,IAAI,UAAU,CAAC,sBAAsB,CAAC,KAAK,IAAI,SAAS,EAAE;gBACtD,eAAe,CAAC,SAAS,CAAC,WAAY,CAAC,KAAK,GAAG,UAAU,CAAC,sBAAsB,CAAC,KAAK,CAAC;aAC1F;SACJ;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAChD,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nimport type { IMaterial, ITextureInfo } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsClearcoat } from \"babylonjs-gltf2interface\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_materials_clearcoat\";\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 KHR_materials_clearcoat extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_materials_clearcoat\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)\r\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_clearcoat 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 = 190;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\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 /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsClearcoat>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadClearCoatPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadClearCoatPropertiesAsync(context: string, properties: IKHRMaterialsClearcoat, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n babylonMaterial.clearCoat.isEnabled = true;\r\n babylonMaterial.clearCoat.useRoughnessFromMainTexture = false;\r\n babylonMaterial.clearCoat.remapF0OnInterfaceChange = false;\r\n\r\n if (properties.clearcoatFactor != undefined) {\r\n babylonMaterial.clearCoat.intensity = properties.clearcoatFactor;\r\n } else {\r\n babylonMaterial.clearCoat.intensity = 0;\r\n }\r\n\r\n if (properties.clearcoatTexture) {\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/clearcoatTexture`, properties.clearcoatTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (ClearCoat Intensity)`;\r\n babylonMaterial.clearCoat.texture = texture;\r\n })\r\n );\r\n }\r\n\r\n if (properties.clearcoatRoughnessFactor != undefined) {\r\n babylonMaterial.clearCoat.roughness = properties.clearcoatRoughnessFactor;\r\n } else {\r\n babylonMaterial.clearCoat.roughness = 0;\r\n }\r\n\r\n if (properties.clearcoatRoughnessTexture) {\r\n (properties.clearcoatRoughnessTexture as ITextureInfo).nonColorData = true;\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/clearcoatRoughnessTexture`, properties.clearcoatRoughnessTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (ClearCoat Roughness)`;\r\n babylonMaterial.clearCoat.textureRoughness = texture;\r\n })\r\n );\r\n }\r\n\r\n if (properties.clearcoatNormalTexture) {\r\n (properties.clearcoatNormalTexture as ITextureInfo).nonColorData = true;\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/clearcoatNormalTexture`, properties.clearcoatNormalTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (ClearCoat Normal)`;\r\n babylonMaterial.clearCoat.bumpTexture = texture;\r\n })\r\n );\r\n\r\n babylonMaterial.invertNormalMapX = !babylonMaterial.getScene().useRightHandedSystem;\r\n babylonMaterial.invertNormalMapY = babylonMaterial.getScene().useRightHandedSystem;\r\n if (properties.clearcoatNormalTexture.scale != undefined) {\r\n babylonMaterial.clearCoat.bumpTexture!.level = properties.clearcoatNormalTexture.scale;\r\n }\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_materials_clearcoat(loader));\r\n"]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
3
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
4
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
4
5
|
const NAME = "KHR_materials_diffuse_transmission";
|
5
6
|
/**
|
6
7
|
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)
|
@@ -86,5 +87,6 @@ export class KHR_materials_diffuse_transmission {
|
|
86
87
|
return Promise.all(promises).then(() => { });
|
87
88
|
}
|
88
89
|
}
|
89
|
-
|
90
|
+
unregisterGLTFExtension(NAME);
|
91
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_materials_diffuse_transmission(loader));
|
90
92
|
//# sourceMappingURL=KHR_materials_diffuse_transmission.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_diffuse_transmission.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,4CAA8B;
|
1
|
+
{"version":3,"file":"KHR_materials_diffuse_transmission.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,oCAAoC,CAAC;AAalD;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,kCAAkC;IAkB3C;;OAEG;IACH,YAAY,MAAkB;QApB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAA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ACxD,WAAW,CAAC,UAAU,CAAC,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;SACzG;aAAM;YACH,WAAW,CAAC,UAAU,CAAC,iBAAiB,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;SAC7D;QAED,IAAI,SAAS,CAAC,+BAA+B,EAAE;YAC3C,QAAQ,CAAC,IAAI,CACT,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,OAAO,kCAAkC,EAAE,SAAS,CAAC,+BAA+B,CAAC,CAAC,IAAI,CAAC,CAAC,OAAoB,EAAE,EAAE;gBACrJ,WAAW,CAAC,UAAU,CAAC,wBAAwB,GAAG,OAAO,CAAC;YAC9D,CAAC,CAAC,CACL,CAAC;SACL;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAChD,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,kCAAkC,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { IMaterial, ITextureInfo } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsDiffuseTransmission } from \"babylonjs-gltf2interface\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_materials_diffuse_transmission\";\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 KHR_materials_diffuse_transmission extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_materials_diffuse_transmission\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_diffuse_transmission 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 = 174;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n if (this.enabled) {\r\n loader.parent.transparencyAsCoverage = true;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsDiffuseTransmission>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadTranslucentPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material, extension: IKHRMaterialsDiffuseTransmission): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const pbrMaterial = babylonMaterial as PBRMaterial;\r\n\r\n // Enables \"translucency\" texture which represents diffusely-transmitted light.\r\n pbrMaterial.subSurface.isTranslucencyEnabled = true;\r\n\r\n // Since this extension models thin-surface transmission only, we must make the\r\n // internal IOR == 1.0 and set the thickness to 0.\r\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\r\n pbrMaterial.subSurface.minimumThickness = 0.0;\r\n pbrMaterial.subSurface.maximumThickness = 0.0;\r\n\r\n // Tint color will be used for transmission.\r\n pbrMaterial.subSurface.useAlbedoToTintTranslucency = false;\r\n\r\n if (extension.diffuseTransmissionFactor !== undefined) {\r\n pbrMaterial.subSurface.translucencyIntensity = extension.diffuseTransmissionFactor;\r\n } else {\r\n pbrMaterial.subSurface.translucencyIntensity = 0.0;\r\n pbrMaterial.subSurface.isTranslucencyEnabled = false;\r\n return Promise.resolve();\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n pbrMaterial.subSurface.useGltfStyleTextures = true;\r\n\r\n if (extension.diffuseTransmissionTexture) {\r\n (extension.diffuseTransmissionTexture as ITextureInfo).nonColorData = true;\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/diffuseTransmissionTexture`, extension.diffuseTransmissionTexture).then((texture: BaseTexture) => {\r\n pbrMaterial.subSurface.translucencyIntensityTexture = texture;\r\n })\r\n );\r\n }\r\n\r\n if (extension.diffuseTransmissionColorFactor !== undefined) {\r\n pbrMaterial.subSurface.translucencyColor = Color3.FromArray(extension.diffuseTransmissionColorFactor);\r\n } else {\r\n pbrMaterial.subSurface.translucencyColor = Color3.White();\r\n }\r\n\r\n if (extension.diffuseTransmissionColorTexture) {\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/diffuseTransmissionColorTexture`, extension.diffuseTransmissionColorTexture).then((texture: BaseTexture) => {\r\n pbrMaterial.subSurface.translucencyColorTexture = texture;\r\n })\r\n );\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_materials_diffuse_transmission(loader));\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
3
4
|
const NAME = "KHR_materials_dispersion";
|
4
5
|
/**
|
5
6
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/87bd64a7f5e23c84b6aef2e6082069583ed0ddb4/extensions/2.0/Khronos/KHR_materials_dispersion/README.md)
|
@@ -52,5 +53,6 @@ export class KHR_materials_dispersion {
|
|
52
53
|
return Promise.resolve();
|
53
54
|
}
|
54
55
|
}
|
55
|
-
|
56
|
+
unregisterGLTFExtension(NAME);
|
57
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_materials_dispersion(loader));
|
56
58
|
//# sourceMappingURL=KHR_materials_dispersion.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_dispersion.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_dispersion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"KHR_materials_dispersion.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_dispersion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,qBAAqB,E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AC,OAAe,EAAE,QAAmB,EAAE,eAAyB,EAAE,SAAkC;QACtI,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,+BAA+B,CAAC,CAAC;SAC9D;QAED,+EAA+E;QAC/E,2GAA2G;QAC3G,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;YAC1E,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC5B;QACD,eAAe,CAAC,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC;QACtD,eAAe,CAAC,UAAU,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;QAC7D,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsDispersion } from \"babylonjs-gltf2interface\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_materials_dispersion\";\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 KHR_materials_dispersion extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_materials_dispersion\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/87bd64a7f5e23c84b6aef2e6082069583ed0ddb4/extensions/2.0/Khronos/KHR_materials_dispersion/README.md)\r\n * @experimental\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_dispersion 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 = 174;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\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 /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsDispersion>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadDispersionPropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadDispersionPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material, extension: IKHRMaterialsDispersion): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n // If transparency isn't enabled already, this extension shouldn't do anything.\r\n // i.e. it requires either the KHR_materials_transmission or KHR_materials_diffuse_transmission extensions.\r\n if (!babylonMaterial.subSurface.isRefractionEnabled || !extension.dispersion) {\r\n return Promise.resolve();\r\n }\r\n babylonMaterial.subSurface.isDispersionEnabled = true;\r\n babylonMaterial.subSurface.dispersion = extension.dispersion;\r\n return Promise.resolve();\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_materials_dispersion(loader));\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
3
4
|
const NAME = "KHR_materials_emissive_strength";
|
4
5
|
/**
|
5
6
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md)
|
@@ -44,5 +45,6 @@ export class KHR_materials_emissive_strength {
|
|
44
45
|
}
|
45
46
|
}
|
46
47
|
}
|
47
|
-
|
48
|
+
unregisterGLTFExtension(NAME);
|
49
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_materials_emissive_strength(loader));
|
48
50
|
//# sourceMappingURL=KHR_materials_emissive_strength.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_emissive_strength.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_emissive_strength.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"KHR_materials_emissive_strength.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_emissive_strength.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,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,CAAC,gBAAgB,CAAC;SACnE;IACL,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsEmissiveStrength } from \"babylonjs-gltf2interface\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_materials_emissive_strength\";\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 KHR_materials_emissive_strength extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_materials_emissive_strength\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_emissive_strength 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 = 170;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\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 /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsEmissiveStrength>(context, material, this.name, (extensionContext, extension) => {\r\n return this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial).then(() => {\r\n this._loadEmissiveProperties(extensionContext, extension, babylonMaterial);\r\n });\r\n });\r\n }\r\n\r\n private _loadEmissiveProperties(context: string, properties: IKHRMaterialsEmissiveStrength, babylonMaterial: Material): void {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n if (properties.emissiveStrength !== undefined) {\r\n babylonMaterial.emissiveIntensity = properties.emissiveStrength;\r\n }\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_materials_emissive_strength(loader));\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
3
4
|
const NAME = "KHR_materials_ior";
|
4
5
|
/**
|
5
6
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_ior/README.md)
|
@@ -53,5 +54,6 @@ export class KHR_materials_ior {
|
|
53
54
|
* Default ior Value from the spec.
|
54
55
|
*/
|
55
56
|
KHR_materials_ior._DEFAULT_IOR = 1.5;
|
56
|
-
|
57
|
+
unregisterGLTFExtension(NAME);
|
58
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_materials_ior(loader));
|
57
59
|
//# sourceMappingURL=KHR_materials_ior.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_ior.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_ior.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"KHR_materials_ior.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_ior.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAajC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,iBAAiB;IAuB1B;;OAEG;IACH,YAAY,MAAkB;QApB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAQf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,2BAA2B,CAAC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAC9F,OAAO,UAAU,CAAC,kBAAkB,CAAmB,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE;YACjH,MAAM,QAAQ,GAAG,IAAI,KAAK,EAAgB,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC5F,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;YAC1F,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,uBAAuB,CAAC,OAAe,EAAE,UAA4B,EAAE,eAAyB;QACpG,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,+BAA+B,CAAC,CAAC;SAC9D;QAED,IAAI,UAAU,CAAC,GAAG,KAAK,SAAS,EAAE;YAC9B,eAAe,CAAC,iBAAiB,GAAG,UAAU,CAAC,GAAG,CAAC;SACtD;aAAM;YACH,eAAe,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,YAAY,CAAC;SACtE;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;;AA3DD;;GAEG;AACqB,8BAAY,GAAG,GAAG,AAAN,CAAO;AA2D/C,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsIor } from \"babylonjs-gltf2interface\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_materials_ior\";\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 KHR_materials_ior extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_materials_ior\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_ior/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_ior implements IGLTFLoaderExtension {\r\n /**\r\n * Default ior Value from the spec.\r\n */\r\n private static readonly _DEFAULT_IOR = 1.5;\r\n\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 = 180;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\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 /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsIor>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadIorPropertiesAsync(context: string, properties: IKHRMaterialsIor, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n if (properties.ior !== undefined) {\r\n babylonMaterial.indexOfRefraction = properties.ior;\r\n } else {\r\n babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_materials_ior(loader));\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
3
4
|
const NAME = "KHR_materials_iridescence";
|
4
5
|
/**
|
5
6
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_iridescence/README.md)
|
@@ -61,5 +62,6 @@ export class KHR_materials_iridescence {
|
|
61
62
|
return Promise.all(promises).then(() => { });
|
62
63
|
}
|
63
64
|
}
|
64
|
-
|
65
|
+
unregisterGLTFExtension(NAME);
|
66
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_materials_iridescence(loader));
|
65
67
|
//# sourceMappingURL=KHR_materials_iridescence.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_iridescence.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_iridescence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"KHR_materials_iridescence.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_materials_iridescence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,E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AC;YAC3D,CAAC,CAAC,CACL,CAAC;SACL;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAChD,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsIridescence } from \"babylonjs-gltf2interface\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_materials_iridescence\";\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 KHR_materials_iridescence extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_materials_iridescence\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_iridescence/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_iridescence 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 = 195;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\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 /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsIridescence>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadIridescencePropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadIridescencePropertiesAsync(context: string, properties: IKHRMaterialsIridescence, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n babylonMaterial.iridescence.isEnabled = true;\r\n\r\n babylonMaterial.iridescence.intensity = properties.iridescenceFactor ?? 0;\r\n babylonMaterial.iridescence.indexOfRefraction = properties.iridescenceIor ?? (properties as any).iridescenceIOR ?? 1.3;\r\n babylonMaterial.iridescence.minimumThickness = properties.iridescenceThicknessMinimum ?? 100;\r\n babylonMaterial.iridescence.maximumThickness = properties.iridescenceThicknessMaximum ?? 400;\r\n\r\n if (properties.iridescenceTexture) {\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/iridescenceTexture`, properties.iridescenceTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Iridescence Intensity)`;\r\n babylonMaterial.iridescence.texture = texture;\r\n })\r\n );\r\n }\r\n\r\n if (properties.iridescenceThicknessTexture) {\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/iridescenceThicknessTexture`, properties.iridescenceThicknessTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Iridescence Thickness)`;\r\n babylonMaterial.iridescence.thicknessTexture = texture;\r\n })\r\n );\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n}\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_materials_iridescence(loader));\r\n"]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
2
2
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
3
3
|
import { GLTFLoader } from "../glTFLoader.js";
|
4
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
4
5
|
const NAME = "KHR_materials_pbrSpecularGlossiness";
|
5
6
|
/**
|
6
7
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness/README.md)
|
@@ -71,5 +72,6 @@ export class KHR_materials_pbrSpecularGlossiness {
|
|
71
72
|
return Promise.all(promises).then(() => { });
|
72
73
|
}
|
73
74
|
}
|
74
|
-
|
75
|
+
unregisterGLTFExtension(NAME);
|
76
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_materials_pbrSpecularGlossiness(loader));
|
75
77
|
//# sourceMappingURL=KHR_materials_pbrSpecularGlossiness.js.map
|