@graphty/graphty-element 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +1 -1
  2. package/dist/{basisTextureLoader-BqIvxvNl.js → basisTextureLoader-YJHdQGdC.js} +2 -2
  3. package/dist/{basisTextureLoader-BqIvxvNl.js.map → basisTextureLoader-YJHdQGdC.js.map} +1 -1
  4. package/dist/{dds-BlAaKjyJ.js → dds-DQLf_hLn.js} +2 -2
  5. package/dist/{dds-BlAaKjyJ.js.map → dds-DQLf_hLn.js.map} +1 -1
  6. package/dist/{ddsTextureLoader-D7Jh83wc.js → ddsTextureLoader-lj5EmdyW.js} +3 -3
  7. package/dist/{ddsTextureLoader-D7Jh83wc.js.map → ddsTextureLoader-lj5EmdyW.js.map} +1 -1
  8. package/dist/{default.fragment-CSeCDRwv.js → default.fragment-Blpb62wl.js} +6 -6
  9. package/dist/{default.fragment-CSeCDRwv.js.map → default.fragment-Blpb62wl.js.map} +1 -1
  10. package/dist/{default.fragment-BNc4beoN.js → default.fragment-BqlvuhH_.js} +6 -6
  11. package/dist/{default.fragment-BNc4beoN.js.map → default.fragment-BqlvuhH_.js.map} +1 -1
  12. package/dist/{default.vertex-9pBFrn06.js → default.vertex-BibOEUcC.js} +7 -7
  13. package/dist/{default.vertex-9pBFrn06.js.map → default.vertex-BibOEUcC.js.map} +1 -1
  14. package/dist/{default.vertex-DDjK1DRv.js → default.vertex-Dblk9O84.js} +7 -7
  15. package/dist/{default.vertex-DDjK1DRv.js.map → default.vertex-Dblk9O84.js.map} +1 -1
  16. package/dist/{defaultUboDeclaration-Ct5CiQ-w.js → defaultUboDeclaration-CO0hcGNU.js} +3 -3
  17. package/dist/{defaultUboDeclaration-Ct5CiQ-w.js.map → defaultUboDeclaration-CO0hcGNU.js.map} +1 -1
  18. package/dist/{defaultUboDeclaration-CG47IDRY.js → defaultUboDeclaration-D2cHxVkr.js} +3 -3
  19. package/dist/{defaultUboDeclaration-CG47IDRY.js.map → defaultUboDeclaration-D2cHxVkr.js.map} +1 -1
  20. package/dist/{dumpTools-DA1xMSIZ.js → dumpTools-DryVPnxm.js} +4 -4
  21. package/dist/{dumpTools-DA1xMSIZ.js.map → dumpTools-DryVPnxm.js.map} +1 -1
  22. package/dist/{envTextureLoader-DdCLpySN.js → envTextureLoader-zUp-sm34.js} +4 -4
  23. package/dist/{envTextureLoader-DdCLpySN.js.map → envTextureLoader-zUp-sm34.js.map} +1 -1
  24. package/dist/{exrTextureLoader-CnJSRQ9w.js → exrTextureLoader-CWNwDbqP.js} +2 -2
  25. package/dist/{exrTextureLoader-CnJSRQ9w.js.map → exrTextureLoader-CWNwDbqP.js.map} +1 -1
  26. package/dist/graphty.js +1 -1
  27. package/dist/{greasedLine.fragment-DixuqXus.js → greasedLine.fragment-BtdnWwPJ.js} +2 -2
  28. package/dist/{greasedLine.fragment-DixuqXus.js.map → greasedLine.fragment-BtdnWwPJ.js.map} +1 -1
  29. package/dist/{greasedLine.fragment-BZnGGe-r.js → greasedLine.fragment-DakXbZDt.js} +2 -2
  30. package/dist/{greasedLine.fragment-BZnGGe-r.js.map → greasedLine.fragment-DakXbZDt.js.map} +1 -1
  31. package/dist/{greasedLine.vertex-BhhwFKPy.js → greasedLine.vertex-DbhEvmnm.js} +3 -3
  32. package/dist/{greasedLine.vertex-BhhwFKPy.js.map → greasedLine.vertex-DbhEvmnm.js.map} +1 -1
  33. package/dist/{greasedLine.vertex-DIhgGSOi.js → greasedLine.vertex-Lh32HaiU.js} +4 -4
  34. package/dist/{greasedLine.vertex-DIhgGSOi.js.map → greasedLine.vertex-Lh32HaiU.js.map} +1 -1
  35. package/dist/{harmonicsFunctions-B9jTNKTF.js → harmonicsFunctions-Bki1gBZd.js} +3 -3
  36. package/dist/{harmonicsFunctions-B9jTNKTF.js.map → harmonicsFunctions-Bki1gBZd.js.map} +1 -1
  37. package/dist/{harmonicsFunctions-D9ZL5yLA.js → harmonicsFunctions-CjRTo-m9.js} +3 -3
  38. package/dist/{harmonicsFunctions-D9ZL5yLA.js.map → harmonicsFunctions-CjRTo-m9.js.map} +1 -1
  39. package/dist/{hdrTextureLoader-DreWCvHD.js → hdrTextureLoader-CLKfu37v.js} +2 -2
  40. package/dist/{hdrTextureLoader-DreWCvHD.js.map → hdrTextureLoader-CLKfu37v.js.map} +1 -1
  41. package/dist/{helperFunctions-Dh1WD8YN.js → helperFunctions-CQxHHy8r.js} +2 -2
  42. package/dist/{helperFunctions-Dh1WD8YN.js.map → helperFunctions-CQxHHy8r.js.map} +1 -1
  43. package/dist/{helperFunctions-ZBnqb-in.js → helperFunctions-TtJlWReK.js} +2 -2
  44. package/dist/{helperFunctions-ZBnqb-in.js.map → helperFunctions-TtJlWReK.js.map} +1 -1
  45. package/dist/{iesTextureLoader-JdfAyRK-.js → iesTextureLoader-BcJl2Arq.js} +2 -2
  46. package/dist/{iesTextureLoader-JdfAyRK-.js.map → iesTextureLoader-BcJl2Arq.js.map} +1 -1
  47. package/dist/{index-ChGTkj2q.js → index-DM3Dwe0V.js} +16 -16
  48. package/dist/{index-ChGTkj2q.js.map → index-DM3Dwe0V.js.map} +1 -1
  49. package/dist/{instancesVertex-evcSIvCA.js → instancesVertex-Dr04ZqKw.js} +2 -2
  50. package/dist/{instancesVertex-evcSIvCA.js.map → instancesVertex-Dr04ZqKw.js.map} +1 -1
  51. package/dist/{instancesVertex-BrWNnWxF.js → instancesVertex-DzC88b5Z.js} +2 -2
  52. package/dist/{instancesVertex-BrWNnWxF.js.map → instancesVertex-DzC88b5Z.js.map} +1 -1
  53. package/dist/{ktxTextureLoader-Dg1h0a-4.js → ktxTextureLoader-O794CBz4.js} +2 -2
  54. package/dist/{ktxTextureLoader-Dg1h0a-4.js.map → ktxTextureLoader-O794CBz4.js.map} +1 -1
  55. package/dist/{logDepthDeclaration-BHUUDd5l.js → logDepthDeclaration--8Jq3fys.js} +2 -2
  56. package/dist/{logDepthDeclaration-BHUUDd5l.js.map → logDepthDeclaration--8Jq3fys.js.map} +1 -1
  57. package/dist/{logDepthDeclaration-Bou5AJOP.js → logDepthDeclaration-DcveQRTq.js} +2 -2
  58. package/dist/{logDepthDeclaration-Bou5AJOP.js.map → logDepthDeclaration-DcveQRTq.js.map} +1 -1
  59. package/dist/{logDepthVertex-r_niddz9.js → logDepthVertex-BiWlUDke.js} +2 -2
  60. package/dist/{logDepthVertex-r_niddz9.js.map → logDepthVertex-BiWlUDke.js.map} +1 -1
  61. package/dist/{logDepthVertex-CCFGLExi.js → logDepthVertex-CYjRNQ1d.js} +2 -2
  62. package/dist/{logDepthVertex-CCFGLExi.js.map → logDepthVertex-CYjRNQ1d.js.map} +1 -1
  63. package/dist/{meshUboDeclaration-Dg__Mhmj.js → meshUboDeclaration-BmcefUDK.js} +2 -2
  64. package/dist/{meshUboDeclaration-Dg__Mhmj.js.map → meshUboDeclaration-BmcefUDK.js.map} +1 -1
  65. package/dist/{oitFragment-Bn29Ggvj.js → oitFragment-DP-aFNyo.js} +2 -2
  66. package/dist/{oitFragment-Bn29Ggvj.js.map → oitFragment-DP-aFNyo.js.map} +1 -1
  67. package/dist/{oitFragment-D6JBEGk0.js → oitFragment-DzgaBzc0.js} +2 -2
  68. package/dist/{oitFragment-D6JBEGk0.js.map → oitFragment-DzgaBzc0.js.map} +1 -1
  69. package/dist/{pass.fragment-Cf0ob1Y3.js → pass.fragment-DoZCyELK.js} +2 -2
  70. package/dist/{pass.fragment-Cf0ob1Y3.js.map → pass.fragment-DoZCyELK.js.map} +1 -1
  71. package/dist/{pass.fragment-C9O4ZLJL.js → pass.fragment-DxSTcWpC.js} +2 -2
  72. package/dist/{pass.fragment-C9O4ZLJL.js.map → pass.fragment-DxSTcWpC.js.map} +1 -1
  73. package/dist/{passCube.fragment-uM4B7TOI.js → passCube.fragment-Dv4FB3Ug.js} +2 -2
  74. package/dist/{passCube.fragment-uM4B7TOI.js.map → passCube.fragment-Dv4FB3Ug.js.map} +1 -1
  75. package/dist/{passCube.fragment-Mg8Qj5T9.js → passCube.fragment-nsqY0ZtC.js} +2 -2
  76. package/dist/{passCube.fragment-Mg8Qj5T9.js.map → passCube.fragment-nsqY0ZtC.js.map} +1 -1
  77. package/dist/{pbr.fragment-C8Lm3cwF.js → pbr.fragment-B13QduZT.js} +6 -6
  78. package/dist/{pbr.fragment-C8Lm3cwF.js.map → pbr.fragment-B13QduZT.js.map} +1 -1
  79. package/dist/{pbr.fragment-siOdCYqI.js → pbr.fragment-B6tx_cvK.js} +6 -6
  80. package/dist/{pbr.fragment-siOdCYqI.js.map → pbr.fragment-B6tx_cvK.js.map} +1 -1
  81. package/dist/{pbr.vertex-CmEPCcBW.js → pbr.vertex-CA7bnQjU.js} +7 -7
  82. package/dist/{pbr.vertex-CmEPCcBW.js.map → pbr.vertex-CA7bnQjU.js.map} +1 -1
  83. package/dist/{pbr.vertex-Bw_TrGQv.js → pbr.vertex-DW6iNOI2.js} +7 -7
  84. package/dist/{pbr.vertex-Bw_TrGQv.js.map → pbr.vertex-DW6iNOI2.js.map} +1 -1
  85. package/dist/{postprocess.vertex-B086G8mM.js → postprocess.vertex-DZzYDZfo.js} +2 -2
  86. package/dist/{postprocess.vertex-B086G8mM.js.map → postprocess.vertex-DZzYDZfo.js.map} +1 -1
  87. package/dist/{rgbdDecode.fragment-bNaGtQ-x.js → rgbdDecode.fragment-CAcs2JmP.js} +3 -3
  88. package/dist/{rgbdDecode.fragment-bNaGtQ-x.js.map → rgbdDecode.fragment-CAcs2JmP.js.map} +1 -1
  89. package/dist/{rgbdDecode.fragment-koAcppx0.js → rgbdDecode.fragment-E4n4lu8J.js} +3 -3
  90. package/dist/{rgbdDecode.fragment-koAcppx0.js.map → rgbdDecode.fragment-E4n4lu8J.js.map} +1 -1
  91. package/dist/{rgbdEncode.fragment-BDHL2P_i.js → rgbdEncode.fragment-CgYUAa43.js} +3 -3
  92. package/dist/{rgbdEncode.fragment-BDHL2P_i.js.map → rgbdEncode.fragment-CgYUAa43.js.map} +1 -1
  93. package/dist/{rgbdEncode.fragment-Dw0FS9aH.js → rgbdEncode.fragment-DCdpffcW.js} +3 -3
  94. package/dist/{rgbdEncode.fragment-Dw0FS9aH.js.map → rgbdEncode.fragment-DCdpffcW.js.map} +1 -1
  95. package/dist/{tgaTextureLoader-DIfkfgQh.js → tgaTextureLoader-DPWaEGJH.js} +2 -2
  96. package/dist/{tgaTextureLoader-DIfkfgQh.js.map → tgaTextureLoader-DPWaEGJH.js.map} +1 -1
  97. package/package.json +9 -5
@@ -1,4 +1,4 @@
1
- import { S as e } from "./index-ChGTkj2q.js";
1
+ import { S as e } from "./index-DM3Dwe0V.js";
2
2
  const d = "instancesDeclaration", r = `#ifdef INSTANCES
3
3
  attribute world0 : vec4<f32>;attribute world1 : vec4<f32>;attribute world2 : vec4<f32>;attribute world3 : vec4<f32>;
4
4
  #ifdef INSTANCESCOLOR
@@ -52,4 +52,4 @@ var finalPreviousWorld=uniforms.previousWorld;
52
52
  #endif
53
53
  `;
54
54
  e.IncludesShadersStoreWGSL[i] || (e.IncludesShadersStoreWGSL[i] = f);
55
- //# sourceMappingURL=instancesVertex-evcSIvCA.js.map
55
+ //# sourceMappingURL=instancesVertex-Dr04ZqKw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instancesVertex-evcSIvCA.js","sources":["../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/instancesDeclaration.js","../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/instancesVertex.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesDeclaration\";\nconst shader = `#ifdef INSTANCES\nattribute world0 : vec4<f32>;attribute world1 : vec4<f32>;attribute world2 : vec4<f32>;attribute world3 : vec4<f32>;\n#ifdef INSTANCESCOLOR\nattribute instanceColor : vec4<f32>;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform world : mat4x4<f32>;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nattribute previousWorld0 : vec4<f32>;attribute previousWorld1 : vec4<f32>;attribute previousWorld2 : vec4<f32>;attribute previousWorld3 : vec4<f32>;\n#ifdef THIN_INSTANCES\nuniform previousWorld : mat4x4<f32>;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform world : mat4x4<f32>;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nuniform previousWorld : mat4x4<f32>;\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const instancesDeclarationWGSL = { name, shader };\n//# sourceMappingURL=instancesDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesVertex\";\nconst shader = `#ifdef INSTANCES\nvar finalWorld=mat4x4<f32>(vertexInputs.world0,vertexInputs.world1,vertexInputs.world2,vertexInputs.world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nvar finalPreviousWorld=mat4x4<f32>(\nvertexInputs.previousWorld0,vertexInputs.previousWorld1,\nvertexInputs.previousWorld2,vertexInputs.previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\n#if !defined(WORLD_UBO)\nfinalWorld=uniforms.world*finalWorld;\n#else\nfinalWorld=mesh.world*finalWorld;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nfinalPreviousWorld=uniforms.previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nvar finalWorld=uniforms.world;\n#else\nvar finalWorld=mesh.world;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nvar finalPreviousWorld=uniforms.previousWorld;\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const instancesVertexWGSL = { name, shader };\n//# sourceMappingURL=instancesVertex.js.map"],"names":["name","shader","ShaderStore"],"mappings":";AAEA,MAAMA,IAAO,wBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;AC1BjD,MAAMD,IAAO,mBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"instancesVertex-Dr04ZqKw.js","sources":["../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/instancesDeclaration.js","../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/instancesVertex.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesDeclaration\";\nconst shader = `#ifdef INSTANCES\nattribute world0 : vec4<f32>;attribute world1 : vec4<f32>;attribute world2 : vec4<f32>;attribute world3 : vec4<f32>;\n#ifdef INSTANCESCOLOR\nattribute instanceColor : vec4<f32>;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform world : mat4x4<f32>;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nattribute previousWorld0 : vec4<f32>;attribute previousWorld1 : vec4<f32>;attribute previousWorld2 : vec4<f32>;attribute previousWorld3 : vec4<f32>;\n#ifdef THIN_INSTANCES\nuniform previousWorld : mat4x4<f32>;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform world : mat4x4<f32>;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nuniform previousWorld : mat4x4<f32>;\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const instancesDeclarationWGSL = { name, shader };\n//# sourceMappingURL=instancesDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesVertex\";\nconst shader = `#ifdef INSTANCES\nvar finalWorld=mat4x4<f32>(vertexInputs.world0,vertexInputs.world1,vertexInputs.world2,vertexInputs.world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nvar finalPreviousWorld=mat4x4<f32>(\nvertexInputs.previousWorld0,vertexInputs.previousWorld1,\nvertexInputs.previousWorld2,vertexInputs.previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\n#if !defined(WORLD_UBO)\nfinalWorld=uniforms.world*finalWorld;\n#else\nfinalWorld=mesh.world*finalWorld;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nfinalPreviousWorld=uniforms.previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nvar finalWorld=uniforms.world;\n#else\nvar finalWorld=mesh.world;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nvar finalPreviousWorld=uniforms.previousWorld;\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const instancesVertexWGSL = { name, shader };\n//# sourceMappingURL=instancesVertex.js.map"],"names":["name","shader","ShaderStore"],"mappings":";AAEA,MAAMA,IAAO,wBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;AC1BjD,MAAMD,IAAO,mBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;","x_google_ignoreList":[0,1]}
@@ -1,4 +1,4 @@
1
- import { S as e } from "./index-ChGTkj2q.js";
1
+ import { S as e } from "./index-DM3Dwe0V.js";
2
2
  const d = "instancesDeclaration", r = `#ifdef INSTANCES
3
3
  attribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;
4
4
  #ifdef INSTANCESCOLOR
@@ -43,4 +43,4 @@ mat4 finalPreviousWorld=previousWorld;
43
43
  #endif
44
44
  `;
45
45
  e.IncludesShadersStore[i] || (e.IncludesShadersStore[i] = f);
46
- //# sourceMappingURL=instancesVertex-BrWNnWxF.js.map
46
+ //# sourceMappingURL=instancesVertex-DzC88b5Z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instancesVertex-BrWNnWxF.js","sources":["../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesDeclaration\";\nconst shader = `#ifdef INSTANCES\nattribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;\n#ifdef INSTANCESCOLOR\nattribute vec4 instanceColor;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nattribute vec4 previousWorld0;attribute vec4 previousWorld1;attribute vec4 previousWorld2;attribute vec4 previousWorld3;\n#ifdef THIN_INSTANCES\nuniform mat4 previousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nuniform mat4 previousWorld;\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const instancesDeclaration = { name, shader };\n//# sourceMappingURL=instancesDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesVertex\";\nconst shader = `#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nmat4 finalPreviousWorld=mat4(previousWorld0,previousWorld1,\npreviousWorld2,previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\nmat4 finalWorld=world;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nmat4 finalPreviousWorld=previousWorld;\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const instancesVertex = { name, shader };\n//# sourceMappingURL=instancesVertex.js.map"],"names":["name","shader","ShaderStore"],"mappings":";AAEA,MAAMA,IAAO,wBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;AC1B7C,MAAMD,IAAO,mBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"instancesVertex-DzC88b5Z.js","sources":["../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesDeclaration\";\nconst shader = `#ifdef INSTANCES\nattribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;\n#ifdef INSTANCESCOLOR\nattribute vec4 instanceColor;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nattribute vec4 previousWorld0;attribute vec4 previousWorld1;attribute vec4 previousWorld2;attribute vec4 previousWorld3;\n#ifdef THIN_INSTANCES\nuniform mat4 previousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nuniform mat4 previousWorld;\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const instancesDeclaration = { name, shader };\n//# sourceMappingURL=instancesDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesVertex\";\nconst shader = `#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nmat4 finalPreviousWorld=mat4(previousWorld0,previousWorld1,\npreviousWorld2,previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\nmat4 finalWorld=world;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR)\nmat4 finalPreviousWorld=previousWorld;\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const instancesVertex = { name, shader };\n//# sourceMappingURL=instancesVertex.js.map"],"names":["name","shader","ShaderStore"],"mappings":";AAEA,MAAMA,IAAO,wBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;AC1B7C,MAAMD,IAAO,mBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;","x_google_ignoreList":[0,1]}
@@ -1,4 +1,4 @@
1
- import { c as n, e as _ } from "./index-ChGTkj2q.js";
1
+ import { c as n, e as _ } from "./index-DM3Dwe0V.js";
2
2
  class l {
3
3
  /**
4
4
  * Creates a new KhronosTextureContainer
@@ -517,4 +517,4 @@ class g {
517
517
  export {
518
518
  g as _KTXTextureLoader
519
519
  };
520
- //# sourceMappingURL=ktxTextureLoader-Dg1h0a-4.js.map
520
+ //# sourceMappingURL=ktxTextureLoader-O794CBz4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ktxTextureLoader-Dg1h0a-4.js","sources":["../node_modules/@babylonjs/core/Misc/khronosTextureContainer.js","../node_modules/@babylonjs/core/Misc/workerPool.js","../node_modules/@babylonjs/core/Materials/Textures/ktx2decoderTypes.js","../node_modules/@babylonjs/core/Misc/khronosTextureContainer2Worker.js","../node_modules/@babylonjs/core/Misc/khronosTextureContainer2.js","../node_modules/@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader.js"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { Logger } from \"../Misc/logger.js\";\n/**\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\n */\nexport class KhronosTextureContainer {\n /**\n * Creates a new KhronosTextureContainer\n * @param data contents of the KTX container file\n * @param facesExpected should be either 1 or 6, based whether a cube texture or or\n */\n constructor(\n /** contents of the KTX container file */\n data, facesExpected) {\n this.data = data;\n /**\n * If the container has been made invalid (eg. constructor failed to correctly load array buffer)\n */\n this.isInvalid = false;\n if (!KhronosTextureContainer.IsValid(data)) {\n this.isInvalid = true;\n Logger.Error(\"texture missing KTX identifier\");\n return;\n }\n // load the reset of the header in native 32 bit uint\n const dataSize = Uint32Array.BYTES_PER_ELEMENT;\n const headerDataView = new DataView(this.data.buffer, this.data.byteOffset + 12, 13 * dataSize);\n const endianness = headerDataView.getUint32(0, true);\n const littleEndian = endianness === 0x04030201;\n this.glType = headerDataView.getUint32(1 * dataSize, littleEndian); // must be 0 for compressed textures\n this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian); // must be 1 for compressed textures\n this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian); // must be 0 for compressed textures\n this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)\n this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)\n this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)\n this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)\n this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)\n this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian); // used for texture arrays\n this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian); // used for cubemap textures, should either be 1 or 6\n this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian); // number of levels; disregard possibility of 0 for compressed textures\n this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian); // the amount of space after the header for meta-data\n // Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing.\n if (this.glType !== 0) {\n Logger.Error(\"only compressed formats currently supported\");\n this.isInvalid = true;\n return;\n }\n else {\n // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.\n this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);\n }\n if (this.pixelHeight === 0 || this.pixelDepth !== 0) {\n Logger.Error(\"only 2D textures currently supported\");\n this.isInvalid = true;\n return;\n }\n if (this.numberOfArrayElements !== 0) {\n Logger.Error(\"texture arrays not currently supported\");\n this.isInvalid = true;\n return;\n }\n if (this.numberOfFaces !== facesExpected) {\n Logger.Error(\"number of faces expected\" + facesExpected + \", but found \" + this.numberOfFaces);\n this.isInvalid = true;\n return;\n }\n // we now have a completely validated file, so could use existence of loadType as success\n // would need to make this more elaborate & adjust checks above to support more than one load type\n this.loadType = KhronosTextureContainer.COMPRESSED_2D;\n }\n /**\n * Uploads KTX content to a Babylon Texture.\n * It is assumed that the texture has already been created & is currently bound\n * @internal\n */\n uploadLevels(texture, loadMipmaps) {\n switch (this.loadType) {\n case KhronosTextureContainer.COMPRESSED_2D:\n this._upload2DCompressedLevels(texture, loadMipmaps);\n break;\n case KhronosTextureContainer.TEX_2D:\n case KhronosTextureContainer.COMPRESSED_3D:\n case KhronosTextureContainer.TEX_3D:\n }\n }\n _upload2DCompressedLevels(texture, loadMipmaps) {\n // initialize width & height for level 1\n let dataOffset = KhronosTextureContainer.HEADER_LEN + this.bytesOfKeyValueData;\n let width = this.pixelWidth;\n let height = this.pixelHeight;\n const mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1;\n for (let level = 0; level < mipmapCount; level++) {\n const imageSize = new Int32Array(this.data.buffer, this.data.byteOffset + dataOffset, 1)[0]; // size per face, since not supporting array cubemaps\n dataOffset += 4; //image data starts from next multiple of 4 offset. Each face refers to same imagesize field above.\n for (let face = 0; face < this.numberOfFaces; face++) {\n const byteArray = new Uint8Array(this.data.buffer, this.data.byteOffset + dataOffset, imageSize);\n const engine = texture.getEngine();\n engine._uploadCompressedDataToTextureDirectly(texture, texture.format, width, height, byteArray, face, level);\n dataOffset += imageSize; // add size of the image for the next face/mipmap\n dataOffset += 3 - ((imageSize + 3) % 4); // add padding for odd sized image\n }\n width = Math.max(1.0, width * 0.5);\n height = Math.max(1.0, height * 0.5);\n }\n }\n /**\n * Checks if the given data starts with a KTX file identifier.\n * @param data the data to check\n * @returns true if the data is a KTX file or false otherwise\n */\n static IsValid(data) {\n if (data.byteLength >= 12) {\n // '«', 'K', 'T', 'X', ' ', '1', '1', '»', '\\r', '\\n', '\\x1A', '\\n'\n const identifier = new Uint8Array(data.buffer, data.byteOffset, 12);\n if (identifier[0] === 0xab &&\n identifier[1] === 0x4b &&\n identifier[2] === 0x54 &&\n identifier[3] === 0x58 &&\n identifier[4] === 0x20 &&\n identifier[5] === 0x31 &&\n identifier[6] === 0x31 &&\n identifier[7] === 0xbb &&\n identifier[8] === 0x0d &&\n identifier[9] === 0x0a &&\n identifier[10] === 0x1a &&\n identifier[11] === 0x0a) {\n return true;\n }\n }\n return false;\n }\n}\nKhronosTextureContainer.HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs)\n// load types\nKhronosTextureContainer.COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()\nKhronosTextureContainer.COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()\nKhronosTextureContainer.TEX_2D = 2; // uses a gl.texImage2D()\nKhronosTextureContainer.TEX_3D = 3; // uses a gl.texImage3D()\n//# sourceMappingURL=khronosTextureContainer.js.map","/**\n * Helper class to push actions to a pool of workers.\n */\nexport class WorkerPool {\n /**\n * Constructor\n * @param workers Array of workers to use for actions\n */\n constructor(workers) {\n this._pendingActions = new Array();\n this._workerInfos = workers.map((worker) => ({\n workerPromise: Promise.resolve(worker),\n idle: true,\n }));\n }\n /**\n * Terminates all workers and clears any pending actions.\n */\n dispose() {\n for (const workerInfo of this._workerInfos) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n workerInfo.workerPromise.then((worker) => {\n worker.terminate();\n });\n }\n this._workerInfos.length = 0;\n this._pendingActions.length = 0;\n }\n /**\n * Pushes an action to the worker pool. If all the workers are active, the action will be\n * pended until a worker has completed its action.\n * @param action The action to perform. Call onComplete when the action is complete.\n */\n push(action) {\n if (!this._executeOnIdleWorker(action)) {\n this._pendingActions.push(action);\n }\n }\n _executeOnIdleWorker(action) {\n for (const workerInfo of this._workerInfos) {\n if (workerInfo.idle) {\n this._execute(workerInfo, action);\n return true;\n }\n }\n return false;\n }\n _execute(workerInfo, action) {\n workerInfo.idle = false;\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n workerInfo.workerPromise.then((worker) => {\n action(worker, () => {\n const nextAction = this._pendingActions.shift();\n if (nextAction) {\n this._execute(workerInfo, nextAction);\n }\n else {\n workerInfo.idle = true;\n }\n });\n });\n }\n}\n/**\n * Similar to the WorkerPool class except it creates and destroys workers automatically with a maximum of `maxWorkers` workers.\n * Workers are terminated when it is idle for at least `idleTimeElapsedBeforeRelease` milliseconds.\n */\nexport class AutoReleaseWorkerPool extends WorkerPool {\n constructor(maxWorkers, createWorkerAsync, options = AutoReleaseWorkerPool.DefaultOptions) {\n super([]);\n this._maxWorkers = maxWorkers;\n this._createWorkerAsync = createWorkerAsync;\n this._options = options;\n }\n push(action) {\n if (!this._executeOnIdleWorker(action)) {\n if (this._workerInfos.length < this._maxWorkers) {\n const workerInfo = {\n workerPromise: this._createWorkerAsync(),\n idle: false,\n };\n this._workerInfos.push(workerInfo);\n this._execute(workerInfo, action);\n }\n else {\n this._pendingActions.push(action);\n }\n }\n }\n _execute(workerInfo, action) {\n // Reset the idle timeout.\n if (workerInfo.timeoutId) {\n clearTimeout(workerInfo.timeoutId);\n delete workerInfo.timeoutId;\n }\n super._execute(workerInfo, (worker, onComplete) => {\n action(worker, () => {\n onComplete();\n if (workerInfo.idle) {\n // Schedule the worker to be terminated after the elapsed time.\n workerInfo.timeoutId = setTimeout(() => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n workerInfo.workerPromise.then((worker) => {\n worker.terminate();\n });\n const indexOf = this._workerInfos.indexOf(workerInfo);\n if (indexOf !== -1) {\n this._workerInfos.splice(indexOf, 1);\n }\n }, this._options.idleTimeElapsedBeforeRelease);\n }\n });\n });\n }\n}\n/**\n * Default options for the constructor.\n * Override to change the defaults.\n */\nAutoReleaseWorkerPool.DefaultOptions = {\n idleTimeElapsedBeforeRelease: 1000,\n};\n//# sourceMappingURL=workerPool.js.map","export var SourceTextureFormat;\n(function (SourceTextureFormat) {\n SourceTextureFormat[SourceTextureFormat[\"ETC1S\"] = 0] = \"ETC1S\";\n // eslint-disable-next-line @typescript-eslint/naming-convention\n SourceTextureFormat[SourceTextureFormat[\"UASTC4x4\"] = 1] = \"UASTC4x4\";\n})(SourceTextureFormat || (SourceTextureFormat = {}));\nexport var TranscodeTarget;\n(function (TranscodeTarget) {\n TranscodeTarget[TranscodeTarget[\"ASTC_4X4_RGBA\"] = 0] = \"ASTC_4X4_RGBA\";\n TranscodeTarget[TranscodeTarget[\"BC7_RGBA\"] = 1] = \"BC7_RGBA\";\n TranscodeTarget[TranscodeTarget[\"BC3_RGBA\"] = 2] = \"BC3_RGBA\";\n TranscodeTarget[TranscodeTarget[\"BC1_RGB\"] = 3] = \"BC1_RGB\";\n TranscodeTarget[TranscodeTarget[\"PVRTC1_4_RGBA\"] = 4] = \"PVRTC1_4_RGBA\";\n TranscodeTarget[TranscodeTarget[\"PVRTC1_4_RGB\"] = 5] = \"PVRTC1_4_RGB\";\n TranscodeTarget[TranscodeTarget[\"ETC2_RGBA\"] = 6] = \"ETC2_RGBA\";\n TranscodeTarget[TranscodeTarget[\"ETC1_RGB\"] = 7] = \"ETC1_RGB\";\n TranscodeTarget[TranscodeTarget[\"RGBA32\"] = 8] = \"RGBA32\";\n TranscodeTarget[TranscodeTarget[\"R8\"] = 9] = \"R8\";\n TranscodeTarget[TranscodeTarget[\"RG8\"] = 10] = \"RG8\";\n})(TranscodeTarget || (TranscodeTarget = {}));\nexport var EngineFormat;\n(function (EngineFormat) {\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA_BPTC_UNORM_EXT\"] = 36492] = \"COMPRESSED_RGBA_BPTC_UNORM_EXT\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA_ASTC_4X4_KHR\"] = 37808] = \"COMPRESSED_RGBA_ASTC_4X4_KHR\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGB_S3TC_DXT1_EXT\"] = 33776] = \"COMPRESSED_RGB_S3TC_DXT1_EXT\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA_S3TC_DXT5_EXT\"] = 33779] = \"COMPRESSED_RGBA_S3TC_DXT5_EXT\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\"] = 35842] = \"COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGB_PVRTC_4BPPV1_IMG\"] = 35840] = \"COMPRESSED_RGB_PVRTC_4BPPV1_IMG\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA8_ETC2_EAC\"] = 37496] = \"COMPRESSED_RGBA8_ETC2_EAC\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGB8_ETC2\"] = 37492] = \"COMPRESSED_RGB8_ETC2\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGB_ETC1_WEBGL\"] = 36196] = \"COMPRESSED_RGB_ETC1_WEBGL\";\n EngineFormat[EngineFormat[\"RGBA8Format\"] = 32856] = \"RGBA8Format\";\n EngineFormat[EngineFormat[\"R8Format\"] = 33321] = \"R8Format\";\n // eslint-disable-next-line @typescript-eslint/naming-convention\n EngineFormat[EngineFormat[\"RG8Format\"] = 33323] = \"RG8Format\";\n})(EngineFormat || (EngineFormat = {}));\n//# sourceMappingURL=ktx2decoderTypes.js.map","export function applyConfig(urls, binariesAndModulesContainer) {\n const KTX2DecoderModule = binariesAndModulesContainer?.jsDecoderModule || KTX2DECODER;\n if (urls) {\n if (urls.wasmUASTCToASTC) {\n KTX2DecoderModule.LiteTranscoder_UASTC_ASTC.WasmModuleURL = urls.wasmUASTCToASTC;\n }\n if (urls.wasmUASTCToBC7) {\n KTX2DecoderModule.LiteTranscoder_UASTC_BC7.WasmModuleURL = urls.wasmUASTCToBC7;\n }\n if (urls.wasmUASTCToRGBA_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL = urls.wasmUASTCToRGBA_UNORM;\n }\n if (urls.wasmUASTCToRGBA_SRGB) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL = urls.wasmUASTCToRGBA_SRGB;\n }\n if (urls.wasmUASTCToR8_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_R8_UNORM.WasmModuleURL = urls.wasmUASTCToR8_UNORM;\n }\n if (urls.wasmUASTCToRG8_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RG8_UNORM.WasmModuleURL = urls.wasmUASTCToRG8_UNORM;\n }\n if (urls.jsMSCTranscoder) {\n KTX2DecoderModule.MSCTranscoder.JSModuleURL = urls.jsMSCTranscoder;\n }\n if (urls.wasmMSCTranscoder) {\n KTX2DecoderModule.MSCTranscoder.WasmModuleURL = urls.wasmMSCTranscoder;\n }\n if (urls.wasmZSTDDecoder) {\n KTX2DecoderModule.ZSTDDecoder.WasmModuleURL = urls.wasmZSTDDecoder;\n }\n }\n if (binariesAndModulesContainer) {\n if (binariesAndModulesContainer.wasmUASTCToASTC) {\n KTX2DecoderModule.LiteTranscoder_UASTC_ASTC.WasmBinary = binariesAndModulesContainer.wasmUASTCToASTC;\n }\n if (binariesAndModulesContainer.wasmUASTCToBC7) {\n KTX2DecoderModule.LiteTranscoder_UASTC_BC7.WasmBinary = binariesAndModulesContainer.wasmUASTCToBC7;\n }\n if (binariesAndModulesContainer.wasmUASTCToRGBA_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RGBA_UNORM.WasmBinary = binariesAndModulesContainer.wasmUASTCToRGBA_UNORM;\n }\n if (binariesAndModulesContainer.wasmUASTCToRGBA_SRGB) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RGBA_SRGB.WasmBinary = binariesAndModulesContainer.wasmUASTCToRGBA_SRGB;\n }\n if (binariesAndModulesContainer.wasmUASTCToR8_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_R8_UNORM.WasmBinary = binariesAndModulesContainer.wasmUASTCToR8_UNORM;\n }\n if (binariesAndModulesContainer.wasmUASTCToRG8_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RG8_UNORM.WasmBinary = binariesAndModulesContainer.wasmUASTCToRG8_UNORM;\n }\n if (binariesAndModulesContainer.jsMSCTranscoder) {\n KTX2DecoderModule.MSCTranscoder.JSModule = binariesAndModulesContainer.jsMSCTranscoder;\n }\n if (binariesAndModulesContainer.wasmMSCTranscoder) {\n KTX2DecoderModule.MSCTranscoder.WasmBinary = binariesAndModulesContainer.wasmMSCTranscoder;\n }\n if (binariesAndModulesContainer.wasmZSTDDecoder) {\n KTX2DecoderModule.ZSTDDecoder.WasmBinary = binariesAndModulesContainer.wasmZSTDDecoder;\n }\n }\n}\nexport function workerFunction(KTX2DecoderModule) {\n if (typeof KTX2DecoderModule === \"undefined\" && typeof KTX2DECODER !== \"undefined\") {\n KTX2DecoderModule = KTX2DECODER;\n }\n let ktx2Decoder;\n onmessage = (event) => {\n if (!event.data) {\n return;\n }\n switch (event.data.action) {\n case \"init\": {\n const urls = event.data.urls;\n if (urls) {\n if (urls.jsDecoderModule && typeof KTX2DecoderModule === \"undefined\") {\n importScripts(urls.jsDecoderModule);\n // assuming global namespace populated by the script (UMD pattern)\n KTX2DecoderModule = KTX2DECODER;\n }\n applyConfig(urls);\n }\n if (event.data.wasmBinaries) {\n applyConfig(undefined, { ...event.data.wasmBinaries, jsDecoderModule: KTX2DecoderModule });\n }\n ktx2Decoder = new KTX2DecoderModule.KTX2Decoder();\n postMessage({ action: \"init\" });\n break;\n }\n case \"setDefaultDecoderOptions\": {\n KTX2DecoderModule.KTX2Decoder.DefaultDecoderOptions = event.data.options;\n break;\n }\n case \"decode\":\n ktx2Decoder\n .decode(event.data.data, event.data.caps, event.data.options)\n // eslint-disable-next-line github/no-then\n .then((data) => {\n const buffers = [];\n for (let mip = 0; mip < data.mipmaps.length; ++mip) {\n const mipmap = data.mipmaps[mip];\n if (mipmap && mipmap.data) {\n buffers.push(mipmap.data.buffer);\n }\n }\n postMessage({ action: \"decoded\", success: true, decodedData: data }, buffers);\n })\n // eslint-disable-next-line github/no-then\n .catch((reason) => {\n postMessage({ action: \"decoded\", success: false, msg: reason });\n });\n break;\n }\n };\n}\nexport async function initializeWebWorker(worker, wasmBinaries, urls) {\n return await new Promise((resolve, reject) => {\n const onError = (error) => {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n };\n const onMessage = (message) => {\n if (message.data.action === \"init\") {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n resolve(worker);\n }\n };\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"message\", onMessage);\n worker.postMessage({\n action: \"init\",\n urls,\n wasmBinaries,\n });\n });\n}\n//# sourceMappingURL=khronosTextureContainer2Worker.js.map","\nimport { AutoReleaseWorkerPool } from \"./workerPool.js\";\nimport { Tools } from \"./tools.js\";\nimport { TranscodeTarget } from \"../Materials/Textures/ktx2decoderTypes.js\";\nimport { applyConfig, initializeWebWorker, workerFunction } from \"./khronosTextureContainer2Worker.js\";\n/**\n * Class that defines the default KTX2 decoder options.\n *\n * This class is useful for providing options to the KTX2 decoder to control how the source data is transcoded.\n */\nexport class DefaultKTX2DecoderOptions {\n constructor() {\n this._isDirty = true;\n this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC = true;\n this._ktx2DecoderOptions = {};\n }\n /**\n * Gets the dirty flag\n */\n get isDirty() {\n return this._isDirty;\n }\n /**\n * force a (uncompressed) RGBA transcoded format if transcoding a UASTC source format and ASTC + BC7 are not available as a compressed transcoded format\n */\n get useRGBAIfASTCBC7NotAvailableWhenUASTC() {\n return this._useRGBAIfASTCBC7NotAvailableWhenUASTC;\n }\n set useRGBAIfASTCBC7NotAvailableWhenUASTC(value) {\n if (this._useRGBAIfASTCBC7NotAvailableWhenUASTC === value) {\n return;\n }\n this._useRGBAIfASTCBC7NotAvailableWhenUASTC = value;\n this._isDirty = true;\n }\n /**\n * force a (uncompressed) RGBA transcoded format if transcoding a UASTC source format and only BC1 or BC3 are available as a compressed transcoded format.\n * This property is true by default to favor speed over memory, because currently transcoding from UASTC to BC1/3 is slow because the transcoder transcodes\n * to uncompressed and then recompresses the texture\n */\n get useRGBAIfOnlyBC1BC3AvailableWhenUASTC() {\n return this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC;\n }\n set useRGBAIfOnlyBC1BC3AvailableWhenUASTC(value) {\n if (this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC === value) {\n return;\n }\n this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC = value;\n this._isDirty = true;\n }\n /**\n * force to always use (uncompressed) RGBA for transcoded format\n */\n get forceRGBA() {\n return this._forceRGBA;\n }\n set forceRGBA(value) {\n if (this._forceRGBA === value) {\n return;\n }\n this._forceRGBA = value;\n this._isDirty = true;\n }\n /**\n * force to always use (uncompressed) R8 for transcoded format\n */\n get forceR8() {\n return this._forceR8;\n }\n set forceR8(value) {\n if (this._forceR8 === value) {\n return;\n }\n this._forceR8 = value;\n this._isDirty = true;\n }\n /**\n * force to always use (uncompressed) RG8 for transcoded format\n */\n get forceRG8() {\n return this._forceRG8;\n }\n set forceRG8(value) {\n if (this._forceRG8 === value) {\n return;\n }\n this._forceRG8 = value;\n this._isDirty = true;\n }\n /**\n * list of transcoders to bypass when looking for a suitable transcoder. The available transcoders are:\n * UniversalTranscoder_UASTC_ASTC\n * UniversalTranscoder_UASTC_BC7\n * UniversalTranscoder_UASTC_RGBA_UNORM\n * UniversalTranscoder_UASTC_RGBA_SRGB\n * UniversalTranscoder_UASTC_R8_UNORM\n * UniversalTranscoder_UASTC_RG8_UNORM\n * MSCTranscoder\n */\n get bypassTranscoders() {\n return this._bypassTranscoders;\n }\n set bypassTranscoders(value) {\n if (this._bypassTranscoders === value) {\n return;\n }\n this._bypassTranscoders = value;\n this._isDirty = true;\n }\n /** @internal */\n _getKTX2DecoderOptions() {\n if (!this._isDirty) {\n return this._ktx2DecoderOptions;\n }\n this._isDirty = false;\n const options = {\n useRGBAIfASTCBC7NotAvailableWhenUASTC: this._useRGBAIfASTCBC7NotAvailableWhenUASTC,\n forceRGBA: this._forceRGBA,\n forceR8: this._forceR8,\n forceRG8: this._forceRG8,\n bypassTranscoders: this._bypassTranscoders,\n };\n if (this.useRGBAIfOnlyBC1BC3AvailableWhenUASTC) {\n options.transcodeFormatDecisionTree = {\n UASTC: {\n transcodeFormat: [TranscodeTarget.BC1_RGB, TranscodeTarget.BC3_RGBA],\n yes: {\n transcodeFormat: TranscodeTarget.RGBA32,\n engineFormat: 32856 /* EngineFormat.RGBA8Format */,\n roundToMultiple4: false,\n },\n },\n };\n }\n this._ktx2DecoderOptions = options;\n return options;\n }\n}\n/**\n * Class for loading KTX2 files\n */\nexport class KhronosTextureContainer2 {\n static GetDefaultNumWorkers() {\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\n return 1;\n }\n // Use 50% of the available logical processors but capped at 4.\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\n }\n static _Initialize(numWorkers) {\n if (KhronosTextureContainer2._WorkerPoolPromise || KhronosTextureContainer2._DecoderModulePromise) {\n return;\n }\n const urls = {\n jsDecoderModule: Tools.GetBabylonScriptURL(this.URLConfig.jsDecoderModule, true),\n wasmUASTCToASTC: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToASTC, true),\n wasmUASTCToBC7: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToBC7, true),\n wasmUASTCToRGBA_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRGBA_UNORM, true),\n wasmUASTCToRGBA_SRGB: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRGBA_SRGB, true),\n wasmUASTCToR8_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToR8_UNORM, true),\n wasmUASTCToRG8_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRG8_UNORM, true),\n jsMSCTranscoder: Tools.GetBabylonScriptURL(this.URLConfig.jsMSCTranscoder, true),\n wasmMSCTranscoder: Tools.GetBabylonScriptURL(this.URLConfig.wasmMSCTranscoder, true),\n wasmZSTDDecoder: Tools.GetBabylonScriptURL(this.URLConfig.wasmZSTDDecoder, true),\n };\n if (numWorkers && typeof Worker === \"function\" && typeof URL !== \"undefined\") {\n KhronosTextureContainer2._WorkerPoolPromise = new Promise((resolve) => {\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n const workerContent = `${applyConfig}(${workerFunction})()`;\n const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\n resolve(new AutoReleaseWorkerPool(numWorkers, async () => await initializeWebWorker(new Worker(workerBlobUrl), undefined, urls)));\n });\n }\n else {\n if (typeof KhronosTextureContainer2._KTX2DecoderModule === \"undefined\") {\n // eslint-disable-next-line github/no-then\n KhronosTextureContainer2._DecoderModulePromise = Tools.LoadBabylonScriptAsync(urls.jsDecoderModule).then(() => {\n KhronosTextureContainer2._KTX2DecoderModule = KTX2DECODER;\n KhronosTextureContainer2._KTX2DecoderModule.MSCTranscoder.UseFromWorkerThread = false;\n KhronosTextureContainer2._KTX2DecoderModule.WASMMemoryManager.LoadBinariesFromCurrentThread = true;\n applyConfig(urls, KhronosTextureContainer2._KTX2DecoderModule);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return new KhronosTextureContainer2._KTX2DecoderModule.KTX2Decoder();\n });\n }\n else {\n KhronosTextureContainer2._KTX2DecoderModule.MSCTranscoder.UseFromWorkerThread = false;\n KhronosTextureContainer2._KTX2DecoderModule.WASMMemoryManager.LoadBinariesFromCurrentThread = true;\n KhronosTextureContainer2._DecoderModulePromise = Promise.resolve(new KhronosTextureContainer2._KTX2DecoderModule.KTX2Decoder());\n }\n }\n }\n /**\n * Constructor\n * @param engine The engine to use\n * @param numWorkersOrOptions The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\n */\n constructor(engine, numWorkersOrOptions = KhronosTextureContainer2.DefaultNumWorkers) {\n this._engine = engine;\n const workerPoolOption = (typeof numWorkersOrOptions === \"object\" && numWorkersOrOptions.workerPool) || KhronosTextureContainer2.WorkerPool;\n if (workerPoolOption) {\n KhronosTextureContainer2._WorkerPoolPromise = Promise.resolve(workerPoolOption);\n }\n else {\n // set the KTX2 decoder module\n if (typeof numWorkersOrOptions === \"object\") {\n KhronosTextureContainer2._KTX2DecoderModule = numWorkersOrOptions?.binariesAndModulesContainer?.jsDecoderModule;\n }\n else if (typeof KTX2DECODER !== \"undefined\") {\n KhronosTextureContainer2._KTX2DecoderModule = KTX2DECODER;\n }\n const numberOfWorkers = typeof numWorkersOrOptions === \"number\" ? numWorkersOrOptions : (numWorkersOrOptions.numWorkers ?? KhronosTextureContainer2.DefaultNumWorkers);\n KhronosTextureContainer2._Initialize(numberOfWorkers);\n }\n }\n /**\n * @internal\n */\n async _uploadAsync(data, internalTexture, options) {\n const caps = this._engine.getCaps();\n const compressedTexturesCaps = {\n astc: !!caps.astc,\n bptc: !!caps.bptc,\n s3tc: !!caps.s3tc,\n pvrtc: !!caps.pvrtc,\n etc2: !!caps.etc2,\n etc1: !!caps.etc1,\n };\n if (KhronosTextureContainer2._WorkerPoolPromise) {\n const workerPool = await KhronosTextureContainer2._WorkerPoolPromise;\n return await new Promise((resolve, reject) => {\n workerPool.push((worker, onComplete) => {\n const onError = (error) => {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n onComplete();\n };\n const onMessage = (message) => {\n if (message.data.action === \"decoded\") {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n if (!message.data.success) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject({ message: message.data.msg });\n }\n else {\n try {\n this._createTexture(message.data.decodedData, internalTexture, options);\n resolve();\n }\n catch (err) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject({ message: err });\n }\n }\n onComplete();\n }\n };\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"message\", onMessage);\n worker.postMessage({ action: \"setDefaultDecoderOptions\", options: KhronosTextureContainer2.DefaultDecoderOptions._getKTX2DecoderOptions() });\n const dataCopy = new Uint8Array(data.byteLength);\n dataCopy.set(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));\n worker.postMessage({ action: \"decode\", data: dataCopy, caps: compressedTexturesCaps, options }, [dataCopy.buffer]);\n });\n });\n }\n else if (KhronosTextureContainer2._DecoderModulePromise) {\n const decoder = await KhronosTextureContainer2._DecoderModulePromise;\n if (KhronosTextureContainer2.DefaultDecoderOptions.isDirty) {\n KhronosTextureContainer2._KTX2DecoderModule.KTX2Decoder.DefaultDecoderOptions = KhronosTextureContainer2.DefaultDecoderOptions._getKTX2DecoderOptions();\n }\n return await new Promise((resolve, reject) => {\n decoder\n .decode(data, caps)\n // eslint-disable-next-line github/no-then\n .then((data) => {\n this._createTexture(data, internalTexture);\n resolve();\n })\n // eslint-disable-next-line github/no-then\n .catch((reason) => {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject({ message: reason });\n });\n });\n }\n throw new Error(\"KTX2 decoder module is not available\");\n }\n _createTexture(data, internalTexture, options) {\n const oglTexture2D = 3553; // gl.TEXTURE_2D\n this._engine._bindTextureDirectly(oglTexture2D, internalTexture);\n if (options) {\n // return back some information about the decoded data\n options.transcodedFormat = data.transcodedFormat;\n options.isInGammaSpace = data.isInGammaSpace;\n options.hasAlpha = data.hasAlpha;\n options.transcoderName = data.transcoderName;\n }\n let isUncompressedFormat = true;\n switch (data.transcodedFormat) {\n case 0x8058 /* RGBA8 */:\n internalTexture.type = 0;\n internalTexture.format = 5;\n break;\n case 0x8229 /* R8 */:\n internalTexture.type = 0;\n internalTexture.format = 6;\n break;\n case 0x822b /* RG8 */:\n internalTexture.type = 0;\n internalTexture.format = 7;\n break;\n default:\n internalTexture.format = data.transcodedFormat;\n isUncompressedFormat = false;\n break;\n }\n internalTexture._gammaSpace = data.isInGammaSpace;\n internalTexture.generateMipMaps = data.mipmaps.length > 1;\n if (data.errors) {\n throw new Error(\"KTX2 container - could not transcode the data. \" + data.errors);\n }\n for (let t = 0; t < data.mipmaps.length; ++t) {\n const mipmap = data.mipmaps[t];\n if (!mipmap || !mipmap.data) {\n throw new Error(\"KTX2 container - could not transcode one of the image\");\n }\n if (isUncompressedFormat) {\n // uncompressed RGBA / R8 / RG8\n internalTexture.width = mipmap.width; // need to set width/height so that the call to _uploadDataToTextureDirectly uses the right dimensions\n internalTexture.height = mipmap.height;\n this._engine._uploadDataToTextureDirectly(internalTexture, mipmap.data, 0, t, undefined, true);\n }\n else {\n this._engine._uploadCompressedDataToTextureDirectly(internalTexture, data.transcodedFormat, mipmap.width, mipmap.height, mipmap.data, 0, t);\n }\n }\n internalTexture._extension = \".ktx2\";\n internalTexture.width = data.mipmaps[0].width;\n internalTexture.height = data.mipmaps[0].height;\n internalTexture.isReady = true;\n this._engine._bindTextureDirectly(oglTexture2D, null);\n }\n /**\n * Checks if the given data starts with a KTX2 file identifier.\n * @param data the data to check\n * @returns true if the data is a KTX2 file or false otherwise\n */\n static IsValid(data) {\n if (data.byteLength >= 12) {\n // '«', 'K', 'T', 'X', ' ', '2', '0', '»', '\\r', '\\n', '\\x1A', '\\n'\n const identifier = new Uint8Array(data.buffer, data.byteOffset, 12);\n if (identifier[0] === 0xab &&\n identifier[1] === 0x4b &&\n identifier[2] === 0x54 &&\n identifier[3] === 0x58 &&\n identifier[4] === 0x20 &&\n identifier[5] === 0x32 &&\n identifier[6] === 0x30 &&\n identifier[7] === 0xbb &&\n identifier[8] === 0x0d &&\n identifier[9] === 0x0a &&\n identifier[10] === 0x1a &&\n identifier[11] === 0x0a) {\n return true;\n }\n }\n return false;\n }\n}\n/**\n * URLs to use when loading the KTX2 decoder module as well as its dependencies\n * If a url is null, the default url is used (pointing to https://preview.babylonjs.com)\n * Note that jsDecoderModule can't be null and that the other dependencies will only be loaded if necessary\n * Urls you can change:\n * URLConfig.jsDecoderModule\n * URLConfig.wasmUASTCToASTC\n * URLConfig.wasmUASTCToBC7\n * URLConfig.wasmUASTCToRGBA_UNORM\n * URLConfig.wasmUASTCToRGBA_SRGB\n * URLConfig.wasmUASTCToR8_UNORM\n * URLConfig.wasmUASTCToRG8_UNORM\n * URLConfig.jsMSCTranscoder\n * URLConfig.wasmMSCTranscoder\n * URLConfig.wasmZSTDDecoder\n * You can see their default values in this PG: https://playground.babylonjs.com/#EIJH8L#29\n */\nKhronosTextureContainer2.URLConfig = {\n jsDecoderModule: \"https://cdn.babylonjs.com/babylon.ktx2Decoder.js\",\n wasmUASTCToASTC: null,\n wasmUASTCToBC7: null,\n wasmUASTCToRGBA_UNORM: null,\n wasmUASTCToRGBA_SRGB: null,\n wasmUASTCToR8_UNORM: null,\n wasmUASTCToRG8_UNORM: null,\n jsMSCTranscoder: null,\n wasmMSCTranscoder: null,\n wasmZSTDDecoder: null,\n};\n/**\n * Default number of workers used to handle data decoding\n */\nKhronosTextureContainer2.DefaultNumWorkers = KhronosTextureContainer2.GetDefaultNumWorkers();\n/**\n * Default configuration for the KTX2 decoder.\n * The options defined in this way have priority over those passed when creating a KTX2 texture with new Texture(...).\n */\nKhronosTextureContainer2.DefaultDecoderOptions = new DefaultKTX2DecoderOptions();\n//# sourceMappingURL=khronosTextureContainer2.js.map","import { KhronosTextureContainer } from \"../../../Misc/khronosTextureContainer.js\";\nimport { KhronosTextureContainer2 } from \"../../../Misc/khronosTextureContainer2.js\";\nimport { Logger } from \"../../../Misc/logger.js\";\n\nfunction MapSRGBToLinear(format) {\n switch (format) {\n case 35916:\n return 33776;\n case 35918:\n return 33778;\n case 35919:\n return 33779;\n case 37493:\n return 37492;\n case 37497:\n return 37496;\n case 37495:\n return 37494;\n case 37840:\n return 37808;\n case 36493:\n return 36492;\n }\n return null;\n}\n/**\n * Implementation of the KTX Texture Loader.\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _KTXTextureLoader {\n constructor() {\n /**\n * Defines whether the loader supports cascade loading the different faces.\n */\n this.supportCascades = false;\n }\n /**\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\n * @param data contains the texture data\n * @param texture defines the BabylonJS internal texture\n * @param createPolynomials will be true if polynomials have been requested\n * @param onLoad defines the callback to trigger once the texture is ready\n */\n loadCubeData(data, texture, createPolynomials, onLoad) {\n if (Array.isArray(data)) {\n return;\n }\n // Need to invert vScale as invertY via UNPACK_FLIP_Y_WEBGL is not supported by compressed texture\n texture._invertVScale = !texture.invertY;\n const engine = texture.getEngine();\n const ktx = new KhronosTextureContainer(data, 6);\n const loadMipmap = ktx.numberOfMipmapLevels > 1 && texture.generateMipMaps;\n engine._unpackFlipY(true);\n ktx.uploadLevels(texture, texture.generateMipMaps);\n texture.width = ktx.pixelWidth;\n texture.height = ktx.pixelHeight;\n engine._setCubeMapTextureParams(texture, loadMipmap, ktx.numberOfMipmapLevels - 1);\n texture.isReady = true;\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n if (onLoad) {\n onLoad();\n }\n }\n /**\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\n * @param data contains the texture data\n * @param texture defines the BabylonJS internal texture\n * @param callback defines the method to call once ready to upload\n * @param options\n */\n loadData(data, texture, callback, options) {\n if (KhronosTextureContainer.IsValid(data)) {\n // Need to invert vScale as invertY via UNPACK_FLIP_Y_WEBGL is not supported by compressed texture\n texture._invertVScale = !texture.invertY;\n const ktx = new KhronosTextureContainer(data, 1);\n const mappedFormat = MapSRGBToLinear(ktx.glInternalFormat);\n if (mappedFormat) {\n texture.format = mappedFormat;\n texture._useSRGBBuffer = texture.getEngine()._getUseSRGBBuffer(true, texture.generateMipMaps);\n texture._gammaSpace = true;\n }\n else {\n texture.format = ktx.glInternalFormat;\n }\n callback(ktx.pixelWidth, ktx.pixelHeight, texture.generateMipMaps, true, () => {\n ktx.uploadLevels(texture, texture.generateMipMaps);\n }, ktx.isInvalid);\n }\n else if (KhronosTextureContainer2.IsValid(data)) {\n const ktx2 = new KhronosTextureContainer2(texture.getEngine());\n // eslint-disable-next-line github/no-then\n ktx2._uploadAsync(data, texture, options).then(() => {\n callback(texture.width, texture.height, texture.generateMipMaps, true, () => { }, false);\n }, (error) => {\n Logger.Warn(`Failed to load KTX2 texture data: ${error.message}`);\n callback(0, 0, false, false, () => { }, true);\n });\n }\n else {\n Logger.Error(\"texture missing KTX identifier\");\n callback(0, 0, false, false, () => { }, true);\n }\n }\n}\n//# sourceMappingURL=ktxTextureLoader.js.map"],"names":["KhronosTextureContainer","data","facesExpected","Logger","dataSize","headerDataView","littleEndian","texture","loadMipmaps","dataOffset","width","height","mipmapCount","level","imageSize","face","byteArray","identifier","WorkerPool","workers","worker","workerInfo","action","nextAction","AutoReleaseWorkerPool","maxWorkers","createWorkerAsync","options","onComplete","indexOf","SourceTextureFormat","TranscodeTarget","EngineFormat","applyConfig","urls","binariesAndModulesContainer","KTX2DecoderModule","workerFunction","ktx2Decoder","event","buffers","mip","mipmap","reason","initializeWebWorker","wasmBinaries","resolve","reject","onError","error","onMessage","message","DefaultKTX2DecoderOptions","value","KhronosTextureContainer2","numWorkers","Tools","workerContent","workerBlobUrl","engine","numWorkersOrOptions","workerPoolOption","_a","numberOfWorkers","internalTexture","caps","compressedTexturesCaps","workerPool","err","dataCopy","decoder","isUncompressedFormat","t","MapSRGBToLinear","format","_KTXTextureLoader","createPolynomials","onLoad","ktx","loadMipmap","callback","mappedFormat"],"mappings":";AAMO,MAAMA,EAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjC,YAEAC,GAAMC,GAAe;AAMjB,QALA,KAAK,OAAOD,GAIZ,KAAK,YAAY,IACb,CAACD,EAAwB,QAAQC,CAAI,GAAG;AACxC,WAAK,YAAY,IACjBE,EAAO,MAAM,gCAAgC;AAC7C;AAAA,IACZ;AAEQ,UAAMC,IAAW,YAAY,mBACvBC,IAAiB,IAAI,SAAS,KAAK,KAAK,QAAQ,KAAK,KAAK,aAAa,IAAI,KAAKD,CAAQ,GAExFE,IADaD,EAAe,UAAU,GAAG,EAAI,MACf;AAcpC,QAbA,KAAK,SAASA,EAAe,UAAU,IAAID,GAAUE,CAAY,GACjE,KAAK,aAAaD,EAAe,UAAU,IAAID,GAAUE,CAAY,GACrE,KAAK,WAAWD,EAAe,UAAU,IAAID,GAAUE,CAAY,GACnE,KAAK,mBAAmBD,EAAe,UAAU,IAAID,GAAUE,CAAY,GAC3E,KAAK,uBAAuBD,EAAe,UAAU,IAAID,GAAUE,CAAY,GAC/E,KAAK,aAAaD,EAAe,UAAU,IAAID,GAAUE,CAAY,GACrE,KAAK,cAAcD,EAAe,UAAU,IAAID,GAAUE,CAAY,GACtE,KAAK,aAAaD,EAAe,UAAU,IAAID,GAAUE,CAAY,GACrE,KAAK,wBAAwBD,EAAe,UAAU,IAAID,GAAUE,CAAY,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AAIxB,EAAyB,QAAQrD,CAAI,IAC7B,IAAIqD,EAAyB/C,EAAQ,UAAS,CAAE,EAExD,aAAaN,GAAMM,GAASoB,CAAO,EAAE,KAAK,MAAM;AACjD,MAAAqD,EAASzE,EAAQ,OAAOA,EAAQ,QAAQA,EAAQ,iBAAiB,IAAM,MAAM;AAAA,MAAA,GAAK,EAAK;AAAA,IACvG,GAAe,CAAC0C,MAAU;AACV,MAAA9C,EAAO,KAAK,qCAAqC8C,EAAM,OAAO,EAAE,GAChE+B,EAAS,GAAG,GAAG,IAAO,IAAO,MAAM;AAAA,MAAA,GAAK,EAAI;AAAA,IAC5D,CAAa,KAGD7E,EAAO,MAAM,gCAAgC,GAC7C6E,EAAS,GAAG,GAAG,IAAO,IAAO,MAAM;AAAA,IAAA,GAAK,EAAI;AAAA,EAExD;AACA;","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"ktxTextureLoader-O794CBz4.js","sources":["../node_modules/@babylonjs/core/Misc/khronosTextureContainer.js","../node_modules/@babylonjs/core/Misc/workerPool.js","../node_modules/@babylonjs/core/Materials/Textures/ktx2decoderTypes.js","../node_modules/@babylonjs/core/Misc/khronosTextureContainer2Worker.js","../node_modules/@babylonjs/core/Misc/khronosTextureContainer2.js","../node_modules/@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader.js"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { Logger } from \"../Misc/logger.js\";\n/**\n * for description see https://www.khronos.org/opengles/sdk/tools/KTX/\n * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/\n */\nexport class KhronosTextureContainer {\n /**\n * Creates a new KhronosTextureContainer\n * @param data contents of the KTX container file\n * @param facesExpected should be either 1 or 6, based whether a cube texture or or\n */\n constructor(\n /** contents of the KTX container file */\n data, facesExpected) {\n this.data = data;\n /**\n * If the container has been made invalid (eg. constructor failed to correctly load array buffer)\n */\n this.isInvalid = false;\n if (!KhronosTextureContainer.IsValid(data)) {\n this.isInvalid = true;\n Logger.Error(\"texture missing KTX identifier\");\n return;\n }\n // load the reset of the header in native 32 bit uint\n const dataSize = Uint32Array.BYTES_PER_ELEMENT;\n const headerDataView = new DataView(this.data.buffer, this.data.byteOffset + 12, 13 * dataSize);\n const endianness = headerDataView.getUint32(0, true);\n const littleEndian = endianness === 0x04030201;\n this.glType = headerDataView.getUint32(1 * dataSize, littleEndian); // must be 0 for compressed textures\n this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian); // must be 1 for compressed textures\n this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian); // must be 0 for compressed textures\n this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)\n this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)\n this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)\n this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)\n this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)\n this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian); // used for texture arrays\n this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian); // used for cubemap textures, should either be 1 or 6\n this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian); // number of levels; disregard possibility of 0 for compressed textures\n this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian); // the amount of space after the header for meta-data\n // Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing.\n if (this.glType !== 0) {\n Logger.Error(\"only compressed formats currently supported\");\n this.isInvalid = true;\n return;\n }\n else {\n // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.\n this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);\n }\n if (this.pixelHeight === 0 || this.pixelDepth !== 0) {\n Logger.Error(\"only 2D textures currently supported\");\n this.isInvalid = true;\n return;\n }\n if (this.numberOfArrayElements !== 0) {\n Logger.Error(\"texture arrays not currently supported\");\n this.isInvalid = true;\n return;\n }\n if (this.numberOfFaces !== facesExpected) {\n Logger.Error(\"number of faces expected\" + facesExpected + \", but found \" + this.numberOfFaces);\n this.isInvalid = true;\n return;\n }\n // we now have a completely validated file, so could use existence of loadType as success\n // would need to make this more elaborate & adjust checks above to support more than one load type\n this.loadType = KhronosTextureContainer.COMPRESSED_2D;\n }\n /**\n * Uploads KTX content to a Babylon Texture.\n * It is assumed that the texture has already been created & is currently bound\n * @internal\n */\n uploadLevels(texture, loadMipmaps) {\n switch (this.loadType) {\n case KhronosTextureContainer.COMPRESSED_2D:\n this._upload2DCompressedLevels(texture, loadMipmaps);\n break;\n case KhronosTextureContainer.TEX_2D:\n case KhronosTextureContainer.COMPRESSED_3D:\n case KhronosTextureContainer.TEX_3D:\n }\n }\n _upload2DCompressedLevels(texture, loadMipmaps) {\n // initialize width & height for level 1\n let dataOffset = KhronosTextureContainer.HEADER_LEN + this.bytesOfKeyValueData;\n let width = this.pixelWidth;\n let height = this.pixelHeight;\n const mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1;\n for (let level = 0; level < mipmapCount; level++) {\n const imageSize = new Int32Array(this.data.buffer, this.data.byteOffset + dataOffset, 1)[0]; // size per face, since not supporting array cubemaps\n dataOffset += 4; //image data starts from next multiple of 4 offset. Each face refers to same imagesize field above.\n for (let face = 0; face < this.numberOfFaces; face++) {\n const byteArray = new Uint8Array(this.data.buffer, this.data.byteOffset + dataOffset, imageSize);\n const engine = texture.getEngine();\n engine._uploadCompressedDataToTextureDirectly(texture, texture.format, width, height, byteArray, face, level);\n dataOffset += imageSize; // add size of the image for the next face/mipmap\n dataOffset += 3 - ((imageSize + 3) % 4); // add padding for odd sized image\n }\n width = Math.max(1.0, width * 0.5);\n height = Math.max(1.0, height * 0.5);\n }\n }\n /**\n * Checks if the given data starts with a KTX file identifier.\n * @param data the data to check\n * @returns true if the data is a KTX file or false otherwise\n */\n static IsValid(data) {\n if (data.byteLength >= 12) {\n // '«', 'K', 'T', 'X', ' ', '1', '1', '»', '\\r', '\\n', '\\x1A', '\\n'\n const identifier = new Uint8Array(data.buffer, data.byteOffset, 12);\n if (identifier[0] === 0xab &&\n identifier[1] === 0x4b &&\n identifier[2] === 0x54 &&\n identifier[3] === 0x58 &&\n identifier[4] === 0x20 &&\n identifier[5] === 0x31 &&\n identifier[6] === 0x31 &&\n identifier[7] === 0xbb &&\n identifier[8] === 0x0d &&\n identifier[9] === 0x0a &&\n identifier[10] === 0x1a &&\n identifier[11] === 0x0a) {\n return true;\n }\n }\n return false;\n }\n}\nKhronosTextureContainer.HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs)\n// load types\nKhronosTextureContainer.COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()\nKhronosTextureContainer.COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()\nKhronosTextureContainer.TEX_2D = 2; // uses a gl.texImage2D()\nKhronosTextureContainer.TEX_3D = 3; // uses a gl.texImage3D()\n//# sourceMappingURL=khronosTextureContainer.js.map","/**\n * Helper class to push actions to a pool of workers.\n */\nexport class WorkerPool {\n /**\n * Constructor\n * @param workers Array of workers to use for actions\n */\n constructor(workers) {\n this._pendingActions = new Array();\n this._workerInfos = workers.map((worker) => ({\n workerPromise: Promise.resolve(worker),\n idle: true,\n }));\n }\n /**\n * Terminates all workers and clears any pending actions.\n */\n dispose() {\n for (const workerInfo of this._workerInfos) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n workerInfo.workerPromise.then((worker) => {\n worker.terminate();\n });\n }\n this._workerInfos.length = 0;\n this._pendingActions.length = 0;\n }\n /**\n * Pushes an action to the worker pool. If all the workers are active, the action will be\n * pended until a worker has completed its action.\n * @param action The action to perform. Call onComplete when the action is complete.\n */\n push(action) {\n if (!this._executeOnIdleWorker(action)) {\n this._pendingActions.push(action);\n }\n }\n _executeOnIdleWorker(action) {\n for (const workerInfo of this._workerInfos) {\n if (workerInfo.idle) {\n this._execute(workerInfo, action);\n return true;\n }\n }\n return false;\n }\n _execute(workerInfo, action) {\n workerInfo.idle = false;\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n workerInfo.workerPromise.then((worker) => {\n action(worker, () => {\n const nextAction = this._pendingActions.shift();\n if (nextAction) {\n this._execute(workerInfo, nextAction);\n }\n else {\n workerInfo.idle = true;\n }\n });\n });\n }\n}\n/**\n * Similar to the WorkerPool class except it creates and destroys workers automatically with a maximum of `maxWorkers` workers.\n * Workers are terminated when it is idle for at least `idleTimeElapsedBeforeRelease` milliseconds.\n */\nexport class AutoReleaseWorkerPool extends WorkerPool {\n constructor(maxWorkers, createWorkerAsync, options = AutoReleaseWorkerPool.DefaultOptions) {\n super([]);\n this._maxWorkers = maxWorkers;\n this._createWorkerAsync = createWorkerAsync;\n this._options = options;\n }\n push(action) {\n if (!this._executeOnIdleWorker(action)) {\n if (this._workerInfos.length < this._maxWorkers) {\n const workerInfo = {\n workerPromise: this._createWorkerAsync(),\n idle: false,\n };\n this._workerInfos.push(workerInfo);\n this._execute(workerInfo, action);\n }\n else {\n this._pendingActions.push(action);\n }\n }\n }\n _execute(workerInfo, action) {\n // Reset the idle timeout.\n if (workerInfo.timeoutId) {\n clearTimeout(workerInfo.timeoutId);\n delete workerInfo.timeoutId;\n }\n super._execute(workerInfo, (worker, onComplete) => {\n action(worker, () => {\n onComplete();\n if (workerInfo.idle) {\n // Schedule the worker to be terminated after the elapsed time.\n workerInfo.timeoutId = setTimeout(() => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n workerInfo.workerPromise.then((worker) => {\n worker.terminate();\n });\n const indexOf = this._workerInfos.indexOf(workerInfo);\n if (indexOf !== -1) {\n this._workerInfos.splice(indexOf, 1);\n }\n }, this._options.idleTimeElapsedBeforeRelease);\n }\n });\n });\n }\n}\n/**\n * Default options for the constructor.\n * Override to change the defaults.\n */\nAutoReleaseWorkerPool.DefaultOptions = {\n idleTimeElapsedBeforeRelease: 1000,\n};\n//# sourceMappingURL=workerPool.js.map","export var SourceTextureFormat;\n(function (SourceTextureFormat) {\n SourceTextureFormat[SourceTextureFormat[\"ETC1S\"] = 0] = \"ETC1S\";\n // eslint-disable-next-line @typescript-eslint/naming-convention\n SourceTextureFormat[SourceTextureFormat[\"UASTC4x4\"] = 1] = \"UASTC4x4\";\n})(SourceTextureFormat || (SourceTextureFormat = {}));\nexport var TranscodeTarget;\n(function (TranscodeTarget) {\n TranscodeTarget[TranscodeTarget[\"ASTC_4X4_RGBA\"] = 0] = \"ASTC_4X4_RGBA\";\n TranscodeTarget[TranscodeTarget[\"BC7_RGBA\"] = 1] = \"BC7_RGBA\";\n TranscodeTarget[TranscodeTarget[\"BC3_RGBA\"] = 2] = \"BC3_RGBA\";\n TranscodeTarget[TranscodeTarget[\"BC1_RGB\"] = 3] = \"BC1_RGB\";\n TranscodeTarget[TranscodeTarget[\"PVRTC1_4_RGBA\"] = 4] = \"PVRTC1_4_RGBA\";\n TranscodeTarget[TranscodeTarget[\"PVRTC1_4_RGB\"] = 5] = \"PVRTC1_4_RGB\";\n TranscodeTarget[TranscodeTarget[\"ETC2_RGBA\"] = 6] = \"ETC2_RGBA\";\n TranscodeTarget[TranscodeTarget[\"ETC1_RGB\"] = 7] = \"ETC1_RGB\";\n TranscodeTarget[TranscodeTarget[\"RGBA32\"] = 8] = \"RGBA32\";\n TranscodeTarget[TranscodeTarget[\"R8\"] = 9] = \"R8\";\n TranscodeTarget[TranscodeTarget[\"RG8\"] = 10] = \"RG8\";\n})(TranscodeTarget || (TranscodeTarget = {}));\nexport var EngineFormat;\n(function (EngineFormat) {\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA_BPTC_UNORM_EXT\"] = 36492] = \"COMPRESSED_RGBA_BPTC_UNORM_EXT\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA_ASTC_4X4_KHR\"] = 37808] = \"COMPRESSED_RGBA_ASTC_4X4_KHR\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGB_S3TC_DXT1_EXT\"] = 33776] = \"COMPRESSED_RGB_S3TC_DXT1_EXT\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA_S3TC_DXT5_EXT\"] = 33779] = \"COMPRESSED_RGBA_S3TC_DXT5_EXT\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\"] = 35842] = \"COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGB_PVRTC_4BPPV1_IMG\"] = 35840] = \"COMPRESSED_RGB_PVRTC_4BPPV1_IMG\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGBA8_ETC2_EAC\"] = 37496] = \"COMPRESSED_RGBA8_ETC2_EAC\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGB8_ETC2\"] = 37492] = \"COMPRESSED_RGB8_ETC2\";\n EngineFormat[EngineFormat[\"COMPRESSED_RGB_ETC1_WEBGL\"] = 36196] = \"COMPRESSED_RGB_ETC1_WEBGL\";\n EngineFormat[EngineFormat[\"RGBA8Format\"] = 32856] = \"RGBA8Format\";\n EngineFormat[EngineFormat[\"R8Format\"] = 33321] = \"R8Format\";\n // eslint-disable-next-line @typescript-eslint/naming-convention\n EngineFormat[EngineFormat[\"RG8Format\"] = 33323] = \"RG8Format\";\n})(EngineFormat || (EngineFormat = {}));\n//# sourceMappingURL=ktx2decoderTypes.js.map","export function applyConfig(urls, binariesAndModulesContainer) {\n const KTX2DecoderModule = binariesAndModulesContainer?.jsDecoderModule || KTX2DECODER;\n if (urls) {\n if (urls.wasmUASTCToASTC) {\n KTX2DecoderModule.LiteTranscoder_UASTC_ASTC.WasmModuleURL = urls.wasmUASTCToASTC;\n }\n if (urls.wasmUASTCToBC7) {\n KTX2DecoderModule.LiteTranscoder_UASTC_BC7.WasmModuleURL = urls.wasmUASTCToBC7;\n }\n if (urls.wasmUASTCToRGBA_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL = urls.wasmUASTCToRGBA_UNORM;\n }\n if (urls.wasmUASTCToRGBA_SRGB) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL = urls.wasmUASTCToRGBA_SRGB;\n }\n if (urls.wasmUASTCToR8_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_R8_UNORM.WasmModuleURL = urls.wasmUASTCToR8_UNORM;\n }\n if (urls.wasmUASTCToRG8_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RG8_UNORM.WasmModuleURL = urls.wasmUASTCToRG8_UNORM;\n }\n if (urls.jsMSCTranscoder) {\n KTX2DecoderModule.MSCTranscoder.JSModuleURL = urls.jsMSCTranscoder;\n }\n if (urls.wasmMSCTranscoder) {\n KTX2DecoderModule.MSCTranscoder.WasmModuleURL = urls.wasmMSCTranscoder;\n }\n if (urls.wasmZSTDDecoder) {\n KTX2DecoderModule.ZSTDDecoder.WasmModuleURL = urls.wasmZSTDDecoder;\n }\n }\n if (binariesAndModulesContainer) {\n if (binariesAndModulesContainer.wasmUASTCToASTC) {\n KTX2DecoderModule.LiteTranscoder_UASTC_ASTC.WasmBinary = binariesAndModulesContainer.wasmUASTCToASTC;\n }\n if (binariesAndModulesContainer.wasmUASTCToBC7) {\n KTX2DecoderModule.LiteTranscoder_UASTC_BC7.WasmBinary = binariesAndModulesContainer.wasmUASTCToBC7;\n }\n if (binariesAndModulesContainer.wasmUASTCToRGBA_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RGBA_UNORM.WasmBinary = binariesAndModulesContainer.wasmUASTCToRGBA_UNORM;\n }\n if (binariesAndModulesContainer.wasmUASTCToRGBA_SRGB) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RGBA_SRGB.WasmBinary = binariesAndModulesContainer.wasmUASTCToRGBA_SRGB;\n }\n if (binariesAndModulesContainer.wasmUASTCToR8_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_R8_UNORM.WasmBinary = binariesAndModulesContainer.wasmUASTCToR8_UNORM;\n }\n if (binariesAndModulesContainer.wasmUASTCToRG8_UNORM) {\n KTX2DecoderModule.LiteTranscoder_UASTC_RG8_UNORM.WasmBinary = binariesAndModulesContainer.wasmUASTCToRG8_UNORM;\n }\n if (binariesAndModulesContainer.jsMSCTranscoder) {\n KTX2DecoderModule.MSCTranscoder.JSModule = binariesAndModulesContainer.jsMSCTranscoder;\n }\n if (binariesAndModulesContainer.wasmMSCTranscoder) {\n KTX2DecoderModule.MSCTranscoder.WasmBinary = binariesAndModulesContainer.wasmMSCTranscoder;\n }\n if (binariesAndModulesContainer.wasmZSTDDecoder) {\n KTX2DecoderModule.ZSTDDecoder.WasmBinary = binariesAndModulesContainer.wasmZSTDDecoder;\n }\n }\n}\nexport function workerFunction(KTX2DecoderModule) {\n if (typeof KTX2DecoderModule === \"undefined\" && typeof KTX2DECODER !== \"undefined\") {\n KTX2DecoderModule = KTX2DECODER;\n }\n let ktx2Decoder;\n onmessage = (event) => {\n if (!event.data) {\n return;\n }\n switch (event.data.action) {\n case \"init\": {\n const urls = event.data.urls;\n if (urls) {\n if (urls.jsDecoderModule && typeof KTX2DecoderModule === \"undefined\") {\n importScripts(urls.jsDecoderModule);\n // assuming global namespace populated by the script (UMD pattern)\n KTX2DecoderModule = KTX2DECODER;\n }\n applyConfig(urls);\n }\n if (event.data.wasmBinaries) {\n applyConfig(undefined, { ...event.data.wasmBinaries, jsDecoderModule: KTX2DecoderModule });\n }\n ktx2Decoder = new KTX2DecoderModule.KTX2Decoder();\n postMessage({ action: \"init\" });\n break;\n }\n case \"setDefaultDecoderOptions\": {\n KTX2DecoderModule.KTX2Decoder.DefaultDecoderOptions = event.data.options;\n break;\n }\n case \"decode\":\n ktx2Decoder\n .decode(event.data.data, event.data.caps, event.data.options)\n // eslint-disable-next-line github/no-then\n .then((data) => {\n const buffers = [];\n for (let mip = 0; mip < data.mipmaps.length; ++mip) {\n const mipmap = data.mipmaps[mip];\n if (mipmap && mipmap.data) {\n buffers.push(mipmap.data.buffer);\n }\n }\n postMessage({ action: \"decoded\", success: true, decodedData: data }, buffers);\n })\n // eslint-disable-next-line github/no-then\n .catch((reason) => {\n postMessage({ action: \"decoded\", success: false, msg: reason });\n });\n break;\n }\n };\n}\nexport async function initializeWebWorker(worker, wasmBinaries, urls) {\n return await new Promise((resolve, reject) => {\n const onError = (error) => {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n };\n const onMessage = (message) => {\n if (message.data.action === \"init\") {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n resolve(worker);\n }\n };\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"message\", onMessage);\n worker.postMessage({\n action: \"init\",\n urls,\n wasmBinaries,\n });\n });\n}\n//# sourceMappingURL=khronosTextureContainer2Worker.js.map","\nimport { AutoReleaseWorkerPool } from \"./workerPool.js\";\nimport { Tools } from \"./tools.js\";\nimport { TranscodeTarget } from \"../Materials/Textures/ktx2decoderTypes.js\";\nimport { applyConfig, initializeWebWorker, workerFunction } from \"./khronosTextureContainer2Worker.js\";\n/**\n * Class that defines the default KTX2 decoder options.\n *\n * This class is useful for providing options to the KTX2 decoder to control how the source data is transcoded.\n */\nexport class DefaultKTX2DecoderOptions {\n constructor() {\n this._isDirty = true;\n this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC = true;\n this._ktx2DecoderOptions = {};\n }\n /**\n * Gets the dirty flag\n */\n get isDirty() {\n return this._isDirty;\n }\n /**\n * force a (uncompressed) RGBA transcoded format if transcoding a UASTC source format and ASTC + BC7 are not available as a compressed transcoded format\n */\n get useRGBAIfASTCBC7NotAvailableWhenUASTC() {\n return this._useRGBAIfASTCBC7NotAvailableWhenUASTC;\n }\n set useRGBAIfASTCBC7NotAvailableWhenUASTC(value) {\n if (this._useRGBAIfASTCBC7NotAvailableWhenUASTC === value) {\n return;\n }\n this._useRGBAIfASTCBC7NotAvailableWhenUASTC = value;\n this._isDirty = true;\n }\n /**\n * force a (uncompressed) RGBA transcoded format if transcoding a UASTC source format and only BC1 or BC3 are available as a compressed transcoded format.\n * This property is true by default to favor speed over memory, because currently transcoding from UASTC to BC1/3 is slow because the transcoder transcodes\n * to uncompressed and then recompresses the texture\n */\n get useRGBAIfOnlyBC1BC3AvailableWhenUASTC() {\n return this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC;\n }\n set useRGBAIfOnlyBC1BC3AvailableWhenUASTC(value) {\n if (this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC === value) {\n return;\n }\n this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC = value;\n this._isDirty = true;\n }\n /**\n * force to always use (uncompressed) RGBA for transcoded format\n */\n get forceRGBA() {\n return this._forceRGBA;\n }\n set forceRGBA(value) {\n if (this._forceRGBA === value) {\n return;\n }\n this._forceRGBA = value;\n this._isDirty = true;\n }\n /**\n * force to always use (uncompressed) R8 for transcoded format\n */\n get forceR8() {\n return this._forceR8;\n }\n set forceR8(value) {\n if (this._forceR8 === value) {\n return;\n }\n this._forceR8 = value;\n this._isDirty = true;\n }\n /**\n * force to always use (uncompressed) RG8 for transcoded format\n */\n get forceRG8() {\n return this._forceRG8;\n }\n set forceRG8(value) {\n if (this._forceRG8 === value) {\n return;\n }\n this._forceRG8 = value;\n this._isDirty = true;\n }\n /**\n * list of transcoders to bypass when looking for a suitable transcoder. The available transcoders are:\n * UniversalTranscoder_UASTC_ASTC\n * UniversalTranscoder_UASTC_BC7\n * UniversalTranscoder_UASTC_RGBA_UNORM\n * UniversalTranscoder_UASTC_RGBA_SRGB\n * UniversalTranscoder_UASTC_R8_UNORM\n * UniversalTranscoder_UASTC_RG8_UNORM\n * MSCTranscoder\n */\n get bypassTranscoders() {\n return this._bypassTranscoders;\n }\n set bypassTranscoders(value) {\n if (this._bypassTranscoders === value) {\n return;\n }\n this._bypassTranscoders = value;\n this._isDirty = true;\n }\n /** @internal */\n _getKTX2DecoderOptions() {\n if (!this._isDirty) {\n return this._ktx2DecoderOptions;\n }\n this._isDirty = false;\n const options = {\n useRGBAIfASTCBC7NotAvailableWhenUASTC: this._useRGBAIfASTCBC7NotAvailableWhenUASTC,\n forceRGBA: this._forceRGBA,\n forceR8: this._forceR8,\n forceRG8: this._forceRG8,\n bypassTranscoders: this._bypassTranscoders,\n };\n if (this.useRGBAIfOnlyBC1BC3AvailableWhenUASTC) {\n options.transcodeFormatDecisionTree = {\n UASTC: {\n transcodeFormat: [TranscodeTarget.BC1_RGB, TranscodeTarget.BC3_RGBA],\n yes: {\n transcodeFormat: TranscodeTarget.RGBA32,\n engineFormat: 32856 /* EngineFormat.RGBA8Format */,\n roundToMultiple4: false,\n },\n },\n };\n }\n this._ktx2DecoderOptions = options;\n return options;\n }\n}\n/**\n * Class for loading KTX2 files\n */\nexport class KhronosTextureContainer2 {\n static GetDefaultNumWorkers() {\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\n return 1;\n }\n // Use 50% of the available logical processors but capped at 4.\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\n }\n static _Initialize(numWorkers) {\n if (KhronosTextureContainer2._WorkerPoolPromise || KhronosTextureContainer2._DecoderModulePromise) {\n return;\n }\n const urls = {\n jsDecoderModule: Tools.GetBabylonScriptURL(this.URLConfig.jsDecoderModule, true),\n wasmUASTCToASTC: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToASTC, true),\n wasmUASTCToBC7: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToBC7, true),\n wasmUASTCToRGBA_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRGBA_UNORM, true),\n wasmUASTCToRGBA_SRGB: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRGBA_SRGB, true),\n wasmUASTCToR8_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToR8_UNORM, true),\n wasmUASTCToRG8_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRG8_UNORM, true),\n jsMSCTranscoder: Tools.GetBabylonScriptURL(this.URLConfig.jsMSCTranscoder, true),\n wasmMSCTranscoder: Tools.GetBabylonScriptURL(this.URLConfig.wasmMSCTranscoder, true),\n wasmZSTDDecoder: Tools.GetBabylonScriptURL(this.URLConfig.wasmZSTDDecoder, true),\n };\n if (numWorkers && typeof Worker === \"function\" && typeof URL !== \"undefined\") {\n KhronosTextureContainer2._WorkerPoolPromise = new Promise((resolve) => {\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n const workerContent = `${applyConfig}(${workerFunction})()`;\n const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\n resolve(new AutoReleaseWorkerPool(numWorkers, async () => await initializeWebWorker(new Worker(workerBlobUrl), undefined, urls)));\n });\n }\n else {\n if (typeof KhronosTextureContainer2._KTX2DecoderModule === \"undefined\") {\n // eslint-disable-next-line github/no-then\n KhronosTextureContainer2._DecoderModulePromise = Tools.LoadBabylonScriptAsync(urls.jsDecoderModule).then(() => {\n KhronosTextureContainer2._KTX2DecoderModule = KTX2DECODER;\n KhronosTextureContainer2._KTX2DecoderModule.MSCTranscoder.UseFromWorkerThread = false;\n KhronosTextureContainer2._KTX2DecoderModule.WASMMemoryManager.LoadBinariesFromCurrentThread = true;\n applyConfig(urls, KhronosTextureContainer2._KTX2DecoderModule);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return new KhronosTextureContainer2._KTX2DecoderModule.KTX2Decoder();\n });\n }\n else {\n KhronosTextureContainer2._KTX2DecoderModule.MSCTranscoder.UseFromWorkerThread = false;\n KhronosTextureContainer2._KTX2DecoderModule.WASMMemoryManager.LoadBinariesFromCurrentThread = true;\n KhronosTextureContainer2._DecoderModulePromise = Promise.resolve(new KhronosTextureContainer2._KTX2DecoderModule.KTX2Decoder());\n }\n }\n }\n /**\n * Constructor\n * @param engine The engine to use\n * @param numWorkersOrOptions The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\n */\n constructor(engine, numWorkersOrOptions = KhronosTextureContainer2.DefaultNumWorkers) {\n this._engine = engine;\n const workerPoolOption = (typeof numWorkersOrOptions === \"object\" && numWorkersOrOptions.workerPool) || KhronosTextureContainer2.WorkerPool;\n if (workerPoolOption) {\n KhronosTextureContainer2._WorkerPoolPromise = Promise.resolve(workerPoolOption);\n }\n else {\n // set the KTX2 decoder module\n if (typeof numWorkersOrOptions === \"object\") {\n KhronosTextureContainer2._KTX2DecoderModule = numWorkersOrOptions?.binariesAndModulesContainer?.jsDecoderModule;\n }\n else if (typeof KTX2DECODER !== \"undefined\") {\n KhronosTextureContainer2._KTX2DecoderModule = KTX2DECODER;\n }\n const numberOfWorkers = typeof numWorkersOrOptions === \"number\" ? numWorkersOrOptions : (numWorkersOrOptions.numWorkers ?? KhronosTextureContainer2.DefaultNumWorkers);\n KhronosTextureContainer2._Initialize(numberOfWorkers);\n }\n }\n /**\n * @internal\n */\n async _uploadAsync(data, internalTexture, options) {\n const caps = this._engine.getCaps();\n const compressedTexturesCaps = {\n astc: !!caps.astc,\n bptc: !!caps.bptc,\n s3tc: !!caps.s3tc,\n pvrtc: !!caps.pvrtc,\n etc2: !!caps.etc2,\n etc1: !!caps.etc1,\n };\n if (KhronosTextureContainer2._WorkerPoolPromise) {\n const workerPool = await KhronosTextureContainer2._WorkerPoolPromise;\n return await new Promise((resolve, reject) => {\n workerPool.push((worker, onComplete) => {\n const onError = (error) => {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n onComplete();\n };\n const onMessage = (message) => {\n if (message.data.action === \"decoded\") {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n if (!message.data.success) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject({ message: message.data.msg });\n }\n else {\n try {\n this._createTexture(message.data.decodedData, internalTexture, options);\n resolve();\n }\n catch (err) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject({ message: err });\n }\n }\n onComplete();\n }\n };\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"message\", onMessage);\n worker.postMessage({ action: \"setDefaultDecoderOptions\", options: KhronosTextureContainer2.DefaultDecoderOptions._getKTX2DecoderOptions() });\n const dataCopy = new Uint8Array(data.byteLength);\n dataCopy.set(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));\n worker.postMessage({ action: \"decode\", data: dataCopy, caps: compressedTexturesCaps, options }, [dataCopy.buffer]);\n });\n });\n }\n else if (KhronosTextureContainer2._DecoderModulePromise) {\n const decoder = await KhronosTextureContainer2._DecoderModulePromise;\n if (KhronosTextureContainer2.DefaultDecoderOptions.isDirty) {\n KhronosTextureContainer2._KTX2DecoderModule.KTX2Decoder.DefaultDecoderOptions = KhronosTextureContainer2.DefaultDecoderOptions._getKTX2DecoderOptions();\n }\n return await new Promise((resolve, reject) => {\n decoder\n .decode(data, caps)\n // eslint-disable-next-line github/no-then\n .then((data) => {\n this._createTexture(data, internalTexture);\n resolve();\n })\n // eslint-disable-next-line github/no-then\n .catch((reason) => {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject({ message: reason });\n });\n });\n }\n throw new Error(\"KTX2 decoder module is not available\");\n }\n _createTexture(data, internalTexture, options) {\n const oglTexture2D = 3553; // gl.TEXTURE_2D\n this._engine._bindTextureDirectly(oglTexture2D, internalTexture);\n if (options) {\n // return back some information about the decoded data\n options.transcodedFormat = data.transcodedFormat;\n options.isInGammaSpace = data.isInGammaSpace;\n options.hasAlpha = data.hasAlpha;\n options.transcoderName = data.transcoderName;\n }\n let isUncompressedFormat = true;\n switch (data.transcodedFormat) {\n case 0x8058 /* RGBA8 */:\n internalTexture.type = 0;\n internalTexture.format = 5;\n break;\n case 0x8229 /* R8 */:\n internalTexture.type = 0;\n internalTexture.format = 6;\n break;\n case 0x822b /* RG8 */:\n internalTexture.type = 0;\n internalTexture.format = 7;\n break;\n default:\n internalTexture.format = data.transcodedFormat;\n isUncompressedFormat = false;\n break;\n }\n internalTexture._gammaSpace = data.isInGammaSpace;\n internalTexture.generateMipMaps = data.mipmaps.length > 1;\n if (data.errors) {\n throw new Error(\"KTX2 container - could not transcode the data. \" + data.errors);\n }\n for (let t = 0; t < data.mipmaps.length; ++t) {\n const mipmap = data.mipmaps[t];\n if (!mipmap || !mipmap.data) {\n throw new Error(\"KTX2 container - could not transcode one of the image\");\n }\n if (isUncompressedFormat) {\n // uncompressed RGBA / R8 / RG8\n internalTexture.width = mipmap.width; // need to set width/height so that the call to _uploadDataToTextureDirectly uses the right dimensions\n internalTexture.height = mipmap.height;\n this._engine._uploadDataToTextureDirectly(internalTexture, mipmap.data, 0, t, undefined, true);\n }\n else {\n this._engine._uploadCompressedDataToTextureDirectly(internalTexture, data.transcodedFormat, mipmap.width, mipmap.height, mipmap.data, 0, t);\n }\n }\n internalTexture._extension = \".ktx2\";\n internalTexture.width = data.mipmaps[0].width;\n internalTexture.height = data.mipmaps[0].height;\n internalTexture.isReady = true;\n this._engine._bindTextureDirectly(oglTexture2D, null);\n }\n /**\n * Checks if the given data starts with a KTX2 file identifier.\n * @param data the data to check\n * @returns true if the data is a KTX2 file or false otherwise\n */\n static IsValid(data) {\n if (data.byteLength >= 12) {\n // '«', 'K', 'T', 'X', ' ', '2', '0', '»', '\\r', '\\n', '\\x1A', '\\n'\n const identifier = new Uint8Array(data.buffer, data.byteOffset, 12);\n if (identifier[0] === 0xab &&\n identifier[1] === 0x4b &&\n identifier[2] === 0x54 &&\n identifier[3] === 0x58 &&\n identifier[4] === 0x20 &&\n identifier[5] === 0x32 &&\n identifier[6] === 0x30 &&\n identifier[7] === 0xbb &&\n identifier[8] === 0x0d &&\n identifier[9] === 0x0a &&\n identifier[10] === 0x1a &&\n identifier[11] === 0x0a) {\n return true;\n }\n }\n return false;\n }\n}\n/**\n * URLs to use when loading the KTX2 decoder module as well as its dependencies\n * If a url is null, the default url is used (pointing to https://preview.babylonjs.com)\n * Note that jsDecoderModule can't be null and that the other dependencies will only be loaded if necessary\n * Urls you can change:\n * URLConfig.jsDecoderModule\n * URLConfig.wasmUASTCToASTC\n * URLConfig.wasmUASTCToBC7\n * URLConfig.wasmUASTCToRGBA_UNORM\n * URLConfig.wasmUASTCToRGBA_SRGB\n * URLConfig.wasmUASTCToR8_UNORM\n * URLConfig.wasmUASTCToRG8_UNORM\n * URLConfig.jsMSCTranscoder\n * URLConfig.wasmMSCTranscoder\n * URLConfig.wasmZSTDDecoder\n * You can see their default values in this PG: https://playground.babylonjs.com/#EIJH8L#29\n */\nKhronosTextureContainer2.URLConfig = {\n jsDecoderModule: \"https://cdn.babylonjs.com/babylon.ktx2Decoder.js\",\n wasmUASTCToASTC: null,\n wasmUASTCToBC7: null,\n wasmUASTCToRGBA_UNORM: null,\n wasmUASTCToRGBA_SRGB: null,\n wasmUASTCToR8_UNORM: null,\n wasmUASTCToRG8_UNORM: null,\n jsMSCTranscoder: null,\n wasmMSCTranscoder: null,\n wasmZSTDDecoder: null,\n};\n/**\n * Default number of workers used to handle data decoding\n */\nKhronosTextureContainer2.DefaultNumWorkers = KhronosTextureContainer2.GetDefaultNumWorkers();\n/**\n * Default configuration for the KTX2 decoder.\n * The options defined in this way have priority over those passed when creating a KTX2 texture with new Texture(...).\n */\nKhronosTextureContainer2.DefaultDecoderOptions = new DefaultKTX2DecoderOptions();\n//# sourceMappingURL=khronosTextureContainer2.js.map","import { KhronosTextureContainer } from \"../../../Misc/khronosTextureContainer.js\";\nimport { KhronosTextureContainer2 } from \"../../../Misc/khronosTextureContainer2.js\";\nimport { Logger } from \"../../../Misc/logger.js\";\n\nfunction MapSRGBToLinear(format) {\n switch (format) {\n case 35916:\n return 33776;\n case 35918:\n return 33778;\n case 35919:\n return 33779;\n case 37493:\n return 37492;\n case 37497:\n return 37496;\n case 37495:\n return 37494;\n case 37840:\n return 37808;\n case 36493:\n return 36492;\n }\n return null;\n}\n/**\n * Implementation of the KTX Texture Loader.\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _KTXTextureLoader {\n constructor() {\n /**\n * Defines whether the loader supports cascade loading the different faces.\n */\n this.supportCascades = false;\n }\n /**\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\n * @param data contains the texture data\n * @param texture defines the BabylonJS internal texture\n * @param createPolynomials will be true if polynomials have been requested\n * @param onLoad defines the callback to trigger once the texture is ready\n */\n loadCubeData(data, texture, createPolynomials, onLoad) {\n if (Array.isArray(data)) {\n return;\n }\n // Need to invert vScale as invertY via UNPACK_FLIP_Y_WEBGL is not supported by compressed texture\n texture._invertVScale = !texture.invertY;\n const engine = texture.getEngine();\n const ktx = new KhronosTextureContainer(data, 6);\n const loadMipmap = ktx.numberOfMipmapLevels > 1 && texture.generateMipMaps;\n engine._unpackFlipY(true);\n ktx.uploadLevels(texture, texture.generateMipMaps);\n texture.width = ktx.pixelWidth;\n texture.height = ktx.pixelHeight;\n engine._setCubeMapTextureParams(texture, loadMipmap, ktx.numberOfMipmapLevels - 1);\n texture.isReady = true;\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n if (onLoad) {\n onLoad();\n }\n }\n /**\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\n * @param data contains the texture data\n * @param texture defines the BabylonJS internal texture\n * @param callback defines the method to call once ready to upload\n * @param options\n */\n loadData(data, texture, callback, options) {\n if (KhronosTextureContainer.IsValid(data)) {\n // Need to invert vScale as invertY via UNPACK_FLIP_Y_WEBGL is not supported by compressed texture\n texture._invertVScale = !texture.invertY;\n const ktx = new KhronosTextureContainer(data, 1);\n const mappedFormat = MapSRGBToLinear(ktx.glInternalFormat);\n if (mappedFormat) {\n texture.format = mappedFormat;\n texture._useSRGBBuffer = texture.getEngine()._getUseSRGBBuffer(true, texture.generateMipMaps);\n texture._gammaSpace = true;\n }\n else {\n texture.format = ktx.glInternalFormat;\n }\n callback(ktx.pixelWidth, ktx.pixelHeight, texture.generateMipMaps, true, () => {\n ktx.uploadLevels(texture, texture.generateMipMaps);\n }, ktx.isInvalid);\n }\n else if (KhronosTextureContainer2.IsValid(data)) {\n const ktx2 = new KhronosTextureContainer2(texture.getEngine());\n // eslint-disable-next-line github/no-then\n ktx2._uploadAsync(data, texture, options).then(() => {\n callback(texture.width, texture.height, texture.generateMipMaps, true, () => { }, false);\n }, (error) => {\n Logger.Warn(`Failed to load KTX2 texture data: ${error.message}`);\n callback(0, 0, false, false, () => { }, true);\n });\n }\n else {\n Logger.Error(\"texture missing KTX identifier\");\n callback(0, 0, false, false, () => { }, true);\n }\n }\n}\n//# sourceMappingURL=ktxTextureLoader.js.map"],"names":["KhronosTextureContainer","data","facesExpected","Logger","dataSize","headerDataView","littleEndian","texture","loadMipmaps","dataOffset","width","height","mipmapCount","level","imageSize","face","byteArray","identifier","WorkerPool","workers","worker","workerInfo","action","nextAction","AutoReleaseWorkerPool","maxWorkers","createWorkerAsync","options","onComplete","indexOf","SourceTextureFormat","TranscodeTarget","EngineFormat","applyConfig","urls","binariesAndModulesContainer","KTX2DecoderModule","workerFunction","ktx2Decoder","event","buffers","mip","mipmap","reason","initializeWebWorker","wasmBinaries","resolve","reject","onError","error","onMessage","message","DefaultKTX2DecoderOptions","value","KhronosTextureContainer2","numWorkers","Tools","workerContent","workerBlobUrl","engine","numWorkersOrOptions","workerPoolOption","_a","numberOfWorkers","internalTexture","caps","compressedTexturesCaps","workerPool","err","dataCopy","decoder","isUncompressedFormat","t","MapSRGBToLinear","format","_KTXTextureLoader","createPolynomials","onLoad","ktx","loadMipmap","callback","mappedFormat"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A,GAAK,EAAI;AAAA,IAC5D,CAAa,KAGD7E,EAAO,MAAM,gCAAgC,GAC7C6E,EAAS,GAAG,GAAG,IAAO,IAAO,MAAM;AAAA,IAAA,GAAK,EAAI;AAAA,EAExD;AACA;","x_google_ignoreList":[0,1,2,3,4,5]}
@@ -1,4 +1,4 @@
1
- import { S as e } from "./index-ChGTkj2q.js";
1
+ import { S as e } from "./index-DM3Dwe0V.js";
2
2
  const n = "mainUVVaryingDeclaration", r = `#ifdef MAINUV{X}
3
3
  varying vMainUV{X}: vec2f;
4
4
  #endif
@@ -9,4 +9,4 @@ uniform logarithmicDepthConstant: f32;varying vFragmentDepth: f32;
9
9
  #endif
10
10
  `;
11
11
  e.IncludesShadersStoreWGSL[a] || (e.IncludesShadersStoreWGSL[a] = t);
12
- //# sourceMappingURL=logDepthDeclaration-BHUUDd5l.js.map
12
+ //# sourceMappingURL=logDepthDeclaration--8Jq3fys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logDepthDeclaration-BHUUDd5l.js","sources":["../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/mainUVVaryingDeclaration.js","../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/logDepthDeclaration.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"mainUVVaryingDeclaration\";\nconst shader = `#ifdef MAINUV{X}\nvarying vMainUV{X}: vec2f;\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const mainUVVaryingDeclarationWGSL = { name, shader };\n//# sourceMappingURL=mainUVVaryingDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"logDepthDeclaration\";\nconst shader = `#ifdef LOGARITHMICDEPTH\nuniform logarithmicDepthConstant: f32;varying vFragmentDepth: f32;\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const logDepthDeclarationWGSL = { name, shader };\n//# sourceMappingURL=logDepthDeclaration.js.map"],"names":["name","shader","ShaderStore"],"mappings":";AAEA,MAAMA,IAAO,4BACPC,IAAS;AAAA;AAAA;AAAA;AAKVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;ACPjD,MAAMD,IAAO,uBACPC,IAAS;AAAA;AAAA;AAAA;AAKVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"logDepthDeclaration--8Jq3fys.js","sources":["../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/mainUVVaryingDeclaration.js","../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/logDepthDeclaration.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"mainUVVaryingDeclaration\";\nconst shader = `#ifdef MAINUV{X}\nvarying vMainUV{X}: vec2f;\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const mainUVVaryingDeclarationWGSL = { name, shader };\n//# sourceMappingURL=mainUVVaryingDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"logDepthDeclaration\";\nconst shader = `#ifdef LOGARITHMICDEPTH\nuniform logarithmicDepthConstant: f32;varying vFragmentDepth: f32;\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const logDepthDeclarationWGSL = { name, shader };\n//# sourceMappingURL=logDepthDeclaration.js.map"],"names":["name","shader","ShaderStore"],"mappings":";AAEA,MAAMA,IAAO,4BACPC,IAAS;AAAA;AAAA;AAAA;AAKVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;ACPjD,MAAMD,IAAO,uBACPC,IAAS;AAAA;AAAA;AAAA;AAKVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;","x_google_ignoreList":[0,1]}
@@ -1,4 +1,4 @@
1
- import { S as e } from "./index-ChGTkj2q.js";
1
+ import { S as e } from "./index-DM3Dwe0V.js";
2
2
  const o = "sceneUboDeclaration", i = `layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;
3
3
  #ifdef MULTIVIEW
4
4
  mat4 viewProjectionR;
@@ -25,4 +25,4 @@ uniform float logarithmicDepthConstant;varying float vFragmentDepth;
25
25
  #endif
26
26
  `;
27
27
  e.IncludesShadersStore[a] || (e.IncludesShadersStore[a] = d);
28
- //# sourceMappingURL=logDepthDeclaration-Bou5AJOP.js.map
28
+ //# sourceMappingURL=logDepthDeclaration-DcveQRTq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logDepthDeclaration-Bou5AJOP.js","sources":["../node_modules/@babylonjs/core/Shaders/ShadersInclude/sceneUboDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/meshUboDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/mainUVVaryingDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"sceneUboDeclaration\";\nconst shader = `layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif \nmat4 view;mat4 projection;vec4 vEyePosition;};\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const sceneUboDeclaration = { name, shader };\n//# sourceMappingURL=sceneUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"meshUboDeclaration\";\nconst shader = `#ifdef WEBGL2\nuniform mat4 world;uniform float visibility;\n#else\nlayout(std140,column_major) uniform;uniform Mesh\n{mat4 world;float visibility;};\n#endif\n#define WORLD_UBO\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const meshUboDeclaration = { name, shader };\n//# sourceMappingURL=meshUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"mainUVVaryingDeclaration\";\nconst shader = `#ifdef MAINUV{X}\nvarying vec2 vMainUV{X};\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const mainUVVaryingDeclaration = { name, shader };\n//# sourceMappingURL=mainUVVaryingDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"logDepthDeclaration\";\nconst shader = `#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;varying float vFragmentDepth;\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const logDepthDeclaration = { name, shader };\n//# sourceMappingURL=logDepthDeclaration.js.map"],"names":["name","shader","ShaderStore"],"mappings":";AAEA,MAAMA,IAAO,uBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAOVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;ACT7C,MAAMD,IAAO,sBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;ACX7C,MAAMD,IAAO,4BACPC,IAAS;AAAA;AAAA;AAAA;AAKVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;ACP7C,MAAMD,IAAO,uBACPC,IAAS;AAAA;AAAA;AAAA;AAKVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;","x_google_ignoreList":[0,1,2,3]}
1
+ {"version":3,"file":"logDepthDeclaration-DcveQRTq.js","sources":["../node_modules/@babylonjs/core/Shaders/ShadersInclude/sceneUboDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/meshUboDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/mainUVVaryingDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"sceneUboDeclaration\";\nconst shader = `layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif \nmat4 view;mat4 projection;vec4 vEyePosition;};\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const sceneUboDeclaration = { name, shader };\n//# sourceMappingURL=sceneUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"meshUboDeclaration\";\nconst shader = `#ifdef WEBGL2\nuniform mat4 world;uniform float visibility;\n#else\nlayout(std140,column_major) uniform;uniform Mesh\n{mat4 world;float visibility;};\n#endif\n#define WORLD_UBO\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const meshUboDeclaration = { name, shader };\n//# sourceMappingURL=meshUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"mainUVVaryingDeclaration\";\nconst shader = `#ifdef MAINUV{X}\nvarying vec2 vMainUV{X};\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const mainUVVaryingDeclaration = { name, shader };\n//# sourceMappingURL=mainUVVaryingDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"logDepthDeclaration\";\nconst shader = `#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;varying float vFragmentDepth;\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const logDepthDeclaration = { name, shader };\n//# sourceMappingURL=logDepthDeclaration.js.map"],"names":["name","shader","ShaderStore"],"mappings":";AAEA,MAAMA,IAAO,uBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAOVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;ACT7C,MAAMD,IAAO,sBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;ACX7C,MAAMD,IAAO,4BACPC,IAAS;AAAA;AAAA;AAAA;AAKVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;ACP7C,MAAMD,IAAO,uBACPC,IAAS;AAAA;AAAA;AAAA;AAKVC,EAAY,qBAAqBF,CAAI,MACtCE,EAAY,qBAAqBF,CAAI,IAAIC;","x_google_ignoreList":[0,1,2,3]}
@@ -1,4 +1,4 @@
1
- import { S as e } from "./index-ChGTkj2q.js";
1
+ import { S as e } from "./index-DM3Dwe0V.js";
2
2
  const i = "decalVertexDeclaration", g = `#ifdef DECAL
3
3
  uniform vec4 vDecalInfos;uniform mat4 decalMatrix;
4
4
  #endif
@@ -493,4 +493,4 @@ vFragmentDepth=1.0+gl_Position.w;gl_Position.z=log2(max(0.000001,vFragmentDepth)
493
493
  #endif
494
494
  `;
495
495
  e.IncludesShadersStore[M] || (e.IncludesShadersStore[M] = J);
496
- //# sourceMappingURL=logDepthVertex-r_niddz9.js.map
496
+ //# sourceMappingURL=logDepthVertex-BiWlUDke.js.map