@arcgis/core 5.2.0-next.72 → 5.2.0-next.74

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 (357) hide show
  1. package/analysis/ViewshedAnalysis.js +1 -1
  2. package/arcgisGlobal.d.ts +1 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{d3be4d914fc99a1d686c.js → 075e65cc4275ac886f08.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{3b3a8a6167f2e1eeb828.js → 0823961e5d0bdedbf8cf.js} +2 -2
  6. package/assets/esri/core/workers/chunks/087bd698b80ca0cea71e.js +1 -0
  7. package/assets/esri/core/workers/chunks/{b6c7b7b7f87dce5de811.js → 0bf644f93c180a2bc2f8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{a62f1b8ed065b2a38f1a.js → 0dbf31a663b5220a3136.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{fe10a95ebe1da2322af6.js → 0df660dfd941cff3ea1d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/0e81c6d4f1c81f9b0a1b.js +1 -0
  11. package/assets/esri/core/workers/chunks/{d93d0cb69f3a9a722510.js → 1418c03c4ab87f7ab5f4.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{c03da138651ac53cadcb.js → 186bedc377cc97731ca2.js} +2 -2
  13. package/assets/esri/core/workers/chunks/193aed69de2dec4f36b6.js +1 -0
  14. package/assets/esri/core/workers/chunks/1a3afee3ecd806b4aa81.js +1 -0
  15. package/assets/esri/core/workers/chunks/{359584a8fb5687a7d098.js → 264fd750691d517ab1f3.js} +1 -1
  16. package/assets/esri/core/workers/chunks/28f87daaba1ae3441364.js +1 -0
  17. package/assets/esri/core/workers/chunks/{fff23b2682590c4b21e3.js → 2a2ed7bd44010f24c2dd.js} +1 -1
  18. package/assets/esri/core/workers/chunks/2baa16ec8559e77c226f.js +1 -0
  19. package/assets/esri/core/workers/chunks/2c31648a4b95275516ee.js +1 -0
  20. package/assets/esri/core/workers/chunks/2e44978ee677aa23163d.js +256 -0
  21. package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +1 -0
  22. package/assets/esri/core/workers/chunks/305eea9c1fc4aee3309e.js +1 -0
  23. package/assets/esri/core/workers/chunks/31d19bb72a9e79b30070.js +1 -0
  24. package/assets/esri/core/workers/chunks/{fc2cae359d571690d754.js → 35fd2f765d2cb3f59a22.js} +4 -4
  25. package/assets/esri/core/workers/chunks/{6b208bac120bcfecd9e4.js → 3e2b4e734aa20a308f3e.js} +1 -1
  26. package/assets/esri/core/workers/chunks/45ccca01db0027b9dc16.js +1 -0
  27. package/assets/esri/core/workers/chunks/495f90fe3d0ad32bb82d.js +1 -0
  28. package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +1 -0
  29. package/assets/esri/core/workers/chunks/{50e0dd74795978468625.js → 4cf2b0558a4acc141429.js} +1 -1
  30. package/assets/esri/core/workers/chunks/509aecafbc629bee1c15.js +1 -0
  31. package/assets/esri/core/workers/chunks/{d901f8503a73277cfa58.js → 553be2bd69bd311477ea.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{2d3a18d56e2e5669c562.js → 64176f7ae719289a2f79.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{31669511cfddf116d991.js → 66e60351aacbd162775f.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{9684ab5e8254fdfcb7bb.js → 67f54586156d1ab80257.js} +1 -1
  35. package/assets/esri/core/workers/chunks/762be5d3e6aeaea33f74.js +29 -0
  36. package/assets/esri/core/workers/chunks/76b573143d1a65fdbcb6.js +1 -0
  37. package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +1 -0
  38. package/assets/esri/core/workers/chunks/{fa19d5923276418096da.js → 7b5b66ae79e0287e3ade.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{2cfe6f41865ffb3a4645.js → 7e373d9c98ce910db9d2.js} +1 -1
  40. package/assets/esri/core/workers/chunks/81130dbcb738d40f723b.js +1 -0
  41. package/assets/esri/core/workers/chunks/{4da993c79b373b9d304e.js → 8302bffd28cc6720e0fe.js} +2 -2
  42. package/assets/esri/core/workers/chunks/835af7b4fd92cb4e7af0.js +1 -0
  43. package/assets/esri/core/workers/chunks/859dd86c921053bf03a1.js +1 -0
  44. package/assets/esri/core/workers/chunks/877594b6db08da98acd7.js +1 -0
  45. package/assets/esri/core/workers/chunks/{96d861265566854760cd.js → 88fd698b940dadcc6dc5.js} +1 -1
  46. package/assets/esri/core/workers/chunks/8f0d4aec8bd3cbfefc40.js +1 -0
  47. package/assets/esri/core/workers/chunks/{7f208ef75ef2ce0d7cf9.js → 910c93bbbf8113a4a51f.js} +1 -1
  48. package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +1 -0
  49. package/assets/esri/core/workers/chunks/{509cfac9e5d86a8ee449.js → 936d44c7bc3a181e64a3.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{b9953277d0cd4a01bdc6.js → 94368a097e6190ce3c7a.js} +1 -1
  51. package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +1 -0
  52. package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +1 -0
  53. package/assets/esri/core/workers/chunks/{c203df41f9d2e4b80889.js → 9ca59077712e45ef4d56.js} +1 -1
  54. package/assets/esri/core/workers/chunks/9e25f715cda59c686a4c.js +1 -0
  55. package/assets/esri/core/workers/chunks/{36171c72a3c04b0d13ef.js → a0a1f0bd3648738354a6.js} +1 -1
  56. package/assets/esri/core/workers/chunks/a101152066dd56259619.js +1 -0
  57. package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +1 -0
  58. package/assets/esri/core/workers/chunks/a50421fe79f264ae3619.js +1 -0
  59. package/assets/esri/core/workers/chunks/a9053ad0f4e8c4705665.js +1 -0
  60. package/assets/esri/core/workers/chunks/aca5c524bd3c955e9243.js +1 -0
  61. package/assets/esri/core/workers/chunks/{9dda9414104f585560a4.js → ad1d06a91121ebfe9162.js} +2 -2
  62. package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +1 -0
  63. package/assets/esri/core/workers/chunks/{065e3353124fc5ac44ce.js → b33d870cbfa238762c5e.js} +1 -1
  64. package/assets/esri/core/workers/chunks/b3b53cf0a3a30164d337.js +1 -0
  65. package/assets/esri/core/workers/chunks/b6d26d9738c0787acc38.js +1 -0
  66. package/assets/esri/core/workers/chunks/b9c61b20bbc91cb63036.js +1 -0
  67. package/assets/esri/core/workers/chunks/bf3dc3ad8df8488da3f0.js +1 -0
  68. package/assets/esri/core/workers/chunks/bff75cc7413bf0d319db.js +1 -0
  69. package/assets/esri/core/workers/chunks/c1568bcd3f04014152e1.js +1 -0
  70. package/assets/esri/core/workers/chunks/c1a4d499a30f3d80567b.js +1 -0
  71. package/assets/esri/core/workers/chunks/c374e5d5980db74c4aca.js +1 -0
  72. package/assets/esri/core/workers/chunks/{8c76f31a363dd0c3354d.js → c46f79d5b7712adbbd1c.js} +1 -1
  73. package/assets/esri/core/workers/chunks/c67e4a848d41038367b8.js +1 -0
  74. package/assets/esri/core/workers/chunks/{684d3cb4fb233180b2d0.js → cd892c9603710d6130a9.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{fa5d27e47d47ff8fcb96.js → d03e7be74c57c3dbf003.js} +2 -2
  76. package/assets/esri/core/workers/chunks/de5013f89f0eae93978f.js +1 -0
  77. package/assets/esri/core/workers/chunks/e557043f90c051e93925.js +1 -0
  78. package/assets/esri/core/workers/chunks/{bee5e738ecf8680909c4.js → eaf26c1cc938789d5336.js} +1 -1
  79. package/assets/esri/core/workers/chunks/ebfb3cdc0df15eb05d75.js +1 -0
  80. package/assets/esri/core/workers/chunks/f1727b4a32cb6f36a5e6.js +1 -0
  81. package/assets/esri/core/workers/chunks/f4bc563c71c478d3912f.js +1 -0
  82. package/assets/esri/core/workers/chunks/fb0b89bbb4f8607d5f20.js +1 -0
  83. package/assets/esri/core/workers/chunks/fdca9873914b9dbd9244.js +1 -0
  84. package/assets/esri/core/workers/chunks/ff890167ff2baabfc4ce.js +1 -0
  85. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  86. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  87. package/chunks/Component.glsl.js +3 -3
  88. package/chunks/HUDMaterial.glsl.js +8 -8
  89. package/chunks/lyr3DMain.js +1 -1
  90. package/config.js +1 -1
  91. package/kernel.js +1 -1
  92. package/layers/DimensionFeatureLayer.d.ts +22 -0
  93. package/layers/DimensionFeatureLayer.js +1 -1
  94. package/layers/ILyr3DWasmPerSceneView.js +1 -1
  95. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  96. package/layers/save/featureLayerUtils.js +1 -1
  97. package/layers/support/layerUtils.js +1 -1
  98. package/layers/support/layersMapping.js +1 -1
  99. package/layers/support/tiles3DUtils.js +1 -1
  100. package/layers/video/VideoController.js +1 -1
  101. package/package.json +3 -3
  102. package/support/revision.js +1 -1
  103. package/views/2d/engine/Bitmap.js +1 -1
  104. package/views/2d/engine/BitmapTile.js +1 -1
  105. package/views/2d/engine/BitmapTileContainer.js +1 -1
  106. package/views/2d/engine/flow/FlowContainer.js +1 -1
  107. package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
  108. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  109. package/views/2d/engine/flow/styles/Particles.js +1 -1
  110. package/views/2d/engine/flow/styles/Streamlines.js +1 -1
  111. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  112. package/views/2d/engine/imagery/RasterTile.js +1 -1
  113. package/views/2d/engine/imagery/RasterTileContainer.js +1 -1
  114. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  115. package/views/2d/engine/imagery/RasterVFTile.js +1 -1
  116. package/views/2d/engine/imagery/RasterVFTileContainer.js +1 -1
  117. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  118. package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
  119. package/views/2d/engine/webgl/Overlay.js +1 -1
  120. package/views/2d/engine/webgl/OverlayContainer.js +1 -1
  121. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  122. package/views/2d/engine/webgl/TileContainer.js +1 -1
  123. package/views/2d/engine/webgl/normalizedTileUtils.js +2 -0
  124. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  125. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
  126. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
  127. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
  128. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  129. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
  132. package/views/2d/engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js +1 -1
  133. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
  134. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  136. package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
  138. package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
  140. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  144. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
  146. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
  147. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  148. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  149. package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
  150. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
  151. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  152. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  153. package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
  154. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
  155. package/views/2d/engine/webgl/shaderGraph/techniques/raster/rasterVFUtils.js +2 -0
  156. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
  157. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
  158. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ClipShader.js +1 -1
  159. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
  160. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
  161. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DebugOverlayShader.js +1 -1
  162. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +1 -1
  163. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
  164. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
  165. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
  166. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
  167. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  168. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
  169. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OverlayShader.js +1 -1
  170. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
  171. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternOutlineFillShader.js +1 -1
  172. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
  173. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/Tile.js +2 -0
  174. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
  175. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js +2 -0
  176. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js +1 -1
  177. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js +1 -1
  178. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js +1 -1
  179. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowParticlesShader.js +1 -1
  180. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowStreamlinesShader.js +1 -1
  181. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowUtils.js +1 -1
  182. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  183. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
  184. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +1 -1
  185. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/MagDirShader.js +1 -1
  186. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterVFTransform.js +2 -0
  187. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/ScalarShader.js +1 -1
  188. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ReprojectShader.js +1 -1
  189. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
  190. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderCircle.js +1 -1
  191. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
  192. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
  193. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
  194. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderOutline.js +1 -1
  195. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
  196. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  197. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
  198. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
  199. package/views/2d/engine/webgl/shaderGraph/techniques/utility/DebugOverlayTechnique.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
  201. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
  202. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  203. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
  204. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  205. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  206. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  207. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  208. package/views/2d/layers/MediaLayerView2D.js +1 -1
  209. package/views/2d/layers/TileLayerView2D.js +1 -1
  210. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  211. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  212. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  213. package/views/2d/layers/support/DebugOverlay.js +1 -1
  214. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  215. package/views/3d/analysis/LineOfSight/LineOfSightAggregateManipulatedObject3D.js +1 -1
  216. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  217. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  218. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  219. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  220. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  221. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  222. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  223. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  224. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  225. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  226. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  227. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  228. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  229. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  230. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  231. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  232. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  233. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  234. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  235. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  236. package/views/3d/interactive/editingTools/settings.js +1 -1
  237. package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
  238. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  239. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  240. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  241. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  242. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  243. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  244. package/views/3d/interactive/manipulatorUtils.js +1 -1
  245. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  246. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  247. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  248. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  249. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  250. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  251. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  252. package/views/3d/layers/support/lyr3dTypeConversions.js +1 -1
  253. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  254. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  255. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  256. package/views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js +1 -1
  257. package/views/3d/webgl-engine/core/shaderLibrary/output/DepthConversion.glsl.js +14 -0
  258. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +3 -15
  259. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js +1 -1
  260. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  261. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  262. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  263. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  264. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  265. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  266. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  267. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  268. package/views/3d/webgl.js +1 -1
  269. package/views/VideoView.js +1 -1
  270. package/views/View.js +1 -1
  271. package/views/draw/DrawGraphicTool.js +1 -1
  272. package/views/draw/DrawOperation.js +1 -1
  273. package/views/draw/DrawTool.js +1 -1
  274. package/views/draw/plugins/PolylinePlugin.js +1 -1
  275. package/views/draw/support/Box.js +1 -1
  276. package/views/draw/support/InteractiveHandle.js +1 -1
  277. package/views/draw/support/Reshape.js +1 -1
  278. package/views/draw/support/drawToolUtils.js +1 -1
  279. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  280. package/views/draw/support/managers/TooltipManager.js +1 -1
  281. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  282. package/views/draw/support/tooltipUtils.js +1 -1
  283. package/views/interactive/options/InteractiveToolOptions.d.ts +36 -0
  284. package/views/interactive/options/InteractiveToolOptions.js +2 -0
  285. package/views/interactive/sketch/SketchOptions.d.ts +4 -3
  286. package/views/interactive/sketch/SketchOptions.js +1 -1
  287. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  288. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  289. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  290. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  291. package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
  292. package/views/interactive/tooltip/fields/fields.js +1 -1
  293. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  294. package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
  295. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  296. package/views/support/imageReprojection.js +1 -1
  297. package/widgets/Sketch/SketchViewModel.js +1 -1
  298. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  299. package/assets/esri/core/workers/chunks/0623acb2bd14a61b65c9.js +0 -29
  300. package/assets/esri/core/workers/chunks/06c9aac75a01d3af6d54.js +0 -1
  301. package/assets/esri/core/workers/chunks/089f8c60e96d920a2cb2.js +0 -1
  302. package/assets/esri/core/workers/chunks/0c3c311400ee352187ea.js +0 -1
  303. package/assets/esri/core/workers/chunks/158d2ac0333d53556e33.js +0 -1
  304. package/assets/esri/core/workers/chunks/16cade1c2ddf44e336ee.js +0 -1
  305. package/assets/esri/core/workers/chunks/1b130af7d14eaae69d96.js +0 -1
  306. package/assets/esri/core/workers/chunks/1e0140556c2e3fa72545.js +0 -1
  307. package/assets/esri/core/workers/chunks/1e5cb72830c7f32f2961.js +0 -1
  308. package/assets/esri/core/workers/chunks/259bdacfb7b0f866a8d0.js +0 -1
  309. package/assets/esri/core/workers/chunks/2f58e1f64df2da8259a2.js +0 -1
  310. package/assets/esri/core/workers/chunks/383304d33b496c5d8baa.js +0 -1
  311. package/assets/esri/core/workers/chunks/3aacb935d632834d4154.js +0 -1
  312. package/assets/esri/core/workers/chunks/3c8e98cf23ad8ef12fcb.js +0 -1
  313. package/assets/esri/core/workers/chunks/3dc71e03a630dd50b28e.js +0 -1
  314. package/assets/esri/core/workers/chunks/3fd022df127af32782ce.js +0 -1
  315. package/assets/esri/core/workers/chunks/4344ab1250a1c550bf8b.js +0 -1
  316. package/assets/esri/core/workers/chunks/43de723f765ec8f268ac.js +0 -1
  317. package/assets/esri/core/workers/chunks/4695cd6120f60b234d5c.js +0 -1
  318. package/assets/esri/core/workers/chunks/582a1d468089b9986416.js +0 -1
  319. package/assets/esri/core/workers/chunks/5f201c77a09ae0df29d6.js +0 -1
  320. package/assets/esri/core/workers/chunks/6080e46fc79127500283.js +0 -1
  321. package/assets/esri/core/workers/chunks/6357c7cac401aee9fe77.js +0 -1
  322. package/assets/esri/core/workers/chunks/67d3ff7fcefaa7d5d27f.js +0 -1
  323. package/assets/esri/core/workers/chunks/6a9002fcba11e2cf3f2e.js +0 -1
  324. package/assets/esri/core/workers/chunks/72dcd4bd1a28bf8605c5.js +0 -1
  325. package/assets/esri/core/workers/chunks/73f228d966b89c73c9e9.js +0 -1
  326. package/assets/esri/core/workers/chunks/77df0bb35d2688729479.js +0 -1
  327. package/assets/esri/core/workers/chunks/7a143ca61c0a70306185.js +0 -1
  328. package/assets/esri/core/workers/chunks/869d292a60747c93dc84.js +0 -1
  329. package/assets/esri/core/workers/chunks/9c57161ad48d8d546dc7.js +0 -1
  330. package/assets/esri/core/workers/chunks/a7f42ada0aa69873a938.js +0 -1
  331. package/assets/esri/core/workers/chunks/a988fd54912969b812ce.js +0 -1
  332. package/assets/esri/core/workers/chunks/aff0e7761276036e029d.js +0 -1
  333. package/assets/esri/core/workers/chunks/b7d8817018b3d277c454.js +0 -1
  334. package/assets/esri/core/workers/chunks/bfb6566c27c09deb0929.js +0 -1
  335. package/assets/esri/core/workers/chunks/c715c585c42d8c2b86f5.js +0 -1
  336. package/assets/esri/core/workers/chunks/c7e9513f75b8ec205562.js +0 -1
  337. package/assets/esri/core/workers/chunks/c838cc1c786368b78598.js +0 -1
  338. package/assets/esri/core/workers/chunks/cd4e5c948d1bfa9b9a2d.js +0 -1
  339. package/assets/esri/core/workers/chunks/cfe31b7d1c6c05fbd268.js +0 -1
  340. package/assets/esri/core/workers/chunks/d0c1bc90e474f706211c.js +0 -1
  341. package/assets/esri/core/workers/chunks/d2faac81142586cf7509.js +0 -1
  342. package/assets/esri/core/workers/chunks/da484787bd9fd3b13d15.js +0 -1
  343. package/assets/esri/core/workers/chunks/e21b3490bfce75405e55.js +0 -1
  344. package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +0 -1
  345. package/assets/esri/core/workers/chunks/e702abaeccef20b64a81.js +0 -1
  346. package/assets/esri/core/workers/chunks/ebd619533be077059494.js +0 -1
  347. package/assets/esri/core/workers/chunks/f475672ff4c2ec9367c2.js +0 -1
  348. package/assets/esri/core/workers/chunks/f69329b85b362b349a8c.js +0 -1
  349. package/assets/esri/core/workers/chunks/fba8065a3a6fbd877e23.js +0 -1
  350. package/assets/esri/core/workers/chunks/fd6107f95082e05f016a.js +0 -256
  351. package/assets/esri/core/workers/chunks/fec07a16b72cdcafc641.js +0 -1
  352. package/views/2d/engine/webgl/shaderGraph/techniques/line/utils.js +0 -2
  353. /package/assets/esri/core/workers/chunks/{3b3a8a6167f2e1eeb828.js.LICENSE.txt → 0823961e5d0bdedbf8cf.js.LICENSE.txt} +0 -0
  354. /package/assets/esri/core/workers/chunks/{c03da138651ac53cadcb.js.LICENSE.txt → 186bedc377cc97731ca2.js.LICENSE.txt} +0 -0
  355. /package/assets/esri/core/workers/chunks/{4da993c79b373b9d304e.js.LICENSE.txt → 8302bffd28cc6720e0fe.js.LICENSE.txt} +0 -0
  356. /package/assets/esri/core/workers/chunks/{9dda9414104f585560a4.js.LICENSE.txt → ad1d06a91121ebfe9162.js.LICENSE.txt} +0 -0
  357. /package/assets/esri/core/workers/chunks/{fa5d27e47d47ff8fcb96.js.LICENSE.txt → d03e7be74c57c3dbf003.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as o,createAbortError as n}from"../../../core/promiseUtils.js";import{initial as a,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{unitFromRESTJSON as h,convertUnit as u}from"../../../core/units.js";import{property as m,subclass as p}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as f,invert as b}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as y,IDENTITY as g}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as w,sub as C,dot as x,set as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,freeze as E,clone as M,ZEROS as O,fromValues as R}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as S,clone as V,ONES as U}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as H,isMars as D,getReferenceEllipsoid as P,SphericalECEFSpatialReferenceLike as I}from"../../../geometry/ellipsoidUtils.js";import k from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as L}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as A}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as F}from"../../../geometry/projection/projectVectorToVector.js";import{create as G}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as z}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as B,isWebMercator as N,equals as W,isGeographic as q,isCGCS2000 as X}from"../../../geometry/support/spatialReferenceUtils.js";import $ from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4f as Z,BufferViewVec4u8 as Y,BufferViewVec4u16 as J,BufferViewVec3f as K,BufferViewVec3u8 as Q,BufferViewVec3u16 as ee,BufferViewVec2f as te,BufferViewUint32 as ie,BufferViewUint16 as re}from"../../../geometry/support/buffer/BufferView.js";import se from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as oe,validateMeshData as ne,makeCacheKey as ae}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as le}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as ce}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as de}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as he}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as ue,removeLayerViewFromWasm as me,getLyr3DWasm as pe}from"./Lyr3DWasm.js";import{toWasmModification as fe}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ye}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ge,alphaModeConversion as _e,faceCullingConversion as ve,wrapModeConversion as we}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as Ce}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as xe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Te}from"../state/Frustum.js";import{ElevationRange as je}from"../support/ElevationRange.js";import{toBoundingRect as Ee}from"../support/extentUtils.js";import{Obb as Me}from"../support/orientedBoundingBox.js";import{glLayout as Oe}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Re}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Se,SourceGeometry as Ve}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ue}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as He}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as De}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Pe}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ie}from"../webgl-engine/materials/pbrUtils.js";import ke from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Le,isInEffectiveScaleRange as Ae,validateScaleRange as Fe}from"../../support/layerViewUtils.js";import{TaskPriority as Ge}from"../../support/Scheduler.js";import{TextureCompressionTracker as ze}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as Be,SizedPixelFormat as Ne}from"../../webgl/enums.js";import{alphaCutoff as We}from"../../../webscene/support/AlphaCutoff.js";var qe;function Xe(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return Be.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return Be.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Ne.RG8;case 6407:return Ne.RGB8;case 6408:return Ne.RGBA8;case 6403:return Ne.R8;default:return null}}let $e=class extends(de(ke)){static{qe=ye}constructor(e){super(e),this[qe]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new ze,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Ge.TILES3D,this),this._frustum=new Te(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{o(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new ce(Ce(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),a),!this._canProjectWithoutEngine())throw Le("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=ue(this,this._initializationController.signal).then(t=>{o(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new xe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>this.view.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),a),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),a),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a)]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),me(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get _groundTransparencyMode(){return this.layer.replacesTerrain?Re(this.fullOpacity,this.view.overlayManager.renderer.isEmpty):0}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return We;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(i=>this._collection.updateObjectOpacity(i,e,t))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=fe(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=G();this._layerClippingArea=Ee(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,le(e))}get _wasm(){return pe(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(n()):this._wasm?.queryElevation(this,e,t)??Promise.reject(n())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Ae(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Fe(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(i+=n.textureMemoryUsage,r+=n.vboMemoryUsage,o++)}),new he(this.usedMemory,s,o,Je(t),Je(e),Je(r),Je(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(B(this.view.renderSpatialReference)||N(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&W(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=oe(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!q(t)&&t.wkid&&-1!==t.wkid&&(i=h($.units[$[t.wkid]])),i&&(e=new k({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===z(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=u(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return le(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new je(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new je;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||X(i)||H(i)||D(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=P(i).radius,{eye:o,viewForward:n,near:a}=t.state.contentCamera,l=w(j(),n),c=500,d=Math.max(o[2],c),h=d+s,u=Math.sqrt(h**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=d>.5*s?.5*Math.PI*s:m,f=j();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;C(f,r,o);const s=x(f,l);Math.abs(s)<p&&s+i>a&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!ne(t))throw new Error("meshData not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage?.removeTexture(e)),o}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:n,elevationRange:a}=s;let l=0,c=0,d=0;for(const e of n){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Ye(e.handle,n,h,d,c,l,o,e.stableNodeId,e.nodeDepth,a);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(ae(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(o){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,r=e.desc.prims.length;try{const s=e.desc;for(let o=0;o<r;o++){const r=s.prims[o].materialId,n=s.materials&&null!=r?s.materials[r]:null;let a=Promise.resolve(Qe),l=null,c=null,d=null,h=null,u=null;if(n){const i="Pbr"===n.lightingModel;l=this._getTexture(n.baseColorTex,e,t),c=i?this._getTexture(n.metalTex,e,t):null,d=i?this._getTexture(n.emissiveTex,e,t):null,h=i?this._getTexture(n.occlusionTex,e,t):null,u=i?this._getTexture(n.normalTex,e,t):null;const r=[l,c,d,h,u].map(e=>e?.loadPromise??null);a=Promise.all(r)}i.push(new et(a,l,c,d,h,u))}}catch(s){throw i.forEach(e=>e.cleanup()),s}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=e.data.buffer,o=r.prims.length,n=E(...r.origin),a=this.view.groundView.spatialReference,l=this.view.state.isGlobal;let c=g;if(l){const e=_();L(I,n,e,a),c=f(y(),e)}if(null==r.obb)throw new Error("meshData.desc.obb undefined");const d=Ke(r.obb),h=l?P(this.view.spatialReference).radius:0,u=new Array;try{for(let i=0;i<o;i++){const e=r.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==ge[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:n,normalsData:a,colorView:l,texCoord0Data:c,indicesView:d}=this.getBufferViews(e,s);if(null==n||null==d){o.cleanup();continue}const h=n.count,m=(e,t)=>null==e||e===h||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);m(null!=c?c.length/2:void 0,"numTexcoord")&&m(l?.count,"numColors")&&m(a?.length,"normals")?u.push({componentIndex:i,positionView:n,indicesView:d,texCoord0Data:c,colorView:l,normalsData:a}):o.cleanup()}const e=c!==g,m=e?b(y(),c)??g:g,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:_}=await this._workerHandle.processTiles3DVertices(u,n,h,l,c,d,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const v=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&d.setHalfSize(f);for(const s of p){const{componentIndex:o,positionView:l,indicesView:c,layout:h,textureCoordinateType:u,interleavedVertexData:p,indices:f}=s,b=r.prims[o],y=t[o],g=d.clone(),_=Oe(h),w=new Uint32Array([0,c.typedBuffer.length]),C=new Se(_,this._imShading?2:0,u,e?2:0),x=new Ve({interleavedVertexData:p,vertexCount:p.byteLength/_[0].stride,indexData:f},{positions:l.typedBuffer,indices:c.typedBuffer},w,C),T=this.view.renderSpatialReference,E=j(),M=[1,1,1];A(n,T,M,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),F(n,T,E,a);const O=v&&null!=b.materialId?v[b.materialId]:null,R=this._createComponentMaterialInitParameters(O,y);R.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:S(E[0],E[1],M[0],M[1]),transform:new Ue(n,m),obb:g,geometry:x,elevationAlignable:!1},R);i.push(V)}const{fullExtent:w}=this.layer;return w?.hasZ&&w.zmax&&w.zmin&&(_.minElevation=Math.max(_.minElevation,w.zmin),_.maxElevation=Math.min(_.maxElevation,w.zmax)),{tileObb:d,componentObjects:i,elevationRange:_}}catch(m){throw i.forEach(e=>this._collection.destroyObject(e)),m}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let r=U,s=We,o=1,n=!1,a=2,l=R(0,0,0);const c=M(Ie),d=t.baseColorTexture,h=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(r=V(e.baseColorFactor),s=e.alphaCutoff??We,i&&(T(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=_e[e.alphaMode],n=e.isDoubleSided,a=ve[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:r,textureAlphaCutoff:s,mrrFactors:c,baseColorTexture:d,metallicRoughnessTexture:h,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:n,cullFace:a,isGround:this.layer.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ae(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ae(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ae(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const s=i.get(r)??this._createTexture(e,t,i);return s?new He(this._stage.renderView.textures,s.id):null}_createTexture(e,t,i){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!r.mipCount||s>1,n=we[e.wrapMode??"None"];let a=r.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let c=null,d=null,h=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(c=l,a=6403,d=""):"Rg8"===r.pixelFormat||"Ga8"===r.pixelFormat?(c=l,a=33319,d=""):"Rgb8"===r.pixelFormat?(c=l,a=6407,d=""):"Rgba8"===r.pixelFormat&&(c=l,a=6408,d="");break;case"Dxt1":c=l,a=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,a=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,a=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=Xe(a,d,r.format),l=new De(c,{mipmap:o,maxAnisotropy:s,encoding:d,wrap:n,pixelFormat:a,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(l),i.set(r,l),l}return null}getBufferViews(e,t){let i,r,s,o,n;for(let l=0;l<e.atrbs.length;l++){const n=e.atrbs[l],{view:c}=n,d=void 0,h=c.byteOffset+c.byteCount;try{switch(n.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new K(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new K(t,c.byteOffset,d,h);o=new Uint32Array(e.count),Pe(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===s&&(s=new te(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(r=new Z(t,c.byteOffset,d,h)),"U8"===c.type&&(r=new Y(t,c.byteOffset,d,h)),"U16"===c.type&&(r=new J(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(r=new K(t,c.byteOffset,d,h)),"U8"===c.type&&(r=new Q(t,c.byteOffset,d,h)),"U16"===c.type&&(r=new ee(t,c.byteOffset,d,h))),null==r&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+n.sem+"). Skipping vertex attribute.")}}catch(a){this._dbg(2,"Error Creating buffer ("+a+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,r=void 0,s=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":n=new re(t,i.byteOffset,r,s);break;case"U32":n=new ie(t,i.byteOffset,r,s);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==n&&null!=i){const e=i.count;n=n=e<65535?new re(new Uint16Array(e).buffer):new ie(new Uint32Array(e).buffer);for(let t=0;t<e;t++)n.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:n,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},a),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([m()],$e.prototype,"fullOpacity",null),e([m({readOnly:!0})],$e.prototype,"ready",null),e([m({type:[se]})],$e.prototype,"_modifications",void 0),e([m()],$e.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([m()],$e.prototype,"layer",void 0),e([m({readOnly:!0})],$e.prototype,"visibleAtCurrentScale",null),e([m({readOnly:!0})],$e.prototype,"_collection",null),e([m()],$e.prototype,"elevationOffset",null),e([m({readOnly:!0})],$e.prototype,"visibleElevationRange",null),e([m()],$e.prototype,"fullExtentInLocalViewSpatialReference",void 0),$e=e([p("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],$e);const Ze=$e;class Ye{constructor(e,t,i,r,s,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=j();n?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h,this._obbShortestHalfsize=n?Math.min(n.halfSizeX,n.halfSizeY,n.halfSizeZ):0,this._mbsCenter=n?n.getCenter(j()):O}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,o=i-e[0],n=r-e[1],a=s-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,o=this._obbCenterX-i[0];if(o>s)return!1;const n=this._obbCenterY-i[1];if(n>s)return!1;const a=this._obbCenterZ-i[2];if(a>s)return!1;const l=o*o+n*n+a*a;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Je(e){return Math.round(e/1048.576)/1e3}function Ke(e){return new Me(e.center,e.halfSize,v(...e.quaternion))}const Qe=new Array;class et{constructor(e,t,i,r,s,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{Ze as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as n,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as h,isFloat32Array as m,isUint32Array as u,isUint16Array as p}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as f,convertUnit as g}from"../../../core/units.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as _,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as w,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as j,sub as E,dot as M,set as R}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as S,clone as V,ZEROS as U,fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as H,clone as I,ONES as D}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as k,isMars as A,getReferenceEllipsoid as L,SphericalECEFSpatialReferenceLike as F}from"../../../geometry/ellipsoidUtils.js";import G from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as B}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as z}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as N}from"../../../geometry/projection/projectVectorToVector.js";import{create as W}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as q}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as X,isWebMercator as $,equals as Z,isGeographic as Y,isCGCS2000 as J}from"../../../geometry/support/spatialReferenceUtils.js";import K from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as Q,BufferViewVec3u8 as ee,BufferViewVec2f as te,BufferViewVec3f as ie,BufferViewUint32 as re,BufferViewUint16 as se}from"../../../geometry/support/buffer/BufferView.js";import{nullId as ae}from"../../../layers/ILyr3DWasmPerSceneView.js";import oe from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as ne,validateEntity3D as le,makeCacheKey as ce}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as de}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as he}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as me}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as ue}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as pe,removeLayerViewFromWasm as fe,getLyr3DWasm as ge}from"./Lyr3DWasm.js";import{toWasmModification as ye}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as _e}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ve,alphaModeConversion as we,faceCullingConversion as Ce,wrapModeConversion as Te}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as xe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as je}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ee}from"../state/Frustum.js";import{ElevationRange as Me}from"../support/ElevationRange.js";import{toBoundingRect as Re}from"../support/extentUtils.js";import{Obb as Oe}from"../support/orientedBoundingBox.js";import{glLayout as Se}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Ve}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ue,SourceGeometry as Pe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as He}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ie}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as De}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as ke}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ae}from"../webgl-engine/materials/pbrUtils.js";import Le from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Fe,isInEffectiveScaleRange as Ge,validateScaleRange as Be}from"../../support/layerViewUtils.js";import{TaskPriority as ze}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ne}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as We,SizedPixelFormat as qe}from"../../webgl/enums.js";import{alphaCutoff as Xe}from"../../../webscene/support/AlphaCutoff.js";var $e;function Ze(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return We.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return We.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx"===t)return"Etc1"===i?We.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return qe.RG8;case 6407:return qe.RGB8;case 6408:return qe.RGBA8;case 6403:return qe.R8;default:return null}}let Ye=class extends(me(Le)){static{$e=_e}constructor(e){super(e),this[$e]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ne,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(ze.TILES3D,this),this._frustum=new Ee(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new he(xe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),n),!this._canProjectWithoutEngine())throw Fe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=pe(this,this._initializationController.signal).then(t=>{a(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new je(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>this.view.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),n),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),n),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),n)]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),fe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get _groundTransparencyMode(){return this.layer.replacesTerrain?Ve(this.fullOpacity,this.view.overlayManager.renderer.isEmpty):0}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return Xe;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(i=>this._collection.updateObjectOpacity(i,e,t))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=ye(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=W();this._layerClippingArea=Re(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,de(e))}get _wasm(){return ge(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Ge(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Be(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,s++):(i+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new ue(this.usedMemory,s,a,Qe(t),Qe(e),Qe(r),Qe(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(X(this.view.renderSpatialReference)||$(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&Z(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=ne(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!Y(t)&&t.wkid&&-1!==t.wkid&&(i=f(K.units[K[t.wkid]])),i&&(e=new G({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===q(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=g(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return de(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Me(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new Me;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||J(i)||k(i)||A(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=L(i).radius,{eye:a,viewForward:o,near:n}=t.state.contentCamera,l=j(O(),o),c=500,d=Math.max(a[2],c),h=d+s,m=Math.sqrt(h**2-s**2),u=Math.abs(Math.atan2(m,s))*s,p=d>.5*s?.5*Math.PI*s:u,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;E(f,r,a);const s=M(f,l);Math.abs(s)<p&&s+i>n&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!le(t))throw new Error("entity3D not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(a){throw i.forEach(e=>this._stage?.removeTexture(e)),a}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:a,componentObjects:o,elevationRange:n}=s;let l=0,c=0,d=0;for(const e of o){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:a}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(a?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),m=new Ke(e.handle,o,h,d,c,l,a,e.stableNodeId,e.nodeDepth,n);return this._lyrHandleToObjects.set(e.handle,m),()=>{this._memCache.put(ce(m.handle),m);const{usedMemory:e}=m;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(a){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),a}}_createPrimitiveTextureBundles(e,t){const i=new Array;try{const r=e.desc.geometry;for(const s of e.validPrimitiveIndices){const a=r.prims[s].materialId,o=e.desc.materials?.materials&&null!=a&&a!==ae?e.desc.materials.materials[a]:null;let n=Promise.resolve(tt),l=null,c=null,d=null,h=null,m=null;if(o){const i="Pbr"===o.lightingModel;l=this._getTexture(o.baseColorTex,e,t),c=i?this._getTexture(o.metalTex,e,t):null,d=i?this._getTexture(o.emissiveTex,e,t):null,h=i?this._getTexture(o.occlusionTex,e,t):null,m=i?this._getTexture(o.normalTex,e,t):null;const r=[l,c,d,h,m].map(e=>e?.loadPromise??null);n=Promise.all(r)}i.push(new it(n,l,c,d,h,m))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=S(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal;let n=C;if(o){const e=T();B(F,s,e,a),n=_(w(),e)}const l=et(r.obb),c=o?L(this.view.spatialReference).radius:0,d=new Array;try{let h=-1;for(const i of e.validPrimitiveIndices){h+=1;const s=r.geometry.prims[i],a=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(s));if(null==ve[s.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+s.ptype+"). Skipping primitive."),a.cleanup();continue}const{positionView:o,normalsData:n,colorView:l,texCoord0Data:c,indicesView:m}=this._getBufferViews(s,e);if(null==o||null==m){a.cleanup();continue}const u=o.count,p=(e,t)=>null==e||e===u||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);p(null!=c?c.length/2:void 0,"numTexcoord")&&p(l?.count,"numColors")&&p(n?.length,"normals")?d.push({componentIndex:h,positionView:o,indicesView:m,texCoord0Data:c,colorView:l,normalsData:n}):a.cleanup()}const m=n!==C,u=m?v(w(),n)??C:C,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:g}=await this._workerHandle.processTiles3DVertices(d,s,c,o,n,l,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const y=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&l.setHalfSize(f);for(const o of p){const{componentIndex:n,positionView:c,indicesView:d,layout:h,textureCoordinateType:p,interleavedVertexData:f,indices:g}=o,b=e.validPrimitiveIndices[n],_=r.geometry.prims[b],v=t[n],w=l.clone(),C=Se(h),T=new Uint32Array([0,d.typedBuffer.length]),x=new Ue(C,this._imShading?2:0,p,m?2:0),j=new Pe({interleavedVertexData:f,vertexCount:f.byteLength/C[0].stride,indexData:g},{positions:c.typedBuffer,indices:d.typedBuffer},T,x),E=this.view.renderSpatialReference,M=O(),R=[1,1,1];z(s,E,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),N(s,E,M,a);const S=this._createComponentMaterialInitParameters(y,_.materialId,v);S.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:H(M[0],M[1],R[0],R[1]),transform:new He(s,u),obb:w,geometry:j,elevationAlignable:!1},S);i.push(V)}const{fullExtent:b}=this.layer;return b?.hasZ&&b.zmax&&b.zmin&&(g.minElevation=Math.max(g.minElevation,b.zmin),g.maxElevation=Math.min(g.maxElevation,b.zmax)),{tileObb:l,componentObjects:i,elevationRange:g}}catch(h){throw i.forEach(e=>this._collection.destroyObject(e)),h}}_createComponentMaterialInitParameters(e,t,i){const r=null!=e?.materials&&null!=t&&t!==ae?e.materials[t]:null;let s=1;const a=r?.baseColorTex?.imageId;if(null!=a&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){const t=e.images[a];t.alpha&&(s=we[t.alpha])}const o="Pbr"===(null!=r?r.lightingModel:"Unlit");let n=D,l=Xe,c=!1,d=2,h=P(0,0,0);const m=V(Ae),u=i.baseColorTexture,p=i.metallicRoughnessTexture,f=i.emissionTexture,g=i.occlusionTexture,y=i.normalTexture;return r&&(n=I(r.baseColorFactor),l=r.alphaCutoff??Xe,o&&(R(m,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(h=r.emissiveFactor)),c=r.isDoubleSided,d=Ce[r.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:n,textureAlphaCutoff:l,mrrFactors:m,baseColorTexture:u,metallicRoughnessTexture:p,normalTexture:y,occlusionTexture:g,emissionTexture:f,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:s,doubleSided:c,cullFace:d,isGround:this.layer.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:h,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ce(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let a=!1,o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}a=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ce(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ce(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}a&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc.materials?.images?.[e.imageId];if(!r||null==r.data||r.data===ae)return null;const s=t.assets[r.data];if(!s||s.byteCount<1||"U8"!==s.dataType)return null;const a=i.get(r)??this._createTexture(e,r,s,i);return a?new Ie(this._stage.renderView.textures,a.id):null}_createTexture(e,t,i,r){const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!t.mipCount||s>1,o=Te[e.wrapMode??"None"];let n=t.alpha?6408:6407;const l=new Uint8Array(i.data.buffer,0,i.byteCount);let c=null,d=null,h=null;switch(t.format){case"Raw":"R8"===t.pixelFormat?(c=l,n=6403,d=""):"Rg8"===t.pixelFormat||"Ga8"===t.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===t.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===t.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Etc1":c=l,n=6407,d="image/ktx";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,i=Ze(n,d,t.format),l=new De(c,{mipmap:a,maxAnisotropy:s,encoding:d,wrap:o,pixelFormat:n,internalFormat:i??void 0,immutable:null!=i,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(l),r.set(t,l),l}return null}_getBufferViews(e,t){let i,r,s,a,o;for(let c=0;c<e.atrbs.length;c++){const o=e.atrbs[c],n=t.assets[o.assetId];if(!n)continue;const d=n.data.buffer,u=void 0,p=0,f=n.byteCount;try{switch(o.sem){case"Position":3===n.ncomp&&"F32"===n.dataType&&m(n.data)?i=new ie(d,p,u,f):this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+n+")");break;case"Normal":if(3===n.ncomp&&"F32"===n.dataType&&m(n.data)){const e=new ie(d,p,u,f);a=new Uint32Array(e.count),ke(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,2*a.length))}else this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+n+")");break;case"TexCoord":2===n.ncomp&&"F32"===n.dataType&&m(n.data)?void 0===s&&(s=new te(d,p,u,f).typedBuffer):this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+n+")");break;case"Color":"U8"===n.dataType&&h(n.data)&&(4===n.ncomp?r=new Q(d,p,u,f):3===n.ncomp&&(r=new ee(d,p,u,f))),null==r&&this._dbg(3,"[Unsupported Feature] Unsupported view for Color ("+n+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+o.sem+"). Skipping vertex attribute.")}}catch(l){this._dbg(2,"Error Creating buffer ("+l+"). Skipping vertex attribute.")}}let n=!1;if(null!=e.index&&e.index!==ae){const i=t.assets[e.index];if(i){const e=void 0,t=0,r=i.byteCount;switch(i.dataType){case"U16":1===i.ncomp&&p(i.data)&&(o=new se(i.data.buffer,t,e,r));break;case"U32":1===i.ncomp&&u(i.data)&&(o=new re(i.data.buffer,t,e,r))}n=!o}else n=!0}if(!n&&null==o&&null!=i){const e=i.count;o=o=e<65535?new se(new Uint16Array(e).buffer):new re(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},n),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([y()],Ye.prototype,"fullOpacity",null),e([y({readOnly:!0})],Ye.prototype,"ready",null),e([y({type:[oe]})],Ye.prototype,"_modifications",void 0),e([y()],Ye.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],Ye.prototype,"layer",void 0),e([y({readOnly:!0})],Ye.prototype,"visibleAtCurrentScale",null),e([y({readOnly:!0})],Ye.prototype,"_collection",null),e([y()],Ye.prototype,"elevationOffset",null),e([y({readOnly:!0})],Ye.prototype,"visibleElevationRange",null),e([y()],Ye.prototype,"fullExtentInLocalViewSpatialReference",void 0),Ye=e([b("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ye);const Je=Ye;class Ke{constructor(e,t,i,r,s,a,o,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=O();o?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=o?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(O()):U}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,a=i-e[0],o=r-e[1],n=s-e[2],l=a*t[0]+o*t[1]+n*t[2];return a*a+o*o+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,a=this._obbCenterX-i[0];if(a>s)return!1;const o=this._obbCenterY-i[1];if(o>s)return!1;const n=this._obbCenterZ-i[2];if(n>s)return!1;const l=a*a+o*o+n*n;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Qe(e){return Math.round(e/1048.576)/1e3}function et(e){return new Oe(e.center,e.halfSize,x(...e.quaternion))}const tt=new Array;class it{constructor(e,t,i,r,s,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{Je as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as n}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as t}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as i,triangulateIndexedF64 as s}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as u,doubleSubArray as l,concatDoubleArrays as c}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as g,newIndexArray as h,concatIndexArrays as f}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as p}from"../../../../geometry/support/polygonUtils.js";const d=1e-5,a={method:"auto",projectionAxis:void 0,outlines:void 0,owner:void 0};function m(n,t){const{hasZ:e,ccwRingsAsHoles:o,spatialReference:i}=t,s=t.axis??x(n,e,i),r=n.length,c=[],g=[],h=[],f=[],p=n.reduce((n,t)=>n+t.length,0);let d=0;const a=u(3*p);let m=0;const L=o&&n[0]&&y(n[0],e,s);for(let u=r-1;u>=0;u--){const t=n[u],i=H(t,e);if(i<3){i>1&&f.push(t);continue}const r=!!o&&y(t,e,s);if(L?!r:r)c[d++]=t;else{let n=t.length;for(let t=0;t<d;++t)n+=c[t].length;const o={index:m,pathLengths:new Array(d+1),count:n,holeIndices:new Array(d)};o.pathLengths[0]=t.length,t.length>0&&h.push({index:m,count:t.length}),m=U(t,a,m,t.length,e,L);for(let t=0;t<d;++t){const n=c[t];o.holeIndices[t]=m,o.pathLengths[t+1]=n.length,n.length>0&&h.push({index:m,count:n.length}),m=U(n,a,m,n.length,e,L)}d=0,o.count>0&&g.push(o)}}const w=m;for(const u of f)h.push({index:m,count:u.length}),m=U(u,a,m,u.length,e,L);return{positions:3*m===a.length?a:l(a,0,3*m),polygonVertexCount:w,polygons:g,outlines:h}}function x(n,t,e){if(!t)return 2;const o=n.map(n=>{const o=H(n,t);return o<3?2:p(n,o,e)}),i=o[0];return o.every(n=>n===i)?i:2}function y(n,t,e){if(!t)return!r(n);if(n.length<3)return!1;switch(e){case 0:return!r(n,1,2);case 1:return!r(n,0,2);case 2:return!r(n,0,1)}}const L=new t;function w(t,e){const o=v(t,e);if(o.succeeded)return o;return"libtess-not-loaded"===o.message?(n(L),j()):o}async function j(){try{await o(),L.notify()}catch(n){throw n}}function v(n,t){const e={method:t?.method??a.method,projectionAxis:t?.projectionAxis??a.projectionAxis,outlines:t?.outlines??a.outlines,owner:t?.owner??a.owner},{projectionAxis:o}=e,i=null!=o&&2!==o;i&&k(n.positions,o,2);const s=I(n,e);if(i){const t=s.succeeded?s.positions:null;null!=t&&t!==n.positions&&k(t,2,o),k(n.positions,2,o)}return s}function I(n,t){if("libtess"===t.method)return C(n,t);const o=b(n,t),i=Array();let s=0;for(const l of n.polygons){const r=P(n.positions,l),u=(l.holeIndices??[]).map(n=>n-l.index),c=u.length>0?u:null,g=e(r,c,3),h=e.deviation(r,u,3,g);if(o&&h>d)return C(n,t);for(let n=0;n<g.length;n++)i.push(g[n]+l.index);s=Math.max(s,h)}const{outlineIndexBuffer:r,outlineRingLengths:u}=null!=t.outlines?S(t.outlines,n.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:n.positions,indices:g(i),outlineIndexBuffer:r,outlineRingLengths:u,vertexCount:n.positions.length/3,method:"earcut",deviation:s}}const R=250;let A=new WeakSet;const B=1e4;function b(n,t){const e=null!=t.owner&&A.has(t.owner),o=B;return"auto"===t.method&&!(e&&n.polygonVertexCount>=o)}function C(n,t){if(!i())return M("libtess-not-loaded");const e=null!=t.outlines,{positions:o,mergedPathLengths:r}=W(n),u=performance.now(),{vertices:l,indices:c,outlineIndices:g,outlineRingLengths:h}=s(o,r,3,e),f=performance.now()-u,p=R;if(null!=t.owner&&f>p&&A.add(t.owner),l.length%3!=0)return M("positions-not-multiple-of-3");const{positions:d,outlineIndexBuffer:a,mergedOutlineRingLengths:m}=e?O(n,t.outlines,l,g,h):{positions:l,outlineIndexBuffer:void 0,mergedOutlineRingLengths:void 0};return{succeeded:!0,positions:d,indices:c,outlineIndexBuffer:a,outlineRingLengths:m,vertexCount:d.length/3,method:"libtess"}}function O(n,t,e,o,i){const s=n.polygonVertexCount,r=t?.filter(n=>n.index>=s)??[];if(0===r.length)return{positions:e,outlineIndexBuffer:o,mergedOutlineRingLengths:i};const u=3*s,g=l(n.positions,u,n.positions.length-u),h=c(e,g),p=e.length/3,d=r.map(n=>({index:p+n.index-s,count:n.count})),{outlineIndexBuffer:a,outlineRingLengths:m}=S(d,h);return{positions:h,outlineIndexBuffer:f(o,a,h.length/3),mergedOutlineRingLengths:f(i,m,i.length+m.length)}}function k(n,t,e){for(let o=0;o<n.length;o+=3){const i=n[o+t];n[o+t]=n[o+e],n[o+e]=i}}function S(n,t){const e=h(n.length);let o=0;for(let r=0;r<n.length;r++){const i=n[r],s=i.count;if(s<=0){e[r]=0;continue}const u=3*i.index,l=3*(i.index+s-1),c=s>1&&t[u]===t[l]&&t[u+1]===t[l+1]&&t[u+2]===t[l+2]?s-1:s,g=c>0?c+1:0;e[r]=g,o+=g}const i=h(o,t.length/3);let s=0;for(let r=0;r<n.length;r++){const t=e[r];if(0===t)continue;const o=n[r].index,u=t-1;for(let n=0;n<u;n++)i[s++]=o+n;i[s++]=o}return{outlineIndexBuffer:i,outlineRingLengths:e}}function V(n){const t=n.reduce((n,t)=>n+t.pathLengths.length,0),e=new Array(t);let o=0;for(let i=0;i<n.length;i++){const t=n[i].pathLengths;for(let n=0;n<t.length;n++)e[o++]=t[n]}return e}function P(n,{index:t,count:e}){return l(n,3*t,3*e)}function U(n,t,e,o,i,s){let r=s?n.length-1:0;const u=s?-1:1;e*=3;for(let l=0;l<o;++l){const o=n[r];t[e++]=o[0],t[e++]=o[1],t[e++]=i&&null!=o[2]?o[2]:0,r+=u}return e/3}function D(n,t){const e=n.length;if(e<2)return!1;const o=n[0],i=n[e-1];return o[0]===i[0]&&o[1]===i[1]&&(!t||o[2]===i[2])}function H(n,t){return D(n,t)?n.length-1:n.length}function M(n){return{succeeded:!1,message:n}}function W(n){const t=V(n.polygons),e=3*n.polygonVertexCount;return e===n.positions.length?{positions:n.positions,mergedPathLengths:t}:{positions:l(n.positions,0,e),mergedPathLengths:t}}const Z=void 0;export{x as axisFromRings,y as isCounterClockwise,j as load,m as ringsToOutlinedTessellationInfo,v as tessellate,w as tessellateOrLoad,Z as tessellationTestHooks};
2
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as n}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as t}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as i,triangulateIndexedF64 as s}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as u,doubleSubArray as l,concatDoubleArrays as c}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as g,newIndexArray as h,concatIndexArrays as f}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as p}from"../../../../geometry/support/polygonUtils.js";const d=1e-5,a={method:"auto",projectionAxis:void 0,outlines:void 0,owner:void 0};function m(n,t){const{hasZ:e,ccwRingsAsHoles:o,spatialReference:i}=t,s=t.axis??x(n,e,i),r=n.length,c=[],g=[],h=[],f=[],p=n.reduce((n,t)=>n+t.length,0);let d=0;const a=u(3*p);let m=0;const L=o&&n[0]&&y(n[0],e,s);for(let u=r-1;u>=0;u--){const t=n[u],i=H(t,e);if(i<3){i>1&&f.push(t);continue}const r=!!o&&y(t,e,s);if(L?!r:r)c[d++]=t;else{let n=t.length;for(let t=0;t<d;++t)n+=c[t].length;const o={index:m,pathLengths:new Array(d+1),count:n,holeIndices:new Array(d)};o.pathLengths[0]=t.length,t.length>0&&h.push({index:m,count:t.length}),m=U(t,a,m,t.length,e,L);for(let t=0;t<d;++t){const n=c[t];o.holeIndices[t]=m,o.pathLengths[t+1]=n.length,n.length>0&&h.push({index:m,count:n.length}),m=U(n,a,m,n.length,e,L)}d=0,o.count>0&&g.push(o)}}const w=m;for(const u of f)h.push({index:m,count:u.length}),m=U(u,a,m,u.length,e,L);return{positions:3*m===a.length?a:l(a,0,3*m),polygonVertexCount:w,polygons:g,outlines:h}}function x(n,t,e){if(!t)return 2;let o=null;for(const i of n){const n=H(i,t),s=n<3?2:p(i,n,e);if(o??=s,s!==o)return 2}return o??2}function y(n,t,e){if(!t)return!r(n);if(n.length<3)return!1;switch(e){case 0:return!r(n,1,2);case 1:return!r(n,0,2);case 2:return!r(n,0,1)}}const L=new t;function w(t,e){const o=v(t,e);if(o.succeeded)return o;return"libtess-not-loaded"===o.message?(n(L),j()):o}async function j(){try{await o(),L.notify()}catch(n){throw n}}function v(n,t){const e={method:t?.method??a.method,projectionAxis:t?.projectionAxis??a.projectionAxis,outlines:t?.outlines??a.outlines,owner:t?.owner??a.owner},{projectionAxis:o}=e,i=null!=o&&2!==o;i&&k(n.positions,o,2);const s=I(n,e);if(i){const t=s.succeeded?s.positions:null;null!=t&&t!==n.positions&&k(t,2,o),k(n.positions,2,o)}return s}function I(n,t){if("libtess"===t.method)return C(n,t);const o=b(n,t),i=Array();let s=0;for(const l of n.polygons){const r=P(n.positions,l),u=(l.holeIndices??[]).map(n=>n-l.index),c=u.length>0?u:null,g=e(r,c,3),h=e.deviation(r,u,3,g);if(o&&h>d)return C(n,t);for(let n=0;n<g.length;n++)i.push(g[n]+l.index);s=Math.max(s,h)}const{outlineIndexBuffer:r,outlineRingLengths:u}=null!=t.outlines?S(t.outlines,n.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:n.positions,indices:g(i),outlineIndexBuffer:r,outlineRingLengths:u,vertexCount:n.positions.length/3,method:"earcut",deviation:s}}const R=250;let A=new WeakSet;const B=1e4;function b(n,t){const e=null!=t.owner&&A.has(t.owner),o=B;return"auto"===t.method&&!(e&&n.polygonVertexCount>=o)}function C(n,t){if(!i())return M("libtess-not-loaded");const e=null!=t.outlines,{positions:o,mergedPathLengths:r}=W(n),u=performance.now(),{vertices:l,indices:c,outlineIndices:g,outlineRingLengths:h}=s(o,r,3,e),f=performance.now()-u,p=R;if(null!=t.owner&&f>p&&A.add(t.owner),l.length%3!=0)return M("positions-not-multiple-of-3");const{positions:d,outlineIndexBuffer:a,mergedOutlineRingLengths:m}=e?O(n,t.outlines,l,g,h):{positions:l,outlineIndexBuffer:void 0,mergedOutlineRingLengths:void 0};return{succeeded:!0,positions:d,indices:c,outlineIndexBuffer:a,outlineRingLengths:m,vertexCount:d.length/3,method:"libtess"}}function O(n,t,e,o,i){const s=n.polygonVertexCount,r=e.length/3,u=(t??[]).values().filter(n=>n.index>=s).map(n=>({index:r+n.index-s,count:n.count})).toArray();if(0===u.length)return{positions:e,outlineIndexBuffer:o,mergedOutlineRingLengths:i};const g=3*s,h=l(n.positions,g,n.positions.length-g),p=c(e,h),{outlineIndexBuffer:d,outlineRingLengths:a}=S(u,p);return{positions:p,outlineIndexBuffer:f(o,d,p.length/3),mergedOutlineRingLengths:f(i,a,i.length+a.length)}}function k(n,t,e){for(let o=0;o<n.length;o+=3){const i=n[o+t];n[o+t]=n[o+e],n[o+e]=i}}function S(n,t){const e=h(n.length);let o=0;for(let r=0;r<n.length;r++){const i=n[r],s=i.count;if(s<=0){e[r]=0;continue}const u=3*i.index,l=3*(i.index+s-1),c=s>1&&t[u]===t[l]&&t[u+1]===t[l+1]&&t[u+2]===t[l+2]?s-1:s,g=c>0?c+1:0;e[r]=g,o+=g}const i=h(o,t.length/3);let s=0;for(let r=0;r<n.length;r++){const t=e[r];if(0===t)continue;const o=n[r].index,u=t-1;for(let n=0;n<u;n++)i[s++]=o+n;i[s++]=o}return{outlineIndexBuffer:i,outlineRingLengths:e}}function V(n){const t=n.reduce((n,t)=>n+t.pathLengths.length,0),e=new Array(t);let o=0;for(let i=0;i<n.length;i++){const t=n[i].pathLengths;for(let n=0;n<t.length;n++)e[o++]=t[n]}return e}function P(n,{index:t,count:e}){return l(n,3*t,3*e)}function U(n,t,e,o,i,s){let r=s?n.length-1:0;const u=s?-1:1;e*=3;for(let l=0;l<o;++l){const o=n[r];t[e++]=o[0],t[e++]=o[1],t[e++]=i&&null!=o[2]?o[2]:0,r+=u}return e/3}function D(n,t){const e=n.length;if(e<2)return!1;const o=n[0],i=n[e-1];return o[0]===i[0]&&o[1]===i[1]&&(!t||o[2]===i[2])}function H(n,t){return D(n,t)?n.length-1:n.length}function M(n){return{succeeded:!1,message:n}}function W(n){const t=V(n.polygons),e=3*n.polygonVertexCount;return e===n.positions.length?{positions:n.positions,mergedPathLengths:t}:{positions:l(n.positions,0,e),mergedPathLengths:t}}const Z=void 0;export{x as axisFromRings,y as isCounterClockwise,j as load,m as ringsToOutlinedTessellationInfo,v as tessellate,w as tessellateOrLoad,Z as tessellationTestHooks};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{normalize as t,copy as r,set as n,dist as e,sub as s,dot as o,scaleAndAdd as i,cross as u,add as c,scale as f,len as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h,fromValues as l,freeze as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as d}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{fromValues as b,signedDistance as S}from"../../../../geometry/support/plane.js";import{Frustum as M}from"../../state/Frustum.js";class F{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=h(),this._cameraEye=h(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=h(),this._frustumBoundingSphereRadius=0,this._frustum=new M(t),this._renderSR=t.spatialReference;const n=d(this._renderSR);this._renderSREllipsoidRadius=p(n).radius}setup(n){this._aboveGround=n.aboveGround,this._frustum.update(n),t(this._cameraForward,n.viewForward),r(this._cameraEye,n.eye),this._cameraFovY=n.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const t=this._frustum.boundingSphere;r(this._frustumBoundingSphereCenter,t.center),this._frustumBoundingSphereRadius=t.radius+Bt}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,u=t.extent,c=this._renderSR;if(!u)return!0;if(C[0]=u[0],C[1]=u[1],C[2]=0,C[3]=u[2],C[4]=u[3],C[5]=0,!_(C,r,0,C,c,0))return!1;n(E[0],C[0],C[1],0),n(E[1],C[3],C[1],0),n(E[2],C[3],C[4],0),n(E[3],C[0],C[4],0),n(P,.5*(C[0]+C[3]),.5*(C[1]+C[4]),.5*(C[2]+C[5]));const f=St,a=.5*e(E[0],E[2]),h=this._frustum,l=this._frustumBoundingSphereRadius,m=this._frustumBoundingSphereCenter,p=W;s(p,m,P);const d=o(f,p),g=A;i(g,P,f,d);if(e(g,m)>a+l)return!1;const b=this._cameraForward,S=o(b,St),M=this._cameraFovY,F=this._cameraEye;if(Math.abs(S)<Math.abs(Math.cos(.5*M))){let t=!0;const r=n(Mt,b[0],b[1],0),e=o(F,r);for(let n=0;n<4;++n){const s=E[n];if(o(s,r)-e>0){t=!1;break}}if(t)return!1}{const t=E[0],r=E[2];if(t[0]<=F[0]&&F[0]<=r[0]&&t[1]<=F[1]&&F[1]<=r[1])return!0}const R=V,v=this.opaqueGround&&this._aboveGround,G=this.opaqueGround&&!this._aboveGround,j=Math.min(G?dt:1/0,d+l),B=Math.max(v?-dt:-1/0,d-l);for(let n=0;n<4;++n)i(R[n],E[n],f,j),i(R[n+4],E[n],f,B);if(y(h.planes,R,8))return!1;if(q(h.planes,R,8))return!0;for(let n=0;n<4;++n){const t=R[n],r=R[n+4];if(Ft(h.planes,t,r))return!0;const e=R[(n+1)%4];if(Ft(h.planes,t,e))return!0;const s=R[4+(n+1)%4];if(Ft(h.planes,r,s))return!0}if(Gt[0][3]=+E[0][0],Gt[1][3]=-E[2][0],Gt[2][3]=+E[0][1],Gt[3][3]=-E[2][1],Gt[4][3]=+B,Gt[5][3]=-j,q(Gt,h.points))return!0;if(q(Gt,h.points))return!0;for(let n=0;n<4;++n){const t=F,r=h.points[n+4];if(Rt(Gt,t,r))return!0;const e=h.points[4+(n+1)%4];if(Rt(Gt,r,e))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<w)return!0;const l=r.spatialReference,m=r.extent;if(!m||!l)return!0;const p=this.opaqueGround&&this._aboveGround,d=this.opaqueGround&&!this._aboveGround,_=E,b=.5*(m[0]+m[2]);if(n(_[0],m[0],m[1],0),n(_[1],m[2],m[1],0),n(_[2],m[2],m[3],0),n(_[3],m[0],m[3],0),n(_[4],b,m[1],0),n(_[5],b,m[3],0),!g(_,l,0,_,this._renderSR,0,6))return!1;const M=_[0][2]>0,F=_[3][2]<0,j=M||F,B=this._renderSREllipsoidRadius;if(j){const t=Y;R(t,jt,_[0]);const r=k;if(R(r,jt,_[1]),M){const n=T,e=_[4],s=H;R(s,e,jt),R(n,s,e);const o=_[0];u(o,t,n),G(o,B);const i=_[1];u(i,r,n),G(i,B)}else if(F){const n=T,e=_[5],s=H;R(s,e,jt),R(n,e,s);const o=_[3];u(o,n,t),G(o,B);const i=_[2];u(i,n,r),G(i,B)}}const q=P,x=s(N,_[3],_[0]);t(x,x);const V=c(O,_[0],_[3]);f(V,V,.5);const C=-o(V,x),A=c(Q,_[0],_[1]);f(A,A,.5);const W=c(X,_[2],_[3]);f(W,W,.5);const et=s(Z,W,A);t(et,et);const ht=-(C+o(x,A))/o(x,et);i(q,A,et,ht),G(q,B);const lt=this._frustumBoundingSphereRadius,mt=this._frustumBoundingSphereCenter,St=this._frustum,Mt=St.planes,Ft=L;t(Ft,q);const Rt=o(_[0],Ft)/a(_[0]),vt=St.origin,Gt=St.points;let Bt=!1;if(p){{Bt=!0;const r=t(_t,vt);for(let n=0;n<4;++n){const e=Gt[4+n],i=s(h(),e,vt);t(i,i);const c=u(h(),r,i);t(c,c);const f=u(h(),i,c);t(f,f);if(o(vt,f)>B){Bt=!1;break}}}if(Bt){if(o(vt,Ft)<B*Rt-dt)return!1}const r=t(_t,St.origin);if(o(r,Ft)<0)return!1;{const r=t(gt,St.direction);if(o(r,Ft)>bt)return!1}}const yt=Math.sqrt(1-Rt*Rt);if(yt>.9)return!0;let qt=!1;const wt=o(Ft,mt),xt=a(mt);if(xt<=lt&&!Mt.some(t=>S(t,z)>0)){if(!p)return!0;qt=!0}const It=wt/xt;if(!qt&&wt<=0){if(-wt>lt)return!1}const Vt=lt/xt;if(Math.sqrt(1-It*It)*Math.sqrt(1-Vt*Vt)-Vt*It>yt)return!1;if(!Bt){if(_.some(t=>St.intersectsPoint(t)))return!0;if(St.intersectsPoint(q))return!0}const Ct=D;s(Ct,mt,z);const Et=o(Ct,Ft),Pt=U;f(Pt,Ft,Et);const Tt=e(Pt,mt),Yt=l.isWGS84,kt=r.lij,Ht=Yt&&kt[2]===2**kt[0]-1,Lt=Yt&&0===kt[2],Ut=Lt?ct:Ht?it:st,At=Lt?ft:Ht?ut:ot;if(!qt){const t=_,r=at,n=$,e=tt,s=z;for(const o of Ut){const i=t[o];if(v(n,t[(o+1)%4],i),v(e,s,i),R(r,e,n),I(r,Gt,1))return!1}}let Wt=null;if(!p&&Et<1.01*lt){const t=2.5*lt;if(Tt>Rt*t+lt)return!1;const r=K,e=t/Rt;for(let n=0;n<4;++n)f(r[n],_[n],e/B);n(r[4],0,0,0),Wt=r}else{const t=(d?B+dt:Et+lt)/Rt,r=p?B-dt:(Et-lt)/Rt,n=J;for(let e=0;e<4;++e){const s=_[e];f(n[e],s,r/B),f(n[e+4],s,t/B)}Wt=n}if(y(Mt,Wt,Wt.length))return!1;const zt=St.lines,Dt=rt,Jt=nt;for(const n of zt){t(Jt,n.direction);for(const r of At){const n=Wt[r];if(t(Dt,n),pt(Jt,Dt,Wt,Gt))return!1;const e=(r+1)%4;if(p){const r=Wt[e];if(s(Dt,r,n),t(Dt,Dt),pt(Jt,Dt,Wt,Gt))return!1}if(d){const n=Wt[4+r],o=Wt[4+e];if(s(Dt,o,n),t(Dt,Dt),pt(Jt,Dt,Wt,Gt))return!1}}}return!0}}function R(r,n,e){return u(r,n,e),t(r,r),r}function v(r,n,e){return s(r,n,e),t(r,r),r}function G(t,r){return f(t,t,r/a(t)),t}const j=[0,1,2,3,5];function B(t,r,n){for(let e=0;e<n;++e)if(S(t,r[e])<=0)return!1;return!0}function y(t,r,n){for(const e of j)if(B(t[e],r,n))return!0;return!1}function q(t,r,n=r.length){for(let e=0;e<n;++e){const n=r[e];let s=!0;for(const r of t){if(S(r,n)>0){s=!1;break}}if(s)return!0}return!1}const w=2,x=4;function I(t,r,n){for(const e of r)if(o(e,t)<n)return!1;return!0}const V=[h(),h(),h(),h(),h(),h(),h(),h()],C=[0,0,0,0,0,0],E=[h(),h(),h(),h(),h(),h()],P=h(),T=h(),Y=h(),k=h(),H=h(),L=h(),U=h(),A=h(),W=h(),z=m(0,0,0),D=h(),J=[h(),h(),h(),h(),h(),h(),h(),h()],K=[h(),h(),h(),h(),h()],N=h(),O=h(),Q=h(),X=h(),Z=h(),$=h(),tt=h(),rt=h(),nt=h(),et=h(),st=[0,1,2,3],ot=[0,1,2,3],it=[0,1,3],ut=[0,1,3],ct=[1,2,3],ft=[1,2,3],at=h();function ht(t,r,n){let e=1/0,s=-1/0;for(const i of n){const t=o(r,i);e=Math.min(e,t),s=Math.max(s,t)}t[0]=e,t[1]=s}function lt(t,r,n,e){let s=1/0,i=-1/0;for(const u of e){const e=o(n,u);if(s=Math.min(s,e),i=Math.max(i,e),s<=r&&i>=t)return!1}return!0}const mt=[0,0];function pt(t,r,n,e){const s=n.length,o=e.length;if(0===s||0===o)return!0;const i=et;R(i,t,r);const u=o<s,c=u?n:e,f=mt;return ht(f,i,u?e:n),lt(f[0],f[1],i,c)}const dt=430,_t=h(),gt=h(),bt=Math.cos(.25*Math.PI),St=l(0,0,1),Mt=h();function Ft(t,r,n){const e={t0:0,t1:1};for(const s of j){if(!vt(t[s],r,n,e))return!1}return e.t0<e.t1}function Rt(t,r,n){const e={t0:0,t1:1};for(const s of t){if(!vt(s,r,n,e))return!1}return e.t0<e.t1}function vt(t,r,n,e){let{t0:s,t1:o}=e;const i=S(t,r),u=S(t,n);if(i>=0&&u>=0)return!1;if(i<0&&u>=0){const t=-i/(u-i);if(t<s)return!1;t<o&&(o=t)}else if(i>=0&&u<0){const t=i/(i-u);if(t>o)return!1;t>s&&(s=t)}return e.t0=s,e.t1=o,!0}const Gt=[b(-1,0,0,1),b(1,0,0,-1),b(0,-1,0,1),b(0,1,0,-1),b(0,0,-1,1),b(0,0,1,-1)],jt=m(0,0,1),Bt=1;export{F as FeatureTileVisibility3D,q as isAnyVertexInPolyhedron,y as isConvexHullOutsideOfFrustum,x as maxLODLevelDelta,w as minTileLOD};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{normalize as r,copy as n,set as e,dist as s,sub as o,dot as i,scaleAndAdd as u,cross as c,add as f,scale as a,len as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l,fromValues as m,freeze as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as _}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as g}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as b}from"../../../../geometry/projection/projectVec3Array.js";import{fromValues as S,signedDistance as M}from"../../../../geometry/support/plane.js";import{Frustum as F}from"../../state/Frustum.js";class R{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=l(),this._cameraEye=l(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=l(),this._frustumBoundingSphereRadius=0,this._frustum=new F(t),this._renderSR=t.spatialReference;const n=_(this._renderSR);this._renderSREllipsoidRadius=d(n).radius}setup(t){this._aboveGround=t.aboveGround,this._frustum.update(t),r(this._cameraForward,t.viewForward),n(this._cameraEye,t.eye),this._cameraFovY=t.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const t=this._frustum.boundingSphere;n(this._frustumBoundingSphereCenter,t.center),this._frustumBoundingSphereRadius=t.radius+xt}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,n=t.extent,c=this._renderSR;if(!n)return!0;if(E[0]=n[0],E[1]=n[1],E[2]=0,E[3]=n[2],E[4]=n[3],E[5]=0,!g(E,r,0,E,c,0))return!1;e(P[0],E[0],E[1],0),e(P[1],E[3],E[1],0),e(P[2],E[3],E[4],0),e(P[3],E[0],E[4],0),e(T,.5*(E[0]+E[3]),.5*(E[1]+E[4]),.5*(E[2]+E[5]));const f=vt,a=.5*s(P[0],P[2]),h=this._frustum,l=this._frustumBoundingSphereRadius,m=this._frustumBoundingSphereCenter,p=z;o(p,m,T);const d=i(f,p),_=W;u(_,T,f,d);if(s(_,m)>a+l)return!1;const b=this._cameraForward,S=i(b,vt),M=this._cameraFovY,F=this._cameraEye;if(Math.abs(S)<Math.abs(Math.cos(.5*M))){let t=!0;const r=e(jt,b[0],b[1],0),n=i(F,r);for(let e=0;e<4;++e){const s=P[e];if(i(s,r)-n>0){t=!1;break}}if(t)return!1}{const t=P[0],r=P[2];if(t[0]<=F[0]&&F[0]<=r[0]&&t[1]<=F[1]&&F[1]<=r[1])return!0}const R=C,v=this.opaqueGround&&this._aboveGround,j=this.opaqueGround&&!this._aboveGround,G=Math.min(j?_t:1/0,d+l),B=Math.max(v?-_t:-1/0,d-l);for(let e=0;e<4;++e)u(R[e],P[e],f,G),u(R[e+4],P[e],f,B);if(q(h.planes,R,8))return!1;if(w(h.planes,R,8))return!0;for(let e=0;e<4;++e){const t=R[e],r=R[e+4];if(Gt(h.planes,t,r))return!0;const n=R[(e+1)%4];if(Gt(h.planes,t,n))return!0;const s=R[4+(e+1)%4];if(Gt(h.planes,r,s))return!0}if(qt[0][3]=+P[0][0],qt[1][3]=-P[2][0],qt[2][3]=+P[0][1],qt[3][3]=-P[2][1],qt[4][3]=+B,qt[5][3]=-G,w(qt,h.points))return!0;for(let e=0;e<4;++e){const t=F,r=h.points[e+4];if(Bt(qt,t,r))return!0;const n=h.points[4+(e+1)%4];if(Bt(qt,r,n))return!0}return!1}_isTileVisibleInFrustumGlobal(n){if(n.level<x)return!0;const l=n.spatialReference,m=n.extent;if(!m||!l)return!0;const p=this.opaqueGround&&this._aboveGround,d=this.opaqueGround&&!this._aboveGround,_=P,g=.5*(m[0]+m[2]);if(e(_[0],m[0],m[1],0),e(_[1],m[2],m[1],0),e(_[2],m[2],m[3],0),e(_[3],m[0],m[3],0),e(_[4],g,m[1],0),e(_[5],g,m[3],0),!b(_,l,0,_,this._renderSR,0,6))return!1;const S=_[0][2]>0,F=_[3][2]<0,R=S||F,B=this._renderSREllipsoidRadius;if(R){const t=k;v(t,wt,_[0]);const r=U;if(v(r,wt,_[1]),S){const n=Y,e=_[4],s=H;v(s,e,wt),v(n,s,e);const o=_[0];c(o,t,n),G(o,B);const i=_[1];c(i,r,n),G(i,B)}else if(F){const n=Y,e=_[5],s=H;v(s,e,wt),v(n,e,s);const o=_[3];c(o,n,t),G(o,B);const i=_[2];c(i,n,r),G(i,B)}}const y=T,w=o(O,_[3],_[0]);r(w,w);const I=f(Q,_[0],_[3]);a(I,I,.5);const C=-i(I,w),E=f(X,_[0],_[1]);a(E,E,.5);const W=f(Z,_[2],_[3]);a(W,W,.5);const z=o($,W,E);r(z,z);const st=-(C+i(w,E))/i(w,z);u(y,E,z,st),G(y,B);const lt=this._frustumBoundingSphereRadius,mt=this._frustumBoundingSphereCenter,pt=this._frustum,vt=pt.planes,jt=L;r(jt,y);const Gt=i(_[0],jt)/h(_[0]),Bt=Math.sqrt(1-Gt*Gt),yt=pt.origin,qt=pt.points;let xt=!1;if(p){xt=!0;const t=r(gt,yt);for(let n=0;n<4;++n){const e=qt[4+n],s=o(St,e,yt);r(s,s);const u=c(Mt,t,s);r(u,u);const f=c(Ft,s,u);r(f,f);if(i(yt,f)>B){xt=!1;break}}if(xt){if(i(yt,jt)<B*Gt-_t)return!1}if(i(t,jt)<-Bt)return!1;{const t=r(bt,pt.direction);if(i(t,jt)>Rt)return!1}}if(Bt>.9)return!0;let It=!1;const Vt=i(jt,mt),Ct=h(mt);if(Ct<=lt&&!vt.some(t=>M(t,D)>0)){if(!p)return!0;It=!0}if(!It&&Vt<=0){if(-Vt>lt)return!1}if(!It&&Ct>lt){const r=t(Vt/Ct,-1,1),n=Math.sqrt(1-r*r),e=t(lt/Ct,0,1);if(n*Math.sqrt(1-e*e)-e*r>Bt)return!1}if(!xt){if(_.some(t=>pt.intersectsPoint(t)))return!0;if(pt.intersectsPoint(y))return!0}const Et=J;o(Et,mt,D);const Pt=i(Et,jt),Tt=A;a(Tt,jt,Pt);const Yt=s(Tt,mt),kt=l.isWGS84,Ut=n.lij,Ht=kt&&Ut[2]===2**Ut[0]-1,Lt=kt&&0===Ut[2],At=Lt?ft:Ht?ut:ot,Wt=Lt?at:Ht?ct:it;if(!It){const t=_,r=ht,n=tt,e=rt,s=D;for(const o of At){const u=t[o];if(j(n,t[(o+1)%4],u),j(e,s,u),v(r,e,n),i(r,jt)>0&&a(r,r,-1),V(r,qt,1))return!1}}let zt=null;if(!p&&Pt<1.01*lt){const t=2.5*lt;if(Yt>Gt*t+lt)return!1;const r=N,n=t/Gt;for(let e=0;e<4;++e)a(r[e],_[e],n/B);e(r[4],0,0,0),zt=r}else{const t=(d?B+_t:Pt+lt)/Gt,r=p?B-_t:(Pt-lt)/Gt,n=K;for(let e=0;e<4;++e){const s=_[e];a(n[e],s,r/B),a(n[e+4],s,t/B)}zt=n}if(q(vt,zt,zt.length))return!1;const Dt=pt.lines,Jt=nt,Kt=et;for(const t of Dt){r(Kt,t.direction);for(const t of Wt){const n=zt[t];if(r(Jt,n),dt(Kt,Jt,zt,qt))return!1;const e=(t+1)%4;if(p){const t=zt[e];if(o(Jt,t,n),r(Jt,Jt),dt(Kt,Jt,zt,qt))return!1}if(d){const n=zt[4+t],s=zt[4+e];if(o(Jt,s,n),r(Jt,Jt),dt(Kt,Jt,zt,qt))return!1}}}return!0}}function v(t,n,e){return c(t,n,e),r(t,t),t}function j(t,n,e){return o(t,n,e),r(t,t),t}function G(t,r){return a(t,t,r/h(t)),t}const B=[0,1,2,3,5];function y(t,r,n){for(let e=0;e<n;++e)if(M(t,r[e])<=0)return!1;return!0}function q(t,r,n){for(const e of B)if(y(t[e],r,n))return!0;return!1}function w(t,r,n=r.length){for(let e=0;e<n;++e){const n=r[e];let s=!0;for(const r of t){if(M(r,n)>0){s=!1;break}}if(s)return!0}return!1}const x=2,I=4;function V(t,r,n){for(const e of r)if(i(e,t)<n)return!1;return!0}const C=[l(),l(),l(),l(),l(),l(),l(),l()],E=[0,0,0,0,0,0],P=[l(),l(),l(),l(),l(),l()],T=l(),Y=l(),k=l(),U=l(),H=l(),L=l(),A=l(),W=l(),z=l(),D=p(0,0,0),J=l(),K=[l(),l(),l(),l(),l(),l(),l(),l()],N=[l(),l(),l(),l(),l()],O=l(),Q=l(),X=l(),Z=l(),$=l(),tt=l(),rt=l(),nt=l(),et=l(),st=l(),ot=[0,1,2,3],it=[0,1,2,3],ut=[0,1,3],ct=[0,1,3],ft=[1,2,3],at=[1,2,3],ht=l();function lt(t,r,n){let e=1/0,s=-1/0;for(const o of n){const t=i(r,o);e=Math.min(e,t),s=Math.max(s,t)}t[0]=e,t[1]=s}function mt(t,r,n,e){let s=1/0,o=-1/0;for(const u of e){const e=i(n,u);if(s=Math.min(s,e),o=Math.max(o,e),s<=r&&o>=t)return!1}return!0}const pt=[0,0];function dt(t,r,n,e){const s=n.length,o=e.length;if(0===s||0===o)return!0;const i=st;v(i,t,r);const u=o<s,c=u?n:e,f=pt;return lt(f,i,u?e:n),mt(f[0],f[1],i,c)}const _t=430,gt=l(),bt=l(),St=l(),Mt=l(),Ft=l(),Rt=Math.cos(.25*Math.PI),vt=m(0,0,1),jt=l();function Gt(t,r,n){const e={t0:0,t1:1};for(const s of B){if(!yt(t[s],r,n,e))return!1}return e.t0<e.t1}function Bt(t,r,n){const e={t0:0,t1:1};for(const s of t){if(!yt(s,r,n,e))return!1}return e.t0<e.t1}function yt(t,r,n,e){let{t0:s,t1:o}=e;const i=M(t,r),u=M(t,n);if(i>=0&&u>=0)return!1;if(i<0&&u>=0){const t=-i/(u-i);if(t<s)return!1;t<o&&(o=t)}else if(i>=0&&u<0){const t=i/(i-u);if(t>o)return!1;t>s&&(s=t)}return e.t0=s,e.t1=o,!0}const qt=[S(-1,0,0,1),S(1,0,0,-1),S(0,-1,0,1),S(0,1,0,-1),S(0,0,-1,1),S(0,0,1,-1)],wt=p(0,0,1),xt=1;export{R as FeatureTileVisibility3D,w as isAnyVertexInPolyhedron,q as isConvexHullOutsideOfFrustum,I as maxLODLevelDelta,x as minTileLOD};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as o,makeHandle as i}from"../../../../core/handleUtils.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as r,destroyMaybe as n}from"../../../../core/maybe.js";import{debounce as a}from"../../../../core/promiseUtils.js";import{initial as l,watch as d,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as p}from"../../../../core/units.js";import{property as h,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as _}from"../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{set as u,transformMat2d as y}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{ControlPointOperations as T}from"../../interactive/editingTools/media/ControlPointOperations.js";import{ViewEventPriorities as b}from"../../../input/InputManager.js";import{KeyBindings as j,mediaKeys as w}from"../../../interactive/keybindings.js";import{acquire as E}from"../../../interactive/snapping/SnappingManagerPool.js";const O=Symbol(),M=Symbol(),P=1,S=10;let H=class extends t{get editSourcePoints(){return!!this.options?.reshapeOptions.editSourcePoints!==this._isEditSourcePointsToggled}get updating(){return this._updatingHandles.updating}get _preferredInteractionTool(){return this.options?.tool??"transform"}get _toolType(){switch(this._preferredInteractionTool){case"transform":return"transform-3d";case"reshape":return"reshape-3d"}}get _validatedSelectedElement(){const e=this.selectedElement;if(!e)return null;const{layer:{source:t}}=this;return t?"hasElement"in t?t.hasElement(e)?e:null:t===e?e:null:null}constructor(e){super(e),this.enabled=!1,this._isEditSourcePointsToggled=!1,this._updatingHandles=new v,this._isOpacityToggled=!1,this._factor=P,this._tool=null,this._object=null,this._createToolAbortController=null,this._onPointerMove=a(async e=>{const t=await this._updatingHandles.addPromise(this._findElementAtScreenPoint(e));this.destroyed||(this.removeHandles(M),t&&t!==this.selectedElement&&this.addHandles(this.view.acquireCursor("pointer","high"),M))}),this._tmpMat2=g(),this._tmpVec2=f()}destroy(){this._createToolAbortController=r(this._createToolAbortController)}initialize(){this.addHandles([o(this._updatingHandles),this._updatingHandles.add(()=>this.enabled,e=>this._enableDisable(e),l),this._updatingHandles.add(()=>this._preferredInteractionTool,e=>this._preferredInteractionToolChanged(e))])}_enableDisable(e){if(!e)return void this.removeHandles(O);this._dynamicImports();const{view:t}=this,o=new j;o.add(w.undo,()=>{this._object?.operations?.undo(),this._object?.emit("modified-externally")}),o.add(w.redo,()=>{this._object?.operations?.redo(),this._object?.emit("modified-externally")}),o.addToggle(w.preserveAspectRatio,e=>{"transform-3d"===this._tool?.type&&(this._tool.preserveAspectRatio="key-down"===e.type)}),o.addToggle(w.editSourcePoints,e=>{"reshape-3d"===this._tool?.type&&(this._isEditSourcePointsToggled="key-down"===e.type)}),o.addToggle(w.rotateIncrements,e=>{"transform-3d"===this._tool?.type&&(this._tool.snapRotation="key-down"===e.type)}),o.add(w.toggleOpacity,()=>{const e=this._object?.element;e&&(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),o.add(w.moveUp,()=>this._move(0,this._factor)),o.add(w.moveDown,()=>this._move(0,-this._factor)),o.add(w.moveRight,()=>this._move(this._factor,0)),o.add(w.moveLeft,()=>this._move(-this._factor,0)),o.addToggle(w.factorModifier,e=>this._factor="key-down"===e.type?S:P),this._isOpacityToggled=!1,this.addHandles([o.register(t,b.TOOL),i(()=>{this._isOpacityToggled&&this.selectedElement&&(this.selectedElement.opacity*=2,this._isOpacityToggled=!1)}),t.on("immediate-click",e=>this._onClick(e),b.TOOL),t.on("pointer-move",e=>this._onPointerMove(e).catch(()=>{}),b.TOOL),this._updatingHandles.add(()=>this._validatedSelectedElement,(e,t)=>{t&&e!==t&&this._isOpacityToggled&&(t.opacity*=2,this._isOpacityToggled=!1),this._selectedElementChanged(e)},l),i(()=>{this.removeHandles(M),this._removeTool()})],O)}async _onClick(e){await this._updatingHandles.addPromise(e.defer(async()=>{const t=await this._findElementAtScreenPoint(e);this.destroyed||(t&&e.stopPropagation(),this.selectedElement=t,this.selectedElement&&this.removeHandles(M))}))}async _selectedElementChanged(e){e?.georeference?this._object?.element!==e&&await this._updatingHandles.addPromise(this._recreateTool()):this._removeTool()}async _recreateTool(){this._createToolAbortController=r(this._createToolAbortController),this._removeTool();const e=this._validatedSelectedElement;if(!e)return;const t=new AbortController;this._createToolAbortController=t;const{ManipulatedObject3DMediaElement:o,ExtentTransformTool:s,ReshapeTool3D:a}=await this._dynamicImports();if(t.signal.aborted)return;const{view:l,layer:p,_toolType:h}=this;switch(this._object=new o({view:l,layer:p,element:e,tool:this._preferredInteractionTool}),h){case"transform-3d":this._tool=new s({view:l,object:this._object}),l.inputManager.isModifierKeyDown(w.rotateIncrements.key)&&(this._tool.snapRotation=!0),l.inputManager.isModifierKeyDown(w.preserveAspectRatio.key)&&(this._tool.preserveAspectRatio=!0);break;case"reshape-3d":{const e=E(l),{snappingManager:t}=e;this._tool=new a({view:l,object:this._object,enableMidpoints:!1,enableZShape:!1,snappingManager:t,enableMoveObject:!1,autoHideManipulators:!0,enableDeleteVertices:!1,sketchOptions:{tooltips:{enabled:!0,inputEnabled:!0,visibleElements:{area:!1}}}}),this.addHandles([e,d(()=>({editSourcePoints:this.editSourcePoints,operations:this._object?.operations}),e=>{e.operations instanceof T&&(e.operations.editSourcePoints=e.editSourcePoints)},c)],this._tool)}}this.addHandles([i(()=>{this._object=n(this._object),this._tool&&(l.tools.remove(this._tool),this._tool=null)})],this._tool),l.addAndActivateTool(this._tool)}_preferredInteractionToolChanged(e){const{_tool:t}=this;if(!t)return;if(this._toolType!==t.type)return void this._updatingHandles.consumePromise(this._recreateTool());const{_object:o}=this;o&&(o.tool=e)}async _dynamicImports(){const[{ManipulatedObject3DMediaElement:e},{ExtentTransformTool:t,ReshapeTool3D:o}]=await Promise.all([import("../../interactive/editingTools/ManipulatedObject3DMediaElement.js"),import("../../interactive/editingTools.js")]);return{ManipulatedObject3DMediaElement:e,ExtentTransformTool:t,ReshapeTool3D:o}}async _findElementAtScreenPoint(e){const t=(await this.view.hitTest(e,{include:[this.layer]})).results[0];return"media"===t?.type?t.element:null}_removeTool(){this._tool&&this.removeHandles(this._tool)}_move(e,t){const{view:o,_object:i}=this,r=i?.operations;if(!r)return;const n=o.overlayPixelSizeInMapUnits(o.pointsOfInterest.focus.location)*p(o.spatialReference)/p(r.data.spatialReference),{_tmpMat2:a,_tmpVec2:l}=this,d=_(a,s(360-this.view.camera.heading)),c=u(l,n*e,n*t);y(c,c,d),r.move(c[0],c[1],0),i.emit("modified-externally")}};e([h({constructOnly:!0})],H.prototype,"view",void 0),e([h({constructOnly:!0})],H.prototype,"layer",void 0),e([h()],H.prototype,"selectedElement",void 0),e([h()],H.prototype,"enabled",void 0),e([h()],H.prototype,"options",void 0),e([h()],H.prototype,"editSourcePoints",null),e([h()],H.prototype,"_isEditSourcePointsToggled",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"_preferredInteractionTool",null),e([h()],H.prototype,"_validatedSelectedElement",null),H=e([m("esri.views.3d.layers.support.MediaLayerInteraction")],H);export{H as MediaLayerInteraction};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as o,makeHandle as i}from"../../../../core/handleUtils.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as r,destroyMaybe as n}from"../../../../core/maybe.js";import{debounce as a}from"../../../../core/promiseUtils.js";import{initial as l,watch as d,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as p}from"../../../../core/units.js";import{property as h,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as _}from"../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{set as u,transformMat2d as y}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{ControlPointOperations as T}from"../../interactive/editingTools/media/ControlPointOperations.js";import{ViewEventPriorities as b}from"../../../input/InputManager.js";import{KeyBindings as j,mediaKeys as w}from"../../../interactive/keybindings.js";import{acquire as E}from"../../../interactive/snapping/SnappingManagerPool.js";const O=Symbol(),M=Symbol(),P=1,S=10;let H=class extends t{get editSourcePoints(){return!!this.options?.reshapeOptions.editSourcePoints!==this._isEditSourcePointsToggled}get updating(){return this._updatingHandles.updating}get _preferredInteractionTool(){return this.options?.tool??"transform"}get _toolType(){switch(this._preferredInteractionTool){case"transform":return"transform-3d";case"reshape":return"reshape-3d"}}get _validatedSelectedElement(){const e=this.selectedElement;if(!e)return null;const{layer:{source:t}}=this;return t?"hasElement"in t?t.hasElement(e)?e:null:t===e?e:null:null}constructor(e){super(e),this.enabled=!1,this._isEditSourcePointsToggled=!1,this._updatingHandles=new v,this._isOpacityToggled=!1,this._factor=P,this._tool=null,this._object=null,this._createToolAbortController=null,this._onPointerMove=a(async e=>{const t=await this._updatingHandles.addPromise(this._findElementAtScreenPoint(e));this.destroyed||(this.removeHandles(M),t&&t!==this.selectedElement&&this.addHandles(this.view.acquireCursor("pointer","high"),M))}),this._tmpMat2=g(),this._tmpVec2=f()}destroy(){this._createToolAbortController=r(this._createToolAbortController)}initialize(){this.addHandles([o(this._updatingHandles),this._updatingHandles.add(()=>this.enabled,e=>this._enableDisable(e),l),this._updatingHandles.add(()=>this._preferredInteractionTool,e=>this._preferredInteractionToolChanged(e))])}_enableDisable(e){if(!e)return void this.removeHandles(O);this._dynamicImports();const{view:t}=this,o=new j;o.add(w.undo,()=>{this._object?.operations?.undo(),this._object?.emit("modified-externally")}),o.add(w.redo,()=>{this._object?.operations?.redo(),this._object?.emit("modified-externally")}),o.addToggle(w.preserveAspectRatio,e=>{"transform-3d"===this._tool?.type&&(this._tool.preserveAspectRatio="key-down"===e.type)}),o.addToggle(w.editSourcePoints,e=>{"reshape-3d"===this._tool?.type&&(this._isEditSourcePointsToggled="key-down"===e.type)}),o.addToggle(w.rotateIncrements,e=>{"transform-3d"===this._tool?.type&&(this._tool.snapRotation="key-down"===e.type)}),o.add(w.toggleOpacity,()=>{const e=this._object?.element;e&&(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),o.add(w.moveUp,()=>this._move(0,this._factor)),o.add(w.moveDown,()=>this._move(0,-this._factor)),o.add(w.moveRight,()=>this._move(this._factor,0)),o.add(w.moveLeft,()=>this._move(-this._factor,0)),o.addToggle(w.factorModifier,e=>this._factor="key-down"===e.type?S:P),this._isOpacityToggled=!1,this.addHandles([o.register(t,b.TOOL),i(()=>{this._isOpacityToggled&&this.selectedElement&&(this.selectedElement.opacity*=2,this._isOpacityToggled=!1)}),t.on("immediate-click",e=>this._onClick(e),b.TOOL),t.on("pointer-move",e=>this._onPointerMove(e).catch(()=>{}),b.TOOL),this._updatingHandles.add(()=>this._validatedSelectedElement,(e,t)=>{t&&e!==t&&this._isOpacityToggled&&(t.opacity*=2,this._isOpacityToggled=!1),this._selectedElementChanged(e)},l),i(()=>{this.removeHandles(M),this._removeTool()})],O)}async _onClick(e){await this._updatingHandles.addPromise(e.defer(async()=>{const t=await this._findElementAtScreenPoint(e);this.destroyed||(t&&e.stopPropagation(),this.selectedElement=t,this.selectedElement&&this.removeHandles(M))}))}async _selectedElementChanged(e){e?.georeference?this._object?.element!==e&&await this._updatingHandles.addPromise(this._recreateTool()):this._removeTool()}async _recreateTool(){this._createToolAbortController=r(this._createToolAbortController),this._removeTool();const e=this._validatedSelectedElement;if(!e)return;const t=new AbortController;this._createToolAbortController=t;const{ManipulatedObject3DMediaElement:o,ExtentTransformTool:s,ReshapeTool3D:a}=await this._dynamicImports();if(t.signal.aborted)return;const{view:l,layer:p,_toolType:h}=this;switch(this._object=new o({view:l,layer:p,element:e,tool:this._preferredInteractionTool}),h){case"transform-3d":this._tool=new s({view:l,object:this._object}),l.inputManager.isModifierKeyDown(w.rotateIncrements.key)&&(this._tool.snapRotation=!0),l.inputManager.isModifierKeyDown(w.preserveAspectRatio.key)&&(this._tool.preserveAspectRatio=!0);break;case"reshape-3d":{const e=E(l),{snappingManager:t}=e;this._tool=new a({view:l,object:this._object,enableMidpoints:!1,enableZShape:!1,snappingManager:t,enableMoveObject:!1,autoHideManipulators:!0,enableDeleteVertices:!1,toolOptions:{tooltips:{enabled:!0,inputEnabled:!0,visibleElements:{area:!1}}}}),this.addHandles([e,d(()=>({editSourcePoints:this.editSourcePoints,operations:this._object?.operations}),e=>{e.operations instanceof T&&(e.operations.editSourcePoints=e.editSourcePoints)},c)],this._tool)}}this.addHandles([i(()=>{this._object=n(this._object),this._tool&&(l.tools.remove(this._tool),this._tool=null)})],this._tool),l.addAndActivateTool(this._tool)}_preferredInteractionToolChanged(e){const{_tool:t}=this;if(!t)return;if(this._toolType!==t.type)return void this._updatingHandles.consumePromise(this._recreateTool());const{_object:o}=this;o&&(o.tool=e)}async _dynamicImports(){const[{ManipulatedObject3DMediaElement:e},{ExtentTransformTool:t,ReshapeTool3D:o}]=await Promise.all([import("../../interactive/editingTools/ManipulatedObject3DMediaElement.js"),import("../../interactive/editingTools.js")]);return{ManipulatedObject3DMediaElement:e,ExtentTransformTool:t,ReshapeTool3D:o}}async _findElementAtScreenPoint(e){const t=(await this.view.hitTest(e,{include:[this.layer]})).results[0];return"media"===t?.type?t.element:null}_removeTool(){this._tool&&this.removeHandles(this._tool)}_move(e,t){const{view:o,_object:i}=this,r=i?.operations;if(!r)return;const n=o.overlayPixelSizeInMapUnits(o.pointsOfInterest.focus.location)*p(o.spatialReference)/p(r.data.spatialReference),{_tmpMat2:a,_tmpVec2:l}=this,d=_(a,s(360-this.view.camera.heading)),c=u(l,n*e,n*t);y(c,c,d),r.move(c[0],c[1],0),i.emit("modified-externally")}};e([h({constructOnly:!0})],H.prototype,"view",void 0),e([h({constructOnly:!0})],H.prototype,"layer",void 0),e([h()],H.prototype,"selectedElement",void 0),e([h()],H.prototype,"enabled",void 0),e([h()],H.prototype,"options",void 0),e([h()],H.prototype,"editSourcePoints",null),e([h()],H.prototype,"_isEditSourcePointsToggled",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"_preferredInteractionTool",null),e([h()],H.prototype,"_validatedSelectedElement",null),H=e([m("esri.views.3d.layers.support.MediaLayerInteraction")],H);export{H as MediaLayerInteraction};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{PrimitiveType as t}from"../../../webgl/enums.js";const n={Points:null,Lines:null,LineStrip:null,Triangles:t.TRIANGLES,TriangleStrip:t.TRIANGLE_STRIP,NotSet:null},e={Opaque:1,Mask:2,Blend:0},l={Back:2,Front:1,None:0,NotSet:0},s={WrapYBit:{s:33071,t:10497},WrapXBit:{s:10497,t:33071},WrapXy:{s:10497,t:10497},None:{s:33071,t:33071},NotSet:{s:33071,t:33071}};export{e as alphaModeConversion,l as faceCullingConversion,n as primTypeConversion,s as wrapModeConversion};
2
+ import{PrimitiveType as t}from"../../../webgl/enums.js";const e={Points:null,Lines:null,Triangles:t.TRIANGLES,NotSet:null},o={None:1,Mask:2,Alpha:0,PreMultAlpha:0,NotSet:1},n={Back:2,Front:1,None:0,NotSet:0},s={WrapYBit:{s:33071,t:10497},WrapXBit:{s:10497,t:33071},WrapXy:{s:10497,t:10497},None:{s:33071,t:33071},NotSet:{s:33071,t:33071}};export{o as alphaModeConversion,n as faceCullingConversion,e as primTypeConversion,s as wrapModeConversion};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t,syncAndInitial as s,when as i,sync as l}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as n,create as d}from"../../../../geometry/support/aaBoundingRect.js";import h from"../../layers/FlowSubView3D.js";import{getFeatureTileId as u}from"../../layers/support/FeatureTileDescriptor.js";import{tilesWaitingTime as c}from"./constants.js";import{FlowDataTile as p}from"./loadUtils.js";import{isRasterTile as f}from"../../terrain/TerrainData.js";import{descendantsAtLevel as T}from"../../terrain/tileUtils.js";import{toFlowData as _}from"../../../support/flow/dataUtils.js";const m={type:"delete"};let g=class extends h{constructor(e){super(e),this._flowDataTiles=D(),this._throttling=!1,this._resetTileData=!0}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{if(t!==this._layerIndex||1!==s)return;const i=this.frameTask.schedule(()=>{this._applyTileDataUpdate(e)&&this.triggerLoad()});this.updatingHandles.consumePromise(i)}),t(()=>this.renderedTiles,e=>{const t=this.frameTask.scheduleGenerator(this.loadAllTiles?t=>this._applyTileDataUpdates(e,t):t=>this._syncToTiles(e,t));this.updatingHandles.consumePromise(t)},s),i(()=>null!=this.renderedTiles&&null!=this.extent&&this.loadAllTiles,()=>{const e=this.frameTask.scheduleGenerator(e=>this._enterAllTilesMode(e));this.updatingHandles.consumePromise(e)},s),t(()=>this._pixelSize,()=>{this.invalidateTileData(),this._resetTileData=!0},l),this.layerView.on("data-changed",()=>{this.invalidateTileData(),this._resetTileData=!0})]),this._throttledTriggerLoad=a(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,c,this),this.addHandles(this._throttledTriggerLoad)}clear(){super.clear(),this._resetTileData=!1}*_enterAllTilesMode(e){const{targetTiles:t,_flowDataTiles:s}=this,i=D();for(const[l,a]of s)t.has(l)&&i.set(l,a);this._setFlowDataTiles(i),e.madeProgress(),e.done&&(e=yield),yield*this._applyTileDataUpdates(new Set(this.surface.allTiles),e),this.triggerLoad()}*_syncToTiles(e,t){const s=D();for(const i of e??[]){const e=this._flowDataTiles.get(i.key),l=null==e||"delete"===e.type||"invalid"===e.type?this._getLoadedState(i):e;null!=l&&s.set(i.key,l),t.madeProgress(),t.done&&(t=yield)}this._setFlowDataTiles(s),this.triggerLoad()}*_applyTileDataUpdates(e,t){let s=!1;for(const i of e??[]){const e=this._applyTileDataUpdate(i);s||=e,t.madeProgress(),t.done&&(t=yield)}s&&this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get _pixelSize(){return this.surface.tilingScheme.pixelSize}doRefresh(){this.invalidateTileData(),super.doRefresh()}triggerLoad(){const{_throttledTriggerLoad:e}=this;null!=e?this._allTilesLoaded?(e.hasPendingUpdates()||e(),e.forceUpdate()):e():super.triggerLoad()}async fetchDataAndGenerateStreamlines(e,t){const{_flowDataTiles:s,needsMagnitude:i}=this,l=this.getSimulationSettings(e);if(null==l)return;const a=this._resetTileData;if(!a&&0===s.size)return;const r=D();s.forEach((e,t)=>{"delete"===e.type?(r.set(t,m),s.delete(t)):(a||"on-worker"!==e.type&&"invalid"!==e.type)&&(r.set(t,e),s.set(t,"invalid"===e.type?{type:"invalid",memory:e.memory}:{type:"on-worker",sourceLevel:e.sourceLevel,memory:e.memory}))});const o={simulationSettings:l,flowExtentInfo:e.flowExtentInfo,flowDataTiles:r,reset:a,needsMagnitude:i,startPositions:this.startPositions(e)};this._resetTileData=!1;const{streamlines:n}=await this.workerHandle.generateTiledStreamlines(o,t);return n}hasWork(){const e=!this.suspended&&super.loadRequirementsMet&&this.tilesIntersectDataBounds;return super.hasWork()||this._throttling||this._resetTileData&&e}get loadRequirementsMet(){return super.loadRequirementsMet&&(this._flowDataTiles.size>0||this._resetTileData)}_getLoadedState(e){const{_layerIndex:t}=this;if(null==t||e.isDisposed)return null;const s=e.getLayerInfo(t,1);if(null==s)return null;const i=this._getRasterTile(s,e,t);if(null==i)return this._upsampleFlowData(t,s.upsampleInfo,e.lij,e.extent);const l=this._createFlowDataTile(i,e.lij,e.extent,this._pixelSize);return{type:"loaded",memory:v(l),data:l,sourceLevel:e.level}}_upsampleFlowData(e,t,s,i){if(null==t)return null;const l=t.tile;if(null==l)return null;const a=l.getLayerInfo(e,1);if(null==a)return null;const r=this._getRasterTile(a,l,e);if(null==r)return null;const{scale:o,offset:n}=t,d=Math.max(Math.floor(this._pixelSize*o),1),h=r.source,u=Math.floor(n[0]*h.width),c=Math.floor((1-n[1]-o)*h.height),p=this._createFlowDataTile(r,s,i,d,u,c);return{type:"loaded",memory:v(p),data:p,sourceLevel:l.level}}_getRasterTile(e,t,s){const{data:i}=e;return!e.dataMissing&&t.hasLayerData(s,1)&&f(i)?i:null}_createFlowDataTile(e,t,s,i,l,a){const r=_(this.layer.serviceRasterInfo.dataType,e.source,i,i,l,a),o=r.mask.slice();return new p(r.data,o,r.width,r.height,t,n(s))}_applyTileDataUpdate(e){const{renderedTiles:t,_layerIndex:s,loadAllTiles:i,loadAllTilesLevel:l}=this;if(null==t||null==s||i&&e.level>l)return!1;if(t.has(e))return this._updateRenderedTile(e);const a=e.key;let r=this._setTileData(a,m);const o=this._updateUpsampledTiles(t,e,s);r||=o;const n=i&&this._updateDescendants(e,s);return r||=n,r}_updateRenderedTile(e){const t=e.key,{_flowDataTiles:s}=this;if(w(s.get(t),e))return!1;const i=this._getLoadedState(e);return this._setTileData(t,i)}_updateUpsampledTiles(e,t,s){const{_flowDataTiles:i}=this;let l=!1;for(const a of e.values()){const e=a.key;if(w(i.get(e),t))continue;const r=a.getLayerInfo(s,1);if(null==r)continue;if(null!=this._getRasterTile(r,a,s))continue;const o=r.upsampleInfo?.tile;if(o!==t)continue;const n=this._getLoadedState(a),d=this._setTileData(e,n);l||=d}return l}_updateDescendants(e,t){let s=!1;const{tilingScheme:i,upsampleInfoPool:l}=this.surface,{targetTiles:a,_flowDataTiles:r,loadAllTilesLevel:o}=this,n=e.lij,h=T(n,o).map(e=>[u(e[0],e[1],e[2]),e]).filter(([e])=>a.has(e));if(0===h.length)return s;const c=1<<o-n[0],p=1/c,f=n[1]*c,_=n[2]*c,m=l.acquire();for(const[u,T]of h){if(w(r.get(u),e))continue;const l=d();i.getExtent(T[0],T[1],T[2],l);const a=1-(T[1]-f)*p-p,o=(T[2]-_)*p;m.init(e,o,a,p);const n=this._upsampleFlowData(t,m,T,l),h=this._setTileData(u,n);s||=h}return l.release(m),s}_setTileData(e,t){if(null==t)return!1;const{_flowDataTiles:s}=this;return(null!=s.get(e)||"delete"!==t.type)&&(s.set(e,t),!0)}_setFlowDataTiles(e){const t=this._flowDataTiles.size!==e.size||e.entries().some(([e,t])=>this._flowDataTiles.get(e)!==t);this._flowDataTiles=e,t&&(this._resetTileData=!0)}get _allTilesLoaded(){let e=0;for(const t of this._flowDataTiles.values()??[])"delete"!==t.type&&"invalid"!==t.type&&e++;return this.loadAllTiles?e===this.targetTiles.size:e===this.renderedTiles?.size}invalidateTileData(){const{_flowDataTiles:e}=this;for(const[t,s]of e.entries())"delete"!==s.type&&e.set(t,{type:"invalid",memory:s.memory})}get usedMemory(){let e=0;return this._flowDataTiles.forEach(t=>{"delete"!==t.type&&(e+=t.memory)}),super.usedMemory+e}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};e([r()],g.prototype,"_throttling",void 0),e([r()],g.prototype,"_resetTileData",void 0),g=e([o("esri.views.3d.support.flow.FlowSubViewTiles3D")],g);const y=g;function D(){return new Map}function w(e,t){return null!=e&&("loaded"===e.type||"on-worker"===e.type)&&e.sourceLevel>=t.level}function v(e){return e.width*e.height*9}export{y as default};
2
+ import{__decorate as e}from"tslib";import{watch as t,syncAndInitial as s,when as i,sync as l}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as n,create as d}from"../../../../geometry/support/aaBoundingRect.js";import h from"../../layers/FlowSubView3D.js";import{getFeatureTileId as u}from"../../layers/support/FeatureTileDescriptor.js";import{tilesWaitingTime as c}from"./constants.js";import{FlowDataTile as p}from"./loadUtils.js";import{isRasterTile as f}from"../../terrain/TerrainData.js";import{descendantsAtLevel as T}from"../../terrain/tileUtils.js";import{toFlowData as _}from"../../../support/flow/dataUtils.js";const m={type:"delete"};let g=class extends h{constructor(e){super(e),this._flowDataTiles=D(),this._throttling=!1,this._resetTileData=!0}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{if(t!==this._layerIndex||1!==s)return;const i=this.frameTask.schedule(()=>{this._applyTileDataUpdate(e)&&this.triggerLoad()});this.updatingHandles.consumePromise(i)}),t(()=>this.renderedTiles,e=>{const t=this.frameTask.scheduleGenerator(this.loadAllTiles?t=>this._applyTileDataUpdates(e,t):t=>this._syncToTiles(e,t));this.updatingHandles.consumePromise(t)},s),i(()=>null!=this.renderedTiles&&null!=this.extent&&this.loadAllTiles,()=>{const e=this.frameTask.scheduleGenerator(e=>this._enterAllTilesMode(e));this.updatingHandles.consumePromise(e)},s),t(()=>this._pixelSize,()=>{this.invalidateTileData(),this._resetTileData=!0},l),this.layerView.on("data-changed",()=>{this.invalidateTileData(),this._resetTileData=!0})]),this._throttledTriggerLoad=a(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,c,this),this.addHandles(this._throttledTriggerLoad)}clear(){super.clear(),this._resetTileData=!1}*_enterAllTilesMode(e){const{targetTiles:t,_flowDataTiles:s}=this,i=D();for(const[l,a]of s)t.has(l)&&i.set(l,a);this._setFlowDataTiles(i),e.madeProgress(),e.done&&(e=yield),yield*this._applyTileDataUpdates(new Set(this.surface.allTiles),e),this.triggerLoad()}*_syncToTiles(e,t){const s=D();for(const i of e??[]){const e=this._flowDataTiles.get(i.key),l=null==e||"delete"===e.type||"invalid"===e.type?this._getLoadedState(i):e;null!=l&&s.set(i.key,l),t.madeProgress(),t.done&&(t=yield)}this._setFlowDataTiles(s),this.triggerLoad()}*_applyTileDataUpdates(e,t){let s=!1;for(const i of e??[]){const e=this._applyTileDataUpdate(i);s||=e,t.madeProgress(),t.done&&(t=yield)}s&&this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get _pixelSize(){return this.surface.tilingScheme.pixelSize}doRefresh(){this.invalidateTileData(),super.doRefresh()}triggerLoad(){const{_throttledTriggerLoad:e}=this;null!=e?this._allTilesLoaded?(e.hasPendingUpdates()||e(),e.forceUpdate()):e():super.triggerLoad()}async fetchDataAndGenerateStreamlines(e,t){const{_flowDataTiles:s,needsMagnitude:i}=this,l=this.getSimulationSettings(e);if(null==l)return;const a=this._resetTileData;if(!a&&0===s.size)return;const r=D();s.forEach((e,t)=>{"delete"===e.type?(r.set(t,m),s.delete(t)):(a||"on-worker"!==e.type&&"invalid"!==e.type)&&(r.set(t,e),s.set(t,"invalid"===e.type?{type:"invalid",memory:e.memory}:{type:"on-worker",sourceLevel:e.sourceLevel,memory:e.memory}))});const o={simulationSettings:l,flowExtentInfo:e.flowExtentInfo,flowDataTiles:r,reset:a,needsMagnitude:i,startPositions:this.startPositions(e)};this._resetTileData=!1;const{streamlines:n}=await this.workerHandle.generateTiledStreamlines(o,t);return n}hasWork(){const e=!this.suspended&&super.loadRequirementsMet&&this.tilesIntersectDataBounds;return super.hasWork()||this._throttling||this._resetTileData&&e}get loadRequirementsMet(){return super.loadRequirementsMet&&(this._flowDataTiles.size>0||this._resetTileData)}_getLoadedState(e){const{_layerIndex:t}=this;if(null==t||e.isDisposed)return null;const s=e.getLayerInfo(t,1);if(null==s)return null;const i=this._getRasterTile(s,e,t);if(null==i)return this._upsampleFlowData(t,s.upsampleInfo,e.lij,e.extent);const l=this._createFlowDataTile(i,e.lij,e.extent,this._pixelSize);return{type:"loaded",memory:v(l),data:l,sourceLevel:e.level}}_upsampleFlowData(e,t,s,i){if(null==t)return null;const l=t.tile;if(null==l)return null;const a=l.getLayerInfo(e,1);if(null==a)return null;const r=this._getRasterTile(a,l,e);if(null==r)return null;const{scale:o,offset:n}=t,d=Math.max(Math.floor(this._pixelSize*o),1),h=r.source,u=Math.floor(n[0]*h.width),c=Math.floor((1-n[1]-o)*h.height),p=this._createFlowDataTile(r,s,i,d,u,c);return{type:"loaded",memory:v(p),data:p,sourceLevel:l.level}}_getRasterTile(e,t,s){const{data:i}=e;return!e.dataMissing&&t.hasLayerData(s,1)&&f(i)?i:null}_createFlowDataTile(e,t,s,i,l,a){const r=_(this.layer.serviceRasterInfo.dataType,e.source,i,i,l,a),o=r.mask.slice();return new p(r.data,o,r.width,r.height,t,n(s))}_applyTileDataUpdate(e){const{renderedTiles:t,_layerIndex:s,loadAllTiles:i,loadAllTilesLevel:l}=this;if(null==t||null==s||i&&e.level>l)return!1;if(t.has(e))return this._updateRenderedTile(e);const a=e.key;let r=this._setTileData(a,m);const o=this._updateUpsampledTiles(t,e,s);r||=o;const n=i&&this._updateDescendants(e,s);return r||=n,r}_updateRenderedTile(e){const t=e.key,{_flowDataTiles:s}=this;if(w(s.get(t),e))return!1;const i=this._getLoadedState(e);return this._setTileData(t,i)}_updateUpsampledTiles(e,t,s){const{_flowDataTiles:i}=this;let l=!1;for(const a of e.values()){const e=a.key;if(w(i.get(e),t))continue;const r=a.getLayerInfo(s,1);if(null==r)continue;if(null!=this._getRasterTile(r,a,s))continue;const o=r.upsampleInfo?.tile;if(o!==t)continue;const n=this._getLoadedState(a),d=this._setTileData(e,n);l||=d}return l}_updateDescendants(e,t){let s=!1;const{tilingScheme:i,upsampleInfoPool:l}=this.surface,{targetTiles:a,_flowDataTiles:r,loadAllTilesLevel:o}=this,n=e.lij,h=T(n,o).values().map(e=>[u(e[0],e[1],e[2]),e]).filter(([e])=>a.has(e)).toArray();if(0===h.length)return s;const c=1<<o-n[0],p=1/c,f=n[1]*c,_=n[2]*c,m=l.acquire();for(const[u,T]of h){if(w(r.get(u),e))continue;const l=d();i.getExtent(T[0],T[1],T[2],l);const a=1-(T[1]-f)*p-p,o=(T[2]-_)*p;m.init(e,o,a,p);const n=this._upsampleFlowData(t,m,T,l),h=this._setTileData(u,n);s||=h}return l.release(m),s}_setTileData(e,t){if(null==t)return!1;const{_flowDataTiles:s}=this;return(null!=s.get(e)||"delete"!==t.type)&&(s.set(e,t),!0)}_setFlowDataTiles(e){const t=this._flowDataTiles.size!==e.size||e.entries().some(([e,t])=>this._flowDataTiles.get(e)!==t);this._flowDataTiles=e,t&&(this._resetTileData=!0)}get _allTilesLoaded(){let e=0;for(const t of this._flowDataTiles.values()??[])"delete"!==t.type&&"invalid"!==t.type&&e++;return this.loadAllTiles?e===this.targetTiles.size:e===this.renderedTiles?.size}invalidateTileData(){const{_flowDataTiles:e}=this;for(const[t,s]of e.entries())"delete"!==s.type&&e.set(t,{type:"invalid",memory:s.memory})}get usedMemory(){let e=0;return this._flowDataTiles.forEach(t=>{"delete"!==t.type&&(e+=t.memory)}),super.usedMemory+e}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};e([r()],g.prototype,"_throttling",void 0),e([r()],g.prototype,"_resetTileData",void 0),g=e([o("esri.views.3d.support.flow.FlowSubViewTiles3D")],g);const y=g;function D(){return new Map}function w(e,t){return null!=e&&("loaded"===e.type||"on-worker"===e.type)&&e.sourceLevel>=t.level}function v(e){return e.width*e.height*9}export{y as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{doubleSubArray as n,newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as s}from"../../layers/graphics/elevationAlignmentUtils.js";import{axisFromRings as i,ringsToOutlinedTessellationInfo as r,tessellateOrLoad as l,load as u}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as c}from"../../terrain/OverlayRenderer.js";async function a(){return u()}class p{constructor(e,t,n,o){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=o,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=A(e.outlineIndices[n]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){t+=A(e.outlineIndices[n])}return t}}class d extends p{}class f extends p{}class h extends p{constructor(e,t,n,o,s,i){super(e,n,o,s),this.mapPositions=t,this.sampledElevation=i}}function g(t,n){const o=R(t,n);return e(o)?null:o}function m(t,n,o,s,i){const r=w(t,n,o,s,i);return e(r)?null:r}function x(t,n){const o=v(t,n);return e(o)?null:o}function R(t,n){const{projectIfNearlyVertical:o=!1,outlineOutput:s="none",method:u,owner:c}=n??{},a="tessellated-indices"===s,p=i(t.rings,!!t.hasZ,t.spatialReference),d=r(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:p}),h=l(d,{projectionAxis:o?p:void 0,outlines:a?d.outlines:void 0,method:u,owner:c});if(e(h))return h;if(!h.succeeded)return null;let g={output:"none"};if("vertex-data"===s){const e=h.positions!==d.positions?d.positions:d.positions.slice();g={output:"vertex-data",outlines:j(d.outlines,e)}}else"tessellated-indices"===s&&(g=y(h));return new f(h.positions,h.indices,g,!0)}function v(n,o){const{drapedSpatialReference:s,projectIfNearlyVertical:u=!1,outlineOutput:a="none",method:p,owner:f}=o,h=i(n.rings,!1,n.spatialReference),g=r(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:h}),m="none"!==a,x=t(g.positions,n.spatialReference,0,g.positions,s,0),R=l(g,{projectionAxis:u?h:void 0,outlines:m?g.outlines:void 0,method:p,owner:f});if(e(R))return R;if(!R.succeeded)return null;const{positions:v,indices:w}=R;for(let e=2;e<v.length;e+=3)v[e]=c;let I={output:"none"};if("vertex-data"===a){if(v!==g.positions)for(let t=2;t<g.positions.length;t+=3)g.positions[t]=c;const e=v!==g.positions?g.positions:g.positions.slice();I={output:"vertex-data",outlines:j(g.outlines,e)}}else"tessellated-indices"===a&&(I=y(R));return new d(v,w,I,x)}function w(t,n,u,c,a){const{projectIfNearlyVertical:p=!1,outlineOutput:d="none",method:f,owner:g}=a??{},m="none"!==d,x=!!t.hasZ&&"on-the-ground"!==c.mode,R=i(t.rings,x,t.spatialReference),v=r(t.rings,{hasZ:x,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:R}),w=l(v,{projectionAxis:p?R:void 0,outlines:m?v.outlines:void 0,method:f,owner:g});if(e(w))return w;if(!w.succeeded)return null;const{positions:j,vertexCount:A}=w,Z=o(j.length),C=s(j,t.spatialReference,0,Z,0,j,0,A,n,u,c);let O={output:"none"};"vertex-data"===d?O={output:"vertex-data",outlines:I(w,Z)}:"tessellated-indices"===d&&(O=y(w));const B=null!=C;return new h(j,Z,w.indices,O,B,C)}function j(e,t,o=null){return e.filter(({count:e})=>e>1).map(({index:e,count:s})=>{const i=3*e,r=3*s;return null!=o?new C(e,s,n(t,i,r),n(o,i,r)):new Z(e,s,n(t,i,r))})}function y(e){const{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(null==t||null==n)return{output:"none"};const o=new Array(n.length);let s=0;for(let i=0;i<n.length;i++){const e=n[i],r=t.slice(s,s+e);o[i]=r,s+=e}return{output:"tessellated-indices",outlineIndices:o}}function I(e,t){const{outlineIndexBuffer:s,outlineRingLengths:i,positions:r}=e;if(null==s||null==i)return[];let l=0;for(let n=0;n<i.length;n++)l+=i[n]-1;const u=o(3*l),c=o(3*l),a=new Array;let p=0,d=0;for(let o=0;o<i.length;o++){const e=i[o],l=e-1;for(let n=0;n<l;n++){const e=3*s[p+n],o=3*(d+n);u[o]=r[e],u[o+1]=r[e+1],u[o+2]=r[e+2],c[o]=t[e],c[o+1]=t[e+1],c[o+2]=t[e+2]}a.push(new C(d,l,n(u,3*d,3*l),n(c,3*d,3*l))),p+=e,d+=l}return a}function A(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class Z{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class C extends Z{constructor(e,t,n,o){super(e,t,n),this.mapPositions=o}}export{C as OutlineVertexData,Z as OutlineVertexDataDraped,p as PolygonRenderInfoBase,d as PolygonRenderInfoDraped,h as PolygonRenderInfoElevationAligned,f as PolygonRenderInfoNotElevationAligned,a as loadTessellationUtils,v as polygonToRenderInfoDraped,w as polygonToRenderInfoElevationAligned,R as polygonToRenderInfoNotElevationAligned,x as preloadedPolygonToRenderInfoDraped,m as preloadedPolygonToRenderInfoElevationAligned,g as preloadedPolygonToRenderInfoNotElevationAligned,y as splitOutlineIndexRings,I as tessellatedOutlineIndicesToVertexData};
2
+ import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{doubleSubArray as n,newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as s}from"../../layers/graphics/elevationAlignmentUtils.js";import{axisFromRings as i,ringsToOutlinedTessellationInfo as r,tessellateOrLoad as l,load as u}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as c}from"../../terrain/OverlayRenderer.js";async function a(){return u()}class p{constructor(e,t,n,o){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=o,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=A(e.outlineIndices[n]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){t+=A(e.outlineIndices[n])}return t}}class d extends p{}class f extends p{}class h extends p{constructor(e,t,n,o,s,i){super(e,n,o,s),this.mapPositions=t,this.sampledElevation=i}}function g(t,n){const o=v(t,n);return e(o)?null:o}function m(t,n,o,s,i){const r=w(t,n,o,s,i);return e(r)?null:r}function x(t,n){const o=R(t,n);return e(o)?null:o}function v(t,n){const{projectIfNearlyVertical:o=!1,outlineOutput:s="none",method:u,owner:c}=n??{},a="tessellated-indices"===s,p=i(t.rings,!!t.hasZ,t.spatialReference),d=r(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:p}),h=l(d,{projectionAxis:o?p:void 0,outlines:a?d.outlines:void 0,method:u,owner:c});if(e(h))return h;if(!h.succeeded)return null;let g={output:"none"};if("vertex-data"===s){const e=h.positions!==d.positions?d.positions:d.positions.slice();g={output:"vertex-data",outlines:y(d.outlines,e)}}else"tessellated-indices"===s&&(g=j(h));return new f(h.positions,h.indices,g,!0)}function R(n,o){const{drapedSpatialReference:s,projectIfNearlyVertical:u=!1,outlineOutput:a="none",method:p,owner:f}=o,h=i(n.rings,!1,n.spatialReference),g=r(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:h}),m="none"!==a,x=t(g.positions,n.spatialReference,0,g.positions,s,0),v=l(g,{projectionAxis:u?h:void 0,outlines:m?g.outlines:void 0,method:p,owner:f});if(e(v))return v;if(!v.succeeded)return null;const{positions:R,indices:w}=v;for(let e=2;e<R.length;e+=3)R[e]=c;let I={output:"none"};if("vertex-data"===a){if(R!==g.positions)for(let t=2;t<g.positions.length;t+=3)g.positions[t]=c;const e=R!==g.positions?g.positions:g.positions.slice();I={output:"vertex-data",outlines:y(g.outlines,e)}}else"tessellated-indices"===a&&(I=j(v));return new d(R,w,I,x)}function w(t,n,u,c,a){const{projectIfNearlyVertical:p=!1,outlineOutput:d="none",method:f,owner:g}=a??{},m="none"!==d,x=!!t.hasZ&&"on-the-ground"!==c.mode,v=i(t.rings,x,t.spatialReference),R=r(t.rings,{hasZ:x,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:v}),w=l(R,{projectionAxis:p?v:void 0,outlines:m?R.outlines:void 0,method:f,owner:g});if(e(w))return w;if(!w.succeeded)return null;const{positions:y,vertexCount:A}=w,Z=o(y.length),C=s(y,t.spatialReference,0,Z,0,y,0,A,n,u,c);let O={output:"none"};"vertex-data"===d?O={output:"vertex-data",outlines:I(w,Z)}:"tessellated-indices"===d&&(O=j(w));const B=null!=C;return new h(y,Z,w.indices,O,B,C)}function y(e,t,o=null){return e.values().filter(({count:e})=>e>1).map(({index:e,count:s})=>{const i=3*e,r=3*s;return null!=o?new C(e,s,n(t,i,r),n(o,i,r)):new Z(e,s,n(t,i,r))}).toArray()}function j(e){const{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(null==t||null==n)return{output:"none"};const o=new Array(n.length);let s=0;for(let i=0;i<n.length;i++){const e=n[i],r=t.slice(s,s+e);o[i]=r,s+=e}return{output:"tessellated-indices",outlineIndices:o}}function I(e,t){const{outlineIndexBuffer:s,outlineRingLengths:i,positions:r}=e;if(null==s||null==i)return[];let l=0;for(let n=0;n<i.length;n++)l+=i[n]-1;const u=o(3*l),c=o(3*l),a=new Array;let p=0,d=0;for(let o=0;o<i.length;o++){const e=i[o],l=e-1;for(let n=0;n<l;n++){const e=3*s[p+n],o=3*(d+n);u[o]=r[e],u[o+1]=r[e+1],u[o+2]=r[e+2],c[o]=t[e],c[o+1]=t[e+1],c[o+2]=t[e+2]}a.push(new C(d,l,n(u,3*d,3*l),n(c,3*d,3*l))),p+=e,d+=l}return a}function A(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class Z{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class C extends Z{constructor(e,t,n,o){super(e,t,n),this.mapPositions=o}}export{C as OutlineVertexData,Z as OutlineVertexDataDraped,p as PolygonRenderInfoBase,d as PolygonRenderInfoDraped,h as PolygonRenderInfoElevationAligned,f as PolygonRenderInfoNotElevationAligned,a as loadTessellationUtils,R as polygonToRenderInfoDraped,w as polygonToRenderInfoElevationAligned,v as polygonToRenderInfoNotElevationAligned,x as preloadedPolygonToRenderInfoDraped,m as preloadedPolygonToRenderInfoElevationAligned,g as preloadedPolygonToRenderInfoNotElevationAligned,j as splitOutlineIndexRings,I as tessellatedOutlineIndicesToVertexData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./ComponentData.glsl.js";import"../../../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../../../core/shaderLibrary/ShaderOutput.js";import"../../../core/shaderLibrary/Slice.glsl.js";import"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../core/shaderModules/BooleanDrawUniform.js";import"../../../core/shaderModules/FloatDrawUniform.js";import"../../../core/shaderModules/glsl.js";import"../../../core/shaderModules/Texture2DBindUniform.js";import"../../../effects/snowcover/SnowCover.glsl.js";import"../../../shaders/alphaCutoff.glsl.js";import"../../../shaders/OutputColorHighlightOLID.glsl.js";import"../../../shaders/SphereDepthInterpolate.glsl.js";import"../../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../../chunks/Component.glsl.js";
2
+ import"./ComponentData.glsl.js";import"../../../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../../../core/shaderLibrary/ShaderOutput.js";import"../../../core/shaderLibrary/Slice.glsl.js";import"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../core/shaderLibrary/output/DepthConversion.glsl.js";import"../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../core/shaderModules/BooleanDrawUniform.js";import"../../../core/shaderModules/FloatDrawUniform.js";import"../../../core/shaderModules/glsl.js";import"../../../core/shaderModules/Texture2DBindUniform.js";import"../../../effects/snowcover/SnowCover.glsl.js";import"../../../shaders/alphaCutoff.glsl.js";import"../../../shaders/OutputColorHighlightOLID.glsl.js";import"../../../shaders/SphereDepthInterpolate.glsl.js";import"../../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../../chunks/Component.glsl.js";
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ReadDepth as e}from"./output/ReadDepth.glsl.js";import{CameraSpace as o}from"./util/CameraSpace.glsl.js";import{glsl as t}from"../shaderModules/glsl.js";function i(i){const r=i.fragment;i.include(o),r.include(e),r.code.add(t`vec3 normalFromDepth(sampler2D depthMap, vec3 pixelPos, vec2 fragCoord, vec2 uv) {
2
+ import{DepthConversion as e}from"./output/DepthConversion.glsl.js";import{CameraSpace as o}from"./util/CameraSpace.glsl.js";import{glsl as t}from"../shaderModules/glsl.js";function i(i){const r=i.fragment;i.include(o),r.include(e),r.code.add(t`vec3 normalFromDepth(sampler2D depthMap, vec3 pixelPos, vec2 fragCoord, vec2 uv) {
3
3
  ivec2 iuv = ivec2(uv * vec2(textureSize(depthMap, 0)));
4
4
  float leftPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(-1, 0), 0).r);
5
5
  float rightPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(1, 0), 0).r);
@@ -0,0 +1,14 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{set as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2BindUniform as o}from"../../shaderModules/Float2BindUniform.js";import{glsl as r}from"../../shaderModules/glsl.js";function a(t){t.uniforms.add(new o("zProjectionMap",t=>n(t.camera))),t.code.add(r`float linearizeDepth(float depth, vec2 zProjectionConstants) {
3
+ float depthNdc = depth * 2.0 - 1.0;
4
+ return -(zProjectionConstants[0] / (depthNdc + zProjectionConstants[1] + 1e-7));
5
+ }
6
+ float linearizeDepth(float depth) {
7
+ return linearizeDepth(depth, zProjectionMap);
8
+ }`),t.code.add(r`float delinearizeDepth(float linearDepth) {
9
+ float c1 = zProjectionMap[0];
10
+ float c2 = zProjectionMap[1];
11
+ float depthNdc = (-c1/linearDepth) - c2 - 1e-7;
12
+ float depthNonlinear01 = (depthNdc + 1.0 ) / 2.0;
13
+ return depthNonlinear01;
14
+ }`)}function n(e){const o=e.projectionMatrix;return t(i,o[14],o[10])}const i=e();export{a as DepthConversion,n as getZProjectionMap};
@@ -1,19 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2BindUniform as r}from"../../shaderModules/Float2BindUniform.js";import{glsl as o}from"../../shaderModules/glsl.js";function a(e){e.uniforms.add(new r("zProjectionMap",e=>i(e.camera))),e.code.add(o`float linearizeDepth(float depth, vec2 zProjectionConstants) {
3
- float depthNdc = depth * 2.0 - 1.0;
4
- return -(zProjectionConstants[0] / (depthNdc + zProjectionConstants[1] + 1e-7));
5
- }
6
- float linearizeDepth(float depth) {
7
- return linearizeDepth(depth, zProjectionMap);
8
- }`),e.code.add(o`float delinearizeDepth(float linearDepth) {
9
- float c1 = zProjectionMap[0];
10
- float c2 = zProjectionMap[1];
11
- float depthNdc = (-c1/linearDepth) - c2 - 1e-7;
12
- float depthNonlinear01 = (depthNdc + 1.0 ) / 2.0;
13
- return depthNonlinear01;
14
- }`),e.code.add(o`float depthFromTexture(sampler2D depthTexture, vec2 uv) {
2
+ import{DepthConversion as e}from"./DepthConversion.glsl.js";import{glsl as t}from"../../shaderModules/glsl.js";function r(r){r.include(e),r.code.add(t`float depthFromTexture(sampler2D depthTexture, vec2 uv) {
15
3
  ivec2 iuv = ivec2(uv * vec2(textureSize(depthTexture, 0)));
16
4
  return texelFetch(depthTexture, iuv, 0).r;
17
- }`),e.code.add(o`float linearDepthFromTexture(sampler2D depthTexture, vec2 uv) {
5
+ }`),r.code.add(t`float linearDepthFromTexture(sampler2D depthTexture, vec2 uv) {
18
6
  return linearizeDepth(depthFromTexture(depthTexture, uv));
19
- }`)}function i(t){const r=t.projectionMatrix;return e(n,r[14],r[10])}const n=t();export{a as ReadDepth,i as getZProjectionMap};
7
+ }`)}export{r as ReadDepth};
@@ -1,4 +1,4 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ReadDepth as e,getZProjectionMap as r}from"./ReadDepth.glsl.js";import{Float2BindUniform as t}from"../../shaderModules/Float2BindUniform.js";import{glsl as o}from"../../shaderModules/glsl.js";function a(a){a.include(e),a.uniforms.add(new t("zProjectionMapLastFrame",e=>r(e.reprojection.lastFrameCamera))),a.code.add(o`float linearDepthFromTextureLastFrame(sampler2D depthTexture, vec2 uv) {
2
+ import{getZProjectionMap as e}from"./DepthConversion.glsl.js";import{ReadDepth as r}from"./ReadDepth.glsl.js";import{Float2BindUniform as o}from"../../shaderModules/Float2BindUniform.js";import{glsl as t}from"../../shaderModules/glsl.js";function a(a){a.include(r),a.uniforms.add(new o("zProjectionMapLastFrame",r=>e(r.reprojection.lastFrameCamera))),a.code.add(t`float linearDepthFromTextureLastFrame(sampler2D depthTexture, vec2 uv) {
3
3
  return linearizeDepth(depthFromTexture(depthTexture, uv), zProjectionMapLastFrame);
4
4
  }`)}export{a as ReadDepthLastFrame};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getBasisTranscoder as e}from"../../../../libs/basisu/BasisUTranscoder.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import n from"../../../webgl/Texture.js";import{getFormatBytesPerElement as s}from"../../../webgl/Util.js";let r=null,i=null;async function a(){return null==i&&(i=e(),r=await i),i}function l(e,t){if(null==r)return e.byteLength;const n=new r.BasisFile(new Uint8Array(e)),s=u(n)?o(n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),t):0;return n.close(),n.delete(),s}function g(e,t){if(null==r)return e.byteLength;const n=new r.KTX2File(new Uint8Array(e)),s=c(n)?o(n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),t):0;return n.close(),n.delete(),s}function o(e,n,r,i,a){const l=s(n?t.COMPRESSED_RGBA8_ETC2_EAC:t.COMPRESSED_RGB8_ETC2),g=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*l*g)}function u(e){return e.getNumImages()>=1&&!e.isUASTC()}function c(e){return e.getFaces()>=1&&(e.isETC1S()||e.isUASTC())}async function m(e,t,n){null==r&&(r=await a());const s=new r.BasisFile(new Uint8Array(n));if(!u(s))return null;s.startTranscoding();const i=h(e,t,s.getNumLevels(0),s.getHasAlpha(),s.getImageWidth(0,0),s.getImageHeight(0,0),(e,t)=>s.getImageTranscodedSizeInBytes(0,e,t),(e,t,n)=>s.transcodeImage(n,0,e,t,0,0));return s.close(),s.delete(),i}async function T(e,t,n){null==r&&(r=await a());const s=new r.KTX2File(new Uint8Array(n));if(!c(s))return null;s.startTranscoding();const i=h(e,t,s.getLevels(),s.getHasAlpha(),s.getWidth(),s.getHeight(),(e,t)=>s.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,n)=>s.transcodeImage(n,e,0,0,t,0,-1,-1));return s.close(),s.delete(),i}function h(e,s,r,i,a,l,g,o){const{compressedTextureETC:u,compressedTextureS3TC:c}=e.capabilities,[m,T]=u?i?[1,t.COMPRESSED_RGBA8_ETC2_EAC]:[0,t.COMPRESSED_RGB8_ETC2]:c?i?[3,t.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,t.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=s.hasMipmap?r:Math.min(1,r),d=[];for(let t=0;t<h;t++)d.push(new Uint8Array(g(t,m))),o(t,m,d[t]);return s.internalFormat=T,s.hasMipmap=d.length>1,s.samplingMode=s.hasMipmap?9987:9729,s.width=a,s.height=l,new n(e,s,{type:"compressed",levels:d})}export{c as checkKTX2,m as createTextureBasis,T as createTextureKTX2,l as estimateMemoryBasis,g as estimateMemoryKTX2,a as loadBasisTranscoder};
2
+ import e from"../../../../core/Logger.js";import{getBasisTranscoder as t}from"../../../../libs/basisu/BasisUTranscoder.js";import{CompressedTextureFormat as n}from"../../../webgl/enums.js";import r from"../../../webgl/Texture.js";import{getFormatBytesPerElement as i}from"../../../webgl/Util.js";const s=()=>e.getLogger("esri.views.3d.webgl-engine.lib.BasisUtil");let a=null,l=null;const o=16,u=0,g=1,c=2,m=3,h=5,f=7,p=8,d=9,T=10,w=14,E=1481919403,S=3140563232,C=169478669,_=67305985;async function M(){return null==l&&(l=t(),a=await l),l}function y(e,t){if(null==a)return e.byteLength;const n=new a.BasisFile(new Uint8Array(e)),r=R(n)?b(n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),t):0;return n.close(),n.delete(),r}function A(e,t){if(null==a)return e.byteLength;const n=new a.KTX2File(new Uint8Array(e)),r=B(n)?b(n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),t):0;return n.close(),n.delete(),r}function b(e,t,r,s,a){const l=i(t?n.COMPRESSED_RGBA8_ETC2_EAC:n.COMPRESSED_RGB8_ETC2),o=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*s*l*o)}function R(e){return e.getNumImages()>=1&&!e.isUASTC()}function B(e){return e.getFaces()>=1&&(e.isETC1S()||e.isUASTC())}async function U(e,t,n){null==a&&(a=await M());const r=new a.BasisFile(new Uint8Array(n));if(!R(r))return null;r.startTranscoding();const i=D(e,t,r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),(e,t)=>r.getImageTranscodedSizeInBytes(0,e,t),(e,t,n)=>r.transcodeImage(n,0,e,t,0,0));return r.close(),r.delete(),i}async function I(e,t,n){null==a&&(a=await M());const r=new a.KTX2File(new Uint8Array(n));if(!B(r))return null;r.startTranscoding();const i=D(e,t,r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),(e,t)=>r.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,n)=>r.transcodeImage(n,e,0,0,t,0,-1,-1));return r.close(),r.delete(),i}function D(e,t,i,s,a,l,o,u){const{compressedTextureETC:g,compressedTextureS3TC:c}=e.capabilities,[m,h]=g?s?[1,n.COMPRESSED_RGBA8_ETC2_EAC]:[0,n.COMPRESSED_RGB8_ETC2]:c?s?[3,n.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,n.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],f=t.hasMipmap?i:Math.min(1,i),p=[];for(let n=0;n<f;n++)p.push(new Uint8Array(o(n,m))),u(n,m,p[n]);return t.internalFormat=h,t.hasMipmap=p.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=a,t.height=l,new r(e,t,{type:"compressed",levels:p})}function v(e,t,n){const i=x(n,t.hasMipmap??!1);if(null==i)throw new Error("KTX1 texture data is null");const{textureData:s,internalFormat:a,width:l,height:o}=i;return t.samplingMode=s.levels.length>1?9987:9729,t.hasMipmap=s.levels.length>1,t.internalFormat=a,t.width=l,t.height=o,new r(e,t,s)}function x(e,t){const r=new Uint32Array(e.buffer,e.byteOffset,o);if(r[u]!==E||r[g]!==S||r[c]!==C)return s().error("Invalid magic number in KTX1 header"),null;if(r[m]!==_||1!==r[h]||r[f]!==n.COMPRESSED_RGB8_ETC2||6407!==r[p])return s().error("Unsupported KTX1 image"),null;const i=r[f];let a=1,l=r[d],M=r[T];if(3&l||3&M)return null;const y=l,A=M;let b,R;!1!==t&&(a=Math.max(1,r[w]));let B=e.byteOffset+4*o;const U=[];for(let n=0;n<a;++n)R=(e[B]|e[B+1]<<8|e[B+2]<<16|e[B+3]<<24)>>>0,B+=4,b=new Uint8Array(e.buffer,B,R),U.push(b),B+=R,l=Math.max(1,l>>1),M=Math.max(1,M>>1);return{textureData:{type:"compressed",levels:U},internalFormat:i,width:y,height:A}}export{B as checkKTX2,x as createKTX1TextureData,U as createTextureBasis,v as createTextureKTX1,I as createTextureKTX2,y as estimateMemoryBasis,A as estimateMemoryKTX2,M as loadBasisTranscoder};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as a}from"../lighting/SceneLighting.js";class l{constructor(t,i){this.width=t,this.height=i}}const g=5e5;class u{constructor(t,h){this._rctx=t,this.shadowMap=h,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=i(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=i(new e),this._inverseViewport=s(),this._oldLighting=new a,this._newLighting=new a,this._fadedLighting=new a,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=t(this.depth),this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get emissions(){return this._emissions.value}set emissions(t){this._emissions.value=t}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(t){this._camera.value=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=s,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{u as BindParameters,l as ViewportSize};
2
+ import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as a}from"../lighting/SceneLighting.js";class l{constructor(t,i){this.width=t,this.height=i}}const g=5e5;class u{constructor(t,h){this._rctx=t,this.shadowMap=h,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=i(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=i(new e),this._inverseViewport=s(),this._oldLighting=new a,this._newLighting=new a,this._fadedLighting=new a,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=t(this.depth),this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get emissions(){return this._emissions.value}set emissions(t){this._emissions.value=t}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(t){this._camera.value=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=s,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{u as BindParameters,l as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../../core/Error.js";import{EventEmitter as e}from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as a}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as s,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as m,isTypedArray as l}from"../../../../core/typedArrayUtil.js";import{generateUID as h}from"../../../../core/uid.js";import{isBlobProtocol as d,isDataProtocol as p}from"../../../../core/urlUtils.js";import{whenVideoPlayable as _}from"../../../../layers/support/videoUtils.js";import{requestImage as u}from"../../../../request/image.js";import{loadImage as c}from"../../../../request/loadImage.js";import{createTextureKTX2 as g,createTextureBasis as x,estimateMemoryKTX2 as y,estimateMemoryBasis as f}from"./BasisUtil.js";import{createDDSTexture as F}from"./DDSUtil.js";import{ensureImageMaxSize as E}from"./textureUtils.js";import{assert as T}from"./Util.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as D}from"../../../webgl/TextureDescriptor.js";import{isCompressedFormat as A,isSizedPixelFormat as M,isSizedDepthFormat as v,isSizedDepthStencilFormat as U}from"../../../webgl/textureUtils.js";import{getFormatComponents as j}from"../../../webgl/Util.js";class I{constructor(t,r){this._data=t,this.id=h(),this.events=new e,this._parameters={...b,...r},this._startPreload(t)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(t){t instanceof HTMLVideoElement?(this.update=e=>this._update(t,e),this._startPreloadVideoElement(t)):t instanceof HTMLImageElement&&this._startPreloadImageElement(t)}_startPreloadVideoElement(t){if(!(d(t.src)||"auto"===t.preload&&t.crossOrigin)&&(t.preload="auto",t.crossOrigin="anonymous",t.src=t.src,t.paused&&t.autoplay)){const e=[];_(t,t=>e.push(t)).then(()=>{t.play()}).finally(()=>e.forEach(t=>t.remove()))}}_startPreloadImageElement(t){p(t.src)||d(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}_createDescriptor(t){const e=new D;return e.wrapMode=this._parameters.wrap??10497,e.flipped=!this._parameters.noUnpackFlip,e.samplingMode=this._parameters.mipmap?9987:9729,e.hasMipmap=!!this._parameters.mipmap,e.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,e.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?t.parameters.maxMaxAnisotropy:1),e.dataType=this._parameters.dataType??e.dataType,e.pixelFormat=this._parameters.pixelFormat??e.pixelFormat,e.internalFormat=this._parameters.internalFormat??e.internalFormat,e.isImmutable=!0===this._parameters.immutable&&H(this._parameters.internalFormat),e}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return this._texture?.usedMemory||L(this._data,this._parameters)}load(t){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;const e=this._data;return null==e?(this._texture=new w(t,this._createDescriptor(t),null),this._texture):(this._emptyTexture=t.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof e?this._loadFromURL(t,e):e instanceof Image?this._loadFromImageElement(t,e):e instanceof HTMLVideoElement?this._loadFromVideoElement(t,e):e instanceof ImageData||e instanceof HTMLCanvasElement?this._loadFromImage(t,e):n(e)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(t,e):m(e)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(t,new Uint8Array(e)):(m(e)||n(e))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(t,e):(m(e)||n(e))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(t,e):m(e)?this._loadFromPixelData(t,new Uint8Array(e)):l(e)?this._loadFromPixelData(t,e):null)}_update(t,e){return null==this._texture||t.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||e===t.currentTime?e:(this._texture.setData(t),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),t.currentTime)}_loadFromDDSData(t,e){return this._texture=F(t,this._createDescriptor(t),e),this._emptyTexture=null,this._texture}_loadFromKTX2(t,e){return this._loadAsync(()=>g(t,this._createDescriptor(t),e).then(t=>(this._texture=t,t)))}_loadFromBasis(t,e){return this._loadAsync(()=>x(t,this._createDescriptor(t),e).then(t=>(this._texture=t,t)))}_loadFromPixelData(t,e){T(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(t);return 6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new w(t,r,e),this._texture}_loadFromURL(t,e){return this._loadAsync(async r=>{const a=await u(e,{signal:r});return i(r),this._loadFromImage(t,a)})}_loadFromImageElement(t,e){return e.complete?this._loadFromImage(t,e):this._loadAsync(async r=>{const a=await c(e,e.src,!1,r);return i(r),this._loadFromImage(t,a)})}_loadFromVideoElement(t,e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(t,e):this._loadFromVideoElementAsync(t,e)}_loadFromVideoElementAsync(e,r){return this._loadAsync(i=>new Promise((n,m)=>{const l=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",d),a(p)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),n(this._loadFromImage(e,r)))},d=e=>{l(),m(e||new t("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",d);const p=s(i,()=>d(o()))}))}_loadFromImage(t,e){let r=e;r instanceof HTMLVideoElement||(r=E(r,t.parameters));const a=P(r);this._parameters.width=a.width,this._parameters.height=a.height;const i=this._createDescriptor(t);return i.width=a.width,i.height=a.height,i.compress=this._parameters.compressionOptions,this._texture=new w(t,i,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const a=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(a,a),r}unload(){if(this._texture=r(this._texture),this._emptyTexture=null,null!=this._loadingController){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function L(t,e){if(null==t)return 0;if(m(t)||n(t))return"image/ktx2"===e.encoding?y(t,!!e.mipmap):"image/x.basis"===e.encoding?f(t,!!e.mipmap):t.byteLength;const{width:r,height:a}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?P(t):e,i=e.pixelFormat??6408,s=j(i);return(e.mipmap?4/3:1)*r*a*s||0}function P(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}const b={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};function H(t){return null!=t&&(A(t)||M(t)||v(t)||U(t))}export{I as ManagedTexture};
2
+ import t from"../../../../core/Error.js";import{EventEmitter as e}from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as i}from"../../../../core/maybe.js";import{throwIfAborted as a,onAbort as s,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as m,isTypedArray as l}from"../../../../core/typedArrayUtil.js";import{generateUID as h}from"../../../../core/uid.js";import{isBlobProtocol as d,isDataProtocol as p}from"../../../../core/urlUtils.js";import{whenVideoPlayable as _}from"../../../../layers/support/videoUtils.js";import{requestImage as u}from"../../../../request/image.js";import{loadImage as c}from"../../../../request/loadImage.js";import{createTextureKTX1 as g,createTextureKTX2 as x,createTextureBasis as y,estimateMemoryKTX2 as f,estimateMemoryBasis as F}from"./BasisUtil.js";import{createDDSTexture as T}from"./DDSUtil.js";import{ensureImageMaxSize as E}from"./textureUtils.js";import{assert as w}from"./Util.js";import D from"../../../webgl/Texture.js";import{TextureDescriptor as A}from"../../../webgl/TextureDescriptor.js";import{isCompressedFormat as M,isSizedPixelFormat as v,isSizedDepthFormat as U,isSizedDepthStencilFormat as j}from"../../../webgl/textureUtils.js";import{getFormatComponents as I}from"../../../webgl/Util.js";class L{constructor(t,r){this._data=t,this.id=h(),this.events=new e,this._parameters={...H,...r},this._startPreload(t)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(t){t instanceof HTMLVideoElement?(this.update=e=>this._update(t,e),this._startPreloadVideoElement(t)):t instanceof HTMLImageElement&&this._startPreloadImageElement(t)}_startPreloadVideoElement(t){if(!(d(t.src)||"auto"===t.preload&&t.crossOrigin)&&(t.preload="auto",t.crossOrigin="anonymous",t.src=t.src,t.paused&&t.autoplay)){const e=[];_(t,t=>e.push(t)).then(()=>{t.play()}).finally(()=>e.forEach(t=>t.remove()))}}_startPreloadImageElement(t){p(t.src)||d(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}_createDescriptor(t){const e=new A;return e.wrapMode=this._parameters.wrap??10497,e.flipped=!this._parameters.noUnpackFlip,e.samplingMode=this._parameters.mipmap?9987:9729,e.hasMipmap=!!this._parameters.mipmap,e.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,e.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?t.parameters.maxMaxAnisotropy:1),e.dataType=this._parameters.dataType??e.dataType,e.pixelFormat=this._parameters.pixelFormat??e.pixelFormat,e.internalFormat=this._parameters.internalFormat??e.internalFormat,e.isImmutable=!0===this._parameters.immutable&&C(this._parameters.internalFormat),e}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return this._texture?.usedMemory||P(this._data,this._parameters)}load(t){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;const e=this._data;return null==e?(this._texture=new D(t,this._createDescriptor(t),null),this._texture):(this._emptyTexture=t.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof e?this._loadFromURL(t,e):e instanceof Image?this._loadFromImageElement(t,e):e instanceof HTMLVideoElement?this._loadFromVideoElement(t,e):e instanceof ImageData||e instanceof HTMLCanvasElement?this._loadFromImage(t,e):n(e)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(t,e):m(e)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(t,new Uint8Array(e)):n(e)&&"image/ktx"===this._parameters.encoding?this._loadFromKTX1(t,e):m(e)&&"image/ktx"===this._parameters.encoding?this._loadFromKTX1(t,new Uint8Array(e)):(m(e)||n(e))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(t,e):(m(e)||n(e))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(t,e):m(e)?this._loadFromPixelData(t,new Uint8Array(e)):l(e)?this._loadFromPixelData(t,e):null)}_update(t,e){return null==this._texture||t.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||e===t.currentTime?e:(this._texture.setData(t),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),t.currentTime)}_loadFromDDSData(t,e){return this._texture=T(t,this._createDescriptor(t),e),this._emptyTexture=null,this._texture}_loadFromKTX1(t,e){return this._texture=g(t,this._createDescriptor(t),e),this._emptyTexture=null,this._texture}_loadFromKTX2(t,e){return this._loadAsync(()=>x(t,this._createDescriptor(t),e).then(t=>(this._texture=t,t)))}_loadFromBasis(t,e){return this._loadAsync(()=>y(t,this._createDescriptor(t),e).then(t=>(this._texture=t,t)))}_loadFromPixelData(t,e){w(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(t);return 6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new D(t,r,e),this._texture}_loadFromURL(t,e){return this._loadAsync(async r=>{const i=await u(e,{signal:r});return a(r),this._loadFromImage(t,i)})}_loadFromImageElement(t,e){return e.complete?this._loadFromImage(t,e):this._loadAsync(async r=>{const i=await c(e,e.src,!1,r);return a(r),this._loadFromImage(t,i)})}_loadFromVideoElement(t,e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(t,e):this._loadFromVideoElementAsync(t,e)}_loadFromVideoElementAsync(e,r){return this._loadAsync(a=>new Promise((n,m)=>{const l=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",d),i(p)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),n(this._loadFromImage(e,r)))},d=e=>{l(),m(e||new t("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",d);const p=s(a,()=>d(o()))}))}_loadFromImage(t,e){let r=e;r instanceof HTMLVideoElement||(r=E(r,t.parameters));const i=b(r);this._parameters.width=i.width,this._parameters.height=i.height;const a=this._createDescriptor(t);return a.width=i.width,a.height=i.height,a.compress=this._parameters.compressionOptions,this._texture=new D(t,a,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const i=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(i,i),r}unload(){if(this._texture=r(this._texture),this._emptyTexture=null,null!=this._loadingController){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function P(t,e){if(null==t)return 0;if(m(t)||n(t))return"image/ktx2"===e.encoding?f(t,!!e.mipmap):"image/x.basis"===e.encoding?F(t,!!e.mipmap):t.byteLength;const{width:r,height:i}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?b(t):e,a=e.pixelFormat??6408,s=I(a);return(e.mipmap?4/3:1)*r*i*s||0}function b(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}const H={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};function C(t){return null!=t&&(M(t)||v(t)||U(t)||j(t))}export{L as ManagedTexture};