@arcgis/core 4.33.0-next.20250326 → 4.33.0-next.20250328

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 (319) hide show
  1. package/applications/Components/viewUtils.d.ts +3 -0
  2. package/applications/Components/viewUtils.js +5 -0
  3. package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +1 -0
  4. package/applications/KnowledgeStudio/layerInternalAccessUtils.js +1 -1
  5. package/arcade/arcadeAsyncRuntime.js +1 -1
  6. package/arcade/arcadeCompiler.js +1 -1
  7. package/arcade/arcadeRuntime.js +1 -1
  8. package/arcade/functions/date.js +1 -1
  9. package/arcade/functions/feature.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/featuresetgeom.js +1 -1
  12. package/arcade/functions/featuresetstats.js +1 -1
  13. package/arcade/functions/featuresetstring.js +1 -1
  14. package/arcade/functions/geomasync.js +1 -1
  15. package/arcade/functions/geometry.js +1 -1
  16. package/arcade/functions/geomsync.js +1 -1
  17. package/arcade/functions/knowledgegraph.js +1 -1
  18. package/arcade/functions/maths.js +1 -1
  19. package/arcade/functions/stats.js +1 -1
  20. package/arcade/functions/string.js +1 -1
  21. package/arcade/geometry/functions.js +1 -1
  22. package/arcade/languageUtils.js +1 -1
  23. package/assets/esri/core/workers/RemoteClient.js +1 -1
  24. package/assets/esri/core/workers/chunks/08ea652b7896c1da022d.js +1 -0
  25. package/assets/esri/core/workers/chunks/{66cae76da0582cfa8656.js → 0943695a1dcd21c45e83.js} +1 -1
  26. package/assets/esri/core/workers/chunks/09ca64184bed6abafcd9.js +1 -0
  27. package/assets/esri/core/workers/chunks/{c6bcfa99fb222894fa0e.js → 0a0e5d699ddb7052c5c0.js} +1 -1
  28. package/assets/esri/core/workers/chunks/0a675f9f69b8b13b7443.js +1 -0
  29. package/assets/esri/core/workers/chunks/0eed612e82a279ac8d1e.js +1 -0
  30. package/assets/esri/core/workers/chunks/{cbe22c58b3230b12b31a.js → 13ad4ee2e064d13ca34d.js} +1 -1
  31. package/assets/esri/core/workers/chunks/176e7c7c2a871bcb512e.js +1 -0
  32. package/assets/esri/core/workers/chunks/18d0fe269531b951e309.js +1 -0
  33. package/assets/esri/core/workers/chunks/201db423e3c6f947b77c.js +1 -0
  34. package/assets/esri/core/workers/chunks/213e82a7e3fa5b253ec1.js +1 -0
  35. package/assets/esri/core/workers/chunks/{22618753349eb9d8b3df.js → 222446da9cb58c3c3b7e.js} +1 -1
  36. package/assets/esri/core/workers/chunks/277b61af8982092a4c81.js +1 -0
  37. package/assets/esri/core/workers/chunks/2b07bdb6c4c4a5b2f968.js +1 -0
  38. package/assets/esri/core/workers/chunks/2bda2cfc6e81818d7d33.js +1 -0
  39. package/assets/esri/core/workers/chunks/2cbab0c078d0b844934c.js +1 -0
  40. package/assets/esri/core/workers/chunks/{a68b48fd1a529f69705e.js → 2fcfc21ba38d9919730a.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{193b4fecdfee927d6200.js → 37e4f588a6896f98bce3.js} +1 -1
  42. package/assets/esri/core/workers/chunks/392e64a573f67817db02.js +1 -0
  43. package/assets/esri/core/workers/chunks/3a743653b786b010a57f.js +1 -0
  44. package/assets/esri/core/workers/chunks/3be007f32ea1e18b8b3b.js +1 -0
  45. package/assets/esri/core/workers/chunks/451555af283b32a10fef.js +1 -0
  46. package/assets/esri/core/workers/chunks/{835fa4484c58d9b31c78.js → 460afde071df9f35182d.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{26bedec014488e1fc5e4.js → 4816cf647eca2f4cecc2.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{09c9e4e94f09ba9f4c22.js → 4aa0a58ded4465ea28bd.js} +1 -1
  49. package/assets/esri/core/workers/chunks/4d02e211967384994e5e.js +1 -0
  50. package/assets/esri/core/workers/chunks/4d798da25a726f179089.js +319 -0
  51. package/assets/esri/core/workers/chunks/51339193abddfe37745d.js +1 -0
  52. package/assets/esri/core/workers/chunks/{0a98dc3ea67ce97a6e7b.js → 5269793822e41dd07fe1.js} +1 -1
  53. package/assets/esri/core/workers/chunks/52d160cb7921ae7a4f57.js +1 -0
  54. package/assets/esri/core/workers/chunks/{630a9afdf0523c27ddb6.js → 555c95b149e3a82a4460.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{eab1e3c101158675abba.js → 5660f479c005149bce8d.js} +1 -1
  56. package/assets/esri/core/workers/chunks/5a51c75a2932d9da001a.js +1 -0
  57. package/assets/esri/core/workers/chunks/{37a3533f004bf2e888da.js → 5d01f0b86566d08ba29d.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{0576b035c1654a43ad5c.js → 5de3aee547113bfd59df.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{45eee326f7a649c5a15b.js → 626db8488f9d931cf55c.js} +2 -2
  60. package/assets/esri/core/workers/chunks/{5a6f7360183693f8490d.js → 6339a24874c698594101.js} +1 -1
  61. package/assets/esri/core/workers/chunks/63dade3e1cc7f5b76846.js +1 -0
  62. package/assets/esri/core/workers/chunks/6c378e7a6ca29d530880.js +1 -0
  63. package/assets/esri/core/workers/chunks/71e46e866c23372b0b58.js +1 -0
  64. package/assets/esri/core/workers/chunks/{c591527543fd75a917d4.js → 72c7126dbd27fa48fcdb.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{d459c790a3b89ac53d2d.js → 759c12b0715279e3c0f6.js} +1 -1
  66. package/assets/esri/core/workers/chunks/75a04b073231da70c18d.js +1 -0
  67. package/assets/esri/core/workers/chunks/75fa861b5757551f8fdc.js +1 -0
  68. package/assets/esri/core/workers/chunks/7655be1470ce39f0e494.js +1 -0
  69. package/assets/esri/core/workers/chunks/796cf1c2ca9955595836.js +1 -0
  70. package/assets/esri/core/workers/chunks/79c4f10da8360ee60cd2.js +1 -0
  71. package/assets/esri/core/workers/chunks/{49c346d2fb8538990f45.js → 7d1c39c2a80e20a0595f.js} +1 -1
  72. package/assets/esri/core/workers/chunks/7f36cffc6ed984b7e467.js +1 -0
  73. package/assets/esri/core/workers/chunks/{fa3eeb40e2d732c184d8.js → 7f8c7e3e41e51ab4d612.js} +1 -1
  74. package/assets/esri/core/workers/chunks/80aaf31c8eec3cff2add.js +1 -0
  75. package/assets/esri/core/workers/chunks/82353e59ac6d909dcf41.js +1 -0
  76. package/assets/esri/core/workers/chunks/84d301e1b6b0d0b48f51.js +1 -0
  77. package/assets/esri/core/workers/chunks/86931186095c23e47c0c.js +1 -0
  78. package/assets/esri/core/workers/chunks/86ee278919038260696e.js +39 -0
  79. package/assets/esri/core/workers/chunks/{4496ef270c700078df0c.js → 8752f807c05d1ec215e8.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{59e4e780dcdfed555ca5.js → 8ef5e6f1c606e5e41002.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{55c7c51e56d72f507c22.js → 90afead317186b31b2f9.js} +1 -1
  82. package/assets/esri/core/workers/chunks/90c893959145827961ac.js +1 -0
  83. package/assets/esri/core/workers/chunks/931275cfa2c55eb0f504.js +1 -0
  84. package/assets/esri/core/workers/chunks/{7e0e9ca84490a0c67197.js → 98da74243df03e0cc70d.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{354117429b3a0a0794c9.js → 999e8dbe6f4d0665b3ab.js} +1 -1
  86. package/assets/esri/core/workers/chunks/9c59fc2df8081e65a128.js +1 -0
  87. package/assets/esri/core/workers/chunks/a348ff2dd936c6bf9399.js +1 -0
  88. package/assets/esri/core/workers/chunks/a53e9f5092de715da025.js +1 -0
  89. package/assets/esri/core/workers/chunks/a9b6377f1fef5826f28d.js +1 -0
  90. package/assets/esri/core/workers/chunks/{8063e35dacf8f99471d8.js → aa404aaec843a4f46ab6.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{21016d58428b15f7427c.js → aa712f850fd129ca5ed8.js} +1 -1
  92. package/assets/esri/core/workers/chunks/ab0113d1269675dcd520.js +1 -0
  93. package/assets/esri/core/workers/chunks/aff7c4477e1f0c31fffa.js +1 -0
  94. package/assets/esri/core/workers/chunks/{726e3f413824f02fe689.js → bd2dcc55ac3418421ee5.js} +1 -1
  95. package/assets/esri/core/workers/chunks/bf453744067267e84d1b.js +1 -0
  96. package/assets/esri/core/workers/chunks/c2f38c66fae2cdb57445.js +1 -0
  97. package/assets/esri/core/workers/chunks/c7aa4a8263e21f631004.js +1 -0
  98. package/assets/esri/core/workers/chunks/{b8a4352f83502449ff95.js → cbbbaccc0d3683e1c0fe.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{e4290719c8afc2a4ee8c.js → cc441051a52bfbda9caf.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{3be465c653236d6d8c1f.js → d2c7067bb6654c0e2793.js} +1 -1
  101. package/assets/esri/core/workers/chunks/{bc3f42401131a12fce9b.js → d2eb3802fa003c2d497e.js} +1 -1
  102. package/assets/esri/core/workers/chunks/d3912886ac2910290f43.js +1 -0
  103. package/assets/esri/core/workers/chunks/da7c14ae1a25fc7163ce.js +1 -0
  104. package/assets/esri/core/workers/chunks/daa54c8a317c27881763.js +1 -0
  105. package/assets/esri/core/workers/chunks/e08bff9f8247909776a4.js +1 -0
  106. package/assets/esri/core/workers/chunks/e15c612caadf7bac4ab9.js +1 -0
  107. package/assets/esri/core/workers/chunks/{d5d2a4e8e19898d86c6d.js → e2029267cddb8e2effab.js} +1 -1
  108. package/assets/esri/core/workers/chunks/e3ef0451dcdc2e966628.js +1 -0
  109. package/assets/esri/core/workers/chunks/e7e987558cf017c62458.js +1 -0
  110. package/assets/esri/core/workers/chunks/{042771b4e56355924140.js → e9993d4f2bfdc434fbcc.js} +1 -1
  111. package/assets/esri/core/workers/chunks/eabfab23246d4a052ea3.js +1 -0
  112. package/assets/esri/core/workers/chunks/ed3d1d0465f4a4d8df4a.js +1 -0
  113. package/assets/esri/core/workers/chunks/{4dc1e7d7ac2a4b0144c4.js → f128d3431da86e484117.js} +28 -29
  114. package/assets/esri/core/workers/chunks/{ed4afafbcb31491c2049.js → f452ca61842dbe8de9af.js} +1 -1
  115. package/assets/esri/core/workers/chunks/f54546c155fba2fd3a7e.js +1 -0
  116. package/assets/esri/core/workers/chunks/{4c8164955f8d844c09ee.js → f8d1c7df671733c3325c.js} +1 -1
  117. package/assets/esri/core/workers/chunks/{e45404a982e173459990.js → f92d521ed3df3c9f737b.js} +1 -1
  118. package/assets/esri/core/workers/chunks/{b2289c18c02c868a2939.js → f9bedb421d4e115a888f.js} +1 -1
  119. package/assets/esri/core/workers/chunks/{55f7b1de8882569861c0.js → faed301a25252c619cff.js} +1 -1
  120. package/assets/esri/core/workers/chunks/fb22b2e4988ecf4d6376.js +1 -0
  121. package/assets/esri/core/workers/chunks/fb455fd89b74b70a6a2b.js +1 -0
  122. package/assets/esri/core/workers/chunks/{6d77c7e9dec323fc4145.js → fb603edd374e24f366ff.js} +1 -1
  123. package/chunks/ComponentShader.glsl.js +25 -25
  124. package/chunks/HUDMaterial.glsl.js +2 -2
  125. package/chunks/LineMarker.glsl.js +26 -26
  126. package/chunks/Point2D.js +1 -1
  127. package/chunks/ProjectionTransformation.js +1 -1
  128. package/chunks/QuadraticBezier.js +1 -1
  129. package/chunks/RibbonLine.glsl.js +35 -33
  130. package/chunks/Terrain.glsl.js +33 -33
  131. package/chunks/aiServices.js +1 -1
  132. package/chunks/array.js +1 -1
  133. package/chunks/languageUtils.js +1 -1
  134. package/core/Accessor.js +1 -1
  135. package/core/accessorSupport/utils.js +1 -1
  136. package/core/workers/registry.js +1 -1
  137. package/geometry/operators/projectOperator.js +1 -1
  138. package/geometry/operators/shapePreservingProjectOperator.js +1 -1
  139. package/geometry/support/meshUtils/elevation.js +1 -1
  140. package/geometry/support/meshUtils.js +1 -1
  141. package/interfaces.d.ts +284 -10
  142. package/intl/locale.js +1 -1
  143. package/layers/LinkChartLayer.js +1 -1
  144. package/layers/MapImageLayer.js +1 -1
  145. package/layers/TileLayer.js +1 -1
  146. package/layers/support/RasterWorker.js +1 -1
  147. package/layers/support/VideoElement.js +1 -1
  148. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  149. package/layers/support/rasterFunctions/clipUtils.js +1 -1
  150. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  151. package/package.json +2 -2
  152. package/rest/networks/queryAssociations.js +1 -1
  153. package/support/revision.js +1 -1
  154. package/symbols/WebStyleSymbol.js +1 -1
  155. package/symbols/support/symbolUtils.js +1 -1
  156. package/views/2d/LabelManager.js +1 -1
  157. package/views/2d/engine/webgl/Overlay.js +1 -1
  158. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  159. package/views/2d/layers/TileLayerView2D.js +1 -1
  160. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  161. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  162. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  163. package/views/2d/layers/support/util.js +1 -1
  164. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  165. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  166. package/views/3d/layers/DrapedSubView3D.js +1 -1
  167. package/views/3d/layers/GraphicsView3D.js +1 -1
  168. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  169. package/views/3d/layers/MapImageLayerView3D.js +1 -1
  170. package/views/3d/layers/MediaLayerView3D.js +1 -1
  171. package/views/3d/layers/TileLayerView3D.js +1 -1
  172. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  173. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  174. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  175. package/views/3d/layers/support/ImageHighlightHelper3D.js +5 -0
  176. package/views/3d/layers/support/SublayerPopupHighlightHelper3D.js +5 -0
  177. package/views/3d/terrain/Overlay.js +1 -1
  178. package/views/3d/terrain/OverlayRenderer.js +1 -1
  179. package/views/3d/terrain/RasterTile.js +1 -1
  180. package/views/3d/terrain/TerrainRenderer.js +1 -1
  181. package/views/3d/terrain/TerrainSurface.js +1 -1
  182. package/views/3d/terrain/TileCompositor.js +1 -1
  183. package/views/3d/terrain/TileRenderer.js +1 -1
  184. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  186. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  187. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +9 -10
  188. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +11 -0
  189. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +3 -3
  190. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +3 -6
  191. package/views/3d/webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js +1 -1
  192. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +1 -1
  193. package/views/3d/webgl-engine/lib/Material.js +1 -1
  194. package/views/3d/webgl-engine/lib/Program.js +1 -1
  195. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  196. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  197. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  198. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  199. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  200. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  201. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  202. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  203. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  204. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  206. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  207. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  208. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  209. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  210. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  211. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  212. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  213. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  214. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  215. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  216. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  217. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  218. package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
  219. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  220. package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
  221. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  222. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  223. package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +1 -1
  224. package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
  225. package/views/3d/webgl-engine/shaders/PointRendererTechniqueConfiguration.js +1 -1
  226. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  227. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  228. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
  229. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  230. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  231. package/views/DOMContainer.js +1 -1
  232. package/views/FocusArea.js +1 -1
  233. package/views/GroundView.js +1 -1
  234. package/views/PopupView.js +1 -1
  235. package/views/SceneView.js +1 -1
  236. package/views/VideoView.d.ts +4 -0
  237. package/views/VideoView.js +1 -1
  238. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  239. package/views/layers/support/highlightUtils.js +5 -0
  240. package/views/support/GroundViewElevationSampler.js +1 -1
  241. package/views/support/TextureCompressionHandle.js +5 -0
  242. package/views/support/TextureCompressionHelper.js +1 -1
  243. package/views/support/TextureCompressionWorker.js +5 -0
  244. package/views/support/TextureCompressionWorkerHandle.js +5 -0
  245. package/views/support/imageReprojection.js +1 -1
  246. package/views/webgl/ShaderBuilder.js +1 -1
  247. package/views/webgl/Texture.js +1 -1
  248. package/views/webgl/TextureDescriptor.js +1 -1
  249. package/webscene/Slide.js +1 -1
  250. package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
  251. package/widgets/CatalogLayerList.js +1 -1
  252. package/widgets/Directions.js +1 -1
  253. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  254. package/widgets/Features/FeaturesViewModel.js +1 -1
  255. package/widgets/LayerList/ListItem.js +1 -1
  256. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  257. package/widgets/Legend.js +1 -1
  258. package/widgets/TableList/ListItem.js +1 -1
  259. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  260. package/widgets/UtilityNetworkTrace.js +1 -1
  261. package/widgets/ValuePicker.js +1 -1
  262. package/widgets/support/uriUtils.js +1 -1
  263. package/assets/esri/core/workers/chunks/0059295780fa4a090f30.js +0 -319
  264. package/assets/esri/core/workers/chunks/07910d16d1efae41d4bc.js +0 -1
  265. package/assets/esri/core/workers/chunks/0a3c1642cfabf9acd5c5.js +0 -1
  266. package/assets/esri/core/workers/chunks/0b7331613f91a3258352.js +0 -1
  267. package/assets/esri/core/workers/chunks/1a09dfb2c9fd7cd84cd4.js +0 -1
  268. package/assets/esri/core/workers/chunks/1dd6d68d23ba07587ae4.js +0 -1
  269. package/assets/esri/core/workers/chunks/2079f9d28e4199714f22.js +0 -1
  270. package/assets/esri/core/workers/chunks/29ba2022c2978e9bd53e.js +0 -1
  271. package/assets/esri/core/workers/chunks/29fe3e9a0ecab74bb729.js +0 -1
  272. package/assets/esri/core/workers/chunks/35f3eef81fac7924a487.js +0 -1
  273. package/assets/esri/core/workers/chunks/3fc18638f8799b85001d.js +0 -1
  274. package/assets/esri/core/workers/chunks/4539a802cba77a7a7cc7.js +0 -1
  275. package/assets/esri/core/workers/chunks/4d7bd2bbe9045a2fee7a.js +0 -1
  276. package/assets/esri/core/workers/chunks/50b6be13c270d7ac80d3.js +0 -1
  277. package/assets/esri/core/workers/chunks/54ace3e4802934f3f9f2.js +0 -1
  278. package/assets/esri/core/workers/chunks/5656cc44e3d4547668db.js +0 -1
  279. package/assets/esri/core/workers/chunks/597f450a57750637cb4d.js +0 -1
  280. package/assets/esri/core/workers/chunks/6e7577cb6378ff34e722.js +0 -1
  281. package/assets/esri/core/workers/chunks/6eb8d7edafeafeb10cae.js +0 -1
  282. package/assets/esri/core/workers/chunks/6ff981ec0c725efe5525.js +0 -1
  283. package/assets/esri/core/workers/chunks/71bd94cc789a55910f92.js +0 -1
  284. package/assets/esri/core/workers/chunks/762567124623f6d11e67.js +0 -1
  285. package/assets/esri/core/workers/chunks/77845cd5d824c1004bfa.js +0 -1
  286. package/assets/esri/core/workers/chunks/78683f1aadc1377be5fd.js +0 -1
  287. package/assets/esri/core/workers/chunks/7a4413a188a8f1affb2f.js +0 -1
  288. package/assets/esri/core/workers/chunks/7d3b2bdc75525d47389c.js +0 -1
  289. package/assets/esri/core/workers/chunks/81bf362ec0d23ffdc90c.js +0 -39
  290. package/assets/esri/core/workers/chunks/81f2f1614ea27f4c2e65.js +0 -1
  291. package/assets/esri/core/workers/chunks/901c957c049f53318e87.js +0 -1
  292. package/assets/esri/core/workers/chunks/94f41ef15f6c61562e5e.js +0 -1
  293. package/assets/esri/core/workers/chunks/95f23bd17ce9e07fc8ef.js +0 -1
  294. package/assets/esri/core/workers/chunks/96d7f47ea8fbf345101c.js +0 -1
  295. package/assets/esri/core/workers/chunks/9f312f7284e506a84ed7.js +0 -1
  296. package/assets/esri/core/workers/chunks/a59ad50d932da1e28c8f.js +0 -1
  297. package/assets/esri/core/workers/chunks/ac86d0b31f6368bd1fb1.js +0 -1
  298. package/assets/esri/core/workers/chunks/ad9b3b83aa96db7b79ea.js +0 -1
  299. package/assets/esri/core/workers/chunks/afe94e351b4a50d7bc53.js +0 -1
  300. package/assets/esri/core/workers/chunks/b02ac03503bfff1ff922.js +0 -1
  301. package/assets/esri/core/workers/chunks/b8416f2560710258c239.js +0 -1
  302. package/assets/esri/core/workers/chunks/b948fe33b4d650eea796.js +0 -1
  303. package/assets/esri/core/workers/chunks/ba47e43ef039fe4b8c5c.js +0 -1
  304. package/assets/esri/core/workers/chunks/be002f24beb832a369ce.js +0 -1
  305. package/assets/esri/core/workers/chunks/bf3c4c1bff8b71bc0b13.js +0 -1
  306. package/assets/esri/core/workers/chunks/d45ff061bf71b73e9f26.js +0 -1
  307. package/assets/esri/core/workers/chunks/d8ddff920725acb99200.js +0 -1
  308. package/assets/esri/core/workers/chunks/db4c110ab4c26c4b768c.js +0 -1
  309. package/assets/esri/core/workers/chunks/dfa4be2e07cc4c0938b0.js +0 -1
  310. package/assets/esri/core/workers/chunks/e088edb9ffbaa1ed12eb.js +0 -1
  311. package/assets/esri/core/workers/chunks/e0ac90b4ad8c36fb7d70.js +0 -1
  312. package/assets/esri/core/workers/chunks/e491daf73ab1264aa1b9.js +0 -1
  313. package/assets/esri/core/workers/chunks/f2a6287c8d28be24f71e.js +0 -1
  314. package/assets/esri/core/workers/chunks/f454e773505c0eef2f9d.js +0 -1
  315. package/assets/esri/core/workers/chunks/f4861d73c62096f73e48.js +0 -1
  316. package/assets/esri/core/workers/chunks/f70dd16f14279bb7e60d.js +0 -1
  317. package/assets/esri/core/workers/chunks/fa011ad649c05201e92a.js +0 -1
  318. package/views/3d/webgl-engine/lib/TextureCompressionWorker.js +0 -5
  319. package/views/3d/webgl-engine/lib/TextureCompressionWorkerHandle.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{MemCachePool as h}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import p from"../../../core/PooledArray.js";import{throwIfAborted as u,isAbortError as c,isAborted as g}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as m,sync as f,initial as y}from"../../../core/reactiveUtils.js";import{property as T}from"../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../core/accessorSupport/decorators/subclass.js";import{i as E,c as S}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L}from"../../../geometry/ellipsoidUtils.js";import b from"../../../geometry/SpatialReference.js";import{getProjector as P}from"../../../geometry/projection/projectors.js";import{projectPointToVector as M}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as D}from"../../../geometry/projection/projectVectorToVector.js";import{create as x,equals as U,intersection as R,intersectsSphere as j,empty as A,expand as I}from"../../../geometry/support/aaBoundingRect.js";import{create as B,copy as V}from"../../../geometry/support/frustum.js";import{isPlateCarree as k}from"../../../geometry/support/spatialReferenceUtils.js";import{e as O,a as G,c as N}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as q}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as F}from"../../../layers/support/layerUtils.js";import{debugFlags as W}from"../support/debugFlags.js";import{ElevationRange as $}from"../support/ElevationRange.js";import{ElevationUpdateEvent as H}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as Q}from"../support/extentUtils.js";import{ClientType as z}from"../support/index.js";import{updatingProgress as X}from"../support/updatingProperties.js";import{ElevationBounds as Y}from"./ElevationBounds.js";import{ElevationData as K,sampleElevation as J}from"./ElevationData.js";import{create as Z}from"./ExtentHelper.js";import{TextureUpdate as ee}from"./interfaces.js";import{LayerClass as te,LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{RenderOrder as ae}from"./RenderOrder.js";import{ScaleRangeQueries as ne}from"./ScaleRangeQueries.js";import{SphericalPatch as le}from"./SphericalPatch.js";import{SplitLimits as oe}from"./SplitLimits.js";import{maxRootTiles as he,tooManyRootTilesAfterChangeError as de,tooManyRootTilesForLayerError as pe,maxTileNeighborLevelDelta as ue,maxMemoryLodBias as ce}from"./TerrainConst.js";import{TerrainRenderer as ge}from"./TerrainRenderer.js";import _e from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as me,isVectorTileLayerView as fe,neighborEdgeIndices as ye,internalAssert as Te,oppositeEdge as ve,isSurfaceLayerView as Ee,isGroupLayerView as Se,isMapTileLayerView as we,isBlendableLayerView as Ce,isElevationLayerView as Le,releaseTerrainData as be,enableTerrainInternalChecks as Pe,neighborCornerIndices as Me,oppositeCorner as De,enableWaterproofTests as xe,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Re}from"./terrainUtils.js";import{Tile as je,lijEquals as Ae}from"./Tile.js";import{printAllocations as Ie}from"./TilePerLayerInfo.js";import{TileUpdate as Be}from"./TileUpdate.js";import{IteratorPreorder as Ve,IteratorPostorder as ke,compareTilesByLij as Oe,hasLoadableSiblings as Ge,sortTilesByPOI as Ne}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{TransparencyMode as Fe}from"./TransparencyMode.js";import{UpsampleInfo as We}from"./UpsampleInfo.js";import{isCompositeBlendMode as $e,blendModeFromString as He}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PBRMode as Qe}from"../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{RenderRequestType as ze}from"../webgl-engine/lib/basicInterfaces.js";import{RenderState as Xe}from"../../support/RenderState.js";import{ImmediateTask as Ye,TaskPriority as Ke,noBudget as Je}from"../../support/Scheduler.js";import{Yield as Ze}from"../../support/Yield.js";var et;let tt=class extends(a.EventedMixin(i)){static{et=this}get allTiles(){return this._allTiles}constructor(e){super(e),this._scaleRangeQueries=new ne,this._iteratorPool=new d(Ve,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new ke,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new _e,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=w(),this._eyePosSurfaceSR=w(),this._splitLimits=new oe,this._frustum=B(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new C,this._frameTask=Ye,this._allTiles=new p,this._upsampleInfoPool=new d(We),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=x(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=b.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new Y(1/0,-1/0),this.rootTileElevationBounds=new Y(1/0,-1/0),this._projectorCache=new Map,this._radiusModifier=Math.cos(Math.PI/16/16),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1;const t=e.view;this.overlayManager=new re({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?le:se,this._ellipsoid=L(t.spatialReference),this._renderer=new ge(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,t.resourceController.memoryController)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new h(((e,t)=>i.newCache(e,t)),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new q(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([_((()=>r.renderer.isEmpty),(()=>this._evaluateTransparency())),_((()=>this.renderer.visible),(e=>this.suspended=!e)),_((()=>this.heading),(e=>{this._renderer.updateHeading(e),this._updateTileTextures(ee.FADING)})),_((()=>({heading:e.camera?.heading,state:e.state?.mode})),(({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(t===Xe.IDLE||Math.min(r,360-r)>=30)&&(this.heading=i)}))],"overlayManager"),this.addHandles([_((()=>this.baseOpacity),(()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?ee.UNFADED:ee.IMMEDIATE)}),m),_((()=>this.hasCompositeBlendMode),(()=>this._updateTileTextures(this._evaluateTransparency()?ee.UNFADED:ee.IMMEDIATE)),m),_((()=>this.backgroundColor),((e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))}),f),_((()=>this.snapLevel),(()=>this._viewChanged=!0),f),_((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>this._allTilesSorted=!1))})),_((()=>W.TERRAIN_TILE_TREE_SHOW_TILES),(t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&W.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))})):t||(this._treeDebugger=o(this._treeDebugger))}),y),_((()=>this._renderer?.texturesBeingCompressed),((e,t)=>{t&&e<t&&(this.setMemoryDirty(),this._allTiles.forAll((e=>e.setMemoryDirty())),this.requestRender())}),f)]);const{spatialReference:a}=e;this._extentHelper=Z(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new qe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(z.ELEVATION),this._mapDataRequester=t.createStreamDataRequester(z.BASEMAP);const d=t.scheduler;this._frameTask=d.registerTask(Ke.TERRAIN_SURFACE,this),this.addHandles([_((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),y),_((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),f),_((()=>this.extent),(()=>this._updateRootTiles()),y),e.on("resize",(()=>this._viewChangeUpdate())),_((()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),m),_((()=>e.qualitySettings?.fadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),y),_((()=>e.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._renderer.pbrMode=e?Qe.Simplified:Qe.Disabled),y),_((()=>e.qualitySettings?.tiledSurface.elevationLevelDelta),(()=>this._updateAllTileGeometries())),_((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),f)]),this.addHandles(e.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}destroy(){this._frameTask.remove(),this._watchUpdatingTracking.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),je.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroy(),this._iteratorPool=o(this._iteratorPool),this._upsampleMapCache=o(this._upsampleMapCache),this._elevationQueryCache=o(this._elevationQueryCache),this._set("view",null),this._extentHelper=o(this._extentHelper),this._upsampleInfoPool=o(this._upsampleInfoPool),Ie()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){if(this.lodSnappingEnabled){const{view:e,tilingScheme:t}=this,i=e.scale;if(t&&i){const r=t.levelAtScale(i)+e.qualitySettings.tiledSurface.lodBias,s=t.getMaxLod();return r<=0?null:Math.min(r,s||1/0)}}return null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(null==t||null==e)return null;const i=x(),r=Q(t,i,e)?i:null,s=this._get("extent");return U(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=R(this.groundExtent,this._userClippingExtent,x()),t=this._get("extent");return U(e,t)?t:e}get groundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.running||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.renderer.texturesBeingCompressed)}get running(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return null!=this._rootTiles}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===Fe.Opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length)return null;if(0===s[0].layerInfo[te.ELEVATION].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=P(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return n.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const l=E(rt,e,t,i);a(l,0,l,0);return ot(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[te.ELEVATION].length:0;if(r?.length&&0!==s)for(let a=0;a<t;++a){const t=3*a;i(a,ot(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getScale(e){if(!this.tilingScheme)return null;if(!M(e,rt,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(rt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;rt[0]>t[2]&&(i+=1),rt[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=P(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return n.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;O(e,st);const r=G(st);i(r,0,r,0);const s=new $,a=this._rootTiles;if(null!=a){const e=[];for(const i of a)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!j(i.extent,st))continue;const r=i.children;if(null==r[0]||i.rendered)s.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of r)e.push(t)}}return s}getRootElevationBounds(){return new $(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max)}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*this._radiusModifier;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!M(e,G(st),this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;st[3]=t;let i=null;const r=e=>{if(e&&j(e.extent,st)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._allSurfaceLayersTransparent()?t?Fe.Invisible:Fe.InvisibleWithDraped:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?Fe.Opaque:Fe.Transparent;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;me(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??b.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&k(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(et._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=at;let s=t.rootTilesInExtent(e,i,5*he);if(null!=this._rootTiles){if(s.length>he)return void n.getLogger(this).warn(de);const e=this._rootTiles.map((e=>e.lij)),t=r(e,s,Ae);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter((e=>!(t.removed.findIndex((t=>Ae(t,e.lij)))>-1)||(this._purgeTile(e),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>he&&(n.getLogger(this).warn(pe),s=t.rootTilesInExtent(e,i,he)),this._setRootTiles(s.map((e=>this._newRootTile(e))));U(i,this._rootTilesExtent)||(this._rootTilesExtent=x(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter((e=>e.loaded&&e.intersectsClippingArea));e.sort(Oe),e.forEach((e=>this._renderer.updateTileGeometryState(e))),e.forEach((e=>e.renderData.updateNeighborData())),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Oe);const t=this.renderer;e.forEach((e=>t.updateGeometryIfNeeded(e))),e.forEach((e=>this._pendingTilesForElevationUpdateEvent.add(e)))}_shouldSplit(e){return e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===Be.SPLIT}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(Be.SPLIT),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Be.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ge(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(Be.GEOMETRY)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new Y(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach((({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)}));const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new Y(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=V(this._splitLimits.frustum??B(),t.frustum):this._splitLimits.frustum=null,V(this._frustum,e.frustum),S(this._eyePosRenderSR,t.eye),D(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor((e=>{this._layerViews[te.MAP].some(fe)&&e.setPendingUpdate(Be.TEXTURE_FADING),this._pendingTilesToUpdate.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Be.TEXTURE_FADING)?Be.TEXTURE_FADING:!!e.resetPendingUpdate(Be.TEXTURE_NOFADING)&&Be.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=nt.extent;A(e),this._pendingTilesForElevationUpdateEvent.forEach((t=>I(e,t.extent,e))),this._pendingTilesForElevationUpdateEvent.clear(),nt.spatialReference=this.spatialReference,this.emit("elevation-change",nt),this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Pe&&this._checkTileInvariant(),!e.hasProgressed)return Ze}_checkTileInvariant(){const e=new Map;this._allTiles.forAll((t=>e.set(t,new Set))),this._allTiles.forAll((t=>{if(me(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce(((t,i)=>t+(e(i)?0:1)),0);if(me(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(Be.MERGE)){me(!t.hasPendingUpdate(Be.SPLIT),"Tile can be both split and merge at the same time");for(const e of t.children)me(e.leaf||e.hasPendingUpdate(Be.MERGE),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ue;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ue} (edge[${i}])`),me(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}me(t.level-e.level<=ue,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ue,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(ye[i],s);if(null!=a){if(t.leaf&&t.level>=ue){let i=a;for(;t.level-i.level<ue;)i=i.parent;const s=[r,t.lij[1]>>ue,t.lij[2]>>ue];if(!Ae(s,i.lij)){const r=e.get(i);me(!r.has(t),"Cannot already have neighbor"),r.add(t)}}me(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),me(t.level-a.level<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}})),this._allTiles.forAll((t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);me(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)}))}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new ht(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll((e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0}));const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=null!=n&&n.hasPendingUpdate(Be.MERGE),o=l?Be.MERGE:e.shouldSplit(r,s,i),h=o===Be.SPLIT;e.leaf?dt(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(Be.SPLIT),e.leaf||e.setPendingUpdate(Be.MERGE),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT)):(e.resetPendingUpdate(Be.SPLIT)&&e.updateAgentSuspension(),o===Be.ELEVATION&&e.updateAgents(te.ELEVATION),e.leaf||(e.setPendingUpdate(Be.MERGE),e.resetPendingUpdate(Be.SPLIT)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Ne(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_markTileToUpdate(e){Te(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter((e=>e.loaded&&e.intersectsClippingArea));if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];Te(r.loaded),Te(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=Me[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(De(t),(e=>e.loaded)))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(ve(ye[t]),(t=>!(!t.loaded||!t.intersectsClippingArea)&&(Te(e.has(t)||Oe(r,t)<0),i(r,t),!0))),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Pe&&xe&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some((s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(Be.MERGE)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(Be.MERGE);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(Be.MERGE);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(Be.SPLIT)){let t=!0;const i=s.level;if(i>=ue){const e=e=>e.leaf||i-e.level<ue;for(let r=0;r<4;++r){const a=s.findNeighborTile(ye[r],e);null!=a&&i-a.level===ue&&(t=!1,Pe&&(Te(a.leaf),Te(a.hasPendingUpdate(Be.SPLIT))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(Be.SPLIT)}return e.done}));if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some((t=>(t.resetPendingUpdate(Be.GEOMETRY)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done))),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done)))}_updateClippingExtent(){this.spatialReference&&(this.overlayManager?.updateOverlayParameters(ze.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ce}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(this._rootTiles.forEach((e=>this._purgeTile(e))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?ut(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(et._tileMemcacheKey,e)}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){me(e.leaf,"Tile that is already split should not be split again!"),me(e.rendered,"Tile marked to split is not rendered"),ut(e);const t=e.createChildren();this._allTiles.pushArray(t),e.updateAgentSuspension(),me(e.rendered,"parent should be rendered"),t.forEach((e=>this._loadTile(e))),t.forEach((e=>this._pendingTilesToUpdate.add(e))),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach((e=>dt(e,e.hasPendingUpdate(Be.SPLIT)))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){lt.spatialReference=this.spatialReference,lt.extent=e.extent,lt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",lt)}createTile(e,t,i,r){me(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(Be.SPLIT),s}get _shortBatches(){return this.view.state.mode!==Xe.IDLE}_mergeTile(e){me(!e.hasPendingUpdate(Be.SPLIT),"_mergeTile sanity check"),me(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),me(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),dt(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&this.overlayManager.updateTileOverlayParameters(e)}_handleLayerViewChanges(e=Je){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),Ee(e)||Se(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Se(e)){const i=this._layerClassFromLayerView(e),s=this._getLayerIdxByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(we(t)&&!F(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Ce(e)||Se(e))&&$e(He[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Le(e)?te.ELEVATION:te.MAP}_registerTiledLayerView(e){const t=[];if((Ce(e)||Se(e))&&t.push(_((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(ee.UNFADED)}))),!Se(e)){const i=this._layerClassFromLayerView(e);t.push(_((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(_((()=>e.fullOpacity),(()=>this._updateTileTextures(ee.UNFADED)))),t.push(_((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),t.push(e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)})))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach((e=>{if(!e.layer||e.suspended||!Ee(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===te.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of ie){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===te.ELEVATION&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(te.MAP),e===ee.IMMEDIATE?this.renderer.updateTileTexture(t,Be.TEXTURE_NOFADING):t.updateRenderData(te.MAP,e)})),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=ze.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||fe(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,u(r),c(t)||this._dataMissing(e,i,s),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();const s=t===te.ELEVATION;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?Le(i)?this._requestElevationTileData(e,i,r):Promise.reject():we(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!g(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{c(i)||(n.getLogger(this).error(`Tile ${e.lij.toString()} layer ${te.ELEVATION}/${t.uid} error ${i}`),this._dataMissing(e,te.ELEVATION,t),this.requestUpdate())};return t.fetchTile(e.lij,i).then((e=>this._frameTask.schedule((()=>r(e)))),s).finally((()=>--this._asyncWorkItems))}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[te.ELEVATION].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",te.ELEVATION,e.lij.toString());const s=new K(e.lij,e.extent,i);e.dataArrived(r,te.ELEVATION,s);const a=[e],l=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,l),e.computeElevationBounds()}0===l&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{be(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer ${te.MAP}/${t.uid} error ${r}`),this._dataMissing(e,te.MAP,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{this.requestUpdate(),g(i)?be(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));return t.fetchTile(e.lij,i).then(a,n).finally((()=>--this._asyncWorkItems))}_mapTileDataArrived(e,t,i){const r=this._getLayerIdxByUID(te.MAP,t.uid);if(null==r)return be(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,te.MAP,i)}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i){const r=this._getLayerIdxByUID(t,i.uid);null!=r?e.dataMissing(r,t):n.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce(((e,t)=>e+t.usedMemory),0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._getLayerIdxByUID(i,e.uid);return null!=r&&this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(e){this._renderer.visualizeNormals=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!xe)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ue(e)}enableWaterproofnessChecks(e){Re(e)}};e([T()],tt.prototype,"_renderer",void 0),e([T({constructOnly:!0})],tt.prototype,"_scaleRangeQueries",void 0),e([T({constructOnly:!0})],tt.prototype,"view",void 0),e([T({constructOnly:!0})],tt.prototype,"overlayManager",void 0),e([T()],tt.prototype,"_hasPendingUpdates",void 0),e([T()],tt.prototype,"_asyncWorkItems",void 0),e([T()],tt.prototype,"_allTilesDirty",void 0),e([T()],tt.prototype,"_allTilesSorted",void 0),e([T()],tt.prototype,"_viewChanged",void 0),e([T({type:Number})],tt.prototype,"heading",void 0),e([T()],tt.prototype,"_splitLimits",void 0),e([T({readOnly:!0})],tt.prototype,"_watchUpdatingTracking",void 0),e([T()],tt.prototype,"_frameTask",void 0),e([T({readOnly:!0})],tt.prototype,"snapLevel",null),e([T({readOnly:!0})],tt.prototype,"lodSnappingEnabled",null),e([T()],tt.prototype,"_userClippingExtent",null),e([T()],tt.prototype,"_rootTilesExtent",void 0),e([T({readOnly:!0})],tt.prototype,"extent",null),e([T({readOnly:!0})],tt.prototype,"groundExtent",null),e([T({readOnly:!0})],tt.prototype,"_tilingSchemeExtent",null),e([T({readOnly:!0})],tt.prototype,"updating",null),e([T({readOnly:!0})],tt.prototype,"running",null),e([T(X)],tt.prototype,"updatingProgress",void 0),e([T({readOnly:!0})],tt.prototype,"updatingProgressValue",null),e([T()],tt.prototype,"_maxNumUpdating",void 0),e([T()],tt.prototype,"baseOpacity",null),e([T()],tt.prototype,"hasCompositeBlendMode",void 0),e([T({readOnly:!0})],tt.prototype,"viewingMode",null),e([T()],tt.prototype,"maxTextureScale",void 0),e([T({readOnly:!0})],tt.prototype,"ready",null),e([T({value:ae.FRONT_TO_BACK})],tt.prototype,"renderOrder",null),e([T({readOnly:!0})],tt.prototype,"rootTiles",null),e([T()],tt.prototype,"_rootTiles",void 0),e([T({readOnly:!0})],tt.prototype,"spatialReference",null),e([T({type:t})],tt.prototype,"backgroundColor",null),e([T({value:!1})],tt.prototype,"slicePlaneEnabled",null),e([T({readOnly:!0})],tt.prototype,"tilingScheme",void 0),e([T({readOnly:!0})],tt.prototype,"tilingSchemeLocked",null),e([T({readOnly:!0})],tt.prototype,"tilingSchemeLogic",void 0),e([T()],tt.prototype,"wireframe",null),e([T({value:!1})],tt.prototype,"suspended",null),e([T()],tt.prototype,"fadeDuration",null),e([T()],tt.prototype,"visibleElevationBounds",void 0),e([T()],tt.prototype,"rootTileElevationBounds",void 0),e([T()],tt.prototype,"_layerViewsDirty",void 0),e([T()],tt.prototype,"renderPatchBorders",null),e([T()],tt.prototype,"visualizeNormals",null),e([T()],tt.prototype,"renderingDisabled",null),tt=et=e([v("esri.views.3d.terrain.TerrainSurface")],tt);const it=tt,rt=w(),st=N(),at=x();new p;const nt=new H("ground"),lt={spatialReference:null,extent:null,scale:0};function ot(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return J(t,i,s)}return null}class ht{constructor(e){this.capacity=e,this._head=0,this._tail=0,this._data=new Array(e)}push(e){const t=this._tail;if(!(t<this.capacity))throw new Error("Queue full");this._data[t]=e,this._tail=t+1}pushAll(e){const t=e.length;if(0===t)return;const i=this._tail;if(!(i+t<=this.capacity))throw new Error("Queue full");for(let r=0;r<t;++r)this._data[i+r]=e[r];this._tail=i+t}pop(){const e=this._head;if(e<this._tail){const t=this._data[e];return this._head=e+1,t}}get empty(){return this._head>=this._tail}get full(){return this._tail>=this._data.length}}function dt(e,t){!e.leaf||e.level<ue||gt(e,(e=>{t&&pt(e);const i=ct(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ct(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}}))}function pt(e){if(e.hasPendingUpdate(Be.SPLIT))return;let t=e.parent;for(;t?.resetPendingUpdate(Be.MERGE);)t=t.parent;e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT),e.level<ue||gt(e,(e=>{pt(e)}))}function ut(e){e.level<ue||gt(e,(e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ct(t));)t=t.parent}}))}function ct(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function gt(e,t){if(e.level<ue)return;const i=e.level-ue,r=e.lij[1]>>ue,s=e.lij[2]>>ue,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(ye[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{it as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{MemCachePool as h}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import p from"../../../core/PooledArray.js";import{throwIfAborted as u,isAbortError as c,isAborted as g}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as m,sync as f,initial as y}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as T}from"../../../core/unitUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as E}from"../../../core/accessorSupport/decorators/subclass.js";import{i as S,c as w}from"../../../chunks/vec32.js";import{create as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as L}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../../geometry/ellipsoidUtils.js";import P from"../../../geometry/SpatialReference.js";import{getProjector as M}from"../../../geometry/projection/projectors.js";import{projectPointToVector as D}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{create as U,equals as R,intersection as I,intersectsSphere as j,empty as A,expand as B}from"../../../geometry/support/aaBoundingRect.js";import{create as V,copy as k}from"../../../geometry/support/frustum.js";import{isPlateCarree as N}from"../../../geometry/support/spatialReferenceUtils.js";import{e as O,a as G,c as q}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as W}from"../../../layers/support/layerUtils.js";import{debugFlags as H}from"../support/debugFlags.js";import{ElevationRange as $}from"../support/ElevationRange.js";import{ElevationUpdateEvent as Q}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as z}from"../support/extentUtils.js";import{ClientType as X}from"../support/index.js";import{updatingProgress as Y}from"../support/updatingProperties.js";import{ElevationBounds as K}from"./ElevationBounds.js";import{ElevationData as J,sampleElevation as Z}from"./ElevationData.js";import{create as ee}from"./ExtentHelper.js";import{TextureUpdate as te}from"./interfaces.js";import{LayerClass as ie,LayerClasses as re}from"./LayerClass.js";import{OverlayManager as se}from"./OverlayManager.js";import{PlanarPatch as ae}from"./PlanarPatch.js";import{RenderOrder as ne}from"./RenderOrder.js";import{ScaleRangeQueries as le}from"./ScaleRangeQueries.js";import{SphericalPatch as oe}from"./SphericalPatch.js";import{SplitLimits as he}from"./SplitLimits.js";import{maxRootTiles as de,tooManyRootTilesAfterChangeError as pe,tooManyRootTilesForLayerError as ue,maxTileNeighborLevelDelta as ce,maxMemoryLodBias as ge}from"./TerrainConst.js";import{TerrainRenderer as _e}from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as fe,isVectorTileLayerView as ye,neighborEdgeIndices as Te,internalAssert as ve,oppositeEdge as Ee,isSurfaceLayerView as Se,isGroupLayerView as we,isMapTileLayerView as Ce,isBlendableLayerView as Le,isElevationLayerView as be,releaseTerrainData as Pe,enableTerrainInternalChecks as Me,neighborCornerIndices as De,oppositeCorner as xe,enableWaterproofTests as Ue,enableInternalTerrainChecks as Re,enableTerrainWaterproofChecks as Ie}from"./terrainUtils.js";import{Tile as je,lijEquals as Ae}from"./Tile.js";import{printAllocations as Be}from"./TilePerLayerInfo.js";import{TileUpdate as Ve}from"./TileUpdate.js";import{IteratorPreorder as ke,IteratorPostorder as Ne,compareTilesByLij as Oe,hasLoadableSiblings as Ge,sortTilesByPOI as qe}from"./tileUtils.js";import{TilingSchemeLogic as Fe}from"./TilingSchemeLogic.js";import{TransparencyMode as We}from"./TransparencyMode.js";import{UpsampleInfo as He}from"./UpsampleInfo.js";import{isCompositeBlendMode as $e,blendModeFromString as Qe}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PBRMode as ze}from"../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{RenderRequestType as Xe}from"../webgl-engine/lib/basicInterfaces.js";import{RenderState as Ye}from"../../support/RenderState.js";import{ImmediateTask as Ke,TaskPriority as Je,noBudget as Ze}from"../../support/Scheduler.js";import{TextureCompressionHandle as et}from"../../support/TextureCompressionHandle.js";import{Yield as tt}from"../../support/Yield.js";var it;let rt=class extends(a.EventedMixin(i)){static{it=this}get allTiles(){return this._allTiles}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=T(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this._scaleRangeQueries=new le,this.compressionHandle=new et,this._iteratorPool=new d(ke,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ne,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new me,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=C(),this._eyePosSurfaceSR=C(),this._splitLimits=new he,this._frustum=V(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new L,this._frameTask=Ke,this._allTiles=new p,this._upsampleInfoPool=new d(He),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=U(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=P.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new K(1/0,-1/0),this.rootTileElevationBounds=new K(1/0,-1/0),this._projectorCache=new Map,this._radiusModifier=Math.cos(Math.PI/16/16),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1;const t=e.view;this.overlayManager=new se({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?oe:ae,this._ellipsoid=b(t.spatialReference),this._renderer=new _e(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.compressionHandle,t.resourceController.memoryController)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new h(((e,t)=>i.newCache(e,t)),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new F(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([_((()=>r.renderer.isEmpty),(()=>this._evaluateTransparency())),_((()=>this.renderer.visible),(e=>this.suspended=!e)),_((()=>this.heading),(e=>{this._renderer.updateHeading(e),this._updateTileTextures(te.FADING)})),_((()=>({heading:e.camera?.heading,state:e.state?.mode})),(({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(t===Ye.IDLE||Math.min(r,360-r)>=30)&&(this.heading=i)}))],"overlayManager"),this.addHandles([_((()=>this.baseOpacity),(()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?te.UNFADED:te.IMMEDIATE)}),m),_((()=>this.hasCompositeBlendMode),(()=>this._updateTileTextures(this._evaluateTransparency()?te.UNFADED:te.IMMEDIATE)),m),_((()=>this.backgroundColor),((e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))}),f),_((()=>this.snapLevel),(()=>this._viewChanged=!0),f),_((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>this._allTilesSorted=!1))})),_((()=>H.TERRAIN_TILE_TREE_SHOW_TILES),(t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&H.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))})):t||(this._treeDebugger=o(this._treeDebugger))}),y),_((()=>this.compressionHandle.compressing),((e,t)=>{e===t||e||(this.setMemoryDirty(),this._allTiles.forAll((e=>e.setMemoryDirty())),this._updateTileTextures(te.IMMEDIATE),this.requestRender())}),f)]);const{spatialReference:a}=e;this._extentHelper=ee(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Fe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(X.ELEVATION),this._mapDataRequester=t.createStreamDataRequester(X.BASEMAP);const d=t.scheduler;this._frameTask=d.registerTask(Je.TERRAIN_SURFACE,this),this.addHandles([_((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),y),_((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),f),_((()=>this.extent),(()=>this._updateRootTiles()),y),e.on("resize",(()=>this._viewChangeUpdate())),_((()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),m),_((()=>e.qualitySettings?.fadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),y),_((()=>e.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._renderer.pbrMode=e?ze.Simplified:ze.Disabled),y),_((()=>e.qualitySettings?.tiledSurface.elevationLevelDelta),(()=>this._updateAllTileGeometries())),_((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),f)]),this.addHandles(e.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}destroy(){this._frameTask.remove(),this._watchUpdatingTracking.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),je.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroy(),this._iteratorPool=o(this._iteratorPool),this._upsampleMapCache=o(this._upsampleMapCache),this._elevationQueryCache=o(this._elevationQueryCache),this._set("view",null),this._extentHelper=o(this._extentHelper),this._upsampleInfoPool=o(this._upsampleInfoPool),Be()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){if(this.lodSnappingEnabled){const{view:e,tilingScheme:t}=this,i=e.scale;if(t&&i){const r=t.levelAtScale(i)+e.qualitySettings.tiledSurface.lodBias,s=t.getMaxLod();return r<=0?null:Math.min(r,s||1/0)}}return null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(null==t||null==e)return null;const i=U(),r=z(t,i,e)?i:null,s=this._get("extent");return R(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=I(this.groundExtent,this._userClippingExtent,U()),t=this._get("extent");return R(e,t)?t:e}get groundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.running||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.compressionHandle.compressing)}get running(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return null!=this._rootTiles}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===We.Opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length)return null;if(0===s[0].layerInfo[ie.ELEVATION].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=M(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return n.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const l=S(at,e,t,i);a(l,0,l,0);return dt(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[ie.ELEVATION].length:0;if(r?.length&&0!==s)for(let a=0;a<t;++a){const t=3*a;i(a,dt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getScale(e){if(!this.tilingScheme)return null;if(!D(e,at,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(at)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;at[0]>t[2]&&(i+=1),at[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=M(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return n.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;O(e,nt);const r=G(nt);i(r,0,r,0);const s=new $,a=this._rootTiles;if(null!=a){const e=[];for(const i of a)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!j(i.extent,nt))continue;const r=i.children;if(null==r[0]||i.rendered)s.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of r)e.push(t)}}return s}getRootElevationBounds(){return new $(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max)}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*this._radiusModifier;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!D(e,G(nt),this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;nt[3]=t;let i=null;const r=e=>{if(e&&j(e.extent,nt)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._allSurfaceLayersTransparent()?t?We.Invisible:We.InvisibleWithDraped:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?We.Opaque:We.Transparent;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;fe(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??P.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&N(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(it._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=lt;let s=t.rootTilesInExtent(e,i,5*de);if(null!=this._rootTiles){if(s.length>de)return void n.getLogger(this).warn(pe);const e=this._rootTiles.map((e=>e.lij)),t=r(e,s,Ae);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter((e=>!(t.removed.findIndex((t=>Ae(t,e.lij)))>-1)||(this._purgeTile(e),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>de&&(n.getLogger(this).warn(ue),s=t.rootTilesInExtent(e,i,de)),this._setRootTiles(s.map((e=>this._newRootTile(e))));R(i,this._rootTilesExtent)||(this._rootTilesExtent=U(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter((e=>e.loaded&&e.intersectsClippingArea));e.sort(Oe),e.forEach((e=>this._renderer.updateTileGeometryState(e))),e.forEach((e=>e.renderData.updateNeighborData())),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Oe);const t=this.renderer;e.forEach((e=>t.updateGeometryIfNeeded(e))),e.forEach((e=>this._pendingTilesForElevationUpdateEvent.add(e)))}_shouldSplit(e){return e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===Ve.SPLIT}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(Ve.SPLIT),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution")}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Ve.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ge(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(Ve.GEOMETRY)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new K(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach((({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)}));const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new K(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=k(this._splitLimits.frustum??V(),t.frustum):this._splitLimits.frustum=null,k(this._frustum,e.frustum),w(this._eyePosRenderSR,t.eye),x(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor((e=>{this._layerViews[ie.MAP].some(ye)&&e.setPendingUpdate(Ve.TEXTURE_FADING),this._pendingTilesToUpdate.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Ve.TEXTURE_FADING)?Ve.TEXTURE_FADING:!!e.resetPendingUpdate(Ve.TEXTURE_NOFADING)&&Ve.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=ot.extent;A(e),this._pendingTilesForElevationUpdateEvent.forEach((t=>B(e,t.extent,e))),this._pendingTilesForElevationUpdateEvent.clear(),ot.spatialReference=this.spatialReference,this.emit("elevation-change",ot),this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Me&&this._checkTileInvariant(),!e.hasProgressed)return tt}_checkTileInvariant(){const e=new Map;this._allTiles.forAll((t=>e.set(t,new Set))),this._allTiles.forAll((t=>{if(fe(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce(((t,i)=>t+(e(i)?0:1)),0);if(fe(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(Ve.MERGE)){fe(!t.hasPendingUpdate(Ve.SPLIT),"Tile can be both split and merge at the same time");for(const e of t.children)fe(e.leaf||e.hasPendingUpdate(Ve.MERGE),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ce;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ce} (edge[${i}])`),fe(r,`tile level delta [${t.level}] vs [${e.level}] > ${ce}`))}fe(t.level-e.level<=ce,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ce,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(Te[i],s);if(null!=a){if(t.leaf&&t.level>=ce){let i=a;for(;t.level-i.level<ce;)i=i.parent;const s=[r,t.lij[1]>>ce,t.lij[2]>>ce];if(!Ae(s,i.lij)){const r=e.get(i);fe(!r.has(t),"Cannot already have neighbor"),r.add(t)}}fe(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),fe(t.level-a.level<=ce,`Tile level delta [${t.level}] vs [${a.level}] > ${ce}`)}}})),this._allTiles.forAll((t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);fe(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)}))}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new pt(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll((e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0}));const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=null!=n&&n.hasPendingUpdate(Ve.MERGE),o=l?Ve.MERGE:e.shouldSplit(r,s,i),h=o===Ve.SPLIT;e.leaf?ut(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(Ve.SPLIT),e.leaf||e.setPendingUpdate(Ve.MERGE),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(Ve.MERGE),e.leaf&&e.setPendingUpdate(Ve.SPLIT)):(e.resetPendingUpdate(Ve.SPLIT)&&e.updateAgentSuspension(),o===Ve.ELEVATION&&e.updateAgents(ie.ELEVATION),e.leaf||(e.setPendingUpdate(Ve.MERGE),e.resetPendingUpdate(Ve.SPLIT)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(qe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_markTileToUpdate(e){ve(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter((e=>e.loaded&&e.intersectsClippingArea));if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];ve(r.loaded),ve(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=De[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(xe(t),(e=>e.loaded)))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(Ee(Te[t]),(t=>!(!t.loaded||!t.intersectsClippingArea)&&(ve(e.has(t)||Oe(r,t)<0),i(r,t),!0))),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Me&&Ue&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some((s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(Ve.MERGE)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(Ve.MERGE);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(Ve.MERGE);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(Ve.SPLIT)){let t=!0;const i=s.level;if(i>=ce){const e=e=>e.leaf||i-e.level<ce;for(let r=0;r<4;++r){const a=s.findNeighborTile(Te[r],e);null!=a&&i-a.level===ce&&(t=!1,Me&&(ve(a.leaf),ve(a.hasPendingUpdate(Ve.SPLIT))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(Ve.SPLIT)}return e.done}));if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some((t=>(t.resetPendingUpdate(Ve.GEOMETRY)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done))),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done)))}_updateClippingExtent(){this.spatialReference&&(this.overlayManager?.updateOverlayParameters(Xe.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ge}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(this._rootTiles.forEach((e=>this._purgeTile(e))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?gt(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(it._tileMemcacheKey,e),this.notifyChange("demResolution")}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){fe(e.leaf,"Tile that is already split should not be split again!"),fe(e.rendered,"Tile marked to split is not rendered"),gt(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),e.updateAgentSuspension(),fe(e.rendered,"parent should be rendered"),t.forEach((e=>this._loadTile(e))),t.forEach((e=>this._pendingTilesToUpdate.add(e))),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach((e=>ut(e,e.hasPendingUpdate(Ve.SPLIT)))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){ht.spatialReference=this.spatialReference,ht.extent=e.extent,ht.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",ht)}createTile(e,t,i,r){fe(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(Ve.SPLIT),s}get _shortBatches(){return this.view.state.mode!==Ye.IDLE}_mergeTile(e){fe(!e.hasPendingUpdate(Ve.SPLIT),"_mergeTile sanity check"),fe(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),fe(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),ut(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&this.overlayManager.updateTileOverlayParameters(e)}_handleLayerViewChanges(e=Ze){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),Se(e)||we(e))if(this._basemapLayerViewHandles.has(e.uid)&&!we(e)){const i=this._layerClassFromLayerView(e),s=this._getLayerIdxByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(Ce(t)&&!W(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Le(e)||we(e))&&$e(Qe[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return be(e)?ie.ELEVATION:ie.MAP}_registerTiledLayerView(e){const t=[];if((Le(e)||we(e))&&t.push(_((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(te.UNFADED)}))),!we(e)){const i=this._layerClassFromLayerView(e);t.push(_((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(_((()=>e.fullOpacity),(()=>this._updateTileTextures(te.UNFADED)))),t.push(_((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),t.push(e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)})))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach((e=>{if(!e.layer||e.suspended||!Se(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===ie.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of re){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ie.ELEVATION&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ie.MAP),e===te.IMMEDIATE?this.renderer.updateTileTexture(t,Ve.TEXTURE_NOFADING):t.updateRenderData(ie.MAP,e)})),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=Xe.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||ye(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,u(r),c(t)||this._dataMissing(e,i,s),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();const s=t===ie.ELEVATION;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?be(i)?this._requestElevationTileData(e,i,r):Promise.reject():Ce(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!g(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{c(i)||(n.getLogger(this).error(`Tile ${e.lij.toString()} layer ${ie.ELEVATION}/${t.uid} error ${i}`),this._dataMissing(e,ie.ELEVATION,t),this.requestUpdate())};return t.fetchTile(e.lij,i).then((e=>this._frameTask.schedule((()=>r(e)))),s).finally((()=>--this._asyncWorkItems))}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[ie.ELEVATION].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",ie.ELEVATION,e.lij.toString());const s=new J(e.lij,e.extent,i);e.dataArrived(r,ie.ELEVATION,s);const a=[e],l=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,l),e.computeElevationBounds()}0===l&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{Pe(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer ${ie.MAP}/${t.uid} error ${r}`),this._dataMissing(e,ie.MAP,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{this.requestUpdate(),g(i)?Pe(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));return t.fetchTile(e.lij,i).then(a,n).finally((()=>--this._asyncWorkItems))}_mapTileDataArrived(e,t,i){const r=this._getLayerIdxByUID(ie.MAP,t.uid);if(null==r)return Pe(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,ie.MAP,i)}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i){const r=this._getLayerIdxByUID(t,i.uid);null!=r?e.dataMissing(r,t):n.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce(((e,t)=>e+t.usedMemory),0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._getLayerIdxByUID(i,e.uid);return null!=r&&this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(e){this._renderer.visualizeNormals=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Ue)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Re(e)}enableWaterproofnessChecks(e){Ie(e)}};e([v()],rt.prototype,"_renderer",void 0),e([v({constructOnly:!0})],rt.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],rt.prototype,"view",void 0),e([v({constructOnly:!0})],rt.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],rt.prototype,"compressionHandle",void 0),e([v()],rt.prototype,"_hasPendingUpdates",void 0),e([v()],rt.prototype,"_asyncWorkItems",void 0),e([v()],rt.prototype,"_allTilesDirty",void 0),e([v()],rt.prototype,"_allTilesSorted",void 0),e([v()],rt.prototype,"_viewChanged",void 0),e([v({type:Number})],rt.prototype,"heading",void 0),e([v()],rt.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],rt.prototype,"_watchUpdatingTracking",void 0),e([v()],rt.prototype,"_frameTask",void 0),e([v()],rt.prototype,"demResolution",null),e([v({readOnly:!0})],rt.prototype,"snapLevel",null),e([v({readOnly:!0})],rt.prototype,"lodSnappingEnabled",null),e([v()],rt.prototype,"_userClippingExtent",null),e([v()],rt.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],rt.prototype,"extent",null),e([v({readOnly:!0})],rt.prototype,"groundExtent",null),e([v({readOnly:!0})],rt.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],rt.prototype,"updating",null),e([v({readOnly:!0})],rt.prototype,"running",null),e([v(Y)],rt.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],rt.prototype,"updatingProgressValue",null),e([v()],rt.prototype,"_maxNumUpdating",void 0),e([v()],rt.prototype,"baseOpacity",null),e([v()],rt.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],rt.prototype,"viewingMode",null),e([v()],rt.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],rt.prototype,"ready",null),e([v({value:ne.FRONT_TO_BACK})],rt.prototype,"renderOrder",null),e([v({readOnly:!0})],rt.prototype,"rootTiles",null),e([v()],rt.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],rt.prototype,"spatialReference",null),e([v({type:t})],rt.prototype,"backgroundColor",null),e([v({value:!1})],rt.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],rt.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],rt.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],rt.prototype,"tilingSchemeLogic",void 0),e([v()],rt.prototype,"wireframe",null),e([v({value:!1})],rt.prototype,"suspended",null),e([v()],rt.prototype,"fadeDuration",null),e([v()],rt.prototype,"visibleElevationBounds",void 0),e([v()],rt.prototype,"rootTileElevationBounds",void 0),e([v()],rt.prototype,"_layerViewsDirty",void 0),e([v()],rt.prototype,"renderPatchBorders",null),e([v()],rt.prototype,"visualizeNormals",null),e([v()],rt.prototype,"renderingDisabled",null),rt=it=e([E("esri.views.3d.terrain.TerrainSurface")],rt);const st=rt,at=C(),nt=q(),lt=U();new p;const ot=new Q("ground"),ht={spatialReference:null,extent:null,scale:0};function dt(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return Z(t,i,s)}return null}class pt{constructor(e){this.capacity=e,this._head=0,this._tail=0,this._data=new Array(e)}push(e){const t=this._tail;if(!(t<this.capacity))throw new Error("Queue full");this._data[t]=e,this._tail=t+1}pushAll(e){const t=e.length;if(0===t)return;const i=this._tail;if(!(i+t<=this.capacity))throw new Error("Queue full");for(let r=0;r<t;++r)this._data[i+r]=e[r];this._tail=i+t}pop(){const e=this._head;if(e<this._tail){const t=this._data[e];return this._head=e+1,t}}get empty(){return this._head>=this._tail}get full(){return this._tail>=this._data.length}}function ut(e,t){!e.leaf||e.level<ce||mt(e,(e=>{t&&ct(e);const i=_t(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=_t(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}}))}function ct(e){if(e.hasPendingUpdate(Ve.SPLIT))return;let t=e.parent;for(;t?.resetPendingUpdate(Ve.MERGE);)t=t.parent;e.resetPendingUpdate(Ve.MERGE),e.leaf&&e.setPendingUpdate(Ve.SPLIT),e.level<ce||mt(e,(e=>{ct(e)}))}function gt(e){e.level<ce||mt(e,(e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,_t(t));)t=t.parent}}))}function _t(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function mt(e,t){if(e.level<ce)return;const i=e.level-ce,r=e.lij[1]>>ce,s=e.lij[2]>>ce,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(Te[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{st as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- 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{RasterColorizerStretchType as i}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as s}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as o}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as n}from"./BlendLayersTechniqueConfiguration.js";import{LayerClass as a}from"./LayerClass.js";import{RasterColorizerTechnique as h}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as u}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as l}from"./support/MultiSizeFramebuffer.js";import{LayerBlendMode as c}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BaseOpacityMode as d}from"../webgl-engine/core/shaderLibrary/terrain/BaseOpacityMode.js";import{BlendLayersOutput as _}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{PremultipliedAlphaSource as f}from"../webgl-engine/core/shaderLibrary/terrain/PremultipliedAlphaSource.js";import{a as p}from"../../../chunks/BlendLayers.glsl.js";import{BindParameters as m}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as b,Layout as g}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as T,FramebufferBit as x,TextureType as y}from"../../webgl/enums.js";import{Texture as C}from"../../webgl/Texture.js";import{vertexCount as B}from"../../webgl/Util.js";const O=()=>e.getLogger("esri.views.3d.terrain");class q{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new s,this._bindParameters=new m(null),this._blendConfiguration=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vaoQuad=b(this._rctx,g.Pos2Tex)}dispose(){this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vaoQuad=t(this._vaoQuad),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=f.Off,s=p.BelowLayer){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.baseOpacityMode=r,this._blendConfiguration.premultipliedSource=i,this._blendConfiguration.background=s,this._techniques.precompile(o,this._blendConfiguration),this._techniques.get(o,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(c.Normal,t?_.ColorComposite:_.GridComposite,d.NotRequired,f.Off,p.Only),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(T.TRIANGLE_STRIP,0,B(this._vaoQuad,"geometry"))}drawGroup(e,t,r,i,s=f.On){t===_.Composite&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const o=e.baseOpacity<1?d.Required:d.NotRequired,n=this._acquireBlendTechnique(i,t,o,s),a=this._rctx.bindTechnique(n,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=f.Off){if(null==e.texture)return;const o=e.baseOpacity<1?d.Required:d.NotRequired;e.fboTexture=t===_.GroupBackgroundComposite||i===c.Normal&&o===d.NotRequired&&s===f.Off?null:this.switch(r).colorTexture;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,a.MAP).ensureSymbolizerParameters(o),!o.bind(this._rctx))return;const n=e.baseOpacity<1?d.Required:d.NotRequired;e.fboTexture=i===c.Normal&&n===d.NotRequired?null:this.switch(r).colorTexture;const h=this._acquireRasterTechnique(o,t,i,n);if(!h)return;o.opacity=e.opacity;const u=o.getUniforms();u.scale=s.scale,u.offset=s.offset,u.backgroundColor=e.backgroundColor,u.fboTexture=e.fboTexture,u.baseOpacity=e.baseOpacity;const l=this._rctx.bindTechnique(h,this._bindParameters,u);this._render(l)}_acquireRasterTechnique(e,t,r,s){if(!this._rctx.capabilities.colorBufferFloat)return null;const o=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(o.type);return this._rasterConfiguration??=new u,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.baseOpacityMode=s,this._rasterConfiguration.colorizerType=n,this._rasterConfiguration.applyColormap=!!o.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?i.Noop:i.PerBand,this._techniques.precompile(h,this._rasterConfiguration),this._techniques.get(h,this._rasterConfiguration)}drawVectorData(e,t,i,s,o,n,h,u){const p=this._rctx,m=o.sourceLayerInfo.data,b=o.tile.surface.layerViewByIndex(o.layerIndex,a.MAP),g=e.baseOpacity<1?d.Required:d.NotRequired,T=g===d.Required||e.opacity<1||s!==c.Normal||t!==_.Composite,y=T?f.On:f.Off,C=this._acquireBlendTechnique(s,t,g,y);p.setPipelineState(C.getPipeline());let B=null,q=null;T?(q=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new l(this._rctx)),B=this._vtFBO.get(i),p.bindFramebuffer(B),this._clearCurrentFBO()):u&&p.clear(x.DEPTH);try{this._vectorTileHelper.renderBackground(p,o.sourceLod,b.painter,b.layer.styleRepository,b.schemaHelper,Math.round(1/o.scale),o.offset,h,n,b.contentZoom),m&&this._vectorTileHelper.renderContent(p,o.sourceLod,m,o.vtlNeighborInfos,b.painter,b.layer.styleRepository,b.schemaHelper,Math.round(1/o.scale),o.offset,h,n,b.contentZoom)}catch(I){O().warnOnce("A render call containing vector tiles did not resolve correctly.",I)}return!B||(p.bindFramebuffer(q),e.texture=B.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,y),u)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,C.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(y.TEXTURE_2D,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,C.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(x.COLOR|x.DEPTH|x.STENCIL)}_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 l(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{q as TileCompositor};
5
+ 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{RasterColorizerStretchType as i}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as s}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as o}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as n}from"./BlendLayersTechniqueConfiguration.js";import{LayerClass as a}from"./LayerClass.js";import{RasterColorizerTechnique as u}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as h}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as l}from"./support/MultiSizeFramebuffer.js";import{LayerBlendMode as c}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BaseOpacityMode as d}from"../webgl-engine/core/shaderLibrary/terrain/BaseOpacityMode.js";import{BlendLayersOutput as _}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{PremultipliedAlphaSource as f}from"../webgl-engine/core/shaderLibrary/terrain/PremultipliedAlphaSource.js";import{a as p}from"../../../chunks/BlendLayers.glsl.js";import{BindParameters as b}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as m,Layout as g}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as x,FramebufferBit as T,TextureType as y}from"../../webgl/enums.js";import{Texture as C}from"../../webgl/Texture.js";import{vertexCount as B}from"../../webgl/Util.js";const O=()=>e.getLogger("esri.views.3d.terrain");class q{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new s,this._bindParameters=new b(null),this._blendConfiguration=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vaoQuad=m(this._rctx,g.Pos2Tex)}dispose(){this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vaoQuad=t(this._vaoQuad),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=f.Off,s=p.BelowLayer){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.baseOpacityMode=r,this._blendConfiguration.premultipliedSource=i,this._blendConfiguration.background=s,this._techniques.precompile(o,this._blendConfiguration),this._techniques.get(o,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(c.Normal,t?_.ColorComposite:_.GridComposite,d.NotRequired,f.Off,p.Only),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(x.TRIANGLE_STRIP,0,B(this._vaoQuad,"geometry"))}drawGroup(e,t,r,i,s=f.On){t===_.Composite&&(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?d.Required:d.NotRequired,n=this._acquireBlendTechnique(i,t,o,s),a=this._rctx.bindTechnique(n,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=f.Off){if(null==e.texture)return;const o=e.baseOpacity<1?d.Required:d.NotRequired;e.fboTexture=t===_.GroupBackgroundComposite||i===c.Normal&&o===d.NotRequired&&s===f.Off?null:this.switch(r).colorTexture,null==e.fboTexture&&(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,a.MAP).ensureSymbolizerParameters(o),!o.bind(this._rctx))return;const n=e.baseOpacity<1?d.Required:d.NotRequired;e.fboTexture=i===c.Normal&&n===d.NotRequired?null:this.switch(r).colorTexture;const u=this._acquireRasterTechnique(o,t,i,n);if(!u)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 l=this._rctx.bindTechnique(u,this._bindParameters,h);this._render(l)}_acquireRasterTechnique(e,t,r,s){if(!this._rctx.capabilities.colorBufferFloat)return null;const o=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(o.type);return this._rasterConfiguration??=new h,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.baseOpacityMode=s,this._rasterConfiguration.colorizerType=n,this._rasterConfiguration.applyColormap=!!o.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?i.Noop:i.PerBand,this._techniques.precompile(u,this._rasterConfiguration),this._techniques.get(u,this._rasterConfiguration)}drawVectorData(e,t,i,s,o,n,u,h){const p=this._rctx,b=o.sourceLayerInfo.data,m=o.tile.surface.layerViewByIndex(o.layerIndex,a.MAP),g=e.baseOpacity<1?d.Required:d.NotRequired,x=g===d.Required||e.opacity<1||s!==c.Normal||t!==_.Composite,y=x?f.On:f.Off,C=this._acquireBlendTechnique(s,t,g,y);p.setPipelineState(C.getPipeline());let B=null,q=null;x?(q=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new l(this._rctx)),B=this._vtFBO.get(i),p.bindFramebuffer(B),this._clearCurrentFBO()):h&&p.clear(T.DEPTH);try{this._vectorTileHelper.renderBackground(p,o.sourceLod,m.painter,m.layer.styleRepository,m.schemaHelper,Math.round(1/o.scale),o.offset,u,n,m.contentZoom),b&&this._vectorTileHelper.renderContent(p,o.sourceLod,b,o.vtlNeighborInfos,m.painter,m.layer.styleRepository,m.schemaHelper,Math.round(1/o.scale),o.offset,u,n,m.contentZoom)}catch(I){O().warnOnce("A render call containing vector tiles did not resolve correctly.",I)}return!B||(p.bindFramebuffer(q),e.texture=B.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,y),h)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,C.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(y.TEXTURE_2D,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,C.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(T.COLOR|T.DEPTH|T.STENCIL)}_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 l(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{q as TileCompositor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as m,isGroupLayer as d,isReferenceLayer as h}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as f}from"../support/flowUtils.js";import{BlendLayersPassParameters as _}from"./BlendLayersTechnique.js";import{TextureUpdate as T}from"./interfaces.js";import{LayerClass as y}from"./LayerClass.js";import{NeighborIndex as g}from"./NeighborIndex.js";import{isImageWithType as b}from"./TerrainData.js";import{isBlendableLayerView as x,isVectorTileLayerView as I,isVectorTileRenderInfo as w,isImageryTileRenderInfo as A,isImageSourceRenderInfo as j,isTextureTileRenderInfo as P,isVectorTilePerLayerInfo as C}from"./terrainUtils.js";import{ActivationTime as O}from"./TextureFader.js";import{TextureReference as k}from"./TextureReference.js";import{TileCompositor as E}from"./TileCompositor.js";import{TileRenderInfo as L}from"./TileRenderInfo.js";import R from"./TileTexture.js";import{TileUpdate as M}from"./TileUpdate.js";import{fallsWithinLayerView as D}from"./tileUtils.js";import{blendModeFromString as N}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as B}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as U}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as S}from"../webgl-engine/lib/TextureCompressionWorkerHandle.js";import{TextureSamplingMode as G,TextureWrapMode as v,PixelFormat as F}from"../../webgl/enums.js";import{Texture as H}from"../../webgl/Texture.js";import{TextureDescriptor as q}from"../../webgl/TextureDescriptor.js";class z{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let V=class extends t{constructor(e){super(e),this._passParameters=new _,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new E(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;Q.clear(),Y.length=0;const l=e.layerInfo[y.MAP];let _=0,g=null;for(;_<l.length;_++){const t=r.layerViewByIndex(_,y.MAP),T=t.layer,b=!D(e,t),w=T.opacity,A=t.fullOpacity;if(c=c||m(T),f(t))continue;if(x(t)){let e="normal"!==t.layer.blendMode;if(d(T.parent)){const t=T.parent.uid;null!=t&&""!==t&&(e=$(T.parent)||e)}e&&(p=e,n=!1)}if((b||0===w)&&!p){l[_].pendingUpdates&=~(M.TEXTURE_NOFADING&M.TEXTURE_FADING);continue}++i;const j=I(t),P=X(e,_,j);if(P){if(l[_].pendingUpdates&=~(M.TEXTURE_NOFADING&M.TEXTURE_FADING),d(T.parent)){const e=T.parent.uid;null!=e&&""!==e&&J(T.parent,_)}j?a=Math.max(a,this.tileSize*u):1===s&&1===A&&(t.isOpaque||this._dataToTexture(P,h(T))&&P.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===g&&(g=_)}}const b=a/this.tileSize,w=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==g?1===o&&!p&&this._useLayerTexture(e,g)||this._composeLayers(e,t,_-1,c,a,b,!n||p,Q,p):K(e,i,w,t!==T.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,y.MAP),s=m(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=X(e,t,!1);return!!this._dataToTexture(n,h(r.layer))&&(e.renderData.setTextureReference(new k(n.sourceLayerInfo.data,T.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,d=G.LINEAR_MIPMAP_LINEAR,f=!1,_=0;for(let j=r;j>=0;j--){const t=e.surface.layerViewByIndex(j,y.MAP),r=t.layer,T=I(t),g=X(e,j,T),b=r.opacity,P=!D(e,t);if(!g||(0===b||P)&&!c)continue;const C=!m(r)&&!l;C&&(l=!0);let O=!1;n.forEach((e=>{e.start===j&&(e.output=s?B.Composite:a&&C?this.backgroundIsGrid?B.GridComposite:B.ColorComposite:B.Composite,e.baseOpacity=C?u:1,Y.push(e),this._compositor.openGroup(o),O=!0)}));const k=0===_,E=O?B.GroupBackgroundComposite:a&&k?this.backgroundIsGrid?B.GridComposite:B.ColorComposite:B.Composite,L=N[x(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=C&&!O&&u<1?u:1,this._passParameters.opacity=b,w(g)?f=this._compositor.drawVectorData(this._passParameters,E,o,L,g,i,this.tileSize,f):A(g)?(this._compositor.drawRasterData(this._passParameters,E,o,L,g),W(g)&&(d=G.NEAREST)):this._dataToTexture(g,h(r))&&(this._passParameters.texture=g.sourceLayerInfo.data.texture,this._passParameters.offset=g.offset,this._passParameters.scale=g.scale,this._compositor.drawImageData(this._passParameters,E,o,L));Y.length>0&&Y[Y.length-1].end===j;){const e=Y.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,N[e.blendMode])}_++}const T=e.renderData,g=c||l&&u<1,b=T.ensureTexture(o,g,t,(()=>this._buildTexture(o,g,d)));this._compositor.copyFBOToTexture(b),this._compositor.unbind(),T.setTextureReference(new k(b,t,ee,l?1:u,0,1))}_dataToTexture(e,t){if(j(e)){const r=e.sourceLayerInfo,s=1===e.scale&&!t;r.data=this._buildTexture(r.data,!0,s),e.tile.setMemoryDirty()}return P(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=G.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new q;s.wrapMode=v.CLAMP_TO_EDGE,s.samplingMode="boolean"==typeof r?G.LINEAR_MIPMAP_LINEAR:r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=F.RGB);const o=this.rctx,i="boolean"==typeof r&&r;let a;if("number"==typeof e)s.width=s.height=e,a=this._buildTileTexture(s,e);else if(b(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=F.RGB),a=this._buildTileTexture(s,e.element.width,i,e.element);else try{s.width=e.width,s.height=e.height,a=this._buildTileTexture(s,e.width,i,e)}catch(c){a=new R(U(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const n=o.bindTexture(a.texture,H.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(n,H.TEXTURE_UNIT_FOR_UPDATES),a}_buildTileTexture(e,t,r=!1,s){const a=`${t} ${e.pixelFormat}`,n=this.cache.pop(a)??this.cache.pop(a+"compressed");if(r&&=S(s),n)return n.retain(),r&&n.texture.enableCompression(!0),n.texture.setData(s),n;e.shouldCompress=r;const c=new H(this.rctx,e,s);return c.isCompressing&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new R(c,this.cache)}get test(){}};function X(e,t,r){Z.layerIndex=t,Z.vtlNeighborInfos.clear();const s=e.layerInfo[y.MAP][t];if(c(Z.offset,0,0),Z.tile=e,Z.scale=1,Z.sourceLod=e.lij,Z.sourceLayerInfo=s,Z.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[y.MAP][t];if(!C(i)||s.data===i.data)return;const a=Z.vtlNeighborInfos.pushNew();a.offset=te[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Z;const o=s.upsampleInfo,i=o?.tile?.layerInfo[y.MAP][t];return i&&o.tile?(Z.tile=o.tile,u(Z.offset,o.offset),Z.scale=o.scale,Z.sourceLod=o.tile.lij,Z.sourceLayerInfo=i,Z):r?Z:null}function W(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function $(e){let t="normal"!==e.blendMode;return d(e.parent)&&(t=$(e.parent)||t),t}function J(e,t){d(e.parent)&&J(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=Q.get(r);s?s.start=t:Q.set(r,new z(t,t,e.blendMode,e.opacity,B.Composite,1))}}function K(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?O.Delayed:O.Immediate;o.setTextureReference(new k(r,T.FADING,ee,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],V.prototype,"rctx",void 0),e([a({constructOnly:!0})],V.prototype,"techniques",void 0),e([a({constructOnly:!0})],V.prototype,"cache",void 0),e([a()],V.prototype,"tileSize",void 0),e([a()],V.prototype,"texturesBeingCompressed",void 0),V=e([n("esri.views.3d.terrain.TileRenderer")],V);const Q=new Map,Y=new Array,Z=new L,ee=l(0,0,1,1),te=new Array;te[g.NORTH]=[0,-1],te[g.NORTH_EAST]=[-1,-1],te[g.EAST]=[-1,0],te[g.SOUTH_EAST]=[-1,1],te[g.SOUTH]=[0,1],te[g.SOUTH_WEST]=[1,1],te[g.WEST]=[1,0],te[g.NORTH_WEST]=[1,-1];export{z as GroupInfo,V as TileRenderer};
5
+ import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as o}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as a,isGroupLayer as n,isReferenceLayer as u}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as c}from"../support/flowUtils.js";import{BlendLayersPassParameters as l}from"./BlendLayersTechnique.js";import{TextureUpdate as p}from"./interfaces.js";import{LayerClass as d}from"./LayerClass.js";import{NeighborIndex as m}from"./NeighborIndex.js";import{isImageWithType as h}from"./TerrainData.js";import{isBlendableLayerView as f,isVectorTileLayerView as _,isVectorTileRenderInfo as T,isImageryTileRenderInfo as y,isImageSourceRenderInfo as b,isTextureTileRenderInfo as x,isVectorTilePerLayerInfo as g}from"./terrainUtils.js";import{ActivationTime as I}from"./TextureFader.js";import{TextureReference as w}from"./TextureReference.js";import{TileCompositor as A}from"./TileCompositor.js";import{TileRenderInfo as P}from"./TileRenderInfo.js";import k from"./TileTexture.js";import{TileUpdate as E}from"./TileUpdate.js";import{fallsWithinLayerView as O}from"./tileUtils.js";import{blendModeFromString as j}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as M}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as D}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as L}from"../../support/TextureCompressionWorkerHandle.js";import{TextureSamplingMode as R,TextureWrapMode as C,PixelFormat as N}from"../../webgl/enums.js";import{Texture as U}from"../../webgl/Texture.js";import{TextureDescriptor as S}from"../../webgl/TextureDescriptor.js";class B{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}class G{constructor(e,t,r,s,o){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._compressionHandle=o,this._passParameters=new l,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new A(this._rctx,this._techniques),this._ensureBackgroundTexture(this.tileSize)}dispose(){this._compositor=e(this._compositor),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,l=this.tileSize,m=!1,h=!1;const T=r.view.state.contentPixelRatio;let y=!1;V.clear(),X.length=0;const b=e.layerInfo[d.MAP];let x=0,g=null;for(;x<b.length;x++){const t=r.layerViewByIndex(x,d.MAP),p=t.layer,I=!O(e,t),w=p.opacity,A=t.fullOpacity;if(h=h||a(p),c(t))continue;if(f(t)){let e="normal"!==t.layer.blendMode;if(n(p.parent)){const t=p.parent.uid;null!=t&&""!==t&&(e=v(p.parent)||e)}e&&(y=e,m=!1)}if((I||0===w)&&!y){b[x].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING);continue}++i;const P=_(t),k=F(e,x,P);if(k){if(b[x].pendingUpdates&=~(E.TEXTURE_NOFADING&E.TEXTURE_FADING),n(p.parent)){const e=p.parent.uid;null!=e&&""!==e&&q(p.parent,x)}P?l=Math.max(l,this.tileSize*T):1===s&&1===A&&(t.isOpaque||this._dataToTexture(k,u(p))&&k.sourceLayerInfo.data.descriptor.isOpaque)&&(m=!0),++o,null===g&&(g=x)}}const I=l/this.tileSize,w=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==g?1===o&&!y&&this._useLayerTexture(e,g)||this._composeLayers(e,t,x-1,h,l,I,!m||y,V,y):z(e,i,w,t!==p.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=o,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,d.MAP),s=a(r.layer),o=s?e.surface.baseOpacity:1,n=s?1:e.surface.baseOpacity,c=r.fullOpacity,l=F(e,t,!1);return!!this._dataToTexture(l,u(r.layer))&&(e.renderData.setTextureReference(new w(l.sourceLayerInfo.data,p.FADING,i(l.offset[0],l.offset[1],l.scale,l.scale),o,n,c)),!0)}_composeLayers(e,t,r,s,i,n,c,l,p){this._compositor.ensureBuffer(i);const m=e.surface.baseOpacity;let h=!1,b=R.LINEAR_MIPMAP_LINEAR,x=!1,g=0;for(let w=r;w>=0;w--){const t=e.surface.layerViewByIndex(w,d.MAP),r=t.layer,I=_(t),A=F(e,w,I),P=r.opacity,k=!O(e,t);if(!A||(0===P||k)&&!p)continue;const E=!a(r)&&!h;E&&(h=!0);let D=!1;l.forEach((e=>{e.start===w&&(e.output=s?M.Composite:c&&E?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,e.baseOpacity=E?m:1,X.push(e),this._compositor.openGroup(i),D=!0)}));const L=0===g,C=D?M.GroupBackgroundComposite:c&&L?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,N=j[f(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=E&&!D&&m<1?m:1,this._passParameters.opacity=P,T(A)?x=this._compositor.drawVectorData(this._passParameters,C,i,N,A,n,this.tileSize,x):y(A)?(this._compositor.drawRasterData(this._passParameters,C,i,N,A),H(A)&&(b=R.NEAREST)):this._dataToTexture(A,u(r))&&(this._passParameters.texture=A.sourceLayerInfo.data.texture,this._passParameters.offset=A.offset,this._passParameters.scale=A.scale,this._compositor.drawImageData(this._passParameters,C,i,N));X.length>0&&X[X.length-1].end===w;){const e=X.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=o,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,i,j[e.blendMode])}g++}const I=e.renderData,A=p||h&&m<1,P=I.ensureTexture(i,A,t,(()=>this._buildTexture(i,A,b)));this._compositor.copyFBOToTexture(P),this._compositor.unbind(),I.setTextureReference(new w(P,t,$,h?1:m,0,1))}_dataToTexture(e,t){if(b(e)){const r=e.sourceLayerInfo,s=1===e.scale&&!t;r.data=this._buildTexture(r.data,!0,s),e.tile.setMemoryDirty()}return x(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=R.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new S;s.wrapMode=C.CLAMP_TO_EDGE,s.samplingMode="boolean"==typeof r?R.LINEAR_MIPMAP_LINEAR:r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=N.RGB);const o=this._rctx,i="boolean"==typeof r&&r;let a;if("number"==typeof e)s.width=s.height=e,a=this._buildTileTexture(s,e);else if(h(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=N.RGB),a=this._buildTileTexture(s,e.element.width,i,e.element);else try{s.width=e.width,s.height=e.height,a=this._buildTileTexture(s,e.width,i,e)}catch(u){a=new k(D(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const n=o.bindTexture(a.texture,U.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(n,U.TEXTURE_UNIT_FOR_UPDATES),a}_buildTileTexture(e,t,r=!1,s){const o=`${t} ${e.pixelFormat}`,i=this._cache.pop(o)??this._cache.pop(o+"compressed");if(r&&=L(s),i)return i.retain(),r?i.texture.enableCompression(this._compressionHandle):i.texture.disableCompression(),i.texture.setData(s),i;e.compressionHandle=r?this._compressionHandle:null;const a=new U(this._rctx,e,s);return new k(a,this._cache)}get test(){}}function F(e,t,o){W.layerIndex=t,W.vtlNeighborInfos.clear();const i=e.layerInfo[d.MAP][t];if(r(W.offset,0,0),W.tile=e,W.scale=1,W.sourceLod=e.lij,W.sourceLayerInfo=i,W.isVTLBackground=o,i.data)return o&&e.forEachLoadedNeighbor(((r,s)=>{if(r.level!==e.level)return;const o=r.layerInfo[d.MAP][t];if(!g(o)||i.data===o.data)return;const a=W.vtlNeighborInfos.pushNew();a.offset=J[s],a.sourceLod=r.lij,a.sourceLayerInfo=o})),W;const a=i.upsampleInfo,n=a?.tile?.layerInfo[d.MAP][t];return n&&a.tile?(W.tile=a.tile,s(W.offset,a.offset),W.scale=a.scale,W.sourceLod=a.tile.lij,W.sourceLayerInfo=n,W):o?W:null}function H(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function v(e){let t="normal"!==e.blendMode;return n(e.parent)&&(t=v(e.parent)||t),t}function q(e,t){n(e.parent)&&q(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=V.get(r);s?s.start=t:V.set(r,new B(t,t,e.blendMode,e.opacity,M.Composite,1))}}function z(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?I.Delayed:I.Immediate;o.setTextureReference(new w(r,p.FADING,$,e.surface.baseOpacity,0,1),i)}const V=new Map,X=new Array,W=new P,$=i(0,0,1,1),J=new Array;J[m.NORTH]=[0,-1],J[m.NORTH_EAST]=[-1,-1],J[m.EAST]=[-1,0],J[m.SOUTH_EAST]=[-1,1],J[m.SOUTH]=[0,1],J[m.SOUTH_WEST]=[1,1],J[m.WEST]=[1,0],J[m.NORTH_WEST]=[1,-1];export{B as GroupInfo,G as TileRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{p as s,J as a}from"../../../../../../chunks/vec32.js";import{freeze as i,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as h,fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as p}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as d}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as m,IntegratedMeshMode as g}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as f}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as x}from"./shader/VertexDiscardMode.js";import{MaterialBase as v,parameter as b,parameterBlock as M,MaterialParameterBlock as y}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as T}from"../../../core/renderPasses/RenderPassIdentifier.js";import{ShaderOutput as w}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as O}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as C}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as S}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as N}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as D,CullFaceOptions as A}from"../../../lib/basicInterfaces.js";import{OITPass as q}from"../../../lib/OITPass.js";import{advancedMRRFactors as R}from"../../../materials/pbrUtils.js";import{defaultHighlightName as F}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as I}from"../../../../../../webscene/support/AlphaCutoff.js";class E extends v{constructor(e,s){super(),this.toMapSpace=s,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=R,this.emissiveFactor=i(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.commonMaterialParameters=new L,this.componentParameters=new V,this.objectOpacity=1,this.textureAlphaCutoff=I,this.alphaDiscardMode=D.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1;const a=new j(e.position),l=o(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=a.low,this.transformWorldFromModelTH=a.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get hasEmissions(){return null!=this.emissionTexture||!s(this.emissiveFactor,l)}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,r,o){const s=new m(e.context.spherical);s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.oitPass=t.identifier===T.Material&&null!=r.oitPass?r.oitPass:q.NONE,s.terrainDepthTest=t.identifier===T.Material&&r.terrainDepthTest,s.cullAboveTerrain=t.identifier===T.Material&&r.cullAboveTerrain,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?S.View:S.None,s.hasColorTexture=null!=this.baseColorTexture;const a=this._computeWhichMaterialPass();if(s.blendingEnabled=a===W.Transparent||a===W.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?U(r)?_(r)?g.ColorOverlayWithWater:g.ColorOverlay:g.NoOverlay:g.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===g.ColorOverlayWithWater?N.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.shadeNormals&&this.isIntegratedMesh?N.Disabled:N.Schematic:N.Normal:N.Disabled,s.emissionSource=null!=this.emissionTexture?C.Texture:s.pbrMode===N.Normal?C.Value:C.None,s.shadeNormals=o.shadeNormals,s.normalType=s.hasNormals?O.Compressed:O.ScreenDerivative,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,t.identifier===T.ShadowMap)s.output=w.Shadow,s.vertexDiscardMode=x.None;else if(t.identifier===T.ViewshedShadowMap)s.output=w.ViewshedShadow,s.vertexDiscardMode=x.None;else if(t.identifier===T.Highlight)s.output=w.Highlight,s.vertexDiscardMode=x.None;else{switch(a===W.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?x.Opaque:x.Transparent:s.vertexDiscardMode=x.None,s.output=t.output,s.receiveAmbientOcclusion=s.receiveShadows=!1,t.output){case w.Color:case w.ColorEmission:s.receiveAmbientOcclusion=o.applySSAO&&null!=r.ssao,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.screenSpaceReflections=null!=r.ssr.lastFrameColor,s.cloudReflections=null!=r.clouds.data;break;case w.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}const i=e.get(c,s);return this._setClean(),i}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}submit(e,t,r){if(this.objectOpacity<=0)return;const{componentData:o,renderable:s}=r,{geometry:a}=s,i=s.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:h}=o;switch(this._computeWhichMaterialPass()){case W.Opaque:e.opaque.submitDraw(this,a,l,i);break;case W.Transparent:e.transparent.submitDraw(this,a,l,i);break;case W.OpaqueAndTransparent:e.opaque.submitDraw(this,a,l,i),e.transparent.submitDraw(this,a,l,i);break;case W.IntegratedMesh:e.integratedMesh.submitDraw(this,a,l,i),H(t)&&e.highlightIntegratedMesh.submitDraw(this,a,l,i)}if(this.componentParameters.castShadows!==k.None){if(null!=n)for(const t of n)t[0]===F&&e.highlightShadowMap.submitDraw(this,a,t[1],i,t[0]);null!=h&&e.defaultShadowMap.submitDraw(this,a,h,i),e.shadowMap.submitDraw(this,a,l,i)}if(null!=n)for(const u of n)e.highlight.submitDraw(this,a,u[1],i,u[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,a,l,i)}_computeWhichMaterialPass(){if(this.isIntegratedMesh)return W.IntegratedMesh;if(this.objectOpacity<1)return W.Transparent;if(this.componentParameters.opaqueOverride===k.All)return W.Opaque;if(this.baseColor[3]<1||this.alphaDiscardMode===D.Blend||this.alphaDiscardMode===D.MaskBlend)return W.Transparent;switch(this.componentParameters.transparent){case k.None:return W.Opaque;case k.All:return W.Transparent;case k.Some:return W.OpaqueAndTransparent}}}var W,k;e([b({vectorOps:n})],E.prototype,"baseColor",void 0),e([b()],E.prototype,"usePBR",void 0),e([b()],E.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:a})],E.prototype,"mrrFactors",void 0),e([b({vectorOps:a})],E.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],E.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],E.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],E.prototype,"emissionTexture",void 0),e([b({dispose:!0})],E.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],E.prototype,"normalTexture",void 0),e([M()],E.prototype,"commonMaterialParameters",void 0),e([M()],E.prototype,"componentParameters",void 0),e([b()],E.prototype,"objectOpacity",void 0),e([b()],E.prototype,"textureAlphaCutoff",void 0),e([b()],E.prototype,"alphaDiscardMode",void 0),e([b()],E.prototype,"isIntegratedMesh",void 0),e([b()],E.prototype,"polygonOffsetEnabled",void 0),e([b()],E.prototype,"ellipsoidMode",void 0),e([b()],E.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(W||(W={}));class L extends y{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=A.Back,this.hasSlicePlane=!0}}e([b()],L.prototype,"doubleSided",void 0),e([b()],L.prototype,"cullFace",void 0),e([b()],L.prototype,"hasSlicePlane",void 0);class V extends y{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=p.Multiply,this.castShadows=k.All}get transparent(){return this.externalColor[3]<1?k.All:k.None}get opaqueOverride(){return this.externalColorMixMode===p.Replace&&1===this.externalColor[3]?k.All:k.None}get visible(){return this.externalColor[3]>0?k.All:k.None}get type(){return f.Uniform}}e([b({vectorOps:n})],V.prototype,"externalColor",void 0),e([b()],V.prototype,"externalColorMixMode",void 0),e([b()],V.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(k||(k={}));class B extends y{constructor(){super(...arguments),this.texture=null,this.transparent=k.None,this.opaqueOverride=k.None,this.castShadows=k.None}get type(){return f.Varying}}function H(e){return null!=e.overlay?.getTexture(d.Highlight)}function _(e){return null!=e.overlay?.getTexture(d.WaterNormal)}function U(e){return null!=e.overlay?.getTexture(d.ColorNoRasterImage)}e([b()],B.prototype,"texture",void 0),e([b()],B.prototype,"transparent",void 0),e([b()],B.prototype,"opaqueOverride",void 0),e([b()],B.prototype,"castShadows",void 0);export{L as CommonMaterialParameters,E as ComponentMaterial,k as ComponentParameterSummary,V as ComponentParametersUniform,B as ComponentParametersVarying};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{p as s,J as a}from"../../../../../../chunks/vec32.js";import{freeze as i,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as h,fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as p}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as c}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as d}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as m,IntegratedMeshMode as g}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as f}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as x}from"./shader/VertexDiscardMode.js";import{MaterialBase as v,parameter as M,parameterBlock as b,MaterialParameterBlock as T}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as y}from"../../../core/renderPasses/RenderPassIdentifier.js";import{ShaderOutput as w}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as O}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as C}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as S}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as N}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as D,CullFaceOptions as A}from"../../../lib/basicInterfaces.js";import{OITPass as q}from"../../../lib/OITPass.js";import{advancedMRRFactors as R}from"../../../materials/pbrUtils.js";import{defaultHighlightName as F}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as I}from"../../../../../../webscene/support/AlphaCutoff.js";class E extends v{constructor(e,s){super(),this.toMapSpace=s,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=R,this.emissiveFactor=i(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.commonMaterialParameters=new L,this.componentParameters=new V,this.objectOpacity=1,this.textureAlphaCutoff=I,this.alphaDiscardMode=D.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1;const a=new j(e.position),l=o(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=a.low,this.transformWorldFromModelTH=a.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get hasEmissions(){return null!=this.emissionTexture||!s(this.emissiveFactor,l)}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,r,o){const s=new m(e.context.spherical);s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.oitPass=t.identifier===y.Material&&null!=r.oitPass?r.oitPass:q.NONE,s.terrainDepthTest=t.identifier===y.Material&&r.terrainDepthTest,s.cullAboveTerrain=t.identifier===y.Material&&r.cullAboveTerrain,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?S.View:S.None,s.hasColorTexture=null!=this.baseColorTexture;const a=this._computeWhichMaterialPass();if(s.blendingEnabled=a===W.Transparent||a===W.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?U(r)?_(r)?g.ColorOverlayWithWater:g.ColorOverlay:g.NoOverlay:g.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===g.ColorOverlayWithWater?N.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.shadeNormals&&this.isIntegratedMesh?N.Disabled:N.Schematic:N.Normal:N.Disabled,s.emissionSource=null!=this.emissionTexture?C.Texture:s.pbrMode===N.Normal?C.Value:C.None,s.shadeNormals=o.shadeNormals,s.normalType=s.hasNormals?O.Compressed:O.ScreenDerivative,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,s.receiveAmbientOcclusion=s.hasOccludees=s.receiveShadows=s.screenSpaceReflections=s.cloudReflections=s.hasHighlightMixTexture=!1,t.identifier===y.ShadowMap)s.output=w.Shadow,s.vertexDiscardMode=x.None;else if(t.identifier===y.ViewshedShadowMap)s.output=w.ViewshedShadow,s.vertexDiscardMode=x.None;else if(t.identifier===y.Highlight)s.output=w.Highlight,s.vertexDiscardMode=x.None,s.hasHighlightMixTexture=null!=r.highlightMixTexture;else{switch(a===W.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?x.Opaque:x.Transparent:s.vertexDiscardMode=x.None,s.output=t.output,t.output){case w.Color:case w.ColorEmission:s.receiveAmbientOcclusion=o.applySSAO&&null!=r.ssao?.getTexture(),s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.screenSpaceReflections=null!=r.ssr.lastFrameColor,s.cloudReflections=null!=r.clouds.data?.cubeMap?.colorTexture;break;case w.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}const i=e.get(d,s);return this._setClean(),i}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}submit(e,t,r){if(this.objectOpacity<=0)return;const{componentData:o,renderable:s}=r,{geometry:a}=s,i=s.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:h}=o;switch(this._computeWhichMaterialPass()){case W.Opaque:e.opaque.submitDraw(this,a,l,i);break;case W.Transparent:e.transparent.submitDraw(this,a,l,i);break;case W.OpaqueAndTransparent:e.opaque.submitDraw(this,a,l,i),e.transparent.submitDraw(this,a,l,i);break;case W.IntegratedMesh:e.integratedMesh.submitDraw(this,a,l,i),H(t)&&e.highlightIntegratedMesh.submitDraw(this,a,l,i)}if(this.componentParameters.castShadows!==k.None){if(null!=n)for(const t of n)t[0]===F&&e.highlightShadowMap.submitDraw(this,a,t[1],i,t[0]);null!=h&&e.defaultShadowMap.submitDraw(this,a,h,i),e.shadowMap.submitDraw(this,a,l,i)}if(null!=n)for(const u of n)e.highlight.submitDraw(this,a,u[1],i,u[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,a,l,i)}_computeWhichMaterialPass(){if(this.isIntegratedMesh)return W.IntegratedMesh;if(this.objectOpacity<1)return W.Transparent;if(this.componentParameters.opaqueOverride===k.All)return W.Opaque;if(this.baseColor[3]<1||this.alphaDiscardMode===D.Blend||this.alphaDiscardMode===D.MaskBlend)return W.Transparent;switch(this.componentParameters.transparent){case k.None:return W.Opaque;case k.All:return W.Transparent;case k.Some:return W.OpaqueAndTransparent}}}var W,k;e([M({vectorOps:n})],E.prototype,"baseColor",void 0),e([M()],E.prototype,"usePBR",void 0),e([M()],E.prototype,"hasParametersFromSource",void 0),e([M({vectorOps:a})],E.prototype,"mrrFactors",void 0),e([M({vectorOps:a})],E.prototype,"emissiveFactor",void 0),e([M({dispose:!0})],E.prototype,"baseColorTexture",void 0),e([M({dispose:!0})],E.prototype,"metallicRoughnessTexture",void 0),e([M({dispose:!0})],E.prototype,"emissionTexture",void 0),e([M({dispose:!0})],E.prototype,"occlusionTexture",void 0),e([M({dispose:!0})],E.prototype,"normalTexture",void 0),e([b()],E.prototype,"commonMaterialParameters",void 0),e([b()],E.prototype,"componentParameters",void 0),e([M()],E.prototype,"objectOpacity",void 0),e([M()],E.prototype,"textureAlphaCutoff",void 0),e([M()],E.prototype,"alphaDiscardMode",void 0),e([M()],E.prototype,"isIntegratedMesh",void 0),e([M()],E.prototype,"polygonOffsetEnabled",void 0),e([M()],E.prototype,"ellipsoidMode",void 0),e([M()],E.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(W||(W={}));class L extends T{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=A.Back,this.hasSlicePlane=!0}}e([M()],L.prototype,"doubleSided",void 0),e([M()],L.prototype,"cullFace",void 0),e([M()],L.prototype,"hasSlicePlane",void 0);class V extends T{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=p.Multiply,this.castShadows=k.All}get transparent(){return this.externalColor[3]<1?k.All:k.None}get opaqueOverride(){return this.externalColorMixMode===p.Replace&&1===this.externalColor[3]?k.All:k.None}get visible(){return this.externalColor[3]>0?k.All:k.None}get type(){return f.Uniform}}e([M({vectorOps:n})],V.prototype,"externalColor",void 0),e([M()],V.prototype,"externalColorMixMode",void 0),e([M()],V.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(k||(k={}));class B extends T{constructor(){super(...arguments),this.texture=null,this.transparent=k.None,this.opaqueOverride=k.None,this.castShadows=k.None}get type(){return f.Varying}}function H(e){return null!=e.overlay?.getTexture(c.Highlight)}function _(e){return null!=e.overlay?.getTexture(c.WaterNormal)}function U(e){return null!=e.overlay?.getTexture(c.ColorNoRasterImage)}e([M()],B.prototype,"texture",void 0),e([M()],B.prototype,"transparent",void 0),e([M()],B.prototype,"opaqueOverride",void 0),e([M()],B.prototype,"castShadows",void 0);export{L as CommonMaterialParameters,E as ComponentMaterial,k as ComponentParameterSummary,V as ComponentParametersUniform,B as ComponentParametersVarying};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../../../../chunks/tslib.es6.js";import{ComponentDataType as e}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as t}from"./shader/VertexDiscardMode.js";import{ShaderOutput as r}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as s}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateType as i}from"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{EmissionSource as a}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as d}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as p}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as n}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{parameter as h,ShaderTechniqueConfiguration as l}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{CullFaceOptions as c,AlphaDiscardMode as u}from"../../../lib/basicInterfaces.js";import{OITPass as y}from"../../../lib/OITPass.js";import{BindType as m}from"../../../../../webgl/BindType.js";var v;!function(o){o[o.None=0]="None",o[o.NoOverlay=1]="NoOverlay",o[o.ColorOverlay=2]="ColorOverlay",o[o.ColorOverlayWithWater=3]="ColorOverlayWithWater",o[o.COUNT=4]="COUNT"}(v||(v={}));class T extends l{constructor(o){super(),this.spherical=o,this.output=r.Color,this.textureCoordinateType=i.None,this.componentData=e.Uniform,this.cullFace=c.Back,this.vertexDiscardMode=t.None,this.doubleSidedMode=d.WindingOrder,this.alphaDiscardMode=u.Opaque,this.integratedMeshMode=v.None,this.oitPass=y.NONE,this.ellipsoidMode=n.Earth,this.pbrMode=p.Disabled,this.normalType=s.Attribute,this.emissionSource=a.None,this.hasVertexColors=!1,this.hasNormals=!1,this.shadeNormals=!0,this.hasSlicePlane=!1,this.hasColorTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.screenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.objectAndLayerIdColor=!1,this.discardInvisibleFragments=!1,this.occlusionPass=!1,this.bindType=m.Draw,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.highStepCount=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.objectAndLayerIdColorInstanced=!1,this.canHaveOverlay=!0}}o([h({count:r.COUNT})],T.prototype,"output",void 0),o([h({count:i.COUNT})],T.prototype,"textureCoordinateType",void 0),o([h({count:e.COUNT})],T.prototype,"componentData",void 0),o([h({count:c.COUNT})],T.prototype,"cullFace",void 0),o([h({count:t.COUNT})],T.prototype,"vertexDiscardMode",void 0),o([h({count:d.COUNT})],T.prototype,"doubleSidedMode",void 0),o([h({count:u.COUNT})],T.prototype,"alphaDiscardMode",void 0),o([h({count:v.COUNT})],T.prototype,"integratedMeshMode",void 0),o([h({count:y.COUNT})],T.prototype,"oitPass",void 0),o([h({count:n.COUNT})],T.prototype,"ellipsoidMode",void 0),o([h({count:p.COUNT})],T.prototype,"pbrMode",void 0),o([h({count:s.COUNT})],T.prototype,"normalType",void 0),o([h({count:a.COUNT})],T.prototype,"emissionSource",void 0),o([h()],T.prototype,"hasVertexColors",void 0),o([h()],T.prototype,"hasNormals",void 0),o([h()],T.prototype,"shadeNormals",void 0),o([h()],T.prototype,"hasSlicePlane",void 0),o([h()],T.prototype,"hasColorTexture",void 0),o([h()],T.prototype,"receiveAmbientOcclusion",void 0),o([h()],T.prototype,"receiveShadows",void 0),o([h()],T.prototype,"blendingEnabled",void 0),o([h()],T.prototype,"screenSpaceReflections",void 0),o([h()],T.prototype,"hasPolygonOffset",void 0),o([h()],T.prototype,"hasMetallicRoughnessTexture",void 0),o([h()],T.prototype,"hasOcclusionTexture",void 0),o([h()],T.prototype,"hasNormalTexture",void 0),o([h()],T.prototype,"hasOccludees",void 0),o([h()],T.prototype,"terrainDepthTest",void 0),o([h()],T.prototype,"cullAboveTerrain",void 0),o([h()],T.prototype,"hasNormalTextureTransform",void 0),o([h()],T.prototype,"cloudReflections",void 0),o([h()],T.prototype,"snowCover",void 0),o([h()],T.prototype,"objectAndLayerIdColor",void 0);export{T as ComponentTechniqueConfiguration,v as IntegratedMeshMode};
5
+ import{_ as o}from"../../../../../../chunks/tslib.es6.js";import{ComponentDataType as e}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as t}from"./shader/VertexDiscardMode.js";import{ShaderOutput as r,isColorEmissionHighlightOrOID as i}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as s}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateType as a}from"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{EmissionSource as d}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as h}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as p}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as l}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{parameter as n,ShaderTechniqueConfiguration as c}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{CullFaceOptions as u,AlphaDiscardMode as y}from"../../../lib/basicInterfaces.js";import{OITPass as m}from"../../../lib/OITPass.js";import{BindType as v}from"../../../../../webgl/BindType.js";var T;!function(o){o[o.None=0]="None",o[o.NoOverlay=1]="NoOverlay",o[o.ColorOverlay=2]="ColorOverlay",o[o.ColorOverlayWithWater=3]="ColorOverlayWithWater",o[o.COUNT=4]="COUNT"}(T||(T={}));class C extends c{constructor(o){super(),this.spherical=o,this.output=r.Color,this.textureCoordinateType=a.None,this.componentData=e.Uniform,this.cullFace=u.Back,this.vertexDiscardMode=t.None,this.doubleSidedMode=h.WindingOrder,this.alphaDiscardMode=y.Opaque,this.integratedMeshMode=T.None,this.oitPass=m.NONE,this.ellipsoidMode=l.Earth,this.pbrMode=p.Disabled,this.normalType=s.Attribute,this.emissionSource=d.None,this.hasVertexColors=!1,this.hasNormals=!1,this.shadeNormals=!0,this.hasSlicePlane=!1,this.hasColorTexture=!1,this.hasHighlightMixTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.screenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.objectAndLayerIdColor=!1,this.discardInvisibleFragments=!1,this.occlusionPass=!1,this.bindType=v.Draw,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.highStepCount=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.objectAndLayerIdColorInstanced=!1,this.draped=!1}get overlayEnabled(){return(this.integratedMeshMode===T.ColorOverlay||this.integratedMeshMode===T.ColorOverlayWithWater)&&i(this.output)}}o([n({count:r.COUNT})],C.prototype,"output",void 0),o([n({count:a.COUNT})],C.prototype,"textureCoordinateType",void 0),o([n({count:e.COUNT})],C.prototype,"componentData",void 0),o([n({count:u.COUNT})],C.prototype,"cullFace",void 0),o([n({count:t.COUNT})],C.prototype,"vertexDiscardMode",void 0),o([n({count:h.COUNT})],C.prototype,"doubleSidedMode",void 0),o([n({count:y.COUNT})],C.prototype,"alphaDiscardMode",void 0),o([n({count:T.COUNT})],C.prototype,"integratedMeshMode",void 0),o([n({count:m.COUNT})],C.prototype,"oitPass",void 0),o([n({count:l.COUNT})],C.prototype,"ellipsoidMode",void 0),o([n({count:p.COUNT})],C.prototype,"pbrMode",void 0),o([n({count:s.COUNT})],C.prototype,"normalType",void 0),o([n({count:d.COUNT})],C.prototype,"emissionSource",void 0),o([n()],C.prototype,"hasVertexColors",void 0),o([n()],C.prototype,"hasNormals",void 0),o([n()],C.prototype,"shadeNormals",void 0),o([n()],C.prototype,"hasSlicePlane",void 0),o([n()],C.prototype,"hasColorTexture",void 0),o([n()],C.prototype,"hasHighlightMixTexture",void 0),o([n()],C.prototype,"receiveAmbientOcclusion",void 0),o([n()],C.prototype,"receiveShadows",void 0),o([n()],C.prototype,"blendingEnabled",void 0),o([n()],C.prototype,"screenSpaceReflections",void 0),o([n()],C.prototype,"hasPolygonOffset",void 0),o([n()],C.prototype,"hasMetallicRoughnessTexture",void 0),o([n()],C.prototype,"hasOcclusionTexture",void 0),o([n()],C.prototype,"hasNormalTexture",void 0),o([n()],C.prototype,"hasOccludees",void 0),o([n()],C.prototype,"terrainDepthTest",void 0),o([n()],C.prototype,"cullAboveTerrain",void 0),o([n()],C.prototype,"hasNormalTextureTransform",void 0),o([n()],C.prototype,"cloudReflections",void 0),o([n()],C.prototype,"snowCover",void 0),o([n()],C.prototype,"objectAndLayerIdColor",void 0);export{C as ComponentTechniqueConfiguration,T as IntegratedMeshMode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../../../geometry/support/Ellipsoid.js";import"../../../../../terrain/OverlayContent.js";import"../ComponentTechniqueConfiguration.js";import"./ComponentData.glsl.js";import"./VertexDiscardMode.js";import"../../../../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../../../../core/shaderLibrary/ShaderOutput.js";import"../../../../core/shaderLibrary/Slice.glsl.js";import"../../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../../core/shaderLibrary/util/EllipsoidMode.js";import"../../../../core/shaderModules/glsl.js";import"../../../../core/shaderModules/Texture2DBindUniform.js";import"../../../../core/shaderModules/Texture2DPassUniform.js";import"../../../../shaders/OutputColorHighlightOID.glsl.js";import"../../../../../../webgl/ShaderBuilder.js";import"../../../../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../../../../chunks/ComponentShader.glsl.js";
5
+ import"../../../../../../../geometry/support/Ellipsoid.js";import"../../../../../terrain/OverlayContent.js";import"./ComponentData.glsl.js";import"./VertexDiscardMode.js";import"../../../../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../../../../core/shaderLibrary/ShaderOutput.js";import"../../../../core/shaderLibrary/Slice.glsl.js";import"../../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../../core/shaderLibrary/util/EllipsoidMode.js";import"../../../../core/shaderModules/glsl.js";import"../../../../core/shaderModules/Texture2DBindUniform.js";import"../../../../core/shaderModules/Texture2DPassUniform.js";import"../../../../shaders/OutputColorHighlightOID.glsl.js";import"../../../../../../webgl/ShaderBuilder.js";import"../../../../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../../../../chunks/ComponentShader.glsl.js";
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{HighlightReadBitmap as i}from"../HighlightReadBitmap.glsl.js";import{ShaderOutput as e}from"../ShaderOutput.js";import{glsl as t}from"../../shaderModules/glsl.js";import{Integer2BindUniform as h}from"../../shaderModules/Integer2BindUniform.js";import{IntegerBindUniform as l}from"../../shaderModules/IntegerBindUniform.js";import{Texture2DBindUniform as g}from"../../shaderModules/Texture2DBindUniform.js";import{Texture2DUintBindUniform as d}from"../../shaderModules/Texture2DUintBindUniform.js";function u(u,o){const{fragment:r}=u,{output:c,canHaveOverlay:n}=o;c===e.Highlight?(r.uniforms.add(new g("depthTexture",(i=>i.mainDepth)),new d("highlightMixTexture",(i=>i.highlightMixTexture)),new l("highlightLevel",(i=>i.highlightLevel??0)),new h("highlightMixOrigin",(i=>i.highlightMixOrigin))),u.outputs.add("fragHighlight","uvec2",0),u.include(i),r.code.add(t`uvec2 getAccumulatedHighlight() {
5
+ import{HighlightReadBitmap as i}from"../HighlightReadBitmap.glsl.js";import{ShaderOutput as e}from"../ShaderOutput.js";import{glsl as t}from"../../shaderModules/glsl.js";import{Integer2BindUniform as h}from"../../shaderModules/Integer2BindUniform.js";import{IntegerBindUniform as g}from"../../shaderModules/IntegerBindUniform.js";import{Texture2DBindUniform as l}from"../../shaderModules/Texture2DBindUniform.js";import{Texture2DUintBindUniform as d}from"../../shaderModules/Texture2DUintBindUniform.js";function o(o,u){const{fragment:r}=o,{output:c,draped:n,hasHighlightMixTexture:s}=u;c===e.Highlight?(r.uniforms.add(new g("highlightLevel",(i=>i.highlightLevel??0)),new h("highlightMixOrigin",(i=>i.highlightMixOrigin))),o.outputs.add("fragHighlight","uvec2",0),o.include(i),s?r.uniforms.add(new d("highlightMixTexture",(i=>i.highlightMixTexture))).code.add(t`uvec2 getAccumulatedHighlight() {
6
6
  return texelFetch(highlightMixTexture, ivec2(gl_FragCoord.xy) - highlightMixOrigin, 0).rg;
7
7
  }
8
8
  void outputHighlight(bool occluded) {
@@ -22,15 +22,14 @@ uvec2 combinedHighlight = getAccumulatedHighlight();
22
22
  combinedHighlight[li] |= bits;
23
23
  fragHighlight = combinedHighlight;
24
24
  }
25
- }
26
- bool isHighlightOccluded() {
25
+ }`):r.code.add(t`void outputHighlight(bool occluded) {
26
+ uint bits = occluded ? 3u : 1u;
27
+ fragHighlight = uvec2(bits, 0);
28
+ }`),n?r.code.add(t`bool isHighlightOccluded() {
29
+ return false;
30
+ }`):r.uniforms.add(new l("depthTexture",(i=>i.mainDepth))).code.add(t`bool isHighlightOccluded() {
27
31
  float sceneDepth = texelFetch(depthTexture, ivec2(gl_FragCoord.xy), 0).x;
28
32
  return gl_FragCoord.z > sceneDepth + 5e-7;
29
- }
30
- void calculateOcclusionAndOutputHighlight() {
31
- outputHighlight(isHighlightOccluded());
32
- }`),n&&r.code.add(t`void calculateOcclusionAndOutputHighlightOverlay(uvec2 highlightToAdd) {
33
- uint levelBits = readLevelBits(highlightToAdd, highlightLevel);
34
- if ((levelBits & 1u) == 0u) { discard; }
33
+ }`),r.code.add(t`void calculateOcclusionAndOutputHighlight() {
35
34
  outputHighlight(isHighlightOccluded());
36
- }`)):r.code.add(t`void calculateOcclusionAndOutputHighlight() {}`)}export{u as OutputHighlight};
35
+ }`)):r.code.add(t`void calculateOcclusionAndOutputHighlight() {}`)}export{o as OutputHighlight};
@@ -0,0 +1,11 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{ShaderOutput as i}from"../ShaderOutput.js";import{OutputHighlight as t}from"./OutputHighlight.glsl.js";import{glsl as l}from"../../shaderModules/glsl.js";function h(h,u){u.output===i.Highlight&&(h.include(t,u),h.fragment.code.add(l`
6
+ void calculateOcclusionAndOutputHighlight(uvec2 highlightToAdd) {
7
+ uint levelBits = readLevelBits(highlightToAdd, highlightLevel);
8
+ if ((levelBits & 1u) == 0u) discard;
9
+ outputHighlight(isHighlightOccluded());
10
+ }
11
+ `))}export{h as OutputHighlightOverlay};
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{IDENTITY as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{ONES as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{TextureCoordinateType as r}from"../attributes/TextureCoordinateAttribute.glsl.js";import{VertexTextureCoordinates as a}from"../attributes/VertexTextureCoordinates.glsl.js";import{NormalsDoubleSidedMode as n}from"./Normals.glsl.js";import{Float2PassUniform as o}from"../../shaderModules/Float2PassUniform.js";import{glsl as s}from"../../shaderModules/glsl.js";import{Matrix3PassUniform as m}from"../../shaderModules/Matrix3PassUniform.js";import{Texture2DDrawUniform as d}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as l}from"../../shaderModules/Texture2DPassUniform.js";import{VertexAttribute as i}from"../../../lib/VertexAttribute.js";import{BindType as c}from"../../../../../webgl/BindType.js";function T(T,u){const x=T.fragment;u.hasVertexTangents?(T.attributes.add(i.TANGENT,"vec4"),T.varyings.add("vTangent","vec4"),u.doubleSidedMode===n.WindingOrder?x.code.add(s`mat3 computeTangentSpace(vec3 normal) {
5
+ import{IDENTITY as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{ONES as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{TextureCoordinateType as r}from"../attributes/TextureCoordinateAttribute.glsl.js";import{VertexTextureCoordinates as a}from"../attributes/VertexTextureCoordinates.glsl.js";import{NormalsDoubleSidedMode as n}from"./Normals.glsl.js";import{Float2PassUniform as o}from"../../shaderModules/Float2PassUniform.js";import{glsl as s}from"../../shaderModules/glsl.js";import{Matrix3PassUniform as m}from"../../shaderModules/Matrix3PassUniform.js";import{Texture2DDrawUniform as d}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as l}from"../../shaderModules/Texture2DPassUniform.js";import{VertexAttribute as i}from"../../../lib/VertexAttribute.js";import{BindType as c}from"../../../../../webgl/BindType.js";function T(T,u){const x=T.fragment,{hasVertexTangents:g,doubleSidedMode:f,hasNormalTexture:v,textureCoordinateType:p,bindType:b,hasNormalTextureTransform:y}=u;g?(T.attributes.add(i.TANGENT,"vec4"),T.varyings.add("vTangent","vec4"),f===n.WindingOrder?x.code.add(s`mat3 computeTangentSpace(vec3 normal) {
6
6
  float tangentHeadedness = gl_FrontFacing ? vTangent.w : -vTangent.w;
7
7
  vec3 tangent = normalize(gl_FrontFacing ? vTangent.xyz : -vTangent.xyz);
8
8
  vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
@@ -23,8 +23,8 @@ T = T - normal * dot(normal, T);
23
23
  T *= inversesqrt(max(dot(T,T), 1.e-10));
24
24
  vec3 B = sign(det) * cross(normal, T);
25
25
  return mat3(T, B, normal);
26
- }`),u.textureCoordinateType!==r.None&&(T.include(a,u),x.uniforms.add(u.bindType===c.Pass?new l("normalTexture",(e=>e.textureNormal)):new d("normalTexture",(e=>e.textureNormal))),u.hasNormalTextureTransform&&(x.uniforms.add(new o("scale",(e=>e.scale??t))),x.uniforms.add(new m("normalTextureTransformMatrix",(t=>t.normalTextureTransformMatrix??e)))),x.code.add(s`vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
27
- vec3 rawNormal = textureLookup(normalTexture, uv).rgb * 2.0 - 1.0;`),u.hasNormalTextureTransform&&x.code.add(s`mat3 normalRotation = mat3(normalTextureTransformMatrix[0][0]/scale[0], normalTextureTransformMatrix[0][1]/scale[1], 0.0,
26
+ }`),v&&p!==r.None&&(T.include(a,u),x.uniforms.add(b===c.Pass?new l("normalTexture",(e=>e.textureNormal)):new d("normalTexture",(e=>e.textureNormal))),y&&(x.uniforms.add(new o("scale",(e=>e.scale??t))),x.uniforms.add(new m("normalTextureTransformMatrix",(t=>t.normalTextureTransformMatrix??e)))),x.code.add(s`vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
27
+ vec3 rawNormal = textureLookup(normalTexture, uv).rgb * 2.0 - 1.0;`),y&&x.code.add(s`mat3 normalRotation = mat3(normalTextureTransformMatrix[0][0]/scale[0], normalTextureTransformMatrix[0][1]/scale[1], 0.0,
28
28
  normalTextureTransformMatrix[1][0]/scale[0], normalTextureTransformMatrix[1][1]/scale[1], 0.0,
29
29
  0.0, 0.0, 0.0 );
30
30
  rawNormal.xy = (normalRotation * vec3(rawNormal.x, rawNormal.y, 1.0)).xy;`),x.code.add(s`return tangentSpace * rawNormal;
@@ -65,17 +65,14 @@ return outColor;
65
65
  float dtrExponent = ${o.useCustomDTRExponentForWater?"2.2":"2.0"};
66
66
  `),n.add(a`vec3 fresnelReflection(float angle, vec3 f0, float f90) {
67
67
  return f0 + (f90 - f0) * pow(1.0 - angle, 5.0);
68
- }`),n.add(a`float normalDistributionWater(float NdotH, float roughness)
69
- {
68
+ }`),n.add(a`float normalDistributionWater(float NdotH, float roughness) {
70
69
  float r2 = roughness * roughness;
71
70
  float NdotH2 = NdotH * NdotH;
72
71
  float denom = pow((NdotH2 * (r2 - 1.0) + 1.0), dtrExponent) * PI;
73
72
  return r2 / denom;
74
- }`),n.add(a`float geometricOcclusionKelemen(float LoH)
75
- {
73
+ }`),n.add(a`float geometricOcclusionKelemen(float LoH) {
76
74
  return 0.25 / (LoH * LoH);
77
- }`),n.add(a`vec3 brdfSpecularWater(in PBRShadingWater props, float roughness, vec3 F0, float F0Max)
78
- {
75
+ }`),n.add(a`vec3 brdfSpecularWater(in PBRShadingWater props, float roughness, vec3 F0, float F0Max) {
79
76
  vec3 F = fresnelReflection(props.VdotH, F0, F0Max);
80
77
  float dSun = normalDistributionWater(props.NdotH, roughness);
81
78
  float V = geometricOcclusionKelemen(props.LdotH);
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- var o;!function(o){o[o.Composite=0]="Composite",o[o.ColorComposite=1]="ColorComposite",o[o.GridComposite=2]="GridComposite",o[o.GroupBackgroundComposite=3]="GroupBackgroundComposite",o[o.COUNT=4]="COUNT"}(o||(o={}));export{o as BlendLayersOutput};
5
+ var o;!function(o){o[o.Draw=0]="Draw",o[o.Composite=1]="Composite",o[o.ColorComposite=2]="ColorComposite",o[o.GridComposite=3]="GridComposite",o[o.GroupBackgroundComposite=4]="GroupBackgroundComposite",o[o.COUNT=5]="COUNT"}(o||(o={}));export{o as BlendLayersOutput};