@babylonjs/loaders 5.0.0-rc.7 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.d.ts +4 -4
- package/OBJ/index.js +4 -4
- package/OBJ/mtlFileLoader.d.ts +41 -41
- package/OBJ/mtlFileLoader.js +232 -232
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +126 -126
- package/OBJ/objFileLoader.js +296 -296
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/OBJ/solidParser.d.ts +154 -154
- package/OBJ/solidParser.js +693 -693
- package/OBJ/solidParser.js.map +1 -1
- package/STL/index.d.ts +1 -1
- package/STL/index.js +1 -1
- package/STL/stlFileLoader.d.ts +64 -64
- package/STL/stlFileLoader.js +233 -233
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -60
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.d.ts +136 -136
- package/glTF/1.0/glTFLoader.js +1814 -1815
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.d.ts +63 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -250
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/1.0/index.d.ts +5 -5
- package/glTF/1.0/index.js +5 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -43
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -117
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -36
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -88
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -34
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -49
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -29
- package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -40
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -112
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -36
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -89
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -94
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -53
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -42
- package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -62
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -80
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -84
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -74
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -83
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -288
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -73
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -87
- package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -254
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -85
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -22
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -23
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -29
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -40
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -33
- package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -61
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -32
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -49
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -54
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -240
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -109
- package/glTF/2.0/Extensions/MSFT_lod.js +369 -369
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/index.d.ts +26 -26
- package/glTF/2.0/Extensions/index.js +26 -26
- package/glTF/2.0/glTFLoader.d.ts +406 -405
- package/glTF/2.0/glTFLoader.js +2366 -2366
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +5 -4
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +433 -433
- package/glTF/glTFFileLoader.js +927 -927
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -123
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +6 -5
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +15 -14
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -3
- package/legacy/legacy-glTF1FileLoader.js.map +1 -1
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +33 -32
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -3
- package/legacy/legacy-glTF2FileLoader.js.map +1 -1
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -4
- package/legacy/legacy-glTFFileLoader.js.map +1 -1
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +13 -12
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +13 -12
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +8 -7
- package/legacy/legacy.js.map +1 -1
- package/license.md +71 -0
- package/package.json +25 -6
@@ -1,84 +1,84 @@
|
|
1
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
|
-
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
-
var NAME = "KHR_materials_translucency";
|
4
|
-
/**
|
5
|
-
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)
|
6
|
-
* !!! Experimental Extension Subject to Changes !!!
|
7
|
-
*/
|
8
|
-
var KHR_materials_translucency = /** @class */ (function () {
|
9
|
-
/**
|
10
|
-
* @param loader
|
11
|
-
* @hidden
|
12
|
-
*/
|
13
|
-
function KHR_materials_translucency(loader) {
|
14
|
-
/**
|
15
|
-
* The name of this extension.
|
16
|
-
*/
|
17
|
-
this.name = NAME;
|
18
|
-
/**
|
19
|
-
* Defines a number that determines the order the extensions are applied.
|
20
|
-
*/
|
21
|
-
this.order = 174;
|
22
|
-
this._loader = loader;
|
23
|
-
this.enabled = this._loader.isExtensionUsed(NAME);
|
24
|
-
if (this.enabled) {
|
25
|
-
loader.parent.transparencyAsCoverage = true;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
/** @hidden */
|
29
|
-
KHR_materials_translucency.prototype.dispose = function () {
|
30
|
-
this._loader = null;
|
31
|
-
};
|
32
|
-
/**
|
33
|
-
* @param context
|
34
|
-
* @param material
|
35
|
-
* @param babylonMaterial
|
36
|
-
* @hidden
|
37
|
-
*/
|
38
|
-
KHR_materials_translucency.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
39
|
-
var _this = this;
|
40
|
-
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
41
|
-
var promises = new Array();
|
42
|
-
promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));
|
43
|
-
promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
|
44
|
-
promises.push(_this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));
|
45
|
-
return Promise.all(promises).then(function () { });
|
46
|
-
});
|
47
|
-
};
|
48
|
-
KHR_materials_translucency.prototype._loadTranslucentPropertiesAsync = function (context, material, babylonMaterial, extension) {
|
49
|
-
if (!(babylonMaterial instanceof PBRMaterial)) {
|
50
|
-
throw new Error("".concat(context, ": Material type not supported"));
|
51
|
-
}
|
52
|
-
var pbrMaterial = babylonMaterial;
|
53
|
-
// Enables "translucency" texture which represents diffusely-transmitted light.
|
54
|
-
pbrMaterial.subSurface.isTranslucencyEnabled = true;
|
55
|
-
// Since this extension models thin-surface transmission only, we must make the
|
56
|
-
// internal IOR == 1.0 and set the thickness to 0.
|
57
|
-
pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;
|
58
|
-
pbrMaterial.subSurface.minimumThickness = 0.0;
|
59
|
-
pbrMaterial.subSurface.maximumThickness = 0.0;
|
60
|
-
// Albedo colour will tint transmission.
|
61
|
-
pbrMaterial.subSurface.useAlbedoToTintTranslucency = true;
|
62
|
-
if (extension.translucencyFactor !== undefined) {
|
63
|
-
pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
pbrMaterial.subSurface.translucencyIntensity = 0.0;
|
67
|
-
pbrMaterial.subSurface.isTranslucencyEnabled = false;
|
68
|
-
return Promise.resolve();
|
69
|
-
}
|
70
|
-
if (extension.translucencyTexture) {
|
71
|
-
extension.translucencyTexture.nonColorData = true;
|
72
|
-
return this._loader.loadTextureInfoAsync("".concat(context, "/translucencyTexture"), extension.translucencyTexture).then(function (texture) {
|
73
|
-
pbrMaterial.subSurface.translucencyIntensityTexture = texture;
|
74
|
-
});
|
75
|
-
}
|
76
|
-
else {
|
77
|
-
return Promise.resolve();
|
78
|
-
}
|
79
|
-
};
|
80
|
-
return KHR_materials_translucency;
|
81
|
-
}());
|
82
|
-
export { KHR_materials_translucency };
|
83
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_translucency(loader); });
|
1
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
2
|
+
import { GLTFLoader } from "../glTFLoader.js";
|
3
|
+
var NAME = "KHR_materials_translucency";
|
4
|
+
/**
|
5
|
+
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)
|
6
|
+
* !!! Experimental Extension Subject to Changes !!!
|
7
|
+
*/
|
8
|
+
var KHR_materials_translucency = /** @class */ (function () {
|
9
|
+
/**
|
10
|
+
* @param loader
|
11
|
+
* @hidden
|
12
|
+
*/
|
13
|
+
function KHR_materials_translucency(loader) {
|
14
|
+
/**
|
15
|
+
* The name of this extension.
|
16
|
+
*/
|
17
|
+
this.name = NAME;
|
18
|
+
/**
|
19
|
+
* Defines a number that determines the order the extensions are applied.
|
20
|
+
*/
|
21
|
+
this.order = 174;
|
22
|
+
this._loader = loader;
|
23
|
+
this.enabled = this._loader.isExtensionUsed(NAME);
|
24
|
+
if (this.enabled) {
|
25
|
+
loader.parent.transparencyAsCoverage = true;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
/** @hidden */
|
29
|
+
KHR_materials_translucency.prototype.dispose = function () {
|
30
|
+
this._loader = null;
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* @param context
|
34
|
+
* @param material
|
35
|
+
* @param babylonMaterial
|
36
|
+
* @hidden
|
37
|
+
*/
|
38
|
+
KHR_materials_translucency.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
39
|
+
var _this = this;
|
40
|
+
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
41
|
+
var promises = new Array();
|
42
|
+
promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));
|
43
|
+
promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
|
44
|
+
promises.push(_this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));
|
45
|
+
return Promise.all(promises).then(function () { });
|
46
|
+
});
|
47
|
+
};
|
48
|
+
KHR_materials_translucency.prototype._loadTranslucentPropertiesAsync = function (context, material, babylonMaterial, extension) {
|
49
|
+
if (!(babylonMaterial instanceof PBRMaterial)) {
|
50
|
+
throw new Error("".concat(context, ": Material type not supported"));
|
51
|
+
}
|
52
|
+
var pbrMaterial = babylonMaterial;
|
53
|
+
// Enables "translucency" texture which represents diffusely-transmitted light.
|
54
|
+
pbrMaterial.subSurface.isTranslucencyEnabled = true;
|
55
|
+
// Since this extension models thin-surface transmission only, we must make the
|
56
|
+
// internal IOR == 1.0 and set the thickness to 0.
|
57
|
+
pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;
|
58
|
+
pbrMaterial.subSurface.minimumThickness = 0.0;
|
59
|
+
pbrMaterial.subSurface.maximumThickness = 0.0;
|
60
|
+
// Albedo colour will tint transmission.
|
61
|
+
pbrMaterial.subSurface.useAlbedoToTintTranslucency = true;
|
62
|
+
if (extension.translucencyFactor !== undefined) {
|
63
|
+
pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
pbrMaterial.subSurface.translucencyIntensity = 0.0;
|
67
|
+
pbrMaterial.subSurface.isTranslucencyEnabled = false;
|
68
|
+
return Promise.resolve();
|
69
|
+
}
|
70
|
+
if (extension.translucencyTexture) {
|
71
|
+
extension.translucencyTexture.nonColorData = true;
|
72
|
+
return this._loader.loadTextureInfoAsync("".concat(context, "/translucencyTexture"), extension.translucencyTexture).then(function (texture) {
|
73
|
+
pbrMaterial.subSurface.translucencyIntensityTexture = texture;
|
74
|
+
});
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
return Promise.resolve();
|
78
|
+
}
|
79
|
+
};
|
80
|
+
return KHR_materials_translucency;
|
81
|
+
}());
|
82
|
+
export { KHR_materials_translucency };
|
83
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_translucency(loader); });
|
84
84
|
//# sourceMappingURL=KHR_materials_translucency.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_translucency.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_translucency.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,4BAA4B,CAAC;AAE1C;;;GAGG;AACH;IAkBI;;;OAGG;IACH,oCAAY,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,MAAM,CAAC,MAAM,CAAC,sBAAsB,GAAG,IAAI,CAAC;SAC/C;IACL,CAAC;IAED,cAAc;IACP,4CAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,gEAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAQC;QAPG,OAAO,UAAU,CAAC,kBAAkB,CAA4B,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YACtH,IAAM,QAAQ,GAAG,IAAI,KAAK,EAAgB,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAChG,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,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C,CAAC,YAAY,GAAG,IAAI,CAAC;YACpE,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,UAAG,OAAO,yBAAsB,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,UAAC,OAAoB;gBAChI,WAAW,CAAC,UAAU,CAAC,4BAA4B,GAAG,OAAO,CAAC;YAClE,CAAC,CAAC,CAAC;SACN;aAAM;YACH,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC5B;IACL,CAAC;IACL,iCAAC;AAAD,CAAC,AAtFD,IAsFC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAtC,CAAsC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { IMaterial, ITextureInfo } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { IKHRMaterialsTranslucency } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_materials_translucency\";\r\n\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nexport class KHR_materials_translucency implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 174;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @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 loader.parent.transparencyAsCoverage = true;\r\n }\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 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<IKHRMaterialsTranslucency>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadTranslucentPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material, extension: IKHRMaterialsTranslucency): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n const pbrMaterial = babylonMaterial as PBRMaterial;\r\n\r\n // Enables \"translucency\" texture which represents diffusely-transmitted light.\r\n pbrMaterial.subSurface.isTranslucencyEnabled = true;\r\n\r\n // Since this extension models thin-surface transmission only, we must make the\r\n // internal IOR == 1.0 and set the thickness to 0.\r\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\r\n pbrMaterial.subSurface.minimumThickness = 0.0;\r\n pbrMaterial.subSurface.maximumThickness = 0.0;\r\n\r\n // Albedo colour will tint transmission.\r\n pbrMaterial.subSurface.useAlbedoToTintTranslucency = true;\r\n\r\n if (extension.translucencyFactor !== undefined) {\r\n pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;\r\n } else {\r\n pbrMaterial.subSurface.translucencyIntensity = 0.0;\r\n pbrMaterial.subSurface.isTranslucencyEnabled = false;\r\n return Promise.resolve();\r\n }\r\n\r\n if (extension.translucencyTexture) {\r\n (extension.translucencyTexture as ITextureInfo).nonColorData = true;\r\n return this._loader.loadTextureInfoAsync(`${context}/translucencyTexture`, extension.translucencyTexture).then((texture: BaseTexture) => {\r\n pbrMaterial.subSurface.translucencyIntensityTexture = texture;\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_translucency(loader));\r\n"]}
|
1
|
+
{"version":3,"file":"KHR_materials_translucency.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_translucency.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,4BAA4B,CAAC;AAE1C;;;GAGG;AACH;IAkBI;;;OAGG;IACH,oCAAY,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,MAAM,CAAC,MAAM,CAAC,sBAAsB,GAAG,IAAI,CAAC;SAC/C;IACL,CAAC;IAED,cAAc;IACP,4CAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,gEAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAQC;QAPG,OAAO,UAAU,CAAC,kBAAkB,CAA4B,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,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,qBAAqB,GAAG,SAAS,CAAC,kBAAkB,CAAC;SAC/E;aAAM;YACH,WAAW,CAAC,UAAU,CAAC,qBAAqB,GAAG,GAAG,CAAC;YACnD,WAAW,CAAC,UAAU,CAAC,qBAAqB,GAAG,KAAK,CAAC;YACrD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC5B;QAED,IAAI,SAAS,CAAC,mBAAmB,EAAE;YAC9B,SAAS,CAAC,mBAAoC,CAAC,YAAY,GAAG,IAAI,CAAC;YACpE,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,UAAG,OAAO,yBAAsB,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,UAAC,OAAoB;gBAChI,WAAW,CAAC,UAAU,CAAC,4BAA4B,GAAG,OAAO,CAAC;YAClE,CAAC,CAAC,CAAC;SACN;aAAM;YACH,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC5B;IACL,CAAC;IACL,iCAAC;AAAD,CAAC,AAtFD,IAsFC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAtC,CAAsC,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 { IKHRMaterialsTranslucency } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_materials_translucency\";\r\n\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nexport class KHR_materials_translucency implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 174;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @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 loader.parent.transparencyAsCoverage = true;\r\n }\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 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<IKHRMaterialsTranslucency>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadTranslucentPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material, extension: IKHRMaterialsTranslucency): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n const pbrMaterial = babylonMaterial as PBRMaterial;\r\n\r\n // Enables \"translucency\" texture which represents diffusely-transmitted light.\r\n pbrMaterial.subSurface.isTranslucencyEnabled = true;\r\n\r\n // Since this extension models thin-surface transmission only, we must make the\r\n // internal IOR == 1.0 and set the thickness to 0.\r\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\r\n pbrMaterial.subSurface.minimumThickness = 0.0;\r\n pbrMaterial.subSurface.maximumThickness = 0.0;\r\n\r\n // Albedo colour will tint transmission.\r\n pbrMaterial.subSurface.useAlbedoToTintTranslucency = true;\r\n\r\n if (extension.translucencyFactor !== undefined) {\r\n pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;\r\n } else {\r\n pbrMaterial.subSurface.translucencyIntensity = 0.0;\r\n pbrMaterial.subSurface.isTranslucencyEnabled = false;\r\n return Promise.resolve();\r\n }\r\n\r\n if (extension.translucencyTexture) {\r\n (extension.translucencyTexture as ITextureInfo).nonColorData = true;\r\n return this._loader.loadTextureInfoAsync(`${context}/translucencyTexture`, extension.translucencyTexture).then((texture: BaseTexture) => {\r\n pbrMaterial.subSurface.translucencyIntensityTexture = texture;\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_translucency(loader));\r\n"]}
|
@@ -1,38 +1,38 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
3
|
-
import { IMaterial } from "../glTFLoaderInterfaces";
|
4
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
-
import { GLTFLoader } from "../glTFLoader";
|
6
|
-
/**
|
7
|
-
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_transmission/README.md)
|
8
|
-
*/
|
9
|
-
export declare class KHR_materials_transmission implements IGLTFLoaderExtension {
|
10
|
-
/**
|
11
|
-
* The name of this extension.
|
12
|
-
*/
|
13
|
-
readonly name = "KHR_materials_transmission";
|
14
|
-
/**
|
15
|
-
* Defines whether this extension is enabled.
|
16
|
-
*/
|
17
|
-
enabled: boolean;
|
18
|
-
/**
|
19
|
-
* Defines a number that determines the order the extensions are applied.
|
20
|
-
*/
|
21
|
-
order: number;
|
22
|
-
private _loader;
|
23
|
-
/**
|
24
|
-
* @param loader
|
25
|
-
* @hidden
|
26
|
-
*/
|
27
|
-
constructor(loader: GLTFLoader);
|
28
|
-
/** @hidden */
|
29
|
-
dispose(): void;
|
30
|
-
/**
|
31
|
-
* @param context
|
32
|
-
* @param material
|
33
|
-
* @param babylonMaterial
|
34
|
-
* @hidden
|
35
|
-
*/
|
36
|
-
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
37
|
-
private _loadTransparentPropertiesAsync;
|
38
|
-
}
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { Material } from "@babylonjs/core/Materials/material.js";
|
3
|
+
import type { IMaterial } from "../glTFLoaderInterfaces";
|
4
|
+
import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
+
import { GLTFLoader } from "../glTFLoader";
|
6
|
+
/**
|
7
|
+
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_transmission/README.md)
|
8
|
+
*/
|
9
|
+
export declare class KHR_materials_transmission implements IGLTFLoaderExtension {
|
10
|
+
/**
|
11
|
+
* The name of this extension.
|
12
|
+
*/
|
13
|
+
readonly name = "KHR_materials_transmission";
|
14
|
+
/**
|
15
|
+
* Defines whether this extension is enabled.
|
16
|
+
*/
|
17
|
+
enabled: boolean;
|
18
|
+
/**
|
19
|
+
* Defines a number that determines the order the extensions are applied.
|
20
|
+
*/
|
21
|
+
order: number;
|
22
|
+
private _loader;
|
23
|
+
/**
|
24
|
+
* @param loader
|
25
|
+
* @hidden
|
26
|
+
*/
|
27
|
+
constructor(loader: GLTFLoader);
|
28
|
+
/** @hidden */
|
29
|
+
dispose(): void;
|
30
|
+
/**
|
31
|
+
* @param context
|
32
|
+
* @param material
|
33
|
+
* @param babylonMaterial
|
34
|
+
* @hidden
|
35
|
+
*/
|
36
|
+
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
37
|
+
private _loadTransparentPropertiesAsync;
|
38
|
+
}
|