@babylonjs/loaders 5.0.0-alpha.5 → 5.0.0-alpha.53

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) 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 +17 -78
  8. package/OBJ/objFileLoader.js +55 -619
  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_ior.d.ts +1 -2
  45. package/glTF/2.0/Extensions/KHR_materials_ior.js +3 -4
  46. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  47. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +3 -4
  48. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
  49. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +0 -1
  50. package/glTF/2.0/Extensions/KHR_materials_sheen.js +3 -4
  51. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  52. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +1 -2
  53. package/glTF/2.0/Extensions/KHR_materials_specular.js +12 -6
  54. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  55. package/glTF/2.0/Extensions/KHR_materials_translucency.js +6 -6
  56. package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
  57. package/glTF/2.0/Extensions/KHR_materials_transmission.js +92 -84
  58. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  59. package/glTF/2.0/Extensions/KHR_materials_unlit.js +3 -3
  60. package/glTF/2.0/Extensions/KHR_materials_variants.js +86 -22
  61. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
  62. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +31 -0
  63. package/glTF/2.0/Extensions/KHR_materials_volume.js +79 -0
  64. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -0
  65. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +1 -1
  66. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +1 -2
  67. package/glTF/2.0/Extensions/KHR_texture_basisu.js +3 -4
  68. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
  69. package/glTF/2.0/Extensions/KHR_texture_transform.js +2 -2
  70. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +2 -2
  71. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +3 -3
  72. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
  73. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +6 -7
  74. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
  75. package/glTF/2.0/Extensions/MSFT_lod.d.ts +2 -1
  76. package/glTF/2.0/Extensions/MSFT_lod.js +48 -8
  77. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
  78. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +2 -2
  79. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +2 -2
  80. package/glTF/2.0/Extensions/index.d.ts +1 -0
  81. package/glTF/2.0/Extensions/index.js +25 -24
  82. package/glTF/2.0/Extensions/index.js.map +1 -1
  83. package/glTF/2.0/glTFLoader.d.ts +5 -10
  84. package/glTF/2.0/glTFLoader.js +125 -92
  85. package/glTF/2.0/glTFLoader.js.map +1 -1
  86. package/glTF/2.0/glTFLoaderInterfaces.d.ts +4 -2
  87. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
  88. package/glTF/2.0/index.d.ts +1 -1
  89. package/glTF/2.0/index.js +4 -4
  90. package/glTF/2.0/index.js.map +1 -1
  91. package/glTF/glTFFileLoader.d.ts +15 -9
  92. package/glTF/glTFFileLoader.js +62 -76
  93. package/glTF/glTFFileLoader.js.map +1 -1
  94. package/glTF/glTFValidation.js +1 -1
  95. package/glTF/glTFValidation.js.map +1 -1
  96. package/glTF/index.d.ts +2 -2
  97. package/glTF/index.js +4 -4
  98. package/glTF/index.js.map +1 -1
  99. package/index.d.ts +3 -3
  100. package/index.js +3 -3
  101. package/index.js.map +1 -1
  102. package/legacy/legacy-glTF.js +4 -4
  103. package/legacy/legacy-glTF1.d.ts +1 -1
  104. package/legacy/legacy-glTF1.js +1 -1
  105. package/legacy/legacy-glTF1.js.map +1 -1
  106. package/legacy/legacy-glTF1FileLoader.js +2 -2
  107. package/legacy/legacy-glTF2.d.ts +1 -1
  108. package/legacy/legacy-glTF2.js +3 -3
  109. package/legacy/legacy-glTF2.js.map +1 -1
  110. package/legacy/legacy-glTF2FileLoader.js +2 -2
  111. package/legacy/legacy-glTFFileLoader.js +3 -3
  112. package/legacy/legacy-objFileLoader.d.ts +1 -1
  113. package/legacy/legacy-objFileLoader.js +2 -2
  114. package/legacy/legacy-objFileLoader.js.map +1 -1
  115. package/legacy/legacy-stlFileLoader.d.ts +1 -1
  116. package/legacy/legacy-stlFileLoader.js +2 -2
  117. package/legacy/legacy-stlFileLoader.js.map +1 -1
  118. package/legacy/legacy.js +6 -6
  119. package/package.json +13 -4
@@ -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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,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 * [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/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,EAAE,eAAyB;QAAlG,iBAQC;QAPG,OAAO,UAAU,CAAC,kBAAkB,CAAqC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YAC/H,IAAM,QAAQ,GAAG,IAAI,KAAK,EAAgB,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAChG,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,sCAAsC,CAAC,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EA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AC,oBAAoB,CAAI,OAAO,oBAAiB,EAAE,UAAU,CAAC,cAAc,EAAE,UAAC,OAAO;gBAC5G,OAAO,CAAC,IAAI,GAAM,eAAe,CAAC,IAAI,eAAY,CAAC;gBACnD,eAAe,CAAC,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,CA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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));"]}
@@ -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,CAA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iB,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 * !!! 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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AAK,CAAC,aAAa,GAAG,IAAI,CAAC;QAC3C,eAAe,CAAC,KAAK,CAAC,2BAA2B,GAAG,KAAK,CAAC;QAE1D,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,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/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;;;GAGG;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,eAAe,CAAC,CAAC,CAAC;YAC5F,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,4BAA4B,CAAC,gBAAgB,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;YAC/F,OAA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,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,S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BACrD,eAAe,CAAC,6CAA6C,GAAG,IAAI,CAAC;YACzE,CAAC,CAAC,CAAC,CAAC;SACP;QAED,IAAI,UAAU,CAAC,oBAAoB,EAAE;YACjC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,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":[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AC,UAAU,CAAC,+BAA+B,GAAG,IAAI,CAAC;YAClE,CAAC,CAAC,CAAC;SACV;aAAM;YACH,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC5B;IACL,CAAC;IACL,iCAAC;AAAD,CAAC,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,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AAC;YAClE,CAAC,CAAC,CAAC;SACV;aAAM;YACH,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC5B;IACL,CAAC;IACL,iCAAC;AAAD,CAAC,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, 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"]}
@@ -1,9 +1,10 @@
1
1
  import { __assign } from "tslib";
2
- import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial";
3
- import { GLTFLoader } from "../glTFLoader";
4
- import { Mesh } from "@babylonjs/core/Meshes/mesh";
5
- import { RenderTargetTexture } from "@babylonjs/core/Materials/Textures/renderTargetTexture";
6
- import { Observable } from "@babylonjs/core/Misc/observable";
2
+ import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
3
+ import { GLTFLoader } from "../glTFLoader.js";
4
+ import { RenderTargetTexture } from "@babylonjs/core/Materials/Textures/renderTargetTexture.js";
5
+ import { Observable } from "@babylonjs/core/Misc/observable.js";
6
+ import { Constants } from "@babylonjs/core/Engines/constants.js";
7
+ import { Tools } from "@babylonjs/core/Misc/tools.js";
7
8
  /**
8
9
  * A class to handle setting up the rendering of opaque objects to be shown through transmissive objects.
9
10
  */
@@ -18,6 +19,7 @@ var TransmissionHelper = /** @class */ (function () {
18
19
  this._opaqueRenderTarget = null;
19
20
  this._opaqueMeshesCache = [];
20
21
  this._transparentMeshesCache = [];
22
+ this._materialObservers = {};
21
23
  this._options = __assign(__assign({}, TransmissionHelper._getDefaultOptions()), options);
22
24
  this._scene = scene;
23
25
  this._scene._transmissionHelper = this;
@@ -33,7 +35,12 @@ var TransmissionHelper = /** @class */ (function () {
33
35
  */
34
36
  TransmissionHelper._getDefaultOptions = function () {
35
37
  return {
36
- renderSize: 1024
38
+ renderSize: 1024,
39
+ samples: 4,
40
+ lodGenerationScale: 1,
41
+ lodGenerationOffset: -4,
42
+ renderTargetTextureType: Constants.TEXTURETYPE_HALF_FLOAT,
43
+ generateMipmaps: true,
37
44
  };
38
45
  };
39
46
  /**
@@ -51,9 +58,14 @@ var TransmissionHelper = /** @class */ (function () {
51
58
  var oldOptions = this._options;
52
59
  this._options = newOptions;
53
60
  // If size changes, recreate everything
54
- if (newOptions.renderSize !== oldOptions.renderSize) {
61
+ if (newOptions.renderSize !== oldOptions.renderSize || newOptions.renderTargetTextureType !== oldOptions.renderTargetTextureType || newOptions.generateMipmaps !== oldOptions.generateMipmaps || !this._opaqueRenderTarget) {
55
62
  this._setupRenderTargets();
56
63
  }
64
+ else {
65
+ this._opaqueRenderTarget.samples = newOptions.samples;
66
+ this._opaqueRenderTarget.lodGenerationScale = newOptions.lodGenerationScale;
67
+ this._opaqueRenderTarget.lodGenerationOffset = newOptions.lodGenerationOffset;
68
+ }
57
69
  };
58
70
  TransmissionHelper.prototype.getOpaqueTarget = function () {
59
71
  return this._opaqueRenderTarget;
@@ -68,27 +80,30 @@ var TransmissionHelper = /** @class */ (function () {
68
80
  return false;
69
81
  };
70
82
  TransmissionHelper.prototype._addMesh = function (mesh) {
71
- if (mesh instanceof Mesh) {
72
- mesh.onMaterialChangedObservable.add(this.onMeshMaterialChanged.bind(this));
73
- if (this.shouldRenderAsTransmission(mesh.material)) {
74
- this._transparentMeshesCache.push(mesh);
83
+ var _this = this;
84
+ this._materialObservers[mesh.uniqueId] = mesh.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this));
85
+ // we need to defer the processing because _addMesh may be called as part as an instance mesh creation, in which case some
86
+ // internal properties are not setup yet, like _sourceMesh (needed when doing mesh.material below)
87
+ Tools.SetImmediate(function () {
88
+ if (_this.shouldRenderAsTransmission(mesh.material)) {
89
+ mesh.material.refractionTexture = _this._opaqueRenderTarget;
90
+ _this._transparentMeshesCache.push(mesh);
75
91
  }
76
92
  else {
77
- this._opaqueMeshesCache.push(mesh);
93
+ _this._opaqueMeshesCache.push(mesh);
78
94
  }
79
- }
95
+ });
80
96
  };
81
97
  TransmissionHelper.prototype._removeMesh = function (mesh) {
82
- if (mesh instanceof Mesh) {
83
- mesh.onMaterialChangedObservable.remove(this.onMeshMaterialChanged.bind(this));
84
- var idx = this._transparentMeshesCache.indexOf(mesh);
85
- if (idx !== -1) {
86
- this._transparentMeshesCache.splice(idx, 1);
87
- }
88
- idx = this._opaqueMeshesCache.indexOf(mesh);
89
- if (idx !== -1) {
90
- this._opaqueMeshesCache.splice(idx, 1);
91
- }
98
+ mesh.onMaterialChangedObservable.remove(this._materialObservers[mesh.uniqueId]);
99
+ delete this._materialObservers[mesh.uniqueId];
100
+ var idx = this._transparentMeshesCache.indexOf(mesh);
101
+ if (idx !== -1) {
102
+ this._transparentMeshesCache.splice(idx, 1);
103
+ }
104
+ idx = this._opaqueMeshesCache.indexOf(mesh);
105
+ if (idx !== -1) {
106
+ this._opaqueMeshesCache.splice(idx, 1);
92
107
  }
93
108
  };
94
109
  TransmissionHelper.prototype._parseScene = function () {
@@ -99,33 +114,31 @@ var TransmissionHelper = /** @class */ (function () {
99
114
  this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this));
100
115
  };
101
116
  // When one of the meshes in the scene has its material changed, make sure that it's in the correct cache list.
102
- TransmissionHelper.prototype.onMeshMaterialChanged = function (mesh) {
103
- if (mesh instanceof Mesh) {
104
- var transparentIdx = this._transparentMeshesCache.indexOf(mesh);
105
- var opaqueIdx = this._opaqueMeshesCache.indexOf(mesh);
106
- // If the material is transparent, make sure that it's added to the transparent list and removed from the opaque list
107
- var useTransmission = this.shouldRenderAsTransmission(mesh.material);
108
- if (useTransmission) {
109
- if (mesh.material instanceof PBRMaterial) {
110
- mesh.material.subSurface.refractionTexture = this._opaqueRenderTarget;
111
- }
112
- if (opaqueIdx !== -1) {
113
- this._opaqueMeshesCache.splice(opaqueIdx, 1);
114
- this._transparentMeshesCache.push(mesh);
115
- }
116
- else if (transparentIdx === -1) {
117
- this._transparentMeshesCache.push(mesh);
118
- }
119
- // If the material is opaque, make sure that it's added to the opaque list and removed from the transparent list
117
+ TransmissionHelper.prototype._onMeshMaterialChanged = function (mesh) {
118
+ var transparentIdx = this._transparentMeshesCache.indexOf(mesh);
119
+ var opaqueIdx = this._opaqueMeshesCache.indexOf(mesh);
120
+ // If the material is transparent, make sure that it's added to the transparent list and removed from the opaque list
121
+ var useTransmission = this.shouldRenderAsTransmission(mesh.material);
122
+ if (useTransmission) {
123
+ if (mesh.material instanceof PBRMaterial) {
124
+ mesh.material.subSurface.refractionTexture = this._opaqueRenderTarget;
120
125
  }
121
- else {
122
- if (transparentIdx !== -1) {
123
- this._transparentMeshesCache.splice(transparentIdx, 1);
124
- this._opaqueMeshesCache.push(mesh);
125
- }
126
- else if (opaqueIdx === -1) {
127
- this._opaqueMeshesCache.push(mesh);
128
- }
126
+ if (opaqueIdx !== -1) {
127
+ this._opaqueMeshesCache.splice(opaqueIdx, 1);
128
+ this._transparentMeshesCache.push(mesh);
129
+ }
130
+ else if (transparentIdx === -1) {
131
+ this._transparentMeshesCache.push(mesh);
132
+ }
133
+ // If the material is opaque, make sure that it's added to the opaque list and removed from the transparent list
134
+ }
135
+ else {
136
+ if (transparentIdx !== -1) {
137
+ this._transparentMeshesCache.splice(transparentIdx, 1);
138
+ this._opaqueMeshesCache.push(mesh);
139
+ }
140
+ else if (opaqueIdx === -1) {
141
+ this._opaqueMeshesCache.push(mesh);
129
142
  }
130
143
  }
131
144
  };
@@ -134,45 +147,38 @@ var TransmissionHelper = /** @class */ (function () {
134
147
  */
135
148
  TransmissionHelper.prototype._setupRenderTargets = function () {
136
149
  var _this = this;
137
- var opaqueRTIndex = -1;
138
- // Remove any layers rendering to the opaque scene.
139
- if (this._scene.layers && this._opaqueRenderTarget) {
140
- for (var _i = 0, _a = this._scene.layers; _i < _a.length; _i++) {
141
- var layer = _a[_i];
142
- var idx = layer.renderTargetTextures.indexOf(this._opaqueRenderTarget);
143
- if (idx >= 0) {
144
- layer.renderTargetTextures.splice(idx, 1);
145
- }
146
- }
147
- }
148
- // Remove opaque render target
150
+ var _a, _b;
149
151
  if (this._opaqueRenderTarget) {
150
- opaqueRTIndex = this._scene.customRenderTargets.indexOf(this._opaqueRenderTarget);
151
152
  this._opaqueRenderTarget.dispose();
152
153
  }
153
- this._opaqueRenderTarget = new RenderTargetTexture("opaqueSceneTexture", this._options.renderSize, this._scene, true);
154
+ this._opaqueRenderTarget = new RenderTargetTexture("opaqueSceneTexture", this._options.renderSize, this._scene, this._options.generateMipmaps, undefined, this._options.renderTargetTextureType);
155
+ this._opaqueRenderTarget.ignoreCameraViewport = true;
154
156
  this._opaqueRenderTarget.renderList = this._opaqueMeshesCache;
155
- // this._opaqueRenderTarget.clearColor = new Color4(0.0, 0.0, 0.0, 0.0);
156
- this._opaqueRenderTarget.gammaSpace = true;
157
- this._opaqueRenderTarget.lodGenerationScale = 1;
158
- this._opaqueRenderTarget.lodGenerationOffset = -4;
159
- this._opaqueRenderTarget.samples = 4;
160
- if (opaqueRTIndex >= 0) {
161
- this._scene.customRenderTargets.splice(opaqueRTIndex, 0, this._opaqueRenderTarget);
162
- }
163
- else {
164
- opaqueRTIndex = this._scene.customRenderTargets.length;
165
- this._scene.customRenderTargets.push(this._opaqueRenderTarget);
166
- }
167
- // If there are other layers, they should be included in the render of the opaque background.
168
- if (this._scene.layers && this._opaqueRenderTarget) {
169
- for (var _b = 0, _c = this._scene.layers; _b < _c.length; _b++) {
170
- var layer = _c[_b];
171
- layer.renderTargetTextures.push(this._opaqueRenderTarget);
157
+ this._opaqueRenderTarget.clearColor = (_b = (_a = this._options.clearColor) === null || _a === void 0 ? void 0 : _a.clone()) !== null && _b !== void 0 ? _b : this._scene.clearColor.clone();
158
+ this._opaqueRenderTarget.gammaSpace = false;
159
+ this._opaqueRenderTarget.lodGenerationScale = this._options.lodGenerationScale;
160
+ this._opaqueRenderTarget.lodGenerationOffset = this._options.lodGenerationOffset;
161
+ this._opaqueRenderTarget.samples = this._options.samples;
162
+ var sceneImageProcessingapplyByPostProcess;
163
+ var saveSceneEnvIntensity;
164
+ this._opaqueRenderTarget.onBeforeBindObservable.add(function (opaqueRenderTarget) {
165
+ saveSceneEnvIntensity = _this._scene.environmentIntensity;
166
+ _this._scene.environmentIntensity = 1.0;
167
+ sceneImageProcessingapplyByPostProcess = _this._scene.imageProcessingConfiguration.applyByPostProcess;
168
+ if (!_this._options.clearColor) {
169
+ _this._scene.clearColor.toLinearSpaceToRef(opaqueRenderTarget.clearColor);
172
170
  }
173
- }
171
+ else {
172
+ opaqueRenderTarget.clearColor.copyFrom(_this._options.clearColor);
173
+ }
174
+ _this._scene.imageProcessingConfiguration.applyByPostProcess = true;
175
+ });
176
+ this._opaqueRenderTarget.onAfterUnbindObservable.add(function () {
177
+ _this._scene.environmentIntensity = saveSceneEnvIntensity;
178
+ _this._scene.imageProcessingConfiguration.applyByPostProcess = sceneImageProcessingapplyByPostProcess;
179
+ });
174
180
  this._transparentMeshesCache.forEach(function (mesh) {
175
- if (_this.shouldRenderAsTransmission(mesh.material) && mesh.material instanceof PBRMaterial) {
181
+ if (_this.shouldRenderAsTransmission(mesh.material)) {
176
182
  mesh.material.refractionTexture = _this._opaqueRenderTarget;
177
183
  }
178
184
  });
@@ -250,12 +256,14 @@ var KHR_materials_transmission = /** @class */ (function () {
250
256
  pbrMaterial.subSurface.isRefractionEnabled = false;
251
257
  return Promise.resolve();
252
258
  }
259
+ pbrMaterial.subSurface.minimumThickness = 0.0;
260
+ pbrMaterial.subSurface.maximumThickness = 0.0;
253
261
  if (extension.transmissionTexture) {
254
262
  extension.transmissionTexture.nonColorData = true;
255
263
  return this._loader.loadTextureInfoAsync(context + "/transmissionTexture", extension.transmissionTexture, undefined)
256
264
  .then(function (texture) {
257
- pbrMaterial.subSurface.thicknessTexture = texture;
258
- pbrMaterial.subSurface.useMaskFromThicknessTextureGltf = true;
265
+ pbrMaterial.subSurface.refractionIntensityTexture = texture;
266
+ pbrMaterial.subSurface.useGltfStyleTextures = true;
259
267
  });
260
268
  }
261
269
  else {