@babylonjs/loaders 5.0.0-rc.7 → 5.0.0-rc.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. package/OBJ/index.d.ts +4 -4
  2. package/OBJ/index.js +4 -4
  3. package/OBJ/mtlFileLoader.d.ts +41 -41
  4. package/OBJ/mtlFileLoader.js +232 -232
  5. package/OBJ/objFileLoader.d.ts +126 -126
  6. package/OBJ/objFileLoader.js +296 -296
  7. package/OBJ/objLoadingOptions.d.ts +43 -43
  8. package/OBJ/objLoadingOptions.js +1 -1
  9. package/OBJ/solidParser.d.ts +154 -154
  10. package/OBJ/solidParser.js +693 -693
  11. package/STL/index.d.ts +1 -1
  12. package/STL/index.js +1 -1
  13. package/STL/stlFileLoader.d.ts +64 -64
  14. package/STL/stlFileLoader.js +233 -233
  15. package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
  16. package/glTF/1.0/glTFBinaryExtension.js +60 -60
  17. package/glTF/1.0/glTFLoader.d.ts +136 -136
  18. package/glTF/1.0/glTFLoader.js +1815 -1815
  19. package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
  20. package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
  21. package/glTF/1.0/glTFLoaderUtils.d.ts +62 -62
  22. package/glTF/1.0/glTFLoaderUtils.js +250 -250
  23. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
  24. package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
  25. package/glTF/1.0/index.d.ts +5 -5
  26. package/glTF/1.0/index.js +5 -5
  27. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -43
  28. package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -117
  29. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -36
  30. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -88
  31. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -34
  32. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -49
  33. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -29
  34. package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -40
  35. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
  36. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
  37. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -39
  38. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -112
  39. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -36
  40. package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -89
  41. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -39
  42. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -94
  43. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -38
  44. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -53
  45. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -42
  46. package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -62
  47. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -38
  48. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -80
  49. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -39
  50. package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -84
  51. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -38
  52. package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -74
  53. package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -39
  54. package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -83
  55. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -38
  56. package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -288
  57. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -38
  58. package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -73
  59. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -87
  60. package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -254
  61. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -39
  62. package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -85
  63. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -22
  64. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -23
  65. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -29
  66. package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -40
  67. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -33
  68. package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -61
  69. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -32
  70. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -49
  71. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -54
  72. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -240
  73. package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -109
  74. package/glTF/2.0/Extensions/MSFT_lod.js +369 -369
  75. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
  76. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
  77. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
  78. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
  79. package/glTF/2.0/Extensions/index.d.ts +26 -26
  80. package/glTF/2.0/Extensions/index.js +26 -26
  81. package/glTF/2.0/glTFLoader.d.ts +405 -405
  82. package/glTF/2.0/glTFLoader.js +2366 -2366
  83. package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
  84. package/glTF/2.0/glTFLoaderExtension.js +1 -1
  85. package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
  86. package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
  87. package/glTF/2.0/index.d.ts +4 -4
  88. package/glTF/2.0/index.js +4 -4
  89. package/glTF/glTFFileLoader.d.ts +433 -433
  90. package/glTF/glTFFileLoader.js +927 -927
  91. package/glTF/glTFValidation.d.ts +29 -29
  92. package/glTF/glTFValidation.js +123 -123
  93. package/glTF/index.d.ts +5 -5
  94. package/glTF/index.js +5 -5
  95. package/index.d.ts +3 -3
  96. package/index.js +3 -3
  97. package/legacy/legacy-glTF.d.ts +2 -2
  98. package/legacy/legacy-glTF.js +18 -18
  99. package/legacy/legacy-glTF1.d.ts +2 -2
  100. package/legacy/legacy-glTF1.js +14 -14
  101. package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
  102. package/legacy/legacy-glTF1FileLoader.js +3 -3
  103. package/legacy/legacy-glTF2.d.ts +2 -2
  104. package/legacy/legacy-glTF2.js +32 -32
  105. package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
  106. package/legacy/legacy-glTF2FileLoader.js +3 -3
  107. package/legacy/legacy-glTFFileLoader.d.ts +3 -3
  108. package/legacy/legacy-glTFFileLoader.js +4 -4
  109. package/legacy/legacy-objFileLoader.d.ts +1 -1
  110. package/legacy/legacy-objFileLoader.js +12 -12
  111. package/legacy/legacy-stlFileLoader.d.ts +1 -1
  112. package/legacy/legacy-stlFileLoader.js +12 -12
  113. package/legacy/legacy.d.ts +6 -6
  114. package/legacy/legacy.js +7 -7
  115. package/package.json +3 -3
@@ -1,90 +1,90 @@
1
- import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
- import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
4
- import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
5
- import { SpotLight } from "@babylonjs/core/Lights/spotLight.js";
6
- import { Light } from "@babylonjs/core/Lights/light.js";
7
- import { GLTFLoader, ArrayItem } from "../glTFLoader.js";
8
- var NAME = "KHR_lights_punctual";
9
- /**
10
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)
11
- */
12
- var KHR_lights = /** @class */ (function () {
13
- /**
14
- * @param loader
15
- * @hidden
16
- */
17
- function KHR_lights(loader) {
18
- /**
19
- * The name of this extension.
20
- */
21
- this.name = NAME;
22
- this._loader = loader;
23
- this.enabled = this._loader.isExtensionUsed(NAME);
24
- }
25
- /** @hidden */
26
- KHR_lights.prototype.dispose = function () {
27
- this._loader = null;
28
- delete this._lights;
29
- };
30
- /** @hidden */
31
- KHR_lights.prototype.onLoading = function () {
32
- var extensions = this._loader.gltf.extensions;
33
- if (extensions && extensions[this.name]) {
34
- var extension = extensions[this.name];
35
- this._lights = extension.lights;
36
- }
37
- };
38
- /**
39
- * @param context
40
- * @param node
41
- * @param assign
42
- * @hidden
43
- */
44
- KHR_lights.prototype.loadNodeAsync = function (context, node, assign) {
45
- var _this = this;
46
- return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {
47
- return _this._loader.loadNodeAsync(context, node, function (babylonMesh) {
48
- var babylonLight;
49
- var light = ArrayItem.Get(extensionContext, _this._lights, extension.light);
50
- var name = light.name || babylonMesh.name;
51
- _this._loader.babylonScene._blockEntityCollection = !!_this._loader._assetContainer;
52
- switch (light.type) {
53
- case "directional" /* DIRECTIONAL */: {
54
- babylonLight = new DirectionalLight(name, Vector3.Backward(), _this._loader.babylonScene);
55
- break;
56
- }
57
- case "point" /* POINT */: {
58
- babylonLight = new PointLight(name, Vector3.Zero(), _this._loader.babylonScene);
59
- break;
60
- }
61
- case "spot" /* SPOT */: {
62
- var babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, _this._loader.babylonScene);
63
- babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;
64
- babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;
65
- babylonLight = babylonSpotLight;
66
- break;
67
- }
68
- default: {
69
- _this._loader.babylonScene._blockEntityCollection = false;
70
- throw new Error("".concat(extensionContext, ": Invalid light type (").concat(light.type, ")"));
71
- }
72
- }
73
- babylonLight._parentContainer = _this._loader._assetContainer;
74
- _this._loader.babylonScene._blockEntityCollection = false;
75
- babylonLight.falloffType = Light.FALLOFF_GLTF;
76
- babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();
77
- babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;
78
- babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;
79
- babylonLight.parent = babylonMesh;
80
- _this._loader._babylonLights.push(babylonLight);
81
- GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);
82
- assign(babylonMesh);
83
- });
84
- });
85
- };
86
- return KHR_lights;
87
- }());
88
- export { KHR_lights };
89
- GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_lights(loader); });
1
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
+ import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
4
+ import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
5
+ import { SpotLight } from "@babylonjs/core/Lights/spotLight.js";
6
+ import { Light } from "@babylonjs/core/Lights/light.js";
7
+ import { GLTFLoader, ArrayItem } from "../glTFLoader";
8
+ var NAME = "KHR_lights_punctual";
9
+ /**
10
+ * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)
11
+ */
12
+ var KHR_lights = /** @class */ (function () {
13
+ /**
14
+ * @param loader
15
+ * @hidden
16
+ */
17
+ function KHR_lights(loader) {
18
+ /**
19
+ * The name of this extension.
20
+ */
21
+ this.name = NAME;
22
+ this._loader = loader;
23
+ this.enabled = this._loader.isExtensionUsed(NAME);
24
+ }
25
+ /** @hidden */
26
+ KHR_lights.prototype.dispose = function () {
27
+ this._loader = null;
28
+ delete this._lights;
29
+ };
30
+ /** @hidden */
31
+ KHR_lights.prototype.onLoading = function () {
32
+ var extensions = this._loader.gltf.extensions;
33
+ if (extensions && extensions[this.name]) {
34
+ var extension = extensions[this.name];
35
+ this._lights = extension.lights;
36
+ }
37
+ };
38
+ /**
39
+ * @param context
40
+ * @param node
41
+ * @param assign
42
+ * @hidden
43
+ */
44
+ KHR_lights.prototype.loadNodeAsync = function (context, node, assign) {
45
+ var _this = this;
46
+ return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {
47
+ return _this._loader.loadNodeAsync(context, node, function (babylonMesh) {
48
+ var babylonLight;
49
+ var light = ArrayItem.Get(extensionContext, _this._lights, extension.light);
50
+ var name = light.name || babylonMesh.name;
51
+ _this._loader.babylonScene._blockEntityCollection = !!_this._loader._assetContainer;
52
+ switch (light.type) {
53
+ case "directional" /* DIRECTIONAL */: {
54
+ babylonLight = new DirectionalLight(name, Vector3.Backward(), _this._loader.babylonScene);
55
+ break;
56
+ }
57
+ case "point" /* POINT */: {
58
+ babylonLight = new PointLight(name, Vector3.Zero(), _this._loader.babylonScene);
59
+ break;
60
+ }
61
+ case "spot" /* SPOT */: {
62
+ var babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, _this._loader.babylonScene);
63
+ babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;
64
+ babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;
65
+ babylonLight = babylonSpotLight;
66
+ break;
67
+ }
68
+ default: {
69
+ _this._loader.babylonScene._blockEntityCollection = false;
70
+ throw new Error("".concat(extensionContext, ": Invalid light type (").concat(light.type, ")"));
71
+ }
72
+ }
73
+ babylonLight._parentContainer = _this._loader._assetContainer;
74
+ _this._loader.babylonScene._blockEntityCollection = false;
75
+ babylonLight.falloffType = Light.FALLOFF_GLTF;
76
+ babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();
77
+ babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;
78
+ babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;
79
+ babylonLight.parent = babylonMesh;
80
+ _this._loader._babylonLights.push(babylonLight);
81
+ GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);
82
+ assign(babylonMesh);
83
+ });
84
+ });
85
+ };
86
+ return KHR_lights;
87
+ }());
88
+ export { KHR_lights };
89
+ GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_lights(loader); });
90
90
  //# sourceMappingURL=KHR_lights_punctual.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
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)
8
- * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)
9
- */
10
- export declare class KHR_materials_clearcoat implements IGLTFLoaderExtension {
11
- /**
12
- * The name of this extension.
13
- */
14
- readonly name = "KHR_materials_clearcoat";
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 _loadClearCoatPropertiesAsync;
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
+ * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)
8
+ * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)
9
+ */
10
+ export declare class KHR_materials_clearcoat implements IGLTFLoaderExtension {
11
+ /**
12
+ * The name of this extension.
13
+ */
14
+ readonly name = "KHR_materials_clearcoat";
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 _loadClearCoatPropertiesAsync;
39
+ }
@@ -1,95 +1,95 @@
1
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
- import { GLTFLoader } from "../glTFLoader.js";
3
- var NAME = "KHR_materials_clearcoat";
4
- /**
5
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)
6
- * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)
7
- */
8
- var KHR_materials_clearcoat = /** @class */ (function () {
9
- /**
10
- * @param loader
11
- * @hidden
12
- */
13
- function KHR_materials_clearcoat(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_clearcoat.prototype.dispose = function () {
27
- this._loader = null;
28
- };
29
- /**
30
- * @param context
31
- * @param material
32
- * @param babylonMaterial
33
- * @hidden
34
- */
35
- KHR_materials_clearcoat.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._loadClearCoatPropertiesAsync(extensionContext, extension, babylonMaterial));
41
- return Promise.all(promises).then(function () { });
42
- });
43
- };
44
- KHR_materials_clearcoat.prototype._loadClearCoatPropertiesAsync = 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
- babylonMaterial.clearCoat.isEnabled = true;
50
- babylonMaterial.clearCoat.useRoughnessFromMainTexture = false;
51
- babylonMaterial.clearCoat.remapF0OnInterfaceChange = false;
52
- if (properties.clearcoatFactor != undefined) {
53
- babylonMaterial.clearCoat.intensity = properties.clearcoatFactor;
54
- }
55
- else {
56
- babylonMaterial.clearCoat.intensity = 0;
57
- }
58
- if (properties.clearcoatTexture) {
59
- promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/clearcoatTexture"), properties.clearcoatTexture, function (texture) {
60
- texture.name = "".concat(babylonMaterial.name, " (ClearCoat Intensity)");
61
- babylonMaterial.clearCoat.texture = texture;
62
- }));
63
- }
64
- if (properties.clearcoatRoughnessFactor != undefined) {
65
- babylonMaterial.clearCoat.roughness = properties.clearcoatRoughnessFactor;
66
- }
67
- else {
68
- babylonMaterial.clearCoat.roughness = 0;
69
- }
70
- if (properties.clearcoatRoughnessTexture) {
71
- properties.clearcoatRoughnessTexture.nonColorData = true;
72
- promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/clearcoatRoughnessTexture"), properties.clearcoatRoughnessTexture, function (texture) {
73
- texture.name = "".concat(babylonMaterial.name, " (ClearCoat Roughness)");
74
- babylonMaterial.clearCoat.textureRoughness = texture;
75
- }));
76
- }
77
- if (properties.clearcoatNormalTexture) {
78
- properties.clearcoatNormalTexture.nonColorData = true;
79
- promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/clearcoatNormalTexture"), properties.clearcoatNormalTexture, function (texture) {
80
- texture.name = "".concat(babylonMaterial.name, " (ClearCoat Normal)");
81
- babylonMaterial.clearCoat.bumpTexture = texture;
82
- }));
83
- babylonMaterial.invertNormalMapX = !babylonMaterial.getScene().useRightHandedSystem;
84
- babylonMaterial.invertNormalMapY = babylonMaterial.getScene().useRightHandedSystem;
85
- if (properties.clearcoatNormalTexture.scale != undefined) {
86
- babylonMaterial.clearCoat.bumpTexture.level = properties.clearcoatNormalTexture.scale;
87
- }
88
- }
89
- return Promise.all(promises).then(function () { });
90
- };
91
- return KHR_materials_clearcoat;
92
- }());
93
- export { KHR_materials_clearcoat };
94
- GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_clearcoat(loader); });
1
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
+ import { GLTFLoader } from "../glTFLoader";
3
+ var NAME = "KHR_materials_clearcoat";
4
+ /**
5
+ * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)
6
+ * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)
7
+ */
8
+ var KHR_materials_clearcoat = /** @class */ (function () {
9
+ /**
10
+ * @param loader
11
+ * @hidden
12
+ */
13
+ function KHR_materials_clearcoat(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_clearcoat.prototype.dispose = function () {
27
+ this._loader = null;
28
+ };
29
+ /**
30
+ * @param context
31
+ * @param material
32
+ * @param babylonMaterial
33
+ * @hidden
34
+ */
35
+ KHR_materials_clearcoat.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._loadClearCoatPropertiesAsync(extensionContext, extension, babylonMaterial));
41
+ return Promise.all(promises).then(function () { });
42
+ });
43
+ };
44
+ KHR_materials_clearcoat.prototype._loadClearCoatPropertiesAsync = 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
+ babylonMaterial.clearCoat.isEnabled = true;
50
+ babylonMaterial.clearCoat.useRoughnessFromMainTexture = false;
51
+ babylonMaterial.clearCoat.remapF0OnInterfaceChange = false;
52
+ if (properties.clearcoatFactor != undefined) {
53
+ babylonMaterial.clearCoat.intensity = properties.clearcoatFactor;
54
+ }
55
+ else {
56
+ babylonMaterial.clearCoat.intensity = 0;
57
+ }
58
+ if (properties.clearcoatTexture) {
59
+ promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/clearcoatTexture"), properties.clearcoatTexture, function (texture) {
60
+ texture.name = "".concat(babylonMaterial.name, " (ClearCoat Intensity)");
61
+ babylonMaterial.clearCoat.texture = texture;
62
+ }));
63
+ }
64
+ if (properties.clearcoatRoughnessFactor != undefined) {
65
+ babylonMaterial.clearCoat.roughness = properties.clearcoatRoughnessFactor;
66
+ }
67
+ else {
68
+ babylonMaterial.clearCoat.roughness = 0;
69
+ }
70
+ if (properties.clearcoatRoughnessTexture) {
71
+ properties.clearcoatRoughnessTexture.nonColorData = true;
72
+ promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/clearcoatRoughnessTexture"), properties.clearcoatRoughnessTexture, function (texture) {
73
+ texture.name = "".concat(babylonMaterial.name, " (ClearCoat Roughness)");
74
+ babylonMaterial.clearCoat.textureRoughness = texture;
75
+ }));
76
+ }
77
+ if (properties.clearcoatNormalTexture) {
78
+ properties.clearcoatNormalTexture.nonColorData = true;
79
+ promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/clearcoatNormalTexture"), properties.clearcoatNormalTexture, function (texture) {
80
+ texture.name = "".concat(babylonMaterial.name, " (ClearCoat Normal)");
81
+ babylonMaterial.clearCoat.bumpTexture = texture;
82
+ }));
83
+ babylonMaterial.invertNormalMapX = !babylonMaterial.getScene().useRightHandedSystem;
84
+ babylonMaterial.invertNormalMapY = babylonMaterial.getScene().useRightHandedSystem;
85
+ if (properties.clearcoatNormalTexture.scale != undefined) {
86
+ babylonMaterial.clearCoat.bumpTexture.level = properties.clearcoatNormalTexture.scale;
87
+ }
88
+ }
89
+ return Promise.all(promises).then(function () { });
90
+ };
91
+ return KHR_materials_clearcoat;
92
+ }());
93
+ export { KHR_materials_clearcoat };
94
+ GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_clearcoat(loader); });
95
95
  //# sourceMappingURL=KHR_materials_clearcoat.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
- * [Experimental Spec](https://github.com/KhronosGroup/glTF/pull/1994)
8
- */
9
- export declare class KHR_materials_emissive_strength implements IGLTFLoaderExtension {
10
- /**
11
- * The name of this extension.
12
- */
13
- readonly name = "KHR_materials_emissive_strength";
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 _loadEmissiveProperties;
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
+ * [Experimental Spec](https://github.com/KhronosGroup/glTF/pull/1994)
8
+ */
9
+ export declare class KHR_materials_emissive_strength implements IGLTFLoaderExtension {
10
+ /**
11
+ * The name of this extension.
12
+ */
13
+ readonly name = "KHR_materials_emissive_strength";
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 _loadEmissiveProperties;
38
+ }
@@ -1,54 +1,54 @@
1
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
- import { GLTFLoader } from "../glTFLoader.js";
3
- var NAME = "KHR_materials_emissive_strength";
4
- /**
5
- * [Experimental Spec](https://github.com/KhronosGroup/glTF/pull/1994)
6
- */
7
- var KHR_materials_emissive_strength = /** @class */ (function () {
8
- /**
9
- * @param loader
10
- * @hidden
11
- */
12
- function KHR_materials_emissive_strength(loader) {
13
- /**
14
- * The name of this extension.
15
- */
16
- this.name = NAME;
17
- /**
18
- * Defines a number that determines the order the extensions are applied.
19
- */
20
- this.order = 170;
21
- this._loader = loader;
22
- this.enabled = this._loader.isExtensionUsed(NAME);
23
- }
24
- /** @hidden */
25
- KHR_materials_emissive_strength.prototype.dispose = function () {
26
- this._loader = null;
27
- };
28
- /**
29
- * @param context
30
- * @param material
31
- * @param babylonMaterial
32
- * @hidden
33
- */
34
- KHR_materials_emissive_strength.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
35
- var _this = this;
36
- return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
37
- return _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial).then(function () {
38
- _this._loadEmissiveProperties(extensionContext, extension, babylonMaterial);
39
- });
40
- });
41
- };
42
- KHR_materials_emissive_strength.prototype._loadEmissiveProperties = function (context, properties, babylonMaterial) {
43
- if (!(babylonMaterial instanceof PBRMaterial)) {
44
- throw new Error("".concat(context, ": Material type not supported"));
45
- }
46
- if (properties.emissiveStrength !== undefined) {
47
- babylonMaterial.emissiveColor.scaleToRef(properties.emissiveStrength, babylonMaterial.emissiveColor);
48
- }
49
- };
50
- return KHR_materials_emissive_strength;
51
- }());
52
- export { KHR_materials_emissive_strength };
53
- GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_emissive_strength(loader); });
1
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
+ import { GLTFLoader } from "../glTFLoader";
3
+ var NAME = "KHR_materials_emissive_strength";
4
+ /**
5
+ * [Experimental Spec](https://github.com/KhronosGroup/glTF/pull/1994)
6
+ */
7
+ var KHR_materials_emissive_strength = /** @class */ (function () {
8
+ /**
9
+ * @param loader
10
+ * @hidden
11
+ */
12
+ function KHR_materials_emissive_strength(loader) {
13
+ /**
14
+ * The name of this extension.
15
+ */
16
+ this.name = NAME;
17
+ /**
18
+ * Defines a number that determines the order the extensions are applied.
19
+ */
20
+ this.order = 170;
21
+ this._loader = loader;
22
+ this.enabled = this._loader.isExtensionUsed(NAME);
23
+ }
24
+ /** @hidden */
25
+ KHR_materials_emissive_strength.prototype.dispose = function () {
26
+ this._loader = null;
27
+ };
28
+ /**
29
+ * @param context
30
+ * @param material
31
+ * @param babylonMaterial
32
+ * @hidden
33
+ */
34
+ KHR_materials_emissive_strength.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
35
+ var _this = this;
36
+ return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
37
+ return _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial).then(function () {
38
+ _this._loadEmissiveProperties(extensionContext, extension, babylonMaterial);
39
+ });
40
+ });
41
+ };
42
+ KHR_materials_emissive_strength.prototype._loadEmissiveProperties = function (context, properties, babylonMaterial) {
43
+ if (!(babylonMaterial instanceof PBRMaterial)) {
44
+ throw new Error("".concat(context, ": Material type not supported"));
45
+ }
46
+ if (properties.emissiveStrength !== undefined) {
47
+ babylonMaterial.emissiveColor.scaleToRef(properties.emissiveStrength, babylonMaterial.emissiveColor);
48
+ }
49
+ };
50
+ return KHR_materials_emissive_strength;
51
+ }());
52
+ export { KHR_materials_emissive_strength };
53
+ GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_emissive_strength(loader); });
54
54
  //# sourceMappingURL=KHR_materials_emissive_strength.js.map