@arcgis/core 4.34.0-next.66 → 4.34.0-next.68

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 (278) hide show
  1. package/WebDocument2D.js +1 -1
  2. package/arcade/Feature.js +1 -1
  3. package/arcade/functions/measures.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{09dd8613bc03e7a3a4cb.js → 0814676e4bac81f96140.js} +1 -1
  6. package/assets/esri/core/workers/chunks/097a5c333de28ec5e16f.js +1 -0
  7. package/assets/esri/core/workers/chunks/{44031bef6d500167ef0b.js → 09dbb3e200ef8d514eb3.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0b71100fa1e7ca706dbb.js +1 -0
  9. package/assets/esri/core/workers/chunks/{3167230555c63f943485.js → 0cbd5335cc92f5891bcf.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{16fe21ca9b24eaee3069.js → 144bfd64daf103a06734.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{c20aead85cdea91c4b74.js → 170ec7fb070c63230c81.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{997a2a1a51039ce7e4e3.js → 1ac6bbaee76684a07b64.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{af1030e4c4437d4eb600.js → 1ada9e6cdd6792e3847a.js} +1 -1
  14. package/assets/esri/core/workers/chunks/1e86df439c564fe752e3.js +1 -0
  15. package/assets/esri/core/workers/chunks/{4459c8e495a37d4c4eb8.js → 25118304c9a914194e90.js} +1 -1
  16. package/assets/esri/core/workers/chunks/28cfe1b270602e0c767b.js +1 -0
  17. package/assets/esri/core/workers/chunks/2ad1d458e4d18232a667.js +1 -0
  18. package/assets/esri/core/workers/chunks/{d823277612f971a9c2f0.js → 3245663da75e168bf85c.js} +1 -1
  19. package/assets/esri/core/workers/chunks/37d7c249114994a7dfac.js +1 -0
  20. package/assets/esri/core/workers/chunks/{2cd27b06226e30aec5da.js → 3f164e587f8d69c306d5.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{96102a9296afd1bfe1a9.js → 451dd3bb44664b4ca2ae.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{dbcef57073075e9cfdfe.js → 489fa17e60f25d5f33ae.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{e97250ae8da4bd0d6bc9.js → 4aa98309081e6889ccbb.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{19e5e011f929b6b940fe.js → 4bc091770bab38874848.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{09f0c9f0b6aa58ae3c52.js → 4f22e5a7f81883e8e5b6.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{7a17e78c76076ed4476f.js → 5185c63fecc5f493e142.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{fa0f94318173db2034de.js → 52483db12203276e726e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{6fff219dfaa86167c326.js → 5303d77a3ab1b7ddeef3.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{22ec2b0a853911692dc8.js → 5993427325d1add18ed9.js} +1 -1
  30. package/assets/esri/core/workers/chunks/5a95688651d7e8b7101d.js +1 -0
  31. package/assets/esri/core/workers/chunks/{9e3f8c06b4e090a35710.js → 5b84eba4a28e25b6d5c0.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{497214e9e82b936fc94e.js → 5ed381a268855bcad072.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{33718ea851645d9078d1.js → 605acf18cbeb89e4f29f.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{5d8c64693830506c8776.js → 643acb12ec6a1d4b4fbb.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{4d7fcec769369c576847.js → 6e59ba2afd444eb4be18.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{de4da985c398c8bcf2e7.js → 7336bfd57f6172ec7186.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{bafd9b0f6e817252cb31.js → 75dd0acf049c7f3271b8.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{60920d4856a011ace7e2.js → 80b0c88a76bd523a406a.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{117eb1422e9795d37ea3.js → 837830e1cf712d4243a5.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{ad7aa7d09bfceb12609e.js → 87fb5d755860057da164.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{5cb238318a24b70d5ac3.js → 8bc8caa384b24af12411.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{dcad3dcbd4ea2f5a6a04.js → 8e2558b14be70b273ce4.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{8e40c409a9b0a2a768a9.js → 8f02349602b072186a1f.js} +1 -1
  44. package/assets/esri/core/workers/chunks/900eb2aa5cb1b08e1906.js +1 -0
  45. package/assets/esri/core/workers/chunks/{0952aeddddc16705b7a3.js → 99f133a152afb4f1b067.js} +1 -1
  46. package/assets/esri/core/workers/chunks/a6f66492651646c18f10.js +1 -0
  47. package/assets/esri/core/workers/chunks/a895da7fd64ebad3d5a4.js +1 -0
  48. package/assets/esri/core/workers/chunks/{31e7358fe802abb3f8db.js → aa970a547c60c43d6c7f.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{9a6d359ead62a8eadd3c.js → ab727ed4417b7dd94ce9.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{707311e24b2f458d9209.js → ad3ebd4f05cc673140f3.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{0f20c0eec850a39620a1.js → ad69cceec8db593fac14.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{05016b0713ef760fc57d.js → b052d3ef5493eedb44a5.js} +1 -1
  53. package/assets/esri/core/workers/chunks/b335e96f6bcac6d2f0ee.js +1 -0
  54. package/assets/esri/core/workers/chunks/{a44f17397d8589433dae.js → b683b0fa7fc430b4d9c5.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{dd1d9913b33d4e48baff.js → c35dad3d5ceaac6ad5a4.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{e1b573840ec1f7c3afd3.js → c4b2678dd46fa1e22f7e.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{2f7e192ee2066f863e1d.js → c908184d747d33366881.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{bc931865a77fc48871d3.js → c94c797864a85342b105.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{06ff5f34ad9bdf9705de.js → d3f59fbaa524b53fcbc6.js} +6 -0
  60. package/assets/esri/core/workers/chunks/{c7a386ac90e58eb71935.js → da1a5537e2f2ca6cc247.js} +1 -1
  61. package/assets/esri/core/workers/chunks/dd447dfc50ee7f511b84.js +1 -0
  62. package/assets/esri/core/workers/chunks/{a700f57af6856cb5313c.js → de443d29d1a6b5300d00.js} +1 -1
  63. package/assets/esri/core/workers/chunks/e2486bf5546443408c85.js +1 -0
  64. package/assets/esri/core/workers/chunks/{0f9813e7d4e2b47b2c39.js → e47acdb1fbf797342716.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{a16b471c3706ee37f9b6.js → e6f2ac738df16fb5e13a.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{f5101f5f93f776a6456f.js → ed1272e7681e561d843f.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{66ffefd46fe6175c2af4.js → efea3e82cec476d486e0.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{d6f5297f7b323c340727.js → f060a52a9b69eb250d63.js} +1 -1
  69. package/assets/esri/core/workers/chunks/f8adac87e48ea86bec21.js +1 -0
  70. package/assets/esri/core/workers/chunks/{4be2bab8ff3bd14ffdfb.js → f9385d7fb5ff20f7b252.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{b30de4936caa654d7817.js → fac020b6886ff2d75015.js} +1 -1
  72. package/assets/esri/core/workers/chunks/fe353a53968827bcd9cc.js +1 -0
  73. package/assets/esri/themes/base/widgets/_Expand.scss +1 -1
  74. package/assets/esri/themes/dark/main.css +1 -1
  75. package/assets/esri/themes/light/main.css +1 -1
  76. package/assets/esri/themes/light/view.css +1 -1
  77. package/chunks/ComponentShader.glsl.js +42 -36
  78. package/chunks/GlowComposition.glsl.js +5 -5
  79. package/chunks/RibbonLine.glsl.js +2 -2
  80. package/config.js +1 -1
  81. package/core/MemCache.js +1 -1
  82. package/editing/geometry/lineUtils.js +1 -1
  83. package/geometry/ellipsoidUtils.js +1 -1
  84. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  85. package/geometry/support/curves/circleUtils.js +1 -1
  86. package/geometry/support/curves/curveLength.js +1 -1
  87. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  88. package/interfaces.d.ts +66 -193
  89. package/kernel.js +1 -1
  90. package/layers/GaussianSplatLayer.js +1 -1
  91. package/layers/Layer.js +1 -1
  92. package/layers/MapImageLayer.js +1 -1
  93. package/layers/OrientedImageryLayer.js +1 -1
  94. package/layers/VoxelLayer.js +1 -1
  95. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  96. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  97. package/layers/mixins/ArcGISImageService.js +1 -1
  98. package/layers/mixins/ImageryTileMixin.js +1 -1
  99. package/layers/mixins/OperationalLayer.js +1 -1
  100. package/layers/mixins/TemporalLayer.js +1 -1
  101. package/layers/mixins/TemporalSceneLayer.js +1 -1
  102. package/layers/mixins/operationalLayers.js +1 -1
  103. package/layers/support/FeatureFilter.js +1 -1
  104. package/layers/support/TimeInfo.js +1 -1
  105. package/layers/support/TrackInfo.js +1 -1
  106. package/layers/support/gaussianSplatUtils.js +1 -1
  107. package/layers/support/layersCreator.js +1 -1
  108. package/package.json +2 -2
  109. package/portal/schemas/definitions.js +1 -1
  110. package/portal/support/portalLayers.js +1 -1
  111. package/rest/support/AttributeBinsQuery.js +1 -1
  112. package/rest/support/IdentifyParameters.js +1 -1
  113. package/rest/support/ImageGPSInfoParameters.js +1 -1
  114. package/rest/support/ImageHistogramParameters.js +1 -1
  115. package/rest/support/ImageIdentifyParameters.js +1 -1
  116. package/rest/support/ImageParameters.js +1 -1
  117. package/rest/support/ImageSampleParameters.js +1 -1
  118. package/rest/support/Query.js +1 -1
  119. package/rest/support/TopFeaturesQuery.js +1 -1
  120. package/support/elevationInfoUtils.js +1 -1
  121. package/support/revision.js +1 -1
  122. package/support/timeUtils.js +1 -1
  123. package/time/TimeExtent.js +1 -1
  124. package/time/TimeInterval.js +1 -1
  125. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  126. package/views/2d/engine/webgl/Painter.js +1 -1
  127. package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
  128. package/views/2d/engine/webgl/effects/post-processing/EffectManager.js +1 -1
  129. package/views/2d/engine/webgl/shaderGraph/techniques/TestTechnique.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +5 -0
  132. package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +5 -0
  133. package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +5 -0
  134. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +5 -0
  136. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
  138. package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
  140. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/grid/GridTechnique.js +1 -1
  144. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  146. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  147. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
  148. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
  149. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  150. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
  151. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js +1 -1
  152. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +5 -0
  153. package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
  154. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
  155. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js +5 -0
  156. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +5 -0
  157. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js +5 -0
  158. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js +5 -0
  159. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +5 -0
  160. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PostProcessingShader.js +5 -0
  161. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
  162. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  163. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  164. package/views/2d/layers/MediaLayerView2D.js +1 -1
  165. package/views/2d/layers/TileLayerView2D.js +1 -1
  166. package/views/2d/layers/features/FeatureContainer.js +1 -1
  167. package/views/2d/layers/features/RenderState.js +1 -1
  168. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  169. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  170. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +5 -0
  171. package/views/3d/analysis/VolumeMeasurement/volumeMeasurementGeometryUtils.js +5 -0
  172. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  173. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  174. package/views/3d/interactive/editingTools/isSupportedObjectUtils.js +1 -1
  175. package/views/3d/interactive/editingTools/move/isSupportedObject.js +1 -1
  176. package/views/3d/interactive/editingTools/reshape/isSupportedObject.js +1 -1
  177. package/views/3d/interactive/editingTools/transform/isSupportedGraphic.js +1 -1
  178. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  179. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  180. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  181. package/views/3d/layers/graphics/ElevationContext.js +1 -1
  182. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  183. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  184. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  185. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  186. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  187. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  188. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  189. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  190. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  191. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  192. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  193. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  194. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  195. package/views/3d/layers/graphics/Graphics3DPointSymbol.js +1 -1
  196. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  197. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  198. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  199. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  200. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  202. package/views/3d/layers/graphics/Labeler.js +1 -1
  203. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  204. package/views/3d/layers/graphics/elevationAlignPointsInFeatures.js +1 -1
  205. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  206. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  207. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  208. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  209. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  210. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  211. package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
  212. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  213. package/views/3d/support/CombinedElevationProvider.js +1 -1
  214. package/views/3d/terrain/TerrainSurface.js +1 -1
  215. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  216. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  217. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  218. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +8 -2
  219. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColor.glsl.js +5 -0
  220. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  221. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  222. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.glsl.js +5 -0
  223. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  224. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +1 -1
  225. package/views/3d/webgl-engine/effects/focusArea/FocusAreaOutlineItem.js +1 -1
  226. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  227. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  228. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  229. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  230. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  231. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +5 -0
  232. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +17 -0
  233. package/views/GroundView.js +1 -1
  234. package/views/VideoView.js +1 -1
  235. package/views/View.js +1 -1
  236. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  237. package/views/analysis/ElevationProfile/ElevationProfileGenerationError.js +1 -1
  238. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  239. package/webdoc/support/timeProperties.js +1 -1
  240. package/webdoc/widgets/TimeSlider.js +1 -1
  241. package/webmap/InitialViewProperties.js +1 -1
  242. package/widgets/Bookmarks.js +1 -1
  243. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  244. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  245. package/widgets/Editor/support/EditorItem.js +1 -1
  246. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  247. package/widgets/Expand.js +1 -1
  248. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  249. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  250. package/widgets/TimeSlider.js +1 -1
  251. package/TimeExtent.d.ts +0 -4
  252. package/TimeExtent.js +0 -5
  253. package/TimeInterval.d.ts +0 -4
  254. package/TimeInterval.js +0 -5
  255. package/assets/esri/core/workers/chunks/047d6f7b1677cc7ab271.js +0 -1
  256. package/assets/esri/core/workers/chunks/0b01c87db77246632ad9.js +0 -1
  257. package/assets/esri/core/workers/chunks/0cb2f7172190babb4139.js +0 -1
  258. package/assets/esri/core/workers/chunks/0e28cb5d8d89ae29cdd0.js +0 -1
  259. package/assets/esri/core/workers/chunks/1c7b5ca80e80c314f78d.js +0 -1
  260. package/assets/esri/core/workers/chunks/2a938096a42613425c7b.js +0 -1
  261. package/assets/esri/core/workers/chunks/3212a476184be25d17f8.js +0 -1
  262. package/assets/esri/core/workers/chunks/3bc50ee639a4d16c4f80.js +0 -1
  263. package/assets/esri/core/workers/chunks/481aea82501d04667ba2.js +0 -1
  264. package/assets/esri/core/workers/chunks/548818df658b607a364e.js +0 -1
  265. package/assets/esri/core/workers/chunks/7597ef10d1699e7088e5.js +0 -1
  266. package/assets/esri/core/workers/chunks/8e3c09c3524654830b14.js +0 -1
  267. package/assets/esri/core/workers/chunks/8f60804c7ba445f25df8.js +0 -1
  268. package/assets/esri/core/workers/chunks/c696615cae5daefa2d98.js +0 -1
  269. package/assets/esri/core/workers/chunks/ff2614d96ca5228e9685.js +0 -1
  270. package/chunks/TimeExtent.js +0 -5
  271. package/chunks/TimeInterval.js +0 -5
  272. package/views/2d/engine/webgl/effects/post-processing/Bloom.js +0 -5
  273. package/views/2d/engine/webgl/effects/post-processing/Blur.js +0 -5
  274. package/views/2d/engine/webgl/effects/post-processing/Colorize.js +0 -5
  275. package/views/2d/engine/webgl/effects/post-processing/DropShadow.js +0 -5
  276. package/views/2d/engine/webgl/effects/post-processing/Opacity.js +0 -5
  277. package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +0 -5
  278. package/views/3d/webgl-engine/shaders/FocusAreaMask.glsl.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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Color.js";import{difference as i}from"../../../core/arrayUtils.js";import r from"../../../core/CollectionFlattener.js";import{toConst as s}from"../../../core/compilerUtils.js";import{EventedAccessor as 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 u from"../../../core/PooledArray.js";import{throwIfAborted as p,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 w}from"../../../core/accessorSupport/decorators/subclass.js";import{q as S,i as C,c as b}from"../../../chunks/vec32.js";import{create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L}from"../../../geometry/ellipsoidUtils.js";import P from"../../../geometry/SpatialReference.js";import{getProjector as U}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 R,equals as j,intersection as B,intersectsSphere as I,empty as k,expand as A}from"../../../geometry/support/aaBoundingRect.js";import{create as V,copy as q}from"../../../geometry/support/frustum.js";import{isPlateCarree as O}from"../../../geometry/support/spatialReferenceUtils.js";import{m as G,c as N,n as F,o as W,e as H}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as $}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as Q}from"../../../layers/support/layerUtils.js";import{debugFlags as z}from"../support/debugFlags.js";import{ElevationRange as Y}from"../support/ElevationRange.js";import{ElevationUpdateEvent as X}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as K}from"../support/extentUtils.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{ElevationData as ee,sampleElevation as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LayerClasses as re}from"./LayerClass.js";import{OverlayManager as se}from"./OverlayManager.js";import{PlanarPatch as ae}from"./PlanarPatch.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 ue,maxTileNeighborLevelDelta as pe,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 we,isGroupLayerView as Se,isMapTileLayerView as Ce,isBlendableLayerView as be,isElevationLayerView as xe,releaseTerrainData as Ee,enableTerrainInternalChecks as Le,oppositeCorner as Pe,enableWaterproofTests as Ue,enableInternalTerrainChecks as Me,enableTerrainWaterproofChecks as De,neighborCornerIndices as Re}from"./terrainUtils.js";import{Tile as je,lijEquals as Be}from"./Tile.js";import{printAllocations as Ie}from"./TilePerLayerInfo.js";import{IteratorPreorder as ke,IteratorPostorder as Ae,compareTilesByLij as Ve,hasLoadableSiblings as qe,sortTilesByPOI as Oe}from"./tileUtils.js";import{TilingSchemeLogic as Ge}from"./TilingSchemeLogic.js";import{UpsampleInfo as Ne}from"./UpsampleInfo.js";import{isCompositeBlendMode as Fe,blendModeFromString as We}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as He}from"../../support/layerViewUtils.js";import{ImmediateTask as $e,TaskPriority as Qe,noBudget as ze}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ye}from"../../support/TextureCompressionTracker.js";import{Yield as Xe}from"../../support/Yield.js";var Ke;let Je=class extends a{static{Ke=this}get allTiles(){return s(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.terrainTextureCompressionTracker=new Ye,this._iteratorPool=new d(()=>new ke,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Ae,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=x(),this._eyePosSurfaceSR=x(),this._splitLimits=new oe,this._frustum=V(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new E,this._frameTask=$e,this._allTiles=new u,this._upsampleInfoPool=new d(()=>new Ne),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=R(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=P.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new Z(1/0,-1/0),this.rootTileElevationBounds=new Z(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,this.enabled=!0;const{view:t}=e;this.overlayManager=new se({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?le:ae,this._ellipsoid=L(t.spatialReference),this._renderer=new ge(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.terrainTextureCompressionTracker,t.resourceController.memoryController),He()||(this._scaleRangeQueries=new ne)}initialize(){const{view:e}=this,{resourceController:t}=e,{memoryController:i}=t;this._tileCache=new h((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",e=>e.unloadMapData()),this._elevationQueryCache=new $(i.newCache("elevation-query"));const s=this.overlayManager;this.addHandles([_(()=>s.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)}),_(()=>({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);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},m),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),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,{equals:S})}),_(()=>z.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&z.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=o(this._treeDebugger))},y)]);const{spatialReference:a}=e;this._extentHelper=ie(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new r({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Ge({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(0),this._mapDataRequester=t.createStreamDataRequester(1);const d=t.scheduler;this._frameTask=d.registerTask(Qe.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?5:0,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)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=$e,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),this._allTiles.prune(),je.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,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(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}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,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=R(),r=K(t,i,e)?i:null,s=this._get("extent");return j(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=B(this.groundExtent,this._userClippingExtent,R()),t=this._get("extent");return j(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.enabled&&!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){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!this.enabled||null!=this._rootTiles}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 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}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||!this.enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=U(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=C(et,e,t,i);a(l,0,l,0);return nt(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this.enabled)for(let a=0;a<t;++a){const t=3*a;i(a,nt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!M(e,et,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(et)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;et[0]>t[2]&&(i+=1),et[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=U(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;G(e,tt);const r=F(tt,x());i(r,0,r,0),W(tt,r);const s=new Y,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,!I(i.extent,tt))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 Y(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,ct,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;H(tt,ct,t);let i=null;const r=e=>{if(e&&I(e.extent,tt)){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){if(!this._scaleRangeQueries)return;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._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const{tilingScheme:e}=this.tilingSchemeLogic;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??P.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&O(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(Ke._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 r=it;let s=t.rootTilesInExtent(e,r,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=i(e,s,Be);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Be(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(ue),s=t.rootTilesInExtent(e,r,he)),this._setRootTiles(s.map(e=>this._newRootTile(e)));j(r,this._rootTilesExtent)||(this._rootTilesExtent=R(r)),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(Ve),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(Ve);const t=this.renderer;e.forEach(e=>t.updateGeometryIfNeeded(e)),e.forEach(e=>this._pendingTilesForElevationUpdateEvent.add(e))}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),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"),this.emit("tiles-changed",{allTiles:this.allTiles})}_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(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=qe(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(8)&&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 Z(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 Z(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=q(this._splitLimits.frustum??V(),t.frustum):this._splitLimits.frustum=null,q(this._frustum,e.frustum),b(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[1].some(fe)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=st.extent;k(e),this._pendingTilesForElevationUpdateEvent.forEach(t=>A(e,t.extent,e)),this._pendingTilesForElevationUpdateEvent.clear(),st.spatialReference=this.spatialReference,this.emit("elevation-change",st),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"),Le&&this._checkTileInvariant(),!e.hasProgressed)return Xe}_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(4)){me(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)me(e.leaf||e.hasPendingUpdate(4),"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<=pe;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${pe} (edge[${i}])`),me(r,`tile level delta [${t.level}] vs [${e.level}] > ${pe}`))}me(t.level-e.level<=pe,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-pe,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(ye[i],s);if(null!=a){if(t.leaf&&t.level>=pe){let i=a;for(;t.level-i.level<pe;)i=i.parent;const s=[r,t.lij[1]>>pe,t.lij[2]>>pe];if(!Be(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<=pe,`Tile level delta [${t.level}] vs [${a.level}] > ${pe}`)}}}),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 lt(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(4),o=l?4:e.shouldSplit(r,s,i),h=1===o;e.leaf?ot(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(1),e.leaf||e.setPendingUpdate(4),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===o&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(Oe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,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(Ve);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=Re[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Pe(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)||Ve(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Le&&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(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=pe){const e=e=>e.leaf||i-e.level<pe;for(let r=0;r<4;++r){const a=s.findNeighborTile(ye[r],e);null!=a&&i-a.level===pe&&(t=!1,Le&&(Te(a.leaf),Te(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}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(8)&&(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(1),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.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),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?dt(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(Ke._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_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"),dt(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),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=>ot(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){at.spatialReference=this.spatialReference,at.extent=e.extent,at.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",at)}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(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){me(!e.hasPendingUpdate(1),"_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(),ot(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),we(e)||Se(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Se(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(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()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Ce(e)&&!Q(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||Se(e))&&Fe(We[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return xe(e)?0:1}_registerTiledLayerView(e){const t=[];if((be(e)||Se(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Se(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(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||!we(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){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),0===e&&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(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,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=1){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,p(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=0===t;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?xe(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 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new ee(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});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)=>{Ee(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),g(i)?Ee(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.getLayerIndexByUID(1,t.uid);if(null==r)return Ee(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass: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.getLayerIndexByUID(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){Me(e)}enableWaterproofnessChecks(e){De(e)}static cleanupTerrainSurface(){rt.prune()}enable(e){e!==this.enabled&&(e?(this._updateRootTiles(),this.suspended=!1):(this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this._set("enabled",e),this.notifyChange("ready"))}};e([v()],Je.prototype,"_renderer",void 0),e([v({constructOnly:!0})],Je.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],Je.prototype,"view",void 0),e([v({constructOnly:!0})],Je.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],Je.prototype,"terrainTextureCompressionTracker",void 0),e([v()],Je.prototype,"_hasPendingUpdates",void 0),e([v()],Je.prototype,"_asyncWorkItems",void 0),e([v()],Je.prototype,"_allTilesDirty",void 0),e([v()],Je.prototype,"_allTilesSorted",void 0),e([v()],Je.prototype,"_viewChanged",void 0),e([v({type:Number})],Je.prototype,"heading",void 0),e([v()],Je.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],Je.prototype,"_watchUpdatingTracking",void 0),e([v()],Je.prototype,"_frameTask",void 0),e([v()],Je.prototype,"demResolution",null),e([v({readOnly:!0})],Je.prototype,"snapLevel",null),e([v({readOnly:!0})],Je.prototype,"lodSnappingEnabled",null),e([v()],Je.prototype,"_userClippingExtent",null),e([v()],Je.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],Je.prototype,"extent",null),e([v({readOnly:!0})],Je.prototype,"groundExtent",null),e([v({readOnly:!0})],Je.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],Je.prototype,"updating",null),e([v({readOnly:!0})],Je.prototype,"readyToRun",null),e([v(J)],Je.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],Je.prototype,"updatingProgressValue",null),e([v()],Je.prototype,"_maxNumUpdating",void 0),e([v()],Je.prototype,"baseOpacity",null),e([v()],Je.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],Je.prototype,"viewingMode",null),e([v()],Je.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],Je.prototype,"ready",null),e([v({readOnly:!0})],Je.prototype,"rootTiles",null),e([v()],Je.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],Je.prototype,"spatialReference",null),e([v({type:t})],Je.prototype,"backgroundColor",null),e([v({value:!1})],Je.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],Je.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],Je.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],Je.prototype,"tilingSchemeLogic",void 0),e([v()],Je.prototype,"wireframe",null),e([v({value:!1})],Je.prototype,"suspended",null),e([v()],Je.prototype,"fadeDuration",null),e([v()],Je.prototype,"visibleElevationBounds",void 0),e([v()],Je.prototype,"rootTileElevationBounds",void 0),e([v()],Je.prototype,"_layerViewsDirty",void 0),e([v()],Je.prototype,"renderPatchBorders",null),e([v()],Je.prototype,"visualizeNormals",null),e([v()],Je.prototype,"renderingDisabled",null),e([v({readOnly:!0})],Je.prototype,"enabled",void 0),Je=Ke=e([w("esri.views.3d.terrain.TerrainSurface")],Je);const Ze=Je,et=x(),tt=N(),it=R(),rt=new u,st=new X("ground"),at={spatialReference:null,extent:null,scale:0};function nt(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 te(t,i,s)}return null}class lt{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 ot(e,t){!e.leaf||e.level<pe||pt(e,e=>{t&&ht(e);const i=ut(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ut(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function ht(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<pe||pt(e,e=>{ht(e)})}function dt(e){e.level<pe||pt(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ut(t));)t=t.parent}})}function ut(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function pt(e,t){if(e.level<pe)return;const i=e.level-pe,r=e.lij[1]>>pe,s=e.lij[2]>>pe,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)}}const ct=x();export{Ze as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../Color.js";import{difference as i}from"../../../core/arrayUtils.js";import r from"../../../core/CollectionFlattener.js";import{toConst as s}from"../../../core/compilerUtils.js";import{EventedAccessor as 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 u from"../../../core/PooledArray.js";import{throwIfAborted as p,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 w}from"../../../core/accessorSupport/decorators/subclass.js";import{q as S,i as C,c as b}from"../../../chunks/vec32.js";import{create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L,radiusModifier as P}from"../../../geometry/ellipsoidUtils.js";import U from"../../../geometry/SpatialReference.js";import{getProjector as D}from"../../../geometry/projection/projectors.js";import{projectPointToVector as M}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as R}from"../../../geometry/projection/projectVectorToVector.js";import{create as j,equals as B,intersection as I,intersectsSphere as k,empty as A,expand as V}from"../../../geometry/support/aaBoundingRect.js";import{create as q,copy as O}from"../../../geometry/support/frustum.js";import{isPlateCarree as G}from"../../../geometry/support/spatialReferenceUtils.js";import{m as N,c as F,n as W,o as H,e as $}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as Q}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as z}from"../../../layers/support/layerUtils.js";import{debugFlags as Y}from"../support/debugFlags.js";import{ElevationRange as X}from"../support/ElevationRange.js";import{ElevationUpdateEvent as K}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as J}from"../support/extentUtils.js";import{updatingProgress as Z}from"../support/updatingProperties.js";import{ElevationBounds as ee}from"./ElevationBounds.js";import{ElevationData as te,sampleElevation as ie}from"./ElevationData.js";import{create as re}from"./ExtentHelper.js";import{LayerClasses as se}from"./LayerClass.js";import{OverlayManager as ae}from"./OverlayManager.js";import{PlanarPatch as ne}from"./PlanarPatch.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 ue,tooManyRootTilesForLayerError as pe,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 we,isSurfaceLayerView as Se,isGroupLayerView as Ce,isMapTileLayerView as be,isBlendableLayerView as xe,isElevationLayerView as Ee,releaseTerrainData as Le,enableTerrainInternalChecks as Pe,oppositeCorner as Ue,enableWaterproofTests as De,enableInternalTerrainChecks as Me,enableTerrainWaterproofChecks as Re,neighborCornerIndices as je}from"./terrainUtils.js";import{Tile as Be,lijEquals as Ie}from"./Tile.js";import{printAllocations as ke}from"./TilePerLayerInfo.js";import{IteratorPreorder as Ae,IteratorPostorder as Ve,compareTilesByLij as qe,hasLoadableSiblings as Oe,sortTilesByPOI as Ge}from"./tileUtils.js";import{TilingSchemeLogic as Ne}from"./TilingSchemeLogic.js";import{UpsampleInfo as Fe}from"./UpsampleInfo.js";import{isCompositeBlendMode as We,blendModeFromString as He}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as $e}from"../../support/layerViewUtils.js";import{ImmediateTask as Qe,TaskPriority as ze,noBudget as Ye}from"../../support/Scheduler.js";import{TextureCompressionTracker as Xe}from"../../support/TextureCompressionTracker.js";import{Yield as Ke}from"../../support/Yield.js";var Je;let Ze=class extends a{static{Je=this}get allTiles(){return s(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.terrainTextureCompressionTracker=new Xe,this._iteratorPool=new d(()=>new Ae,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Ve,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=x(),this._eyePosSurfaceSR=x(),this._splitLimits=new he,this._frustum=q(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new E,this._frameTask=Qe,this._allTiles=new u,this._upsampleInfoPool=new d(()=>new Fe),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=j(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=U.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new ee(1/0,-1/0),this.rootTileElevationBounds=new ee(1/0,-1/0),this._projectorCache=new Map,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,this.enabled=!0;const{view:t}=e;this.overlayManager=new ae({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?oe:ne,this._ellipsoid=L(t.spatialReference),this._renderer=new _e(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.terrainTextureCompressionTracker,t.resourceController.memoryController),$e()||(this._scaleRangeQueries=new le)}initialize(){const{view:e}=this,{resourceController:t}=e,{memoryController:i}=t;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 s=this.overlayManager;this.addHandles([_(()=>s.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)}),_(()=>({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);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},m),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),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,{equals:S})}),_(()=>Y.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Y.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=o(this._treeDebugger))},y)]);const{spatialReference:a}=e;this._extentHelper=re(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new r({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Ne({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(0),this._mapDataRequester=t.createStreamDataRequester(1);const d=t.scheduler;this._frameTask=d.registerTask(ze.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?5:0,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)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=Qe,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),this._allTiles.prune(),Be.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,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),ke(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}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,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=j(),r=J(t,i,e)?i:null,s=this._get("extent");return B(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=I(this.groundExtent,this._userClippingExtent,j()),t=this._get("extent");return B(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.enabled&&!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){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!this.enabled||null!=this._rootTiles}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 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}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||!this.enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=D(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=C(tt,e,t,i);a(l,0,l,0);return lt(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this.enabled)for(let a=0;a<t;++a){const t=3*a;i(a,lt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!M(e,tt,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(tt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;tt[0]>t[2]&&(i+=1),tt[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=D(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){if(!this.enabled||null==this._rootTiles)return null;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;N(e,it);const r=W(it,x());i(r,0,r,0),H(it,r);const s=new X,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,!k(i.extent,it))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 this.enabled&&null!=this._rootTiles?new X(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max):null}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*P;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!M(e,gt,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;$(it,gt,t);let i=null;const r=e=>{if(e&&k(e.extent,it)){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){if(!this._scaleRangeQueries)return;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._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const{tilingScheme:e}=this.tilingSchemeLogic;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??U.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&G(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(Je._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 r=rt;let s=t.rootTilesInExtent(e,r,5*de);if(null!=this._rootTiles){if(s.length>de)return void n.getLogger(this).warn(ue);const e=this._rootTiles.map(e=>e.lij),t=i(e,s,Ie);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Ie(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(pe),s=t.rootTilesInExtent(e,r,de)),this._setRootTiles(s.map(e=>this._newRootTile(e)));B(r,this._rootTilesExtent)||(this._rootTilesExtent=j(r)),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(qe),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(qe);const t=this.renderer;e.forEach(e=>t.updateGeometryIfNeeded(e)),e.forEach(e=>this._pendingTilesForElevationUpdateEvent.add(e))}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),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"),this.emit("tiles-changed",{allTiles:this.allTiles})}_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(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Oe(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(8)&&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 ee(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 ee(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=O(this._splitLimits.frustum??q(),t.frustum):this._splitLimits.frustum=null,O(this._frustum,e.frustum),b(this._eyePosRenderSR,t.eye),R(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[1].some(ye)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=at.extent;A(e),this._pendingTilesForElevationUpdateEvent.forEach(t=>V(e,t.extent,e)),this._pendingTilesForElevationUpdateEvent.clear(),at.spatialReference=this.spatialReference,this.emit("elevation-change",at),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 Ke}_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(4)){fe(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)fe(e.leaf||e.hasPendingUpdate(4),"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(!Ie(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 ot(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(4),o=l?4:e.shouldSplit(r,s,i),h=1===o;e.leaf?ht(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(1),e.leaf||e.setPendingUpdate(4),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===o&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(Ge(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,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(qe);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=je[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Ue(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(we(Te[t]),t=>!(!t.loaded||!t.intersectsClippingArea)&&(ve(e.has(t)||qe(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Pe&&De&&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(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){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,Pe&&(ve(a.leaf),ve(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}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(8)&&(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(1),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.emit("tiles-changed",{allTiles:this.allTiles}),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(Je._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_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"),ut(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),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=>ht(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){nt.spatialReference=this.spatialReference,nt.extent=e.extent,nt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",nt)}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(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){fe(!e.hasPendingUpdate(1),"_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(),ht(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=Ye){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)||Ce(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Ce(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(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()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(be(e)&&!z(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((xe(e)||Ce(e))&&We(He[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Ee(e)?0:1}_registerTiledLayerView(e){const t=[];if((xe(e)||Ce(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Ce(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(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(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of se){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),0===e&&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(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,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=1){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,p(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=0===t;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?Ee(i)?this._requestElevationTileData(e,i,r):Promise.reject():be(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 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new te(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});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)=>{Le(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),g(i)?Le(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.getLayerIndexByUID(1,t.uid);if(null==r)return Le(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass: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.getLayerIndexByUID(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(!De)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){Me(e)}enableWaterproofnessChecks(e){Re(e)}static cleanupTerrainSurface(){st.prune()}enable(e){e!==this.enabled&&(e?(this._updateRootTiles(),this.suspended=!1):(this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this._set("enabled",e),this.notifyChange("ready"))}};e([v()],Ze.prototype,"_renderer",void 0),e([v({constructOnly:!0})],Ze.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],Ze.prototype,"view",void 0),e([v({constructOnly:!0})],Ze.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],Ze.prototype,"terrainTextureCompressionTracker",void 0),e([v()],Ze.prototype,"_hasPendingUpdates",void 0),e([v()],Ze.prototype,"_asyncWorkItems",void 0),e([v()],Ze.prototype,"_allTilesDirty",void 0),e([v()],Ze.prototype,"_allTilesSorted",void 0),e([v()],Ze.prototype,"_viewChanged",void 0),e([v({type:Number})],Ze.prototype,"heading",void 0),e([v()],Ze.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],Ze.prototype,"_watchUpdatingTracking",void 0),e([v()],Ze.prototype,"_frameTask",void 0),e([v()],Ze.prototype,"demResolution",null),e([v({readOnly:!0})],Ze.prototype,"snapLevel",null),e([v({readOnly:!0})],Ze.prototype,"lodSnappingEnabled",null),e([v()],Ze.prototype,"_userClippingExtent",null),e([v()],Ze.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],Ze.prototype,"extent",null),e([v({readOnly:!0})],Ze.prototype,"groundExtent",null),e([v({readOnly:!0})],Ze.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],Ze.prototype,"updating",null),e([v({readOnly:!0})],Ze.prototype,"readyToRun",null),e([v(Z)],Ze.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],Ze.prototype,"updatingProgressValue",null),e([v()],Ze.prototype,"_maxNumUpdating",void 0),e([v()],Ze.prototype,"baseOpacity",null),e([v()],Ze.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],Ze.prototype,"viewingMode",null),e([v()],Ze.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],Ze.prototype,"ready",null),e([v({readOnly:!0})],Ze.prototype,"rootTiles",null),e([v()],Ze.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],Ze.prototype,"spatialReference",null),e([v({type:t})],Ze.prototype,"backgroundColor",null),e([v({value:!1})],Ze.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],Ze.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],Ze.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],Ze.prototype,"tilingSchemeLogic",void 0),e([v()],Ze.prototype,"wireframe",null),e([v({value:!1})],Ze.prototype,"suspended",null),e([v()],Ze.prototype,"fadeDuration",null),e([v()],Ze.prototype,"visibleElevationBounds",void 0),e([v()],Ze.prototype,"rootTileElevationBounds",void 0),e([v()],Ze.prototype,"_layerViewsDirty",void 0),e([v()],Ze.prototype,"renderPatchBorders",null),e([v()],Ze.prototype,"visualizeNormals",null),e([v()],Ze.prototype,"renderingDisabled",null),e([v({readOnly:!0})],Ze.prototype,"enabled",void 0),Ze=Je=e([w("esri.views.3d.terrain.TerrainSurface")],Ze);const et=Ze,tt=x(),it=F(),rt=j(),st=new u,at=new K("ground"),nt={spatialReference:null,extent:null,scale:0};function lt(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 ie(t,i,s)}return null}class ot{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 ht(e,t){!e.leaf||e.level<ce||ct(e,e=>{t&&dt(e);const i=pt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=pt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function dt(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ce||ct(e,e=>{dt(e)})}function ut(e){e.level<ce||ct(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,pt(t));)t=t.parent}})}function pt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ct(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)}}const gt=x();export{et 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{invert as t,transpose as s}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as o,I as i}from"../../../../../../chunks/vec32.js";import{freeze as a,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{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as p}from"./ComponentTechniqueConfiguration.js";import{parameter as d,parameterBlock as m,MaterialBase as v,MaterialParameterBlock as g}from"../../../core/material/MaterialBase.js";import{isColorEmission as x}from"../../../core/shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as f}from"../../../core/util/TwoVectorPosition.js";import{advancedMRRFactors as M}from"../../../materials/pbrUtils.js";import{defaultHighlightName as b}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as y}from"../../../../../../webscene/support/AlphaCutoff.js";class T extends v{constructor(e,o){super(),this.toMapSpace=o,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=M,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=0,this.commonMaterialParameters=new S,this.componentParameters=new w,this.objectOpacity=1,this.textureAlphaCutoff=y,this.alphaDiscardMode=1,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=1,this.hasOccludees=!1;const i=new f(e.position),l=r(e.rotationScale);t(l,l),s(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=i.low,this.transformWorldFromModelTH=i.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get _hasEmissiveBase(){return null!=this.emissionTexture||!o(this.emissiveBaseColor,l)}get _hasEmissiveStrength(){return 2!==this.componentParameters.emissiveOverride}get hasEmissions(){return this._hasEmissiveStrength&&(this._hasEmissiveBase||2!==this.componentParameters.emissiveSourceOverride)}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,s,r){const o=new p(e.context.spherical);o.renderOccluded=9===s.slot,o.hasVertexColors=r.hasVertexColors,o.hasNormals=r.hasNormals,o.textureCoordinateType=r.textureCoordinateType,o.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,o.hasOcclusionTexture=null!=this.occlusionTexture,o.hasNormalTexture=null!=this.normalTexture,o.oitPass=0===t.identifier&&null!=s.oitPass?s.oitPass:0,o.terrainDepthTest=0===t.identifier&&s.terrainDepthTest,o.cullAboveTerrain=0===t.identifier&&s.cullAboveTerrain,o.ellipsoidMode=this.ellipsoidMode,o.componentData=this.componentParameters.type,o.cullFace=this.commonMaterialParameters.cullFace,o.doubleSidedMode=this.commonMaterialParameters.doubleSided?1:0,o.hasColorTexture=null!=this.baseColorTexture;const i=this._computeWhichMaterialPass();o.blendingEnabled=1===i||2===i,o.alphaDiscardMode=this.alphaDiscardMode,o.integratedMeshMode=this.isIntegratedMesh?D(s)?P(s)?3:2:1:0,o.hasPolygonOffset=this.polygonOffsetEnabled,o.pbrMode=3===o.integratedMeshMode?4:this.usePBR?this.hasParametersFromSource?r.shadeNormals&&this.isIntegratedMesh?0:2:1:0;const a=1===this.componentParameters.emissiveSourceOverride,l=2===this.componentParameters.emissiveSourceOverride,n=null!=this.emissionTexture;if(o.emissionSource=this.hasEmissions?this._hasEmissiveBase&&1===o.pbrMode?l?n?4:2:a?n?5:7:6:a?7:6:0,o.shadeNormals=r.shadeNormals,o.normalType=o.hasNormals?1:2,o.hasSlicePlane=null!=s.slicePlane&&this.commonMaterialParameters.hasSlicePlane,o.receiveAmbientOcclusion=o.hasOccludees=o.receiveShadows=o.screenSpaceReflections=o.cloudReflections=o.hasHighlightMixTexture=!1,1===t.identifier)o.output=4,o.vertexDiscardMode=0;else if(3===t.identifier)o.output=7,o.vertexDiscardMode=0;else if(2===t.identifier)o.output=9,o.vertexDiscardMode=0,o.hasHighlightMixTexture=null!=s.highlightMixTexture;else{switch(o.vertexDiscardMode=2===i?t.transparent?2:1:0,o.hasGlow=x(t.output),o.output=t.output,t.output){case 0:case 1:o.receiveAmbientOcclusion=r.applySSAO&&null!=s.ssao?.getTexture(),o.hasOccludees=s.hasOccludees,o.receiveShadows=s.shadowMap.ready,o.screenSpaceReflections=null!=s.ssr.lastFrameColor,o.cloudReflections=null!=s.clouds.data?.cubeMap?.colorTexture;break;case 10:o.olidColor=!0}o.snowCover=s.snowCover>0}const h=e.get(c,o);return this._setClean(),h}submit(e,t,s){if(this.objectOpacity<=0)return;const{componentData:r,renderable:o}=s,{geometry:i}=o,a=o.meta.cameraDepthSquared;r.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:h}=r;switch(this._computeWhichMaterialPass()){case 0:e.opaque.submitDraw(this,i,l,a);break;case 1:e.transparent.submitDraw(this,i,l,a);break;case 2:e.opaque.submitDraw(this,i,l,a),e.transparent.submitDraw(this,i,l,a);break;case 3:e.integratedMesh.submitDraw(this,i,l,a),j(t)&&e.occludedGround.submitDraw(this,i,l,a),C(t)&&e.highlightIntegratedMesh.submitDraw(this,i,l,a);break;case 4:e.transparentIntegratedMesh.submitDraw(this,i,l,a)}if(2!==this.componentParameters.castShadows){if(null!=n)for(const t of n)t[0]===b&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=h&&e.defaultShadowMap.submitDraw(this,i,h,a),e.shadowMap.submitDraw(this,i,l,a)}if(null!=n)for(const u of n)e.highlight.submitDraw(this,i,u[1],a,u[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,i,l,a)}_computeWhichMaterialPass(){if(this.isIntegratedMesh&&this.objectOpacity>=1)return 3;if(this.isIntegratedMesh&&this.objectOpacity<1)return 4;if(this.objectOpacity<1)return 1;if(0===this.componentParameters.opaqueOverride)return 0;if(this.baseColor[3]<1||0===this.alphaDiscardMode||3===this.alphaDiscardMode)return 1;switch(this.componentParameters.transparent){case 2:return 0;case 0:return 1;case 1:return 2}}}e([d({vectorOps:n})],T.prototype,"baseColor",void 0),e([d()],T.prototype,"usePBR",void 0),e([d()],T.prototype,"hasParametersFromSource",void 0),e([d({vectorOps:i})],T.prototype,"mrrFactors",void 0),e([d({dispose:!0})],T.prototype,"baseColorTexture",void 0),e([d({dispose:!0})],T.prototype,"metallicRoughnessTexture",void 0),e([d({dispose:!0})],T.prototype,"normalTexture",void 0),e([d({dispose:!0})],T.prototype,"occlusionTexture",void 0),e([d({dispose:!0})],T.prototype,"emissionTexture",void 0),e([d({vectorOps:i})],T.prototype,"emissiveBaseColor",void 0),e([d()],T.prototype,"emissiveStrength",void 0),e([m()],T.prototype,"commonMaterialParameters",void 0),e([m()],T.prototype,"componentParameters",void 0),e([d()],T.prototype,"objectOpacity",void 0),e([d()],T.prototype,"textureAlphaCutoff",void 0),e([d()],T.prototype,"alphaDiscardMode",void 0),e([d()],T.prototype,"isIntegratedMesh",void 0),e([d()],T.prototype,"polygonOffsetEnabled",void 0),e([d()],T.prototype,"ellipsoidMode",void 0),e([d()],T.prototype,"hasOccludees",void 0);class S extends g{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=2,this.hasSlicePlane=!0}}e([d()],S.prototype,"doubleSided",void 0),e([d()],S.prototype,"cullFace",void 0),e([d()],S.prototype,"hasSlicePlane",void 0);class w extends g{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=1,this.emissiveStrength=0,this.emissiveSource=0,this.castShadows=0}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}get visible(){return this.externalColor[3]>0?0:2}get type(){return 0}}e([d({vectorOps:n})],w.prototype,"externalColor",void 0),e([d()],w.prototype,"externalColorMixMode",void 0),e([d()],w.prototype,"emissiveStrength",void 0),e([d()],w.prototype,"emissiveSource",void 0),e([d()],w.prototype,"castShadows",void 0);class O extends g{constructor(){super(...arguments),this.texture=null,this.transparent=2,this.opaqueOverride=2,this.emissiveOverride=2,this.emissiveSourceOverride=2,this.castShadows=2}get type(){return 1}}function C(e){return null!=e.overlay?.getTexture(2)}function P(e){return null!=e.overlay?.getTexture(3)}function D(e){return null!=e.overlay?.getTexture(1)}function j(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?1:4)}e([d()],O.prototype,"texture",void 0),e([d()],O.prototype,"transparent",void 0),e([d()],O.prototype,"opaqueOverride",void 0),e([d()],O.prototype,"emissiveOverride",void 0),e([d()],O.prototype,"emissiveSourceOverride",void 0),e([d()],O.prototype,"castShadows",void 0);export{S as CommonMaterialParameters,T as ComponentMaterial,w as ComponentParametersUniform,O as ComponentParametersVarying};
5
+ import{__decorate as e}from"tslib";import{invert as t,transpose as s}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as o,I as i}from"../../../../../../chunks/vec32.js";import{freeze as a,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{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as p}from"./ComponentTechniqueConfiguration.js";import{parameter as d,parameterBlock as m,MaterialBase as v,MaterialParameterBlock as g}from"../../../core/material/MaterialBase.js";import{isColorEmission as x}from"../../../core/shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as f}from"../../../core/util/TwoVectorPosition.js";import{advancedMRRFactors as M}from"../../../materials/pbrUtils.js";import{defaultHighlightName as b}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as y}from"../../../../../../webscene/support/AlphaCutoff.js";class T extends v{constructor(e,o){super(),this.toMapSpace=o,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.sphereDepthInterpolate=!1,this.mrrFactors=M,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=0,this.commonMaterialParameters=new S,this.componentParameters=new w,this.objectOpacity=1,this.textureAlphaCutoff=y,this.alphaDiscardMode=1,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=1,this.hasOccludees=!1;const i=new f(e.position),l=r(e.rotationScale);t(l,l),s(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=i.low,this.transformWorldFromModelTH=i.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get _hasEmissiveBase(){return null!=this.emissionTexture||!o(this.emissiveBaseColor,l)}get _hasEmissiveStrength(){return 2!==this.componentParameters.emissiveOverride}get hasEmissions(){return this._hasEmissiveStrength&&(this._hasEmissiveBase||2!==this.componentParameters.emissiveSourceOverride)}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,s,r){const o=new p(e.context.spherical);o.renderOccluded=9===s.slot,o.hasVertexColors=r.hasVertexColors,o.hasNormals=r.hasNormals,o.textureCoordinateType=r.textureCoordinateType,o.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,o.hasOcclusionTexture=null!=this.occlusionTexture,o.hasNormalTexture=null!=this.normalTexture,o.sphereDepthInterpolate=this.sphereDepthInterpolate&&1===e.viewingMode,o.oitPass=0===t.identifier&&null!=s.oitPass?s.oitPass:0,o.terrainDepthTest=0===t.identifier&&s.terrainDepthTest,o.cullAboveTerrain=0===t.identifier&&s.cullAboveTerrain,o.ellipsoidMode=this.ellipsoidMode,o.componentData=this.componentParameters.type,o.cullFace=this.commonMaterialParameters.cullFace,o.doubleSidedMode=this.commonMaterialParameters.doubleSided?1:0,o.hasColorTexture=null!=this.baseColorTexture;const i=this._computeWhichMaterialPass();o.blendingEnabled=1===i||2===i,o.alphaDiscardMode=this.alphaDiscardMode,o.integratedMeshMode=this.isIntegratedMesh?D(s)?P(s)?3:2:1:0,o.hasPolygonOffset=this.polygonOffsetEnabled,o.pbrMode=3===o.integratedMeshMode?4:this.usePBR?this.hasParametersFromSource?r.shadeNormals&&this.isIntegratedMesh?0:2:1:0;const a=1===this.componentParameters.emissiveSourceOverride,l=2===this.componentParameters.emissiveSourceOverride,n=null!=this.emissionTexture;if(o.emissionSource=this.hasEmissions?this._hasEmissiveBase&&1===o.pbrMode?l?n?4:2:a?n?5:7:6:a?7:6:0,o.shadeNormals=r.shadeNormals,o.normalType=o.hasNormals?1:2,o.hasSlicePlane=null!=s.slicePlane&&this.commonMaterialParameters.hasSlicePlane,o.receiveAmbientOcclusion=o.hasOccludees=o.receiveShadows=o.screenSpaceReflections=o.cloudReflections=o.hasHighlightMixTexture=!1,1===t.identifier)o.output=4,o.vertexDiscardMode=0;else if(3===t.identifier)o.output=7,o.vertexDiscardMode=0;else if(2===t.identifier)o.output=9,o.vertexDiscardMode=0,o.hasHighlightMixTexture=null!=s.highlightMixTexture;else{switch(o.vertexDiscardMode=2===i?t.transparent?2:1:0,o.hasGlow=x(t.output),o.output=t.output,t.output){case 0:case 1:o.receiveAmbientOcclusion=r.applySSAO&&null!=s.ssao?.getTexture(),o.hasOccludees=s.hasOccludees,o.receiveShadows=s.shadowMap.ready,o.screenSpaceReflections=null!=s.ssr.lastFrameColor,o.cloudReflections=null!=s.clouds.data?.cubeMap?.colorTexture;break;case 10:o.olidColor=!0}o.snowCover=s.snowCover>0}const h=e.get(c,o);return this._setClean(),h}submit(e,t,s){if(this.objectOpacity<=0)return;const{componentData:r,renderable:o}=s,{geometry:i}=o,a=o.meta.cameraDepthSquared;r.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:h}=r;switch(this._computeWhichMaterialPass()){case 0:e.opaque.submitDraw(this,i,l,a);break;case 1:e.transparent.submitDraw(this,i,l,a);break;case 2:e.opaque.submitDraw(this,i,l,a),e.transparent.submitDraw(this,i,l,a);break;case 3:e.integratedMesh.submitDraw(this,i,l,a),j(t)&&e.occludedGround.submitDraw(this,i,l,a),C(t)&&e.highlightIntegratedMesh.submitDraw(this,i,l,a);break;case 4:e.transparentIntegratedMesh.submitDraw(this,i,l,a)}if(2!==this.componentParameters.castShadows){if(null!=n)for(const t of n)t[0]===b&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=h&&e.defaultShadowMap.submitDraw(this,i,h,a),e.shadowMap.submitDraw(this,i,l,a)}if(null!=n)for(const u of n)e.highlight.submitDraw(this,i,u[1],a,u[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,i,l,a)}_computeWhichMaterialPass(){if(this.isIntegratedMesh&&this.objectOpacity>=1)return 3;if(this.isIntegratedMesh&&this.objectOpacity<1)return 4;if(this.objectOpacity<1)return 1;if(0===this.componentParameters.opaqueOverride)return 0;if(this.baseColor[3]<1||0===this.alphaDiscardMode||3===this.alphaDiscardMode)return 1;switch(this.componentParameters.transparent){case 2:return 0;case 0:return 1;case 1:return 2}}}e([d({vectorOps:n})],T.prototype,"baseColor",void 0),e([d()],T.prototype,"usePBR",void 0),e([d()],T.prototype,"hasParametersFromSource",void 0),e([d()],T.prototype,"sphereDepthInterpolate",void 0),e([d({vectorOps:i})],T.prototype,"mrrFactors",void 0),e([d({dispose:!0})],T.prototype,"baseColorTexture",void 0),e([d({dispose:!0})],T.prototype,"metallicRoughnessTexture",void 0),e([d({dispose:!0})],T.prototype,"normalTexture",void 0),e([d({dispose:!0})],T.prototype,"occlusionTexture",void 0),e([d({dispose:!0})],T.prototype,"emissionTexture",void 0),e([d({vectorOps:i})],T.prototype,"emissiveBaseColor",void 0),e([d()],T.prototype,"emissiveStrength",void 0),e([m()],T.prototype,"commonMaterialParameters",void 0),e([m()],T.prototype,"componentParameters",void 0),e([d()],T.prototype,"objectOpacity",void 0),e([d()],T.prototype,"textureAlphaCutoff",void 0),e([d()],T.prototype,"alphaDiscardMode",void 0),e([d()],T.prototype,"isIntegratedMesh",void 0),e([d()],T.prototype,"polygonOffsetEnabled",void 0),e([d()],T.prototype,"ellipsoidMode",void 0),e([d()],T.prototype,"hasOccludees",void 0);class S extends g{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=2,this.hasSlicePlane=!0}}e([d()],S.prototype,"doubleSided",void 0),e([d()],S.prototype,"cullFace",void 0),e([d()],S.prototype,"hasSlicePlane",void 0);class w extends g{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=1,this.emissiveStrength=0,this.emissiveSource=0,this.castShadows=0}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}get visible(){return this.externalColor[3]>0?0:2}get type(){return 0}}e([d({vectorOps:n})],w.prototype,"externalColor",void 0),e([d()],w.prototype,"externalColorMixMode",void 0),e([d()],w.prototype,"emissiveStrength",void 0),e([d()],w.prototype,"emissiveSource",void 0),e([d()],w.prototype,"castShadows",void 0);class O extends g{constructor(){super(...arguments),this.texture=null,this.transparent=2,this.opaqueOverride=2,this.emissiveOverride=2,this.emissiveSourceOverride=2,this.castShadows=2}get type(){return 1}}function C(e){return null!=e.overlay?.getTexture(2)}function P(e){return null!=e.overlay?.getTexture(3)}function D(e){return null!=e.overlay?.getTexture(1)}function j(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?1:4)}e([d()],O.prototype,"texture",void 0),e([d()],O.prototype,"transparent",void 0),e([d()],O.prototype,"opaqueOverride",void 0),e([d()],O.prototype,"emissiveOverride",void 0),e([d()],O.prototype,"emissiveSourceOverride",void 0),e([d()],O.prototype,"castShadows",void 0);export{S as CommonMaterialParameters,T as ComponentMaterial,w as ComponentParametersUniform,O 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import{isColorEmissionHighlightOrOID as t}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as e,ShaderTechniqueConfiguration as i}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class s extends i{constructor(o){super(),this.spherical=o,this.output=0,this.textureCoordinateType=0,this.componentData=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.oitPass=0,this.ellipsoidMode=1,this.pbrMode=0,this.normalType=0,this.emissionSource=0,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.olidColor=!1,this.hasGlow=!1,this.renderOccluded=!1,this.discardInvisibleFragments=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.highStepCount=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1}get overlayEnabled(){return(2===this.integratedMeshMode||3===this.integratedMeshMode)&&t(this.output)}}o([e({count:11})],s.prototype,"output",void 0),o([e({count:3})],s.prototype,"textureCoordinateType",void 0),o([e({count:2})],s.prototype,"componentData",void 0),o([e({count:3})],s.prototype,"cullFace",void 0),o([e({count:3})],s.prototype,"vertexDiscardMode",void 0),o([e({count:3})],s.prototype,"doubleSidedMode",void 0),o([e({count:4})],s.prototype,"alphaDiscardMode",void 0),o([e({count:4})],s.prototype,"integratedMeshMode",void 0),o([e({count:3})],s.prototype,"oitPass",void 0),o([e({count:4})],s.prototype,"ellipsoidMode",void 0),o([e({count:7})],s.prototype,"pbrMode",void 0),o([e({count:3})],s.prototype,"normalType",void 0),o([e({count:8})],s.prototype,"emissionSource",void 0),o([e()],s.prototype,"hasVertexColors",void 0),o([e()],s.prototype,"hasNormals",void 0),o([e()],s.prototype,"shadeNormals",void 0),o([e()],s.prototype,"hasSlicePlane",void 0),o([e()],s.prototype,"hasColorTexture",void 0),o([e()],s.prototype,"hasHighlightMixTexture",void 0),o([e()],s.prototype,"receiveAmbientOcclusion",void 0),o([e()],s.prototype,"receiveShadows",void 0),o([e()],s.prototype,"blendingEnabled",void 0),o([e()],s.prototype,"screenSpaceReflections",void 0),o([e()],s.prototype,"hasPolygonOffset",void 0),o([e()],s.prototype,"hasMetallicRoughnessTexture",void 0),o([e()],s.prototype,"hasOcclusionTexture",void 0),o([e()],s.prototype,"hasNormalTexture",void 0),o([e()],s.prototype,"hasOccludees",void 0),o([e()],s.prototype,"terrainDepthTest",void 0),o([e()],s.prototype,"cullAboveTerrain",void 0),o([e()],s.prototype,"hasNormalTextureTransform",void 0),o([e()],s.prototype,"cloudReflections",void 0),o([e()],s.prototype,"snowCover",void 0),o([e()],s.prototype,"olidColor",void 0),o([e()],s.prototype,"hasGlow",void 0),o([e()],s.prototype,"renderOccluded",void 0);export{s as ComponentTechniqueConfiguration};
5
+ import{__decorate as o}from"tslib";import{isColorEmissionHighlightOrOID as e}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as t,ShaderTechniqueConfiguration as i}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class s extends i{constructor(o){super(),this.spherical=o,this.output=0,this.textureCoordinateType=0,this.componentData=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.oitPass=0,this.ellipsoidMode=1,this.pbrMode=0,this.normalType=0,this.emissionSource=0,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.olidColor=!1,this.hasGlow=!1,this.renderOccluded=!1,this.sphereDepthInterpolate=!1,this.discardInvisibleFragments=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.highStepCount=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1}get overlayEnabled(){return(2===this.integratedMeshMode||3===this.integratedMeshMode)&&e(this.output)}}o([t({count:11})],s.prototype,"output",void 0),o([t({count:3})],s.prototype,"textureCoordinateType",void 0),o([t({count:2})],s.prototype,"componentData",void 0),o([t({count:3})],s.prototype,"cullFace",void 0),o([t({count:3})],s.prototype,"vertexDiscardMode",void 0),o([t({count:3})],s.prototype,"doubleSidedMode",void 0),o([t({count:4})],s.prototype,"alphaDiscardMode",void 0),o([t({count:4})],s.prototype,"integratedMeshMode",void 0),o([t({count:3})],s.prototype,"oitPass",void 0),o([t({count:4})],s.prototype,"ellipsoidMode",void 0),o([t({count:7})],s.prototype,"pbrMode",void 0),o([t({count:3})],s.prototype,"normalType",void 0),o([t({count:8})],s.prototype,"emissionSource",void 0),o([t()],s.prototype,"hasVertexColors",void 0),o([t()],s.prototype,"hasNormals",void 0),o([t()],s.prototype,"shadeNormals",void 0),o([t()],s.prototype,"hasSlicePlane",void 0),o([t()],s.prototype,"hasColorTexture",void 0),o([t()],s.prototype,"hasHighlightMixTexture",void 0),o([t()],s.prototype,"receiveAmbientOcclusion",void 0),o([t()],s.prototype,"receiveShadows",void 0),o([t()],s.prototype,"blendingEnabled",void 0),o([t()],s.prototype,"screenSpaceReflections",void 0),o([t()],s.prototype,"hasPolygonOffset",void 0),o([t()],s.prototype,"hasMetallicRoughnessTexture",void 0),o([t()],s.prototype,"hasOcclusionTexture",void 0),o([t()],s.prototype,"hasNormalTexture",void 0),o([t()],s.prototype,"hasOccludees",void 0),o([t()],s.prototype,"terrainDepthTest",void 0),o([t()],s.prototype,"cullAboveTerrain",void 0),o([t()],s.prototype,"hasNormalTextureTransform",void 0),o([t()],s.prototype,"cloudReflections",void 0),o([t()],s.prototype,"snowCover",void 0),o([t()],s.prototype,"olidColor",void 0),o([t()],s.prototype,"hasGlow",void 0),o([t()],s.prototype,"renderOccluded",void 0),o([t()],s.prototype,"sphereDepthInterpolate",void 0);export{s as ComponentTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../../../geometry/support/Ellipsoid.js";import"./ComponentData.glsl.js";import"../../../../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../../../../core/shaderLibrary/ShaderOutput.js";import"../../../../core/shaderLibrary/Slice.glsl.js";import"../../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../../core/shaderLibrary/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/shaderModules/glsl.js";import"../../../../core/shaderModules/Texture2DBindUniform.js";import"../../../../effects/weather/SnowCover.glsl.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/ellipsoidUtils.js";import"../../../../../../../geometry/support/Ellipsoid.js";import"./ComponentData.glsl.js";import"../../../../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../../../../core/shaderLibrary/ShaderOutput.js";import"../../../../core/shaderLibrary/Slice.glsl.js";import"../../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../../core/shaderModules/glsl.js";import"../../../../core/shaderModules/Texture2DBindUniform.js";import"../../../../effects/weather/SnowCover.glsl.js";import"../../../../shaders/OutputColorHighlightOID.glsl.js";import"../../../../shaders/SphereDepthInterpolate.glsl.js";import"../../../../../../webgl/ShaderBuilder.js";import"../../../../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../../../../chunks/ComponentShader.glsl.js";
@@ -2,15 +2,21 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2BindUniform as r}from"../../shaderModules/Float2BindUniform.js";import{glsl as o}from"../../shaderModules/glsl.js";function d(e){e.uniforms.add(new r("zProjectionMap",e=>a(e.camera))),e.code.add(o`float linearizeDepth(float depth) {
5
+ import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2BindUniform as r}from"../../shaderModules/Float2BindUniform.js";import{glsl as o}from"../../shaderModules/glsl.js";function a(e){e.uniforms.add(new r("zProjectionMap",e=>d(e.camera))),e.code.add(o`float linearizeDepth(float depth) {
6
6
  float depthNdc = depth * 2.0 - 1.0;
7
7
  float c1 = zProjectionMap[0];
8
8
  float c2 = zProjectionMap[1];
9
9
  return -(c1 / (depthNdc + c2 + 1e-7));
10
+ }`),e.code.add(o`float delinearizeDepth(float linearDepth) {
11
+ float c1 = zProjectionMap[0];
12
+ float c2 = zProjectionMap[1];
13
+ float depthNdc = (-c1/linearDepth) - c2 - 1e-7;
14
+ float depthNonlinear01 = (depthNdc + 1.0 ) / 2.0;
15
+ return depthNonlinear01;
10
16
  }`),e.code.add(o`float depthFromTexture(sampler2D depthTexture, vec2 uv) {
11
17
  ivec2 iuv = ivec2(uv * vec2(textureSize(depthTexture, 0)));
12
18
  float depth = texelFetch(depthTexture, iuv, 0).r;
13
19
  return depth;
14
20
  }`),e.code.add(o`float linearDepthFromTexture(sampler2D depthTexture, vec2 uv) {
15
21
  return linearizeDepth(depthFromTexture(depthTexture, uv));
16
- }`)}function a(t){const r=t.projectionMatrix;return e(c,r[14],r[10])}const c=t();export{d as ReadDepth};
22
+ }`)}function d(t){const r=t.projectionMatrix;return e(c,r[14],r[10])}const c=t();export{a as ReadDepth};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{F as FocusAreaColorPassParameters,b as build}from"../../../../../chunks/FocusAreaColor.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as o}from"../../../webgl.js";import t from"../../../webgl/RenderNode.js";import{FocusAreaColorTechnique as i}from"./FocusAreaColorTechnique.js";import{F as c}from"../../../../../chunks/FocusAreaColor.glsl.js";import{DepthStencilAttachment as a}from"../../../../webgl/enums.js";let p=class extends t{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._passParameters=new c}precompile(){this.techniques.precompile(i)}render(e){const r=this.techniques.get(i),s=e.find(({name:e})=>e===this.produces);if(!r.compiled)return this.requestRender(),s;const t=this.focusAreasView.style,c=this.bindParameters,p=c.camera,n=p.fullViewport[2],u=p.fullViewport[3],d=e.find(({name:e})=>e===o.FOCUSAREA),h=this.fboCache.acquire(n,u,this.produces),f=this.renderingContext;return f.bindFramebuffer(h.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=d.getTexture(),this._passParameters.effect=m[t],f.bindTechnique(r,c,this._passParameters),f.screen.draw(),h.attachDepth(s.getAttachment(a)),h}};e([r()],p.prototype,"consumes",void 0),e([r()],p.prototype,"produces",void 0),e([r({constructOnly:!0})],p.prototype,"focusAreasView",void 0),p=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],p);const m={bright:0,dark:1};export{p as FocusAreaColorNode};
5
+ import{__decorate as e}from"tslib";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as o}from"../../../webgl.js";import t from"../../../webgl/RenderNode.js";import{F as i}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{DepthStencilAttachment as a}from"../../../../webgl/enums.js";let p=class extends t{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._passParameters=new i}precompile(){this.techniques.precompile(c)}render(e){const r=this.techniques.get(c),s=e.find(({name:e})=>e===this.produces);if(!r.compiled)return this.requestRender(),s;const t=this.focusAreasView.style,i=this.bindParameters,p=i.camera,n=p.fullViewport[2],u=p.fullViewport[3],d=e.find(({name:e})=>e===o.FOCUSAREA),h=this.fboCache.acquire(n,u,this.produces),f=this.renderingContext;return f.bindFramebuffer(h.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=d.getTexture(),this._passParameters.effect=m[t],f.bindTechnique(r,i,this._passParameters),f.screen.draw(),h.attachDepth(s.getAttachment(a)),h}};e([r()],p.prototype,"consumes",void 0),e([r()],p.prototype,"produces",void 0),e([r({constructOnly:!0})],p.prototype,"focusAreasView",void 0),p=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],p);const m={bright:0,dark:1};export{p as FocusAreaColorNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as o}from"../../lib/DefaultVertexBufferLayouts.js";import{a as s}from"../../../../../chunks/FocusAreaColor.glsl.js";import{makePipelineState as t,defaultColorWrite as i}from"../../../../webgl/renderState.js";class a extends r{constructor(r,t){super(r,t,new e(s,()=>import("../../shaders/FocusAreaColor.glsl.js")),o)}initializePipeline(){return t({colorWrite:i})}}export{a as FocusAreaColorTechnique};
5
+ import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as o}from"../../../../../chunks/FocusAreaColor.glsl.js";import{Pos2Locations as s}from"../../lib/DefaultVertexBufferLayouts.js";import{makePipelineState as t,defaultColorWrite as i}from"../../../../webgl/renderState.js";class l extends r{constructor(r,t){super(r,t,new e(o,()=>import("./FocusAreaColor.glsl.js")),s)}initializePipeline(){return t({colorWrite:i})}}export{l as FocusAreaColorTechnique};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import"../../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Matrix4DrawUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{F as FocusAreaMaskDrawParameters,b as build}from"../../../../../chunks/FocusAreaMask.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r,InternalRenderCategory as o}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{FocusAreaMaskTechnique as n}from"./FocusAreaMaskTechnique.js";import{Pos3 as a}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as c}from"../../lib/VertexArrayObject.js";import{F as h}from"../../../../../chunks/FocusAreaMask.glsl.js";import{DepthStencilAttachment as p,PrimitiveType as l}from"../../../../webgl/enums.js";import{noParameters as u}from"../../../../webgl/NoParameters.js";import{VertexBuffer as m}from"../../../../webgl/VertexBuffer.js";let d=class extends i{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.TRANSPARENT]},this.produces=o.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new h}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(n)}render(e){const s=this.techniques.get(n),t=this.bindParameters,i=t.camera,a=i.fullViewport[2],c=i.fullViewport[3];if(!s.compiled||!this._vaos)return void this.requestRender();const h=e.find(({name:e})=>e===r.TRANSPARENT),m=this.renderingContext,d=this.fboCache.acquire(a,c,o.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(d.acquireDepth(12),m.blitFramebuffer(h.fbo,d.fbo,256)):d.attachDepth(h.getAttachment(p)),m.bindFramebuffer(d.fbo),m.setClearColor(0,0,0,1),m.clear(17408),m.setViewport(0,0,a,c);const f=m.bindTechnique(s,t);m.setFaceCullingEnabled(!1),m.setStencilTestEnabled(!0),m.setStencilOpSeparate(1028,7680,34055,7680),m.setStencilOpSeparate(1029,7680,34056,7680),m.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],f.bindDraw(t,u,this._maskParameters),m.bindVAO(e),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!1,!1,!1),m.drawArrays(l.TRIANGLES,0,s),m.setDepthTestEnabled(!1),m.setStencilWriteMask(0),m.setStencilFunction(517,0,255),m.setColorMask(!0,!0,!0,!0),m.drawArrays(l.TRIANGLES,0,s)}return d}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=new Array;let t=0,r=0;e.geometryVolumes.forEach(e=>{const o=e.indicesBottom;t+=o.length;for(let t=0;t<o.length;t++)s.push(e.positions[3*(o[t]-1)]),s.push(e.positions[3*(o[t]-1)+1]),s.push(e.positions[3*(o[t]-1)+2]);const i=e.indicesExtruded;r+=i.length;for(let t=0;t<i.length;t++)s.push(e.positions[3*i[t]]),s.push(e.positions[3*i[t]+1]),s.push(e.positions[3*i[t]+2])});const o=new c(this.renderingContext,new m(this.renderingContext,a,new Float32Array(s)));this._vaos.push(o),this._counts.push(t+r),this._origins.push(e.origin)}),this.requestRender()}};e([s()],d.prototype,"consumes",void 0),e([s()],d.prototype,"produces",void 0),e([s({constructOnly:!0})],d.prototype,"focusAreasView",void 0),d=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],d);export{d as FocusAreaMaskNode};
5
+ import{__decorate as e}from"tslib";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r,InternalRenderCategory as o}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaMask.glsl.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{Pos3 as c}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as h}from"../../lib/VertexArrayObject.js";import{DepthStencilAttachment as p,PrimitiveType as l}from"../../../../webgl/enums.js";import{noParameters as u}from"../../../../webgl/NoParameters.js";import{VertexBuffer as m}from"../../../../webgl/VertexBuffer.js";let d=class extends i{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.TRANSPARENT]},this.produces=o.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new n}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const s=this.techniques.get(a),t=this.bindParameters,i=t.camera,n=i.fullViewport[2],c=i.fullViewport[3];if(!s.compiled||!this._vaos)return void this.requestRender();const h=e.find(({name:e})=>e===r.TRANSPARENT),m=this.renderingContext,d=this.fboCache.acquire(n,c,o.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(d.acquireDepth(12),m.blitFramebuffer(h.fbo,d.fbo,256)):d.attachDepth(h.getAttachment(p)),m.bindFramebuffer(d.fbo),m.setClearColor(0,0,0,1),m.clear(17408),m.setViewport(0,0,n,c);const f=m.bindTechnique(s,t);m.setFaceCullingEnabled(!1),m.setStencilTestEnabled(!0),m.setStencilOpSeparate(1028,7680,34055,7680),m.setStencilOpSeparate(1029,7680,34056,7680),m.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],f.bindDraw(t,u,this._maskParameters),m.bindVAO(e),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!1,!1,!1),m.drawArrays(l.TRIANGLES,0,s),m.setDepthTestEnabled(!1),m.setStencilWriteMask(0),m.setStencilFunction(517,0,255),m.setColorMask(!0,!0,!0,!0),m.drawArrays(l.TRIANGLES,0,s)}return d}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=new Array;let t=0,r=0;e.geometryVolumes.forEach(e=>{const o=e.indicesBottom;t+=o.length;for(let t=0;t<o.length;t++)s.push(e.positions[3*(o[t]-1)]),s.push(e.positions[3*(o[t]-1)+1]),s.push(e.positions[3*(o[t]-1)+2]);const i=e.indicesExtruded;r+=i.length;for(let t=0;t<i.length;t++)s.push(e.positions[3*i[t]]),s.push(e.positions[3*i[t]+1]),s.push(e.positions[3*i[t]+2])});const o=new h(this.renderingContext,new m(this.renderingContext,c,new Float32Array(s)));this._vaos.push(o),this._counts.push(t+r),this._origins.push(e.origin)}),this.requestRender()}};e([s()],d.prototype,"consumes",void 0),e([s()],d.prototype,"produces",void 0),e([s({constructOnly:!0})],d.prototype,"focusAreasView",void 0),d=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],d);export{d as FocusAreaMaskNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{Pos3 as o}from"../../lib/DefaultVertexBufferLayouts.js";import{a as s}from"../../../../../chunks/FocusAreaMask.glsl.js";import{makePipelineState as t,defaultColorWrite as i}from"../../../../webgl/renderState.js";import{fromLayout as a}from"../../../../webgl/VertexAttributeLocations.js";class l extends r{constructor(r,t){super(r,t,new e(s,()=>import("../../shaders/FocusAreaMask.glsl.js")),a(o))}initializePipeline(){return t({colorWrite:i,depthTest:{func:515}})}}export{l as FocusAreaMaskTechnique};
5
+ import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as o}from"../../../../../chunks/FocusAreaMask.glsl.js";import{Pos3 as t}from"../../lib/DefaultVertexBufferLayouts.js";import{makePipelineState as s,defaultColorWrite as i}from"../../../../webgl/renderState.js";import{fromLayout as a}from"../../../../webgl/VertexAttributeLocations.js";class l extends r{constructor(r,s){super(r,s,new e(o,()=>import("./FocusAreaMask.glsl.js")),a(t))}initializePipeline(){return s({colorWrite:i,depthTest:{func:515}})}}export{l as FocusAreaMaskTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../Color.js";import o from"../../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as s,initial as i}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{OutlineVisualElement as a}from"../../../interactive/visualElements/OutlineVisualElement.js";let m=class extends o{constructor(e){super(e)}initialize(){this.addHandles([s(()=>this.area.enabled,()=>this._ensureElement(),i),s(()=>this.area.outline?.color,e=>this._updateColor(e),i),s(()=>this.area.geometries,e=>this._updateGeometries(e),i)])}destroy(){this.removeAllHandles(),this._outlineElement=r(this._outlineElement)}_ensureElement(){this.area.enabled&&this.area.outline?.color?this._outlineElement??=new a({view:this.view,geometry:this._mergePolygons(this.area.geometries),isDraped:!0,attached:!0,isDecoration:!1,color:t.toUnitRGBA(this.area.outline?.color),renderOccluded:4,width:3}):this._outlineElement=r(this._outlineElement)}_updateGeometries(e){this._ensureElement(),this._outlineElement&&(this._outlineElement.geometry=this._mergePolygons(e))}_updateColor(e){this._ensureElement(),this._outlineElement&&e&&(this._outlineElement.color=t.toUnitRGBA(e))}_mergePolygons(e){if(!e||0===e.length)return null;const t=e.at(0).clone();return e.forEach(e=>{t.rings.push(...e.rings)}),t}};e([n({constructOnly:!0})],m.prototype,"view",void 0),e([n({constructOnly:!0})],m.prototype,"area",void 0),m=e([l("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaOutlineItem")],m);export{m as FocusAreaOutlineItem};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../Color.js";import o from"../../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as s,initial as i}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{OutlineVisualElement as a}from"../../../interactive/visualElements/OutlineVisualElement.js";let m=class extends o{constructor(e){super(e)}initialize(){this.addHandles([s(()=>this.area.enabled,()=>this._ensureElement(),i),s(()=>this.area.outline?.color,e=>this._updateColor(e),i),s(()=>this.area.geometries,e=>this._updateGeometries(e),i)])}destroy(){this.removeAllHandles(),this._outlineElement=r(this._outlineElement)}_ensureElement(){this.area.enabled&&this.area.outline?.color?this._outlineElement??=new a({view:this.view,geometry:this._mergePolygons(this.area.geometries),isDraped:!0,attached:!0,isDecoration:!1,color:t.toUnitRGBA(this.area.outline?.color),renderOccluded:4,width:3}):this._outlineElement=r(this._outlineElement)}_updateGeometries(e){this._ensureElement(),this._outlineElement&&(this._outlineElement.geometry=this._mergePolygons(e))}_updateColor(e){this._ensureElement(),this._outlineElement&&e&&(this._outlineElement.color=t.toUnitRGBA(e))}_mergePolygons(e){if(!e||0===e.length)return null;const t=e.at(0).clone();return t.rings.length=0,e.forEach(e=>t.rings.push(...e.rings)),t}};e([n({constructOnly:!0})],m.prototype,"view",void 0),e([n({constructOnly:!0})],m.prototype,"area",void 0),m=e([l("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaOutlineItem")],m);export{m as FocusAreaOutlineItem};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlowPresets.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/GlowComposition.glsl.js";
5
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/GlowComposition.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as a}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{InternalRenderCategory as n}from"../../../webgl.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as h}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as u}from"./GlowBlurTechniqueConfiguration.js";import{G as m}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as p}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as d}from"./GlowCompositionTechniqueConfiguration.js";import{blurRadiusPresets as g,lodFactorsPresets as _,normalizePreset as b}from"./GlowPresets.glsl.js";import{ColorAttachment1 as f,DepthStencilAttachment as w}from"../../../../webgl/enums.js";let P=class extends l{constructor(e){super(e),this.consumes={required:[n.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=n.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new u,this._blurVerticalConfiguration=new u,this._compositionConfiguration=new d,this._compositionParameters=new m,this._blurParameters=new c,this._blurScale=3.06,this._blurLodCombination=0,this._glowEnabled=!1,this._glowResults=new Array;e.view.stage.renderView.techniques.precompile(p,this._compositionConfiguration)}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},r),i(()=>this.view.qualitySettings.glow,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},r)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=g[e.type];else{const i="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(g.cloudy,g[e.type],i)}this._computeLodFactors(),this.requestRender(1)}_computeLodFactors(e=_.sunny.presets,i=_.foggy.presets){this._compositionParameters.lodFactors=_.sunny.presets,e.forEach((e,r)=>{this._compositionParameters.lodFactors[r]=t(e,i[r],this._blurLodCombination)})}precompile(){this._glowEnabled&&(this.techniques.precompile(h,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(h,this._blurVerticalConfiguration)),this._compositionConfiguration.blurEnabled=this._glowEnabled,this.techniques.precompile(p,this._compositionConfiguration)}render(e){const t=e.find(({name:e})=>e===n.TRANSPARENT_ENVIRONMENT),i=t.getAttachment(f)?.attachment;if(!i)return t;const r=t.getAttachment(w);if(!this._glowEnabled){const e=this.techniques.get(p,this._compositionConfiguration);if(!e.compiled)return this.requestRender(1),t;const o=t.getTexture(),s=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,l=this.renderingContext,c=s.acquire(o.descriptor.width,o.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=o,this._compositionParameters.emission=i,l.bindTechnique(e,this.bindParameters,this._compositionParameters),l.screen.draw(),c.attachDepth(r),c.attachColor(t.getAttachment(f),f),c}const o=this.techniques.get(h,this._blurHorizontalConfiguration),s=this.techniques.get(h,this._blurVerticalConfiguration),a=this.techniques.get(p,this._compositionConfiguration);if(!o.compiled||!s.compiled||!a.compiled)return this.requestRender(1),t;const l=t.getTexture(),c=this.fboCache,{fullWidth:u,fullHeight:m}=this.bindParameters.camera,d=this.renderingContext;let g=i,_=Math.ceil(u/2),b=Math.ceil(m/2);const P=5,C=this._blurParameters.blurRadius;for(let n=0;n<P;n++){const e=c.acquire(_,b,"glow horizontal",8);this._blurParameters.color=g,this._prepareFBO(e,_,b),d.bindTechnique(o,this.bindParameters,this._blurParameters),d.screen.draw();const t=c.acquire(_,b,"glow vertical",8);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,_,b),d.bindTechnique(s,this.bindParameters,this._blurParameters),d.screen.draw(),e.release(),this._glowResults[n]=t,_=Math.ceil(_/2),b=Math.ceil(b/2),g=this._glowResults[n].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=C,this._compositionParameters.color=l,this._compositionParameters.emission=i,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const T=c.acquire(l.descriptor.width,l.descriptor.height,this.produces);return T.acquireColor(f,8,"emissive glow"),this._prepareFBO(T,u,m,!0),d.bindTechnique(a,this.bindParameters,this._compositionParameters),d.screen.draw(),this._glowResults.forEach(e=>e.release()),T.attachDepth(r),T}_prepareFBO(e,t,i,r=!1){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,a)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:e=>{this._blurLodCombination=e,this._computeLodFactors()},setLodFactors:e=>{this._computeLodFactors(b(e))},toggleTonemapping:e=>{this._compositionConfiguration.tonemappingEnabled=e,this.requestRender(1)}}}};e([o()],P.prototype,"consumes",void 0),e([o()],P.prototype,"produces",void 0),P=e([s("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],P);export{P as GlowRenderNode};
5
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as a}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{InternalRenderCategory as n}from"../../../webgl.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as h}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as u}from"./GlowBlurTechniqueConfiguration.js";import{G as m}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as p}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as d}from"./GlowCompositionTechniqueConfiguration.js";import{blurRadiusPresets as g,lodFactorsPresets as _,normalizePreset as b}from"./GlowPresets.glsl.js";import{ColorAttachment1 as f,DepthStencilAttachment as w}from"../../../../webgl/enums.js";let P=class extends l{constructor(e){super(e),this.consumes={required:[n.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=n.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new u,this._blurVerticalConfiguration=new u,this._compositionConfiguration=new d,this._compositionParameters=new m,this._blurParameters=new c,this._blurScale=3.06,this._blurLodCombination=0,this._glowEnabled=!1,this._glowResults=new Array;e.view.stage.renderView.techniques.precompile(p,this._compositionConfiguration)}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},r),i(()=>this.view.qualitySettings.glow,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},r)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=g[e.type];else{const i="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(g.cloudy,g[e.type],i)}this._computeLodFactors(),this.requestRender(1)}_computeLodFactors(e=_.sunny.presets,i=_.foggy.presets){e.forEach((e,r)=>{this._compositionParameters.lodFactors[r]=t(e,i[r],this._blurLodCombination)})}precompile(){this._glowEnabled&&(this.techniques.precompile(h,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(h,this._blurVerticalConfiguration)),this._compositionConfiguration.blurEnabled=this._glowEnabled,this.techniques.precompile(p,this._compositionConfiguration)}render(e){const t=e.find(({name:e})=>e===n.TRANSPARENT_ENVIRONMENT),i=t.getAttachment(f)?.attachment;if(!i)return t;const r=t.getAttachment(w);if(!this._glowEnabled){const e=this.techniques.get(p,this._compositionConfiguration);if(!e.compiled)return this.requestRender(1),t;const o=t.getTexture(),s=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,l=this.renderingContext,c=s.acquire(o.descriptor.width,o.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=o,this._compositionParameters.emission=i,l.bindTechnique(e,this.bindParameters,this._compositionParameters),l.screen.draw(),c.attachDepth(r),c.attachColor(t.getAttachment(f),f),c}const o=this.techniques.get(h,this._blurHorizontalConfiguration),s=this.techniques.get(h,this._blurVerticalConfiguration),a=this.techniques.get(p,this._compositionConfiguration);if(!o.compiled||!s.compiled||!a.compiled)return this.requestRender(1),t;const l=t.getTexture(),c=this.fboCache,{fullWidth:u,fullHeight:m}=this.bindParameters.camera,d=this.renderingContext;let g=i,_=Math.ceil(u/2),b=Math.ceil(m/2);const P=5,C=this._blurParameters.blurRadius;for(let n=0;n<P;n++){const e=c.acquire(_,b,"glow horizontal",8);this._blurParameters.color=g,this._prepareFBO(e,_,b),d.bindTechnique(o,this.bindParameters,this._blurParameters),d.screen.draw();const t=c.acquire(_,b,"glow vertical",8);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,_,b),d.bindTechnique(s,this.bindParameters,this._blurParameters),d.screen.draw(),e.release(),this._glowResults[n]=t,_=Math.ceil(_/2),b=Math.ceil(b/2),g=this._glowResults[n].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=C,this._compositionParameters.color=l,this._compositionParameters.emission=i,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const T=c.acquire(l.descriptor.width,l.descriptor.height,this.produces);return T.acquireColor(f,8,"emissive glow"),this._prepareFBO(T,u,m,!0),d.bindTechnique(a,this.bindParameters,this._compositionParameters),d.screen.draw(),this._glowResults.forEach(e=>e.release()),T.attachDepth(r),T}_prepareFBO(e,t,i,r=!1){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,a)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:e=>{this._blurLodCombination=e,this._computeLodFactors()},setLodFactors:e=>{this._computeLodFactors(b(e))},toggleTonemapping:e=>{this._compositionConfiguration.tonemappingEnabled=e,this.requestRender(1)}}}};e([o()],P.prototype,"consumes",void 0),e([o()],P.prototype,"produces",void 0),P=e([s("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],P);export{P as GlowRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/Error.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{g as o,J as n,c as h,d as l}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{elementsPerSplatPage as u,splatAtlasTextureSize as c}from"../../../../layers/support/GaussianSplatAtlasPageAllocator.js";import{evalTextureSize as m,maxAllowedVisibleGaussians as _}from"../../../../layers/support/gaussianSplatUtils.js";import{RenderCategory as d}from"../../webgl.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as g}from"../../support/GaussianSplatWorkerHandle.js";import b from"../../webgl/RenderNode.js";import{G as S}from"../../../../chunks/GaussianSplat.glsl.js";import{G as C}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as T}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as w}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as P}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as y}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as G}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as x,PrimitiveType as v,PixelType as A,SizedPixelFormat as j}from"../../../webgl/enums.js";import{Texture as D}from"../../../webgl/Texture.js";import{TextureDescriptor as I}from"../../../webgl/TextureDescriptor.js";var k;let F=class extends b{static{k=this}static{this.tileSize=2.048}constructor(t){super(t),this.produces=d.OPAQUE,this._gaussianSplatParameters=new S,this._gaussianSplatCompositionParameters=new C,this._gaussianSplatDepthCompositionParameters=new w,this._splatDepthTechniqueConfiguration=new q(!0),this._totalVisibleGaussians=0,this._orderTexture=null,this._textureAtlas=null,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._previousCameraPosition=p(),this._previousCameraDirection=p(),this._tanFov=r(),this._tempVec=p(),this._cameraDelta=p(),this._coarseCameraPosition=p()}async initialize(){this._initializeTextures(),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())]);const{resourceController:t}=this.view;this._workerHandle=new g(f(t))}precompile(){this.techniques.precompile(G),this.techniques.precompile(y,this._splatDepthTechniqueConfiguration),this.techniques.precompile(T),this.techniques.precompile(P)}render(t){const e=t.find(({name:t})=>t===d.OPAQUE),s=this.techniques.get(G),i=this.techniques.get(y,this._splatDepthTechniqueConfiguration),r=this.techniques.get(T),o=this.techniques.get(P);if(!(s.compiled&&i.compiled&&o.compiled&&r.compiled))return this.requestRender(1),e;const{fullWidth:n,fullHeight:h}=this.bindParameters.camera,l=this.fboCache,p=l.acquire(n,h,"gaussianColorOutput");p.attachDepth(e.getAttachment(x));const u=this.renderingContext;u.bindFramebuffer(p.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this._gaussianSplatParameters.totalGaussians=this._totalVisibleGaussians,this._gaussianSplatParameters.splatOrder=this._orderTexture,this._gaussianSplatParameters.splatAtlas=this._textureAtlas;const c=Math.tan(.5*this.camera.fovY),m=c/h*n;a(this._tanFov,m,c);const _=h/(2*c);this._gaussianSplatParameters.focalLength=_,this._gaussianSplatParameters.tanFov=this._tanFov,this.prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(s,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(v.TRIANGLE_STRIP,0,4,this._totalVisibleGaussians);const f=l.acquire(n,h,"splat depth",8);f.attachDepth(e.getAttachment(x)),u.bindFramebuffer(f.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(v.TRIANGLE_STRIP,0,4,this._totalVisibleGaussians);const g=l.acquire(n,h,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),g.attachDepth(e.getAttachment(x)),u.bindFramebuffer(g.fbo),u.bindTechnique(o,this.bindParameters,this._gaussianSplatDepthCompositionParameters),u.screen.draw(),this._gaussianSplatCompositionParameters.color=e.getTexture(),this._gaussianSplatCompositionParameters.splatColor=p.getTexture(),u.bindFramebuffer(g.fbo),u.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),u.screen.draw(),p.release(),f.release(),g}updateGaussianVisibility(t){this._visibleGaussianTiles=t,this._requestSort()}destroy(){this._workerHandle?.destroyWorkerAndSelf(),super.destroy()}updateTextureAtlas(t,e,s){this._textureAtlas?.updateData(0,t,e,u,1,s)}_ensureBufferCapacity(t){if(this._bufferCapacity<t){const s=Math.ceil(t*e);this._atlasIndicesBuffer=new Uint32Array(s),this._sortedAtlasIndicesBuffer=new Uint32Array(s),this._bufferCapacity=s}}_initializeTextures(){const t=new I;t.height=c,t.width=c,t.pixelFormat=36249,t.dataType=A.UNSIGNED_INT,t.internalFormat=j.RGBA32UI,t.samplingMode=9728,t.wrapMode=33071,this._textureAtlas=new D(this.renderingContext,t);const e=m(_);this._orderBuffer=new Uint32Array(e[0]*e[1]);const s=new I;s.height=e[0],s.width=e[1],s.pixelFormat=36244,s.dataType=A.UNSIGNED_INT,s.internalFormat=j.R32UI,s.wrapMode=33071,s.samplingMode=9728,this._orderTexture=new D(this.renderingContext,s)}_onCameraChange(){const t=this.view.state.camera.eye,e=this.view.state.camera.ray.direction,s=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>s||Math.abs(t[1]-this._previousCameraPosition[1])>s||Math.abs(t[2]-this._previousCameraPosition[2])>s||Math.abs(e[0]-this._previousCameraDirection[0])>s||Math.abs(e[1]-this._previousCameraDirection[1])>s||Math.abs(e[2]-this._previousCameraDirection[2])>s)&&this._requestSort()}prepareHighPrecisionCameraPosition(){o(this._tempVec,this.camera.eye,1/k.tileSize),n(this._tempVec,this._tempVec),h(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,o(this._tempVec,this._tempVec,k.tileSize),l(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}_requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this._requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this._requestSort()}))}async _sortOnWorker(){let t=0;for(let _=0;_<this._visibleGaussianTiles.length;_++)t+=this._visibleGaussianTiles[_].gaussianAtlasIndices.length;if(0===t||t>_)return;this._ensureBufferCapacity(t);const e=this.camera.ray.direction,s=e[0],i=e[1],a=e[2],r=1/Math.sqrt(s*s+i*i+a*a),o=s*r,n=i*r,h=a*r,l=this._atlasIndicesBuffer.subarray(0,t),p=new Float64Array(t);let u=0;for(let _=0;_<this._visibleGaussianTiles.length;_++){const t=this._visibleGaussianTiles[_],e=t.gaussianAtlasIndices,s=t.positions;for(let i=0;i<e.length;i++){l[u]=e[i];const t=3*i,a=s[t],r=s[t+1],c=s[t+2];p[u]=a*o+r*n+c*h,u++}}const c=new Uint32Array(t);for(let _=0;_<t;_++)c[_]=_;const m={distances:p,sortOrderIndices:c};await(this._workerHandle?.sort(m).then(e=>{const s=this._sortedAtlasIndicesBuffer.subarray(0,t);for(let i=0;i<t;i++)s[i]=l[e.sortedOrderIndices[i]];this._orderBuffer.set(s),this._orderTexture?.setData(this._orderBuffer),this._totalVisibleGaussians=t,this.requestRender(1)}))}};F=k=t([i("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],F);export{F as GaussianSplatRenderNode};
5
+ import{__decorate as t}from"tslib";import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/Error.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{g as o,J as n,c as h,d as l}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{elementsPerSplatPage as u,splatAtlasTextureSize as c}from"../../../../layers/support/GaussianSplatAtlasPageAllocator.js";import{evalTextureSize as m,maxAllowedVisibleGaussians as _}from"../../../../layers/support/gaussianSplatUtils.js";import{RenderCategory as d}from"../../webgl.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as g}from"../../support/GaussianSplatWorkerHandle.js";import b from"../../webgl/RenderNode.js";import{G as S}from"../../../../chunks/GaussianSplat.glsl.js";import{G as C}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as T}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as w}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as P}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as G}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as q}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as y}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as v,PrimitiveType as x,PixelType as A,SizedPixelFormat as j}from"../../../webgl/enums.js";import{Texture as D}from"../../../webgl/Texture.js";import{TextureDescriptor as I}from"../../../webgl/TextureDescriptor.js";var k;let V=class extends b{static{k=this}static{this.tileSize=2.048}constructor(t){super(t),this.produces=d.OPAQUE,this._gaussianSplatParameters=new S,this._gaussianSplatCompositionParameters=new C,this._gaussianSplatDepthCompositionParameters=new w,this._splatDepthTechniqueConfiguration=new y(!0),this._totalVisibleGaussians=0,this._orderTexture=null,this._textureAtlas=null,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._previousCameraPosition=p(),this._previousCameraDirection=p(),this._tanFov=r(),this._tempVec=p(),this._cameraDelta=p(),this._coarseCameraPosition=p()}async initialize(){this._initializeTextures(),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())]);const{resourceController:t}=this.view;this._workerHandle=new g(f(t))}precompile(){this.techniques.precompile(q),this.techniques.precompile(G,this._splatDepthTechniqueConfiguration),this.techniques.precompile(T),this.techniques.precompile(P)}render(t){const e=t.find(({name:t})=>t===d.OPAQUE),s=this.techniques.get(q),i=this.techniques.get(G,this._splatDepthTechniqueConfiguration),r=this.techniques.get(T),o=this.techniques.get(P);if(!(s.compiled&&i.compiled&&o.compiled&&r.compiled))return this.requestRender(1),e;const{fullWidth:n,fullHeight:h}=this.bindParameters.camera,l=this.fboCache,p=l.acquire(n,h,"gaussianColorOutput");p.attachDepth(e.getAttachment(v));const u=this.renderingContext;u.bindFramebuffer(p.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this._gaussianSplatParameters.totalGaussians=this._totalVisibleGaussians,this._gaussianSplatParameters.splatOrder=this._orderTexture,this._gaussianSplatParameters.splatAtlas=this._textureAtlas;const c=Math.tan(.5*this.camera.fovY),m=c/h*n;a(this._tanFov,m,c);const _=h/(2*c);this._gaussianSplatParameters.focalLength=_,this._gaussianSplatParameters.tanFov=this._tanFov,this._prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(s,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(x.TRIANGLE_STRIP,0,4,this._totalVisibleGaussians);const f=l.acquire(n,h,"splat depth",8);f.attachDepth(e.getAttachment(v)),u.bindFramebuffer(f.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(x.TRIANGLE_STRIP,0,4,this._totalVisibleGaussians);const g=l.acquire(n,h,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),g.attachDepth(e.getAttachment(v)),u.bindFramebuffer(g.fbo),u.bindTechnique(o,this.bindParameters,this._gaussianSplatDepthCompositionParameters),u.screen.draw(),this._gaussianSplatCompositionParameters.color=e.getTexture(),this._gaussianSplatCompositionParameters.splatColor=p.getTexture(),u.bindFramebuffer(g.fbo),u.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),u.screen.draw(),p.release(),f.release(),g}updateGaussianVisibility(t){this._visibleGaussianTiles=t,this._requestSort()}destroy(){this._workerHandle?.destroyWorkerAndSelf(),super.destroy()}updateTextureAtlas(t,e,s){this._textureAtlas?.updateData(0,t,e,u,1,s)}_ensureBufferCapacity(t){if(this._bufferCapacity<t){const s=Math.ceil(t*e);this._atlasIndicesBuffer=new Uint32Array(s),this._sortedAtlasIndicesBuffer=new Uint32Array(s),this._bufferCapacity=s}}_initializeTextures(){const t=new I;t.height=c,t.width=c,t.pixelFormat=36249,t.dataType=A.UNSIGNED_INT,t.internalFormat=j.RGBA32UI,t.samplingMode=9728,t.wrapMode=33071,this._textureAtlas=new D(this.renderingContext,t);const e=m(_);this._orderBuffer=new Uint32Array(e[0]*e[1]);const s=new I;s.height=e[0],s.width=e[1],s.pixelFormat=36244,s.dataType=A.UNSIGNED_INT,s.internalFormat=j.R32UI,s.wrapMode=33071,s.samplingMode=9728,this._orderTexture=new D(this.renderingContext,s)}_onCameraChange(){const t=this.view.state.camera.eye,e=this.view.state.camera.ray.direction,s=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>s||Math.abs(t[1]-this._previousCameraPosition[1])>s||Math.abs(t[2]-this._previousCameraPosition[2])>s||Math.abs(e[0]-this._previousCameraDirection[0])>s||Math.abs(e[1]-this._previousCameraDirection[1])>s||Math.abs(e[2]-this._previousCameraDirection[2])>s)&&this._requestSort()}_prepareHighPrecisionCameraPosition(){o(this._tempVec,this.camera.eye,1/k.tileSize),n(this._tempVec,this._tempVec),h(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,o(this._tempVec,this._tempVec,k.tileSize),l(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}_requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this._requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this._requestSort()}))}async _sortOnWorker(){let t=0;for(let _=0;_<this._visibleGaussianTiles.length;_++)t+=this._visibleGaussianTiles[_].gaussianAtlasIndices.length;if(0===t||t>_)return this._totalVisibleGaussians=0,void this.requestRender(1);this._ensureBufferCapacity(t);const e=this.camera.ray.direction,s=e[0],i=e[1],a=e[2],r=1/Math.sqrt(s*s+i*i+a*a),o=s*r,n=i*r,h=a*r,l=this._atlasIndicesBuffer.subarray(0,t),p=new Float64Array(t);let u=0;for(let _=0;_<this._visibleGaussianTiles.length;_++){const t=this._visibleGaussianTiles[_],e=t.gaussianAtlasIndices,s=t.positions;for(let i=0;i<e.length;i++){l[u]=e[i];const t=3*i,a=s[t],r=s[t+1],c=s[t+2];p[u]=a*o+r*n+c*h,u++}}const c=new Uint32Array(t);for(let _=0;_<t;_++)c[_]=_;const m={distances:p,sortOrderIndices:c};await(this._workerHandle?.sort(m).then(e=>{const s=this._sortedAtlasIndicesBuffer.subarray(0,t);for(let i=0;i<t;i++)s[i]=l[e.sortedOrderIndices[i]];this._orderBuffer.set(s),this._orderTexture?.setData(this._orderBuffer),this._totalVisibleGaussians=t,this.requestRender(1)}))}};V=k=t([i("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],V);export{V as GaussianSplatRenderNode};