@arcgis/core 4.33.0-next.20250414 → 4.33.0-next.20250416

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 (253) hide show
  1. package/arcade/featureset/support/FeatureSet.js +1 -1
  2. package/arcade/functions/geomasync.js +1 -1
  3. package/arcade/functions/geomsync.js +1 -1
  4. package/arcade/geometry/functions.js +1 -1
  5. package/arcade/geometry/operatorsWorker.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/0252d853419adc203f04.js +1 -0
  8. package/assets/esri/core/workers/chunks/030f5b9a9757eead436b.js +1 -0
  9. package/assets/esri/core/workers/chunks/{3a84ee5d0434362286a6.js → 07f206719763173faa8d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{4403b3f08907e88d0d91.js → 0b34c8356b8492ce7b16.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{fb65796296b0422cf266.js → 272a309760dacb13dee3.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{fe1ad9ed0d32f557e5a3.js → 29283c19e1ccdc6cfbde.js} +33 -33
  13. package/assets/esri/core/workers/chunks/2bdbf678d4f013543dbb.js +1 -0
  14. package/assets/esri/core/workers/chunks/2fd5b48976cefe7cc0ab.js +1 -0
  15. package/assets/esri/core/workers/chunks/321f6f6d268755482c27.js +1 -0
  16. package/assets/esri/core/workers/chunks/{b7a1185ac49480fc1410.js → 35a59f0df087e3c588a9.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{626e33ece2c49d40f6cd.js → 42aab2a336ee22fd9055.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{083548c5eea5aca6404c.js → 45d64b72b7e93e9c64d7.js} +1 -1
  19. package/assets/esri/core/workers/chunks/56fdbe61ac84b036a1a2.js +1 -0
  20. package/assets/esri/core/workers/chunks/57fd5a52be41ddd6a11b.js +1 -0
  21. package/assets/esri/core/workers/chunks/5fb9bb3ac2f60dbd59c4.js +1 -0
  22. package/assets/esri/core/workers/chunks/{0a675f9f69b8b13b7443.js → 601fc99426f0213b0769.js} +1 -1
  23. package/assets/esri/core/workers/chunks/68d7babbe7e0d934e056.js +1 -0
  24. package/assets/esri/core/workers/chunks/6fc39a58f3011291c602.js +1 -0
  25. package/assets/esri/core/workers/chunks/8221f2e540abe1e0f048.js +1 -0
  26. package/assets/esri/core/workers/chunks/83e13baab4b90a88d967.js +1 -0
  27. package/assets/esri/core/workers/chunks/851baab753d9c8e967bd.js +1 -0
  28. package/assets/esri/core/workers/chunks/8ba7d44eff348004f084.js +1 -0
  29. package/assets/esri/core/workers/chunks/{9050dad7e4f093568026.js → 97267911d03c2426d319.js} +1 -1
  30. package/assets/esri/core/workers/chunks/984c5047ab1fa632ca09.js +1 -0
  31. package/assets/esri/core/workers/chunks/{5aae4e127e888f69435a.js → 9a1c058d3ecd1db0e996.js} +1 -1
  32. package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +1 -0
  33. package/assets/esri/core/workers/chunks/{ff62b813fff4a015a8a6.js → a4239e301728d594afa5.js} +1 -1
  34. package/assets/esri/core/workers/chunks/aca3ccb9599bcc444617.js +1 -0
  35. package/assets/esri/core/workers/chunks/{a3421383e48379012c9c.js → b6dd25bccb9f6e19c18e.js} +1 -1
  36. package/assets/esri/core/workers/chunks/bf4947fe446dcb477031.js +1 -0
  37. package/assets/esri/core/workers/chunks/d053c23fce77fb77cc00.js +1 -0
  38. package/assets/esri/core/workers/chunks/e31bb256921807464715.js +1 -0
  39. package/assets/esri/core/workers/chunks/{8aae03e347ab18ae6ee2.js → e3d25d027885eb1a415f.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{d88544ac332be633e3fe.js → e64e0c3240f8e577a61c.js} +1 -1
  41. package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +1 -0
  42. package/assets/esri/themes/base/widgets/_Expand.scss +6 -1
  43. package/assets/esri/themes/base/widgets/_TimeSlider.scss +97 -107
  44. package/assets/esri/themes/dark/main.css +1 -1
  45. package/assets/esri/themes/light/main.css +1 -1
  46. package/assets/esri/themes/light/view.css +1 -1
  47. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider.json +1 -1
  48. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ar.json +1 -1
  49. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_bg.json +1 -1
  50. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_bs.json +1 -1
  51. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ca.json +1 -1
  52. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_cs.json +1 -1
  53. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_da.json +1 -1
  54. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_de.json +1 -1
  55. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_el.json +1 -1
  56. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_en.json +1 -1
  57. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_es.json +1 -1
  58. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_et.json +1 -1
  59. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_fi.json +1 -1
  60. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_fr.json +1 -1
  61. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_he.json +1 -1
  62. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_hr.json +1 -1
  63. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_hu.json +1 -1
  64. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_id.json +1 -1
  65. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_it.json +1 -1
  66. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ja.json +1 -1
  67. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ko.json +1 -1
  68. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_lt.json +1 -1
  69. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_lv.json +1 -1
  70. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_nl.json +1 -1
  71. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_no.json +1 -1
  72. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pl.json +1 -1
  73. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pt-BR.json +1 -1
  74. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pt-PT.json +1 -1
  75. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ro.json +1 -1
  76. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ru.json +1 -1
  77. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sk.json +1 -1
  78. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sl.json +1 -1
  79. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sr.json +1 -1
  80. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sv.json +1 -1
  81. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_th.json +1 -1
  82. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_tr.json +1 -1
  83. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_uk.json +1 -1
  84. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_vi.json +1 -1
  85. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-CN.json +1 -1
  86. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-HK.json +1 -1
  87. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-TW.json +1 -1
  88. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ar.json +1 -0
  89. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_bg.json +1 -0
  90. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_bs.json +1 -0
  91. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ca.json +1 -0
  92. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_cs.json +1 -0
  93. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_da.json +1 -0
  94. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_de.json +1 -0
  95. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_el.json +1 -0
  96. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_es.json +1 -0
  97. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_et.json +1 -0
  98. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_fi.json +1 -0
  99. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_fr.json +1 -0
  100. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_he.json +1 -0
  101. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_hr.json +1 -0
  102. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_hu.json +1 -0
  103. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_id.json +1 -0
  104. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_it.json +1 -0
  105. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ja.json +1 -0
  106. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ko.json +1 -0
  107. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_lt.json +1 -0
  108. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_lv.json +1 -0
  109. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_nl.json +1 -0
  110. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_no.json +1 -0
  111. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pl.json +1 -0
  112. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pt-BR.json +1 -0
  113. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pt-PT.json +1 -0
  114. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ro.json +1 -0
  115. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ru.json +1 -0
  116. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sk.json +1 -0
  117. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sl.json +1 -0
  118. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sr.json +1 -0
  119. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sv.json +1 -0
  120. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_th.json +1 -0
  121. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_tr.json +1 -0
  122. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_uk.json +1 -0
  123. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_vi.json +1 -0
  124. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-CN.json +1 -0
  125. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-HK.json +1 -0
  126. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-TW.json +1 -0
  127. package/chunks/BloomComposition.glsl.js +4 -13
  128. package/chunks/Theme.js +1 -1
  129. package/chunks/Tick.js +1 -1
  130. package/geometry/support/HalfFloatArray.js +1 -1
  131. package/geometry/support/MeshTexture.js +1 -1
  132. package/geometry/support/buffer/BufferView.js +1 -1
  133. package/geometry/support/float16.js +1 -1
  134. package/interfaces.d.ts +266 -139
  135. package/layers/FeatureLayer.js +1 -1
  136. package/layers/WCSLayer.js +1 -1
  137. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  138. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  139. package/layers/mixins/ArcGISImageService.js +1 -1
  140. package/layers/mixins/FeatureLayerBase.js +1 -1
  141. package/layers/support/capabilities.js +1 -1
  142. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  143. package/package.json +2 -2
  144. package/support/revision.js +1 -1
  145. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  146. package/views/3d/interactive/Manipulator3D.js +1 -1
  147. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  148. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  149. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  151. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  152. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  153. package/views/3d/layers/DrapedSubView3D.js +1 -1
  154. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  155. package/views/3d/layers/FlowSubView3D.js +5 -0
  156. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  157. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  158. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  159. package/views/3d/layers/WMSLayerView3D.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  167. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  168. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  169. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  170. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  171. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  172. package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
  173. package/views/3d/layers/graphics/Labeler.js +1 -1
  174. package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
  175. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  176. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  177. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  178. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  179. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  180. package/views/3d/support/MemoryController.js +1 -1
  181. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  182. package/views/3d/support/engineContent/line.js +1 -1
  183. package/views/3d/terrain/OverlayRenderer.js +1 -1
  184. package/views/3d/webgl-engine/Stage.js +1 -1
  185. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
  186. package/views/3d/webgl-engine/effects/bloom/BloomPresets.glsl.js +1 -1
  187. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  188. package/views/3d/webgl-engine/lib/ContentObjectType.js +1 -1
  189. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  190. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  191. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  192. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  193. package/views/3d/webgl-engine/lib/IntersectableGeometry.js +5 -0
  194. package/views/3d/webgl-engine/lib/Material.js +1 -1
  195. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  196. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  197. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  198. package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
  199. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  200. package/views/3d/webgl-engine/lib/RendererBase.js +1 -1
  201. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  202. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  203. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  204. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  206. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  207. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  208. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  209. package/views/layers/ImageryTileLayerView.js +1 -1
  210. package/views/support/Scheduler.js +1 -1
  211. package/webscene/Slide.js +1 -1
  212. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  213. package/widgets/Features/FeaturesViewModel.js +1 -1
  214. package/widgets/Search/types.d.ts +10 -0
  215. package/widgets/Search/types.js +5 -0
  216. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  217. package/widgets/TimeSlider/css.js +1 -1
  218. package/widgets/TimeSlider.js +1 -1
  219. package/widgets/support/SelectionList/FeatureItem.js +5 -0
  220. package/widgets/support/SelectionList/GroupLayerItem.js +5 -0
  221. package/widgets/support/SelectionList/{SelectionListItemBase.js → ItemBase.js} +1 -1
  222. package/widgets/support/SelectionList/LayerItem.js +5 -0
  223. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  224. package/widgets/support/SelectionList/selectionListUtils.js +1 -1
  225. package/widgets/support/SelectionList.js +1 -1
  226. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  227. package/assets/esri/core/workers/chunks/0db4c0071282dd94f3b2.js +0 -1
  228. package/assets/esri/core/workers/chunks/10631680abe7607616ca.js +0 -1
  229. package/assets/esri/core/workers/chunks/277b61af8982092a4c81.js +0 -1
  230. package/assets/esri/core/workers/chunks/290aed587aa647226b46.js +0 -1
  231. package/assets/esri/core/workers/chunks/345f428dfcaa594ee617.js +0 -1
  232. package/assets/esri/core/workers/chunks/358a3a9326615d5e6d3b.js +0 -1
  233. package/assets/esri/core/workers/chunks/39fbac918ebd1b0e3a18.js +0 -1
  234. package/assets/esri/core/workers/chunks/544771f64a86b541d5bb.js +0 -1
  235. package/assets/esri/core/workers/chunks/6275114e8ed9dd31465d.js +0 -1
  236. package/assets/esri/core/workers/chunks/72b5e43741ce3a0da8f7.js +0 -1
  237. package/assets/esri/core/workers/chunks/72d7e45e7eb28f2cc0b0.js +0 -1
  238. package/assets/esri/core/workers/chunks/7e63e3d759c874077b52.js +0 -1
  239. package/assets/esri/core/workers/chunks/7f8c7e3e41e51ab4d612.js +0 -1
  240. package/assets/esri/core/workers/chunks/80a5fd4fb79e90086538.js +0 -1
  241. package/assets/esri/core/workers/chunks/80aaf31c8eec3cff2add.js +0 -1
  242. package/assets/esri/core/workers/chunks/b6361cec92003997bfe5.js +0 -1
  243. package/assets/esri/core/workers/chunks/bbbb1aa2569ebf01ad8b.js +0 -1
  244. package/assets/esri/core/workers/chunks/d59aeb46bf2fb0931a9b.js +0 -1
  245. package/assets/esri/core/workers/chunks/ee277dd58aa69281163f.js +0 -1
  246. package/assets/esri/core/workers/chunks/f718d41f665d5df25f79.js +0 -1
  247. package/assets/esri/core/workers/chunks/fa9ef9e8eae505371965.js +0 -1
  248. package/assets/esri/core/workers/chunks/fb5b852d0f72df014377.js +0 -1
  249. package/assets/esri/core/workers/chunks/fb603edd374e24f366ff.js +0 -1
  250. package/views/3d/webgl-engine/lib/MaterialCollection.js +0 -5
  251. package/widgets/support/SelectionList/SelectionListFeatureItem.js +0 -5
  252. package/widgets/support/SelectionList/SelectionListGroupLayerItem.js +0 -5
  253. package/widgets/support/SelectionList/SelectionListLayerItem.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import l from"../../../../core/Logger.js";import{disposeMaybe as r,abortMaybe as a}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as w,textRenderAlignmentFromHorizontalPlacement as D}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{MaterialCollection as I}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as T}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as S}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as R}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as P}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E}from"../../../support/Scheduler.js";import{Yield as O}from"../../../support/Yield.js";class V{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class F{constructor(e,t,s,i,l){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=l,this.calloutSymbolLayerIndex=0}}class U{constructor(e,t,s,i,l,r,a,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=l,this.elevationInfoOverride=r,this.disablePlacement=a,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let z=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c((()=>this.view.state?.camera),(()=>this.setDirty())),c((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),c((()=>this.view.focusAreas.activePolygons),(()=>this._updateFocus())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new R({view:this.view}),this._hudMaterialCollection=new I(this.view.stage),this._calloutMaterialCollection=new I(this.view.stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),Z.graphic=null,Z.renderingInfo=null,Z.layer=null}_updateFocus(){this._labelingContexts.forEach((e=>{e.graphics.forEach((t=>{if(0===t.labelLayers.length)return;const s=A(t.graphic.geometry);if(null==s)return;const i=this.view.focusAreas.containsGeometry(s);t.labelLayers.forEach((s=>{const l=s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==i));l&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())}))}))}))}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const i=new V(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,(e=>H(t.stageObject,e)))),M(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach((e=>e.remove())),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(k(t))this._dirty=!0;else if(B(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const r=e.graphics3DCore,a=r.layer,n=a.labelingInfo?.filter((e=>!!e.symbol));if(!n||0===n.length)return;let c=!1;await s(n,(async(s,a)=>{const n=s.symbol,h=_(r.getOrCreateGraphics3DSymbol(n));if(null==h)return void l.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,r.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t),e.labelClassContexts[a]=new F(s,h,b,i,p.value)}else l.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0})),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(n(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:S.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,a(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,l,r){const a=new v(s,G(s.anchor),w(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return Z.graphic=t,Z.layer=i,Z.renderingInfo=null,l.createLabel(Z,a,this._hudMaterialCollection,this._textTextureAtlas,(()=>r.placement?.elevationOffset??null))}_createLineCalloutGraphic(e,t,s,i,l){Z.graphic=e,Z.layer=l;const r=i.screenOffset[0];return Z.renderingInfo=new C(null,t,i.translation,i.centerOffset,r,i.centerOffsetUnits,i.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(Z)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(B(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let l=!1;const r=t.graphic,a=s.layer,o=W(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=N(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,u,b.labelClass),f=this._createTextSymbolGraphic(c,r,h,a,d,y);if(null==f)return!1;f._labelClass=b.labelClass,f._labelIndex=n,t.addLabelGraphic(f,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),l=!0;const C=b.graphics3DCalloutSymbolLayer;if(C&&h.hasLabelVerticalOffset){C.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(r,u,C,h,a);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return l&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(B(s))return;const i=e.graphics3DGraphic.graphic;for(let r=0;r<s.length;r++){const a=s[r];if(e.textRenderers[r]=null,e.textLabelPlacements[r]=null,null==a?.textRenderParameters)continue;const o=a.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(l){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=a.labelClass,d=t.disablePlacement,y=new L(h,b,p,d).placement;if(null==y)continue;const g=G(y.anchor),m=D(g);e.textRenderers[r]=new T(n,m,a.textRenderParameters,R.maxSize),e.textLabelPlacements[r]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new V(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const l of i.graphics3DGraphic.labelLayers){if(null==l._labelClass)continue;if(!e.labelClassContexts[l._labelIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(l,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach((e=>i.set(e.graphic.uid,e)));const l=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,l),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,l=s?.elevationInfoOverride||null,r=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const a=e.layer,o=new U(this.view.stage,a,e,t,i,l,r,W(a));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>W(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>k(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(k(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function M(e,t){e.geometries[0].setAttributeData(P.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],P.SIZE)}function H(e,t){e.geometries[0].setAttributeData(P.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],P.UVI,!0)}function k(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function B(e){return!e||0===e.length}function N(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([h({constructOnly:!0})],z.prototype,"view",void 0),e([h({constructOnly:!0})],z.prototype,"deconflictor",void 0),e([h()],z.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],z.prototype,"updating",null),z=e([b("esri.views.3d.layers.graphics.Labeler")],z);const Z=new x(null,null,null);export{z as Labeler,W as areLabelsVisible};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as l}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as x,LineCalloutCreationContext as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as D,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{TextRenderer as I}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as S}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as R}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,i,r){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=r,this.calloutSymbolLayerIndex=0}}class F{constructor(e,t,s,i,r,a,l,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=r,this.elevationInfoOverride=a,this.disablePlacement=l,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let U=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c((()=>this.view.state?.camera),(()=>this.setDirty())),c((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),c((()=>this.view.focusAreas.activePolygons),(()=>this._updateFocus())),this.view.resourceController.scheduler.registerTask(j.LABELER,this)]),this._textTextureAtlas=new S({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),W.graphic=null,W.renderingInfo=null,W.layer=null}_updateFocus(){this._labelingContexts.forEach((e=>{e.graphics.forEach((t=>{if(0===t.labelLayers.length)return;const s=A(t.graphic.geometry);if(null==s)return;const i=this.view.focusAreas.containsGeometry(s);t.labelLayers.forEach((s=>{const r=s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==i));r&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())}))}))}))}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,(e=>H(t.stageObject,e)))),z(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach((e=>e.remove())),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),E}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(M(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const a=e.graphics3DCore,l=a.layer,n=l.labelingInfo?.filter((e=>!!e.symbol));if(!n||0===n.length)return;let c=!1;await s(n,(async(s,l)=>{const n=s.symbol,h=_(a.getOrCreateGraphics3DSymbol(n));if(null==h)return void r.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,a.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t),e.labelClassContexts[l]=new V(s,h,b,i,p.value)}else r.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0})),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(n(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,l(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,r,a){const l=new v(s,G(s.anchor),D(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return W.graphic=t,W.layer=i,W.renderingInfo=null,r.createLabel(W,l,this._hudMaterials,this._textTextureAtlas,(()=>a.placement?.elevationOffset??null))}_createLineCalloutGraphic(e,t,s,i,r){W.graphic=e,W.layer=r;const a=i.screenOffset[0];return W.renderingInfo=new x(null,t,i.translation,i.centerOffset,a,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(W,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(k(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let r=!1;const a=t.graphic,l=s.layer,o=N(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=B(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,u,b.labelClass),f=this._createTextSymbolGraphic(c,a,h,l,d,y);if(null==f)return!1;f._labelClass=b.labelClass,f._labelIndex=n,t.addLabelGraphic(f,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),r=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,x,h,l);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return r&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const i=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const l=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==l?.textRenderParameters)continue;const o=l.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(r){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=l.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=l.labelClass,d=t.disablePlacement,y=new L(h,b,p,d).placement;if(null==y)continue;const g=G(y.anchor),m=w(g);e.textRenderers[a]=new I(n,m,l.textRenderParameters,S.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const r of i.graphics3DGraphic.labelLayers){if(null==r._labelClass)continue;if(!e.labelClassContexts[r._labelIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(r,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach((e=>i.set(e.graphic.uid,e)));const r=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,r),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=N(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,r=s?.elevationInfoOverride||null,a=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const l=e.layer,o=new F(this.view.stage,l,e,t,i,r,a,N(l));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>N(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>M(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(M(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function z(e,t){e.geometries[0].setAttributeData(R.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],R.SIZE)}function H(e,t){e.geometries[0].setAttributeData(R.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],R.UVI,!0)}function M(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return"label-3d"===e.symbol?.type?e.symbol:null}function N(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([h({constructOnly:!0})],U.prototype,"view",void 0),e([h({constructOnly:!0})],U.prototype,"deconflictor",void 0),e([h()],U.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],U.prototype,"updating",null),U=e([b("esri.views.3d.layers.graphics.Labeler")],U);const W=new C(null,null,null);export{U as Labeler,N as areLabelsVisible};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{DefaultMaterial as a}from"../../webgl-engine/materials/DefaultMaterial.js";class r{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(r,t,e){r.enableFastTransformUpdates((r=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(r))return r;const a=t.byMaterial(r);return this._fastTransformOriginalMaterials.set(r,a),t.delete(r),r}const s=new a(r.parameters,e);return e.stage.add(s),this._fastTransformClonedMaterials.set(s,r),s}),e.localOriginFactory)}disable(a,r,t){const e=new Set,s=new Set;a.disableFastTransformUpdates((a=>{if(!this._fastTransformClonedMaterials.has(a)){const t=a,i=this._fastTransformOriginalMaterials.get(t);return r.has(i.uid)?(e.add(t),r.byUid(i.uid).material):(s.add(t),i.material)}const i=a,n=this._fastTransformClonedMaterials.get(i);return this._fastTransformClonedMaterials.delete(i),t.stage.remove(i),n}));for(const i of e)this._fastTransformOriginalMaterials.delete(i),t.stage.remove(i);for(const i of s){const a=this._fastTransformOriginalMaterials.get(i);this._fastTransformOriginalMaterials.delete(i),r.set(a.uid,a)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(a,r,t){this._graphicReferenceCount--,this.disable(a,r,t)}forEachMaterialInfo(a){this._fastTransformOriginalMaterials.forEach(a)}forEachClonedMaterial(a){this._fastTransformClonedMaterials.forEach(a)}destroy(a){a.removeMany(Array.from(this._fastTransformClonedMaterials.keys())),a.removeMany(Array.from(this._fastTransformOriginalMaterials.values(),(({material:a})=>a))),this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}}class t{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),(a=>a.material))}byUid(a){return this._byUid.get(a)}byMaterial(a){return this._byMaterial.get(a)}set(a,r){this._byUid.set(a,r),this._byMaterial.set(r.material,r)}delete(a){const r=this._byMaterial.get(a)?.uid;r&&(this._byUid.delete(r),this._byMaterial.delete(a))}has(a){return this._byUid.has(a)}forEachMaterialInfo(a){this._byUid.forEach(a)}clear(){this._byUid.clear(),this._byMaterial.clear()}}export{t as MaterialInfoCache,r as MeshFastUpdateProcessor};
5
+ import{DefaultMaterial as a}from"../../webgl-engine/materials/DefaultMaterial.js";class t{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(t,e,r){t.enableFastTransformUpdates((t=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(t))return t;const a=e.byMaterial(t);return this._fastTransformOriginalMaterials.set(t,a),e.delete(t),t}const s=new a(t.parameters,r);return this._fastTransformClonedMaterials.set(s,t),s}),r.localOriginFactory)}disable(a,t){const e=new Set,r=new Set;a.disableFastTransformUpdates((a=>{if(!this._fastTransformClonedMaterials.has(a)){const s=a,i=this._fastTransformOriginalMaterials.get(s);return t.has(i.uid)?(e.add(s),t.byUid(i.uid).material):(r.add(s),i.material)}const s=a,i=this._fastTransformClonedMaterials.get(s);return this._fastTransformClonedMaterials.delete(s),i}));for(const s of e)this._fastTransformOriginalMaterials.delete(s);for(const s of r){const a=this._fastTransformOriginalMaterials.get(s);this._fastTransformOriginalMaterials.delete(s),t.set(a.uid,a)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(a,t){this._graphicReferenceCount--,this.disable(a,t)}forEachMaterialInfo(a){this._fastTransformOriginalMaterials.forEach(a)}forEachClonedMaterial(a){this._fastTransformClonedMaterials.forEach(a)}destroy(){this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}}class e{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),(a=>a.material))}byUid(a){return this._byUid.get(a)}byMaterial(a){return this._byMaterial.get(a)}set(a,t){this._byUid.set(a,t),this._byMaterial.set(t.material,t)}delete(a){const t=this._byMaterial.get(a)?.uid;t&&(this._byUid.delete(t),this._byMaterial.delete(a))}has(a){return this._byUid.has(a)}forEachMaterialInfo(a){this._byUid.forEach(a)}clear(){this._byUid.clear(),this._byMaterial.clear()}}export{e as MaterialInfoCache,t as MeshFastUpdateProcessor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{colorGamma as e}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as o,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as u,d as c,E as m,l as f,n as d,m as p}from"../../../../chunks/vec32.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as x,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec4f as h,BufferViewVec4u8 as y,BufferViewVec4u16 as w,BufferViewVec3f as v,BufferViewVec3u8 as R,BufferViewVec3u16 as j}from"../../../../geometry/support/buffer/BufferView.js";import{t as B,b as S,n as M,f as A}from"../../../../chunks/vec3.js";import{t as F,b as E}from"../../../../chunks/vec4.js";import{a as C}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as I}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as L}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as O}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as k}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as P}from"./ProcessedObjectResource.js";import{load as U,processLoadResult as N}from"./wosrLoader.js";import{NormalType as V}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as D}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _,DepthTestFunction as q,CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{Texture as W}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{esriSymbologyMRRFactors as z,advancedMRRFactors as K,useSchematicPBR as J,schematicMRRFactors as X}from"../../webgl-engine/materials/pbrUtils.js";async function Y(e,t){const o=Z(r(e));if("wosr"===o.fileType){const e=await(t.cache?t.cache.loadWOSR(o.url,t):U(o.url,t)),{engineResources:r,referenceBoundingBox:s}=N(e,t);return{lods:r,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(t.cache)s=await t.cache.loadGLTF(o.url,t,!!t.usePBR);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new I(t.streamDataRequester),o.url,t,t.usePBR)}const i=s.model.meta?.ESRI_proxyEllipsoid,n=s.meta.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.meta.ESRI_webstyle;n&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,ie(s,i));const l=!!t.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:z}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:K},u={...t.materialParameters,treeRendering:n},{engineResources:c,referenceBoundingBox:m}=ee(s,a,u,t,o.specifiedLodIndex,n);return{lods:c,referenceBoundingBox:m,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function Z(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function ee(e,r,t,o,s,i){const n=e.model,l=new Array,a=new Map,u=new Map,c=n.lods.length,m=x();return n.lods.forEach(((e,f)=>{const d=!0===o.skipHighLods&&(c>1&&0===f||c>3&&1===f)||!1===o.skipHighLods&&null!=s&&f!==s;if(d&&0!==f)return;const p=new P(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const s=d?new $({},o):re(n,e,p,r,t,a,u,o,i),{geometry:l,vertexCount:c}=te(e,s??new $({},o)),g=l.boundingInfo;null!=g&&0===f&&(b(m,g.bbMin),b(m,g.bbMax)),null!=s&&(p.stageResources.geometries.push(l),p.numberOfVertices+=c)})),d||l.push(p)})),{engineResources:l,referenceBoundingBox:m}}function re(r,t,o,s,i,n,l,u,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),b=null!=t.attributes.texCoord0,T=null!=t.attributes.normal,h=se(m.alphaMode);if(!n.has(x)){if(b){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data;l.set(e,new W(O(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!O(r)&&o,encoding:O(r)?r.encoding:void 0,compressionHandle:t&&!O(r)?u.compressionHandle:void 0,compressionCallback:u.compressionCallback}))}}},t=h!==_.Opaque&&!c;e(m.colorTexture,t,h!==_.Opaque),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture,!0),e(m.metallicRoughnessTexture,!0)}const o=1/e,f=m.color[0]**o,d=m.color[1]**o,p=m.color[2]**o,g=m.emissiveFactor[0]**o,y=m.emissiveFactor[1]**o,w=m.emissiveFactor[2]**o,v=null!=m.colorTexture&&b?l.get(m.colorTexture):null,R=J(m),j=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:a;n.set(x,new $({...s,customDepthTest:q.Lequal,textureAlphaMode:h,textureAlphaCutoff:m.alphaCutoff,diffuse:[f,d,p],ambient:[f,d,p],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?G.None:G.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:T?V.Attribute:V.ScreenDerivative,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclustion,textureId:null!=v?v.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&b?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=v&&!!v.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&b?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&b?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&b?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[g,y,w],mrrFactors:R?X:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:R,colorTextureTransformMatrix:k(m.colorTextureTransform),normalTextureTransformMatrix:k(m.normalTextureTransform),scale:[j[0],j[1]],occlusionTextureTransformMatrix:k(m.occlusionTextureTransform),emissiveTextureTransformMatrix:k(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:k(m.metallicRoughnessTextureTransform),...i},u))}const y=n.get(x);if(o.stageResources.materials.push(y),b){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function te(e,r){const i=e.attributes.position.count,n=L(e.indices||i,e.primitiveType),l=T(3*i),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;B(l,a,e.transform,3,u);const c=[[Q.POSITION,new D(l,n,3,!0)]];if(null!=e.attributes.normal){const r=T(3*i),{typedBuffer:s,typedBufferStride:l}=e.attributes.normal;o(oe,e.transform),S(r,s,oe,3,l),t(oe)&&M(r,r),c.push([Q.NORMAL,new D(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=T(4*i),{typedBuffer:o,typedBufferStride:l}=e.attributes.tangent;s(oe,e.transform),F(r,o,oe,4,l),t(oe)&&M(r,r,4),c.push([Q.TANGENT,new D(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=T(2*i),{typedBuffer:t,typedBufferStride:o}=e.attributes.texCoord0;C(r,t,2,o),c.push([Q.UV0,new D(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*i);4===m.elementCount?m instanceof h?E(r,m,1,255):(m instanceof y||m instanceof w)&&E(r,m,1/255,255):(r.fill(255),m instanceof v?A(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof R||e.attributes.color instanceof j)&&A(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push([Q.COLOR,new D(r,n,4,!0)])}return{geometry:new H(r,c),vertexCount:i}}const oe=i();function se(e){switch(e){case"BLEND":return _.Blend;case"MASK":return _.Mask;case"OPAQUE":case null:case void 0:return _.Opaque}}function ie(r,t){for(let o=0;o<r.model.lods.length;++o){const s=r.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const a=i.attributes.position,x=a.count,b=g(),T=g(),y=g(),w=new Float32Array(4*x),R=new Float32Array(3*x),j=n(l(),i.transform);let B=0,S=0;for(let n=0;n<x;n++){a.getVec(n,T),s.getVec(n,b),u(T,T,i.transform),c(y,T,t.center),m(y,y,t.radius);const l=y[2],g=f(y),x=Math.min(.45+.55*g*g,1)**e;m(y,y,t.radius),null!==j&&u(y,y,j),d(y,y),o+1!==r.model.lods.length&&r.model.lods.length>1&&p(y,y,b,l>-1?.2:Math.min(-4*l-3.8,1)),R[B]=y[0],R[B+1]=y[1],R[B+2]=y[2],B+=3,w[S]=x,w[S+1]=x,w[S+2]=x,w[S+3]=1,S+=4}i.attributes.normal=new v(R),i.attributes.color=new h(w)}}}export{Y as fetch,Z as parseUrl};
5
+ import{colorGamma as e}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as o,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as u,d as c,E as m,l as f,n as d,m as p}from"../../../../chunks/vec32.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as x,expandWithVec3 as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec4f as h,BufferViewVec4u8 as y,BufferViewVec4u16 as w,BufferViewVec3f as v,BufferViewVec3u8 as R,BufferViewVec3u16 as j}from"../../../../geometry/support/buffer/BufferView.js";import{t as B,b as S,n as M,f as A}from"../../../../chunks/vec3.js";import{t as F,b as E}from"../../../../chunks/vec4.js";import{a as C}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as I}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as L}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as O}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as k}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as P}from"./ProcessedObjectResource.js";import{load as U,processLoadResult as N}from"./wosrLoader.js";import{NormalType as V}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as D}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _,DepthTestFunction as q,CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{Texture as W}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{esriSymbologyMRRFactors as z,advancedMRRFactors as K,useSchematicPBR as J,schematicMRRFactors as X}from"../../webgl-engine/materials/pbrUtils.js";async function Y(e,t){const o=Z(r(e));if("wosr"===o.fileType){const e=await(t.cache?t.cache.loadWOSR(o.url,t):U(o.url,t)),{engineResources:r,referenceBoundingBox:s}=N(e,t);return{lods:r,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(t.cache)s=await t.cache.loadGLTF(o.url,t,!!t.usePBR);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new I(t.streamDataRequester),o.url,t,t.usePBR)}const i=s.model.meta?.ESRI_proxyEllipsoid,n=s.meta.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.meta.ESRI_webstyle;n&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,ie(s,i));const l=!!t.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:z}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:K},u={...t.materialParameters,treeRendering:n},{engineResources:c,referenceBoundingBox:m}=ee(s,a,u,t,o.specifiedLodIndex,n);return{lods:c,referenceBoundingBox:m,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function Z(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function ee(e,r,t,o,s,i){const n=e.model,l=new Array,a=new Map,u=new Map,c=n.lods.length,m=x();return n.lods.forEach(((e,f)=>{const d=!0===o.skipHighLods&&(c>1&&0===f||c>3&&1===f)||!1===o.skipHighLods&&null!=s&&f!==s;if(d&&0!==f)return;const p=new P(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const s=d?new $({},o):re(n,e,p,r,t,a,u,o,i),{geometry:l,vertexCount:c}=te(e,s??new $({},o)),g=l.boundingInfo;null!=g&&0===f&&(b(m,g.bbMin),b(m,g.bbMax)),null!=s&&(p.stageResources.geometries.push(l),p.numberOfVertices+=c)})),d||l.push(p)})),{engineResources:l,referenceBoundingBox:m}}function re(r,t,o,s,i,n,l,u,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),b=null!=t.attributes.texCoord0,T=null!=t.attributes.normal,h=se(m.alphaMode);if(!n.has(x)){if(b){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!O(r);l.set(e,new W(O(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!O(r)&&o,encoding:O(r)?r.encoding:void 0,compressionHandle:i?u.compressionHandle:void 0,compressionCallback:i?u.compressionCallback:void 0}))}}},t=h!==_.Opaque&&!c;e(m.colorTexture,t,h!==_.Opaque),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=1/e,f=m.color[0]**o,d=m.color[1]**o,p=m.color[2]**o,g=m.emissiveFactor[0]**o,y=m.emissiveFactor[1]**o,w=m.emissiveFactor[2]**o,v=null!=m.colorTexture&&b?l.get(m.colorTexture):null,R=J(m),j=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:a;n.set(x,new $({...s,customDepthTest:q.Lequal,textureAlphaMode:h,textureAlphaCutoff:m.alphaCutoff,diffuse:[f,d,p],ambient:[f,d,p],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?G.None:G.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:T?V.Attribute:V.ScreenDerivative,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclustion,textureId:null!=v?v.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&b?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=v&&!!v.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&b?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&b?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&b?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[g,y,w],mrrFactors:R?X:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:R,colorTextureTransformMatrix:k(m.colorTextureTransform),normalTextureTransformMatrix:k(m.normalTextureTransform),scale:[j[0],j[1]],occlusionTextureTransformMatrix:k(m.occlusionTextureTransform),emissiveTextureTransformMatrix:k(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:k(m.metallicRoughnessTextureTransform),...i},u))}const y=n.get(x);if(o.stageResources.materials.push(y),b){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function te(e,r){const i=e.attributes.position.count,n=L(e.indices||i,e.primitiveType),l=T(3*i),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;B(l,a,e.transform,3,u);const c=[[Q.POSITION,new D(l,n,3,!0)]];if(null!=e.attributes.normal){const r=T(3*i),{typedBuffer:s,typedBufferStride:l}=e.attributes.normal;o(oe,e.transform),S(r,s,oe,3,l),t(oe)&&M(r,r),c.push([Q.NORMAL,new D(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=T(4*i),{typedBuffer:o,typedBufferStride:l}=e.attributes.tangent;s(oe,e.transform),F(r,o,oe,4,l),t(oe)&&M(r,r,4),c.push([Q.TANGENT,new D(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=T(2*i),{typedBuffer:t,typedBufferStride:o}=e.attributes.texCoord0;C(r,t,2,o),c.push([Q.UV0,new D(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*i);4===m.elementCount?m instanceof h?E(r,m,1,255):(m instanceof y||m instanceof w)&&E(r,m,1/255,255):(r.fill(255),m instanceof v?A(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof R||e.attributes.color instanceof j)&&A(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push([Q.COLOR,new D(r,n,4,!0)])}return{geometry:new H(r,c),vertexCount:i}}const oe=i();function se(e){switch(e){case"BLEND":return _.Blend;case"MASK":return _.Mask;case"OPAQUE":case null:case void 0:return _.Opaque}}function ie(r,t){for(let o=0;o<r.model.lods.length;++o){const s=r.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const a=i.attributes.position,x=a.count,b=g(),T=g(),y=g(),w=new Float32Array(4*x),R=new Float32Array(3*x),j=n(l(),i.transform);let B=0,S=0;for(let n=0;n<x;n++){a.getVec(n,T),s.getVec(n,b),u(T,T,i.transform),c(y,T,t.center),m(y,y,t.radius);const l=y[2],g=f(y),x=Math.min(.45+.55*g*g,1)**e;m(y,y,t.radius),null!==j&&u(y,y,j),d(y,y),o+1!==r.model.lods.length&&r.model.lods.length>1&&p(y,y,b,l>-1?.2:Math.min(-4*l-3.8,1)),R[B]=y[0],R[B+1]=y[1],R[B+2]=y[2],B+=3,w[S]=x,w[S+1]=x,w[S+2]=x,w[S+3]=1,S+=4}i.attributes.normal=new v(R),i.attributes.color=new h(w)}}}export{Y as fetch,Z as parseUrl};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";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 i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as u}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as c}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerViewUid=e.layerViewUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerViewUid:c}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerViewUid:c,boundingVolumeWorldSpace:new u,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===c.OCCLUDER_MATERIAL||i.slot===c.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e,t){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,a)}updateRenderGeometryBuffer(e,t,r,i){const{data:s,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;this._vaoCache.deleteVao(o.vao);const a=this._vaoCache.newVao(s.byteLength);a.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength),o.localOrigin=i,o.numElements=n,o.buffer=t,o.items=r,o.vao=a,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(f(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function f(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";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 i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as u}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as c}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerViewUid=e.layerViewUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerViewUid:c}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerViewUid:c,boundingVolumeWorldSpace:new u,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===c.OCCLUDER_MATERIAL||i.slot===c.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,i){this.removeRenderGeometryBuffer(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,a)}updateRenderGeometryBuffer(e,t,r,i){const{data:s,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;this._vaoCache.deleteVao(o.vao);const a=this._vaoCache.newVao(s.byteLength);a.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength),o.localOrigin=i,o.numElements=n,o.buffer=t,o.items=r,o.vao=a,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(f(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function f(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerViewUid=e.layerViewUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OLIDCOLOR);const o=c((e=>s(e)),e),i=this.view.stage,a=o.getMaterials();i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view.stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer;if(null==n)return;const{featureIds:t,localTransforms:o,globalTransforms:i,visibility:a}=r,d=new Array,l=n.instanceData,c=t.length,u=this._instanceIndexToFeatureId;for(let h=0;h<c;++h){const e=t[h],r=l.addInstance(),s=l.view,n=16*h;s.localTransform.copyFromTypedBuffer(r,o,n),s.globalTransform.copyFromTypedBuffer(r,i,n),l.updateModelTransform(r),l.setVisible(r,Boolean(a[h])),d.push(r),u.set(r,e)}this._instanceGroupToIndices.set(e,d),this._numFeatures+=c}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}updateVisibility(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData;for(let i=0;i<t;++i)o.setVisible(s[i],Boolean(r[i]))}updateGlobalTransforms(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(16*t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData,i=o.view;for(let a=0;a<t;++a){const e=s[a],n=16*a;i.globalTransform.copyFromTypedBuffer(e,r,n),o.updateModelTransform(e)}}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view.stage,n={layerViewUid:this.layerViewUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerViewUid=e.layerViewUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OLIDCOLOR);const o=c((e=>s(e)),e),i=this.view.stage,a=o.getMaterials(),d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view.stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer;if(null==n)return;const{featureIds:t,localTransforms:o,globalTransforms:i,visibility:a}=r,d=new Array,l=n.instanceData,c=t.length,u=this._instanceIndexToFeatureId;for(let h=0;h<c;++h){const e=t[h],r=l.addInstance(),s=l.view,n=16*h;s.localTransform.copyFromTypedBuffer(r,o,n),s.globalTransform.copyFromTypedBuffer(r,i,n),l.updateModelTransform(r),l.setVisible(r,Boolean(a[h])),d.push(r),u.set(r,e)}this._instanceGroupToIndices.set(e,d),this._numFeatures+=c}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}updateVisibility(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData;for(let i=0;i<t;++i)o.setVisible(s[i],Boolean(r[i]))}updateGlobalTransforms(e,r){const s=this._instanceGroupToIndices.get(e);if(null==s)return;const n=this._lodRendererResources;if(null==n)return;const t=s.length;if(16*t!==r.length)throw new Error("Unexpected mismatch instance count and visibility flag buffer length.");const o=n.lodRenderer.instanceData,i=o.view;for(let a=0;a<t;++a){const e=s[a],n=16*a;i.globalTransform.copyFromTypedBuffer(e,r,n),o.updateModelTransform(e)}}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view.stage,n={layerViewUid:this.layerViewUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{e as t}from"../../../../chunks/earcut.js";import e from"../../../../geometry/Extent.js";import r from"../../../../geometry/Polygon.js";import{Axis as i}from"../../../../geometry/support/Axis.js";import{getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as n}from"../../../../geometry/support/polygonUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as s}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as c}from"../../webgl-engine/lib/VertexAttribute.js";function p(e,r,o){const a=(r.length>0?r[0]:e.length/3)-1,s=n(e,a,o);if(s!==i.Z){e=e.slice();for(let t=0;t<e.length;t+=3)e[t+s]=e[t+2]}return t(e,r,3)}function l(t){const e=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)]],r=o(t.indices.length);return null!=t.attributeData.colorFeature?e.push([c.COLORFEATUREATTRIBUTE,new a([t.attributeData.colorFeature],r,1,!0)]):t.attributeData.color&&e.push([c.COLOR,new a(t.attributeData.color,r,4,!0)]),t.attributeData.uvMapSpace&&e.push([c.UVMAPSPACE,new a(t.attributeData.uvMapSpace,t.indices,4,!0)]),t.attributeData.boundingRect&&e.push([c.BOUNDINGRECT,new a(t.attributeData.boundingRect,t.indices,9,!0)]),new u(t.material,e,t.mapPositions,s.Mesh,t.attributeData.objectAndLayerIdColor)}function m(t,e=null){const r=[[c.POSITION,new a(t.attributeData.position,t.indices,3,!0)],[c.UV0,new a(t.attributeData.uv0,t.indices,2,!0)]];return new u(t.material,r,t.mapPositions,s.Mesh,e)}function b(t){switch(t.type){case"extent":if(t instanceof e)return r.fromExtent(t);break;case"polygon":return t}return null}class g{constructor(t,e,r){this.renderData=t,this.layerViewUid=e,this.graphicUid=r,this.outGeometries=new Array}}export{g as PolygonCreationDataBase,l as createColorGeometry,p as createIndices3D,m as createWaterGeometry,b as geometryAsPolygon};
5
+ import{e as t}from"../../../../chunks/earcut.js";import e from"../../../../geometry/Extent.js";import r from"../../../../geometry/Polygon.js";import{Axis as i}from"../../../../geometry/support/Axis.js";import{getZeroIndexArray as o}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as n}from"../../../../geometry/support/polygonUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{Geometry as s}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as u}from"../../webgl-engine/lib/VertexAttribute.js";import{GeometryType as c}from"../../webgl-engine/lib/IntersectableGeometry.js";function l(e,r,o){const a=(r.length>0?r[0]:e.length/3)-1,s=n(e,a,o);if(s!==i.Z){e=e.slice();for(let t=0;t<e.length;t+=3)e[t+s]=e[t+2]}return t(e,r,3)}function m(t){const e=[[u.POSITION,new a(t.attributeData.position,t.indices,3,!0)]],r=o(t.indices.length);return null!=t.attributeData.colorFeature?e.push([u.COLORFEATUREATTRIBUTE,new a([t.attributeData.colorFeature],r,1,!0)]):t.attributeData.color&&e.push([u.COLOR,new a(t.attributeData.color,r,4,!0)]),t.attributeData.uvMapSpace&&e.push([u.UVMAPSPACE,new a(t.attributeData.uvMapSpace,t.indices,4,!0)]),t.attributeData.boundingRect&&e.push([u.BOUNDINGRECT,new a(t.attributeData.boundingRect,t.indices,9,!0)]),new s(t.material,e,t.mapPositions,c.Mesh,t.attributeData.objectAndLayerIdColor)}function p(t,e=null){const r=[[u.POSITION,new a(t.attributeData.position,t.indices,3,!0)],[u.UV0,new a(t.attributeData.uv0,t.indices,2,!0)]];return new s(t.material,r,t.mapPositions,c.Mesh,e)}function b(t){switch(t.type){case"extent":if(t instanceof e)return r.fromExtent(t);break;case"polygon":return t}return null}class g{constructor(t,e,r){this.renderData=t,this.layerViewUid=e,this.graphicUid=r,this.outGeometries=new Array}}export{g as PolygonCreationDataBase,m as createColorGeometry,l as createIndices3D,p as createWaterGeometry,b as geometryAsPolygon};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import n from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as S}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as j}from"../interfaces.js";import{DisplayFeatureLimit as T}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as V}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as G}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as I}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as A}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as N}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as O}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as U,DirtyState as H}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as E}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as D}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as C}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as B,isScaleRangeActive as W}from"../../../support/layerViewUtils.js";import{PixelType as Z,PixelFormat as $}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as q,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const Y=112;let k=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=E.ASYNC,this.dataExtent=null,this.drapeSourceType=j.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=Z.HALF_FLOAT,this._pixelFormat=$.RGBA,this._updatingHandles=new y}initialize(){let e;try{e=q(this._renderView.renderingContext,i.getLogger(this))}catch(h){this.addResolvingPromise(Promise.reject(h)),e=z}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new w({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==Z.FLOAT,u=this.view.basemapTerrain.overlayManager,m={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o,rendererContext:u.renderer,drapeSource:this};this._drapeSourceRenderer=new N(m),u.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new C({usesHalfFloats:n}),this._materialWithField=new C({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new G({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),l),this._updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),l),this._updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this._updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),p),this._updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),l),this.addHandles([d((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),d((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),r((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new T(r*6,r)}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!B(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===$.RED?1:4,r=this._dataType===Z.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(null==e)return 0;const t=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new V(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&S(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return W(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce(((e,{visible:t})=>e+(t?1:0)),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return x}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>R(e,r)))),this._featureStore.addMany(e.added.map((e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new b(F(new v,a),t,i?F(new v,i):null,R(e,r));return s.displayId=e.uid,s})));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map((({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})).filter(t),o=i.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));s.length>0&&this._drapeSourceRenderer.removeGeometries(s,U.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,U.ADD),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=I;const a=g(1),s=[[D.POSITION,new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push([D.FEATUREATTRIBUTE,new M([o?e.attributes[t]??0:0],a,1)]);const n=new L(new O(r,s,null,A.Point),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>Y&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${Y} pt for HeatmapRenderer.`),Math.min(e,Y)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}get test(){}};e([m()],k.prototype,"type",void 0),e([m({constructOnly:!0})],k.prototype,"owner",void 0),e([m()],k.prototype,"layer",null),e([m()],k.prototype,"featureStore",null),e([m()],k.prototype,"updating",null),e([m()],k.prototype,"updatingRemaining",null),e([m()],k.prototype,"suspendInfo",null),e([m()],k.prototype,"legendEnabled",null),e([m()],k.prototype,"filterVisibility",null),e([m()],k.prototype,"displayFeatureLimit",null),e([m()],k.prototype,"preferredUpdatePolicy",void 0),e([m()],k.prototype,"hasZ",null),e([m()],k.prototype,"hasM",null),e([m()],k.prototype,"dataExtent",void 0),e([m()],k.prototype,"view",null),e([m()],k.prototype,"fullOpacity",null),e([m()],k.prototype,"updatePolicy",null),e([m()],k.prototype,"drapeSourceType",void 0),e([m()],k.prototype,"scaleVisibilitySuspended",null),e([m()],k.prototype,"renderer",null),e([m()],k.prototype,"_featureStore",void 0),e([m()],k.prototype,"_filterVisibility",void 0),e([m()],k.prototype,"_overlayRenderer",null),e([m()],k.prototype,"_overlaySpatialReference",null),e([m()],k.prototype,"_rendererParameters",null),e([m()],k.prototype,"_materialParameters",null),e([m()],k.prototype,"_densityParameters",null),e([m()],k.prototype,"_radiusParameter",null),e([m()],k.prototype,"_resolutionForScaleParameter",null),e([m()],k.prototype,"_colorRampParameter",null),e([m()],k.prototype,"_pixelRatioParameter",null),e([m()],k.prototype,"_densityMapPixelRatio",null),e([m()],k.prototype,"_renderGeometries",void 0),e([m()],k.prototype,"_material",void 0),e([m()],k.prototype,"_materialWithField",void 0),e([m()],k.prototype,"_renderView",null),e([m()],k.prototype,"_featuresArePoints",null),e([m()],k.prototype,"_loadedPointGraphics",null),e([m()],k.prototype,"_heatmapRenderer",null),e([m()],k.prototype,"_heatmapRendererFieldName",null),e([m()],k.prototype,"_heatmapRendererField",null),e([m()],k.prototype,"_heatmapRendererFieldIsNumeric",null),e([m()],k.prototype,"_fieldTotal",void 0),e([m()],k.prototype,"_drapeSourceRenderer",void 0),e([m()],k.prototype,"_isScaleRangeActive",null),k=e([h("esri.views.3d.layers.support.HeatmapFeatureProcessor")],k);export{k as HeatmapFeatureProcessor,Y as maxRadiusPt};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import n from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as S}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as j}from"../interfaces.js";import{DisplayFeatureLimit as T}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as V}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as G}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as I}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as A}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as U,DirtyState as H}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as L}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as E}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as D}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as C,isScaleRangeActive as B}from"../../../support/layerViewUtils.js";import{PixelType as W,PixelFormat as Z}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as $,fallBackHeatmapConfiguration as q}from"../../../webgl/heatmapTextureUtils.js";import{GeometryType as z}from"../../webgl-engine/lib/IntersectableGeometry.js";const Y=112;let k=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=L.ASYNC,this.dataExtent=null,this.drapeSourceType=j.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=W.HALF_FLOAT,this._pixelFormat=Z.RGBA,this._updatingHandles=new y}initialize(){let e;try{e=$(this._renderView.renderingContext,i.getLogger(this))}catch(h){this.addResolvingPromise(Promise.reject(h)),e=q}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new w({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==W.FLOAT,u=this.view.basemapTerrain.overlayManager,m={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o,rendererContext:u.renderer,drapeSource:this};this._drapeSourceRenderer=new A(m),u.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new D({usesHalfFloats:n}),this._materialWithField=new D({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new G({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),l),this._updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),l),this._updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this._updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),p),this._updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),l),this.addHandles([d((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),d((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),r((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new T(r*6,r)}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!C(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===Z.RED?1:4,r=this._dataType===W.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(null==e)return 0;const t=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new V(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&S(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return B(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce(((e,{visible:t})=>e+(t?1:0)),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return x}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>R(e,r)))),this._featureStore.addMany(e.added.map((e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new b(F(new v,a),t,i?F(new v,i):null,R(e,r));return s.displayId=e.uid,s})));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map((({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})).filter(t),o=i.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));s.length>0&&this._drapeSourceRenderer.removeGeometries(s,U.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,U.ADD),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=I;const a=g(1),s=[[E.POSITION,new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push([E.FEATUREATTRIBUTE,new M([o?e.attributes[t]??0:0],a,1)]);const n=new O(new N(r,s,null,z.Point),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>Y&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${Y} pt for HeatmapRenderer.`),Math.min(e,Y)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}get test(){}};e([m()],k.prototype,"type",void 0),e([m({constructOnly:!0})],k.prototype,"owner",void 0),e([m()],k.prototype,"layer",null),e([m()],k.prototype,"featureStore",null),e([m()],k.prototype,"updating",null),e([m()],k.prototype,"updatingRemaining",null),e([m()],k.prototype,"suspendInfo",null),e([m()],k.prototype,"legendEnabled",null),e([m()],k.prototype,"filterVisibility",null),e([m()],k.prototype,"displayFeatureLimit",null),e([m()],k.prototype,"preferredUpdatePolicy",void 0),e([m()],k.prototype,"hasZ",null),e([m()],k.prototype,"hasM",null),e([m()],k.prototype,"dataExtent",void 0),e([m()],k.prototype,"view",null),e([m()],k.prototype,"fullOpacity",null),e([m()],k.prototype,"updatePolicy",null),e([m()],k.prototype,"drapeSourceType",void 0),e([m()],k.prototype,"scaleVisibilitySuspended",null),e([m()],k.prototype,"renderer",null),e([m()],k.prototype,"_featureStore",void 0),e([m()],k.prototype,"_filterVisibility",void 0),e([m()],k.prototype,"_overlayRenderer",null),e([m()],k.prototype,"_overlaySpatialReference",null),e([m()],k.prototype,"_rendererParameters",null),e([m()],k.prototype,"_materialParameters",null),e([m()],k.prototype,"_densityParameters",null),e([m()],k.prototype,"_radiusParameter",null),e([m()],k.prototype,"_resolutionForScaleParameter",null),e([m()],k.prototype,"_colorRampParameter",null),e([m()],k.prototype,"_pixelRatioParameter",null),e([m()],k.prototype,"_densityMapPixelRatio",null),e([m()],k.prototype,"_renderGeometries",void 0),e([m()],k.prototype,"_material",void 0),e([m()],k.prototype,"_materialWithField",void 0),e([m()],k.prototype,"_renderView",null),e([m()],k.prototype,"_featuresArePoints",null),e([m()],k.prototype,"_loadedPointGraphics",null),e([m()],k.prototype,"_heatmapRenderer",null),e([m()],k.prototype,"_heatmapRendererFieldName",null),e([m()],k.prototype,"_heatmapRendererField",null),e([m()],k.prototype,"_heatmapRendererFieldIsNumeric",null),e([m()],k.prototype,"_fieldTotal",void 0),e([m()],k.prototype,"_drapeSourceRenderer",void 0),e([m()],k.prototype,"_isScaleRangeActive",null),k=e([h("esri.views.3d.layers.support.HeatmapFeatureProcessor")],k);export{k as HeatmapFeatureProcessor,Y as maxRadiusPt};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedView as d}from"./MemoryManagedView.js";function y(e){return new p({view:e})}const l=.1,u=1,n=1,m=.75,c=.6,_=1.3;let p=class extends t{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._predictedMemory=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=750,this._additionalCacheMemory=0,this.addHandles(a({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){null==e||e<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<e&&this._updateQuality(u),this._maxMemory=e)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(e){null!=e&&(this._additionalCacheMemory=e)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(e,t,i){return new r(e,this._cacheStorage,t,i)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(e=!0){if(this._predictedMemory<=0&&!this._updating)return;let t=this._layersUpdating();if(this._predictedMemory<c&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(u);else if(t){if(this._predictedMemory>1.1*n||this._usedMemory>n)if(this._stableQuality>0)this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality);else if(this._quality>l&&this._downscaleMemoryUsed<this._usedMemory){if(e&&this._compactAndUpdate())return;this._updateQuality(this._quality/_),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1}}else if(this._downscaleMemoryUsed=0,this._usedMemory>n){if(e&&this._compactAndUpdate())return;this._stableQuality=0,this._canFastRecover=!1,t=this._updateQuality(this._quality/_),this._downscaleMemoryUsed=this._predictedMemory}else if(this._stableQuality!==this._quality)if(this._usedMemory<m&&this._quality<u){this._stableQuality=this._quality;const e=.05;t=this._updateQuality(this._quality+e)}else this._quality<1&&(this._canFastRecover=!0);this._updating=t}_compactAndUpdate(){let e=this.view.stage.compact();return e=this.view.basemapTerrain.overlayManager.renderer.compact()||e,e&&(this._updateMemory(),this.update(!1)),e}_updateQuality(e){return(e=Math.min(Math.max(e,l),u))!==this._quality&&(this._quality=e,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some((e=>!!e.updating))}_updateMemory(){if(!this.view)return;this.view.stage?.renderer?.tick();const e=this.view.stage?.renderer?.usedMemory;let t=(this.view.basemapTerrain?.usedMemory??0)+(e?e.fbos+e.edges+e.plugins:0),s=0;this.view.allLayerViews&&this.view.allLayerViews.forEach((e=>{if(d(e)){const i=e.ignoresMemoryFactor?this._quality:1;t+=e.usedMemory*i,s+=e.unloadedMemory*i}}));const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&r){this._warnMemoryUsage=t;const e=e=>(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${e(a)} Current: ${e(t)} Projected: ${e(t+s)} Quality: ${r}%`)}this._usedMemory=t/a,this._predictedMemory=(t+s)/a;const o=a-t;this._cacheStorage.maxSize=Math.max(0,o+1048576*this.additionalCacheMemory)}get test(){}};e([o({constructOnly:!0})],p.prototype,"view",void 0),e([o()],p.prototype,"maxMemory",null),e([o()],p.prototype,"additionalCacheMemory",null),e([o({readOnly:!0})],p.prototype,"memoryFactor",null),e([o({readOnly:!0})],p.prototype,"updating",null),e([o({readOnly:!0})],p.prototype,"usedMemory",null),e([o({readOnly:!0})],p.prototype,"usedCacheMemory",null),e([o()],p.prototype,"_quality",void 0),e([o()],p.prototype,"_usedMemory",void 0),e([o()],p.prototype,"_updating",void 0),e([o()],p.prototype,"_stableQuality",void 0),e([o()],p.prototype,"_maxMemory",void 0),e([o()],p.prototype,"_additionalCacheMemory",void 0),p=e([h("esri.views.3d.support.MemoryController")],p);export{l as minQuality,y as newMemoryController};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{Milliseconds as o}from"../../../core/time.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedView as y}from"./MemoryManagedView.js";import{makeBudget as l}from"../../support/Scheduler.js";function m(e){return new g({view:e})}const u=.1,n=1,c=1,_=.75,p=.6,M=1.3;let g=class extends t{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._predictedMemory=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=750,this._additionalCacheMemory=0,this.addHandles(a({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){null==e||e<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<e&&this._updateQuality(n),this._maxMemory=e)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(e){null!=e&&(this._additionalCacheMemory=e)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(e,t,i){return new r(e,this._cacheStorage,t,i)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._predictedMemory<=0&&!this._updating)return;let e=this._layersUpdating();if(this._predictedMemory<p&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(n);else if(e){if(this._predictedMemory>1.1*c||this._usedMemory>c)if(this._stableQuality>0)this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality);else if(this._quality>u&&this._downscaleMemoryUsed<this._usedMemory){if(this._compactAndUpdate())return;this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1}}else if(this._downscaleMemoryUsed=0,this._usedMemory>c){if(this._compactAndUpdate())return;this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._predictedMemory}else if(this._stableQuality!==this._quality)if(this._usedMemory<_&&this._quality<n){this._stableQuality=this._quality;const t=.05;e=this._updateQuality(this._quality+t)}else this._quality<1&&(this._canFastRecover=!0);this._updating=e}_compactAndUpdate(){const e=l(o(100)),t=this.view.stage.compact(e);return this.view.basemapTerrain.overlayManager.renderer.compact(e)||t}_updateQuality(e){return(e=Math.min(Math.max(e,u),n))!==this._quality&&(this._quality=e,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some((e=>!!e.updating))}_updateMemory(){if(!this.view)return;this.view.stage?.renderer?.tick();const e=this.view.stage?.renderer?.usedMemory;let t=(this.view.basemapTerrain?.usedMemory??0)+(e?e.fbos+e.edges+e.plugins:0),s=0;this.view.allLayerViews&&this.view.allLayerViews.forEach((e=>{if(y(e)){const i=e.ignoresMemoryFactor?this._quality:1;t+=e.usedMemory*i,s+=e.unloadedMemory*i}}));const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&r){this._warnMemoryUsage=t;const e=e=>(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${e(a)} Current: ${e(t)} Projected: ${e(t+s)} Quality: ${r}%`)}this._usedMemory=t/a,this._predictedMemory=(t+s)/a;const o=a-t;this._cacheStorage.maxSize=Math.max(0,o+1048576*this.additionalCacheMemory)}get test(){}};e([h({constructOnly:!0})],g.prototype,"view",void 0),e([h()],g.prototype,"maxMemory",null),e([h()],g.prototype,"additionalCacheMemory",null),e([h({readOnly:!0})],g.prototype,"memoryFactor",null),e([h({readOnly:!0})],g.prototype,"updating",null),e([h({readOnly:!0})],g.prototype,"usedMemory",null),e([h({readOnly:!0})],g.prototype,"usedCacheMemory",null),e([h()],g.prototype,"_quality",void 0),e([h()],g.prototype,"_usedMemory",void 0),e([h()],g.prototype,"_updating",void 0),e([h()],g.prototype,"_stableQuality",void 0),e([h()],g.prototype,"_maxMemory",void 0),e([h()],g.prototype,"_additionalCacheMemory",void 0),g=e([d("esri.views.3d.support.MemoryController")],g);export{u as minQuality,m as newMemoryController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewVec2f16 as e,BufferViewVec2f as t,BufferViewVec2f64 as i,BufferViewVec3f16 as s,BufferViewVec3f as r,BufferViewVec3f64 as n,BufferViewVec4f16 as h,BufferViewVec4f as d,BufferViewVec4f64 as u,BufferViewMat3f as f,BufferViewMat3f64 as o,BufferViewMat4f as l,BufferViewMat4f64 as p,BufferViewVec4u8 as c,BufferViewFloat16 as a,BufferViewFloat as _,BufferViewFloat64 as F,BufferViewUint8 as y,BufferViewUint16 as m,BufferViewInt8 as b,BufferViewVec2i8 as g,BufferViewVec2i16 as w,BufferViewVec2u8 as v,BufferViewVec2u16 as E,BufferViewVec4u16 as M,BufferViewUint32 as T,BufferViewVec3u8 as A,BufferViewVec3u16 as B,BufferViewVec2u32 as U,BufferViewVec3u32 as C,BufferViewVec4u32 as L,BufferViewVec3i8 as j,BufferViewVec4i8 as x,BufferViewInt16 as z,BufferViewVec3i16 as $,BufferViewVec4i16 as V,BufferViewInt32 as k,BufferViewVec2i32 as q,BufferViewVec3i32 as D,BufferViewVec4i32 as G}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as H}from"../../../../geometry/support/buffer/types.js";import{assert as I}from"../../webgl-engine/lib/Util.js";class J{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const i of e.fields.keys()){const t=e.fields.get(i);this[i]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const i=this[e];return i&&i.elementCount===t.ElementCount&&i.elementType===t.ElementType?i:null}slice(e,t){return new J(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,i=0,s=e.count){const r=this.stride;if(r%4==0){const n=new Uint32Array(e.buffer,t*r,s*r/4);new Uint32Array(this.buffer,i*r,s*r/4).set(n)}else{const n=new Uint8Array(e.buffer,t*r,s*r);new Uint8Array(this.buffer,i*r,s*r).set(n)}return this}get cachedMemory(){return this.byteLength}dispose(){}}class K{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach((e=>this._fields.set(e[0],{...e[1],constructor:R(e[1].constructor)}))))}freeze(){return this}vec2f16(t,i){return this._appendField(t,e,i),this}vec2f(e,i){return this._appendField(e,t,i),this}vec2f64(e,t){return this._appendField(e,i,t),this}vec3f16(e,t){return this._appendField(e,s,t),this}vec3f(e,t){return this._appendField(e,r,t),this}vec3f64(e,t){return this._appendField(e,n,t),this}vec4f16(e,t){return this._appendField(e,h,t),this}vec4f(e,t){return this._appendField(e,d,t),this}vec4f64(e,t){return this._appendField(e,u,t),this}mat3f(e,t){return this._appendField(e,f,t),this}mat3f64(e,t){return this._appendField(e,o,t),this}mat4f(e,t){return this._appendField(e,l,t),this}mat4f64(e,t){return this._appendField(e,p,t),this}vec4u8(e,t){return this._appendField(e,c,t),this}f16(e,t){return this._appendField(e,a,t),this}f32(e,t){return this._appendField(e,_,t),this}f64(e,t){return this._appendField(e,F,t),this}u8(e,t){return this._appendField(e,y,t),this}u16(e,t){return this._appendField(e,m,t),this}i8(e,t){return this._appendField(e,b,t),this}vec2i8(e,t){return this._appendField(e,g,t),this}vec2i16(e,t){return this._appendField(e,w,t),this}vec2u8(e,t){return this._appendField(e,v,t),this}vec2u16(e,t){return this._appendField(e,E,t),this}vec4u16(e,t){return this._appendField(e,M,t),this}u32(e,t){return this._appendField(e,T,t),this}_appendField(e,t,i){if(this._fields.has(e))return void I(!1,`${e} already added to vertex buffer layout`);const s=t.ElementCount*H(t.ElementType),r=this._stride;this._fields.set(e,{constructor:t,size:s,offset:r,optional:i}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach((i=>{const s=H(i.constructor.ElementType);e=Math.floor((e+s-1)/s)*s,i.offset=e,e+=i.size,t=Math.max(t,s)})),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new J(this,e)}createView(e){return new J(this,e)}clone(){const e=new K;return e._stride=this._stride,e._fields=new Map,this._fields.forEach(((t,i)=>e._fields.set(i,t))),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function N(){return new K}class O{constructor(e){this.fields=new Array,e.fields.forEach(((e,t)=>{const i={...e,constructor:Q(e.constructor)};this.fields.push([t,i])})),this.stride=e.stride}}const P=[_,t,r,d,f,l,F,i,n,u,o,p,y,v,A,c,m,E,B,M,T,U,C,L,b,g,j,x,z,w,$,V,k,q,D,G];function Q(e){return`${e.ElementType}_${e.ElementCount}`}function R(e){return S.get(e)}const S=new Map;P.forEach((e=>S.set(Q(e),e)));export{J as InterleavedBuffer,K as InterleavedLayout,O as PackedLayout,N as newLayout};
5
+ import{BufferViewVec2f16 as e,BufferViewVec2f as t,BufferViewVec2f64 as i,BufferViewVec3f16 as s,BufferViewVec3f as r,BufferViewVec3f64 as n,BufferViewVec4f16 as h,BufferViewVec4f as d,BufferViewVec4f64 as u,BufferViewMat3f as f,BufferViewMat3f64 as l,BufferViewMat4f as o,BufferViewMat4f64 as a,BufferViewVec4u8 as p,BufferViewFloat16 as c,BufferViewFloat as _,BufferViewFloat64 as F,BufferViewUint8 as y,BufferViewUint16 as m,BufferViewInt8 as b,BufferViewVec2i8 as v,BufferViewVec2i16 as g,BufferViewVec2u8 as w,BufferViewVec2u16 as E,BufferViewVec4u16 as M,BufferViewUint32 as T,BufferViewVec3u8 as A,BufferViewVec3u16 as B,BufferViewVec2u32 as U,BufferViewVec3u32 as C,BufferViewVec4u32 as L,BufferViewVec3i8 as j,BufferViewVec4i8 as x,BufferViewInt16 as z,BufferViewVec3i16 as $,BufferViewVec4i16 as V,BufferViewInt32 as k,BufferViewVec2i32 as q,BufferViewVec3i32 as D,BufferViewVec4i32 as G}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as H}from"../../../../geometry/support/buffer/types.js";import{assert as I}from"../../webgl-engine/lib/Util.js";class J{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const i of e.fields.keys()){const t=e.fields.get(i);this[i]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const i=this[e];return i&&i.elementCount===t.ElementCount&&i.elementType===t.ElementType?i:null}slice(e,t){return new J(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,i=0,s=e.count){const r=this.stride;if(r%4==0){const n=new Uint32Array(e.buffer,t*r,s*r/4);new Uint32Array(this.buffer,i*r,s*r/4).set(n)}else{const n=new Uint8Array(e.buffer,t*r,s*r);new Uint8Array(this.buffer,i*r,s*r).set(n)}return this}get cachedMemory(){return this.byteLength}dispose(){}}class K{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach((e=>this._fields.set(e[0],{...e[1],constructor:R(e[1].constructor)}))))}freeze(){return this}vec2f16(i,s){return this._appendField(i,e.available?e:t,s),this}vec2f(e,i){return this._appendField(e,t,i),this}vec2f64(e,t){return this._appendField(e,i,t),this}vec3f16(e,t){return this._appendField(e,s.available?s:r,t),this}vec3f(e,t){return this._appendField(e,r,t),this}vec3f64(e,t){return this._appendField(e,n,t),this}vec4f16(e,t){return this._appendField(e,h.available?h:d,t),this}vec4f(e,t){return this._appendField(e,d,t),this}vec4f64(e,t){return this._appendField(e,u,t),this}mat3f(e,t){return this._appendField(e,f,t),this}mat3f64(e,t){return this._appendField(e,l,t),this}mat4f(e,t){return this._appendField(e,o,t),this}mat4f64(e,t){return this._appendField(e,a,t),this}vec4u8(e,t){return this._appendField(e,p,t),this}f16(e,t){return this._appendField(e,c.available?c:_,t),this}f32(e,t){return this._appendField(e,_,t),this}f64(e,t){return this._appendField(e,F,t),this}u8(e,t){return this._appendField(e,y,t),this}u16(e,t){return this._appendField(e,m,t),this}i8(e,t){return this._appendField(e,b,t),this}vec2i8(e,t){return this._appendField(e,v,t),this}vec2i16(e,t){return this._appendField(e,g,t),this}vec2u8(e,t){return this._appendField(e,w,t),this}vec2u16(e,t){return this._appendField(e,E,t),this}vec4u16(e,t){return this._appendField(e,M,t),this}u32(e,t){return this._appendField(e,T,t),this}_appendField(e,t,i){this._fields.has(e)&&I(!1,`${e} already added to vertex buffer layout`);const s=t.ElementCount*H(t.ElementType),r=this._stride;this._fields.set(e,{constructor:t,size:s,offset:r,optional:i}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach((i=>{const s=H(i.constructor.ElementType);e=Math.floor((e+s-1)/s)*s,i.offset=e,e+=i.size,t=Math.max(t,s)})),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new J(this,e)}createView(e){return new J(this,e)}clone(){const e=new K;return e._stride=this._stride,e._fields=new Map,this._fields.forEach(((t,i)=>e._fields.set(i,t))),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function N(){return new K}class O{constructor(e){this.fields=new Array,e.fields.forEach(((e,t)=>{const i={...e,constructor:Q(e.constructor)};this.fields.push([t,i])})),this.stride=e.stride}}const P=[_,t,r,d,f,o,F,i,n,u,l,a,y,w,A,p,m,E,B,M,T,U,C,L,b,v,j,x,z,g,$,V,k,q,D,G];function Q(e){return`${e.ElementType}_${e.ElementCount}`}function R(e){return S.get(e)}const S=new Map;P.forEach((e=>S.set(Q(e),e)));export{J as InterleavedBuffer,K as InterleavedLayout,O as PackedLayout,N as newLayout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as u}from"../../../../geometry/support/Indices.js";import{ViewingMode as s}from"../../../ViewingMode.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as p}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";function b(t,e,r=null){const o=[],n=e.mapPositions;g(e,o);const i=o[0][1].data,a=o[0][1].indices.length,l=u(a);return h(e,o,l),j(e,o,l),T(e,o,l),D(e,o,l),w(e,o,l),y(e,o,l),E(e,o,i),new f(t,o,n,p.Line,r)}function g(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=A(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),l=n?r.slice(0,-3):r;let u=0;for(let s=0;s<i-1;s++)a[u++]=s,a[u++]=s+1;e.push([m.POSITION,new c(l,a,3,n)])}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push([m.COLOR,new c(n??o,r,4)])}function T(t,e,r){t.attributeData.normal&&e.push([m.NORMAL,new c(t.attributeData.normal,r,3)])}function D(t,e,r){null!=t.attributeData.colorFeature&&e.push([m.COLORFEATUREATTRIBUTE,new c([t.attributeData.colorFeature],r,1,!0)])}function j(t,e,r){null==t.attributeData.sizeFeature&&e.push([m.SIZE,new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r){null!=t.attributeData.sizeFeature&&e.push([m.SIZEFEATUREATTRIBUTE,new c([t.attributeData.sizeFeature],r,1,!0)])}function y(t,e,r){null!=t.attributeData.opacityFeature&&e.push([m.OPACITYFEATUREATTRIBUTE,new c([t.attributeData.opacityFeature],r,1,!0)])}function E(r,o,u){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==s.Global||!r.overlayInfo.spatialReference.isGeographic)return;const p=a(u.length),f=n(r.overlayInfo.spatialReference);for(let t=0;t<p.length;t+=3)i(u,t,p,t,f);const b=u.length/3,g=l(b+1);let h=I,T=F,D=0,j=0;t(h,p[j++],p[j++]),j++,g[0]=0;for(let n=1;n<b+1;++n)n===b&&(j=0),t(T,p[j++],p[j++]),j++,D+=e(h,T),g[n]=D,[h,T]=[T,h];o.push([m.DISTANCETOSTART,new c(g,o[0][1].indices,1,!0)])}function A(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const I=r(),F=r();function R(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach((t=>{const o=t.length,n=a(3*o);t.forEach(((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]}));const i={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(i)})),r}export{b as createGeometry,R as lineStripsToParameters};
5
+ import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as u}from"../../../../geometry/support/Indices.js";import{ViewingMode as s}from"../../../ViewingMode.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as m}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as p}from"../../webgl-engine/lib/VertexAttribute.js";import{GeometryType as f}from"../../webgl-engine/lib/IntersectableGeometry.js";function b(t,e,r=null){const o=[],n=e.mapPositions;g(e,o);const i=o[0][1].data,a=o[0][1].indices.length,l=u(a);return h(e,o,l),w(e,o,l),D(e,o,l),T(e,o,l),y(e,o,l),E(e,o,l),j(e,o,i),new m(t,o,n,f.Line,r)}function g(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=A(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),l=n?r.slice(0,-3):r;let u=0;for(let s=0;s<i-1;s++)a[u++]=s,a[u++]=s+1;e.push([p.POSITION,new c(l,a,3,n)])}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push([p.COLOR,new c(n??o,r,4)])}function D(t,e,r){t.attributeData.normal&&e.push([p.NORMAL,new c(t.attributeData.normal,r,3)])}function T(t,e,r){null!=t.attributeData.colorFeature&&e.push([p.COLORFEATUREATTRIBUTE,new c([t.attributeData.colorFeature],r,1,!0)])}function w(t,e,r){null==t.attributeData.sizeFeature&&e.push([p.SIZE,new c([t.attributeData.size??1],r,1,!0)])}function y(t,e,r){null!=t.attributeData.sizeFeature&&e.push([p.SIZEFEATUREATTRIBUTE,new c([t.attributeData.sizeFeature],r,1,!0)])}function E(t,e,r){null!=t.attributeData.opacityFeature&&e.push([p.OPACITYFEATUREATTRIBUTE,new c([t.attributeData.opacityFeature],r,1,!0)])}function j(r,o,u){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==s.Global||!r.overlayInfo.spatialReference.isGeographic)return;const m=a(u.length),f=n(r.overlayInfo.spatialReference);for(let t=0;t<m.length;t+=3)i(u,t,m,t,f);const b=u.length/3,g=l(b+1);let h=I,D=F,T=0,w=0;t(h,m[w++],m[w++]),w++,g[0]=0;for(let n=1;n<b+1;++n)n===b&&(w=0),t(D,m[w++],m[w++]),w++,T+=e(h,D),g[n]=T,[h,D]=[D,h];o.push([p.DISTANCETOSTART,new c(g,o[0][1].indices,1,!0)])}function A(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const I=r(),F=r();function R(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach((t=>{const o=t.length,n=a(3*o);t.forEach(((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]}));const i={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(i)})),r}export{b as createGeometry,R as lineStripsToParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t}from"../../../core/MapUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as o,on as a,initial as h}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as u,fromTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as m,DrapeSourceType as f,DrapedRenderGroup as y}from"../layers/interfaces.js";import{debugFlags as R}from"../support/debugFlags.js";import{OverlayIndex as T}from"./interfaces.js";import{Overlay as b}from"./Overlay.js";import{OverlayContent as w}from"./OverlayContent.js";import{OverlayRenderTargets as x}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{ShaderOutput as D}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as O}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as E,renderHighlightBuffer as P}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as j}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OITPass as I}from"../webgl-engine/lib/OITPass.js";import{OverlayRenderContext as q,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as N}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as F}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as V}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as H}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as G}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as k}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as U}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as z}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as Y,noBudget as X}from"../../support/Scheduler.js";import{FramebufferBit as K,TextureSamplingMode as J}from"../../webgl/enums.js";import{Texture as Q}from"../../webgl/Texture.js";import{TextureDescriptor as Z}from"../../webgl/TextureDescriptor.js";let $=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new i,this._passParameters=new O,this._materials=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[N.DRAPED_MATERIAL,e=>e!==D.Highlight||this.hasHighlights],[N.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,textures:i}=r.renderView;this._renderContext=new q(this._rctx,new F(t,e.state.viewingMode)),this.addHandles([n((()=>s.updating),(()=>this.events.emit("content-changed")),o),n((()=>this.spatialReference),(e=>this._localOriginFactory=new M(e)),o),a((()=>e.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0)),n((()=>E(e.state.highlights)),(()=>this._sortedDrapeSourceRenderersDirty=!0),h),n((()=>e.state.highlights),(r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap}),h),e.resourceController.scheduler.registerTask(Y.STAGE,this)]),this._materials=new A(i,this._techniques,(()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed")));const{_bindParameters:l,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,l.slot=N.DRAPED_MATERIAL,l.mainDepth=null,l.camera=d,l.oitPass=I.NONE,l.updateLighting([new U(_())],0,0,G.Immediate)}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._passParameters.texture=s(this._passParameters.texture),this.disposeOverlays()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){this._pluginContext=e,this._techniques.precompile(z)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating||e.canCompact))}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map((e=>e.drapeSource.layer)).filter((e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(){this._renderTargets?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,(e=>e.drapeTargetType===m.WithoutRasterImage))}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===f.Features)),this._hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===f.RasterImage))):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new x(this._stage.renderer.fboCache),this._overlays=[new b,new b]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets=s(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){return e===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(w.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges(this._view.state.highlightOrderMap)&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers());for(const t of this._renderers.values())t.compact(e),this.notifyChange("updating");s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this.notifyChange("rendersOccludedDraped"))}compact(){let e=!1;for(const r of this._renderers.values())e=r.compact(X)||e;return e&&this.notifyChange("updating"),e}hasHighlight(e){return t(this._renderers,(r=>r.hasHighlight(e)))}processSyncDrapeSources(){this._processDrapeSources(X,(e=>e.updatePolicy===k.SYNC))}get isEmpty(){return!R.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){const e=t(this._renderers,(({hasWater:e})=>e));return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=se,++this._techniques.precompiling;const r=this._sortedRenderers.some((({renderer:e})=>e.precompile(this._renderContext)));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==w.Occluded&&e!==w.Highlight)return!0;if(!this._overlays)return!1;const r=this._overlays[T.INNER];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find((r=>r.content===e))?.output??D.Color,++this._techniques.precompiling;const s=this._sortedRenderers.some((({renderer:e})=>e.precompile(this._renderContext)));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?C.Disabled:this.hasWater&&this.renders(w.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(w.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r&&this.parent.requestRender(j.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(t.content===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=e===D.Normal?N.DRAPED_WATER:N.DRAPED_MATERIAL,e===D.Highlight&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),t.content===w.Occluded&&(this._renderContext.renderOccludedMask=se),this._sortedRenderers.forAll((({drapeSource:e,renderer:r})=>{t.content===w.ColorNoRasterImage&&e.drapeSourceType===f.RasterImage||r.precompile(this._renderContext)})),this._renderContext.renderOccludedMask=L,r.highlightMixTexture=null}--this._techniques.precompiling}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;for(const e of this._renderTargets.targets){if(e.content===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const r=this._drawTarget(T.INNER,e),t=this._drawTarget(T.OUTER,e);(r||t)&&e.fbo.generateMipMap()}}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===D.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===D.Normal?N.DRAPED_WATER:N.DRAPED_MATERIAL,r.content===w.Occluded&&(h.renderOccludedMask=se),!this.renders(r.content))return h.renderOccludedMask=L,!1;const{resolution:d}=t,c=e===T.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==D.Highlight)o.setClearColor(0,0,0,0),o.clear(K.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==w.Occluded&&r.content!==w.Highlight){this._techniques.precompile(V,ie);const r=this._techniques.get(V,ie);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,re[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===D.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),P(o,t,{width:s,height:s},l,(()=>this._renderAllGeometry(e,r)),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=L,!0}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll((({drapeSource:i,renderer:n})=>{if(r.content===w.ColorNoRasterImage&&i.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===D.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(z);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}}))}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.bind(this._rctx,t,r)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(K.COLOR),s}get _resolution(){return this._overlays?.[T.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach(((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?y.MapLayer:y.ViewLayer),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new ee(s,t,h))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],u(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),p(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new Z(e);i.samplingMode=J.NEAREST,this._passParameters.texture=new Q(this._rctx,i,t)}get test(){}};e([d()],$.prototype,"hasHighlights",void 0),e([d()],$.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([d({constructOnly:!0})],$.prototype,"parent",void 0),e([d({readOnly:!0})],$.prototype,"_techniques",null),e([d({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([d()],$.prototype,"isEmpty",null),e([d({readOnly:!0})],$.prototype,"rendersOccludedDraped",null),$=e([c("esri.views.3d.terrain.OverlayRenderer")],$);class ee{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const re=[[1,.5,.5],[.5,.5,1]],te=-2,se=W.OccludeAndTransparent,ie=new H;ie.hasAlpha=!0;export{$ as OverlayRenderer,te as drapedZ,se as overlayRenderOccludedFlag};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t}from"../../../core/MapUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as o,on as a,initial as h}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as u,fromTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as m,DrapeSourceType as f,DrapedRenderGroup as y}from"../layers/interfaces.js";import{debugFlags as R}from"../support/debugFlags.js";import{OverlayIndex as b}from"./interfaces.js";import{Overlay as T}from"./Overlay.js";import{OverlayContent as w}from"./OverlayContent.js";import{OverlayRenderTargets as x}from"./OverlayRenderTargets.js";import D from"../webgl/RenderCamera.js";import{ShaderOutput as v}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as O}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as E,renderHighlightBuffer as P}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as j}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OITPass as I}from"../webgl-engine/lib/OITPass.js";import{RenderContext as q,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as N}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as V}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as F}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as H}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as k}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as U}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as z}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as Y,noBudget as X}from"../../support/Scheduler.js";import{FramebufferBit as K,TextureSamplingMode as J}from"../../webgl/enums.js";import{Texture as Q}from"../../webgl/Texture.js";import{TextureDescriptor as Z}from"../../webgl/TextureDescriptor.js";let $=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new i,this._passParameters=new O,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new D,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[N.DRAPED_MATERIAL,e=>e!==v.Highlight||this.hasHighlights],[N.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new q(this._rctx,new V(t,e.state.viewingMode),i),this.addHandles([n((()=>s.updating),(()=>this.events.emit("content-changed")),o),n((()=>this.spatialReference),(e=>this._localOriginFactory=new M(e)),o),a((()=>e.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0)),n((()=>E(e.state.highlights)),(()=>this._sortedDrapeSourceRenderersDirty=!0),h),n((()=>e.state.highlights),(r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap}),h),e.resourceController.scheduler.registerTask(Y.OVERLAY_RENDERER,this)]);const{_bindParameters:l,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,l.slot=N.DRAPED_MATERIAL,l.mainDepth=null,l.camera=d,l.oitPass=I.NONE,l.updateLighting([new U(_())],0,0,k.Immediate)}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._passParameters.texture=s(this._passParameters.texture),this.disposeOverlays()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new A(this._view.stage.renderView.textures,this._techniques,(()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed")));this._pluginContext={...e,materials:r},this._techniques.precompile(z)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating||e.canCompact))}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map((e=>e.drapeSource.layer)).filter((e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(){this._renderTargets?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,(e=>e.drapeTargetType===m.WithoutRasterImage))}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===f.Features)),this._hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===f.RasterImage))):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new x(this._stage.renderer.fboCache),this._overlays=[new T,new T]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets=s(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){return e===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(w.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress());for(const t of this._renderers.values())t.compact(e),this.notifyChange("updating");s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this.notifyChange("rendersOccludedDraped"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,(r=>r.hasHighlight(e)))}processSyncDrapeSources(){this._processDrapeSources(X,(e=>e.updatePolicy===G.SYNC))}get isEmpty(){return!R.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){const e=t(this._renderers,(({hasWater:e})=>e));return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=se,++this._techniques.precompiling;const r=this._sortedRenderers.some((({renderer:e})=>e.precompile(this._renderContext)));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==w.Occluded&&e!==w.Highlight)return!0;if(!this._overlays)return!1;const r=this._overlays[b.INNER];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find((r=>r.content===e))?.output??v.Color,++this._techniques.precompiling;const s=this._sortedRenderers.some((({renderer:e})=>e.precompile(this._renderContext)));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?C.Disabled:this.hasWater&&this.renders(w.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(w.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r&&this.parent.requestRender(j.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(t.content===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=e===v.Normal?N.DRAPED_WATER:N.DRAPED_MATERIAL,e===v.Highlight&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),t.content===w.Occluded&&(this._renderContext.renderOccludedMask=se),this._sortedRenderers.forAll((({drapeSource:e,renderer:r})=>{t.content===w.ColorNoRasterImage&&e.drapeSourceType===f.RasterImage||r.precompile(this._renderContext)})),this._renderContext.renderOccludedMask=L,r.highlightMixTexture=null}--this._techniques.precompiling}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;for(const e of this._renderTargets.targets){if(e.content===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const r=this._drawTarget(b.INNER,e),t=this._drawTarget(b.OUTER,e);(r||t)&&e.fbo.generateMipMap()}}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===v.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===v.Normal?N.DRAPED_WATER:N.DRAPED_MATERIAL,r.content===w.Occluded&&(h.renderOccludedMask=se),!this.renders(r.content))return h.renderOccludedMask=L,!1;const{resolution:d}=t,c=e===b.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==v.Highlight)o.setClearColor(0,0,0,0),o.clear(K.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==w.Occluded&&r.content!==w.Highlight){this._techniques.precompile(F,ie);const r=this._techniques.get(F,ie);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,re[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===v.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),P(o,t,{width:s,height:s},l,(()=>this._renderAllGeometry(e,r)),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=L,!0}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll((({drapeSource:i,renderer:n})=>{if(r.content===w.ColorNoRasterImage&&i.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===v.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(z);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}}))}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.bind(this._rctx,t,r)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(K.COLOR),s}get _resolution(){return this._overlays?.[b.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach(((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?y.MapLayer:y.ViewLayer),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new ee(s,t,h))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],u(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),p(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new Z(e);i.samplingMode=J.NEAREST,this._passParameters.texture=new Q(this._rctx,i,t)}get test(){}};e([d()],$.prototype,"hasHighlights",void 0),e([d()],$.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([d({constructOnly:!0})],$.prototype,"parent",void 0),e([d({readOnly:!0})],$.prototype,"_techniques",null),e([d({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([d()],$.prototype,"isEmpty",null),e([d({readOnly:!0})],$.prototype,"rendersOccludedDraped",null),$=e([c("esri.views.3d.terrain.OverlayRenderer")],$);class ee{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const re=[[1,.5,.5],[.5,.5,1]],te=-2,se=W.OccludeAndTransparent,ie=new H;ie.hasAlpha=!0;export{$ as OverlayRenderer,te as drapedZ,se as overlayRenderOccludedFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import r from"../../../core/PooledArray.js";import{isPromiseLike as s}from"../../../core/promiseUtils.js";import{signal as i}from"../../../core/signal.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntersectionHandler as d}from"../state/helpers/SceneIntersectionHelper.js";import{TextureCollection as a}from"../support/TextureCollection.js";import{ChangeSet as h}from"./lib/ChangeSet.js";import{UpdatePolicy as c}from"./lib/UpdatePolicy.js";import{isWebGLLayer as y}from"./lib/WebGLLayer.js";import{Model as m}from"./parts/Model.js";import{RenderView as l}from"./parts/RenderView.js";import{TaskPriority as p,noBudget as u}from"../../support/Scheduler.js";import{Yield as _}from"../../support/Yield.js";let g=class extends t{constructor(e){super(e),this._model=new m,this._canCompact=i(!1),this._layers=new r,this._asyncChangeSet=new h,this._syncChangeSet=new h,this._layerSyncSet=new Set,this.textures=new a(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(p.STAGE,this),this.addHandles(this._frameTask)}initialize(){this._renderView=new l({stage:this})}destroy(){this.textures.destroy(),this.renderView.destroy()}get viewingMode(){return this.view.state.viewingMode}get updating(){return this.running||this.renderView.updating||this._frameTask.updating||this.textures.updating}get renderView(){return this._renderView}get renderer(){return this.renderView.renderer}add(e){this._model.add(e),y(e)&&this._addLayer(e),this.renderView.requestRender()}remove(e){null!=e&&!this.destroyed&&this._model.remove(e)&&(y(e)&&this._removeLayer(e),this.renderView.requestRender())}addMany(e){null!=e&&(this._model.addMany(e),this.renderView.requestRender())}removeMany(e){null!=e&&(this._model?.removeMany(e),this.renderView.requestRender())}forEachOfType(e,t){this._model.forEachOfType(e,t)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get running(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return _}compact(){return this._canCompact.value=!1,this.renderer.compact(u)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||r.updatePolicy===c.SYNC,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.modify(i,s?u:e),this.renderView.requestRender(),e.madeProgress())})),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,u),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{e.done||this._layerSyncSet.has(r.id)||r.updatePolicy!==c.ASYNC||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))})),this._layerSyncSet.clear(),this.notifyChange("running")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forAll((t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===c.SYNC?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)}));for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,u),this.renderView.requestRender())}_commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,u),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}getObject(e){return this._model.getObject(e)}get layers(){return this._layers}_addLayer(e){this._layers.includes(e)||this._layers.push(e)}_removeLayer(e){this._commitLayer(e),null!=this._layers.removeUnordered(e)&&(this._model.dirtySet.getResidentRenderGeometries(e.id,this._syncChangeSet.removes),this.renderer.modify(this._syncChangeSet,u))}addRenderPlugin(e,t){const r=this.renderer.plugins.add(e,t),i=()=>{d(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(s(r))return r.then(i);i()}removeRenderPlugin(e){this.destroyed||(d(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get performanceInfo(){return this._model.getStats()}get test(){}};e([n({constructOnly:!0})],g.prototype,"view",void 0),e([n({constructOnly:!0})],g.prototype,"options",void 0),e([n({readOnly:!0})],g.prototype,"viewingMode",null),e([n({constructOnly:!0})],g.prototype,"container",void 0),e([n({readOnly:!0})],g.prototype,"updating",null),e([n({constructOnly:!0})],g.prototype,"_model",void 0),e([n()],g.prototype,"_renderView",void 0),e([n({readOnly:!0})],g.prototype,"renderer",null),e([n()],g.prototype,"textures",void 0),e([n({readOnly:!0})],g.prototype,"running",null),g=e([o("esri.views.3d.webgl-engine.Stage")],g);export{g as Stage};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import r from"../../../core/PooledArray.js";import{isPromiseLike as s}from"../../../core/promiseUtils.js";import{signal as i}from"../../../core/signal.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntersectionHandler as d}from"../state/helpers/SceneIntersectionHelper.js";import{TextureCollection as a}from"../support/TextureCollection.js";import{ChangeSet as h}from"./lib/ChangeSet.js";import{UpdatePolicy as c}from"./lib/UpdatePolicy.js";import{isWebGLLayer as m}from"./lib/WebGLLayer.js";import{Model as y}from"./parts/Model.js";import{RenderView as l}from"./parts/RenderView.js";import{TaskPriority as p,noBudget as u}from"../../support/Scheduler.js";import{Yield as _}from"../../support/Yield.js";let g=class extends t{constructor(e){super(e),this._model=new y,this._canCompact=i(!1),this._layers=new r,this._asyncChangeSet=new h,this._syncChangeSet=new h,this._layerSyncSet=new Set,this.textures=new a(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(p.STAGE,this),this.addHandles(this._frameTask)}initialize(){this._renderView=new l({stage:this})}destroy(){this.textures.destroy(),this.renderView.destroy()}get viewingMode(){return this.view.state.viewingMode}get updating(){return this.running||this.renderView.updating||this._frameTask.updating||this.textures.updating}get renderView(){return this._renderView}get renderer(){return this.renderView.renderer}add(e){this._model.add(e),m(e)&&this._addLayer(e),this.renderView.requestRender()}remove(e){null!=e&&!this.destroyed&&this._model.remove(e)&&(m(e)&&this._removeLayer(e),this.renderView.requestRender())}addMany(e){null!=e&&(this._model.addMany(e),this.renderView.requestRender())}removeMany(e){null!=e&&(this._model?.removeMany(e),this.renderView.requestRender())}forEachOfType(e,t){this._model.forEachOfType(e,t)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get running(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return _}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||r.updatePolicy===c.SYNC,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.commit(i,s?u:e),this.renderView.requestRender(),e.madeProgress())})),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,u),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{e.done||this._layerSyncSet.has(r.id)||r.updatePolicy!==c.ASYNC||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))})),this._layerSyncSet.clear(),this.notifyChange("running")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forAll((t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===c.SYNC?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)}));for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,u),this.renderView.requestRender())}_commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,u),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}getObject(e){return this._model.getObject(e)}get layers(){return this._layers}_addLayer(e){this._layers.includes(e)||this._layers.push(e)}_removeLayer(e){this._commitLayer(e),null!=this._layers.removeUnordered(e)&&(this._model.dirtySet.getResidentRenderGeometries(e.id,this._syncChangeSet.removes),this.renderer.commit(this._syncChangeSet,u))}addRenderPlugin(e,t){const r=this.renderer.plugins.add(e,t),i=()=>{d(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(s(r))return r.then(i);i()}removeRenderPlugin(e){this.destroyed||(d(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get performanceInfo(){return this._model.getStats()}get test(){}};e([n({constructOnly:!0})],g.prototype,"view",void 0),e([n({constructOnly:!0})],g.prototype,"options",void 0),e([n({readOnly:!0})],g.prototype,"viewingMode",null),e([n({constructOnly:!0})],g.prototype,"container",void 0),e([n({readOnly:!0})],g.prototype,"updating",null),e([n({constructOnly:!0})],g.prototype,"_model",void 0),e([n()],g.prototype,"_renderView",void 0),e([n({readOnly:!0})],g.prototype,"renderer",null),e([n()],g.prototype,"textures",void 0),e([n({readOnly:!0})],g.prototype,"running",null),g=e([o("esri.views.3d.webgl-engine.Stage")],g);export{g as Stage};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float2BindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{B as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/BloomComposition.glsl.js";
5
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{B as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/BloomComposition.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.33/esri/copyright.txt for details.
4
4
  */
5
- const n=2.6,o={sunny:.0022,cloudy:.0022,rainy:.0022,snowy:.0022,foggy:.0022};class s{constructor(n,o){this.near=n,this.far=o}}const y={sunny:new s([.15,.05,.01,0,0],[1,.8,.6,.4,.2]),cloudy:new s([.15,.05,.01,0,0],[1,.8,.6,.4,.2]),rainy:new s([.15,.05,.01,0,0],[1,.8,.6,.4,.2]),snowy:new s([.15,.05,.01,0,0],[1,.8,.6,.4,.2]),foggy:new s([.15,.05,.01,0,0],[1,.8,.6,.4,.2])};export{o as blurRadiusPresets,n as defaultExposure,y as lodFactorsPresets};
5
+ const n=2.6,s={sunny:.0022,cloudy:.0022,rainy:.0022,snowy:.0022,foggy:.0022};class o{constructor(n,s){this.near=n,this.far=s,this.near=r(n),this.far=r(s)}}const t={sunny:new o([.15,.05,.01,0,0],[1,.8,.6,.4,.2]),cloudy:new o([.15,.05,.01,0,0],[1,.8,.6,.4,.2]),rainy:new o([.15,.05,.01,0,0],[1,.8,.6,.4,.2]),snowy:new o([.15,.05,.01,0,0],[1,.8,.6,.4,.2]),foggy:new o([.15,.05,.01,0,0],[1,.8,.6,.4,.2])};function r(n,s=1){const o=n[0]+n[1]+n[2]+n[3]+n[4];return o<s?n:[n[0]/o,n[1]/o,n[2]/o,n[3]/o,n[4]/o]}export{s as blurRadiusPresets,n as defaultExposure,t as lodFactorsPresets,r as normalizePreset};