@babylonjs/loaders 5.0.0-alpha.9 → 5.0.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. package/OBJ/index.d.ts +2 -0
  2. package/OBJ/index.js +4 -2
  3. package/OBJ/index.js.map +1 -1
  4. package/OBJ/mtlFileLoader.d.ts +4 -2
  5. package/OBJ/mtlFileLoader.js +7 -6
  6. package/OBJ/mtlFileLoader.js.map +1 -1
  7. package/OBJ/objFileLoader.d.ts +12 -84
  8. package/OBJ/objFileLoader.js +50 -667
  9. package/OBJ/objFileLoader.js.map +1 -1
  10. package/OBJ/objLoadingOptions.d.ts +43 -0
  11. package/OBJ/objLoadingOptions.js +2 -0
  12. package/OBJ/objLoadingOptions.js.map +1 -0
  13. package/OBJ/solidParser.d.ts +153 -0
  14. package/OBJ/solidParser.js +700 -0
  15. package/OBJ/solidParser.js.map +1 -0
  16. package/STL/index.js +1 -1
  17. package/STL/stlFileLoader.d.ts +6 -0
  18. package/STL/stlFileLoader.js +38 -11
  19. package/STL/stlFileLoader.js.map +1 -1
  20. package/glTF/1.0/glTFBinaryExtension.js +4 -4
  21. package/glTF/1.0/glTFLoader.d.ts +4 -4
  22. package/glTF/1.0/glTFLoader.js +60 -55
  23. package/glTF/1.0/glTFLoader.js.map +1 -1
  24. package/glTF/1.0/glTFLoaderInterfaces.d.ts +3 -1
  25. package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
  26. package/glTF/1.0/glTFLoaderUtils.js +6 -6
  27. package/glTF/1.0/glTFMaterialsCommonExtension.js +12 -12
  28. package/glTF/1.0/index.js +5 -5
  29. package/glTF/2.0/Extensions/EXT_lights_image_based.js +8 -5
  30. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
  31. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +3 -3
  32. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  33. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +1 -5
  34. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +5 -21
  35. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
  36. package/glTF/2.0/Extensions/EXT_texture_webp.js +2 -2
  37. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
  38. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +1 -1
  39. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +8 -4
  40. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  41. package/glTF/2.0/Extensions/KHR_lights_punctual.js +9 -8
  42. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  43. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +2 -2
  44. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +30 -0
  45. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +46 -0
  46. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -0
  47. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +1 -2
  48. package/glTF/2.0/Extensions/KHR_materials_ior.js +3 -4
  49. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  50. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +3 -4
  51. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
  52. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +0 -1
  53. package/glTF/2.0/Extensions/KHR_materials_sheen.js +3 -4
  54. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  55. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +1 -2
  56. package/glTF/2.0/Extensions/KHR_materials_specular.js +12 -6
  57. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  58. package/glTF/2.0/Extensions/KHR_materials_translucency.js +6 -6
  59. package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
  60. package/glTF/2.0/Extensions/KHR_materials_transmission.js +93 -84
  61. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  62. package/glTF/2.0/Extensions/KHR_materials_unlit.js +3 -3
  63. package/glTF/2.0/Extensions/KHR_materials_variants.js +70 -5
  64. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
  65. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +31 -0
  66. package/glTF/2.0/Extensions/KHR_materials_volume.js +79 -0
  67. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -0
  68. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +1 -1
  69. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +1 -2
  70. package/glTF/2.0/Extensions/KHR_texture_basisu.js +3 -4
  71. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
  72. package/glTF/2.0/Extensions/KHR_texture_transform.js +2 -2
  73. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +2 -2
  74. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +6 -3
  75. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
  76. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +6 -7
  77. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
  78. package/glTF/2.0/Extensions/MSFT_lod.d.ts +2 -1
  79. package/glTF/2.0/Extensions/MSFT_lod.js +48 -8
  80. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
  81. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +2 -2
  82. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +2 -2
  83. package/glTF/2.0/Extensions/index.d.ts +2 -0
  84. package/glTF/2.0/Extensions/index.js +26 -24
  85. package/glTF/2.0/Extensions/index.js.map +1 -1
  86. package/glTF/2.0/glTFLoader.d.ts +6 -11
  87. package/glTF/2.0/glTFLoader.js +129 -95
  88. package/glTF/2.0/glTFLoader.js.map +1 -1
  89. package/glTF/2.0/glTFLoaderInterfaces.d.ts +4 -2
  90. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
  91. package/glTF/2.0/index.d.ts +1 -1
  92. package/glTF/2.0/index.js +4 -4
  93. package/glTF/2.0/index.js.map +1 -1
  94. package/glTF/glTFFileLoader.d.ts +15 -9
  95. package/glTF/glTFFileLoader.js +62 -76
  96. package/glTF/glTFFileLoader.js.map +1 -1
  97. package/glTF/glTFValidation.js +1 -1
  98. package/glTF/glTFValidation.js.map +1 -1
  99. package/glTF/index.d.ts +2 -2
  100. package/glTF/index.js +4 -4
  101. package/glTF/index.js.map +1 -1
  102. package/index.d.ts +3 -3
  103. package/index.js +3 -3
  104. package/index.js.map +1 -1
  105. package/legacy/legacy-glTF.js +4 -4
  106. package/legacy/legacy-glTF1.d.ts +1 -1
  107. package/legacy/legacy-glTF1.js +1 -1
  108. package/legacy/legacy-glTF1.js.map +1 -1
  109. package/legacy/legacy-glTF1FileLoader.js +2 -2
  110. package/legacy/legacy-glTF2.d.ts +1 -1
  111. package/legacy/legacy-glTF2.js +3 -3
  112. package/legacy/legacy-glTF2.js.map +1 -1
  113. package/legacy/legacy-glTF2FileLoader.js +2 -2
  114. package/legacy/legacy-glTFFileLoader.js +3 -3
  115. package/legacy/legacy-objFileLoader.d.ts +1 -1
  116. package/legacy/legacy-objFileLoader.js +2 -2
  117. package/legacy/legacy-objFileLoader.js.map +1 -1
  118. package/legacy/legacy-stlFileLoader.d.ts +1 -1
  119. package/legacy/legacy-stlFileLoader.js +2 -2
  120. package/legacy/legacy-stlFileLoader.js.map +1 -1
  121. package/legacy/legacy.js +6 -6
  122. package/package.json +16 -4
@@ -0,0 +1,30 @@
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
+ * [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
+ /** @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 _loadEmissiveProperties;
30
+ }
@@ -0,0 +1,46 @@
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
+ /** @hidden */
9
+ function KHR_materials_emissive_strength(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 = 170;
18
+ this._loader = loader;
19
+ this.enabled = this._loader.isExtensionUsed(NAME);
20
+ }
21
+ /** @hidden */
22
+ KHR_materials_emissive_strength.prototype.dispose = function () {
23
+ this._loader = null;
24
+ };
25
+ /** @hidden */
26
+ KHR_materials_emissive_strength.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
27
+ var _this = this;
28
+ return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
29
+ return _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial).then(function () {
30
+ _this._loadEmissiveProperties(extensionContext, extension, babylonMaterial);
31
+ });
32
+ });
33
+ };
34
+ KHR_materials_emissive_strength.prototype._loadEmissiveProperties = function (context, properties, babylonMaterial) {
35
+ if (!(babylonMaterial instanceof PBRMaterial)) {
36
+ throw new Error(context + ": Material type not supported");
37
+ }
38
+ if (properties.emissiveStrength !== undefined) {
39
+ babylonMaterial.emissiveColor.scaleToRef(properties.emissiveStrength, babylonMaterial.emissiveColor);
40
+ }
41
+ };
42
+ return KHR_materials_emissive_strength;
43
+ }());
44
+ export { KHR_materials_emissive_strength };
45
+ GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_emissive_strength(loader); });
46
+ //# sourceMappingURL=KHR_materials_emissive_strength.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KHR_materials_emissive_strength.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_emissive_strength.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,iCAAiC,CAAC;AAE/C;;GAEG;AACH;IAkBI,cAAc;IACd,yCAAY,MAAkB;QAlB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAMf,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,iDAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,cAAc;IACP,qEAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAMC;QALG,OAAO,UAAU,CAAC,kBAAkB,CAAgC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YAC1H,OAAO,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC;gBACrF,KAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;YAC/E,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,iEAAuB,GAA/B,UAAgC,OAAe,EAAE,UAAyC,EAAE,eAAyB;QACjH,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAI,OAAO,kCAA+B,CAAC,CAAC;SAC9D;QAED,IAAI,UAAU,CAAC,gBAAgB,KAAK,SAAS,EAAE;YAC3C,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;SACxG;IACL,CAAC;IACL,sCAAC;AAAD,CAAC,AA/CD,IA+CC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,+BAA+B,CAAC,MAAM,CAAC,EAA3C,CAA2C,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 { IKHRMaterialsEmissiveStrength } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_emissive_strength\";\n\n/**\n * [Experimental Spec](https://github.com/KhronosGroup/glTF/pull/1994)\n */\nexport class KHR_materials_emissive_strength 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 = 170;\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<IKHRMaterialsEmissiveStrength>(context, material, this.name, (extensionContext, extension) => {\n return this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial).then(() => {\n this._loadEmissiveProperties(extensionContext, extension, babylonMaterial);\n });\n });\n }\n\n private _loadEmissiveProperties(context: string, properties: IKHRMaterialsEmissiveStrength, babylonMaterial: Material): void {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n\n if (properties.emissiveStrength !== undefined) {\n babylonMaterial.emissiveColor.scaleToRef(properties.emissiveStrength, babylonMaterial.emissiveColor);\n }\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_emissive_strength(loader));"]}
@@ -4,8 +4,7 @@ import { IMaterial } from "../glTFLoaderInterfaces";
4
4
  import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
5
5
  import { GLTFLoader } from "../glTFLoader";
6
6
  /**
7
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1718)
8
- * !!! Experimental Extension Subject to Changes !!!
7
+ * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior)
9
8
  */
10
9
  export declare class KHR_materials_ior implements IGLTFLoaderExtension {
11
10
  /**
@@ -1,9 +1,8 @@
1
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial";
2
- import { GLTFLoader } from "../glTFLoader";
1
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
+ import { GLTFLoader } from "../glTFLoader.js";
3
3
  var NAME = "KHR_materials_ior";
4
4
  /**
5
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1718)
6
- * !!! Experimental Extension Subject to Changes !!!
5
+ * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior)
7
6
  */
8
7
  var KHR_materials_ior = /** @class */ (function () {
9
8
  /** @hidden */
@@ -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,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC;;;GAGG;AACH;IAuBI,cAAc;IACd,2BAAY,MAAkB;QAlB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAMf,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,cAAc;IACP,uDAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAOC;QANG,OAAO,UAAU,CAAC,kBAAkB,CAAmB,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YAC7G,IAAM,QAAQ,GAAG,IAAI,KAAK,EAAgB,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC5F,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;YAC1F,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,cAAQ,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,mDAAuB,GAA/B,UAAgC,OAAe,EAAE,UAA4B,EAAE,eAAyB;QACpG,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAI,OAAO,kCAA+B,CAAC,CAAC;SAC9D;QAED,IAAI,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 * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1718)\n * !!! Experimental Extension Subject to Changes !!!\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":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_ior.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC;;GAEG;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G,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,6 +1,6 @@
1
- import { Color3 } from "@babylonjs/core/Maths/math.color";
2
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial";
3
- import { GLTFLoader } from "../glTFLoader";
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
4
  var NAME = "KHR_materials_pbrSpecularGlossiness";
5
5
  /**
6
6
  * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
@@ -57,7 +57,6 @@ var KHR_materials_pbrSpecularGlossiness = /** @class */ (function () {
57
57
  }));
58
58
  }
59
59
  if (properties.specularGlossinessTexture) {
60
- properties.specularGlossinessTexture.nonColorData = true;
61
60
  promises.push(this._loader.loadTextureInfoAsync(context + "/specularGlossinessTexture", properties.specularGlossinessTexture, function (texture) {
62
61
  texture.name = babylonMaterial.name + " (Specular Glossiness)";
63
62
  babylonMaterial.reflectivityTexture = texture;
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_materials_pbrSpecularGlossiness.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/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,aAAa,GAAG,OAAO,CAAC;YAC5C,CAAC,CAAC,CAAC,CAAC;SACP;QAED,IAAI,UAAU,CAAC,yBAAyB,EAAE;YACrC,UAAU,CAAC,yBAA0C,CAAC,YAAY,GAAG,IAAI,CAAC;YAC3E,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAI,OAAO,+BAA4B,EAAE,UAAU,CAAC,yBAAyB,EAAE,UAAC,OAAO;gBAClI,OAAO,CAAC,IAAI,GAAM,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,AAjFD,IAiFC;;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, ITextureInfo } 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 (properties.specularGlossinessTexture as ITextureInfo).nonColorData = true;\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":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,qCAAqC,CAAC;AAEnD;;GAEG;AACH;IAkBI,cAAc;IACd,6CAAY,MAAkB;QAlB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAMf,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,cAAc;IACP,yEAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,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C,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));"]}
@@ -6,7 +6,6 @@ import { GLTFLoader } from "../glTFLoader";
6
6
  /**
7
7
  * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_sheen/README.md)
8
8
  * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)
9
- * !!! Experimental Extension Subject to Changes !!!
10
9
  */
11
10
  export declare class KHR_materials_sheen implements IGLTFLoaderExtension {
12
11
  /**
@@ -1,11 +1,10 @@
1
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial";
2
- import { GLTFLoader } from "../glTFLoader";
3
- import { Color3 } from '@babylonjs/core/Maths/math.color';
1
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
+ import { GLTFLoader } from "../glTFLoader.js";
3
+ import { Color3 } from '@babylonjs/core/Maths/math.color.js';
4
4
  var NAME = "KHR_materials_sheen";
5
5
  /**
6
6
  * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_sheen/README.md)
7
7
  * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)
8
- * !!! Experimental Extension Subject to Changes !!!
9
8
  */
10
9
  var KHR_materials_sheen = /** @class */ (function () {
11
10
  /** @hidden */
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_materials_sheen.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_sheen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D,IAAM,IAAI,GAAG,qBAAqB,CAAC;AAEnC;;;;GAIG;AACH;IAkBI,cAAc;IACd,6BAAY,MAAkB;QAlB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAMf,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,qCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,cAAc;IACP,yDAA2B,GAAlC,UAAmC,OAAe,EAAE,QA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} from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\nimport { Material } from \"@babylonjs/core/Materials/material\";\n\nimport { IMaterial, ITextureInfo } from \"../glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { GLTFLoader } from \"../glTFLoader\";\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\nimport { IKHRMaterialsSheen } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_sheen\";\n\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_sheen/README.md)\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)\n * !!! Experimental Extension Subject to Changes !!!\n */\nexport class KHR_materials_sheen 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 = 190;\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<IKHRMaterialsSheen>(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._loadSheenPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n\n private _loadSheenPropertiesAsync(context: string, properties: IKHRMaterialsSheen, 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.sheen.isEnabled = true;\n babylonMaterial.sheen.intensity = 1;\n\n if (properties.sheenColorFactor != undefined) {\n babylonMaterial.sheen.color = Color3.FromArray(properties.sheenColorFactor);\n }\n else {\n babylonMaterial.sheen.color = Color3.Black();\n }\n\n if (properties.sheenColorTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/sheenColorTexture`, properties.sheenColorTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Sheen Color)`;\n babylonMaterial.sheen.texture = texture;\n }));\n }\n\n if (properties.sheenRoughnessFactor !== undefined) {\n babylonMaterial.sheen.roughness = properties.sheenRoughnessFactor;\n } else {\n babylonMaterial.sheen.roughness = 0;\n }\n\n if (properties.sheenRoughnessTexture) {\n (properties.sheenRoughnessTexture as ITextureInfo).nonColorData = true;\n promises.push(this._loader.loadTextureInfoAsync(`${context}/sheenRoughnessTexture`, properties.sheenRoughnessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Sheen Roughness)`;\n babylonMaterial.sheen.textureRoughness = texture;\n }));\n }\n\n babylonMaterial.sheen.albedoScaling = true;\n babylonMaterial.sheen.useRoughnessFromMainTexture = false;\n\n return Promise.all(promises).then(() => { });\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_sheen(loader));"]}
1
+ {"version":3,"file":"KHR_materials_sheen.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_sheen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D,IAAM,IAAI,GAAG,qBAAqB,CAAC;AAEnC;;;GAGG;AACH;IAkBI,cAAc;IACd,6BAAY,MAAkB;QAlB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAMf,IAAI,C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CAAC,cAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IACL,0BAAC;AAAD,CAAC,AAlFD,IAkFC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAA/B,CAA+B,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, ITextureInfo } from \"../glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { GLTFLoader } from \"../glTFLoader\";\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\nimport { IKHRMaterialsSheen } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_sheen\";\n\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_sheen/README.md)\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)\n */\nexport class KHR_materials_sheen 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 = 190;\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<IKHRMaterialsSheen>(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._loadSheenPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n\n private _loadSheenPropertiesAsync(context: string, properties: IKHRMaterialsSheen, 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.sheen.isEnabled = true;\n babylonMaterial.sheen.intensity = 1;\n\n if (properties.sheenColorFactor != undefined) {\n babylonMaterial.sheen.color = Color3.FromArray(properties.sheenColorFactor);\n }\n else {\n babylonMaterial.sheen.color = Color3.Black();\n }\n\n if (properties.sheenColorTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/sheenColorTexture`, properties.sheenColorTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Sheen Color)`;\n babylonMaterial.sheen.texture = texture;\n }));\n }\n\n if (properties.sheenRoughnessFactor !== undefined) {\n babylonMaterial.sheen.roughness = properties.sheenRoughnessFactor;\n } else {\n babylonMaterial.sheen.roughness = 0;\n }\n\n if (properties.sheenRoughnessTexture) {\n (properties.sheenRoughnessTexture as ITextureInfo).nonColorData = true;\n promises.push(this._loader.loadTextureInfoAsync(`${context}/sheenRoughnessTexture`, properties.sheenRoughnessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Sheen Roughness)`;\n babylonMaterial.sheen.textureRoughness = texture;\n }));\n }\n\n babylonMaterial.sheen.albedoScaling = true;\n babylonMaterial.sheen.useRoughnessFromMainTexture = false;\n\n return Promise.all(promises).then(() => { });\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_sheen(loader));"]}
@@ -4,8 +4,7 @@ import { IMaterial } from "../glTFLoaderInterfaces";
4
4
  import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
5
5
  import { GLTFLoader } from "../glTFLoader";
6
6
  /**
7
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1719)
8
- * !!! Experimental Extension Subject to Changes !!!
7
+ * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular)
9
8
  */
10
9
  export declare class KHR_materials_specular implements IGLTFLoaderExtension {
11
10
  /**
@@ -1,10 +1,9 @@
1
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial";
2
- import { GLTFLoader } from "../glTFLoader";
3
- import { Color3 } from '@babylonjs/core/Maths/math.color';
1
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
+ import { GLTFLoader } from "../glTFLoader.js";
3
+ import { Color3 } from '@babylonjs/core/Maths/math.color.js';
4
4
  var NAME = "KHR_materials_specular";
5
5
  /**
6
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1719)
7
- * !!! Experimental Extension Subject to Changes !!!
6
+ * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular)
8
7
  */
9
8
  var KHR_materials_specular = /** @class */ (function () {
10
9
  /** @hidden */
@@ -48,8 +47,15 @@ var KHR_materials_specular = /** @class */ (function () {
48
47
  if (properties.specularTexture) {
49
48
  properties.specularTexture.nonColorData = true;
50
49
  promises.push(this._loader.loadTextureInfoAsync(context + "/specularTexture", properties.specularTexture, function (texture) {
51
- texture.name = babylonMaterial.name + " (Specular F0 Color)";
50
+ texture.name = babylonMaterial.name + " (Specular F0 Strength)";
52
51
  babylonMaterial.metallicReflectanceTexture = texture;
52
+ babylonMaterial.useOnlyMetallicFromMetallicReflectanceTexture = true;
53
+ }));
54
+ }
55
+ if (properties.specularColorTexture) {
56
+ promises.push(this._loader.loadTextureInfoAsync(context + "/specularColorTexture", properties.specularColorTexture, function (texture) {
57
+ texture.name = babylonMaterial.name + " (Specular F0 Color)";
58
+ babylonMaterial.reflectanceTexture = texture;
53
59
  }));
54
60
  }
55
61
  return Promise.all(promises).then(function () { });
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_materials_specular.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/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E,UAAiC,EAAE,eAAyB;QAC9G,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAI,OAAO,kCAA+B,CAAC,CAAC;SAC9D;QAED,IAAM,QAAQ,GAAG,IAAI,KAAK,EAAgB,CAAC;QAE3C,IAAI,UAAU,CAAC,cAAc,KAAK,SAAS,EAAE;YACzC,eAAe,CAAC,gBAAgB,GAAG,UAAU,CAAC,cAAc,CAAC;SAChE;QAED,IAAI,UAAU,CAAC,mBAAmB,KAAK,SAAS,EAAE;YAC9C,eAAe,CAAC,wBAAwB,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;SAC/F;QAED,IAAI,UAAU,CAAC,eAAe,EAAE;YAC3B,UAAU,CAAC,eAAgC,CAAC,YAAY,GAAG,IAAI,CAAC;YACjE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAI,OAAO,qBAAkB,EAAE,UAAU,CAAC,eAAe,EAAE,UAAC,OAAO;gBAC9G,OAAO,CAAC,IAAI,GAAM,eAAe,CAAC,IAAI,yBAAsB,CAAC;gBAC7D,eAAe,CAAC,0BAA0B,GAAG,OAAO,CAAC;YACzD,CAAC,CAAC,CAAC,CAAC;SACP;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,cAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IACL,6BAAC;AAAD,CAAC,AAhED,IAgEC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAlC,CAAkC,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, ITextureInfo } from \"../glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { GLTFLoader } from \"../glTFLoader\";\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\nimport { IKHRMaterialsSpecular } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_specular\";\n\n/**\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1719)\n * !!! Experimental Extension Subject to Changes !!!\n */\nexport class KHR_materials_specular 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 = 190;\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<IKHRMaterialsSpecular>(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._loadSpecularPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n\n private _loadSpecularPropertiesAsync(context: string, properties: IKHRMaterialsSpecular, 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 if (properties.specularFactor !== undefined) {\n babylonMaterial.metallicF0Factor = properties.specularFactor;\n }\n\n if (properties.specularColorFactor !== undefined) {\n babylonMaterial.metallicReflectanceColor = Color3.FromArray(properties.specularColorFactor);\n }\n\n if (properties.specularTexture) {\n (properties.specularTexture as ITextureInfo).nonColorData = true;\n promises.push(this._loader.loadTextureInfoAsync(`${context}/specularTexture`, properties.specularTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Specular F0 Color)`;\n babylonMaterial.metallicReflectanceTexture = texture;\n }));\n }\n\n return Promise.all(promises).then(() => { });\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_specular(loader));"]}
1
+ {"version":3,"file":"KHR_materials_specular.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_specular.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D,IAAM,IAAI,GAAG,wBAAwB,CAAC;AAEtC;;GAEG;AACH;IAkBI,cAAc;IACd,gCAAY,MAAkB;QAlB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QAMf,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,wCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,cAAc;IACP,4DAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAOC;QANG,OAAO,UAAU,CAAC,kBAAkB,CAAwB,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YAClH,IAAM,QAAQ,GAAG,IAAI,KAAK,EAAgB,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAA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AAC,OAAO,CAAC,oBAAoB,CAAI,OAAO,0BAAuB,EAAE,UAAU,CAAC,oBAAoB,EAAE,UAAC,OAAO;gBACxH,OAAO,CAAC,IAAI,GAAM,eAAe,CAAC,IAAI,yBAAsB,CAAC;gBAC7D,eAAe,CAAC,kBAAkB,GAAG,OAAO,CAAC;YACjD,CAAC,CAAC,CAAC,CAAC;SACP;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,cAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IACL,6BAAC;AAAD,CAAC,AAxED,IAwEC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAlC,CAAkC,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, ITextureInfo } from \"../glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { GLTFLoader } from \"../glTFLoader\";\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\nimport { IKHRMaterialsSpecular } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_specular\";\n\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular)\n */\nexport class KHR_materials_specular 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 = 190;\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<IKHRMaterialsSpecular>(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._loadSpecularPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n\n private _loadSpecularPropertiesAsync(context: string, properties: IKHRMaterialsSpecular, 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 if (properties.specularFactor !== undefined) {\n babylonMaterial.metallicF0Factor = properties.specularFactor;\n }\n\n if (properties.specularColorFactor !== undefined) {\n babylonMaterial.metallicReflectanceColor = Color3.FromArray(properties.specularColorFactor);\n }\n\n if (properties.specularTexture) {\n (properties.specularTexture as ITextureInfo).nonColorData = true;\n promises.push(this._loader.loadTextureInfoAsync(`${context}/specularTexture`, properties.specularTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Specular F0 Strength)`;\n babylonMaterial.metallicReflectanceTexture = texture;\n babylonMaterial.useOnlyMetallicFromMetallicReflectanceTexture = true;\n }));\n }\n\n if (properties.specularColorTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/specularColorTexture`, properties.specularColorTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Specular F0 Color)`;\n babylonMaterial.reflectanceTexture = texture;\n }));\n }\n\n return Promise.all(promises).then(() => { });\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_specular(loader));"]}
@@ -1,5 +1,5 @@
1
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial";
2
- import { GLTFLoader } from "../glTFLoader";
1
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
2
+ import { GLTFLoader } from "../glTFLoader.js";
3
3
  var NAME = "KHR_materials_translucency";
4
4
  /**
5
5
  * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)
@@ -15,7 +15,7 @@ var KHR_materials_translucency = /** @class */ (function () {
15
15
  /**
16
16
  * Defines a number that determines the order the extensions are applied.
17
17
  */
18
- this.order = 175;
18
+ this.order = 174;
19
19
  this._loader = loader;
20
20
  this.enabled = this._loader.isExtensionUsed(NAME);
21
21
  if (this.enabled) {
@@ -50,7 +50,7 @@ var KHR_materials_translucency = /** @class */ (function () {
50
50
  pbrMaterial.subSurface.minimumThickness = 0.0;
51
51
  pbrMaterial.subSurface.maximumThickness = 0.0;
52
52
  // Albedo colour will tint transmission.
53
- pbrMaterial.subSurface.useAlbedoToTintRefraction = true;
53
+ pbrMaterial.subSurface.useAlbedoToTintTranslucency = true;
54
54
  if (extension.translucencyFactor !== undefined) {
55
55
  pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;
56
56
  }
@@ -60,10 +60,10 @@ var KHR_materials_translucency = /** @class */ (function () {
60
60
  return Promise.resolve();
61
61
  }
62
62
  if (extension.translucencyTexture) {
63
+ extension.translucencyTexture.nonColorData = true;
63
64
  return this._loader.loadTextureInfoAsync(context + "/translucencyTexture", extension.translucencyTexture)
64
65
  .then(function (texture) {
65
- pbrMaterial.subSurface.thicknessTexture = texture;
66
- pbrMaterial.subSurface.useMaskFromThicknessTextureGltf = true;
66
+ pbrMaterial.subSurface.translucencyIntensityTexture = texture;
67
67
  });
68
68
  }
69
69
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"KHR_materials_translucency.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_translucency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,4BAA4B,CAAC;AAE1C;;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AAC,AA/ED,IA+EC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAtC,CAAsC,CAAC,CAAC","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\nimport { Material } from \"@babylonjs/core/Materials/material\";\nimport { BaseTexture } from \"@babylonjs/core/Materials/Textures/baseTexture\";\nimport { IMaterial } from \"../glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { GLTFLoader } from \"../glTFLoader\";\nimport { IKHRMaterialsTranslucency } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_translucency\";\n\n/**\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)\n * !!! Experimental Extension Subject to Changes !!!\n */\nexport class KHR_materials_translucency 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 = 175;\n\n private _loader: GLTFLoader;\n\n /** @hidden */\n constructor(loader: GLTFLoader) {\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n if (this.enabled) {\n loader.parent.transparencyAsCoverage = true;\n }\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<IKHRMaterialsTranslucency>(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._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\n return Promise.all(promises).then(() => { });\n });\n }\n\n private _loadTranslucentPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material, extension: IKHRMaterialsTranslucency): Promise<void> {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const pbrMaterial = babylonMaterial as PBRMaterial;\n\n // Enables \"translucency\" texture which represents diffusely-transmitted light.\n pbrMaterial.subSurface.isTranslucencyEnabled = true;\n\n // Since this extension models thin-surface transmission only, we must make the\n // internal IOR == 1.0 and set the thickness to 0.\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\n pbrMaterial.subSurface.minimumThickness = 0.0;\n pbrMaterial.subSurface.maximumThickness = 0.0;\n\n // Albedo colour will tint transmission.\n pbrMaterial.subSurface.useAlbedoToTintRefraction = true;\n\n if (extension.translucencyFactor !== undefined) {\n pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;\n } else {\n pbrMaterial.subSurface.translucencyIntensity = 0.0;\n pbrMaterial.subSurface.isTranslucencyEnabled = false;\n return Promise.resolve();\n }\n\n if (extension.translucencyTexture) {\n return this._loader.loadTextureInfoAsync(`${context}/translucencyTexture`, extension.translucencyTexture)\n .then((texture: BaseTexture) => {\n pbrMaterial.subSurface.thicknessTexture = texture;\n pbrMaterial.subSurface.useMaskFromThicknessTextureGltf = true;\n });\n } else {\n return Promise.resolve();\n }\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_translucency(loader));\n"]}
1
+ {"version":3,"file":"KHR_materials_translucency.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_materials_translucency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAKxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,4BAA4B,CAAC;AAE1C;;;GAGG;AACH;IAkBI,cAAc;IACd,oCAAY,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iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAtC,CAAsC,CAAC,CAAC","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\nimport { Material } from \"@babylonjs/core/Materials/material\";\nimport { BaseTexture } from \"@babylonjs/core/Materials/Textures/baseTexture\";\nimport { IMaterial, ITextureInfo } from \"../glTFLoaderInterfaces\";\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { GLTFLoader } from \"../glTFLoader\";\nimport { IKHRMaterialsTranslucency } from 'babylonjs-gltf2interface';\n\nconst NAME = \"KHR_materials_translucency\";\n\n/**\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)\n * !!! Experimental Extension Subject to Changes !!!\n */\nexport class KHR_materials_translucency 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 = 174;\n\n private _loader: GLTFLoader;\n\n /** @hidden */\n constructor(loader: GLTFLoader) {\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n if (this.enabled) {\n loader.parent.transparencyAsCoverage = true;\n }\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<IKHRMaterialsTranslucency>(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._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\n return Promise.all(promises).then(() => { });\n });\n }\n\n private _loadTranslucentPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material, extension: IKHRMaterialsTranslucency): Promise<void> {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const pbrMaterial = babylonMaterial as PBRMaterial;\n\n // Enables \"translucency\" texture which represents diffusely-transmitted light.\n pbrMaterial.subSurface.isTranslucencyEnabled = true;\n\n // Since this extension models thin-surface transmission only, we must make the\n // internal IOR == 1.0 and set the thickness to 0.\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\n pbrMaterial.subSurface.minimumThickness = 0.0;\n pbrMaterial.subSurface.maximumThickness = 0.0;\n\n // Albedo colour will tint transmission.\n pbrMaterial.subSurface.useAlbedoToTintTranslucency = true;\n\n if (extension.translucencyFactor !== undefined) {\n pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;\n } else {\n pbrMaterial.subSurface.translucencyIntensity = 0.0;\n pbrMaterial.subSurface.isTranslucencyEnabled = false;\n return Promise.resolve();\n }\n\n if (extension.translucencyTexture) {\n (extension.translucencyTexture as ITextureInfo).nonColorData = true;\n return this._loader.loadTextureInfoAsync(`${context}/translucencyTexture`, extension.translucencyTexture)\n .then((texture: BaseTexture) => {\n pbrMaterial.subSurface.translucencyIntensityTexture = texture;\n });\n } else {\n return Promise.resolve();\n }\n }\n}\n\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_translucency(loader));\n"]}