@arcgis/core 5.1.0-next.50 → 5.1.0-next.52

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 (262) hide show
  1. package/applications/Components/imageryUtils.d.ts +6 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/001492854799c35b53bb.js +1 -0
  4. package/assets/esri/core/workers/chunks/004f991251f09b36fb09.js +1 -0
  5. package/assets/esri/core/workers/chunks/027d733a99f50cadcf22.js +1 -0
  6. package/assets/esri/core/workers/chunks/03d85a706669aaf24d49.js +1 -0
  7. package/assets/esri/core/workers/chunks/0450133e81bce4b48b84.js +1 -0
  8. package/assets/esri/core/workers/chunks/07e791530677f7e70f32.js +30 -0
  9. package/assets/esri/core/workers/chunks/085778ecd39f46324a6b.js +1 -0
  10. package/assets/esri/core/workers/chunks/08dce0019b52042b01fa.js +1 -0
  11. package/assets/esri/core/workers/chunks/0d8294982853308225da.js +1 -0
  12. package/assets/esri/core/workers/chunks/156aecac067213642aae.js +1 -0
  13. package/assets/esri/core/workers/chunks/{942e4d69b140bc2f97c9.js → 15a45e26964c2eb381a6.js} +1 -1
  14. package/assets/esri/core/workers/chunks/184e9147f7a2f0ae5915.js +1 -0
  15. package/assets/esri/core/workers/chunks/19f59a2a97c33ff92650.js +1 -0
  16. package/assets/esri/core/workers/chunks/{54420b66fd53d6e19ba5.js → 278eecd729bed2832702.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{74814678942a47fd48fb.js → 28ac3a75130fe2b57ac7.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{a3174b23aabcef2fa98c.js → 29c91b5c9ddcea85f39a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/2b7d020367cb4ebb3c3d.js +1 -0
  20. package/assets/esri/core/workers/chunks/30654845ca1334f1c206.js +1 -0
  21. package/assets/esri/core/workers/chunks/3104b10770903c265626.js +1 -0
  22. package/assets/esri/core/workers/chunks/33f00633131581e06328.js +1 -0
  23. package/assets/esri/core/workers/chunks/{32a51ce8e1a362115c89.js → 354b309c8225336bc1e5.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{569e4479707bc6881d97.js → 35dbe1eeb6932b03aea2.js} +1 -1
  25. package/assets/esri/core/workers/chunks/386435341e949f5573b4.js +2 -0
  26. package/assets/esri/core/workers/chunks/3874362bf7d43adc41bb.js +1 -0
  27. package/assets/esri/core/workers/chunks/38dc1c4b8721efd4a165.js +1 -0
  28. package/assets/esri/core/workers/chunks/39f3bea123f20c816ab2.js +1 -0
  29. package/assets/esri/core/workers/chunks/3fa5f102b6f77c523a76.js +1 -0
  30. package/assets/esri/core/workers/chunks/{a422cfe1e2afe0722acd.js → 3fcc8c455af56ae89030.js} +1 -1
  31. package/assets/esri/core/workers/chunks/42f3fdad1728433b3510.js +1 -0
  32. package/assets/esri/core/workers/chunks/436941ec88439667022e.js +1 -0
  33. package/assets/esri/core/workers/chunks/{25946077568ab14c7bfc.js → 440f76c397a813b0dcf9.js} +1 -1
  34. package/assets/esri/core/workers/chunks/4812482f28f7205b0938.js +1 -0
  35. package/assets/esri/core/workers/chunks/5317cbef0aac29761575.js +1 -0
  36. package/assets/esri/core/workers/chunks/54a9e17d6c0fef6a9146.js +1 -0
  37. package/assets/esri/core/workers/chunks/55985c9c48b8e1d1c634.js +1 -0
  38. package/assets/esri/core/workers/chunks/55edd712c6d2d044e550.js +1 -0
  39. package/assets/esri/core/workers/chunks/5a573fa1012092328b88.js +1 -0
  40. package/assets/esri/core/workers/chunks/5f06a57b4f7d7de16bbf.js +1 -0
  41. package/assets/esri/core/workers/chunks/60ad54e5707d4414d8b9.js +1 -0
  42. package/assets/esri/core/workers/chunks/{55070344f08ef0ed2a30.js → 60cee9a44929decd2474.js} +1 -1
  43. package/assets/esri/core/workers/chunks/63b9e4a7dad358605c38.js +1 -0
  44. package/assets/esri/core/workers/chunks/{d0adf059085ddf7151dd.js → 64845b1f53eca9db1229.js} +1 -1
  45. package/assets/esri/core/workers/chunks/66d4cbb35d0c290150bf.js +1 -0
  46. package/assets/esri/core/workers/chunks/677d3674cb2c0c05fb7e.js +1 -0
  47. package/assets/esri/core/workers/chunks/7100c9038739121c2c4b.js +1 -0
  48. package/assets/esri/core/workers/chunks/{6c49ac7888679b9f7823.js → 720a33a7f118d2769133.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{9f7b5749f3ceca8d5978.js → 7480bd6f892abf444cac.js} +31 -31
  50. package/assets/esri/core/workers/chunks/{3a7c02616d942c81257d.js → 792219a079c28bcdc003.js} +1 -1
  51. package/assets/esri/core/workers/chunks/794f604d4267e374f7dd.js +1 -0
  52. package/assets/esri/core/workers/chunks/7ae8f73c8e2afae98ecb.js +1 -0
  53. package/assets/esri/core/workers/chunks/7d4af7e2cb2f234e12eb.js +1 -0
  54. package/assets/esri/core/workers/chunks/807b12ace0099300b9b9.js +1 -0
  55. package/assets/esri/core/workers/chunks/{b98dd9fc9a7e3ff6bd49.js → 816a4b03f2ea49238a6c.js} +1 -1
  56. package/assets/esri/core/workers/chunks/842b442cc012d0797333.js +1 -0
  57. package/assets/esri/core/workers/chunks/8903ff28896bd6f34b0d.js +1 -0
  58. package/assets/esri/core/workers/chunks/89e9bc8789b100316136.js +1 -0
  59. package/assets/esri/core/workers/chunks/8afe32d3db9669f972bc.js +1 -0
  60. package/assets/esri/core/workers/chunks/91fd28f50477d16e294e.js +1 -0
  61. package/assets/esri/core/workers/chunks/{278409028bc5af45b507.js → 93ceb74ac88ef460fe5f.js} +1 -1
  62. package/assets/esri/core/workers/chunks/98011b93acf3d5f0b5a2.js +1 -0
  63. package/assets/esri/core/workers/chunks/{cd491c37ba1ac381178c.js → 987dc23fdc0a8c7150b9.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{25509953f19fbc4949a1.js → 992e74570b76f3f9e52e.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{b1c5f69bd1400e66c635.js → 9ae90a4b281d4103e8bb.js} +1 -1
  66. package/assets/esri/core/workers/chunks/9c7fd5db0813bdc38582.js +1 -0
  67. package/assets/esri/core/workers/chunks/9f272445c285ee9abb7b.js +1 -0
  68. package/assets/esri/core/workers/chunks/a2fee1611319665e6aed.js +1 -0
  69. package/assets/esri/core/workers/chunks/a644e30f65347ce846ed.js +1 -0
  70. package/assets/esri/core/workers/chunks/a64daa4945923a178fe5.js +1 -0
  71. package/assets/esri/core/workers/chunks/a85575a8d1da09280cd7.js +1 -0
  72. package/assets/esri/core/workers/chunks/ac4f7309a249132c22da.js +1 -0
  73. package/assets/esri/core/workers/chunks/aeb1900cfdd0e51cc5f8.js +1 -0
  74. package/assets/esri/core/workers/chunks/ba62f3aa811430787863.js +1 -0
  75. package/assets/esri/core/workers/chunks/{7b48c102a44606291f82.js → bb659dcd297b895830df.js} +1 -1
  76. package/assets/esri/core/workers/chunks/c03d0091a6f385b9ce8d.js +1 -0
  77. package/assets/esri/core/workers/chunks/c48d1ee37c207bfb0aac.js +1 -0
  78. package/assets/esri/core/workers/chunks/c4a9006cc6d2938570e0.js +1 -0
  79. package/assets/esri/core/workers/chunks/c692ea68509bddbf7b42.js +1 -0
  80. package/assets/esri/core/workers/chunks/{a4a4ce33de6432ba4dc3.js → c6a0e770c1a89d3b5913.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{b49b608c0d58a9b55fa2.js → cc1f3a2f281a2f6e0f94.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{73e384fd93cf22503d84.js → cdf6ad970dc1893dac58.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{b45fdc04d399d2849d63.js → daf65bccc45dc5c400ae.js} +1 -1
  84. package/assets/esri/core/workers/chunks/df3e79b56c37156e7895.js +1 -0
  85. package/assets/esri/core/workers/chunks/df8b80b17e371c9be4e6.js +1 -0
  86. package/assets/esri/core/workers/chunks/e77198f8ab47441423c5.js +1 -0
  87. package/assets/esri/core/workers/chunks/e786da40a1c87bed64ca.js +1 -0
  88. package/assets/esri/core/workers/chunks/e8aafef6342c50340a27.js +1 -0
  89. package/assets/esri/core/workers/chunks/ec00348d74e29f48613a.js +1 -0
  90. package/assets/esri/core/workers/chunks/{284ce99af7bdd73dc7e9.js → ec65c9c72507ef9a9cf9.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{cdec811b66d98e76be9e.js → eedeff8b344ff699b0b9.js} +1 -1
  92. package/assets/esri/core/workers/chunks/f4201e7dcae224d0caf0.js +1 -0
  93. package/assets/esri/core/workers/chunks/f4d31d96681b649ddc95.js +1 -0
  94. package/assets/esri/core/workers/chunks/{08d76c600926d7642a8b.js → f5fd59291cb161fdc05b.js} +1 -1
  95. package/assets/esri/core/workers/chunks/f7cc05fbfc97b4d36eba.js +1 -0
  96. package/assets/esri/core/workers/chunks/{6aba8c3bce5f68568e3a.js → f7fb121169b7e5a5adbc.js} +1 -1
  97. package/assets/esri/core/workers/chunks/f9d369a4683f88ee9d76.js +1 -0
  98. package/assets/esri/core/workers/chunks/fc534c94d55331578195.js +1 -0
  99. package/assets/esri/core/workers/chunks/{3e61e7805dc6ff284831.js → fdf8fe0f50a9ae548c16.js} +1 -1
  100. package/chunks/Fog.glsl.js +1 -1
  101. package/chunks/GlowBlur.glsl.js +2 -2
  102. package/chunks/GlowComposition.glsl.js +6 -6
  103. package/chunks/HUDMaterial.glsl.js +1 -1
  104. package/chunks/OITBlend.glsl.js +9 -9
  105. package/config.js +1 -1
  106. package/core/timeUtils.d.ts +68 -0
  107. package/geometry/support/aaBoundingBox.js +1 -1
  108. package/geometry/support/sphere.js +1 -1
  109. package/kernel.js +1 -1
  110. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  111. package/layers/raster/datasets/pixelReader.js +1 -1
  112. package/layers/support/Sublayer.d.ts +15 -0
  113. package/layers/support/Sublayer.js +1 -1
  114. package/package.json +3 -3
  115. package/support/revision.js +1 -1
  116. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  117. package/symbols/cim/utils.js +1 -1
  118. package/views/2d/engine/Stage.js +1 -1
  119. package/views/2d/engine/brushes.js +1 -1
  120. package/views/2d/engine/webgl/TileContainer.js +1 -1
  121. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  122. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +2 -0
  123. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js +2 -0
  124. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +2 -0
  125. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTexture.js +2 -0
  126. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +2 -0
  127. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
  128. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
  129. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  132. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  133. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  134. package/views/2d/layers/MediaLayerView2D.js +1 -1
  135. package/views/2d/layers/TileLayerView2D.js +1 -1
  136. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  137. package/views/3d/layers/support/Tiles3DBVH.js +2 -0
  138. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  139. package/views/3d/support/ElevationRange.js +1 -1
  140. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  141. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
  142. package/views/3d/support/orientedBoundingBox.js +1 -1
  143. package/views/3d/terrain/TerrainRenderer.js +1 -1
  144. package/views/3d/terrain/TileCompositor.js +1 -1
  145. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  146. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialGlobalParameters.js +1 -1
  147. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  148. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  149. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
  150. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +5 -5
  151. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  152. package/views/3d/webgl-engine/effects/fboFormatUtils.js +2 -0
  153. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  154. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +1 -1
  155. package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +1 -1
  156. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +1 -1
  157. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  158. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
  159. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  160. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  161. package/views/3d/webgl-engine/effects/transparency/OITBlendTechniqueConfiguration.js +1 -1
  162. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  163. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  164. package/views/3d/webgl-engine/lib/Material.js +1 -1
  165. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  166. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  167. package/views/3d/webgl-engine/shaders/Dithering.glsl.js +1 -1
  168. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +3 -3
  169. package/views/3d/webgl-engine/shaders/oitResolution.glsl.js +1 -1
  170. package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
  171. package/views/3d/webgl.js +1 -1
  172. package/views/SceneView.js +1 -1
  173. package/views/SelectionManager.js +1 -1
  174. package/views/VideoView.js +1 -1
  175. package/views/selection/types.d.ts +92 -1
  176. package/views/support/selectionUtils.js +1 -1
  177. package/views/support/waitForResources.js +1 -1
  178. package/views/webgl/FramebufferObject.js +1 -1
  179. package/views/webgl/InstanceCounter.js +1 -1
  180. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  181. package/widgets/Editor/EditorViewModel.js +1 -1
  182. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  183. package/widgets/Editor/UpdateFeaturesWorkflowData.d.ts +2 -2
  184. package/widgets/Editor/workflowUtils.js +1 -1
  185. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  186. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  187. package/widgets/LayerList/ListItemPanel.js +1 -1
  188. package/widgets/Legend/LegendViewModel.js +1 -1
  189. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  190. package/widgets/Sketch/SketchViewModel.js +1 -1
  191. package/widgets/support/SelectionList/FeatureItem.js +1 -1
  192. package/widgets/support/SelectionList/LayerItem.js +1 -1
  193. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  194. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  195. package/assets/esri/core/workers/chunks/04b04548d4eb0941a01e.js +0 -1
  196. package/assets/esri/core/workers/chunks/06223d5d8281e5af14c5.js +0 -1
  197. package/assets/esri/core/workers/chunks/07bdcb622ea59fdbb3a6.js +0 -1
  198. package/assets/esri/core/workers/chunks/0d59f5cd3fdd7d6fd693.js +0 -1
  199. package/assets/esri/core/workers/chunks/0eb57ef4a1b387c951d6.js +0 -1
  200. package/assets/esri/core/workers/chunks/136859ef29a3269c4128.js +0 -1
  201. package/assets/esri/core/workers/chunks/1e018de43becf66cceaa.js +0 -1
  202. package/assets/esri/core/workers/chunks/236b4ab3da0bc8f788a2.js +0 -1
  203. package/assets/esri/core/workers/chunks/2379c64b0ca30814a815.js +0 -1
  204. package/assets/esri/core/workers/chunks/35d115bde474c380c791.js +0 -1
  205. package/assets/esri/core/workers/chunks/3f6ebd82551c2000912e.js +0 -1
  206. package/assets/esri/core/workers/chunks/4577df99c92c7ec0f9de.js +0 -1
  207. package/assets/esri/core/workers/chunks/4869e2f35aaf6b058281.js +0 -1
  208. package/assets/esri/core/workers/chunks/4b3545965b11a54184d4.js +0 -2
  209. package/assets/esri/core/workers/chunks/4c6fc6d19fe519ce7bfc.js +0 -1
  210. package/assets/esri/core/workers/chunks/58f47dea6d8665611eff.js +0 -1
  211. package/assets/esri/core/workers/chunks/5b2fe488a461bc433f59.js +0 -1
  212. package/assets/esri/core/workers/chunks/5c0b3c76a7bc971c61dc.js +0 -1
  213. package/assets/esri/core/workers/chunks/5df9d2a255c9d63ae7df.js +0 -1
  214. package/assets/esri/core/workers/chunks/5f53d7d6bc9b67b2f357.js +0 -1
  215. package/assets/esri/core/workers/chunks/5ffe664eda334ad73175.js +0 -1
  216. package/assets/esri/core/workers/chunks/64fd3561bc94570ee954.js +0 -1
  217. package/assets/esri/core/workers/chunks/650614a9e4871714c42e.js +0 -1
  218. package/assets/esri/core/workers/chunks/66e35e38aea978f91a0c.js +0 -1
  219. package/assets/esri/core/workers/chunks/696f645349249f26090c.js +0 -1
  220. package/assets/esri/core/workers/chunks/6d5bb00157e20ad90fc0.js +0 -1
  221. package/assets/esri/core/workers/chunks/70f0d66e5e6d5d2163f3.js +0 -1
  222. package/assets/esri/core/workers/chunks/768bbc910be6c65ac107.js +0 -1
  223. package/assets/esri/core/workers/chunks/76effcc35b3962cd5535.js +0 -1
  224. package/assets/esri/core/workers/chunks/777390e820b3824dc265.js +0 -1
  225. package/assets/esri/core/workers/chunks/7948d6f14ae44d346d88.js +0 -1
  226. package/assets/esri/core/workers/chunks/797bf402489b3677a5f7.js +0 -1
  227. package/assets/esri/core/workers/chunks/7a4cc1133e4410271b00.js +0 -1
  228. package/assets/esri/core/workers/chunks/7dba4b04c148f03fdf21.js +0 -1
  229. package/assets/esri/core/workers/chunks/87c9a1fc9f2a392b78f5.js +0 -1
  230. package/assets/esri/core/workers/chunks/88426877d625ea333143.js +0 -1
  231. package/assets/esri/core/workers/chunks/8967a02f394a63f11030.js +0 -1
  232. package/assets/esri/core/workers/chunks/8c210529a28addb94ea0.js +0 -1
  233. package/assets/esri/core/workers/chunks/8d3c508995253cbe083f.js +0 -1
  234. package/assets/esri/core/workers/chunks/8e18ac7b22d8dca1e1e2.js +0 -1
  235. package/assets/esri/core/workers/chunks/8e3cb1c584951c3d1eb7.js +0 -1
  236. package/assets/esri/core/workers/chunks/908f171b9c512d738dea.js +0 -1
  237. package/assets/esri/core/workers/chunks/922484b43803ab4e4319.js +0 -1
  238. package/assets/esri/core/workers/chunks/947a715b608c8affd812.js +0 -1
  239. package/assets/esri/core/workers/chunks/9bd68abc6b5b07b2add3.js +0 -1
  240. package/assets/esri/core/workers/chunks/9e55f97291062985560b.js +0 -1
  241. package/assets/esri/core/workers/chunks/a90883ff02c0cc6450c2.js +0 -1
  242. package/assets/esri/core/workers/chunks/ac9722a7897c994f11ab.js +0 -1
  243. package/assets/esri/core/workers/chunks/b1ac09d8fa340d194aa2.js +0 -1
  244. package/assets/esri/core/workers/chunks/c04c457f5295febb3c39.js +0 -1
  245. package/assets/esri/core/workers/chunks/cb2fbe585c0827eecf70.js +0 -1
  246. package/assets/esri/core/workers/chunks/cf74d1605ad2f21699e7.js +0 -1
  247. package/assets/esri/core/workers/chunks/d50e6681ecb9612e4528.js +0 -1
  248. package/assets/esri/core/workers/chunks/d6eddb94f5f2e9759bd0.js +0 -1
  249. package/assets/esri/core/workers/chunks/dcc3285e4ab2c38709bd.js +0 -1
  250. package/assets/esri/core/workers/chunks/e25bbd7cc553b1d2e208.js +0 -1
  251. package/assets/esri/core/workers/chunks/e72ca52d930afb5650af.js +0 -30
  252. package/assets/esri/core/workers/chunks/e96529e144c3268a04f7.js +0 -1
  253. package/assets/esri/core/workers/chunks/f379f94adbe79dc305a2.js +0 -1
  254. package/assets/esri/core/workers/chunks/f4e5163efa2a0567ee19.js +0 -1
  255. package/assets/esri/core/workers/chunks/f76833254f842fb0cd9a.js +0 -1
  256. package/assets/esri/core/workers/chunks/f9abae8d07002fe04a08.js +0 -1
  257. package/assets/esri/core/workers/chunks/ff6c4f8420140b9f9577.js +0 -1
  258. package/assets/esri/core/workers/chunks/ff75fb0fce51ac12e656.js +0 -1
  259. package/assets/esri/core/workers/chunks/ffe9fa5111c149ddef49.js +0 -1
  260. package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +0 -2
  261. package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +0 -2
  262. /package/assets/esri/core/workers/chunks/{4b3545965b11a54184d4.js.LICENSE.txt → 386435341e949f5573b4.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s,waitTick as r}from"../../../core/promiseUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{equals as h}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as a}from"../../../support/GraphicsCollection.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import"../../../core/scheduling.js";import"../../../Color.js";import"../../../core/mathUtils.js";import"../../../config.js";import"../../../symbols/cim/defaultCIMValues.js";import"../../../core/floatRGBA.js";import"../../../geometry/Extent.js";import"../../../symbols/Font.js";import"../../../symbols/cim/effects/EffectAddControlPoints.js";import"../../../symbols/cim/effects/EffectArrow.js";import"../../../symbols/cim/effects/EffectBuffer.js";import"../../../symbols/cim/effects/EffectControlMeasureLine.js";import"../../../symbols/cim/effects/EffectCut.js";import"../../../symbols/cim/effects/EffectDashes.js";import"../../../symbols/cim/effects/EffectDonut.js";import"../../../symbols/cim/effects/EffectEnclosingPolygon.js";import"../../../symbols/cim/effects/EffectJog.js";import"../../../symbols/cim/effects/EffectMove.js";import"../../../symbols/cim/effects/EffectOffset.js";import"../../../symbols/cim/effects/EffectRadial.js";import"../../../symbols/cim/effects/EffectReverse.js";import"../../../symbols/cim/effects/EffectRotate.js";import"../../../symbols/cim/effects/EffectScale.js";import"../../../symbols/cim/effects/EffectSuppress.js";import"../../../symbols/cim/effects/EffectTaperedPolygon.js";import"../../../symbols/cim/effects/EffectWave.js";import"../../../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../../../symbols/cim/placements/PlacementAtExtremities.js";import"../../../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../../../symbols/cim/placements/PlacementAtRatioPositions.js";import"../../../symbols/cim/placements/PlacementInsidePolygon.js";import"../../../symbols/cim/placements/PlacementOnLine.js";import"../../../symbols/cim/placements/PlacementOnVertices.js";import"../../../symbols/cim/placements/PlacementPolygonCenter.js";import"../../../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../../../symbols/cim/constants.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../../../geometry/Polygon.js";import"../../../symbols/support/defaults.js";import"../../../symbols/cim/OverrideHelper.js";import"../../../layers/effects/EffectView.js";import"../../../core/Accessor.js";import"../engine/transitions/FadeTransition.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../engine/webgl/shaders/BackgroundPrograms.js";import"../../webgl/enums.js";import"../../webgl/Program.js";import"../../webgl/Util.js";import"../../webgl/VertexAttributeLayouts.js";import"../../webgl/BufferObject.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/MappedMesh.js";import"../engine/webgl/number.js";import"../engine/webgl/shaders/TileInfoPrograms.js";import"../../webgl/Texture.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/pbf.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../../webgl/FramebufferObject.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"../engine/webgl/meshing/SimpleMesh.js";import"../../webgl/Renderbuffer.js";import"../engine/webgl/PooledUint32Array.js";import"../engine/webgl/Profiler.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../engine/webgl/shaderGraph/techniques/animated/attributes.js";import"../engine/webgl/mesh/templates/templateUtils.js";import"../engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/aaBoundingBox.js";import"../engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../../../core/sql/UnknownTimeZone.js";import"luxon";import"../../../intl/locale.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polyline.js";import"../../../layers/support/fieldUtils.js";import"../../../time/constants.js";import"../engine/webgl/animations/instructions.js";import"../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"../../webgl/checkWebGLError.js";import"../../webgl/renderState.js";import"../../webgl/testSVGPremultipliedAlpha.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import n from"./graphics/GraphicsView2D.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/support/UpdatingHandles.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{BitmapTileLayerView2D as p}from"./BitmapTileLayerView2D.js";import{LayerView2D as m}from"./LayerView2D.js";import c from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as g,resampleImage as f}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import d from"../tiling/TileKey.js";import j from"../tiling/TileQueue.js";import y from"../tiling/TileStrategy.js";import w from"../../layers/LayerView.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as _}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as G,MapServiceLayerViewHelper as T}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as q}from"../../support/drapedUtils.js";import{getHighlightName as V}from"../../support/highlightOptionsUtils.js";import{TaskPriority as S}from"../../support/Scheduler.js";const E=[0,0];let P=class extends(b(p(m(w)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new a,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}get tilemapCache(){return"tilemapCache"in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null,i=this.tilemapCache;if(this._tileInfoView=new u(this.layer.tileInfo,this.layer.fullExtent,i?.effectiveMinLOD,i?.effectiveMaxLOD),this._fetchQueue=new j({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i),scheduler:this.scheduler,priority:S.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new y({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),G(this,this.layer)){const e=this._highlightView=new n({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new c(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new T({createFetchPopupFeaturesQueryGeometry:(e,i)=>q(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:i,property:t})=>e.graphicUpdateHandler({graphic:i,property:t}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtLocation(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtLocation(e,i):[]}highlight(e,t){const s=_(e);if(0===s.length)return i();const r=V(t);return this._addHighlightGraphics(s,r),i(()=>!this.destroyed&&this._removeHighlightGraphics(s,r))}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_addHighlightGraphics(e,i){this._highlightGraphics.addMany(e),this._addHighlights(e.map(e=>e.uid),i)}_removeHighlightGraphics(e,i){this._highlightGraphics.removeMany(e),this._removeHighlights(e.map(e=>e.uid),i)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return h(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(E,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(i)),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,i={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,i):this._fetchTileWithoutTilemapCache(e,i)}async _fetchTileWithoutTilemapCache(e,i={}){const{signal:t,resamplingLevel:r=0}=i;try{return await this._fetchImage(e,t)}catch(o){if(s(o))throw o;if(!this.resampling)return g(this._tileInfoView.size);if(r<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const s=new d(t),o=await this._fetchTileWithoutTilemapCache(s,{...i,resamplingLevel:r+1});return f(this._tileInfoView,o,s,e)}}return g(this._tileInfoView.size)}}async _fetchTileWithTilemapCache(e,i={}){const t=this.tilemapCache,{signal:o,resamplingLevel:l=0}=i,h=new d(0,0,0,0);let a,n=null;try{if(n=await t.fetchAvailabilityUpsample(e.level,e.row,e.col,h,{signal:o}),!this.resampling&&h.level!==e.level)return await r(i),g(this._tileInfoView.size);a=await this._fetchImage(h,o)}catch(p){if(s(p))throw p;if(this.resampling&&"unknown"===n&&l<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){h.set(t);try{a=await this._fetchTileWithTilemapCache(h,{...i,resamplingLevel:l+1})}catch{}}}}return a?this.resampling?f(this._tileInfoView,a,h,e):a:g(this._tileInfoView.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once("attach",()=>this.requestUpdate()),e.once("isReady",()=>this.requestUpdate())}catch(i){s(i)||t.getLogger(this).error(i)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i})}};e([o()],P.prototype,"resampling",null),e([o()],P.prototype,"tilemapCache",null),P=e([l("esri.views.2d.layers.TileLayerView2D")],P);const U=P;export{U as default};
2
+ import{__decorate as e}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s,waitTick as r}from"../../../core/promiseUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{equals as h}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as a}from"../../../support/GraphicsCollection.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import"../../../core/scheduling.js";import"../../../Color.js";import"../../../core/mathUtils.js";import"../../../config.js";import"../../../symbols/cim/defaultCIMValues.js";import"../../../core/floatRGBA.js";import"../../../geometry/Extent.js";import"../../../symbols/Font.js";import"../../../symbols/cim/effects/EffectAddControlPoints.js";import"../../../symbols/cim/effects/EffectArrow.js";import"../../../symbols/cim/effects/EffectBuffer.js";import"../../../symbols/cim/effects/EffectControlMeasureLine.js";import"../../../symbols/cim/effects/EffectCut.js";import"../../../symbols/cim/effects/EffectDashes.js";import"../../../symbols/cim/effects/EffectDonut.js";import"../../../symbols/cim/effects/EffectEnclosingPolygon.js";import"../../../symbols/cim/effects/EffectJog.js";import"../../../symbols/cim/effects/EffectMove.js";import"../../../symbols/cim/effects/EffectOffset.js";import"../../../symbols/cim/effects/EffectRadial.js";import"../../../symbols/cim/effects/EffectReverse.js";import"../../../symbols/cim/effects/EffectRotate.js";import"../../../symbols/cim/effects/EffectScale.js";import"../../../symbols/cim/effects/EffectSuppress.js";import"../../../symbols/cim/effects/EffectTaperedPolygon.js";import"../../../symbols/cim/effects/EffectWave.js";import"../../../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../../../symbols/cim/placements/PlacementAtExtremities.js";import"../../../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../../../symbols/cim/placements/PlacementAtRatioPositions.js";import"../../../symbols/cim/placements/PlacementInsidePolygon.js";import"../../../symbols/cim/placements/PlacementOnLine.js";import"../../../symbols/cim/placements/PlacementOnVertices.js";import"../../../symbols/cim/placements/PlacementPolygonCenter.js";import"../../../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../../../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../../../symbols/cim/constants.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../../../geometry/Polygon.js";import"../../../symbols/support/defaults.js";import"../../../symbols/cim/OverrideHelper.js";import"../../../layers/effects/EffectView.js";import"../../../core/Accessor.js";import"../engine/transitions/FadeTransition.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../../webgl/enums.js";import"../../webgl/Program.js";import"../../webgl/Util.js";import"../../webgl/VertexAttributeLayouts.js";import"../../webgl/BufferObject.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../webgl/Texture.js";import"../../../core/pbf.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../../webgl/FramebufferObject.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"../engine/webgl/meshing/SimpleMesh.js";import"../../webgl/Renderbuffer.js";import"../engine/webgl/PooledUint32Array.js";import"../engine/webgl/Profiler.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/animated/attributes.js";import"../engine/webgl/mesh/templates/templateUtils.js";import"../engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/aaBoundingBox.js";import"../engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../../../core/sql/UnknownTimeZone.js";import"luxon";import"../../../intl/locale.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polyline.js";import"../../../layers/support/fieldUtils.js";import"../../../time/constants.js";import"../engine/webgl/animations/instructions.js";import"../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"../../webgl/checkWebGLError.js";import"../../webgl/renderState.js";import"../../webgl/testSVGPremultipliedAlpha.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import n from"./graphics/GraphicsView2D.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/MappedMesh.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/support/UpdatingHandles.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{BitmapTileLayerView2D as p}from"./BitmapTileLayerView2D.js";import{LayerView2D as m}from"./LayerView2D.js";import c from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as g,resampleImage as f}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import d from"../tiling/TileKey.js";import j from"../tiling/TileQueue.js";import y from"../tiling/TileStrategy.js";import w from"../../layers/LayerView.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as _}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as G,MapServiceLayerViewHelper as q}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as T}from"../../support/drapedUtils.js";import{getHighlightName as V}from"../../support/highlightOptionsUtils.js";import{TaskPriority as S}from"../../support/Scheduler.js";const E=[0,0];let P=class extends(b(p(m(w)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new a,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}get tilemapCache(){return"tilemapCache"in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null,i=this.tilemapCache;if(this._tileInfoView=new u(this.layer.tileInfo,this.layer.fullExtent,i?.effectiveMinLOD,i?.effectiveMaxLOD),this._fetchQueue=new j({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i),scheduler:this.scheduler,priority:S.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new y({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),G(this,this.layer)){const e=this._highlightView=new n({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new c(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new q({createFetchPopupFeaturesQueryGeometry:(e,i)=>T(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:i,property:t})=>e.graphicUpdateHandler({graphic:i,property:t}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtLocation(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtLocation(e,i):[]}highlight(e,t){const s=_(e);if(0===s.length)return i();const r=V(t);return this._addHighlightGraphics(s,r),i(()=>!this.destroyed&&this._removeHighlightGraphics(s,r))}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_addHighlightGraphics(e,i){this._highlightGraphics.addMany(e),this._addHighlights(e.map(e=>e.uid),i)}_removeHighlightGraphics(e,i){this._highlightGraphics.removeMany(e),this._removeHighlights(e.map(e=>e.uid),i)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return h(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(E,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(i)),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,i={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,i):this._fetchTileWithoutTilemapCache(e,i)}async _fetchTileWithoutTilemapCache(e,i={}){const{signal:t,resamplingLevel:r=0}=i;try{return await this._fetchImage(e,t)}catch(o){if(s(o))throw o;if(!this.resampling)return g(this._tileInfoView.size);if(r<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const s=new d(t),o=await this._fetchTileWithoutTilemapCache(s,{...i,resamplingLevel:r+1});return f(this._tileInfoView,o,s,e)}}return g(this._tileInfoView.size)}}async _fetchTileWithTilemapCache(e,i={}){const t=this.tilemapCache,{signal:o,resamplingLevel:l=0}=i,h=new d(0,0,0,0);let a,n=null;try{if(n=await t.fetchAvailabilityUpsample(e.level,e.row,e.col,h,{signal:o}),!this.resampling&&h.level!==e.level)return await r(i),g(this._tileInfoView.size);a=await this._fetchImage(h,o)}catch(p){if(s(p))throw p;if(this.resampling&&"unknown"===n&&l<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){h.set(t);try{a=await this._fetchTileWithTilemapCache(h,{...i,resamplingLevel:l+1})}catch{}}}}return a?this.resampling?f(this._tileInfoView,a,h,e):a:g(this._tileInfoView.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once("attach",()=>this.requestUpdate()),e.once("isReady",()=>this.requestUpdate())}catch(i){s(i)||t.getLogger(this).error(i)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i})}};e([o()],P.prototype,"resampling",null),e([o()],P.prototype,"tilemapCache",null),P=e([l("esri.views.2d.layers.TileLayerView2D")],P);const U=P;export{U as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as m,fromQuat as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as y,sub as _,dot as v,add as w,length as j,transformMat3 as x,set as C,abs as M,max as E}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as T,fromValues as R,clone as U,ZEROS as V}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S,clone as A,fromValues as H}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as k,getReferenceEllipsoid as P,SphericalECEFSpatialReferenceLike as I}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as F}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as D}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as G}from"../../../geometry/projection/projectVectorToVector.js";import{create as B}from"../../../geometry/support/aaBoundingRect.js";import{getContinuousIndexArray as z}from"../../../geometry/support/Indices.js";import{isCGCS2000 as N}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec2f as q,BufferViewVec4f as W,BufferViewVec4u8 as $,BufferViewVec4u16 as Z,BufferViewVec3f as J,BufferViewVec3u8 as X,BufferViewVec3u16 as Y,BufferViewInt16 as K,BufferViewUint32 as Q,BufferViewUint16 as ee}from"../../../geometry/support/buffer/BufferView.js";import te from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as ie}from"../../../support/elevationInfoUtils.js";import{addNormals as se}from"./IntegratedMeshNormals.js";import{LayerView3D as re}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as oe}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as ne,removeLayerViewFromWasm as ae,getLyr3DWasm as le}from"./Lyr3DWasm.js";import{toWasmModification as ce}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as de}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as he}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as me,alphaModeConversion as ue,faceCullingConversion as pe,wrapModeConversion as fe,lyr3DTypeToByteSize as be}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as ge}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as ye}from"../state/Frustum.js";import{ElevationRange as _e}from"../support/ElevationRange.js";import{toBoundingRect as ve}from"../support/extentUtils.js";import{Obb as we,compute as je}from"../support/orientedBoundingBox.js";import{glLayout as xe}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as Ce,createVertexBufferLayout as Me,ComponentGeometryParameters as Ee,SourceGeometry as Oe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Te}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Re}from"../webgl-engine/core/material/RenderTexture.js";import{Vertices as Ue,Attribute as Ve}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Se}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as Ae}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as He}from"../webgl-engine/materials/pbrUtils.js";import{writeAttribute as Le,writeBufferVec2 as ke}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Pe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ie,isInEffectiveScaleRange as Fe,validateScaleRange as De}from"../../support/layerViewUtils.js";import{TaskPriority as Ge}from"../../support/Scheduler.js";import{TextureCompressionTracker as Be}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as ze}from"../../../webscene/support/AlphaCutoff.js";var Ne;let qe=class extends(re(Pe)){static{Ne=he}constructor(e){super(e),this[Ne]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,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 Be,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._frustum=new ye(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(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._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ie("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=ne(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ge(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(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new de({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([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),ae(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),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=i(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 hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ce(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=B();this._layerClippingArea=ve(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{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,ie(e))}get _wasm(){return le(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Fe(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||De(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new oe(this.usedMemory,r,o,Ze(t),Ze(e),Ze(s),Ze(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return ie(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new _e(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new _e;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,s=i.isWGS84||i.isWebMercator||N(i)||L(i)||k(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=P(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=y(O(),n),c=500,d=Math.max(o[2],c),h=d+r,m=Math.sqrt(h**2-r**2),u=Math.abs(Math.atan2(m,r))*r,p=d>.5*r?.5*Math.PI*r:u,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-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)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){return this._frameTask.schedule(()=>this._createRenderable(e))}async _createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:t}=e;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=T(...t.desc.origin),s=this.view.basemapTerrain.spatialReference;let r=f;if(this.view.state.isGlobal){const e=b();F(I,i,e,s),r=h(p(),e)}const o=O(),n=Ye(t.desc.obb);let a=0;const l={textureMemoryUsage:0},c=new Array,d=new Map,u=t.desc.prims.length,g=new Array,y=new _e;try{const e=this.view.state.isGlobal,h=e?P(this.view.spatialReference).radius:0,b=O();for(let g=0;g<u;g++){const u=t.desc.prims[g];this._dbg(2,JSON.stringify(u));if(null==me[u.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+u.ptype+"). Skipping primitive.");continue}const _=t.desc?.materials&&null!=u.materialId?t.desc.materials[u.materialId]:null,v=null!=_?_.lightingModel:"Unlit",{positionView:M,positionAttr:E,normalsView:T,normalsAttr:V,colorAttr:L,texCoord0Attr:k,indicesView:P}=this.getBufferViews(u,t.data.buffer,r);if(null==E||null==M||null==P)continue;const I=M.count,F=(e,t)=>!e||e.data.length/e.size===I||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!F(k,"numTexcoord")||!F(L,"numColors")||!F(V,"normals"))continue;const B=new Ce(null!=L,null!=T,k?1:0),z=Me(B);for(let t=0;t<M.count;t++){M.getVec(t,o),w(o,o,i);const s=e?j(o)-h:o[2];y.expandElevationRangeValues(s,s)}if(n){et(n,b,new Ue(E.data,3),i)}const N=n?.clone()??Xe(E,i);if(r!==f)for(let e=0;e<M.count;e++)M.getVec(e,o),x(o,o,r),M.setVec(e,o);const W=z.createBuffer(I);if(Le("position",E,null,null,W,0),null!=k){const e=W.getField("uv0",q);ke(k,e,0)}null!=L&&Le("color",L,null,null,W,0),null!=V&&Le("normalCompressed",V,null,null,W,0);const $=new Uint32Array([0,P.typedBuffer.length]),Z=xe(z),J=this._imVertexNormals,X=r===f?f:m(p(),r)??f,Y=se(new Uint8Array(W.buffer),P.typedBuffer,Z,J,J?X:void 0),K=new Ee(Z,this._imShading?2:0,B.textureCoordinateType,r!==f?1:0,0),Q=new Oe({interleavedVertexData:Y.data,vertexCount:Y.data.byteLength/Z[0].stride,indexData:Y.indices},{positions:M.typedBuffer,indices:P.typedBuffer},$,K),ee=this.view.renderSpatialReference,te=O(),ie=[1,1,1];D(i,ee,ie,s)||this._dbg(3,"Unsupported coordinate system for IM overlay"),G(i,ee,te,s);let re=Promise.resolve(Qe),oe=S,ne=ze,ae=null,le=null,ce=null,de=null,he=null,fe=1,be=!1,ge=2,ye=!1,_e=R(0,0,0);const ve=U(He),we="Pbr"===v;if(_){const e=e=>this._getTexture(e,t,d,l);ae=e(_.baseColorTex),he=we?e(_.metalTex):null,le=we?e(_.emissiveTex):null,de=we?e(_.occlusionTex):null,ce=we?e(_.normalTex):null;const i=[ae,he,le,de,ce].map(e=>e?.loadPromise??null);re=Promise.all(i),oe=A(_.baseColorFactor),ne=_.alphaCutoff??ze,we&&(C(ve,_.metallicFactor,_.roughnessFactor,0),_.emissiveFactor&&(_e=_.emissiveFactor)),fe=ue[_.alphaMode],be=_.isDoubleSided,ge=pe[_.faceCulling??"NotSet"],ye=this.layer.replacesTerrain}const je=re.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ae||this._dbg(3,"No colour texture 1");const e=this._collection.createObject({toMapSpace:H(te[0],te[1],ie[0],ie[1]),transform:new Te(i,X),obb:N,geometry:Q,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:oe,textureAlphaCutoff:ne,mrrFactors:ve,baseColorTexture:ae,metallicRoughnessTexture:he,normalTexture:ce,occlusionTexture:de,emissionTexture:le,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:fe,doubleSided:be,cullFace:ge,isGround:ye,emissiveBaseColor:_e,usePBR:we,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffsetEnabled:!1,ellipsoidMode:1,applySSAO:this._applySSAO});return l.textureMemoryUsage+=ae?.texture?.usedMemory??0,we&&(l.textureMemoryUsage+=(he?.texture?.usedMemory??0)+(le?.texture?.usedMemory??0)+(de?.texture?.usedMemory??0)+(ce?.texture?.usedMemory??0)),a+=this._collection.getObjectGPUMemoryUsage(e),e});c.push(je)}if(g.push(...await Promise.all(c)),this.destroyed){const e="IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call";throw this._dbg(3,e),new Error(e)}}catch(k){throw d.forEach(e=>this._stage.removeTexture(e)),k}const _=g.map(e=>e()),v=new Array;d.forEach(e=>v.push(e));const{fullExtent:M}=this.layer;M?.hasZ&&M.zmax&&M.zmin&&(y.minElevation=Math.max(y.minElevation,M.zmin),y.maxElevation=Math.min(y.maxElevation,M.zmax));const E=_.reduceRight((e,t)=>e+t.intersectionGeometry.usedMemory,0),V=new $e(e.handle,_,v,E,a,l.textureMemoryUsage,n,e.stableNodeId,e.nodeDepth,y);this._lyrHandleToObjects.set(e.handle,V),this._memCache.put(Ke(V.handle),V);const{usedMemory:L}=V;return this._cacheMemory+=L,{memUsageBytes:L}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(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=Ke(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 s=this._frustum,r=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._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Ke(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 s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=this._visibleObjects.delete(s);s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Ke(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=i.get(r)??this._createTexture(e,t,i,s);return o?new Re(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!r.mipCount||a>1,c=fe[e.wrapMode??"None"];let d=r.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let m=null,u=null,p=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(m=h,d=6403,u=""):"Rgb8"===r.pixelFormat?(m=h,d=6407,u=""):"Rgba8"===r.pixelFormat&&(m=h,d=6408,u="");break;case"Dxt1":m=h,d=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,d=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,d=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0,t=new Se(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:c,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(t),i.set(r,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],{view:u}=c,p=void 0,f=u.byteOffset+u.byteCount,b=u.byteCount/be[u.type],g=z(b);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new J(t,u.byteOffset,p,f),r=new Ve(s.typedBuffer,g,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new J(t,u.byteOffset,p,f),s=Ae(e.typedBuffer,i);a=new K(s.buffer),l=new Ve(a.typedBuffer,g,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new Ve(new q(t,u.byteOffset,p,f).typedBuffer,g,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new W(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new $(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new Z(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new J(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new X(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new Y(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new Ve(d.typedBuffer,g,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new ee(t,i.byteOffset,s,r);break;case"U32":c=new Q(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;c=c=e<65535?new ee(new Uint16Array(e).buffer):new Q(new Uint32Array(e).buffer);for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_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.")},o),"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([c()],qe.prototype,"fullOpacity",null),e([c({readOnly:!0})],qe.prototype,"ready",null),e([c({type:[te]})],qe.prototype,"_modifications",void 0),e([c()],qe.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],qe.prototype,"layer",void 0),e([c({readOnly:!0})],qe.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],qe.prototype,"_collection",null),e([c()],qe.prototype,"elevationOffset",null),e([c({readOnly:!0})],qe.prototype,"visibleElevationRange",null),qe=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],qe);const We=qe;class $e{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.isLoaded=!1,this.isVisible=!1;const d=O();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;const m=n?.halfSize;this._obbShortestHalfsize=m?Math.min(m[0],m[1],m[2]):0}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this.obb?.center??V}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-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,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ze(e){return Math.round(e/1048.576)/1e3}const Je=O();function Xe(e,t){const i=je(e);return w(Je,i.center,t),i.center=Je,i}function Ye(e){return e?new we(e.center,e.halfSize,g(...e.quaternion)):null}function Ke(e){return`${e}`}const Qe=new Array;function et(e,t,i,s){const{center:r}=e,o=u(st,e.quaternionConjugate),n=x(tt,r,o),{data:a}=i,l=a.length/i.stride,c=it;for(let d=0;d<l;++d){const e=3*d;for(let t=0;t<3;++t)c[t]=a[e+t]+s[t];x(c,c,o),_(c,c,n),M(c,c),E(t,t,c)}e.halfSize=t}const tt=O(),it=O(),st=p();export{We as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as m,fromQuat as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,add as w,length as j,transformMat3 as x,set as C,abs as M,max as E}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as T,fromValues as R,clone as U,ZEROS as V}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S,clone as H,fromValues as A}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as k,getReferenceEllipsoid as I,SphericalECEFSpatialReferenceLike as P}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as F}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as D}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as G}from"../../../geometry/projection/projectVectorToVector.js";import{create as B}from"../../../geometry/support/aaBoundingRect.js";import{getContinuousIndexArray as z}from"../../../geometry/support/Indices.js";import{isCGCS2000 as N}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec2f as q,BufferViewVec4f as W,BufferViewVec4u8 as $,BufferViewVec4u16 as Z,BufferViewVec3f as J,BufferViewVec3u8 as X,BufferViewVec3u16 as Y,BufferViewInt16 as K,BufferViewUint32 as Q,BufferViewUint16 as ee}from"../../../geometry/support/buffer/BufferView.js";import te from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as ie}from"../../../support/elevationInfoUtils.js";import{addNormals as se}from"./IntegratedMeshNormals.js";import{LayerView3D as re}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as oe}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as ne,removeLayerViewFromWasm as ae,getLyr3DWasm as le}from"./Lyr3DWasm.js";import{toWasmModification as ce}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as de}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as he}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as me,alphaModeConversion as ue,faceCullingConversion as pe,wrapModeConversion as fe,lyr3DTypeToByteSize as be}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as ye}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as ge}from"../state/Frustum.js";import{ElevationRange as _e}from"../support/ElevationRange.js";import{toBoundingRect as ve}from"../support/extentUtils.js";import{Obb as we,compute as je}from"../support/orientedBoundingBox.js";import{glLayout as xe}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as Ce,createVertexBufferLayout as Me,ComponentGeometryParameters as Ee,SourceGeometry as Oe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Te}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Re}from"../webgl-engine/core/material/RenderTexture.js";import{Vertices as Ue,Attribute as Ve}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Se}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as He}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ae}from"../webgl-engine/materials/pbrUtils.js";import{writeAttribute as Le,writeBufferVec2 as ke}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Ie from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Pe,isInEffectiveScaleRange as Fe,validateScaleRange as De}from"../../support/layerViewUtils.js";import{TaskPriority as Ge}from"../../support/Scheduler.js";import{TextureCompressionTracker as Be}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as ze}from"../../../webscene/support/AlphaCutoff.js";var Ne;let qe=class extends(re(Ie)){static{Ne=he}constructor(e){super(e),this[Ne]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,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 Be,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._frustum=new ge(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(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._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Pe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=ne(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ye(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(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new de({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([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),ae(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),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=i(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 hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ce(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=B();this._layerClippingArea=ve(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{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,ie(e))}get _wasm(){return le(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Fe(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||De(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new oe(this.usedMemory,r,o,Ze(t),Ze(e),Ze(s),Ze(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return ie(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new _e(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new _e;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,s=i.isWGS84||i.isWebMercator||N(i)||L(i)||k(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=I(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(O(),n),c=500,d=Math.max(o[2],c),h=d+r,m=Math.sqrt(h**2-r**2),u=Math.abs(Math.atan2(m,r))*r,p=d>.5*r?.5*Math.PI*r:u,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-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)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){return this._frameTask.schedule(()=>this._createRenderable(e))}async _createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:t}=e;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=T(...t.desc.origin),s=this.view.basemapTerrain.spatialReference;let r=f;if(this.view.state.isGlobal){const e=b();F(P,i,e,s),r=h(p(),e)}const o=O(),n=Ye(t.desc.obb);let a=0;const l={textureMemoryUsage:0},c=new Array,d=new Map,u=t.desc.prims.length,y=new Array,g=new _e;try{const e=this.view.state.isGlobal,h=e?I(this.view.spatialReference).radius:0,b=O();for(let y=0;y<u;y++){const u=t.desc.prims[y];this._dbg(2,JSON.stringify(u));if(null==me[u.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+u.ptype+"). Skipping primitive.");continue}const _=t.desc?.materials&&null!=u.materialId?t.desc.materials[u.materialId]:null,v=null!=_?_.lightingModel:"Unlit",{positionView:M,positionAttr:E,normalsView:T,normalsAttr:V,colorAttr:L,texCoord0Attr:k,indicesView:I}=this.getBufferViews(u,t.data.buffer,r);if(null==E||null==M||null==I)continue;const P=M.count,F=(e,t)=>!e||e.data.length/e.size===P||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!F(k,"numTexcoord")||!F(L,"numColors")||!F(V,"normals"))continue;const B=new Ce(null!=L,null!=T,k?1:0),z=Me(B);for(let t=0;t<M.count;t++){M.getVec(t,o),w(o,o,i);const s=e?j(o)-h:o[2];g.expandElevationRangeValues(s,s)}if(n){et(n,b,new Ue(E.data,3),i)}const N=n?.clone()??Xe(E,i);if(r!==f)for(let e=0;e<M.count;e++)M.getVec(e,o),x(o,o,r),M.setVec(e,o);const W=z.createBuffer(P);if(Le("position",E,null,null,W,0),null!=k){const e=W.getField("uv0",q);ke(k,e,0)}null!=L&&Le("color",L,null,null,W,0),null!=V&&Le("normalCompressed",V,null,null,W,0);const $=new Uint32Array([0,I.typedBuffer.length]),Z=xe(z),J=this._imVertexNormals,X=r===f?f:m(p(),r)??f,Y=se(new Uint8Array(W.buffer),I.typedBuffer,Z,J,J?X:void 0),K=new Ee(Z,this._imShading?2:0,B.textureCoordinateType,r!==f?1:0,0),Q=new Oe({interleavedVertexData:Y.data,vertexCount:Y.data.byteLength/Z[0].stride,indexData:Y.indices},{positions:M.typedBuffer,indices:I.typedBuffer},$,K),ee=this.view.renderSpatialReference,te=O(),ie=[1,1,1];D(i,ee,ie,s)||this._dbg(3,"Unsupported coordinate system for IM overlay"),G(i,ee,te,s);let re=Promise.resolve(Qe),oe=S,ne=ze,ae=null,le=null,ce=null,de=null,he=null,fe=1,be=!1,ye=2,ge=!1,_e=R(0,0,0);const ve=U(Ae),we="Pbr"===v;if(_){const e=e=>this._getTexture(e,t,d,l);ae=e(_.baseColorTex),he=we?e(_.metalTex):null,le=we?e(_.emissiveTex):null,de=we?e(_.occlusionTex):null,ce=we?e(_.normalTex):null;const i=[ae,he,le,de,ce].map(e=>e?.loadPromise??null);re=Promise.all(i),oe=H(_.baseColorFactor),ne=_.alphaCutoff??ze,we&&(C(ve,_.metallicFactor,_.roughnessFactor,0),_.emissiveFactor&&(_e=_.emissiveFactor)),fe=ue[_.alphaMode],be=_.isDoubleSided,ye=pe[_.faceCulling??"NotSet"],ge=this.layer.replacesTerrain}const je=re.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ae||this._dbg(3,"No colour texture 1");const e=this._collection.createObject({toMapSpace:A(te[0],te[1],ie[0],ie[1]),transform:new Te(i,X),obb:N,geometry:Q,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:oe,textureAlphaCutoff:ne,mrrFactors:ve,baseColorTexture:ae,metallicRoughnessTexture:he,normalTexture:ce,occlusionTexture:de,emissionTexture:le,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:fe,doubleSided:be,cullFace:ye,isGround:ge,emissiveBaseColor:_e,usePBR:we,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffsetEnabled:!1,ellipsoidMode:1,applySSAO:this._applySSAO});return l.textureMemoryUsage+=ae?.texture?.usedMemory??0,we&&(l.textureMemoryUsage+=(he?.texture?.usedMemory??0)+(le?.texture?.usedMemory??0)+(de?.texture?.usedMemory??0)+(ce?.texture?.usedMemory??0)),a+=this._collection.getObjectGPUMemoryUsage(e),e});c.push(je)}if(y.push(...await Promise.all(c)),this.destroyed){const e="IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call";throw this._dbg(3,e),new Error(e)}}catch(k){throw d.forEach(e=>this._stage.removeTexture(e)),k}const _=y.map(e=>e()),v=new Array;d.forEach(e=>v.push(e));const{fullExtent:M}=this.layer;M?.hasZ&&M.zmax&&M.zmin&&(g.minElevation=Math.max(g.minElevation,M.zmin),g.maxElevation=Math.min(g.maxElevation,M.zmax));const E=_.reduceRight((e,t)=>e+t.intersectionGeometry.usedMemory,0),V=new $e(e.handle,_,v,E,a,l.textureMemoryUsage,n,e.stableNodeId,e.nodeDepth,g);this._lyrHandleToObjects.set(e.handle,V),this._memCache.put(Ke(V.handle),V);const{usedMemory:L}=V;return this._cacheMemory+=L,{memUsageBytes:L}}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=Ke(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 s=this._frustum,r=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(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Ke(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 s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Ke(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=i.get(r)??this._createTexture(e,t,i,s);return o?new Re(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!r.mipCount||a>1,c=fe[e.wrapMode??"None"];let d=r.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let m=null,u=null,p=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(m=h,d=6403,u=""):"Rgb8"===r.pixelFormat?(m=h,d=6407,u=""):"Rgba8"===r.pixelFormat&&(m=h,d=6408,u="");break;case"Dxt1":m=h,d=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,d=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,d=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0,t=new Se(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:c,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(t),i.set(r,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],{view:u}=c,p=void 0,f=u.byteOffset+u.byteCount,b=u.byteCount/be[u.type],y=z(b);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new J(t,u.byteOffset,p,f),r=new Ve(s.typedBuffer,y,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new J(t,u.byteOffset,p,f),s=He(e.typedBuffer,i);a=new K(s.buffer),l=new Ve(a.typedBuffer,y,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new Ve(new q(t,u.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new W(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new $(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new Z(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new J(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new X(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new Y(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new Ve(d.typedBuffer,y,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new ee(t,i.byteOffset,s,r);break;case"U32":c=new Q(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;c=c=e<65535?new ee(new Uint16Array(e).buffer):new Q(new Uint32Array(e).buffer);for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_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.")},o),"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([c()],qe.prototype,"fullOpacity",null),e([c({readOnly:!0})],qe.prototype,"ready",null),e([c({type:[te]})],qe.prototype,"_modifications",void 0),e([c()],qe.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],qe.prototype,"layer",void 0),e([c({readOnly:!0})],qe.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],qe.prototype,"_collection",null),e([c()],qe.prototype,"elevationOffset",null),e([c({readOnly:!0})],qe.prototype,"visibleElevationRange",null),qe=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],qe);const We=qe;class $e{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,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=O();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;const m=n?.halfSize;this._obbShortestHalfsize=m?Math.min(m[0],m[1],m[2]):0,this._mbsCenter=n?U(n.center):V}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:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-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,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ze(e){return Math.round(e/1048.576)/1e3}const Je=O();function Xe(e,t){const i=je(e);return w(Je,i.center,t),i.center=Je,i}function Ye(e){return e?new we(e.center,e.halfSize,y(...e.quaternion)):null}function Ke(e){return`${e}`}const Qe=new Array;function et(e,t,i,s){const{center:r}=e,o=u(st,e.quaternionConjugate),n=x(tt,r,o),{data:a}=i,l=a.length/i.stride,c=it;for(let d=0;d<l;++d){const e=3*d;for(let t=0;t<3;++t)c[t]=a[e+t]+s[t];x(c,c,o),_(c,c,n),M(c,c),E(t,t,c)}e.halfSize=t}const tt=O(),it=O(),st=p();export{We as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import e from"../../../../core/Logger.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import{sub as n,normalize as o,dot as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a,isEmpty as l,setEmpty as u,intersectsSphere as h,intersectsRay as c,copy as d,exactEquals as g}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as m}from"../../../../geometry/support/aaBoundingRect.js";import{earth as f}from"../../../../geometry/support/Ellipsoid.js";import{ElevationRange as p}from"../../support/ElevationRange.js";class w{static create(e,t){return"local"===e?new _(t):new b(t)}constructor(e,t){this.viewingMode=e,this.layerExtent=t,this._rootNode=null,this._intersectionGeneration=0,this._tileMap=new Map}destroy(){this._rootNode?.clear(),this._tileMap.clear()}_nextIntersectionGeneration(){return this._intersectionGeneration++,this._intersectionGeneration}addTile(e){const{mbsCenter:n,mbsRadius:o}=e,i=[this._ensureRootNode()],r=new Array,s=t(this._tileMap,e,()=>new Set),a=t=>{if(s.has(t))return;const n=t.addOwnTile(e);R(r,t.parent,n),s.add(t)};for(;i.length>0;){const t=i.pop();if(t.treeDepth>=H||e.mbsRadius>=.5*t.sideLength){a(t);continue}const{hPlane:r,vPlane:s}=t,l=V(n,o,r),u=V(n,o,s);0!==l||0!==u?M(t,l,u,(e,t)=>{i.push(this._ensureChild(e,t))}):a(t)}this._propagateSummaryUpdates(r)}removeTile(t){if(!this._rootNode)return void e.getLogger("Tiles3DBVH").error("Tiles3DBVH: Attempted to remove a tile that is not loaded (no root node)");const n=this._tileMap.get(t);if(!n||0===n.size)return void e.getLogger("Tiles3DBVH").error("Tiles3DBVH internal error: Attempted to remove a tile that is not loaded (not in tile map)");const o=new Array;this._tileMap.delete(t);for(const e of n){e.removeOwnTile(t);const n=e.updateOwnSummaries();R(o,e.parent,n)}this._propagateSummaryUpdates(o)}_propagateSummaryUpdates(e){if(0===e.length)return;e.sort((e,t)=>e.node.treeDepth-t.node.treeDepth);let t=new Map,n=-1;const o=()=>e.length>0?e[e.length-1].node.treeDepth:-1;for(;e.length>0||t.size>0;){const i=t.size>0?n:o(),r=t;for(t=new Map;e.length>0&&o()===i;){const{node:t,childrenUpdateKind:n}=e.pop();I(r,t,n)}for(const[e,n]of r){let o=0;for(let t=0;t<4;t++){const n=e.children[t];n&&n.isLeaf&&0===n.ownTiles.size&&(n.clear(),e.children[t]=null,o=3)}o|=e.updateSubtreeSummaries(n|o),I(t,e.parent,o)}t.size>0&&(n=i-1)}}forEachTileIntersectingRay(e,t,n,o){o?this._forEachTileIntersectingVerticalRay(e,t,n):this._forEachTileIntersectingRayGeneral(e,t,n)}_forEachTileIntersectingRayGeneral(e,t,i){const r=this._rootNode;if(!r)return;const s=this._nextIntersectionGeneration();n(j,t,e);const a=o(j,j),l=[{node:r,tRange:{tMin:0,tMax:Number.POSITIVE_INFINITY}}];for(;l.length>0;){const t=l.pop(),{node:n,tRange:o}=t,r=n.subtreeIntersectsRay(e,a,o);if(!r)continue;if(n.ownIntersectsRay(e,a,r))for(const l of n.ownTiles)l.bvhIntersectionGeneration!==s&&(l.bvhIntersectionGeneration=s,l.boundingVolumeIntersectsRay(e,a)&&i(l));const{hPlane:u,vPlane:h}=n;for(let i=0;i<4;i++){const t=n.children[i];if(null==t)continue;const r=0===i||1===i,s=y(e,a,y(e,a,o,h,!(0===i||2===i)),u,!r);s&&l.push({node:t,tRange:s})}}}_forEachTileIntersectingVerticalRay(e,t,i){if("global"!==this.viewingMode)return void this._forEachTileIntersectingRayGeneral(e,t,i);const r=this._rootNode;if(!r)return;const s=this._nextIntersectionGeneration();n(j,t,e);const a=o(j,j),l={tMin:0,tMax:Number.POSITIVE_INFINITY},u=(e,t)=>{const n=e.children[t];n&&h.push(n)},h=[r];for(;h.length>0;){const t=h.pop();if(!t.subtreeIntersectsRay(e,a,l))continue;if(null!=t.ownIntersectsRay(e,a,l))for(const n of t.ownTiles)n.bvhIntersectionGeneration!==s&&(n.bvhIntersectionGeneration=s,n.boundingVolumeIntersectsRay(e,a)&&i(n));if(t.isLeaf)continue;M(t,T(t.hPlane,e),T(t.vPlane,e),(t,n)=>{const o=t.children[n];o&&o.subtreeIntersectsRay(e,a,l)&&u(t,n)})}}getElevationRangeIntersectingSphere(e){const t=this._rootNode;if(!t||!t.subtreeIntersectsSphere(e))return null;const n=this._nextIntersectionGeneration();let o=null;const i=e=>{e.isEmpty||(o?o.expandElevationRange(e):o=new p(e.minElevation,e.maxElevation))},r=[t];for(;r.length>0;){const t=r.pop();if(!o?.contains(t.subtreeElevationRange))if(t.subtreeContainedBySphere(e))i(t.subtreeElevationRange);else{if(t.ownIntersectsSphere(e))for(const r of t.ownTiles){if(r.bvhIntersectionGeneration===n)continue;if(r.bvhIntersectionGeneration=n,!r.boundingVolumeIntersectsSphere(e))continue;const t=r.elevationRange;o?.contains(t)||i(t)}if(!t.isLeaf){M(t,V(e.center,e.radius,t.hPlane),V(e.center,e.radius,t.vPlane),(t,n)=>{const i=t.children[n];if(i&&i.subtreeIntersectsSphere(e)){if(o?.contains(i.subtreeElevationRange))return;r.push(i)}})}}}return o}}class _ extends w{constructor(e){super("local",e)}_ensureRootNode(){if(!this._rootNode){const e=this.layerExtent,t=Math.max(Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2]),Math.abs(e[3])),n=Math.log2(t),o=Math.ceil(n),i=2**Math.max(1,o),s=new v(null,0,m(-i,-i,i,i),new E(r(0,1,0),0),new E(r(1,0,0),0),2*i,a(-i,-i,-1/0,i,i,1/0));this._rootNode=s}return this._rootNode}_ensureChild(t,n){if(t.treeDepth>=H){const t="Internal error: attempted to create a child node for a node that is already at max depth";throw e.getLogger("Tiles3DBVH").error(t),new Error(t)}let o=t.children[n];if(null===o){const{extent:e,hPlane:i,vPlane:r,treeDepth:s,sideLength:l}=t,u=.5*(e[0]+e[2]),h=.5*(e[1]+e[3]),c=0===n||1===n,d=2===n||0===n,g=m(d?e[0]:u,c?e[1]:h,d?u:e[2],c?h:e[3]),f=new E(i.normal,-.5*(g[1]+g[3])),p=new E(r.normal,-.5*(g[0]+g[2]));o=new v(t,s+1,g,f,p,.5*l,a(g[0],g[1],-1/0,g[2],g[3],1/0)),t.children[n]=o}return o}}class b extends w{constructor(e){super("global",e)}_ensureRootNode(){if(!this._rootNode){const e=new v(null,0,m(-Math.PI,-Math.PI/2,Math.PI,Math.PI/2),new E(r(0,0,1),0),new E(r(1,0,0),0),Math.PI*f.radius,a(-1/0,-1/0,-1/0,1/0,1/0,1/0));this._rootNode=e}return this._rootNode}_ensureChild(t,n){if(t.treeDepth>=H){const t="Attempted to create a child node for a node that is already at max depth";throw e.getLogger("Tiles3DBVH").error(t),new Error(t)}let o=t.children[n];if(null===o){const{extent:e,treeDepth:i,sideLength:s}=t,a=.5*(e[0]+e[2]),l=.5*(e[1]+e[3]),u=0===n||1===n,h=2===n||0===n,c=m(h?e[0]:a,u?e[1]:l,h?a:e[2],u?l:e[3]),d=.5*(c[0]+c[2]),g=.5*(c[1]+c[3]),f=Math.cos(d),p=Math.sin(d),w=Math.cos(g),_=Math.sin(g),b=r(-_*f,-_*p,w),M=new E(b,0),R=new E(r(-p,f,0),0);o=new v(t,i+1,c,M,R,.5*s),t.children[n]=o}return o}}class v{constructor(e,t,n,o,i,r,s){this.parent=e,this._treeDepth=t,this.extent=n,this.hPlane=o,this.vPlane=i,this.sideLength=r,this.bounds=s,this._ownBoundingVolume=a(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._subtreeBoundingVolume=a(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._ownElevationRange=new p,this._subtreeElevationRange=new p,this.ownTiles=new Set,this.children=[null,null,null,null]}get ownBoundingVolume(){return this._ownBoundingVolume}get subtreeBoundingVolume(){return this._subtreeBoundingVolume}get subtreeElevationRange(){return this._subtreeElevationRange}subtreeContainedBySphere(e){const t=this._subtreeBoundingVolume;if(l(t))return!0;const{center:n,radius:o}=e,i=o**2;let r=0;for(let s=0;s<3;s++){if(r+=Math.max(Math.abs(t[s]-n[s]),Math.abs(t[s+3]-n[s]))**2,r>i)return!1}return!0}clear(){for(let e=0;e<4;e++)this.children[e]?.clear(),this.children[e]=null;this.ownTiles.clear(),u(this._ownBoundingVolume),u(this._subtreeBoundingVolume),this._ownElevationRange.initializeEmpty(),this._subtreeElevationRange.initializeEmpty()}get isLeaf(){return this.children.every(e=>null==e)}get treeDepth(){return this._treeDepth}subtreeIntersectsSphere(e){return h(this.subtreeBoundingVolume,e)}ownIntersectsSphere(e){return this.ownTiles.size>0&&h(this._ownBoundingVolume,e)}subtreeIntersectsRay(e,t,n){return c(this.subtreeBoundingVolume,e,t,n)}ownIntersectsRay(e,t,n){return this.ownTiles.size>0?c(this._ownBoundingVolume,e,t,n):null}addOwnTile(t){if(this.ownTiles.has(t)){const t="BVNode: Attempted to add a tile that is already in the node";return e.getLogger("Tiles3DBVH").error(t),0}this.ownTiles.add(t);return(x(this._ownBoundingVolume,t,this.bounds)&&B(this._subtreeBoundingVolume,this._ownBoundingVolume,this.bounds)?1:0)|(this._ownElevationRange.expandElevationRange(t.elevationRange)&&this._subtreeElevationRange.expandElevationRange(t.elevationRange)?2:0)}removeOwnTile(t){if(!this.ownTiles.has(t)){const t="BVNode: Attempted to remove a tile that is not in the node";return void e.getLogger("Tiles3DBVH").error(t)}this.ownTiles.delete(t)}updateOwnSummaries(){const e=(S(this._ownBoundingVolume,this.ownTiles,this.bounds)?1:0)|(D(this._ownElevationRange,this.ownTiles)?2:0);return this.updateSubtreeSummaries(e)}updateSubtreeSummaries(e){if(this.isLeaf&&0===this.ownTiles.size)return u(this._subtreeBoundingVolume),this._subtreeElevationRange.initializeEmpty(),3;let t=0;if(1&e){N(this._subtreeBoundingVolume,[this._ownBoundingVolume,...this.children.map(e=>e?.subtreeBoundingVolume).filter(e=>null!=e)],this.bounds)&&(t|=1)}if(2&e){P(this._subtreeElevationRange,[this._ownElevationRange,...this.children.filter(e=>null!=e).map(e=>e.subtreeElevationRange)])&&(t|=2)}return t}}function M(e,t,n,o){t<=0&&(n<=0&&o(e,0),n>=0&&o(e,1)),t>=0&&(n<=0&&o(e,2),n>=0&&o(e,3))}function R(e,t,n){null!=t&&0!==n&&e.push({node:t,childrenUpdateKind:n})}function I(e,t,n){if(null==t||0===n)return;const o=e.get(t)??0;e.set(t,o|n)}class E{constructor(e=[0,0,0],t=0){this.normal=e,this.distance=t}}function V(e,t,n){const o=i(n.normal,e)+n.distance;return o<0?Math.min(o+t,0):Math.max(o-t,0)}function T(e,t){return i(e.normal,t)+e.distance}function y(e,t,n,o,r){if(!n)return null;const s=1e-12,a=i(o.normal,t),l=T(o,e)+n.tMin*a;if(Math.abs(a)<s){return(r?l>=-s:l<=s)?n:null}const u=n.tMin-l/a,h=r===a>0?{tMin:Math.max(n.tMin,u),tMax:n.tMax}:{tMin:n.tMin,tMax:Math.min(n.tMax,u)};return h.tMin<=h.tMax?h:null}function x(e,t,n){const{mbsCenter:o,mbsRadius:i}=t;for(let r=0;r<3;r++)G[r]=o[r]-i,G[r+3]=o[r]+i;return B(e,G,n)}function B(e,t,n){if(l(t))return!1;let o=!1;for(let i=0;i<3;i++){const r=Math.max(n?.[i]??-1/0,t[i]),s=Math.min(n?.[i+3]??1/0,t[i+3]);r<e[i]&&(e[i]=r,o=!0),s>e[i+3]&&(e[i+3]=s,o=!0)}return o}function S(e,t,n){d(L,e),u(e);for(const o of t)x(e,o,n);return!g(e,L)}function N(e,t,n){d(L,e),u(e);for(const o of t)B(e,o,n);return!g(e,L)}function D(e,t){z.setElevationRange(e),e.initializeEmpty();for(const n of t)e.expandElevationRange(n.elevationRange);return!e.equals(z)}function P(e,t){z.setElevationRange(e),e.initializeEmpty();for(const n of t)e.expandElevationRange(n);return!e.equals(z)}const G=a(0,0,0,0,0,0),L=a(0,0,0,0,0,0),z=new p,j=s(),H=30;export{w as Tiles3DBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{sub as e,normalize as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as r}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as o,computeInvDir as l,intersectAabbInvDir as a}from"../../webgl-engine/lib/RayIntersections.js";class c{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid}intersect(s,c,d,m,p,f){if(s.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:g,tolerance:h}=s,w=2===s.options.store,{componentObjectCollection:b}=this.layerView.view.stage.renderView,y=new o(h,f,s.options.normalRequired),V=l(d,m,u),R=e(i(),m,d),j=t(i(),R),v=(e,t,i)=>{if(t>=0){if(null!=c&&!c(d,m,t))return;const e=e=>{const s=new n(this.layerView.uid);e.set(this.type,s,t,i)};if(this.isGround&&(null==g.ground.distance||t<g.ground.distance)&&e(g.ground),s.options.isFiltered)return;if((null==g.min.distance||t<g.min.distance)&&e(g.min),(null==g.max.distance||t>g.max.distance)&&e(g.max),w){const t=new r(s.ray);e(t),s.results.all.push(t)}}};this.layerView.forEachTile(e=>{if(!e.boundingVolumeIntersectsRay(d,j))return;const{componentObjects:t}=e;for(const i of t)a(i.aabbInWorldCoordinates,d,V,0)&&b.intersect(i,d,m,null,y,v)})}getElevationRange(e){let t=null;return this.layerView.forEachTile(i=>{t?.contains(i.elevationRange)||i.boundingVolumeIntersectsSphere(e)&&(t||(t=new s),t.expandElevationRange(i.elevationRange))}),t||(t=new s(0,0)),t}}const u=i();export{c as Tiles3DMeshIntersectionHandler};
2
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as t}from"../../../../geometry/projectionUtils.js";import{fromExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{Tiles3DBVH as r}from"./Tiles3DBVH.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as o}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as l,computeInvDir as a,intersectAabbInvDir as c}from"../../webgl-engine/lib/RayIntersections.js";class d{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid;const n=e.view.viewingMode,s=e.layer.fullExtent,o=(s?t(s,e.view.renderSpatialReference):void 0)??e.view.extent,l=i(o);this._bvh=r.create(n,l)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}intersect(e,t,i,r,s,d){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:u,tolerance:h}=e,p=2===e.options.store,{componentObjectCollection:f}=this.layerView.view.stage.renderView,g=new l(h,d,e.options.normalRequired),v=a(i,r,m),w=(s,l,a)=>{if(l<0)return;if(null!=t&&!t(i,r,l))return;const c=e=>{const t=new n(this.layerView.uid);e.set(this.type,t,l,a)};if(this.isGround&&(null==u.ground.distance||l<u.ground.distance)&&c(u.ground),!e.options.isFiltered&&((null==u.min.distance||l<u.min.distance)&&c(u.min),(null==u.max.distance||l>u.max.distance)&&c(u.max),p)){const t=new o(e.ray);c(t),e.results.all.push(t)}};this._bvh.forEachTileIntersectingRay(i,r,e=>{const{componentObjects:t}=e;for(const n of t)c(n.aabbInWorldCoordinates,i,v,0)&&f.intersect(n,i,r,null,g,w)},d)}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new s(0,0)}}const m=e();export{d as Tiles3DMeshIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- class i{constructor(i=1/0,a=-1/0){this.minElevation=i,this.maxElevation=a}get elevationRangeValid(){return!Number.isNaN(this.minElevation)}contains(i){return this.minElevation<=i.minElevation&&this.maxElevation>=i.maxElevation}invalidateElevationRange(){this.minElevation=NaN}expandElevationRange(i){this.minElevation=Math.min(this.minElevation,i.minElevation),this.maxElevation=Math.max(this.maxElevation,i.maxElevation)}expandElevationRangeValues(i,a){this.minElevation=Math.min(this.minElevation,i),this.maxElevation=Math.max(this.maxElevation,a)}setElevationRange(i){this.minElevation=i.minElevation,this.maxElevation=i.maxElevation}setElevationRangeValues(i,a){this.minElevation=i,this.maxElevation=a}}export{i as ElevationRange};
2
+ class i{constructor(i=1/0,t=-1/0){this.minElevation=i,this.maxElevation=t}get elevationRangeValid(){return!Number.isNaN(this.minElevation)}get isEmpty(){return!(this.minElevation<=this.maxElevation)}contains(i){return this.minElevation<=i.minElevation&&this.maxElevation>=i.maxElevation}invalidateElevationRange(){this.minElevation=NaN}initializeEmpty(){this.minElevation=1/0,this.maxElevation=-1/0}expandElevationRange(i){const t=Math.min(this.minElevation,i.minElevation),a=Math.max(this.maxElevation,i.maxElevation),n=t!==this.minElevation||a!==this.maxElevation;return this.minElevation=t,this.maxElevation=a,n}expandElevationRangeValues(i,t){const a=Math.min(this.minElevation,i),n=Math.max(this.maxElevation,t),e=a!==this.minElevation||n!==this.maxElevation;return this.minElevation=a,this.maxElevation=n,e}setElevationRange(i){this.minElevation=i.minElevation,this.maxElevation=i.maxElevation}setElevationRangeValues(i,t){this.minElevation=i,this.maxElevation=t}equals(i){return this.minElevation===i.minElevation&&this.maxElevation===i.maxElevation}}export{i as ElevationRange};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{signal as i}from"../../../../core/signal.js";class e{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}constructor(e){this.layerView=e,this._numFadingTiles=i(0),this._tmpFullyFadedOutTiles=new Array}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(i,e){const t=this._getTargetOpacity(e);if(i.fadeDirection=e,0===this.fadeDuration)return void this._instantTileFading(i,t);const a=i.opacityModifier;if(a!==t){const e=1-Math.abs(t-a);this._startTileFading(i,e)}else this._stopTileFading(i)}updateAllTileFading(i){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,i)&&e.push(t)}),this.layerView.updateGaussians(),e.length>0&&this.layerView.notifyTileObbsChanged(e)}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}onTileDiscarded(i){null!=i.fadeProgress&&this._numFadingTiles.value--}get updating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(i,e){null==i.fadeProgress&&this._numFadingTiles.value++,i.fadeProgress=e}_stopTileFading(i){null!=i.fadeProgress&&(1===i.fadeDirection&&this._onTileFullyFadedOut(i),this._numFadingTiles.value--,i.fadeProgress=null)}_updateTileFading(i,t){const{fadeProgress:a,fadeDirection:s}=i;if(null==a)return!1;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),u=Math.min(a+r,1),o=n*(1-(0===s?e.fadeInEase:e.fadeOutEase)(u)),g=1===u;if(i.opacityModifier=g?d:d-o,g){const e=1===s;return this._stopTileFading(i),this._updateOpacityModifier(i),e}return i.fadeProgress=u,this._updateOpacityModifier(i),!1}_updateOpacityModifier(i){const e=255*i.opacityModifier;for(let t=0;t<i.pageIds.length;t++){const a=i.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(e,a)}}_instantTileFading(i,e){i.fadeProgress=null,i.opacityModifier=e,this._updateOpacityModifier(i),1===i.fadeDirection&&this._onTileFullyFadedOut(i)}_instantlyFullyFadeAllTiles(){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(e=>{if(null!=e.fadeProgress){const t=1===e.fadeDirection;this._instantTileFading(e,this._getTargetOpacity(e.fadeDirection)),t&&i.push(e)}}),this.layerView.updateGaussians(),i.length>0&&this.layerView.notifyTileObbsChanged(i),this._numFadingTiles.value=0}_onTileFullyFadedOut(i){i.isVisible=!1,this.layerView.moveTileToCache(i)}_fadeDirectionToSign(i){return 0===i?1:-1}_getTargetOpacity(i){return 0===i?1:0}}export{e as GaussianSplatFadeHelper};
2
+ import{signal as e}from"../../../../core/signal.js";class i{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}constructor(i){this.layerView=i,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i){const t=this._getTargetOpacity(i);if(e.fadeDirection=i,0===this.fadeDuration)return void this._instantTileFading(e,t);const a=e.opacityModifier;if(a!==t){const i=1-Math.abs(t-a);this._startTileFading(e,i)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(i)),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&this._numFadingTiles.value--}get updating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(e,i){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,e.fadeProgress=null)}_updateTileFading(e,t){const{fadeProgress:a,fadeDirection:s}=e;if(null==a)return!1;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),u=Math.min(a+r,1),o=n*(1-(0===s?i.fadeInEase:i.fadeOutEase)(u)),g=1===u;if(e.opacityModifier=g?d:d-o,g){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){const i=255*e.opacityModifier;for(let t=0;t<e.pageIds.length;t++){const a=e.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(i,a)}}_instantTileFading(e,i){e.fadeProgress=null,e.opacityModifier=i,this._updateOpacityModifier(e),1===e.fadeDirection&&this._onTileFullyFadedOut(e)}_instantlyFullyFadeAllTiles(){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(i=>{if(null!=i.fadeProgress){const t=1===i.fadeDirection;this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection)),t&&e.push(i)}});e.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(e)),this._numFadingTiles.value=0}_onTileFullyFadedOut(e){e.isVisible=!1,this.layerView.moveTileToCache(e)}_fadeDirectionToSign(e){return 0===e?1:-1}_getTargetOpacity(e){return 0===e?1:0}}export{i as GaussianSplatFadeHelper};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import r from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as s}from"../../../webgl/enums.js";import"../../../webgl/Util.js";import{initialSplatAtlasTexturePages as a}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class o{constructor(e){this.texture=null,this._fadeTextureCapacity=0,this._rctx=e}ensureCapacity(t){const o=this.texture;if(this._fadeTextureCapacity>t&&o?.hasWebGLTextureObject)return;const f=Math.max(Math.ceil(t*e),a),[h,c]=this._evalTextureSize(f),p=h*c,l=this._fadeBuffer,m=new Uint8Array(p);l&&m.set(l.subarray(0,this._fadeTextureCapacity)),this._fadeBuffer=m,this._fadeTextureCapacity=p,this.texture?.dispose();const n=new u;n.width=h,n.height=c,n.pixelFormat=36244,n.dataType=i.UNSIGNED_BYTE,n.internalFormat=s.R8UI,n.unpackAlignment=1,n.wrapMode=33071,n.samplingMode=9728,n.isImmutable=!0,this.texture=new r(this._rctx,n)}updateTexture(e){this.ensureCapacity(e);const t=this.texture.descriptor.width,r=Math.ceil(e/t),i=t*r;this.texture.updateData(0,0,0,t,r,this._fadeBuffer.subarray(0,i))}updateBuffer(e,t){this.ensureCapacity(t+1),this._fadeBuffer&&(this._fadeBuffer[t]=e)}clear(){this._fadeBuffer=void 0,this._fadeTextureCapacity=0,this.texture?.dispose(),this.texture=null}destroy(){this.clear()}_evalTextureSize(e){const r=Math.ceil(Math.sqrt(e)),i=Math.ceil(e/r);return t(r,i)}}export{o as GaussianSplatFadeTexture};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import r from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as s}from"../../../webgl/enums.js";import"../../../webgl/Util.js";import{initialSplatAtlasTexturePages as a}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class o{constructor(e){this.texture=null,this._fadeTextureCapacity=0,this._rctx=e}ensureCapacity(t){const o=this.texture;if(this._fadeTextureCapacity>=t&&o?.hasWebGLTextureObject)return;const f=Math.max(Math.ceil(t*e),a),[h,c]=this._evalTextureSize(f),p=h*c,l=this._fadeBuffer,m=new Uint8Array(p);l&&m.set(l.subarray(0,this._fadeTextureCapacity)),this._fadeBuffer=m,this._fadeTextureCapacity=p,this.texture?.dispose();const n=new u;n.width=h,n.height=c,n.pixelFormat=36244,n.dataType=i.UNSIGNED_BYTE,n.internalFormat=s.R8UI,n.unpackAlignment=1,n.wrapMode=33071,n.samplingMode=9728,n.isImmutable=!0,this.texture=new r(this._rctx,n)}updateTexture(e){this.ensureCapacity(e);const t=this.texture.descriptor.width,r=Math.ceil(e/t),i=t*r;this.texture.updateData(0,0,0,t,r,this._fadeBuffer.subarray(0,i))}updateBuffer(e,t){this.ensureCapacity(t+1),this._fadeBuffer&&(this._fadeBuffer[t]=e)}clear(){this._fadeBuffer=void 0,this._fadeTextureCapacity=0,this.texture?.dispose(),this.texture=null}destroy(){this.clear()}_evalTextureSize(e){const r=Math.ceil(Math.sqrt(e)),i=Math.ceil(e/r);return t(r,i)}}export{o as GaussianSplatFadeTexture};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{fromQuat as t,scale as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,conjugate as i,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as c,transformQuat as f,dot as d,cross as u,len as l,scale as m,transformMat3 as _,add as g,sub as p,abs as b,max as M,min as j,length as S,scaleAndAdd as z,sign as x,multiply as y}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as C,freeze as q,create as A,UNIT_Z as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as Q}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as R}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as w}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as D}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as H}from"../../../geometry/projection/projectBuffer.js";import{getProjector as F}from"../../../geometry/projection/projectors.js";import{getNormal as k}from"../../../geometry/support/plane.js";import{isPlateCarree as B}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as U,sq4d as W}from"../../../geometry/support/vectorStacks.js";import{computeOBB as Z}from"./dito.js";import{Vertices as G}from"../webgl-engine/lib/Attribute.js";class O{constructor(t=C,e=pt,a=o){this._data=[t[0],t[1],t[2],e[0],e[1],e[2],a[0],a[1],a[2],a[3]]}clone(){return O.fromData(this._data)}invalidate(){this._data[3]=-1}get isValid(){return this._data[3]>=0}static fromData(t){const e=new O;return e._copyFromData(t),e}static fromJSON(t){return new O(t.center,t.halfSize,t.quaternion)}copy(t){this._copyFromData(t.data)}_copyFromData(t){for(let e=0;e<10;++e)this._data[e]=t[e]}get center(){return c(U.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,e,a){this._data[0]=t,this._data[1]=e,this._data[2]=a}get halfSize(){return c(U.get(),this._data[3],this._data[4],this._data[5])}get halfSizeX(){return this._data[3]}get halfSizeY(){return this._data[4]}get halfSizeZ(){return this._data[5]}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return r(W.get(),this._data[6],this._data[7],this._data[8],this._data[9])}get quaternionConjugate(){return r(W.get(),-this._data[6],-this._data[7],-this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const e=this._data,a=r(T,e[6],e[7],e[8],e[9]);for(let s=0;s<8;++s){const r=t[s];r[0]=(1&s?-1:1)*e[3],r[1]=(2&s?-1:1)*e[4],r[2]=(4&s?-1:1)*e[5],f(r,r,a),r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}return t}getAxes(t){const e=this._data,a=r(T,e[6],e[7],e[8],e[9]);return f(t[0],[1,0,0],a),f(t[1],[0,1,0],a),f(t[2],[0,0,1],a),t}intersectsFrustum(t){const e=this.center,a=t.planes;for(const f of a){const t=k(f),a=this.projectedRadius(t);if(d(t,e)+f[3]-a>0)return!1}const s=this.getAxes(lt),r=t.points,i=this.halfSize;for(let f=0;f<3;++f){const t=s[f],a=-d(t,e),n=i[f];let o=!0,h=!0;for(const e of r){const s=d(e,t)+a;o&&=s>n,h&&=s<-n}if(o||h)return!1}if(this.getCorners(ut).some(e=>t.intersectsPoint(e)))return!0;const n=jt;for(let f=0;f<3;++f){const t=s[f];n[f]=d(t,e)}const o=t=>{for(let e=0;e<3;++e){const a=s[e],r=i[e],o=d(a,t)-n[e];if(o>r||o<-r)return!1}return!0};if(t.points.some(t=>o(t)))return!0;const h=t.lines,c=Mt;for(let f=0;f<8;++f){const t=h[f].direction;for(const a of s){u(c,t,a);const s=l(c);if(!(s>0))continue;m(c,c,1/s);const i=this.projectedRadius(c),n=d(e,c),o=n-i,h=n+i;let f=!1,_=!1,g=!0;for(const t of r){const e=d(c,t);if(e>h){if(_){g=!1;break}f=!0}else{if(!(e<o)){g=!1;break}if(f){g=!1;break}_=!0}}if(g)return!1}}return!0}intersectsFrustumConservativeApproximation(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],e=this._data[4],a=this._data[5];return Math.sqrt(t*t+e*e+a*a)}intersectsPoint(t){const e=this.getAxes(lt),a=this.halfSize,{center:s}=this;for(let r=0;r<3;++r){const i=e[r],n=a[r],o=d(i,t)-d(i,s);if(o>n||o<-n)return!1}return!0}intersectSphere(t){const{center:e,radius:a}=t,s=this._data,r=s[3],i=s[4],n=s[5],o=r+i+n+a,h=s[0]-e[0];if(Math.abs(h)>o)return!1;const c=s[1]-e[1];if(Math.abs(c)>o)return!1;const f=s[2]-e[2];if(Math.abs(f)>o)return!1;const d=-s[6],u=-s[7],l=-s[8],m=u*f-l*c,_=l*h-d*f,g=d*c-u*h,p=u*g-l*_,b=l*m-d*g,M=d*_-u*m,j=2*s[9],S=Math.abs(h+m*j+2*p),z=Math.abs(c+_*j+2*b),x=Math.abs(f+g*j+2*M),y=S-Math.min(S,r),C=z-Math.min(z,i),q=x-Math.min(x,n);return y*y+C*C+q*q<=a*a}intersectSphereWithMBS(t,e=this.radius){const a=this._data,{center:s,radius:r}=t,i=e+r,n=a[0]-s[0];if(n>i)return!1;const o=a[1]-s[1];if(o>i)return!1;const h=a[2]-s[2];if(h>i)return!1;if(n*n+o*o+h*h>i*i)return!1;const c=-a[6],f=-a[7],d=-a[8],u=f*h-d*o,l=d*n-c*h,m=c*o-f*n,_=f*m-d*l,g=d*u-c*m,p=c*l-f*u,b=2*a[9],M=Math.abs(n+u*b+2*_),j=Math.abs(o+l*b+2*g),S=Math.abs(h+m*b+2*p),z=M-Math.min(M,a[3]),x=j-Math.min(j,a[4]),y=S-Math.min(S,a[5]);return z*z+x*x+y*y<r*r}intersectPlane(t){const e=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],a=this.projectedRadius(k(t));return e>a?1:e<-a?-1:0}intersectRay(t,e,a=0){const s=this._data,r=T;r[0]=-s[6],r[1]=-s[7],r[2]=-s[8],r[3]=s[9],E[0]=t[0]-s[0],E[1]=t[1]-s[1],E[2]=t[2]-s[2];const i=f(E,E,T),n=f(I,e,T);let o=-1/0,h=1/0;const c=this.getHalfSize(ct);for(let f=0;f<3;f++){const t=i[f],e=n[f],s=c[f]+a;if(Math.abs(e)>1e-6){const a=(s-t)/e,r=(-s-t)/e;o=Math.max(o,Math.min(a,r)),h=Math.min(h,Math.max(a,r))}else if(t>s||t<-s)return!1}return o<=h}projectedArea(a,s,r,n){const o=this.getQuaternion(X);i(T,o),E[0]=a[0]-this._data[0],E[1]=a[1]-this._data[1],E[2]=a[2]-this._data[2],f(E,E,T);const h=this.getHalfSize(ct),d=E[0]<-h[0]?-1:E[0]>h[0]?1:0,u=E[1]<-h[1]?-1:E[1]>h[1]?1:0,l=E[2]<-h[2]?-1:E[2]>h[2]?1:0,m=Math.abs(d)+Math.abs(u)+Math.abs(l);if(0===m)return 1/0;const p=1===m?4:6,b=6*(d+3*u+9*l+13);t(ft,o),e(ft,ft,h);const M=this.getCenter(ot);for(let t=0;t<p;t++){const e=K[b+t];c(E,((1&e)<<1)-1,(2&e)-1,((4&e)>>1)-1),_(E,E,ft),g(J,M,E),J[3]=1,Q(J,J,s);const a=1/Math.max(1e-6,J[3]);V[2*t]=J[0]*a,V[2*t+1]=J[1]*a}const j=2*p-2;let S=V[0]*(V[3]-V[j+1])+V[j]*(V[1]-V[j-1]);for(let t=2;t<j;t+=2)S+=V[t]*(V[t+3]-V[t-1]);return Math.abs(S)*r*n*.125}projectedRadius(t){const e=this.getQuaternion(X);return i(T,e),f(E,t,T),Math.abs(E[0]*this._data[3])+Math.abs(E[1]*this._data[4])+Math.abs(E[2]*this._data[5])}minimumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]-this.projectedRadius(k(t))}maximumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]+this.projectedRadius(k(t))}toAaBoundingBox(e){const a=this.getQuaternion(X),s=t(ft,a),r=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),i=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);e[0]=this._data[0]-r,e[1]=this._data[1]-i,e[2]=this._data[2]-n,e[3]=this._data[0]+r,e[4]=this._data[1]+i,e[5]=this._data[2]+n}transform(t,e,a,s=0,r=w(a),i=w(e),n=F(e,i)){if(a===r)e.isGeographic?st(this,t,e,s,i):at(this,t,e,s,i,n);else if(e.isGeographic&&(a.isWebMercator||B(a)))$(e,this,a,t,s);else if(e.isWebMercator&&B(a))tt(e,this,a,t,s);else{const r=this.getCenter(ot);r[2]+=s,H(r,e,0,r,a,0),t.center=r,this!==t&&(t.quaternion=this.getQuaternion(X),t.halfSize=this.getHalfSize(ct))}}}const T=h(),X=h(),Y=h(),E=A(),I=A(),J=R();function N(t,e=new O){return Z(t,e),e}const V=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],K=(()=>{const t=new Int8Array(162);let e=0;const a=a=>{for(let s=0;s<a.length;s++)t[e+s]=a[s];e+=6};return a([6,2,3,1,5,4]),a([0,2,3,1,5,4]),a([0,2,3,7,5,4]),a([0,1,3,2,6,4]),a([0,1,3,2,0,0]),a([0,1,5,7,3,2]),a([0,1,3,7,6,4]),a([0,1,3,7,6,2]),a([0,1,5,7,6,2]),a([0,1,5,4,6,2]),a([0,1,5,4,0,0]),a([0,1,3,7,5,4]),a([0,2,6,4,0,0]),a([0,0,0,0,0,0]),a([1,3,7,5,0,0]),a([2,3,7,6,4,0]),a([2,3,7,6,0,0]),a([2,3,1,5,7,6]),a([0,1,5,7,6,2]),a([0,1,5,7,6,4]),a([0,1,3,7,6,4]),a([4,5,7,6,2,0]),a([4,5,7,6,0,0]),a([4,5,1,3,7,6]),a([0,2,3,7,5,4]),a([6,2,3,7,5,4]),a([6,2,3,1,5,4]),t})();function L(t,e,a,s,r){const n=t.getQuaternion(X);r.quaternion=n,i(T,n);const o=t.getCenter(ot),h=t.getHalfSize(ct);if(1===s){f(mt,o,T),b(_t,mt),j(gt,_t,h),p(gt,_t,gt);const s=S(gt);g(gt,_t,h);const i=S(gt);if(s<a)r.center=o,c(mt,a,a,a),r.halfSize=g(mt,h,mt);else{const n=i>0?1+e/i:1,o=s>0?1+a/s:1,c=(o+n)/2,d=(o-n)/2;m(gt,_t,d),r.halfSize=z(gt,gt,h,c),m(gt,_t,c),z(gt,gt,h,d),x(mt,mt),y(mt,gt,mt);const u=t.getQuaternion(Y);r.center=f(mt,mt,u)}}else{r.center=z(mt,o,P,(a+e)/2);const t=f(mt,P,T);b(t,t),r.halfSize=z(_t,h,t,(a-e)/2)}return r}function $(t,e,a,s,r){e.getCenter(ot),ot[2]+=r;const i=w(a);H(ot,t,0,ot,i,0),et(i,e,ot,a,s)}function tt(t,e,a,s,r){e.getCenter(ot),ot[2]+=r,et(t,e,ot,a,s)}function et(e,a,s,r,i){const n=a.getQuaternion(X),o=t(ft,n),h=a.getHalfSize(ct);for(let t=0;t<8;++t){for(let e=0;e<3;++e)nt[e]=h[e]*(t&1<<e?-1:1);for(let e=0;e<3;++e){let a=s[e];for(let t=0;t<3;++t)a+=nt[t]*o[3*t+e];rt[3*t+e]=a}}H(rt,e,0,rt,r,0,8),N(it,i)}function at(t,e,a,s,r=w(a),o=F(a,r)){t.getCorners(ut),t.getCenter(nt),nt[2]+=s,D(a,nt,dt,r),e.setCenter(dt[12],dt[13],dt[14]);const h=2*Math.sqrt(1+dt[0]+dt[5]+dt[10]);T[0]=(dt[6]-dt[9])/h,T[1]=(dt[8]-dt[2])/h,T[2]=(dt[1]-dt[4])/h,T[3]=.25*h;const d=t.getQuaternion(X);e.quaternion=n(T,T,d),i(T,T),c(_t,0,0,0);const u=e.getCenter(ht);for(const i of ut)i[2]+=s,o(i,0,i,0),p(mt,i,u),f(mt,mt,T),b(mt,mt),M(_t,_t,mt);e.halfSize=_t}function st(t,e,a,s,r=w(a)){const n=v(a),o=1+Math.max(0,s)/(n.radius+t.centerZ);t.getCenter(nt),nt[2]+=s,H(nt,a,0,nt,r,0),e.center=nt;const h=t.getQuaternion(X);e.quaternion=h,i(T,h),c(mt,0,0,1),f(mt,mt,T);const d=t.getHalfSize(ct);c(mt,d[0]*Math.abs(mt[0]),d[1]*Math.abs(mt[1]),d[2]*Math.abs(mt[2])),m(mt,mt,n.inverseFlattening),g(mt,d,mt),e.halfSize=m(mt,mt,o)}const rt=new Array(24),it=new G(rt,3),nt=A(),ot=A(),ht=A(),ct=A(),ft=a(),dt=s(),ut=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],lt=[A(),A(),A()],mt=A(),_t=A(),gt=A(),pt=q(-1,-1,-1);function bt(t){return Array.from(t)}const Mt=A(),jt=[0,0,0];export{O as Obb,N as compute,L as computeOffsetObb,bt as ensurePackedObbData};
2
+ import{fromQuat as t,scale as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,conjugate as i,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as c,transformQuat as d,dot as f,cross as u,len as l,scale as m,transformMat3 as _,add as g,sub as p,abs as b,max as M,min as j,length as S,scaleAndAdd as z,sign as x,multiply as y}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as C,freeze as q,create as A,UNIT_Z as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as Q}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as R}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as w}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as D}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as H}from"../../../geometry/projection/projectBuffer.js";import{getProjector as F}from"../../../geometry/projection/projectors.js";import{getNormal as k}from"../../../geometry/support/plane.js";import{isPlateCarree as B}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as Z,sq4d as U}from"../../../geometry/support/vectorStacks.js";import{computeOBB as W}from"./dito.js";import{Vertices as X}from"../webgl-engine/lib/Attribute.js";class Y{constructor(t=C,e=pt,a=o){this._data=[t[0],t[1],t[2],e[0],e[1],e[2],a[0],a[1],a[2],a[3]]}clone(){return Y.fromData(this._data)}invalidate(){this._data[3]=-1}get isValid(){return this._data[3]>=0}static fromData(t){const e=new Y;return e._copyFromData(t),e}static fromJSON(t){return new Y(t.center,t.halfSize,t.quaternion)}copy(t){this._copyFromData(t.data)}_copyFromData(t){for(let e=0;e<10;++e)this._data[e]=t[e]}get center(){return c(Z.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,e,a){this._data[0]=t,this._data[1]=e,this._data[2]=a}get halfSize(){return c(Z.get(),this._data[3],this._data[4],this._data[5])}get halfSizeX(){return this._data[3]}get halfSizeY(){return this._data[4]}get halfSizeZ(){return this._data[5]}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return r(U.get(),this._data[6],this._data[7],this._data[8],this._data[9])}get quaternionConjugate(){return r(U.get(),-this._data[6],-this._data[7],-this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}getQuaternionConjugate(t){return t[0]=-this._data[6],t[1]=-this._data[7],t[2]=-this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const e=this._data,a=r(G,e[6],e[7],e[8],e[9]);for(let s=0;s<8;++s){const r=t[s];r[0]=(1&s?-1:1)*e[3],r[1]=(2&s?-1:1)*e[4],r[2]=(4&s?-1:1)*e[5],d(r,r,a),r[0]+=e[0],r[1]+=e[1],r[2]+=e[2]}return t}getAxes(t){const e=this._data,a=r(G,e[6],e[7],e[8],e[9]);return d(t[0],[1,0,0],a),d(t[1],[0,1,0],a),d(t[2],[0,0,1],a),t}intersectsFrustum(t){const{centerX:e,centerY:a,centerZ:s}=this,r=t.planes;for(const f of r){const t=k(f),r=this.projectedRadius(t);if(e*t[0]+a*t[1]+s*t[2]+f[3]-r>0)return!1}const i=this.getAxes(lt),n=t.points,o=this.halfSize;for(let u=0;u<3;++u){const t=i[u],r=-t[0]*e-t[1]*a-t[2]*s,h=o[u];let c=!0,d=!0;for(const e of n){const a=f(e,t)+r;c&&=a>h,d&&=a<-h}if(c||d)return!1}if(this.getCorners(ut).some(e=>t.intersectsPoint(e)))return!0;const h=jt;for(let f=0;f<3;++f){const t=i[f];h[f]=t[0]*e+t[1]*a+t[2]*s}const c=t=>{for(let e=0;e<3;++e){const a=i[e],s=o[e],r=a[0]*t[0]+a[1]*t[1]+a[2]*t[2]-h[e];if(r>s||r<-s)return!1}return!0};if(t.points.some(t=>c(t)))return!0;const d=t.lines,_=Mt;for(let g=0;g<8;++g){const t=d[g].direction;for(const r of i){u(_,t,r);const i=l(_);if(!(i>0))continue;m(_,_,1/i);const o=this.projectedRadius(_),h=_[0]*e+_[1]*a+_[2]*s,c=h-o,d=h+o;let g=!1,p=!1,b=!0;for(const t of n){const e=f(_,t);if(e>d){if(p){b=!1;break}g=!0}else{if(!(e<c)){b=!1;break}if(g){b=!1;break}p=!0}}if(b)return!1}}return!0}intersectsFrustumConservativeApproximation(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],e=this._data[4],a=this._data[5];return Math.sqrt(t*t+e*e+a*a)}intersectsPoint(t){const e=this.getAxes(lt),a=this.halfSize,{center:s}=this;for(let r=0;r<3;++r){const i=e[r],n=a[r],o=f(i,t)-f(i,s);if(o>n||o<-n)return!1}return!0}intersectSphere(t){const{center:e,radius:a}=t,s=this._data,r=s[3],i=s[4],n=s[5],o=r+i+n+a,h=s[0]-e[0];if(Math.abs(h)>o)return!1;const c=s[1]-e[1];if(Math.abs(c)>o)return!1;const d=s[2]-e[2];if(Math.abs(d)>o)return!1;const f=-s[6],u=-s[7],l=-s[8],m=u*d-l*c,_=l*h-f*d,g=f*c-u*h,p=u*g-l*_,b=l*m-f*g,M=f*_-u*m,j=2*s[9],S=Math.abs(h+m*j+2*p),z=Math.abs(c+_*j+2*b),x=Math.abs(d+g*j+2*M),y=S-Math.min(S,r),C=z-Math.min(z,i),q=x-Math.min(x,n);return y*y+C*C+q*q<=a*a}intersectSphereWithMBS(t,e=this.radius){const a=this._data,{center:s,radius:r}=t,i=e+r,n=a[0]-s[0];if(n>i)return!1;const o=a[1]-s[1];if(o>i)return!1;const h=a[2]-s[2];if(h>i)return!1;if(n*n+o*o+h*h>i*i)return!1;const c=-a[6],d=-a[7],f=-a[8],u=d*h-f*o,l=f*n-c*h,m=c*o-d*n,_=d*m-f*l,g=f*u-c*m,p=c*l-d*u,b=2*a[9],M=Math.abs(n+u*b+2*_),j=Math.abs(o+l*b+2*g),S=Math.abs(h+m*b+2*p),z=M-Math.min(M,a[3]),x=j-Math.min(j,a[4]),y=S-Math.min(S,a[5]);return z*z+x*x+y*y<r*r}intersectPlane(t){const e=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],a=this.projectedRadius(k(t));return e>a?1:e<-a?-1:0}intersectRay(t,e,a=0){const s=this._data,r=G;r[0]=-s[6],r[1]=-s[7],r[2]=-s[8],r[3]=s[9],E[0]=t[0]-s[0],E[1]=t[1]-s[1],E[2]=t[2]-s[2];const i=d(E,E,G),n=d(I,e,G);let o=-1/0,h=1/0;const c=this.getHalfSize(ct);for(let d=0;d<3;d++){const t=i[d],e=n[d],s=c[d]+a;if(Math.abs(e)>1e-6){const a=(s-t)/e,r=(-s-t)/e;o=Math.max(o,Math.min(a,r)),h=Math.min(h,Math.max(a,r))}else if(t>s||t<-s)return!1}return o<=h}projectedArea(a,s,r,n){const o=this.getQuaternion(O);i(G,o),E[0]=a[0]-this._data[0],E[1]=a[1]-this._data[1],E[2]=a[2]-this._data[2],d(E,E,G);const h=this.getHalfSize(ct),f=E[0]<-h[0]?-1:E[0]>h[0]?1:0,u=E[1]<-h[1]?-1:E[1]>h[1]?1:0,l=E[2]<-h[2]?-1:E[2]>h[2]?1:0,m=Math.abs(f)+Math.abs(u)+Math.abs(l);if(0===m)return 1/0;const p=1===m?4:6,b=6*(f+3*u+9*l+13);t(dt,o),e(dt,dt,h);const M=this.getCenter(ot);for(let t=0;t<p;t++){const e=K[b+t];c(E,((1&e)<<1)-1,(2&e)-1,((4&e)>>1)-1),_(E,E,dt),g(J,M,E),J[3]=1,Q(J,J,s);const a=1/Math.max(1e-6,J[3]);V[2*t]=J[0]*a,V[2*t+1]=J[1]*a}const j=2*p-2;let S=V[0]*(V[3]-V[j+1])+V[j]*(V[1]-V[j-1]);for(let t=2;t<j;t+=2)S+=V[t]*(V[t+3]-V[t-1]);return Math.abs(S)*r*n*.125}projectedRadius(t){const e=this.getQuaternion(O);return i(G,e),d(E,t,G),Math.abs(E[0]*this._data[3])+Math.abs(E[1]*this._data[4])+Math.abs(E[2]*this._data[5])}minimumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]-this.projectedRadius(k(t))}maximumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]+this.projectedRadius(k(t))}toAaBoundingBox(e){const a=this.getQuaternion(O),s=t(dt,a),r=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),i=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);e[0]=this._data[0]-r,e[1]=this._data[1]-i,e[2]=this._data[2]-n,e[3]=this._data[0]+r,e[4]=this._data[1]+i,e[5]=this._data[2]+n}transform(t,e,a,s=0,r=w(a),i=w(e),n=F(e,i)){if(a===r)e.isGeographic?st(this,t,e,s,i):at(this,t,e,s,i,n);else if(e.isGeographic&&(a.isWebMercator||B(a)))$(e,this,a,t,s);else if(e.isWebMercator&&B(a))tt(e,this,a,t,s);else{const r=this.getCenter(ot);r[2]+=s,H(r,e,0,r,a,0),t.center=r,this!==t&&(t.quaternion=this.getQuaternion(O),t.halfSize=this.getHalfSize(ct))}}}const G=h(),O=h(),T=h(),E=A(),I=A(),J=R();function N(t,e=new Y){return W(t,e),e}const V=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],K=(()=>{const t=new Int8Array(162);let e=0;const a=a=>{for(let s=0;s<a.length;s++)t[e+s]=a[s];e+=6};return a([6,2,3,1,5,4]),a([0,2,3,1,5,4]),a([0,2,3,7,5,4]),a([0,1,3,2,6,4]),a([0,1,3,2,0,0]),a([0,1,5,7,3,2]),a([0,1,3,7,6,4]),a([0,1,3,7,6,2]),a([0,1,5,7,6,2]),a([0,1,5,4,6,2]),a([0,1,5,4,0,0]),a([0,1,3,7,5,4]),a([0,2,6,4,0,0]),a([0,0,0,0,0,0]),a([1,3,7,5,0,0]),a([2,3,7,6,4,0]),a([2,3,7,6,0,0]),a([2,3,1,5,7,6]),a([0,1,5,7,6,2]),a([0,1,5,7,6,4]),a([0,1,3,7,6,4]),a([4,5,7,6,2,0]),a([4,5,7,6,0,0]),a([4,5,1,3,7,6]),a([0,2,3,7,5,4]),a([6,2,3,7,5,4]),a([6,2,3,1,5,4]),t})();function L(t,e,a,s,r){const n=t.getQuaternion(O);r.quaternion=n,i(G,n);const o=t.getCenter(ot),h=t.getHalfSize(ct);if(1===s){d(mt,o,G),b(_t,mt),j(gt,_t,h),p(gt,_t,gt);const s=S(gt);g(gt,_t,h);const i=S(gt);if(s<a)r.center=o,c(mt,a,a,a),r.halfSize=g(mt,h,mt);else{const n=i>0?1+e/i:1,o=s>0?1+a/s:1,c=(o+n)/2,f=(o-n)/2;m(gt,_t,f),r.halfSize=z(gt,gt,h,c),m(gt,_t,c),z(gt,gt,h,f),x(mt,mt),y(mt,gt,mt);const u=t.getQuaternion(T);r.center=d(mt,mt,u)}}else{r.center=z(mt,o,P,(a+e)/2);const t=d(mt,P,G);b(t,t),r.halfSize=z(_t,h,t,(a-e)/2)}return r}function $(t,e,a,s,r){e.getCenter(ot),ot[2]+=r;const i=w(a);H(ot,t,0,ot,i,0),et(i,e,ot,a,s)}function tt(t,e,a,s,r){e.getCenter(ot),ot[2]+=r,et(t,e,ot,a,s)}function et(e,a,s,r,i){const n=a.getQuaternion(O),o=t(dt,n),h=a.getHalfSize(ct);for(let t=0;t<8;++t){for(let e=0;e<3;++e)nt[e]=h[e]*(t&1<<e?-1:1);for(let e=0;e<3;++e){let a=s[e];for(let t=0;t<3;++t)a+=nt[t]*o[3*t+e];rt[3*t+e]=a}}H(rt,e,0,rt,r,0,8),N(it,i)}function at(t,e,a,s,r=w(a),o=F(a,r)){t.getCorners(ut),t.getCenter(nt),nt[2]+=s,D(a,nt,ft,r),e.setCenter(ft[12],ft[13],ft[14]);const h=2*Math.sqrt(1+ft[0]+ft[5]+ft[10]);G[0]=(ft[6]-ft[9])/h,G[1]=(ft[8]-ft[2])/h,G[2]=(ft[1]-ft[4])/h,G[3]=.25*h;const f=t.getQuaternion(O);e.quaternion=n(G,G,f),i(G,G),c(_t,0,0,0);const u=e.getCenter(ht);for(const i of ut)i[2]+=s,o(i,0,i,0),p(mt,i,u),d(mt,mt,G),b(mt,mt),M(_t,_t,mt);e.halfSize=_t}function st(t,e,a,s,r=w(a)){const n=v(a),o=1+Math.max(0,s)/(n.radius+t.centerZ);t.getCenter(nt),nt[2]+=s,H(nt,a,0,nt,r,0),e.center=nt;const h=t.getQuaternion(O);e.quaternion=h,i(G,h),c(mt,0,0,1),d(mt,mt,G);const f=t.getHalfSize(ct);c(mt,f[0]*Math.abs(mt[0]),f[1]*Math.abs(mt[1]),f[2]*Math.abs(mt[2])),m(mt,mt,n.inverseFlattening),g(mt,f,mt),e.halfSize=m(mt,mt,o)}const rt=new Array(24),it=new X(rt,3),nt=A(),ot=A(),ht=A(),ct=A(),dt=a(),ft=s(),ut=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],lt=[A(),A(),A()],mt=A(),_t=A(),gt=A(),pt=q(-1,-1,-1);function bt(t){return Array.from(t)}const Mt=A(),jt=[0,0,0];export{Y as Obb,N as compute,L as computeOffsetObb,bt as ensurePackedObbData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as O,fallsWithinLayerView as P,sortTiles as w,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as S}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as U}from"../webgl-engine/materials/DrawParameters.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as I}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as N}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as L}from"../../webgl/enums.js";const V=7,z=10,H=200,Q=p();let W=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new U,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new O,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[6,()=>6===this._desiredSlot],[8,()=>8===this._desiredSlot],[10,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new N(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}get _oitEnabled(){return this._stage.renderer.oitEnabled}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(P(e,i)!==P(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-V,i=Math.max(0,Math.floor((e.level-t)/V)*V);if(this._isGlobal&&0===i)return h;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=Z,n=J;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,h=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(Q,v.boundingBox);const O=_.localOrigin;null!=g&&(g.localOrigin=O,g.applyToAabb(Q));const P=Q;if(K[0]=i[0]-O[0],K[1]=i[1]-O[1],K[2]=i[2]-O[2],!j(P,K,n,f,b))return;const w=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},D=(n,o,c)=>{if((!T||null!=c)&&n>=0&&(x.backfacesTerrain||d(c,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==h.distance||n<h.distance)&&w(h,n,c),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),w(p,n,c),e.results.all.push(p)):n<p.distance&&w(p,n,c)),(null==a.distance||n<a.distance)&&w(a,n,c),0!==x.store&&(null==l.distance||n>l.distance)&&w(l,n,c)}},S=X;o(S,r,O);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),U=new E(G.typedBuffer,3,M.stride/4),k=q/3;if(!g&&k>H){const e=c.renderData;e.intersectionData??=new A(B,k,U),e.intersectionData.intersectRay(K,S,R,D)}else C(K,S,0,k,B,U,g,R,D)},O=this._rootTiles;if(null!=O){(()=>{const t=this._tileIterator;t.reset(O);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return this._oitEnabled?8:6;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillEnabled:r,slot:s,hasEmission:n,hasFloatOit:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(10===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=o.hasEmission=!1,o.overlayMode=this._overlayRenderer.mode,o.hasFloatOit=a.value,e.output){case 0:case 1:case 2:{const{ssr:i,clouds:r,ssao:a}=e.bind;o.screenSpaceReflections=null!=i.lastFrameColor,o.cloudReflections=null!=r.data;const l=10===s;return o.receiveShadows=t.ready&&!l,o.renderOccluded=l,o.receiveAmbientOcclusion=!l&&null!=a,o.hasEmission=n,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=S(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],L.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=10===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",h),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:h;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?L.LINES:L.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const i=d[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of d){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:d,bind:h}=e;s&&(t.useStencil=this._useStencilForTile(i),d.setPipelineState(t.getPipeline(h)));const u=a.geometry.indexCount;d.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),d.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(I,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],W.prototype,"visibleTiles",null),e([a({readOnly:!0})],W.prototype,"_isGlobal",null),e([a()],W.prototype,"renderOccludedFlags",null),e([a({value:!1})],W.prototype,"renderingDisabled",null),e([a({value:!0})],W.prototype,"visible",null),e([a()],W.prototype,"renderPatchBorders",null),e([a()],W.prototype,"wireframe",null),W=e([l("esri.views.3d.terrain.TerrainRenderer")],W);const Z=_(),J=_(),K=_(),X=_();export{W as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as O,sortTiles as w,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as S}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as U}from"../webgl-engine/materials/DrawParameters.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as I}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as N}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as L}from"../../webgl/enums.js";const V=7,z=10,H=200,Q=p();let W=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new U,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[6,()=>6===this._desiredSlot],[8,()=>8===this._desiredSlot],[10,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new N(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}get _oitEnabled(){return this._stage.renderer.oitEnabled}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(O(e,i)!==O(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-V,i=Math.max(0,Math.floor((e.level-t)/V)*V);if(this._isGlobal&&0===i)return h;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=Z,n=J;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,h=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(Q,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(Q));const O=Q;if(K[0]=i[0]-P[0],K[1]=i[1]-P[1],K[2]=i[2]-P[2],!j(O,K,n,f,b))return;const w=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},D=(n,o,c)=>{if((!T||null!=c)&&n>=0&&(x.backfacesTerrain||d(c,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==h.distance||n<h.distance)&&w(h,n,c),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),w(p,n,c),e.results.all.push(p)):n<p.distance&&w(p,n,c)),(null==a.distance||n<a.distance)&&w(a,n,c),0!==x.store&&(null==l.distance||n>l.distance)&&w(l,n,c)}},S=X;o(S,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),U=new E(G.typedBuffer,3,M.stride/4),k=q/3;if(!g&&k>H){const e=c.renderData;e.intersectionData??=new A(B,k,U),e.intersectionData.intersectRay(K,S,R,D)}else C(K,S,0,k,B,U,g,R,D)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return this._oitEnabled?8:6;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(10===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=o.hasEmission=!1,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const{ssr:i,clouds:r,ssao:a}=e.bind;o.screenSpaceReflections=null!=i.lastFrameColor,o.cloudReflections=null!=r.data;const l=10===s;return o.receiveShadows=t.ready&&!l,o.renderOccluded=l,o.receiveAmbientOcclusion=!l&&null!=a,o.hasEmission=n,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=S(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],L.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=10===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",h),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:h;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?L.LINES:L.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const i=d[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of d){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:d,bind:h}=e;s&&(t.useStencil=this._useStencilForTile(i),d.setPipelineState(t.getPipeline(h)));const u=a.geometry.indexCount;d.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),d.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(I,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],W.prototype,"visibleTiles",null),e([a({readOnly:!0})],W.prototype,"_isGlobal",null),e([a()],W.prototype,"renderOccludedFlags",null),e([a({value:!1})],W.prototype,"renderingDisabled",null),e([a({value:!0})],W.prototype,"visible",null),e([a()],W.prototype,"renderPatchBorders",null),e([a()],W.prototype,"wireframe",null),W=e([l("esri.views.3d.terrain.TerrainRenderer")],W);const Z=_(),J=_(),K=_(),X=_();export{W as TerrainRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as o}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as n}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as c}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as l}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";import d from"../../webgl/Texture.js";const _=()=>e.getLogger("esri.views.3d.terrain");class f{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._blendConfiguration=new o,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=l(this._rctx,1),this._bindParameters=new c(e,null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=!1,o=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=r,this._blendConfiguration.premultipliedAlphaSource=i,this._blendConfiguration.background=o,this._techniques.precompile(s,this._blendConfiguration),this._techniques.get(s,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(u.TRIANGLE_STRIP,0,this._vao.vertexCount("geometry"))}drawGroup(e,t,r,i,s=!0){1===t&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture,null==e.fboTexture&&(e.fboTexture=this._rctx.emptyTexture)),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const o=e.baseOpacity<1,n=this._acquireBlendTechnique(i,t,o,s),a=this._rctx.bindTechnique(n,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=!1){if(null==e.texture)return;const o=e.baseOpacity<1;e.fboTexture=4===t||0===i&&!o&&!s?null:this.switch(r).colorTexture,e.fboTexture??=this._rctx.emptyTexture;const n=this._acquireBlendTechnique(i,t,o,s),a=this._rctx.bindTechnique(n,this._bindParameters,e);this._render(a)}drawRasterData(e,t,r,i,s){const o=s.sourceLayerInfo.data;if(!o.source)return;if(s.tile.surface.layerViewByIndex(s.layerIndex,1).ensureSymbolizerParameters(o),!o.bind(this._rctx))return;const n=e.baseOpacity<1;e.fboTexture=0!==i||n?this.switch(r).colorTexture:null;const a=this._acquireRasterTechnique(o,t,i,n);if(!a)return;o.opacity=e.opacity;const h=o.getUniforms(this._rctx);h.scale=s.scale,h.offset=s.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const c=this._rctx.bindTechnique(a,this._bindParameters,h);this._render(c)}_acquireRasterTechnique(e,t,r,i){if(!this._rctx.capabilities.colorBufferFloat)return null;const s=e.symbolizerParameters,o=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterConfiguration??=new a,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.applyBaseOpacity=i,this._rasterConfiguration.colorizerType=o,this._rasterConfiguration.applyColormap=!!s.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?0:1,this._techniques.precompile(n,this._rasterConfiguration),this._techniques.get(n,this._rasterConfiguration)}drawVectorData(e,t,i,s,o,n,a,c){const l=this._rctx,u=o.sourceLayerInfo.data,d=o.tile.surface.layerViewByIndex(o.layerIndex,1),f=e.baseOpacity<1,p=f||e.opacity<1||0!==s||1!==t,b=p,g=this._acquireBlendTechnique(s,t,f,b);l.setPipelineState(g.getPipeline(this._bindParameters));let m=null,x=null;p?(x=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new h(this._rctx)),m=this._vtFBO.get(i),l.bindFramebuffer(m),this._clearCurrentFBO()):c&&l.clear(256);try{this._vectorTileHelper.renderBackground(l,o.sourceLod,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/o.scale),o.offset,a,n,d.contentZoom),u&&this._vectorTileHelper.renderContent(l,o.sourceLod,u,o.vtlNeighborInfos,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/o.scale),o.offset,a,n,d.contentZoom)}catch(T){_().warnOnce("A render call containing vector tiles did not resolve correctly.",T)}return!m||(l.bindFramebuffer(x),e.texture=m.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,b),c)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,d.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(3553,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,d.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new h(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{f as TileCompositor};
2
+ import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as n}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as o}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as c}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as l}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";import d from"../../webgl/Texture.js";const _=()=>e.getLogger("esri.views.3d.terrain");class f{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._blendConfiguration=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=l(this._rctx,1),this._bindParameters=new c(e,null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=!1,n=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=r,this._blendConfiguration.premultipliedAlphaSource=i,this._blendConfiguration.background=n,this._techniques.precompile(s,this._blendConfiguration),this._techniques.get(s,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(u.TRIANGLE_STRIP,0,this._vao.vertexCount("geometry"))}drawGroup(e,t,r,i,s=!0){1===t&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const n=e.baseOpacity<1,o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=!1){if(null==e.texture)return;const n=e.baseOpacity<1;e.fboTexture=(4===t||0===i&&!n&&!s?null:this.switch(r).colorTexture)??this._rctx.emptyTexture;const o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawRasterData(e,t,r,i,s){const n=s.sourceLayerInfo.data;if(!n.source)return;if(s.tile.surface.layerViewByIndex(s.layerIndex,1).ensureSymbolizerParameters(n),!n.bind(this._rctx))return;const o=e.baseOpacity<1;e.fboTexture=(0!==i||o?this.switch(r).colorTexture:null)??this._rctx.emptyTexture;const a=this._acquireRasterTechnique(n,t,i,o);if(!a)return;n.opacity=e.opacity;const h=n.getUniforms(this._rctx);h.scale=s.scale,h.offset=s.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const c=this._rctx.bindTechnique(a,this._bindParameters,h);this._render(c)}_acquireRasterTechnique(e,t,r,i){if(!this._rctx.capabilities.colorBufferFloat)return null;const s=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterConfiguration??=new a,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.applyBaseOpacity=i,this._rasterConfiguration.colorizerType=n,this._rasterConfiguration.applyColormap=!!s.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?0:1,this._techniques.precompile(o,this._rasterConfiguration),this._techniques.get(o,this._rasterConfiguration)}drawVectorData(e,t,i,s,n,o,a,c){const l=this._rctx,u=n.sourceLayerInfo.data,d=n.tile.surface.layerViewByIndex(n.layerIndex,1),f=e.baseOpacity<1,p=f||e.opacity<1||0!==s||1!==t,b=p,m=this._acquireBlendTechnique(s,t,f,b);l.setPipelineState(m.getPipeline(this._bindParameters));let g=null,x=null;p?(x=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new h(this._rctx)),g=this._vtFBO.get(i),l.bindFramebuffer(g),this._clearCurrentFBO()):c&&l.clear(256);try{this._vectorTileHelper.renderBackground(l,n.sourceLod,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom),u&&this._vectorTileHelper.renderContent(l,n.sourceLod,u,n.vtlNeighborInfos,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom)}catch(T){_().warnOnce("A render call containing vector tiles did not resolve correctly.",T)}return!g||(l.bindFramebuffer(x),e.texture=g.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,b),c)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,d.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(3553,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,d.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new h(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{f as TileCompositor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as m}from"../../../../../geometry/support/Indices.js";import{c as h}from"../../../../../chunks/vec3.js";import{c as p}from"../../../../../chunks/vec32.js";import{ComponentData as g}from"./ComponentData.js";import{defaultComponentParameters as d,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as v,Renderable as _}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as j}from"./RenderSubmitSystem.js";import{ComponentMaterialRepository as C}from"./Material/ComponentMaterialRepository.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as M}from"../../lib/verticalOffsetUtils.js";import{BufferManager as O}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as R,IndexGlLayout as x}from"../../materials/DefaultLayouts.js";import{BufferObject as A}from"../../../../webgl/BufferObject.js";import{PrimitiveType as D}from"../../../../webgl/enums.js";import{SamplerRepository as E}from"../../../../webgl/Sampler.js";import{VertexBuffer as H}from"../../../../webgl/VertexBuffer.js";const B=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let V=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new j(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new O(r,R());const l=2===this._viewingMode?0:i?1:2;this.materials=new C(a,l),this.samplers=new E(r.gl),this.addHandles(o(()=>a.hasFloatOit.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new g(this._componentBufferManager,m(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,o,s);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t}=e;this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,s=o.componentData.verticalOffsets;if(n||null==s)return i;const r=s[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=M(r);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:s}=o,r=s.count,{verticalOffsets:a}=s,{intersectionGeometry:l}=o,c=2===this._viewingMode,m=l.getComponentAabbs(),h=I;let p=1/0,g=-1/0;for(let d=0;d<r;d++){const e=6*d,s=a?.[d]??0;let r=1/0,l=-1/0;if(c)r=m[e+2]+s+t,l=m[e+5]+s+t;else{if(h[0]=m[e],h[1]=m[e+1],h[2]=m[e+2],h[3]=m[e+3],h[4]=m[e+4],h[5]=m[e+5],0!==s){const e=M(s);e.localOrigin=o.transform.position,e.applyToAabb(h)}const r=Math.max(Math.abs(h[3]),Math.abs(h[0])),a=Math.max(Math.abs(h[4]),Math.abs(h[1])),l=t+h[5]+i;n.expandElevationRangeValues(t+h[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),p=Math.min(p,r),g=Math.max(g,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=g}intersect(e,t,i,n,o,s){const r=e,{transform:a,componentData:l,intersectionGeometry:c}=r;return null!=n&&(n.localOrigin=a.position),c.intersect(t,i,n,l.verticalOffsets,a,o,s)}addEdges(e,t,i,n,o){const s=e,{indices:r,positions:a}=s.intersectionGeometry,l=s.componentData.offsets;return t.addComponentObject(s,a,r,l,i,n,o)}async extractEdgeInformation(e,t,i){const n=e,o=n.componentData.visibility;if(o.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:c}=await import("../../lib/edgeRendering/bufferLayouts.js"),m=c.createBuffer(r.length/3);p(m.position.typedBuffer,r,m.position.typedBufferStride,3),h(m.position,m.position,n.transform.rotationScale),this._setComponentIndices(m.componentIndex,s,a);const g=m.count,d=this._computeVisibilityIndices(s,o,a,g);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:d,indicesLength:d.length,skipDeduplicate:!0,data:m,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const s=i[o],r=i[o+1];for(let i=s;i<r;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let o=0;t.forEachComponentRange((e,t)=>(o+=i[t]-i[e],!0));const s=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(o):new Uint32Array(o):new Array(o);let a=0;return t.forEachComponentRange((t,n)=>{const o=i[t],r=i[n];for(let i=o;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addHighlight(e,t,i){const n=e,o=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,o+1);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)B().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&B().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,o=e.geometry,s=o.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=o.renderGeometryData,c=new H(n,s,r),m=a?A.createIndex(n,35044,a):null;let h=0;const p=[["geometry",c]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],o=i.offsets[n+1],s=i.materialDataIndices[n];if(null!=a)for(let i=t;i<o;i++){e[a[i]]=s}else for(let i=t;i<o;i++)e[i]=s}const t=new H(n,x,e.buffer);h+=t.usedMemory,p.push(["componentIndices",t])}const g=new w(n,new Map(p),m),u=new y(g,D.TRIANGLES,o.parameters,null!=m),b=this.materials.acquire(t,u.parameters,d),j=new v(c.usedMemory+h+(m?.usedMemory??0)),C=this.samplers.addFromTexture(t.baseColorTexture?.texture),M=new f(e,t,C);return new _(b,M,u,j)}_requestRender(){this._renderPassManager.requestRender()}};V=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],V);const I=c();export{V as ComponentObjectCollection};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as m}from"../../../../../geometry/support/Indices.js";import{c as h}from"../../../../../chunks/vec3.js";import{c as p}from"../../../../../chunks/vec32.js";import{ComponentData as d}from"./ComponentData.js";import{defaultComponentParameters as g,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as v,Renderable as _}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as j}from"./RenderSubmitSystem.js";import{ComponentMaterialRepository as C}from"./Material/ComponentMaterialRepository.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as M}from"../../lib/verticalOffsetUtils.js";import{BufferManager as R}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as O,IndexGlLayout as x}from"../../materials/DefaultLayouts.js";import{BufferObject as A}from"../../../../webgl/BufferObject.js";import{PrimitiveType as D}from"../../../../webgl/enums.js";import{SamplerRepository as E}from"../../../../webgl/Sampler.js";import{VertexBuffer as B}from"../../../../webgl/VertexBuffer.js";const H=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let V=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new j(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new R(r,O());const l=2===this._viewingMode?0:i?1:2;this.materials=new C(a,l),this.samplers=new E(r.gl),this.addHandles(o(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new d(this._componentBufferManager,m(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,o,s);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t}=e;this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,s=o.componentData.verticalOffsets;if(n||null==s)return i;const r=s[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=M(r);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:s}=o,r=s.count,{verticalOffsets:a}=s,{intersectionGeometry:l}=o,c=2===this._viewingMode,m=l.getComponentAabbs(),h=I;let p=1/0,d=-1/0;for(let g=0;g<r;g++){const e=6*g,s=a?.[g]??0;let r=1/0,l=-1/0;if(c)r=m[e+2]+s+t,l=m[e+5]+s+t;else{if(h[0]=m[e],h[1]=m[e+1],h[2]=m[e+2],h[3]=m[e+3],h[4]=m[e+4],h[5]=m[e+5],0!==s){const e=M(s);e.localOrigin=o.transform.position,e.applyToAabb(h)}const r=Math.max(Math.abs(h[3]),Math.abs(h[0])),a=Math.max(Math.abs(h[4]),Math.abs(h[1])),l=t+h[5]+i;n.expandElevationRangeValues(t+h[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),p=Math.min(p,r),d=Math.max(d,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=d}intersect(e,t,i,n,o,s){const r=e,{transform:a,componentData:l,intersectionGeometry:c}=r;return null!=n&&(n.localOrigin=a.position),c.intersect(t,i,n,l.verticalOffsets,a,o,s)}addEdges(e,t,i,n,o){const s=e,{indices:r,positions:a}=s.intersectionGeometry,l=s.componentData.offsets;return t.addComponentObject(s,a,r,l,i,n,o)}async extractEdgeInformation(e,t,i){const n=e,o=n.componentData.visibility;if(o.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:c}=await import("../../lib/edgeRendering/bufferLayouts.js"),m=c.createBuffer(r.length/3);p(m.position.typedBuffer,r,m.position.typedBufferStride,3),h(m.position,m.position,n.transform.rotationScale),this._setComponentIndices(m.componentIndex,s,a);const d=m.count,g=this._computeVisibilityIndices(s,o,a,d);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:g,indicesLength:g.length,skipDeduplicate:!0,data:m,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const s=i[o],r=i[o+1];for(let i=s;i<r;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let o=0;t.forEachComponentRange((e,t)=>(o+=i[t]-i[e],!0));const s=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(o):new Uint32Array(o):new Array(o);let a=0;return t.forEachComponentRange((t,n)=>{const o=i[t],r=i[n];for(let i=o;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addHighlight(e,t,i){const n=e,o=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,o+1);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)H().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&H().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,o=e.geometry,s=o.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=o.renderGeometryData,c=new B(n,s,r),m=a?A.createIndex(n,35044,a):null;let h=0;const p=[["geometry",c]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],o=i.offsets[n+1],s=i.materialDataIndices[n];if(null!=a)for(let i=t;i<o;i++){e[a[i]]=s}else for(let i=t;i<o;i++)e[i]=s}const t=new B(n,x,e.buffer);h+=t.usedMemory,p.push(["componentIndices",t])}const d=new w(n,new Map(p),m),u=new y(d,D.TRIANGLES,o.parameters,null!=m),b=this.materials.acquire(t,u.parameters,g),j=new v(c.usedMemory+h+(m?.usedMemory??0)),C=this.samplers.addFromTexture(t.baseColorTexture?.texture),M=new f(e,t,C);return new _(b,M,u,j)}_requestRender(){this._renderPassManager.requestRender()}};V=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],V);const I=c();export{V as ComponentObjectCollection};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../../../core/has.js";class s{constructor(s,i){this._bind=s,this.sphericalSR=i,this._hasOIT8Emissive=!has("disable-feature:oit8-emissive")}get hasEmissionSupport(){return this.hasFloatOit||this._hasOIT8Emissive}get hasFloatOit(){return this._bind.hasFloatOit.value}}export{s as ComponentMaterialGlobalParameters};
2
+ import has from"../../../../../../core/has.js";class s{constructor(s,i){this._bind=s,this.sphericalSR=i,this._hasEmissiveOIT8Bit=!has("disable-feature:emissive-8bit")}get hasEmissionSupport(){return this.useFloatBlend||this._hasEmissiveOIT8Bit}get useFloatBlend(){return this._bind.useFloatBlend.value}}export{s as ComponentMaterialGlobalParameters};