@babylonjs/loaders 5.0.0-rc.1 → 5.0.0-rc.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. package/OBJ/index.d.ts +4 -4
  2. package/OBJ/index.js +4 -4
  3. package/OBJ/index.js.map +1 -1
  4. package/OBJ/mtlFileLoader.d.ts +41 -40
  5. package/OBJ/mtlFileLoader.js +232 -231
  6. package/OBJ/mtlFileLoader.js.map +1 -1
  7. package/OBJ/objFileLoader.d.ts +126 -133
  8. package/OBJ/objFileLoader.js +296 -300
  9. package/OBJ/objFileLoader.js.map +1 -1
  10. package/OBJ/objLoadingOptions.d.ts +43 -43
  11. package/OBJ/objLoadingOptions.js +1 -1
  12. package/OBJ/objLoadingOptions.js.map +1 -1
  13. package/OBJ/solidParser.d.ts +154 -153
  14. package/OBJ/solidParser.js +693 -699
  15. package/OBJ/solidParser.js.map +1 -1
  16. package/STL/index.d.ts +1 -1
  17. package/STL/index.js +1 -1
  18. package/STL/index.js.map +1 -1
  19. package/STL/stlFileLoader.d.ts +64 -71
  20. package/STL/stlFileLoader.js +233 -239
  21. package/STL/stlFileLoader.js.map +1 -1
  22. package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
  23. package/glTF/1.0/glTFBinaryExtension.js +60 -61
  24. package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
  25. package/glTF/1.0/glTFLoader.d.ts +136 -106
  26. package/glTF/1.0/glTFLoader.js +1814 -1696
  27. package/glTF/1.0/glTFLoader.js.map +1 -1
  28. package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
  29. package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
  30. package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
  31. package/glTF/1.0/glTFLoaderUtils.d.ts +63 -62
  32. package/glTF/1.0/glTFLoaderUtils.js +250 -232
  33. package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
  34. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
  35. package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -127
  36. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
  37. package/glTF/1.0/index.d.ts +5 -5
  38. package/glTF/1.0/index.js +5 -5
  39. package/glTF/1.0/index.js.map +1 -1
  40. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -36
  41. package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -110
  42. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
  43. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -28
  44. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -80
  45. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  46. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -27
  47. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -42
  48. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
  49. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -21
  50. package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -32
  51. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
  52. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -32
  53. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -55
  54. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
  55. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -31
  56. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -101
  57. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  58. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -28
  59. package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -81
  60. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  61. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -31
  62. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -86
  63. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  64. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -30
  65. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -45
  66. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  67. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -34
  68. package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -54
  69. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  70. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -30
  71. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -72
  72. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
  73. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -31
  74. package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -76
  75. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  76. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -30
  77. package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -66
  78. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  79. package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -31
  80. package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -76
  81. package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
  82. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -30
  83. package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -277
  84. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  85. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -30
  86. package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -65
  87. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  88. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -76
  89. package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -243
  90. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
  91. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -31
  92. package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -78
  93. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  94. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -19
  95. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -21
  96. package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
  97. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -21
  98. package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -32
  99. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
  100. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -25
  101. package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -53
  102. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  103. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -29
  104. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -46
  105. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
  106. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -38
  107. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -216
  108. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
  109. package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -75
  110. package/glTF/2.0/Extensions/MSFT_lod.js +369 -333
  111. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
  112. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
  113. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
  114. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
  115. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
  116. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
  117. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
  118. package/glTF/2.0/Extensions/index.d.ts +26 -26
  119. package/glTF/2.0/Extensions/index.js +26 -26
  120. package/glTF/2.0/Extensions/index.js.map +1 -1
  121. package/glTF/2.0/glTFLoader.d.ts +406 -357
  122. package/glTF/2.0/glTFLoader.js +2366 -2266
  123. package/glTF/2.0/glTFLoader.js.map +1 -1
  124. package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
  125. package/glTF/2.0/glTFLoaderExtension.js +1 -1
  126. package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
  127. package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -209
  128. package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
  129. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
  130. package/glTF/2.0/index.d.ts +4 -4
  131. package/glTF/2.0/index.js +5 -4
  132. package/glTF/2.0/index.js.map +1 -1
  133. package/glTF/glTFFileLoader.d.ts +433 -373
  134. package/glTF/glTFFileLoader.js +927 -870
  135. package/glTF/glTFFileLoader.js.map +1 -1
  136. package/glTF/glTFValidation.d.ts +29 -29
  137. package/glTF/glTFValidation.js +123 -121
  138. package/glTF/glTFValidation.js.map +1 -1
  139. package/glTF/index.d.ts +5 -5
  140. package/glTF/index.js +6 -5
  141. package/glTF/index.js.map +1 -1
  142. package/index.d.ts +3 -3
  143. package/index.js +4 -3
  144. package/index.js.map +1 -1
  145. package/legacy/legacy-glTF.d.ts +2 -2
  146. package/legacy/legacy-glTF.js +18 -18
  147. package/legacy/legacy-glTF.js.map +1 -1
  148. package/legacy/legacy-glTF1.d.ts +2 -2
  149. package/legacy/legacy-glTF1.js +15 -14
  150. package/legacy/legacy-glTF1.js.map +1 -1
  151. package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
  152. package/legacy/legacy-glTF1FileLoader.js +3 -2
  153. package/legacy/legacy-glTF1FileLoader.js.map +1 -1
  154. package/legacy/legacy-glTF2.d.ts +2 -2
  155. package/legacy/legacy-glTF2.js +33 -32
  156. package/legacy/legacy-glTF2.js.map +1 -1
  157. package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
  158. package/legacy/legacy-glTF2FileLoader.js +3 -2
  159. package/legacy/legacy-glTF2FileLoader.js.map +1 -1
  160. package/legacy/legacy-glTFFileLoader.d.ts +3 -3
  161. package/legacy/legacy-glTFFileLoader.js +4 -3
  162. package/legacy/legacy-glTFFileLoader.js.map +1 -1
  163. package/legacy/legacy-objFileLoader.d.ts +1 -1
  164. package/legacy/legacy-objFileLoader.js +13 -12
  165. package/legacy/legacy-objFileLoader.js.map +1 -1
  166. package/legacy/legacy-stlFileLoader.d.ts +1 -1
  167. package/legacy/legacy-stlFileLoader.js +13 -12
  168. package/legacy/legacy-stlFileLoader.js.map +1 -1
  169. package/legacy/legacy.d.ts +6 -6
  170. package/legacy/legacy.js +8 -6
  171. package/legacy/legacy.js.map +1 -1
  172. package/license.md +71 -0
  173. package/package.json +37 -193
  174. package/readme.md +2 -2
@@ -1,34 +1,42 @@
1
- import { Nullable } from "@babylonjs/core/types";
2
- import { Material } from "@babylonjs/core/Materials/material";
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_ior)
8
- */
9
- export declare class KHR_materials_ior implements IGLTFLoaderExtension {
10
- /**
11
- * Default ior Value from the spec.
12
- */
13
- private static readonly _DEFAULT_IOR;
14
- /**
15
- * The name of this extension.
16
- */
17
- readonly name = "KHR_materials_ior";
18
- /**
19
- * Defines whether this extension is enabled.
20
- */
21
- enabled: boolean;
22
- /**
23
- * Defines a number that determines the order the extensions are applied.
24
- */
25
- order: number;
26
- private _loader;
27
- /** @hidden */
28
- constructor(loader: GLTFLoader);
29
- /** @hidden */
30
- dispose(): void;
31
- /** @hidden */
32
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
33
- private _loadIorPropertiesAsync;
34
- }
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/tree/master/extensions/2.0/Khronos/KHR_materials_ior)
8
+ */
9
+ export declare class KHR_materials_ior implements IGLTFLoaderExtension {
10
+ /**
11
+ * Default ior Value from the spec.
12
+ */
13
+ private static readonly _DEFAULT_IOR;
14
+ /**
15
+ * The name of this extension.
16
+ */
17
+ readonly name = "KHR_materials_ior";
18
+ /**
19
+ * Defines whether this extension is enabled.
20
+ */
21
+ enabled: boolean;
22
+ /**
23
+ * Defines a number that determines the order the extensions are applied.
24
+ */
25
+ order: number;
26
+ private _loader;
27
+ /**
28
+ * @param loader
29
+ * @hidden
30
+ */
31
+ constructor(loader: GLTFLoader);
32
+ /** @hidden */
33
+ dispose(): void;
34
+ /**
35
+ * @param context
36
+ * @param material
37
+ * @param babylonMaterial
38
+ * @hidden
39
+ */
40
+ loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
41
+ private _loadIorPropertiesAsync;
42
+ }
@@ -1,55 +1,63 @@
1
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
- import { GLTFLoader } from "../glTFLoader.js";
3
- var NAME = "KHR_materials_ior";
4
- /**
5
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior)
6
- */
7
- var KHR_materials_ior = /** @class */ (function () {
8
- /** @hidden */
9
- function KHR_materials_ior(loader) {
10
- /**
11
- * The name of this extension.
12
- */
13
- this.name = NAME;
14
- /**
15
- * Defines a number that determines the order the extensions are applied.
16
- */
17
- this.order = 180;
18
- this._loader = loader;
19
- this.enabled = this._loader.isExtensionUsed(NAME);
20
- }
21
- /** @hidden */
22
- KHR_materials_ior.prototype.dispose = function () {
23
- this._loader = null;
24
- };
25
- /** @hidden */
26
- KHR_materials_ior.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
27
- var _this = this;
28
- return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
29
- var promises = new Array();
30
- promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
31
- promises.push(_this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));
32
- return Promise.all(promises).then(function () { });
33
- });
34
- };
35
- KHR_materials_ior.prototype._loadIorPropertiesAsync = function (context, properties, babylonMaterial) {
36
- if (!(babylonMaterial instanceof PBRMaterial)) {
37
- throw new Error("".concat(context, ": Material type not supported"));
38
- }
39
- if (properties.ior !== undefined) {
40
- babylonMaterial.indexOfRefraction = properties.ior;
41
- }
42
- else {
43
- babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;
44
- }
45
- return Promise.resolve();
46
- };
47
- /**
48
- * Default ior Value from the spec.
49
- */
50
- KHR_materials_ior._DEFAULT_IOR = 1.5;
51
- return KHR_materials_ior;
52
- }());
53
- export { KHR_materials_ior };
54
- GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_ior(loader); });
1
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
+ import { GLTFLoader } from "../glTFLoader";
3
+ var NAME = "KHR_materials_ior";
4
+ /**
5
+ * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior)
6
+ */
7
+ var KHR_materials_ior = /** @class */ (function () {
8
+ /**
9
+ * @param loader
10
+ * @hidden
11
+ */
12
+ function KHR_materials_ior(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 = 180;
21
+ this._loader = loader;
22
+ this.enabled = this._loader.isExtensionUsed(NAME);
23
+ }
24
+ /** @hidden */
25
+ KHR_materials_ior.prototype.dispose = function () {
26
+ this._loader = null;
27
+ };
28
+ /**
29
+ * @param context
30
+ * @param material
31
+ * @param babylonMaterial
32
+ * @hidden
33
+ */
34
+ KHR_materials_ior.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
35
+ var _this = this;
36
+ return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
37
+ var promises = new Array();
38
+ promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));
39
+ promises.push(_this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));
40
+ return Promise.all(promises).then(function () { });
41
+ });
42
+ };
43
+ KHR_materials_ior.prototype._loadIorPropertiesAsync = function (context, properties, babylonMaterial) {
44
+ if (!(babylonMaterial instanceof PBRMaterial)) {
45
+ throw new Error("".concat(context, ": Material type not supported"));
46
+ }
47
+ if (properties.ior !== undefined) {
48
+ babylonMaterial.indexOfRefraction = properties.ior;
49
+ }
50
+ else {
51
+ babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;
52
+ }
53
+ return Promise.resolve();
54
+ };
55
+ /**
56
+ * Default ior Value from the spec.
57
+ */
58
+ KHR_materials_ior._DEFAULT_IOR = 1.5;
59
+ return KHR_materials_ior;
60
+ }());
61
+ export { KHR_materials_ior };
62
+ GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_ior(loader); });
55
63
  //# sourceMappingURL=KHR_materials_ior.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_materials_ior.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_ior.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,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AAI,UAAU,CAAC,GAAG,KAAK,SAAS,EAAE;YAC9B,eAAe,CAAC,iBAAiB,GAAG,UAAU,CAAC,GAAG,CAAC;SACtD;aACI;YACD,eAAe,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,YAAY,CAAC;SACtE;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAxDD;;OAEG;IACqB,8BAAY,GAAG,GAAG,CAAC;IAsD/C,wBAAC;CAAA,AA1DD,IA0DC;SA1DY,iBAAiB;AA4D9B,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAA7B,CAA6B,CAAC,CAAC","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\nimport { Material } from \"@babylonjs/core/Materials/material\";\n\nimport { IMaterial } from \"../glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { GLTFLoader } from \"../glTFLoader\";\nimport { IKHRMaterialsIor } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_ior\";\n\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior)\n */\nexport class KHR_materials_ior implements IGLTFLoaderExtension {\n /**\n * Default ior Value from the spec.\n */\n private static readonly _DEFAULT_IOR = 1.5;\n\n /**\n * The name of this extension.\n */\n public readonly name = NAME;\n\n /**\n * Defines whether this extension is enabled.\n */\n public enabled: boolean;\n\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n public order = 180;\n\n private _loader: GLTFLoader;\n\n /** @hidden */\n constructor(loader: GLTFLoader) {\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n\n /** @hidden */\n public dispose() {\n (this._loader as any) = null;\n }\n\n /** @hidden */\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsIor>(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array<Promise<any>>();\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n\n private _loadIorPropertiesAsync(context: string, properties: IKHRMaterialsIor, babylonMaterial: Material): Promise<void> {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n\n if (properties.ior !== undefined) {\n babylonMaterial.indexOfRefraction = properties.ior;\n }\n else {\n babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;\n }\n\n return Promise.resolve();\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_ior(loader));"]}
1
+ {"version":3,"file":"KHR_materials_ior.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_ior.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC;;GAEG;AACH;IAuBI;;;OAGG;IACH,2BAAY,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;IACtD,CAAC;IAED,cAAc;IACP,mCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,uDAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,e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nimport type { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsIor } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_materials_ior\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior)\r\n */\r\nexport class KHR_materials_ior implements IGLTFLoaderExtension {\r\n /**\r\n * Default ior Value from the spec.\r\n */\r\n private static readonly _DEFAULT_IOR = 1.5;\r\n\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 = 180;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param 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<IKHRMaterialsIor>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadIorPropertiesAsync(context: string, properties: IKHRMaterialsIor, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n if (properties.ior !== undefined) {\r\n babylonMaterial.indexOfRefraction = properties.ior;\r\n } else {\r\n babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_ior(loader));\r\n"]}
@@ -1,30 +1,38 @@
1
- import { Nullable } from "@babylonjs/core/types";
2
- import { Material } from "@babylonjs/core/Materials/material";
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_pbrSpecularGlossiness)
8
- */
9
- export declare class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
10
- /**
11
- * The name of this extension.
12
- */
13
- readonly name = "KHR_materials_pbrSpecularGlossiness";
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
- /** @hidden */
24
- constructor(loader: GLTFLoader);
25
- /** @hidden */
26
- dispose(): void;
27
- /** @hidden */
28
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
29
- private _loadSpecularGlossinessPropertiesAsync;
30
- }
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/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
8
+ */
9
+ export declare class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {
10
+ /**
11
+ * The name of this extension.
12
+ */
13
+ readonly name = "KHR_materials_pbrSpecularGlossiness";
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 _loadSpecularGlossinessPropertiesAsync;
38
+ }
@@ -1,73 +1,81 @@
1
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
2
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
3
- import { GLTFLoader } from "../glTFLoader.js";
4
- var NAME = "KHR_materials_pbrSpecularGlossiness";
5
- /**
6
- * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
7
- */
8
- var KHR_materials_pbrSpecularGlossiness = /** @class */ (function () {
9
- /** @hidden */
10
- function KHR_materials_pbrSpecularGlossiness(loader) {
11
- /**
12
- * The name of this extension.
13
- */
14
- this.name = NAME;
15
- /**
16
- * Defines a number that determines the order the extensions are applied.
17
- */
18
- this.order = 200;
19
- this._loader = loader;
20
- this.enabled = this._loader.isExtensionUsed(NAME);
21
- }
22
- /** @hidden */
23
- KHR_materials_pbrSpecularGlossiness.prototype.dispose = function () {
24
- this._loader = null;
25
- };
26
- /** @hidden */
27
- KHR_materials_pbrSpecularGlossiness.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
28
- var _this = this;
29
- return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
30
- var promises = new Array();
31
- promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));
32
- promises.push(_this._loadSpecularGlossinessPropertiesAsync(extensionContext, material, extension, babylonMaterial));
33
- _this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);
34
- return Promise.all(promises).then(function () { });
35
- });
36
- };
37
- KHR_materials_pbrSpecularGlossiness.prototype._loadSpecularGlossinessPropertiesAsync = function (context, material, properties, babylonMaterial) {
38
- if (!(babylonMaterial instanceof PBRMaterial)) {
39
- throw new Error("".concat(context, ": Material type not supported"));
40
- }
41
- var promises = new Array();
42
- babylonMaterial.metallic = null;
43
- babylonMaterial.roughness = null;
44
- if (properties.diffuseFactor) {
45
- babylonMaterial.albedoColor = Color3.FromArray(properties.diffuseFactor);
46
- babylonMaterial.alpha = properties.diffuseFactor[3];
47
- }
48
- else {
49
- babylonMaterial.albedoColor = Color3.White();
50
- }
51
- babylonMaterial.reflectivityColor = properties.specularFactor ? Color3.FromArray(properties.specularFactor) : Color3.White();
52
- babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;
53
- if (properties.diffuseTexture) {
54
- promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/diffuseTexture"), properties.diffuseTexture, function (texture) {
55
- texture.name = "".concat(babylonMaterial.name, " (Diffuse)");
56
- babylonMaterial.albedoTexture = texture;
57
- }));
58
- }
59
- if (properties.specularGlossinessTexture) {
60
- promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/specularGlossinessTexture"), properties.specularGlossinessTexture, function (texture) {
61
- texture.name = "".concat(babylonMaterial.name, " (Specular Glossiness)");
62
- babylonMaterial.reflectivityTexture = texture;
63
- }));
64
- babylonMaterial.reflectivityTexture.hasAlpha = true;
65
- babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;
66
- }
67
- return Promise.all(promises).then(function () { });
68
- };
69
- return KHR_materials_pbrSpecularGlossiness;
70
- }());
71
- export { KHR_materials_pbrSpecularGlossiness };
72
- GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_pbrSpecularGlossiness(loader); });
1
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
2
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
3
+ import { GLTFLoader } from "../glTFLoader";
4
+ var NAME = "KHR_materials_pbrSpecularGlossiness";
5
+ /**
6
+ * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
7
+ */
8
+ var KHR_materials_pbrSpecularGlossiness = /** @class */ (function () {
9
+ /**
10
+ * @param loader
11
+ * @hidden
12
+ */
13
+ function KHR_materials_pbrSpecularGlossiness(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 = 200;
22
+ this._loader = loader;
23
+ this.enabled = this._loader.isExtensionUsed(NAME);
24
+ }
25
+ /** @hidden */
26
+ KHR_materials_pbrSpecularGlossiness.prototype.dispose = function () {
27
+ this._loader = null;
28
+ };
29
+ /**
30
+ * @param context
31
+ * @param material
32
+ * @param babylonMaterial
33
+ * @hidden
34
+ */
35
+ KHR_materials_pbrSpecularGlossiness.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.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));
40
+ promises.push(_this._loadSpecularGlossinessPropertiesAsync(extensionContext, material, extension, babylonMaterial));
41
+ _this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);
42
+ return Promise.all(promises).then(function () { });
43
+ });
44
+ };
45
+ KHR_materials_pbrSpecularGlossiness.prototype._loadSpecularGlossinessPropertiesAsync = function (context, material, 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.metallic = null;
51
+ babylonMaterial.roughness = null;
52
+ if (properties.diffuseFactor) {
53
+ babylonMaterial.albedoColor = Color3.FromArray(properties.diffuseFactor);
54
+ babylonMaterial.alpha = properties.diffuseFactor[3];
55
+ }
56
+ else {
57
+ babylonMaterial.albedoColor = Color3.White();
58
+ }
59
+ babylonMaterial.reflectivityColor = properties.specularFactor ? Color3.FromArray(properties.specularFactor) : Color3.White();
60
+ babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;
61
+ if (properties.diffuseTexture) {
62
+ promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/diffuseTexture"), properties.diffuseTexture, function (texture) {
63
+ texture.name = "".concat(babylonMaterial.name, " (Diffuse)");
64
+ babylonMaterial.albedoTexture = texture;
65
+ }));
66
+ }
67
+ if (properties.specularGlossinessTexture) {
68
+ promises.push(this._loader.loadTextureInfoAsync("".concat(context, "/specularGlossinessTexture"), properties.specularGlossinessTexture, function (texture) {
69
+ texture.name = "".concat(babylonMaterial.name, " (Specular Glossiness)");
70
+ babylonMaterial.reflectivityTexture = texture;
71
+ }));
72
+ babylonMaterial.reflectivityTexture.hasAlpha = true;
73
+ babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;
74
+ }
75
+ return Promise.all(promises).then(function () { });
76
+ };
77
+ return KHR_materials_pbrSpecularGlossiness;
78
+ }());
79
+ export { KHR_materials_pbrSpecularGlossiness };
80
+ GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_pbrSpecularGlossiness(loader); });
73
81
  //# sourceMappingURL=KHR_materials_pbrSpecularGlossiness.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_materials_pbrSpecularGlossiness.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/K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aAAa,GAAG,OAAO,CAAC;YAC5C,CAAC,CAAC,CAAC,CAAC;SACP;QAED,IAAI,UAAU,CAAC,yBAAyB,EAAE;YACtC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,UAAG,OAAO,+BAA4B,EAAE,UAAU,CAAC,yBAAyB,EAAE,UAAC,OAAO;gBAClI,OAAO,CAAC,IAAI,GAAG,UAAG,eAAe,CAAC,IAAI,2BAAwB,CAAC;gBAC/D,eAAe,CAAC,mBAAmB,GAAG,OAAO,CAAC;YAClD,CAAC,CAAC,CAAC,CAAC;YAEJ,eAAe,CAAC,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC;YACpD,eAAe,CAAC,uCAAuC,GAAG,IAAI,CAAC;SAClE;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,cAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IACL,0CAAC;AAAD,CAAC,AAhFD,IAgFC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,mCAAmC,CAAC,MAAM,CAAC,EAA/C,CAA+C,CAAC,CAAC","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\nimport { Material } from \"@babylonjs/core/Materials/material\";\n\nimport { IMaterial } from \"../glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { GLTFLoader } from \"../glTFLoader\";\nimport { IKHRMaterialsPbrSpecularGlossiness } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_pbrSpecularGlossiness\";\n\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)\n */\nexport class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderExtension {\n /**\n * The name of this extension.\n */\n public readonly name = NAME;\n\n /**\n * Defines whether this extension is enabled.\n */\n public enabled: boolean;\n\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n public order = 200;\n\n private _loader: GLTFLoader;\n\n /** @hidden */\n constructor(loader: GLTFLoader) {\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n\n /** @hidden */\n public dispose() {\n (this._loader as any) = null;\n }\n\n /** @hidden */\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsPbrSpecularGlossiness>(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array<Promise<any>>();\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadSpecularGlossinessPropertiesAsync(extensionContext, material, extension, babylonMaterial));\n this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);\n return Promise.all(promises).then(() => { });\n });\n }\n\n private _loadSpecularGlossinessPropertiesAsync(context: string, material: IMaterial, properties: IKHRMaterialsPbrSpecularGlossiness, babylonMaterial: Material): Promise<void> {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n\n const promises = new Array<Promise<any>>();\n\n babylonMaterial.metallic = null;\n babylonMaterial.roughness = null;\n\n if (properties.diffuseFactor) {\n babylonMaterial.albedoColor = Color3.FromArray(properties.diffuseFactor);\n babylonMaterial.alpha = properties.diffuseFactor[3];\n }\n else {\n babylonMaterial.albedoColor = Color3.White();\n }\n\n babylonMaterial.reflectivityColor = properties.specularFactor ? Color3.FromArray(properties.specularFactor) : Color3.White();\n babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;\n\n if (properties.diffuseTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/diffuseTexture`, properties.diffuseTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Diffuse)`;\n babylonMaterial.albedoTexture = texture;\n }));\n }\n\n if (properties.specularGlossinessTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/specularGlossinessTexture`, properties.specularGlossinessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Specular Glossiness)`;\n babylonMaterial.reflectivityTexture = texture;\n }));\n\n babylonMaterial.reflectivityTexture.hasAlpha = true;\n babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;\n }\n\n return Promise.all(promises).then(() => { });\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_pbrSpecularGlossiness(loader));"]}
1
+ {"version":3,"file":"KHR_materials_pbrSpecularGlossiness.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,qCAAqC,CAAC;AAEnD;;GAEG;AACH;IAkBI;;;OAGG;IACH,6CAAY,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;IACtD,CAAC;IAED,cAAc;IACP,qDAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,yEAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAQC;QAPG,OAAO,UAAU,CAAC,kBAAkB,CAAqC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAA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eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\n\r\nimport type { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport type { IKHRMaterialsPbrSpecularGlossiness } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_materials_pbrSpecularGlossiness\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)\r\n */\r\nexport class KHR_materials_pbrSpecularGlossiness 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 = 200;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param 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<IKHRMaterialsPbrSpecularGlossiness>(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._loadSpecularGlossinessPropertiesAsync(extensionContext, material, extension, babylonMaterial));\r\n this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadSpecularGlossinessPropertiesAsync(context: string, material: IMaterial, properties: IKHRMaterialsPbrSpecularGlossiness, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n babylonMaterial.metallic = null;\r\n babylonMaterial.roughness = null;\r\n\r\n if (properties.diffuseFactor) {\r\n babylonMaterial.albedoColor = Color3.FromArray(properties.diffuseFactor);\r\n babylonMaterial.alpha = properties.diffuseFactor[3];\r\n } else {\r\n babylonMaterial.albedoColor = Color3.White();\r\n }\r\n\r\n babylonMaterial.reflectivityColor = properties.specularFactor ? Color3.FromArray(properties.specularFactor) : Color3.White();\r\n babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;\r\n\r\n if (properties.diffuseTexture) {\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/diffuseTexture`, properties.diffuseTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Diffuse)`;\r\n babylonMaterial.albedoTexture = texture;\r\n })\r\n );\r\n }\r\n\r\n if (properties.specularGlossinessTexture) {\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/specularGlossinessTexture`, properties.specularGlossinessTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (Specular Glossiness)`;\r\n babylonMaterial.reflectivityTexture = texture;\r\n })\r\n );\r\n\r\n babylonMaterial.reflectivityTexture.hasAlpha = true;\r\n babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_pbrSpecularGlossiness(loader));\r\n"]}
@@ -1,31 +1,39 @@
1
- import { Nullable } from "@babylonjs/core/types";
2
- import { Material } from "@babylonjs/core/Materials/material";
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_sheen/README.md)
8
- * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)
9
- */
10
- export declare class KHR_materials_sheen implements IGLTFLoaderExtension {
11
- /**
12
- * The name of this extension.
13
- */
14
- readonly name = "KHR_materials_sheen";
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
- /** @hidden */
25
- constructor(loader: GLTFLoader);
26
- /** @hidden */
27
- dispose(): void;
28
- /** @hidden */
29
- loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
30
- private _loadSheenPropertiesAsync;
31
- }
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_sheen/README.md)
8
+ * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)
9
+ */
10
+ export declare class KHR_materials_sheen implements IGLTFLoaderExtension {
11
+ /**
12
+ * The name of this extension.
13
+ */
14
+ readonly name = "KHR_materials_sheen";
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 _loadSheenPropertiesAsync;
39
+ }