@babylonjs/loaders 5.20.0 → 5.22.1
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/mtlFileLoader.js +25 -27
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.js +112 -124
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/solidParser.js +118 -125
- package/OBJ/solidParser.js.map +1 -1
- package/STL/stlFileLoader.js +61 -63
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.js +26 -30
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.js +409 -432
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.js +33 -37
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.js +27 -31
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +48 -59
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +24 -29
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +13 -16
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.js +13 -16
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +22 -26
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.js +63 -76
- package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.map.js +90 -120
- package/glTF/2.0/Extensions/KHR_animation_pointer.map.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +25 -28
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +27 -30
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +25 -28
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +15 -18
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.js +21 -24
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js +27 -31
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +24 -27
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +23 -26
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.js +23 -26
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +20 -23
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +82 -86
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +19 -22
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.js +79 -97
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.js +20 -23
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +6 -8
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +13 -16
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js +12 -15
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +12 -15
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +77 -95
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.js +114 -139
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +12 -15
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +12 -15
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/glTFLoader.js +739 -823
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/glTFFileLoader.js +337 -404
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.js +32 -39
- package/glTF/glTFValidation.js.map +1 -1
- package/legacy/legacy-glTF.js +3 -3
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.js +2 -2
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF2.js +12 -12
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-objFileLoader.js +2 -2
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.js +2 -2
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/package.json +5 -8
@@ -1,16 +1,16 @@
|
|
1
1
|
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
-
|
3
|
+
const NAME = "KHR_materials_volume";
|
4
4
|
/**
|
5
5
|
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume)
|
6
6
|
* @since 5.0.0
|
7
7
|
*/
|
8
|
-
|
8
|
+
export class KHR_materials_volume {
|
9
9
|
/**
|
10
10
|
* @param loader
|
11
11
|
* @hidden
|
12
12
|
*/
|
13
|
-
|
13
|
+
constructor(loader) {
|
14
14
|
/**
|
15
15
|
* The name of this extension.
|
16
16
|
*/
|
@@ -27,31 +27,30 @@ var KHR_materials_volume = /** @class */ (function () {
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
/** @hidden */
|
30
|
-
|
30
|
+
dispose() {
|
31
31
|
if (this.enabled) {
|
32
32
|
this._loader._disableInstancedMesh--;
|
33
33
|
}
|
34
34
|
this._loader = null;
|
35
|
-
}
|
35
|
+
}
|
36
36
|
/**
|
37
37
|
* @param context
|
38
38
|
* @param material
|
39
39
|
* @param babylonMaterial
|
40
40
|
* @hidden
|
41
41
|
*/
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
promises.push(
|
47
|
-
promises.push(
|
48
|
-
|
49
|
-
return Promise.all(promises).then(function () { });
|
42
|
+
loadMaterialPropertiesAsync(context, material, babylonMaterial) {
|
43
|
+
return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {
|
44
|
+
const promises = new Array();
|
45
|
+
promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));
|
46
|
+
promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
|
47
|
+
promises.push(this._loadVolumePropertiesAsync(extensionContext, material, babylonMaterial, extension));
|
48
|
+
return Promise.all(promises).then(() => { });
|
50
49
|
});
|
51
|
-
}
|
52
|
-
|
50
|
+
}
|
51
|
+
_loadVolumePropertiesAsync(context, material, babylonMaterial, extension) {
|
53
52
|
if (!(babylonMaterial instanceof PBRMaterial)) {
|
54
|
-
throw new Error(
|
53
|
+
throw new Error(`${context}: Material type not supported`);
|
55
54
|
}
|
56
55
|
// If transparency isn't enabled already, this extension shouldn't do anything.
|
57
56
|
// i.e. it requires either the KHR_materials_transmission or KHR_materials_translucency extensions.
|
@@ -60,7 +59,7 @@ var KHR_materials_volume = /** @class */ (function () {
|
|
60
59
|
}
|
61
60
|
// IOR in this extension only affects interior.
|
62
61
|
babylonMaterial.subSurface.volumeIndexOfRefraction = babylonMaterial.indexOfRefraction;
|
63
|
-
|
62
|
+
const attenuationDistance = extension.attenuationDistance !== undefined ? extension.attenuationDistance : Number.MAX_VALUE;
|
64
63
|
babylonMaterial.subSurface.tintColorAtDistance = attenuationDistance;
|
65
64
|
if (extension.attenuationColor !== undefined && extension.attenuationColor.length == 3) {
|
66
65
|
babylonMaterial.subSurface.tintColor.copyFromFloats(extension.attenuationColor[0], extension.attenuationColor[1], extension.attenuationColor[2]);
|
@@ -70,7 +69,7 @@ var KHR_materials_volume = /** @class */ (function () {
|
|
70
69
|
babylonMaterial.subSurface.useThicknessAsDepth = true;
|
71
70
|
if (extension.thicknessTexture) {
|
72
71
|
extension.thicknessTexture.nonColorData = true;
|
73
|
-
return this._loader.loadTextureInfoAsync(
|
72
|
+
return this._loader.loadTextureInfoAsync(`${context}/thicknessTexture`, extension.thicknessTexture).then((texture) => {
|
74
73
|
babylonMaterial.subSurface.thicknessTexture = texture;
|
75
74
|
babylonMaterial.subSurface.useGltfStyleTextures = true;
|
76
75
|
});
|
@@ -78,9 +77,7 @@ var KHR_materials_volume = /** @class */ (function () {
|
|
78
77
|
else {
|
79
78
|
return Promise.resolve();
|
80
79
|
}
|
81
|
-
}
|
82
|
-
|
83
|
-
|
84
|
-
export { KHR_materials_volume };
|
85
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_volume(loader); });
|
80
|
+
}
|
81
|
+
}
|
82
|
+
GLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_volume(loader));
|
86
83
|
//# sourceMappingURL=KHR_materials_volume.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_volume.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_volume.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,
|
1
|
+
{"version":3,"file":"KHR_materials_volume.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_volume.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,IAAI,GAAG,sBAAsB,CAAC;AAEpC;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAkB7B;;;OAGG;IACH,YAAY,MAAkB;QArB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QASf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,qHAAqH;YACrH,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;SACxC;IACL,CAAC;IAED,cAAc;IACP,OAAO;QACV,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;SACxC;QACA,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,2BAA2B,CAAC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAC9F,OAAO,UAAU,CAAC,kBAAkB,CAAsB,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAAgB,EAAE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U,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QACrE,IAAI,SAAS,CAAC,gBAAgB,KAAK,SAAS,IAAI,SAAS,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,EAAE;YACpF,eAAe,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;SACpJ;QAED,eAAe,CAAC,UAAU,CAAC,gBAAgB,GAAG,GAAG,CAAC;QAClD,eAAe,CAAC,UAAU,CAAC,gBAAgB,GAAG,SAAS,CAAC,eAAe,CAAC;QACxE,eAAe,CAAC,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC;QACtD,IAAI,SAAS,CAAC,gBAAgB,EAAE;YAC3B,SAAS,CAAC,gBAAiC,CAAC,YAAY,GAAG,IAAI,CAAC;YACjE,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,OAAO,mBAAmB,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,OAAoB,EAAE,EAAE;gBAC9H,eAAe,CAAC,UAAU,CAAC,gBAAgB,GAAG,OAAO,CAAC;gBACtD,eAAe,CAAC,UAAU,CAAC,oBAAoB,GAAG,IAAI,CAAC;YAC3D,CAAC,CAAC,CAAC;SACN;aAAM;YACH,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC5B;IACL,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,oBAAoB,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 { 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 { IKHRMaterialsVolume } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_materials_volume\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume)\r\n * @since 5.0.0\r\n */\r\nexport class KHR_materials_volume 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 = 173;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n if (this.enabled) {\r\n // We need to disable instance usage because the attenuation factor depends on the node scale of each individual mesh\r\n this._loader._disableInstancedMesh++;\r\n }\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n if (this.enabled) {\r\n this._loader._disableInstancedMesh--;\r\n }\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonMaterial\r\n * @hidden\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsVolume>(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._loadVolumePropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadVolumePropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material, extension: IKHRMaterialsVolume): 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_translucency extensions.\r\n if ((!babylonMaterial.subSurface.isRefractionEnabled && !babylonMaterial.subSurface.isTranslucencyEnabled) || !extension.thicknessFactor) {\r\n return Promise.resolve();\r\n }\r\n\r\n // IOR in this extension only affects interior.\r\n babylonMaterial.subSurface.volumeIndexOfRefraction = babylonMaterial.indexOfRefraction;\r\n const attenuationDistance = extension.attenuationDistance !== undefined ? extension.attenuationDistance : Number.MAX_VALUE;\r\n babylonMaterial.subSurface.tintColorAtDistance = attenuationDistance;\r\n if (extension.attenuationColor !== undefined && extension.attenuationColor.length == 3) {\r\n babylonMaterial.subSurface.tintColor.copyFromFloats(extension.attenuationColor[0], extension.attenuationColor[1], extension.attenuationColor[2]);\r\n }\r\n\r\n babylonMaterial.subSurface.minimumThickness = 0.0;\r\n babylonMaterial.subSurface.maximumThickness = extension.thicknessFactor;\r\n babylonMaterial.subSurface.useThicknessAsDepth = true;\r\n if (extension.thicknessTexture) {\r\n (extension.thicknessTexture as ITextureInfo).nonColorData = true;\r\n return this._loader.loadTextureInfoAsync(`${context}/thicknessTexture`, extension.thicknessTexture).then((texture: BaseTexture) => {\r\n babylonMaterial.subSurface.thicknessTexture = texture;\r\n babylonMaterial.subSurface.useGltfStyleTextures = true;\r\n });\r\n } else {\r\n return Promise.resolve();\r\n }\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_volume(loader));\r\n"]}
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { GLTFLoader } from "../glTFLoader.js";
|
2
|
-
|
2
|
+
const NAME = "KHR_mesh_quantization";
|
3
3
|
/**
|
4
4
|
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization)
|
5
5
|
*/
|
6
|
-
|
6
|
+
export class KHR_mesh_quantization {
|
7
7
|
/**
|
8
8
|
* @param loader
|
9
9
|
* @hidden
|
10
10
|
*/
|
11
|
-
|
11
|
+
constructor(loader) {
|
12
12
|
/**
|
13
13
|
* The name of this extension.
|
14
14
|
*/
|
@@ -16,9 +16,7 @@ var KHR_mesh_quantization = /** @class */ (function () {
|
|
16
16
|
this.enabled = loader.isExtensionUsed(NAME);
|
17
17
|
}
|
18
18
|
/** @hidden */
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
export { KHR_mesh_quantization };
|
23
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_mesh_quantization(loader); });
|
19
|
+
dispose() { }
|
20
|
+
}
|
21
|
+
GLTFLoader.RegisterExtension(NAME, (loader) => new KHR_mesh_quantization(loader));
|
24
22
|
//# sourceMappingURL=KHR_mesh_quantization.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_mesh_quantization.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_mesh_quantization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,
|
1
|
+
{"version":3,"file":"KHR_mesh_quantization.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_mesh_quantization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAErC;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAW9B;;;OAGG;IACH,YAAY,MAAkB;QAd9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAYxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,cAAc;IACP,OAAO,KAAI,CAAC;CACtB;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\n\r\nconst NAME = \"KHR_mesh_quantization\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization)\r\n */\r\nexport class KHR_mesh_quantization 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 * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {}\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_mesh_quantization(loader));\r\n"]}
|
@@ -1,41 +1,38 @@
|
|
1
1
|
import { GLTFLoader, ArrayItem } from "../glTFLoader.js";
|
2
|
-
|
2
|
+
const NAME = "KHR_texture_basisu";
|
3
3
|
/**
|
4
4
|
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu)
|
5
5
|
*/
|
6
|
-
|
6
|
+
export class KHR_texture_basisu {
|
7
7
|
/**
|
8
8
|
* @param loader
|
9
9
|
* @hidden
|
10
10
|
*/
|
11
|
-
|
11
|
+
constructor(loader) {
|
12
12
|
/** The name of this extension. */
|
13
13
|
this.name = NAME;
|
14
14
|
this._loader = loader;
|
15
15
|
this.enabled = loader.isExtensionUsed(NAME);
|
16
16
|
}
|
17
17
|
/** @hidden */
|
18
|
-
|
18
|
+
dispose() {
|
19
19
|
this._loader = null;
|
20
|
-
}
|
20
|
+
}
|
21
21
|
/**
|
22
22
|
* @param context
|
23
23
|
* @param texture
|
24
24
|
* @param assign
|
25
25
|
* @hidden
|
26
26
|
*/
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
return _this._loader._createTextureAsync(context, sampler, image, function (babylonTexture) {
|
27
|
+
_loadTextureAsync(context, texture, assign) {
|
28
|
+
return GLTFLoader.LoadExtensionAsync(context, texture, this.name, (extensionContext, extension) => {
|
29
|
+
const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);
|
30
|
+
const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);
|
31
|
+
return this._loader._createTextureAsync(context, sampler, image, (babylonTexture) => {
|
33
32
|
assign(babylonTexture);
|
34
33
|
}, texture._textureInfo.nonColorData ? { useRGBAIfASTCBC7NotAvailableWhenUASTC: true } : undefined, !texture._textureInfo.nonColorData);
|
35
34
|
});
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
|
-
export { KHR_texture_basisu };
|
40
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_texture_basisu(loader); });
|
35
|
+
}
|
36
|
+
}
|
37
|
+
GLTFLoader.RegisterExtension(NAME, (loader) => new KHR_texture_basisu(loader));
|
41
38
|
//# sourceMappingURL=KHR_texture_basisu.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_texture_basisu.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_texture_basisu.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAMtD,
|
1
|
+
{"version":3,"file":"KHR_texture_basisu.js","sourceRoot":"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AC,EACD,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,qCAAqC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,EAC/F,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CACrC,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport type { ITexture } from \"../glTFLoaderInterfaces\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { IKHRTextureBasisU } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_texture_basisu\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu)\r\n */\r\nexport class KHR_texture_basisu implements IGLTFLoaderExtension {\r\n /** The name of this extension. */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled. */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param texture\r\n * @param assign\r\n * @hidden\r\n */\r\n public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRTextureBasisU, BaseTexture>(context, texture, this.name, (extensionContext, extension) => {\r\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);\r\n const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);\r\n return this._loader._createTextureAsync(\r\n context,\r\n sampler,\r\n image,\r\n (babylonTexture) => {\r\n assign(babylonTexture);\r\n },\r\n texture._textureInfo.nonColorData ? { useRGBAIfASTCBC7NotAvailableWhenUASTC: true } : undefined,\r\n !texture._textureInfo.nonColorData\r\n );\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_texture_basisu(loader));\r\n"]}
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
2
2
|
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
-
|
3
|
+
const NAME = "KHR_texture_transform";
|
4
4
|
/**
|
5
5
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform)
|
6
6
|
*/
|
7
|
-
|
7
|
+
export class KHR_texture_transform {
|
8
8
|
/**
|
9
9
|
* @param loader
|
10
10
|
* @hidden
|
11
11
|
*/
|
12
|
-
|
12
|
+
constructor(loader) {
|
13
13
|
/**
|
14
14
|
* The name of this extension.
|
15
15
|
*/
|
@@ -18,21 +18,20 @@ var KHR_texture_transform = /** @class */ (function () {
|
|
18
18
|
this.enabled = this._loader.isExtensionUsed(NAME);
|
19
19
|
}
|
20
20
|
/** @hidden */
|
21
|
-
|
21
|
+
dispose() {
|
22
22
|
this._loader = null;
|
23
|
-
}
|
23
|
+
}
|
24
24
|
/**
|
25
25
|
* @param context
|
26
26
|
* @param textureInfo
|
27
27
|
* @param assign
|
28
28
|
* @hidden
|
29
29
|
*/
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
return _this._loader.loadTextureInfoAsync(context, textureInfo, function (babylonTexture) {
|
30
|
+
loadTextureInfoAsync(context, textureInfo, assign) {
|
31
|
+
return GLTFLoader.LoadExtensionAsync(context, textureInfo, this.name, (extensionContext, extension) => {
|
32
|
+
return this._loader.loadTextureInfoAsync(context, textureInfo, (babylonTexture) => {
|
34
33
|
if (!(babylonTexture instanceof Texture)) {
|
35
|
-
throw new Error(
|
34
|
+
throw new Error(`${extensionContext}: Texture type not supported`);
|
36
35
|
}
|
37
36
|
if (extension.offset) {
|
38
37
|
babylonTexture.uOffset = extension.offset[0];
|
@@ -54,9 +53,7 @@ var KHR_texture_transform = /** @class */ (function () {
|
|
54
53
|
assign(babylonTexture);
|
55
54
|
});
|
56
55
|
});
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
export { KHR_texture_transform };
|
61
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_texture_transform(loader); });
|
56
|
+
}
|
57
|
+
}
|
58
|
+
GLTFLoader.RegisterExtension(NAME, (loader) => new KHR_texture_transform(loader));
|
62
59
|
//# sourceMappingURL=KHR_texture_transform.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_texture_transform.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_texture_transform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAI1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,
|
1
|
+
{"version":3,"file":"KHR_texture_transform.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_texture_transform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAI1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAErC;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAa9B;;;OAGG;IACH,YAAY,MAAkB;QAhB9B;;WAEG;QACa,SAAI,GAAG,IAAI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BAC9C;gBAED,IAAI,SAAS,CAAC,QAAQ,IAAI,SAAS,EAAE;oBACjC,cAAc,CAAC,gBAAgB,GAAG,SAAS,CAAC,QAAQ,CAAC;iBACxD;gBAED,MAAM,CAAC,cAAc,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\n\r\nimport type { ITextureInfo } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRTextureTransform } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_texture_transform\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform)\r\n */\r\nexport class KHR_texture_transform 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 private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param textureInfo\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRTextureTransform, BaseTexture>(context, textureInfo, this.name, (extensionContext, extension) => {\r\n return this._loader.loadTextureInfoAsync(context, textureInfo, (babylonTexture) => {\r\n if (!(babylonTexture instanceof Texture)) {\r\n throw new Error(`${extensionContext}: Texture type not supported`);\r\n }\r\n\r\n if (extension.offset) {\r\n babylonTexture.uOffset = extension.offset[0];\r\n babylonTexture.vOffset = extension.offset[1];\r\n }\r\n\r\n // Always rotate around the origin.\r\n babylonTexture.uRotationCenter = 0;\r\n babylonTexture.vRotationCenter = 0;\r\n\r\n if (extension.rotation) {\r\n babylonTexture.wAng = -extension.rotation;\r\n }\r\n\r\n if (extension.scale) {\r\n babylonTexture.uScale = extension.scale[0];\r\n babylonTexture.vScale = extension.scale[1];\r\n }\r\n\r\n if (extension.texCoord != undefined) {\r\n babylonTexture.coordinatesIndex = extension.texCoord;\r\n }\r\n\r\n assign(babylonTexture);\r\n });\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_texture_transform(loader));\r\n"]}
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { GLTFLoader } from "../glTFLoader.js";
|
2
|
-
|
2
|
+
const NAME = "KHR_xmp_json_ld";
|
3
3
|
/**
|
4
4
|
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_xmp_json_ld)
|
5
5
|
* @since 5.0.0
|
6
6
|
*/
|
7
|
-
|
7
|
+
export class KHR_xmp_json_ld {
|
8
8
|
/**
|
9
9
|
* @param loader
|
10
10
|
* @hidden
|
11
11
|
*/
|
12
|
-
|
12
|
+
constructor(loader) {
|
13
13
|
/**
|
14
14
|
* The name of this extension.
|
15
15
|
*/
|
@@ -22,29 +22,26 @@ var KHR_xmp_json_ld = /** @class */ (function () {
|
|
22
22
|
this.enabled = this._loader.isExtensionUsed(NAME);
|
23
23
|
}
|
24
24
|
/** @hidden */
|
25
|
-
|
25
|
+
dispose() {
|
26
26
|
this._loader = null;
|
27
|
-
}
|
27
|
+
}
|
28
28
|
/**
|
29
29
|
* Called after the loader state changes to LOADING.
|
30
30
|
*/
|
31
|
-
|
32
|
-
var _a, _b, _c;
|
31
|
+
onLoading() {
|
33
32
|
if (this._loader.rootBabylonMesh === null) {
|
34
33
|
return;
|
35
34
|
}
|
36
|
-
|
37
|
-
|
35
|
+
const xmp_gltf = this._loader.gltf.extensions?.KHR_xmp_json_ld;
|
36
|
+
const xmp_node = this._loader.gltf.asset?.extensions?.KHR_xmp_json_ld;
|
38
37
|
if (xmp_gltf && xmp_node) {
|
39
|
-
|
38
|
+
const packet = +xmp_node.packet;
|
40
39
|
if (xmp_gltf.packets && packet < xmp_gltf.packets.length) {
|
41
40
|
this._loader.rootBabylonMesh.metadata = this._loader.rootBabylonMesh.metadata || {};
|
42
41
|
this._loader.rootBabylonMesh.metadata.xmp = xmp_gltf.packets[packet];
|
43
42
|
}
|
44
43
|
}
|
45
|
-
}
|
46
|
-
|
47
|
-
|
48
|
-
export { KHR_xmp_json_ld };
|
49
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_xmp_json_ld(loader); });
|
44
|
+
}
|
45
|
+
}
|
46
|
+
GLTFLoader.RegisterExtension(NAME, (loader) => new KHR_xmp_json_ld(loader));
|
50
47
|
//# sourceMappingURL=KHR_xmp_json_ld.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_xmp_json_ld.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_xmp_json_ld.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,
|
1
|
+
{"version":3,"file":"KHR_xmp_json_ld.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_xmp_json_ld.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAA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AC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRXmpJsonLd_Gltf, IKHRXmpJsonLd_Node } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_xmp_json_ld\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_xmp_json_ld)\r\n * @since 5.0.0\r\n */\r\nexport class KHR_xmp_json_ld implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 100;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * Called after the loader state changes to LOADING.\r\n */\r\n public onLoading(): void {\r\n if (this._loader.rootBabylonMesh === null) {\r\n return;\r\n }\r\n\r\n const xmp_gltf = this._loader.gltf.extensions?.KHR_xmp_json_ld as IKHRXmpJsonLd_Gltf;\r\n const xmp_node = this._loader.gltf.asset?.extensions?.KHR_xmp_json_ld as IKHRXmpJsonLd_Node;\r\n if (xmp_gltf && xmp_node) {\r\n const packet = +xmp_node.packet;\r\n if (xmp_gltf.packets && packet < xmp_gltf.packets.length) {\r\n this._loader.rootBabylonMesh.metadata = this._loader.rootBabylonMesh.metadata || {};\r\n this._loader.rootBabylonMesh.metadata.xmp = xmp_gltf.packets[packet];\r\n }\r\n }\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_xmp_json_ld(loader));\r\n"]}
|