@babylonjs/loaders 7.23.0 → 7.24.0
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 +3 -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
@@ -0,0 +1,136 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
2
|
+
import { registerGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
3
|
+
/**
|
4
|
+
* Registers the built-in glTF 2.0 extension async factories, which dynamically imports and loads each glTF extension on demand (e.g. only when a glTF model uses the extension).
|
5
|
+
*/
|
6
|
+
export function registerBuiltInGLTFExtensions() {
|
7
|
+
registerGLTFExtension("EXT_lights_image_based", true, async (loader) => {
|
8
|
+
const { EXT_lights_image_based } = await import("./EXT_lights_image_based.js");
|
9
|
+
return new EXT_lights_image_based(loader);
|
10
|
+
});
|
11
|
+
registerGLTFExtension("EXT_mesh_gpu_instancing", true, async (loader) => {
|
12
|
+
const { EXT_mesh_gpu_instancing } = await import("./EXT_mesh_gpu_instancing.js");
|
13
|
+
return new EXT_mesh_gpu_instancing(loader);
|
14
|
+
});
|
15
|
+
registerGLTFExtension("EXT_meshopt_compression", true, async (loader) => {
|
16
|
+
const { EXT_meshopt_compression } = await import("./EXT_meshopt_compression.js");
|
17
|
+
return new EXT_meshopt_compression(loader);
|
18
|
+
});
|
19
|
+
registerGLTFExtension("EXT_texture_avif", true, async (loader) => {
|
20
|
+
const { EXT_texture_avif } = await import("./EXT_texture_avif.js");
|
21
|
+
return new EXT_texture_avif(loader);
|
22
|
+
});
|
23
|
+
registerGLTFExtension("EXT_texture_webp", true, async (loader) => {
|
24
|
+
const { EXT_texture_webp } = await import("./EXT_texture_webp.js");
|
25
|
+
return new EXT_texture_webp(loader);
|
26
|
+
});
|
27
|
+
registerGLTFExtension("ExtrasAsMetadata", false, async (loader) => {
|
28
|
+
const { ExtrasAsMetadata } = await import("./ExtrasAsMetadata.js");
|
29
|
+
return new ExtrasAsMetadata(loader);
|
30
|
+
});
|
31
|
+
registerGLTFExtension("KHR_animation_pointer", true, async (loader) => {
|
32
|
+
const { KHR_animation_pointer } = await import("./KHR_animation_pointer.js");
|
33
|
+
return new KHR_animation_pointer(loader);
|
34
|
+
});
|
35
|
+
registerGLTFExtension("KHR_draco_mesh_compression", true, async (loader) => {
|
36
|
+
const { KHR_draco_mesh_compression } = await import("./KHR_draco_mesh_compression.js");
|
37
|
+
return new KHR_draco_mesh_compression(loader);
|
38
|
+
});
|
39
|
+
registerGLTFExtension("KHR_interactivity", true, async (loader) => {
|
40
|
+
const { KHR_interactivity } = await import("./KHR_interactivity.js");
|
41
|
+
return new KHR_interactivity(loader);
|
42
|
+
});
|
43
|
+
registerGLTFExtension("KHR_lights_punctual", true, async (loader) => {
|
44
|
+
const { KHR_lights } = await import("./KHR_lights_punctual.js");
|
45
|
+
return new KHR_lights(loader);
|
46
|
+
});
|
47
|
+
registerGLTFExtension("KHR_materials_anisotropy", true, async (loader) => {
|
48
|
+
const { KHR_materials_anisotropy } = await import("./KHR_materials_anisotropy.js");
|
49
|
+
return new KHR_materials_anisotropy(loader);
|
50
|
+
});
|
51
|
+
registerGLTFExtension("KHR_materials_clearcoat", true, async (loader) => {
|
52
|
+
const { KHR_materials_clearcoat } = await import("./KHR_materials_clearcoat.js");
|
53
|
+
return new KHR_materials_clearcoat(loader);
|
54
|
+
});
|
55
|
+
registerGLTFExtension("KHR_materials_diffuse_transmission", true, async (loader) => {
|
56
|
+
const { KHR_materials_diffuse_transmission } = await import("./KHR_materials_diffuse_transmission.js");
|
57
|
+
return new KHR_materials_diffuse_transmission(loader);
|
58
|
+
});
|
59
|
+
registerGLTFExtension("KHR_materials_dispersion", true, async (loader) => {
|
60
|
+
const { KHR_materials_dispersion } = await import("./KHR_materials_dispersion.js");
|
61
|
+
return new KHR_materials_dispersion(loader);
|
62
|
+
});
|
63
|
+
registerGLTFExtension("KHR_materials_emissive_strength", true, async (loader) => {
|
64
|
+
const { KHR_materials_emissive_strength } = await import("./KHR_materials_emissive_strength.js");
|
65
|
+
return new KHR_materials_emissive_strength(loader);
|
66
|
+
});
|
67
|
+
registerGLTFExtension("KHR_materials_ior", true, async (loader) => {
|
68
|
+
const { KHR_materials_ior } = await import("./KHR_materials_ior.js");
|
69
|
+
return new KHR_materials_ior(loader);
|
70
|
+
});
|
71
|
+
registerGLTFExtension("KHR_materials_iridescence", true, async (loader) => {
|
72
|
+
const { KHR_materials_iridescence } = await import("./KHR_materials_iridescence.js");
|
73
|
+
return new KHR_materials_iridescence(loader);
|
74
|
+
});
|
75
|
+
registerGLTFExtension("KHR_materials_pbrSpecularGlossiness", true, async (loader) => {
|
76
|
+
const { KHR_materials_pbrSpecularGlossiness } = await import("./KHR_materials_pbrSpecularGlossiness.js");
|
77
|
+
return new KHR_materials_pbrSpecularGlossiness(loader);
|
78
|
+
});
|
79
|
+
registerGLTFExtension("KHR_materials_sheen", true, async (loader) => {
|
80
|
+
const { KHR_materials_sheen } = await import("./KHR_materials_sheen.js");
|
81
|
+
return new KHR_materials_sheen(loader);
|
82
|
+
});
|
83
|
+
registerGLTFExtension("KHR_materials_specular", true, async (loader) => {
|
84
|
+
const { KHR_materials_specular } = await import("./KHR_materials_specular.js");
|
85
|
+
return new KHR_materials_specular(loader);
|
86
|
+
});
|
87
|
+
registerGLTFExtension("KHR_materials_transmission", true, async (loader) => {
|
88
|
+
const { KHR_materials_transmission } = await import("./KHR_materials_transmission.js");
|
89
|
+
return new KHR_materials_transmission(loader);
|
90
|
+
});
|
91
|
+
registerGLTFExtension("KHR_materials_unlit", true, async (loader) => {
|
92
|
+
const { KHR_materials_unlit } = await import("./KHR_materials_unlit.js");
|
93
|
+
return new KHR_materials_unlit(loader);
|
94
|
+
});
|
95
|
+
registerGLTFExtension("KHR_materials_variants", true, async (loader) => {
|
96
|
+
const { KHR_materials_variants } = await import("./KHR_materials_variants.js");
|
97
|
+
return new KHR_materials_variants(loader);
|
98
|
+
});
|
99
|
+
registerGLTFExtension("KHR_materials_volume", true, async (loader) => {
|
100
|
+
const { KHR_materials_volume } = await import("./KHR_materials_volume.js");
|
101
|
+
return new KHR_materials_volume(loader);
|
102
|
+
});
|
103
|
+
registerGLTFExtension("KHR_mesh_quantization", true, async (loader) => {
|
104
|
+
const { KHR_mesh_quantization } = await import("./KHR_mesh_quantization.js");
|
105
|
+
return new KHR_mesh_quantization(loader);
|
106
|
+
});
|
107
|
+
registerGLTFExtension("KHR_texture_basisu", true, async (loader) => {
|
108
|
+
const { KHR_texture_basisu } = await import("./KHR_texture_basisu.js");
|
109
|
+
return new KHR_texture_basisu(loader);
|
110
|
+
});
|
111
|
+
registerGLTFExtension("KHR_texture_transform", true, async (loader) => {
|
112
|
+
const { KHR_texture_transform } = await import("./KHR_texture_transform.js");
|
113
|
+
return new KHR_texture_transform(loader);
|
114
|
+
});
|
115
|
+
registerGLTFExtension("KHR_xmp_json_ld", true, async (loader) => {
|
116
|
+
const { KHR_xmp_json_ld } = await import("./KHR_xmp_json_ld.js");
|
117
|
+
return new KHR_xmp_json_ld(loader);
|
118
|
+
});
|
119
|
+
registerGLTFExtension("MSFT_audio_emitter", true, async (loader) => {
|
120
|
+
const { MSFT_audio_emitter } = await import("./MSFT_audio_emitter.js");
|
121
|
+
return new MSFT_audio_emitter(loader);
|
122
|
+
});
|
123
|
+
registerGLTFExtension("MSFT_lod", true, async (loader) => {
|
124
|
+
const { MSFT_lod } = await import("./MSFT_lod.js");
|
125
|
+
return new MSFT_lod(loader);
|
126
|
+
});
|
127
|
+
registerGLTFExtension("MSFT_minecraftMesh", true, async (loader) => {
|
128
|
+
const { MSFT_minecraftMesh } = await import("./MSFT_minecraftMesh.js");
|
129
|
+
return new MSFT_minecraftMesh(loader);
|
130
|
+
});
|
131
|
+
registerGLTFExtension("MSFT_sRGBFactors", true, async (loader) => {
|
132
|
+
const { MSFT_sRGBFactors } = await import("./MSFT_sRGBFactors.js");
|
133
|
+
return new MSFT_sRGBFactors(loader);
|
134
|
+
});
|
135
|
+
}
|
136
|
+
//# sourceMappingURL=dynamic.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dynamic.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/dynamic.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;GAEG;AACH,MAAM,UAAU,6BAA6B;IACzC,qBAAqB,CAAC,wBAAwB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACnE,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;QAC5E,OAAO,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,yBAAyB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACpE,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAC9E,OAAO,IAAI,uBAAuB,CAAC,MAAM,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AAC;QACpE,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAChD,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC/D,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QACpE,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC7D,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAChE,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport { registerGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\n/**\r\n * Registers the built-in glTF 2.0 extension async factories, which dynamically imports and loads each glTF extension on demand (e.g. only when a glTF model uses the extension).\r\n */\r\nexport function registerBuiltInGLTFExtensions() {\r\n registerGLTFExtension(\"EXT_lights_image_based\", true, async (loader) => {\r\n const { EXT_lights_image_based } = await import(\"./EXT_lights_image_based\");\r\n return new EXT_lights_image_based(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_mesh_gpu_instancing\", true, async (loader) => {\r\n const { EXT_mesh_gpu_instancing } = await import(\"./EXT_mesh_gpu_instancing\");\r\n return new EXT_mesh_gpu_instancing(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_meshopt_compression\", true, async (loader) => {\r\n const { EXT_meshopt_compression } = await import(\"./EXT_meshopt_compression\");\r\n return new EXT_meshopt_compression(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_texture_avif\", true, async (loader) => {\r\n const { EXT_texture_avif } = await import(\"./EXT_texture_avif\");\r\n return new EXT_texture_avif(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_texture_webp\", true, async (loader) => {\r\n const { EXT_texture_webp } = await import(\"./EXT_texture_webp\");\r\n return new EXT_texture_webp(loader);\r\n });\r\n\r\n registerGLTFExtension(\"ExtrasAsMetadata\", false, async (loader) => {\r\n const { ExtrasAsMetadata } = await import(\"./ExtrasAsMetadata\");\r\n return new ExtrasAsMetadata(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_animation_pointer\", true, async (loader) => {\r\n const { KHR_animation_pointer } = await import(\"./KHR_animation_pointer\");\r\n return new KHR_animation_pointer(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_draco_mesh_compression\", true, async (loader) => {\r\n const { KHR_draco_mesh_compression } = await import(\"./KHR_draco_mesh_compression\");\r\n return new KHR_draco_mesh_compression(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_interactivity\", true, async (loader) => {\r\n const { KHR_interactivity } = await import(\"./KHR_interactivity\");\r\n return new KHR_interactivity(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_lights_punctual\", true, async (loader) => {\r\n const { KHR_lights } = await import(\"./KHR_lights_punctual\");\r\n return new KHR_lights(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_anisotropy\", true, async (loader) => {\r\n const { KHR_materials_anisotropy } = await import(\"./KHR_materials_anisotropy\");\r\n return new KHR_materials_anisotropy(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_clearcoat\", true, async (loader) => {\r\n const { KHR_materials_clearcoat } = await import(\"./KHR_materials_clearcoat\");\r\n return new KHR_materials_clearcoat(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_diffuse_transmission\", true, async (loader) => {\r\n const { KHR_materials_diffuse_transmission } = await import(\"./KHR_materials_diffuse_transmission\");\r\n return new KHR_materials_diffuse_transmission(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_dispersion\", true, async (loader) => {\r\n const { KHR_materials_dispersion } = await import(\"./KHR_materials_dispersion\");\r\n return new KHR_materials_dispersion(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_emissive_strength\", true, async (loader) => {\r\n const { KHR_materials_emissive_strength } = await import(\"./KHR_materials_emissive_strength\");\r\n return new KHR_materials_emissive_strength(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_ior\", true, async (loader) => {\r\n const { KHR_materials_ior } = await import(\"./KHR_materials_ior\");\r\n return new KHR_materials_ior(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_iridescence\", true, async (loader) => {\r\n const { KHR_materials_iridescence } = await import(\"./KHR_materials_iridescence\");\r\n return new KHR_materials_iridescence(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_pbrSpecularGlossiness\", true, async (loader) => {\r\n const { KHR_materials_pbrSpecularGlossiness } = await import(\"./KHR_materials_pbrSpecularGlossiness\");\r\n return new KHR_materials_pbrSpecularGlossiness(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_sheen\", true, async (loader) => {\r\n const { KHR_materials_sheen } = await import(\"./KHR_materials_sheen\");\r\n return new KHR_materials_sheen(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_specular\", true, async (loader) => {\r\n const { KHR_materials_specular } = await import(\"./KHR_materials_specular\");\r\n return new KHR_materials_specular(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_transmission\", true, async (loader) => {\r\n const { KHR_materials_transmission } = await import(\"./KHR_materials_transmission\");\r\n return new KHR_materials_transmission(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_unlit\", true, async (loader) => {\r\n const { KHR_materials_unlit } = await import(\"./KHR_materials_unlit\");\r\n return new KHR_materials_unlit(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_variants\", true, async (loader) => {\r\n const { KHR_materials_variants } = await import(\"./KHR_materials_variants\");\r\n return new KHR_materials_variants(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_volume\", true, async (loader) => {\r\n const { KHR_materials_volume } = await import(\"./KHR_materials_volume\");\r\n return new KHR_materials_volume(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_mesh_quantization\", true, async (loader) => {\r\n const { KHR_mesh_quantization } = await import(\"./KHR_mesh_quantization\");\r\n return new KHR_mesh_quantization(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_texture_basisu\", true, async (loader) => {\r\n const { KHR_texture_basisu } = await import(\"./KHR_texture_basisu\");\r\n return new KHR_texture_basisu(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_texture_transform\", true, async (loader) => {\r\n const { KHR_texture_transform } = await import(\"./KHR_texture_transform\");\r\n return new KHR_texture_transform(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_xmp_json_ld\", true, async (loader) => {\r\n const { KHR_xmp_json_ld } = await import(\"./KHR_xmp_json_ld\");\r\n return new KHR_xmp_json_ld(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_audio_emitter\", true, async (loader) => {\r\n const { MSFT_audio_emitter } = await import(\"./MSFT_audio_emitter\");\r\n return new MSFT_audio_emitter(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_lod\", true, async (loader) => {\r\n const { MSFT_lod } = await import(\"./MSFT_lod\");\r\n return new MSFT_lod(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_minecraftMesh\", true, async (loader) => {\r\n const { MSFT_minecraftMesh } = await import(\"./MSFT_minecraftMesh\");\r\n return new MSFT_minecraftMesh(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_sRGBFactors\", true, async (loader) => {\r\n const { MSFT_sRGBFactors } = await import(\"./MSFT_sRGBFactors\");\r\n return new MSFT_sRGBFactors(loader);\r\n });\r\n}\r\n"]}
|
package/glTF/2.0/glTFLoader.d.ts
CHANGED
@@ -13,7 +13,6 @@ import type { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "@babylo
|
|
13
13
|
import type { Scene } from "@babylonjs/core/scene.js";
|
14
14
|
import type { IProperty } from "babylonjs-gltf2interface";
|
15
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 { IGLTFLoaderExtension } from "./glTFLoaderExtension";
|
17
16
|
import type { IGLTFLoader, IGLTFLoaderData } from "../glTFFileLoader";
|
18
17
|
import { GLTFFileLoader } from "../glTFFileLoader";
|
19
18
|
import type { IDataBuffer } from "@babylonjs/core/Misc/dataReader.js";
|
@@ -21,6 +20,8 @@ import type { Light } from "@babylonjs/core/Lights/light.js";
|
|
21
20
|
import type { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
22
21
|
import type { AnimationPropertyInfo } from "./glTFLoaderAnimation";
|
23
22
|
import type { IObjectInfo } from "@babylonjs/core/ObjectModel/objectModelInterfaces.js";
|
23
|
+
import type { GLTFExtensionFactory } from "./glTFLoaderExtensionRegistry";
|
24
|
+
export { GLTFFileLoader };
|
24
25
|
interface IWithMetadata {
|
25
26
|
metadata: any;
|
26
27
|
_internalMetadata: any;
|
@@ -83,7 +84,6 @@ export declare class GLTFLoader implements IGLTFLoader {
|
|
83
84
|
private _rootBabylonMesh;
|
84
85
|
private _defaultBabylonMaterialData;
|
85
86
|
private readonly _postSceneLoadActions;
|
86
|
-
private static _RegisteredExtensions;
|
87
87
|
/**
|
88
88
|
* The default glTF sampler.
|
89
89
|
*/
|
@@ -92,12 +92,14 @@ export declare class GLTFLoader implements IGLTFLoader {
|
|
92
92
|
* Registers a loader extension.
|
93
93
|
* @param name The name of the loader extension.
|
94
94
|
* @param factory The factory function that creates the loader extension.
|
95
|
+
* @deprecated Please use registerGLTFExtension instead.
|
95
96
|
*/
|
96
|
-
static RegisterExtension(name: string, factory:
|
97
|
+
static RegisterExtension(name: string, factory: GLTFExtensionFactory): void;
|
97
98
|
/**
|
98
99
|
* Unregisters a loader extension.
|
99
100
|
* @param name The name of the loader extension.
|
100
101
|
* @returns A boolean indicating whether the extension has been unregistered
|
102
|
+
* @deprecated Please use unregisterGLTFExtension instead.
|
101
103
|
*/
|
102
104
|
static UnregisterExtension(name: string): boolean;
|
103
105
|
/**
|
@@ -141,8 +143,7 @@ export declare class GLTFLoader implements IGLTFLoader {
|
|
141
143
|
private _loadAsync;
|
142
144
|
private _loadData;
|
143
145
|
private _setupData;
|
144
|
-
private
|
145
|
-
private _checkExtensions;
|
146
|
+
private _loadExtensionsAsync;
|
146
147
|
private _createRootNode;
|
147
148
|
/**
|
148
149
|
* Loads a glTF scene.
|
@@ -420,4 +421,3 @@ export declare class GLTFLoader implements IGLTFLoader {
|
|
420
421
|
*/
|
421
422
|
endPerformanceCounter(counterName: string): void;
|
422
423
|
}
|
423
|
-
export {};
|
package/glTF/2.0/glTFLoader.js
CHANGED
@@ -22,6 +22,8 @@ import { DecodeBase64UrlToBinary, IsBase64DataUrl, LoadFileError } from "@babylo
|
|
22
22
|
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
23
23
|
import { BoundingInfo } from "@babylonjs/core/Culling/boundingInfo.js";
|
24
24
|
import { nodeAnimationData } from "./glTFLoaderAnimation.js";
|
25
|
+
import { registeredGLTFExtensions, registerGLTFExtension, unregisterGLTFExtension } from "./glTFLoaderExtensionRegistry.js";
|
26
|
+
export { GLTFFileLoader };
|
25
27
|
// https://stackoverflow.com/a/48218209
|
26
28
|
function mergeDeep(...objects) {
|
27
29
|
const isObject = (obj) => obj && typeof obj === "object";
|
@@ -91,26 +93,19 @@ export class GLTFLoader {
|
|
91
93
|
* Registers a loader extension.
|
92
94
|
* @param name The name of the loader extension.
|
93
95
|
* @param factory The factory function that creates the loader extension.
|
96
|
+
* @deprecated Please use registerGLTFExtension instead.
|
94
97
|
*/
|
95
98
|
static RegisterExtension(name, factory) {
|
96
|
-
|
97
|
-
Logger.Warn(`Extension with the name '${name}' already exists`);
|
98
|
-
}
|
99
|
-
GLTFLoader._RegisteredExtensions[name] = {
|
100
|
-
factory: factory,
|
101
|
-
};
|
99
|
+
registerGLTFExtension(name, false, factory);
|
102
100
|
}
|
103
101
|
/**
|
104
102
|
* Unregisters a loader extension.
|
105
103
|
* @param name The name of the loader extension.
|
106
104
|
* @returns A boolean indicating whether the extension has been unregistered
|
105
|
+
* @deprecated Please use unregisterGLTFExtension instead.
|
107
106
|
*/
|
108
107
|
static UnregisterExtension(name) {
|
109
|
-
|
110
|
-
return false;
|
111
|
-
}
|
112
|
-
delete GLTFLoader._RegisteredExtensions[name];
|
113
|
-
return true;
|
108
|
+
return unregisterGLTFExtension(name);
|
114
109
|
}
|
115
110
|
/**
|
116
111
|
* The object that represents the glTF JSON.
|
@@ -249,13 +244,12 @@ export class GLTFLoader {
|
|
249
244
|
}
|
250
245
|
_loadAsync(rootUrl, fileName, nodes, resultFunc) {
|
251
246
|
return Promise.resolve()
|
252
|
-
.then(() => {
|
247
|
+
.then(async () => {
|
253
248
|
this._rootUrl = rootUrl;
|
254
249
|
this._uniqueRootUrl = !rootUrl.startsWith("file:") && fileName ? rootUrl : `${rootUrl}${Date.now()}/`;
|
255
250
|
this._fileName = fileName;
|
256
251
|
this._allMaterialsDirtyRequired = false;
|
257
|
-
this.
|
258
|
-
this._checkExtensions();
|
252
|
+
await this._loadExtensionsAsync();
|
259
253
|
const loadingToReadyCounterName = `${GLTFLoaderState[GLTFLoaderState.LOADING]} => ${GLTFLoaderState[GLTFLoaderState.READY]}`;
|
260
254
|
const loadingToCompleteCounterName = `${GLTFLoaderState[GLTFLoaderState.LOADING]} => ${GLTFLoaderState[GLTFLoaderState.COMPLETE]}`;
|
261
255
|
this._parent._startPerformanceCounter(loadingToReadyCounterName);
|
@@ -385,28 +379,31 @@ export class GLTFLoader {
|
|
385
379
|
}
|
386
380
|
}
|
387
381
|
}
|
388
|
-
|
389
|
-
|
382
|
+
async _loadExtensionsAsync() {
|
383
|
+
const extensionPromises = [];
|
384
|
+
registeredGLTFExtensions.forEach((registeredExtension, name) => {
|
390
385
|
// Don't load explicitly disabled extensions.
|
391
386
|
if (this.parent.extensionOptions[name]?.enabled === false) {
|
392
387
|
// But warn if the disabled extension is used by the model.
|
393
|
-
if (this.isExtensionUsed(name)) {
|
388
|
+
if (registeredExtension.isGLTFExtension && this.isExtensionUsed(name)) {
|
394
389
|
Logger.Warn(`Extension ${name} is used but has been explicitly disabled.`);
|
395
390
|
}
|
396
391
|
}
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
392
|
+
// Load loader extensions that are not a glTF extension, as well as extensions that are glTF extensions and are used by the model.
|
393
|
+
else if (!registeredExtension.isGLTFExtension || this.isExtensionUsed(name)) {
|
394
|
+
extensionPromises.push((async () => {
|
395
|
+
const extension = await registeredExtension.factory(this);
|
396
|
+
if (extension.name !== name) {
|
397
|
+
Logger.Warn(`The name of the glTF loader extension instance does not match the registered name: ${extension.name} !== ${name}`);
|
398
|
+
}
|
399
|
+
this._parent.onExtensionLoadedObservable.notifyObservers(extension);
|
400
|
+
return extension;
|
401
|
+
})());
|
404
402
|
}
|
405
|
-
}
|
403
|
+
});
|
404
|
+
this._extensions.push(...(await Promise.all(extensionPromises)));
|
406
405
|
this._extensions.sort((a, b) => (a.order || Number.MAX_VALUE) - (b.order || Number.MAX_VALUE));
|
407
406
|
this._parent.onExtensionLoadedObservable.clear();
|
408
|
-
}
|
409
|
-
_checkExtensions() {
|
410
407
|
if (this._gltf.extensionsRequired) {
|
411
408
|
for (const name of this._gltf.extensionsRequired) {
|
412
409
|
const available = this._extensions.some((extension) => extension.name === name && extension.enabled);
|
@@ -2328,7 +2325,6 @@ export class GLTFLoader {
|
|
2328
2325
|
this._parent._endPerformanceCounter(counterName);
|
2329
2326
|
}
|
2330
2327
|
}
|
2331
|
-
GLTFLoader._RegisteredExtensions = {};
|
2332
2328
|
/**
|
2333
2329
|
* The default glTF sampler.
|
2334
2330
|
*/
|