@babylonjs/loaders 8.1.1 → 8.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/OBJ/index.d.ts +4 -4
  2. package/OBJ/objFileLoader.d.ts +2 -2
  3. package/OBJ/solidParser.d.ts +1 -1
  4. package/SPLAT/index.d.ts +2 -2
  5. package/SPLAT/splatFileLoader.d.ts +2 -2
  6. package/SPLAT/splatFileLoader.js +2 -2
  7. package/SPLAT/splatFileLoader.js.map +1 -1
  8. package/STL/index.d.ts +1 -1
  9. package/STL/stlFileLoader.d.ts +1 -1
  10. package/glTF/1.0/glTFBinaryExtension.d.ts +3 -3
  11. package/glTF/1.0/glTFLoader.d.ts +2 -2
  12. package/glTF/1.0/glTFLoaderUtils.d.ts +2 -2
  13. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +2 -2
  14. package/glTF/1.0/index.d.ts +5 -5
  15. package/glTF/2.0/Extensions/EXT_lights_ies.d.ts +4 -4
  16. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +4 -4
  17. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +4 -4
  18. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +4 -4
  19. package/glTF/2.0/Extensions/EXT_texture_avif.d.ts +4 -4
  20. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +4 -4
  21. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +4 -4
  22. package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +5 -5
  23. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +4 -4
  24. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +6 -3
  25. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +46 -24
  26. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -1
  27. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +1 -1
  28. package/glTF/2.0/Extensions/KHR_interactivity/index.d.ts +3 -3
  29. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +3 -3
  30. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +7 -2
  31. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -1
  32. package/glTF/2.0/Extensions/KHR_interactivity.d.ts +3 -3
  33. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +4 -4
  34. package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +4 -4
  35. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +4 -4
  36. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +4 -4
  37. package/glTF/2.0/Extensions/KHR_materials_dispersion.d.ts +4 -4
  38. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +4 -4
  39. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +4 -4
  40. package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +4 -4
  41. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +4 -4
  42. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +4 -4
  43. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +4 -4
  44. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +4 -4
  45. package/glTF/2.0/Extensions/KHR_materials_transmission.js +1 -1
  46. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  47. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +4 -4
  48. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +5 -5
  49. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +4 -4
  50. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +3 -3
  51. package/glTF/2.0/Extensions/KHR_node_hoverability.d.ts +3 -3
  52. package/glTF/2.0/Extensions/KHR_node_selectability.d.ts +3 -3
  53. package/glTF/2.0/Extensions/KHR_node_visibility.d.ts +3 -3
  54. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +4 -4
  55. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +4 -4
  56. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +3 -3
  57. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +4 -4
  58. package/glTF/2.0/Extensions/MSFT_lod.d.ts +4 -4
  59. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +4 -4
  60. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +4 -4
  61. package/glTF/2.0/Extensions/gltfPathToObjectConverter.d.ts +9 -1
  62. package/glTF/2.0/Extensions/gltfPathToObjectConverter.js +17 -2
  63. package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -1
  64. package/glTF/2.0/Extensions/index.d.ts +38 -38
  65. package/glTF/2.0/Extensions/objectModelMapping.d.ts +2 -2
  66. package/glTF/2.0/glTFLoader.d.ts +5 -5
  67. package/glTF/2.0/glTFLoader.js +2 -2
  68. package/glTF/2.0/glTFLoader.js.map +1 -1
  69. package/glTF/2.0/glTFLoaderAnimation.d.ts +1 -1
  70. package/glTF/2.0/glTFLoaderExtension.d.ts +2 -2
  71. package/glTF/2.0/glTFLoaderExtensionRegistry.d.ts +2 -2
  72. package/glTF/2.0/index.d.ts +6 -6
  73. package/glTF/glTFFileLoader.d.ts +1 -1
  74. package/glTF/index.d.ts +4 -4
  75. package/index.d.ts +4 -4
  76. package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
  77. package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
  78. package/legacy/legacy-glTFFileLoader.d.ts +3 -3
  79. package/legacy/legacy.d.ts +5 -5
  80. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
1
  import type { Nullable } from "@babylonjs/core/types.js";
2
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
- declare module "../../glTFFileLoader" {
3
+ import type { IMaterial } from "../glTFLoaderInterfaces.js";
4
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
5
+ import { GLTFLoader } from "../glTFLoader.js";
6
+ declare module "../../glTFFileLoader.js" {
7
7
  interface GLTFLoaderExtensionOptions {
8
8
  /**
9
9
  * Defines options for the KHR_materials_unlit extension.
@@ -1,12 +1,12 @@
1
1
  import type { Nullable } from "@babylonjs/core/types.js";
2
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
3
- import { GLTFLoader } from "../glTFLoader";
2
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
3
+ import { GLTFLoader } from "../glTFLoader.js";
4
4
  import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
5
- import type { INode, IMeshPrimitive, IMesh } from "../glTFLoaderInterfaces";
5
+ import type { INode, IMeshPrimitive, IMesh } from "../glTFLoaderInterfaces.js";
6
6
  import type { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
7
- import type { MaterialVariantsController } from "../../glTFFileLoader";
7
+ import type { MaterialVariantsController } from "../../glTFFileLoader.js";
8
8
  export { MaterialVariantsController };
9
- declare module "../../glTFFileLoader" {
9
+ declare module "../../glTFFileLoader.js" {
10
10
  type MaterialVariantsController = {
11
11
  /**
12
12
  * The list of available variant names for this asset.
@@ -1,9 +1,9 @@
1
1
  import type { Nullable } from "@babylonjs/core/types.js";
2
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
- declare module "../../glTFFileLoader" {
3
+ import type { IMaterial } from "../glTFLoaderInterfaces.js";
4
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
5
+ import { GLTFLoader } from "../glTFLoader.js";
6
+ declare module "../../glTFFileLoader.js" {
7
7
  interface GLTFLoaderExtensionOptions {
8
8
  /**
9
9
  * Defines options for the KHR_materials_volume extension.
@@ -1,6 +1,6 @@
1
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
2
- import type { GLTFLoader } from "../glTFLoader";
3
- declare module "../../glTFFileLoader" {
1
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
2
+ import type { GLTFLoader } from "../glTFLoader.js";
3
+ declare module "../../glTFFileLoader.js" {
4
4
  interface GLTFLoaderExtensionOptions {
5
5
  /**
6
6
  * Defines options for the KHR_mesh_quantization extension.
@@ -1,6 +1,6 @@
1
- import type { GLTFLoader } from "../glTFLoader";
2
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
3
- declare module "../../glTFFileLoader" {
1
+ import type { GLTFLoader } from "../glTFLoader.js";
2
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
3
+ declare module "../../glTFFileLoader.js" {
4
4
  interface GLTFLoaderExtensionOptions {
5
5
  /**
6
6
  * Defines options for the KHR_node_hoverability extension.
@@ -1,6 +1,6 @@
1
- import type { GLTFLoader } from "../glTFLoader";
2
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
3
- declare module "../../glTFFileLoader" {
1
+ import type { GLTFLoader } from "../glTFLoader.js";
2
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
3
+ declare module "../../glTFFileLoader.js" {
4
4
  interface GLTFLoaderExtensionOptions {
5
5
  /**
6
6
  * Defines options for the KHR_selectability extension.
@@ -1,6 +1,6 @@
1
- import type { GLTFLoader } from "../glTFLoader";
2
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
3
- declare module "../../glTFFileLoader" {
1
+ import type { GLTFLoader } from "../glTFLoader.js";
2
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
3
+ declare module "../../glTFFileLoader.js" {
4
4
  interface GLTFLoaderExtensionOptions {
5
5
  /**
6
6
  * Defines options for the KHR_node_visibility extension.
@@ -1,9 +1,9 @@
1
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
2
- import { GLTFLoader } from "../glTFLoader";
3
- import type { ITexture } from "../glTFLoaderInterfaces";
1
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
2
+ import { GLTFLoader } from "../glTFLoader.js";
3
+ import type { ITexture } from "../glTFLoaderInterfaces.js";
4
4
  import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
5
5
  import type { Nullable } from "@babylonjs/core/types.js";
6
- declare module "../../glTFFileLoader" {
6
+ declare module "../../glTFFileLoader.js" {
7
7
  interface GLTFLoaderExtensionOptions {
8
8
  /**
9
9
  * Defines options for the KHR_texture_basisu extension.
@@ -1,9 +1,9 @@
1
1
  import type { Nullable } from "@babylonjs/core/types.js";
2
2
  import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
3
- import type { ITextureInfo } from "../glTFLoaderInterfaces";
4
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
5
- import { GLTFLoader } from "../glTFLoader";
6
- declare module "../../glTFFileLoader" {
3
+ import type { ITextureInfo } from "../glTFLoaderInterfaces.js";
4
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
5
+ import { GLTFLoader } from "../glTFLoader.js";
6
+ declare module "../../glTFFileLoader.js" {
7
7
  interface GLTFLoaderExtensionOptions {
8
8
  /**
9
9
  * Defines options for the KHR_texture_transform extension.
@@ -1,6 +1,6 @@
1
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
2
- import type { GLTFLoader } from "../glTFLoader";
3
- declare module "../../glTFFileLoader" {
1
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
2
+ import type { GLTFLoader } from "../glTFLoader.js";
3
+ declare module "../../glTFFileLoader.js" {
4
4
  interface GLTFLoaderExtensionOptions {
5
5
  /**
6
6
  * Defines options for the KHR_xmp_json_ld extension.
@@ -1,11 +1,11 @@
1
1
  import type { Nullable } from "@babylonjs/core/types.js";
2
2
  import type { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
3
3
  import type { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
4
- import type { IScene, INode, IAnimation } from "../glTFLoaderInterfaces";
5
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
6
- import { GLTFLoader } from "../glTFLoader";
4
+ import type { IScene, INode, IAnimation } from "../glTFLoaderInterfaces.js";
5
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
6
+ import { GLTFLoader } from "../glTFLoader.js";
7
7
  import "@babylonjs/core/Audio/audioSceneComponent.js";
8
- declare module "../../glTFFileLoader" {
8
+ declare module "../../glTFFileLoader.js" {
9
9
  interface GLTFLoaderExtensionOptions {
10
10
  /**
11
11
  * Defines options for the MSFT_audio_emitter extension.
@@ -3,11 +3,11 @@ import { Observable } from "@babylonjs/core/Misc/observable.js";
3
3
  import type { Material } from "@babylonjs/core/Materials/material.js";
4
4
  import type { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
5
5
  import type { Mesh } from "@babylonjs/core/Meshes/mesh.js";
6
- import type { INode, IMaterial, IBuffer, IScene } from "../glTFLoaderInterfaces";
7
- import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
8
- import { GLTFLoader } from "../glTFLoader";
6
+ import type { INode, IMaterial, IBuffer, IScene } from "../glTFLoaderInterfaces.js";
7
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
8
+ import { GLTFLoader } from "../glTFLoader.js";
9
9
  import type { IProperty } from "babylonjs-gltf2interface";
10
- declare module "../../glTFFileLoader" {
10
+ declare module "../../glTFFileLoader.js" {
11
11
  interface GLTFLoaderExtensionOptions {
12
12
  /**
13
13
  * Defines options for the MSFT_lod extension.
@@ -1,9 +1,9 @@
1
1
  import type { Nullable } from "@babylonjs/core/types.js";
2
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
- declare module "../../glTFFileLoader" {
3
+ import type { IMaterial } from "../glTFLoaderInterfaces.js";
4
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
5
+ import { GLTFLoader } from "../glTFLoader.js";
6
+ declare module "../../glTFFileLoader.js" {
7
7
  interface GLTFLoaderExtensionOptions {
8
8
  /**
9
9
  * Defines options for the MSFT_minecraftMesh extension.
@@ -1,9 +1,9 @@
1
1
  import type { Nullable } from "@babylonjs/core/types.js";
2
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
- declare module "../../glTFFileLoader" {
3
+ import type { IMaterial } from "../glTFLoaderInterfaces.js";
4
+ import type { IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
5
+ import { GLTFLoader } from "../glTFLoader.js";
6
+ declare module "../../glTFFileLoader.js" {
7
7
  interface GLTFLoaderExtensionOptions {
8
8
  /**
9
9
  * Defines options for the MSFT_sRGBFactors extension.
@@ -1,6 +1,14 @@
1
1
  import type { IObjectInfo, IPathToObjectConverter } from "@babylonjs/core/ObjectModel/objectModelInterfaces.js";
2
- import type { IGLTF } from "../glTFLoaderInterfaces";
2
+ import type { IGLTF } from "../glTFLoaderInterfaces.js";
3
3
  import type { IObjectAccessor } from "@babylonjs/core/FlowGraph/typeDefinitions.js";
4
+ /**
5
+ * Adding an exception here will break traversing through the glTF object tree.
6
+ * This is used for properties that might not be in the glTF object model, but are optional and have a default value.
7
+ * For example, the path /nodes/\{\}/extensions/KHR_node_visibility/visible is optional - the object can be deferred without the object fully existing.
8
+ */
9
+ export declare const OptionalPathExceptionsList: {
10
+ regex: RegExp;
11
+ }[];
4
12
  /**
5
13
  * A converter that takes a glTF Object Model JSON Pointer
6
14
  * and transforms it into an ObjectAccessorContainer, allowing
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Adding an exception here will break traversing through the glTF object tree.
3
+ * This is used for properties that might not be in the glTF object model, but are optional and have a default value.
4
+ * For example, the path /nodes/\{\}/extensions/KHR_node_visibility/visible is optional - the object can be deferred without the object fully existing.
5
+ */
6
+ export const OptionalPathExceptionsList = [
7
+ {
8
+ // get the node as object when reading an extension
9
+ regex: new RegExp(`^/nodes/\\d+/extensions/`),
10
+ },
11
+ ];
1
12
  /**
2
13
  * A converter that takes a glTF Object Model JSON Pointer
3
14
  * and transforms it into an ObjectAccessorContainer, allowing
@@ -67,9 +78,13 @@ export class GLTFPathToObjectConverter {
67
78
  }
68
79
  if (!ignoreObjectTree) {
69
80
  if (objectTree === undefined) {
70
- throw new Error(`Path ${path} is invalid`);
81
+ // check if the path is in the exception list. If it is, break and return the last object that was found
82
+ const exception = OptionalPathExceptionsList.find((e) => e.regex.test(path));
83
+ if (!exception) {
84
+ throw new Error(`Path ${path} is invalid`);
85
+ }
71
86
  }
72
- if (!isLength) {
87
+ else if (!isLength) {
73
88
  objectTree = objectTree?.[part];
74
89
  }
75
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gltfPathToObjectConverter.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/gltfPathToObjectConverter.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IAClC,YACY,KAAY,EACZ,SAAc;QADd,UAAK,GAAL,KAAK,CAAO;QACZ,cAAS,GAAT,SAAS,CAAK;IACvB,CAAC;IAEJ;;;;;;;;;;;;;;;;;;;;;OAqBG;IACI,OAAO,CAAC,IAAY;QACvB,IAAI,UAAU,GAAQ,IAAI,CAAC,KAAK,CAAC;QACjC,IAAI,QAAQ,GAAQ,IAAI,CAAC,SAAS,CAAC;QACnC,IAAI,MAAM,GAAQ,SAAS,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG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ACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpB,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC3B,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,aAAa,CAAC,CAAC;gBAC/C,CAAC;gBACD,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACZ,UAAU,GAAG,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC;gBACpC,CAAC;YACL,CAAC;YAED,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,EAAE,CAAC;gBAClC,MAAM,GAAG,UAAU,CAAC;YACxB,CAAC;QACL,CAAC;QAED,OAAO;YACH,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,QAAQ;SACjB,CAAC;IACN,CAAC;CACJ","sourcesContent":["import type { IObjectInfo, IPathToObjectConverter } from \"core/ObjectModel/objectModelInterfaces\";\r\nimport type { IGLTF } from \"../glTFLoaderInterfaces\";\r\nimport type { IObjectAccessor } from \"core/FlowGraph/typeDefinitions\";\r\n\r\n/**\r\n * A converter that takes a glTF Object Model JSON Pointer\r\n * and transforms it into an ObjectAccessorContainer, allowing\r\n * objects referenced in the glTF to be associated with their\r\n * respective Babylon.js objects.\r\n */\r\nexport class GLTFPathToObjectConverter<T, BabylonType, BabylonValue> implements IPathToObjectConverter<IObjectAccessor<T, BabylonType, BabylonValue>> {\r\n public constructor(\r\n private _gltf: IGLTF,\r\n private _infoTree: any\r\n ) {}\r\n\r\n /**\r\n * The pointer string is represented by a [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901).\r\n * See also https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/ObjectModel.adoc#core-pointers\r\n * <animationPointer> := /<rootNode>/<assetIndex>/<propertyPath>\r\n * <rootNode> := \"nodes\" | \"materials\" | \"meshes\" | \"cameras\" | \"extensions\"\r\n * <assetIndex> := <digit> | <name>\r\n * <propertyPath> := <extensionPath> | <standardPath>\r\n * <extensionPath> := \"extensions\"/<name>/<standardPath>\r\n * <standardPath> := <name> | <name>/<standardPath>\r\n * <name> := W+\r\n * <digit> := D+\r\n *\r\n * Examples:\r\n * - \"/nodes/0/rotation\"\r\n * - \"/nodes.length\"\r\n * - \"/materials/2/emissiveFactor\"\r\n * - \"/materials/2/pbrMetallicRoughness/baseColorFactor\"\r\n * - \"/materials/2/extensions/KHR_materials_emissive_strength/emissiveStrength\"\r\n *\r\n * @param path The path to convert\r\n * @returns The object and info associated with the path\r\n */\r\n public convert(path: string): IObjectInfo<IObjectAccessor<T, BabylonType, BabylonValue>> {\r\n let objectTree: any = this._gltf;\r\n let infoTree: any = this._infoTree;\r\n let target: any = undefined;\r\n\r\n if (!path.startsWith(\"/\")) {\r\n throw new Error(\"Path must start with a /\");\r\n }\r\n const parts = path.split(\"/\");\r\n parts.shift();\r\n\r\n //if the last part has \".length\" in it, separate that as an extra part\r\n if (parts[parts.length - 1].includes(\".length\")) {\r\n const lastPart = parts[parts.length - 1];\r\n const split = lastPart.split(\".\");\r\n parts.pop();\r\n parts.push(...split);\r\n }\r\n\r\n let ignoreObjectTree = false;\r\n\r\n for (const part of parts) {\r\n const isLength = part === \"length\";\r\n if (isLength && !infoTree.__array__) {\r\n throw new Error(`Path ${path} is invalid`);\r\n }\r\n if (infoTree.__ignoreObjectTree__) {\r\n ignoreObjectTree = true;\r\n }\r\n if (infoTree.__array__ && !isLength) {\r\n infoTree = infoTree.__array__;\r\n } else {\r\n infoTree = infoTree[part];\r\n if (!infoTree) {\r\n throw new Error(`Path ${path} is invalid`);\r\n }\r\n }\r\n if (!ignoreObjectTree) {\r\n if (objectTree === undefined) {\r\n throw new Error(`Path ${path} is invalid`);\r\n }\r\n if (!isLength) {\r\n objectTree = objectTree?.[part];\r\n }\r\n }\r\n\r\n if (infoTree.__target__ || isLength) {\r\n target = objectTree;\r\n }\r\n }\r\n\r\n return {\r\n object: target,\r\n info: infoTree,\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"gltfPathToObjectConverter.js","sourceRoot":"","sources":["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,EAAE,QAAQ;SACjB,CAAC;IACN,CAAC;CACJ","sourcesContent":["import type { IObjectInfo, IPathToObjectConverter } from \"core/ObjectModel/objectModelInterfaces\";\r\nimport type { IGLTF } from \"../glTFLoaderInterfaces\";\r\nimport type { IObjectAccessor } from \"core/FlowGraph/typeDefinitions\";\r\n\r\n/**\r\n * Adding an exception here will break traversing through the glTF object tree.\r\n * This is used for properties that might not be in the glTF object model, but are optional and have a default value.\r\n * For example, the path /nodes/\\{\\}/extensions/KHR_node_visibility/visible is optional - the object can be deferred without the object fully existing.\r\n */\r\nexport const OptionalPathExceptionsList: {\r\n regex: RegExp;\r\n}[] = [\r\n {\r\n // get the node as object when reading an extension\r\n regex: new RegExp(`^/nodes/\\\\d+/extensions/`),\r\n },\r\n];\r\n\r\n/**\r\n * A converter that takes a glTF Object Model JSON Pointer\r\n * and transforms it into an ObjectAccessorContainer, allowing\r\n * objects referenced in the glTF to be associated with their\r\n * respective Babylon.js objects.\r\n */\r\nexport class GLTFPathToObjectConverter<T, BabylonType, BabylonValue> implements IPathToObjectConverter<IObjectAccessor<T, BabylonType, BabylonValue>> {\r\n public constructor(\r\n private _gltf: IGLTF,\r\n private _infoTree: any\r\n ) {}\r\n\r\n /**\r\n * The pointer string is represented by a [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901).\r\n * See also https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/ObjectModel.adoc#core-pointers\r\n * <animationPointer> := /<rootNode>/<assetIndex>/<propertyPath>\r\n * <rootNode> := \"nodes\" | \"materials\" | \"meshes\" | \"cameras\" | \"extensions\"\r\n * <assetIndex> := <digit> | <name>\r\n * <propertyPath> := <extensionPath> | <standardPath>\r\n * <extensionPath> := \"extensions\"/<name>/<standardPath>\r\n * <standardPath> := <name> | <name>/<standardPath>\r\n * <name> := W+\r\n * <digit> := D+\r\n *\r\n * Examples:\r\n * - \"/nodes/0/rotation\"\r\n * - \"/nodes.length\"\r\n * - \"/materials/2/emissiveFactor\"\r\n * - \"/materials/2/pbrMetallicRoughness/baseColorFactor\"\r\n * - \"/materials/2/extensions/KHR_materials_emissive_strength/emissiveStrength\"\r\n *\r\n * @param path The path to convert\r\n * @returns The object and info associated with the path\r\n */\r\n public convert(path: string): IObjectInfo<IObjectAccessor<T, BabylonType, BabylonValue>> {\r\n let objectTree: any = this._gltf;\r\n let infoTree: any = this._infoTree;\r\n let target: any = undefined;\r\n\r\n if (!path.startsWith(\"/\")) {\r\n throw new Error(\"Path must start with a /\");\r\n }\r\n const parts = path.split(\"/\");\r\n parts.shift();\r\n\r\n //if the last part has \".length\" in it, separate that as an extra part\r\n if (parts[parts.length - 1].includes(\".length\")) {\r\n const lastPart = parts[parts.length - 1];\r\n const split = lastPart.split(\".\");\r\n parts.pop();\r\n parts.push(...split);\r\n }\r\n\r\n let ignoreObjectTree = false;\r\n\r\n for (const part of parts) {\r\n const isLength = part === \"length\";\r\n if (isLength && !infoTree.__array__) {\r\n throw new Error(`Path ${path} is invalid`);\r\n }\r\n if (infoTree.__ignoreObjectTree__) {\r\n ignoreObjectTree = true;\r\n }\r\n if (infoTree.__array__ && !isLength) {\r\n infoTree = infoTree.__array__;\r\n } else {\r\n infoTree = infoTree[part];\r\n if (!infoTree) {\r\n throw new Error(`Path ${path} is invalid`);\r\n }\r\n }\r\n if (!ignoreObjectTree) {\r\n if (objectTree === undefined) {\r\n // check if the path is in the exception list. If it is, break and return the last object that was found\r\n const exception = OptionalPathExceptionsList.find((e) => e.regex.test(path));\r\n if (!exception) {\r\n throw new Error(`Path ${path} is invalid`);\r\n }\r\n } else if (!isLength) {\r\n objectTree = objectTree?.[part];\r\n }\r\n }\r\n\r\n if (infoTree.__target__ || isLength) {\r\n target = objectTree;\r\n }\r\n }\r\n\r\n return {\r\n object: target,\r\n info: infoTree,\r\n };\r\n }\r\n}\r\n"]}
@@ -1,38 +1,38 @@
1
- export * from "./objectModelMapping";
2
- export * from "./EXT_lights_image_based";
3
- export * from "./EXT_mesh_gpu_instancing";
4
- export * from "./EXT_meshopt_compression";
5
- export * from "./EXT_texture_webp";
6
- export * from "./EXT_texture_avif";
7
- export * from "./EXT_lights_ies";
8
- export * from "./KHR_draco_mesh_compression";
9
- export * from "./KHR_lights_punctual";
10
- export * from "./KHR_materials_pbrSpecularGlossiness";
11
- export * from "./KHR_materials_unlit";
12
- export * from "./KHR_materials_clearcoat";
13
- export * from "./KHR_materials_iridescence";
14
- export * from "./KHR_materials_anisotropy";
15
- export * from "./KHR_materials_emissive_strength";
16
- export * from "./KHR_materials_sheen";
17
- export * from "./KHR_materials_specular";
18
- export * from "./KHR_materials_ior";
19
- export * from "./KHR_materials_variants";
20
- export * from "./KHR_materials_transmission";
21
- export * from "./KHR_materials_diffuse_transmission";
22
- export * from "./KHR_materials_volume";
23
- export * from "./KHR_materials_dispersion";
24
- export * from "./KHR_mesh_quantization";
25
- export * from "./KHR_texture_basisu";
26
- export * from "./KHR_texture_transform";
27
- export * from "./KHR_xmp_json_ld";
28
- export * from "./KHR_animation_pointer";
29
- export * from "./MSFT_audio_emitter";
30
- export * from "./MSFT_lod";
31
- export * from "./MSFT_minecraftMesh";
32
- export * from "./MSFT_sRGBFactors";
33
- export * from "./KHR_interactivity";
34
- export * from "./KHR_node_visibility";
35
- export * from "./KHR_node_selectability";
36
- export * from "./KHR_node_hoverability";
37
- export * from "./ExtrasAsMetadata";
38
- export * from "./KHR_interactivity/index";
1
+ export * from "./objectModelMapping.js";
2
+ export * from "./EXT_lights_image_based.js";
3
+ export * from "./EXT_mesh_gpu_instancing.js";
4
+ export * from "./EXT_meshopt_compression.js";
5
+ export * from "./EXT_texture_webp.js";
6
+ export * from "./EXT_texture_avif.js";
7
+ export * from "./EXT_lights_ies.js";
8
+ export * from "./KHR_draco_mesh_compression.js";
9
+ export * from "./KHR_lights_punctual.js";
10
+ export * from "./KHR_materials_pbrSpecularGlossiness.js";
11
+ export * from "./KHR_materials_unlit.js";
12
+ export * from "./KHR_materials_clearcoat.js";
13
+ export * from "./KHR_materials_iridescence.js";
14
+ export * from "./KHR_materials_anisotropy.js";
15
+ export * from "./KHR_materials_emissive_strength.js";
16
+ export * from "./KHR_materials_sheen.js";
17
+ export * from "./KHR_materials_specular.js";
18
+ export * from "./KHR_materials_ior.js";
19
+ export * from "./KHR_materials_variants.js";
20
+ export * from "./KHR_materials_transmission.js";
21
+ export * from "./KHR_materials_diffuse_transmission.js";
22
+ export * from "./KHR_materials_volume.js";
23
+ export * from "./KHR_materials_dispersion.js";
24
+ export * from "./KHR_mesh_quantization.js";
25
+ export * from "./KHR_texture_basisu.js";
26
+ export * from "./KHR_texture_transform.js";
27
+ export * from "./KHR_xmp_json_ld.js";
28
+ export * from "./KHR_animation_pointer.js";
29
+ export * from "./MSFT_audio_emitter.js";
30
+ export * from "./MSFT_lod.js";
31
+ export * from "./MSFT_minecraftMesh.js";
32
+ export * from "./MSFT_sRGBFactors.js";
33
+ export * from "./KHR_interactivity.js";
34
+ export * from "./KHR_node_visibility.js";
35
+ export * from "./KHR_node_selectability.js";
36
+ export * from "./KHR_node_hoverability.js";
37
+ export * from "./ExtrasAsMetadata.js";
38
+ export * from "./KHR_interactivity/index.js";
@@ -1,5 +1,5 @@
1
1
  import type { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
2
- import type { IAnimation, ICamera, IGLTF, IKHRLightsPunctual_Light, IMaterial, IMesh, INode } from "../glTFLoaderInterfaces";
2
+ import type { IAnimation, ICamera, IGLTF, IKHRLightsPunctual_Light, IMaterial, IMesh, INode } from "../glTFLoaderInterfaces.js";
3
3
  import type { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
4
4
  import { Matrix, Quaternion, Vector2 } from "@babylonjs/core/Maths/math.vector.js";
5
5
  import type { Color3 } from "@babylonjs/core/Maths/math.color.js";
@@ -10,7 +10,7 @@ import type { Nullable } from "@babylonjs/core/types.js";
10
10
  import type { IEXTLightsImageBased_LightImageBased } from "babylonjs-gltf2interface";
11
11
  import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
12
12
  import type { IInterpolationPropertyInfo, IObjectAccessor } from "@babylonjs/core/FlowGraph/typeDefinitions.js";
13
- import { GLTFPathToObjectConverter } from "./gltfPathToObjectConverter";
13
+ import { GLTFPathToObjectConverter } from "./gltfPathToObjectConverter.js";
14
14
  import type { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
15
15
  import type { Mesh } from "@babylonjs/core/Meshes/mesh.js";
16
16
  export interface IGLTFObjectModelTree {
@@ -12,16 +12,16 @@ import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
12
12
  import type { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader.js";
13
13
  import type { Scene } from "@babylonjs/core/scene.js";
14
14
  import type { IProperty } from "babylonjs-gltf2interface";
15
- import type { IGLTF, ISampler, INode, IScene, IMesh, IAccessor, ICamera, IAnimation, IBuffer, IBufferView, IMaterial, ITextureInfo, ITexture, IImage, IMeshPrimitive, IArrayItem, IAnimationChannel } from "./glTFLoaderInterfaces";
16
- import type { IGLTFLoader, IGLTFLoaderData } from "../glTFFileLoader";
17
- import { GLTFFileLoader } from "../glTFFileLoader";
15
+ import type { IGLTF, ISampler, INode, IScene, IMesh, IAccessor, ICamera, IAnimation, IBuffer, IBufferView, IMaterial, ITextureInfo, ITexture, IImage, IMeshPrimitive, IArrayItem, IAnimationChannel } from "./glTFLoaderInterfaces.js";
16
+ import type { IGLTFLoader, IGLTFLoaderData } from "../glTFFileLoader.js";
17
+ import { GLTFFileLoader } from "../glTFFileLoader.js";
18
18
  import type { IDataBuffer } from "@babylonjs/core/Misc/dataReader.js";
19
19
  import type { Light } from "@babylonjs/core/Lights/light.js";
20
20
  import { BoundingInfo } from "@babylonjs/core/Culling/boundingInfo.js";
21
21
  import type { AssetContainer } from "@babylonjs/core/assetContainer.js";
22
- import type { AnimationPropertyInfo } from "./glTFLoaderAnimation";
22
+ import type { AnimationPropertyInfo } from "./glTFLoaderAnimation.js";
23
23
  import type { IObjectInfo } from "@babylonjs/core/ObjectModel/objectModelInterfaces.js";
24
- import type { GLTFExtensionFactory } from "./glTFLoaderExtensionRegistry";
24
+ import type { GLTFExtensionFactory } from "./glTFLoaderExtensionRegistry.js";
25
25
  import type { IInterpolationPropertyInfo } from "@babylonjs/core/FlowGraph/typeDefinitions.js";
26
26
  export { GLTFFileLoader };
27
27
  interface IWithMetadata {
@@ -17,7 +17,7 @@ import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
17
17
  import { MorphTarget } from "@babylonjs/core/Morph/morphTarget.js";
18
18
  import { MorphTargetManager } from "@babylonjs/core/Morph/morphTargetManager.js";
19
19
  import { GLTFFileLoader, GLTFLoaderState, GLTFLoaderCoordinateSystemMode, GLTFLoaderAnimationStartMode } from "../glTFFileLoader.js";
20
- import { DecodeBase64UrlToBinary, IsBase64DataUrl, LoadFileError } from "@babylonjs/core/Misc/fileTools.js";
20
+ import { DecodeBase64UrlToBinary, GetMimeType, IsBase64DataUrl, LoadFileError } from "@babylonjs/core/Misc/fileTools.js";
21
21
  import { Logger } from "@babylonjs/core/Misc/logger.js";
22
22
  import { BoundingInfo } from "@babylonjs/core/Culling/boundingInfo.js";
23
23
  import { registeredGLTFExtensions, registerGLTFExtension, unregisterGLTFExtension } from "./glTFLoaderExtensionRegistry.js";
@@ -1936,7 +1936,7 @@ export class GLTFLoader {
1936
1936
  deferred.reject(new Error(`${context}: ${exception && exception.message ? exception.message : message || "Failed to load texture"}`));
1937
1937
  }
1938
1938
  },
1939
- mimeType: image.mimeType,
1939
+ mimeType: image.mimeType ?? GetMimeType(image.uri ?? ""),
1940
1940
  loaderOptions: textureLoaderOptions,
1941
1941
  useSRGBBuffer: !!useSRGBBuffer && this._parent.useSRGBBuffers,
1942
1942
  };