@babylonjs/loaders 5.0.0-rc.5 → 5.0.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/objFileLoader.d.ts +126 -126
- package/OBJ/objFileLoader.js +296 -296
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/solidParser.d.ts +154 -154
- package/OBJ/solidParser.js +693 -693
- 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/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -60
- package/glTF/1.0/glTFLoader.d.ts +136 -136
- package/glTF/1.0/glTFLoader.js +1815 -1815
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderUtils.d.ts +62 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -250
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
- 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_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_meshopt_compression.d.ts +34 -34
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -49
- 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/ExtrasAsMetadata.d.ts +50 -50
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
- 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_lights_punctual.d.ts +36 -36
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -89
- 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_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_ior.d.ts +42 -42
- package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -62
- 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_sheen.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -84
- 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_translucency.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -83
- 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_unlit.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -73
- 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_volume.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -85
- 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_texture_basisu.d.ts +29 -29
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -40
- 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_xmp_json_ld.d.ts +32 -32
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -49
- 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_lod.d.ts +109 -109
- package/glTF/2.0/Extensions/MSFT_lod.js +369 -369
- 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_sRGBFactors.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
- 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 +405 -405
- package/glTF/2.0/glTFLoader.js +2366 -2366
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +4 -4
- package/glTF/glTFFileLoader.d.ts +433 -433
- package/glTF/glTFFileLoader.js +927 -927
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -123
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +5 -5
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +14 -14
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -3
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +32 -32
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -3
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -4
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +12 -12
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +12 -12
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +7 -7
- package/package.json +3 -3
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
2
|
-
import { GLTFLoader } from "../glTFLoader
|
|
3
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
|
-
var NAME = "KHR_materials_sheen";
|
|
5
|
-
/**
|
|
6
|
-
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_sheen/README.md)
|
|
7
|
-
* [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)
|
|
8
|
-
*/
|
|
9
|
-
var KHR_materials_sheen = /** @class */ (function () {
|
|
10
|
-
/**
|
|
11
|
-
* @param loader
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
function KHR_materials_sheen(loader) {
|
|
15
|
-
/**
|
|
16
|
-
* The name of this extension.
|
|
17
|
-
*/
|
|
18
|
-
this.name = NAME;
|
|
19
|
-
/**
|
|
20
|
-
* Defines a number that determines the order the extensions are applied.
|
|
21
|
-
*/
|
|
22
|
-
this.order = 190;
|
|
23
|
-
this._loader = loader;
|
|
24
|
-
this.enabled = this._loader.isExtensionUsed(NAME);
|
|
25
|
-
}
|
|
26
|
-
/** @hidden */
|
|
27
|
-
KHR_materials_sheen.prototype.dispose = function () {
|
|
28
|
-
this._loader = null;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* @param context
|
|
32
|
-
* @param material
|
|
33
|
-
* @param babylonMaterial
|
|
34
|
-
* @hidden
|
|
35
|
-
*/
|
|
36
|
-
KHR_materials_sheen.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
|
37
|
-
var _this = this;
|
|
38
|
-
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
|
39
|
-
var promises = new Array();
|
|
40
|
-
promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
|
|
41
|
-
promises.push(_this._loadSheenPropertiesAsync(extensionContext, extension, babylonMaterial));
|
|
42
|
-
return Promise.all(promises).then(function () { });
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
KHR_materials_sheen.prototype._loadSheenPropertiesAsync = function (context, properties, babylonMaterial) {
|
|
46
|
-
if (!(babylonMaterial instanceof PBRMaterial)) {
|
|
47
|
-
throw new Error("".concat(context, ": Material type not supported"));
|
|
48
|
-
}
|
|
49
|
-
var promises = new Array();
|
|
50
|
-
babylonMaterial.sheen.isEnabled = true;
|
|
51
|
-
babylonMaterial.sheen.intensity = 1;
|
|
52
|
-
if (properties.sheenColorFactor != undefined) {
|
|
53
|
-
babylonMaterial.sheen.color = Color3.FromArray(properties.sheenColorFactor);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
babylonMaterial.sheen.color = Color3.Black();
|
|
57
|
-
}
|
|
58
|
-
if (properties.sheenColorTexture) {
|
|
59
|
-
promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/sheenColorTexture"), properties.sheenColorTexture, function (texture) {
|
|
60
|
-
texture.name = "".concat(babylonMaterial.name, " (Sheen Color)");
|
|
61
|
-
babylonMaterial.sheen.texture = texture;
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
if (properties.sheenRoughnessFactor !== undefined) {
|
|
65
|
-
babylonMaterial.sheen.roughness = properties.sheenRoughnessFactor;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
babylonMaterial.sheen.roughness = 0;
|
|
69
|
-
}
|
|
70
|
-
if (properties.sheenRoughnessTexture) {
|
|
71
|
-
properties.sheenRoughnessTexture.nonColorData = true;
|
|
72
|
-
promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/sheenRoughnessTexture"), properties.sheenRoughnessTexture, function (texture) {
|
|
73
|
-
texture.name = "".concat(babylonMaterial.name, " (Sheen Roughness)");
|
|
74
|
-
babylonMaterial.sheen.textureRoughness = texture;
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
babylonMaterial.sheen.albedoScaling = true;
|
|
78
|
-
babylonMaterial.sheen.useRoughnessFromMainTexture = false;
|
|
79
|
-
return Promise.all(promises).then(function () { });
|
|
80
|
-
};
|
|
81
|
-
return KHR_materials_sheen;
|
|
82
|
-
}());
|
|
83
|
-
export { KHR_materials_sheen };
|
|
84
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_sheen(loader); });
|
|
1
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
2
|
+
import { GLTFLoader } from "../glTFLoader";
|
|
3
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
|
+
var NAME = "KHR_materials_sheen";
|
|
5
|
+
/**
|
|
6
|
+
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_sheen/README.md)
|
|
7
|
+
* [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)
|
|
8
|
+
*/
|
|
9
|
+
var KHR_materials_sheen = /** @class */ (function () {
|
|
10
|
+
/**
|
|
11
|
+
* @param loader
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
function KHR_materials_sheen(loader) {
|
|
15
|
+
/**
|
|
16
|
+
* The name of this extension.
|
|
17
|
+
*/
|
|
18
|
+
this.name = NAME;
|
|
19
|
+
/**
|
|
20
|
+
* Defines a number that determines the order the extensions are applied.
|
|
21
|
+
*/
|
|
22
|
+
this.order = 190;
|
|
23
|
+
this._loader = loader;
|
|
24
|
+
this.enabled = this._loader.isExtensionUsed(NAME);
|
|
25
|
+
}
|
|
26
|
+
/** @hidden */
|
|
27
|
+
KHR_materials_sheen.prototype.dispose = function () {
|
|
28
|
+
this._loader = null;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @param context
|
|
32
|
+
* @param material
|
|
33
|
+
* @param babylonMaterial
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
KHR_materials_sheen.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
|
37
|
+
var _this = this;
|
|
38
|
+
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
|
39
|
+
var promises = new Array();
|
|
40
|
+
promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
|
|
41
|
+
promises.push(_this._loadSheenPropertiesAsync(extensionContext, extension, babylonMaterial));
|
|
42
|
+
return Promise.all(promises).then(function () { });
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
KHR_materials_sheen.prototype._loadSheenPropertiesAsync = function (context, properties, babylonMaterial) {
|
|
46
|
+
if (!(babylonMaterial instanceof PBRMaterial)) {
|
|
47
|
+
throw new Error("".concat(context, ": Material type not supported"));
|
|
48
|
+
}
|
|
49
|
+
var promises = new Array();
|
|
50
|
+
babylonMaterial.sheen.isEnabled = true;
|
|
51
|
+
babylonMaterial.sheen.intensity = 1;
|
|
52
|
+
if (properties.sheenColorFactor != undefined) {
|
|
53
|
+
babylonMaterial.sheen.color = Color3.FromArray(properties.sheenColorFactor);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
babylonMaterial.sheen.color = Color3.Black();
|
|
57
|
+
}
|
|
58
|
+
if (properties.sheenColorTexture) {
|
|
59
|
+
promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/sheenColorTexture"), properties.sheenColorTexture, function (texture) {
|
|
60
|
+
texture.name = "".concat(babylonMaterial.name, " (Sheen Color)");
|
|
61
|
+
babylonMaterial.sheen.texture = texture;
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
if (properties.sheenRoughnessFactor !== undefined) {
|
|
65
|
+
babylonMaterial.sheen.roughness = properties.sheenRoughnessFactor;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
babylonMaterial.sheen.roughness = 0;
|
|
69
|
+
}
|
|
70
|
+
if (properties.sheenRoughnessTexture) {
|
|
71
|
+
properties.sheenRoughnessTexture.nonColorData = true;
|
|
72
|
+
promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/sheenRoughnessTexture"), properties.sheenRoughnessTexture, function (texture) {
|
|
73
|
+
texture.name = "".concat(babylonMaterial.name, " (Sheen Roughness)");
|
|
74
|
+
babylonMaterial.sheen.textureRoughness = texture;
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
babylonMaterial.sheen.albedoScaling = true;
|
|
78
|
+
babylonMaterial.sheen.useRoughnessFromMainTexture = false;
|
|
79
|
+
return Promise.all(promises).then(function () { });
|
|
80
|
+
};
|
|
81
|
+
return KHR_materials_sheen;
|
|
82
|
+
}());
|
|
83
|
+
export { KHR_materials_sheen };
|
|
84
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_sheen(loader); });
|
|
85
85
|
//# sourceMappingURL=KHR_materials_sheen.js.map
|
|
@@ -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/tree/master/extensions/2.0/Khronos/KHR_materials_specular)
|
|
8
|
-
*/
|
|
9
|
-
export declare class KHR_materials_specular implements IGLTFLoaderExtension {
|
|
10
|
-
/**
|
|
11
|
-
* The name of this extension.
|
|
12
|
-
*/
|
|
13
|
-
readonly name = "KHR_materials_specular";
|
|
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 _loadSpecularPropertiesAsync;
|
|
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/tree/master/extensions/2.0/Khronos/KHR_materials_specular)
|
|
8
|
+
*/
|
|
9
|
+
export declare class KHR_materials_specular implements IGLTFLoaderExtension {
|
|
10
|
+
/**
|
|
11
|
+
* The name of this extension.
|
|
12
|
+
*/
|
|
13
|
+
readonly name = "KHR_materials_specular";
|
|
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 _loadSpecularPropertiesAsync;
|
|
38
|
+
}
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
2
|
-
import { GLTFLoader } from "../glTFLoader
|
|
3
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
|
-
var NAME = "KHR_materials_specular";
|
|
5
|
-
/**
|
|
6
|
-
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular)
|
|
7
|
-
*/
|
|
8
|
-
var KHR_materials_specular = /** @class */ (function () {
|
|
9
|
-
/**
|
|
10
|
-
* @param loader
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
function KHR_materials_specular(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 = 190;
|
|
22
|
-
this._loader = loader;
|
|
23
|
-
this.enabled = this._loader.isExtensionUsed(NAME);
|
|
24
|
-
}
|
|
25
|
-
/** @hidden */
|
|
26
|
-
KHR_materials_specular.prototype.dispose = function () {
|
|
27
|
-
this._loader = null;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* @param context
|
|
31
|
-
* @param material
|
|
32
|
-
* @param babylonMaterial
|
|
33
|
-
* @hidden
|
|
34
|
-
*/
|
|
35
|
-
KHR_materials_specular.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
|
36
|
-
var _this = this;
|
|
37
|
-
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
|
38
|
-
var promises = new Array();
|
|
39
|
-
promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
|
|
40
|
-
promises.push(_this._loadSpecularPropertiesAsync(extensionContext, extension, babylonMaterial));
|
|
41
|
-
return Promise.all(promises).then(function () { });
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
KHR_materials_specular.prototype._loadSpecularPropertiesAsync = function (context, properties, babylonMaterial) {
|
|
45
|
-
if (!(babylonMaterial instanceof PBRMaterial)) {
|
|
46
|
-
throw new Error("".concat(context, ": Material type not supported"));
|
|
47
|
-
}
|
|
48
|
-
var promises = new Array();
|
|
49
|
-
if (properties.specularFactor !== undefined) {
|
|
50
|
-
babylonMaterial.metallicF0Factor = properties.specularFactor;
|
|
51
|
-
}
|
|
52
|
-
if (properties.specularColorFactor !== undefined) {
|
|
53
|
-
babylonMaterial.metallicReflectanceColor = Color3.FromArray(properties.specularColorFactor);
|
|
54
|
-
}
|
|
55
|
-
if (properties.specularTexture) {
|
|
56
|
-
properties.specularTexture.nonColorData = true;
|
|
57
|
-
promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/specularTexture"), properties.specularTexture, function (texture) {
|
|
58
|
-
texture.name = "".concat(babylonMaterial.name, " (Specular F0 Strength)");
|
|
59
|
-
babylonMaterial.metallicReflectanceTexture = texture;
|
|
60
|
-
babylonMaterial.useOnlyMetallicFromMetallicReflectanceTexture = true;
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
if (properties.specularColorTexture) {
|
|
64
|
-
promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/specularColorTexture"), properties.specularColorTexture, function (texture) {
|
|
65
|
-
texture.name = "".concat(babylonMaterial.name, " (Specular F0 Color)");
|
|
66
|
-
babylonMaterial.reflectanceTexture = texture;
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
return Promise.all(promises).then(function () { });
|
|
70
|
-
};
|
|
71
|
-
return KHR_materials_specular;
|
|
72
|
-
}());
|
|
73
|
-
export { KHR_materials_specular };
|
|
74
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_specular(loader); });
|
|
1
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
2
|
+
import { GLTFLoader } from "../glTFLoader";
|
|
3
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
|
+
var NAME = "KHR_materials_specular";
|
|
5
|
+
/**
|
|
6
|
+
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular)
|
|
7
|
+
*/
|
|
8
|
+
var KHR_materials_specular = /** @class */ (function () {
|
|
9
|
+
/**
|
|
10
|
+
* @param loader
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
function KHR_materials_specular(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 = 190;
|
|
22
|
+
this._loader = loader;
|
|
23
|
+
this.enabled = this._loader.isExtensionUsed(NAME);
|
|
24
|
+
}
|
|
25
|
+
/** @hidden */
|
|
26
|
+
KHR_materials_specular.prototype.dispose = function () {
|
|
27
|
+
this._loader = null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @param context
|
|
31
|
+
* @param material
|
|
32
|
+
* @param babylonMaterial
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
KHR_materials_specular.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
|
36
|
+
var _this = this;
|
|
37
|
+
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
|
38
|
+
var promises = new Array();
|
|
39
|
+
promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
|
|
40
|
+
promises.push(_this._loadSpecularPropertiesAsync(extensionContext, extension, babylonMaterial));
|
|
41
|
+
return Promise.all(promises).then(function () { });
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
KHR_materials_specular.prototype._loadSpecularPropertiesAsync = function (context, properties, babylonMaterial) {
|
|
45
|
+
if (!(babylonMaterial instanceof PBRMaterial)) {
|
|
46
|
+
throw new Error("".concat(context, ": Material type not supported"));
|
|
47
|
+
}
|
|
48
|
+
var promises = new Array();
|
|
49
|
+
if (properties.specularFactor !== undefined) {
|
|
50
|
+
babylonMaterial.metallicF0Factor = properties.specularFactor;
|
|
51
|
+
}
|
|
52
|
+
if (properties.specularColorFactor !== undefined) {
|
|
53
|
+
babylonMaterial.metallicReflectanceColor = Color3.FromArray(properties.specularColorFactor);
|
|
54
|
+
}
|
|
55
|
+
if (properties.specularTexture) {
|
|
56
|
+
properties.specularTexture.nonColorData = true;
|
|
57
|
+
promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/specularTexture"), properties.specularTexture, function (texture) {
|
|
58
|
+
texture.name = "".concat(babylonMaterial.name, " (Specular F0 Strength)");
|
|
59
|
+
babylonMaterial.metallicReflectanceTexture = texture;
|
|
60
|
+
babylonMaterial.useOnlyMetallicFromMetallicReflectanceTexture = true;
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
if (properties.specularColorTexture) {
|
|
64
|
+
promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/specularColorTexture"), properties.specularColorTexture, function (texture) {
|
|
65
|
+
texture.name = "".concat(babylonMaterial.name, " (Specular F0 Color)");
|
|
66
|
+
babylonMaterial.reflectanceTexture = texture;
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
return Promise.all(promises).then(function () { });
|
|
70
|
+
};
|
|
71
|
+
return KHR_materials_specular;
|
|
72
|
+
}());
|
|
73
|
+
export { KHR_materials_specular };
|
|
74
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_specular(loader); });
|
|
75
75
|
//# sourceMappingURL=KHR_materials_specular.js.map
|
|
@@ -1,39 +1,39 @@
|
|
|
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
|
-
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)
|
|
8
|
-
* !!! Experimental Extension Subject to Changes !!!
|
|
9
|
-
*/
|
|
10
|
-
export declare class KHR_materials_translucency implements IGLTFLoaderExtension {
|
|
11
|
-
/**
|
|
12
|
-
* The name of this extension.
|
|
13
|
-
*/
|
|
14
|
-
readonly name = "KHR_materials_translucency";
|
|
15
|
-
/**
|
|
16
|
-
* Defines whether this extension is enabled.
|
|
17
|
-
*/
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Defines a number that determines the order the extensions are applied.
|
|
21
|
-
*/
|
|
22
|
-
order: number;
|
|
23
|
-
private _loader;
|
|
24
|
-
/**
|
|
25
|
-
* @param loader
|
|
26
|
-
* @hidden
|
|
27
|
-
*/
|
|
28
|
-
constructor(loader: GLTFLoader);
|
|
29
|
-
/** @hidden */
|
|
30
|
-
dispose(): void;
|
|
31
|
-
/**
|
|
32
|
-
* @param context
|
|
33
|
-
* @param material
|
|
34
|
-
* @param babylonMaterial
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
|
38
|
-
private _loadTranslucentPropertiesAsync;
|
|
39
|
-
}
|
|
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
|
+
* [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)
|
|
8
|
+
* !!! Experimental Extension Subject to Changes !!!
|
|
9
|
+
*/
|
|
10
|
+
export declare class KHR_materials_translucency implements IGLTFLoaderExtension {
|
|
11
|
+
/**
|
|
12
|
+
* The name of this extension.
|
|
13
|
+
*/
|
|
14
|
+
readonly name = "KHR_materials_translucency";
|
|
15
|
+
/**
|
|
16
|
+
* Defines whether this extension is enabled.
|
|
17
|
+
*/
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Defines a number that determines the order the extensions are applied.
|
|
21
|
+
*/
|
|
22
|
+
order: number;
|
|
23
|
+
private _loader;
|
|
24
|
+
/**
|
|
25
|
+
* @param loader
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
constructor(loader: GLTFLoader);
|
|
29
|
+
/** @hidden */
|
|
30
|
+
dispose(): void;
|
|
31
|
+
/**
|
|
32
|
+
* @param context
|
|
33
|
+
* @param material
|
|
34
|
+
* @param babylonMaterial
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
|
38
|
+
private _loadTranslucentPropertiesAsync;
|
|
39
|
+
}
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
2
|
-
import { GLTFLoader } from "../glTFLoader
|
|
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";
|
|
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
|