@arcgis/core 5.2.0-next.125 → 5.2.0-next.126

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 (283) hide show
  1. package/analysis/ElevationProfile/ElevationProfileDisplayUnits.d.ts +3 -2
  2. package/analysis/VolumeMeasurement/VolumeMeasurementDisplayUnits.d.ts +1 -0
  3. package/arcgisGlobal.d.ts +1 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{fe9582bc2244667e40ab.js → 05afa8c2b5929ce0545a.js} +1 -1
  6. package/assets/esri/core/workers/chunks/0a20f84b5f004a77a9f9.js +1 -0
  7. package/assets/esri/core/workers/chunks/{cfd56e0a716baf95e17b.js → 0a2b7c691a577cb3d189.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{6cf34cfdd063a1b6fe3e.js → 0ccd4200c5a2a5de6e16.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{bdf012e591a8476db467.js → 1406a884241809b62bff.js} +1 -1
  10. package/assets/esri/core/workers/chunks/17218d714cb07b607c2f.js +1 -0
  11. package/assets/esri/core/workers/chunks/1d040aa8951fff3141d9.js +1 -0
  12. package/assets/esri/core/workers/chunks/30604a29df320d7a4c6b.js +1 -0
  13. package/assets/esri/core/workers/chunks/3ef367c9b7bf1588307d.js +1 -0
  14. package/assets/esri/core/workers/chunks/{5b9b76e180cf206a8a0c.js → 4327d2c39a660bd89da7.js} +1 -1
  15. package/assets/esri/core/workers/chunks/4678a8170d8a3ccd1a7b.js +1 -0
  16. package/assets/esri/core/workers/chunks/474d9541d387b31ad275.js +1 -0
  17. package/assets/esri/core/workers/chunks/{f05becec0952a61bc654.js → 4d18451e0ea6ca54101a.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{26bc509a031788bfa678.js → 4f464047c6f6c9486efd.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{58528ccb7f72ae76d52b.js → 540f60e31b19d85e9371.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{44857a76be2c0ac65bb9.js → 55a560fd872f7463b33d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/56acda1eed3a013430e2.js +1 -0
  22. package/assets/esri/core/workers/chunks/{1f55701d23a5e5a0c70c.js → 57ab87e70ef85b9405f9.js} +122 -122
  23. package/assets/esri/core/workers/chunks/{f0901f9c7135b708434f.js → 5adf2792416b22cd602f.js} +1 -1
  24. package/assets/esri/core/workers/chunks/5fe5ef5ccf480634d159.js +1 -0
  25. package/assets/esri/core/workers/chunks/67678054342178b601cf.js +1 -0
  26. package/assets/esri/core/workers/chunks/67dcf9b873cb037b2647.js +1 -0
  27. package/assets/esri/core/workers/chunks/76548469fe1b9c3b2051.js +1 -0
  28. package/assets/esri/core/workers/chunks/7d6da4e89aa951e6523f.js +1 -0
  29. package/assets/esri/core/workers/chunks/7dd94567833386dc74de.js +1 -0
  30. package/assets/esri/core/workers/chunks/806f96ad09e882be41af.js +1 -0
  31. package/assets/esri/core/workers/chunks/{bbaaebe1774a22dba39b.js → 97602019a1ccad22a03a.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{378bdb4e5cd1ebada1f4.js → 9ca98fffd43e63d5ade3.js} +1 -1
  33. package/assets/esri/core/workers/chunks/9d6a96e4c7ccedcb0c13.js +1 -0
  34. package/assets/esri/core/workers/chunks/9ec04faad97be55309b8.js +1 -0
  35. package/assets/esri/core/workers/chunks/a08385ebf1715414c1a6.js +1 -0
  36. package/assets/esri/core/workers/chunks/{e22a013ec38989caf9de.js → a790fc6b22acf651574b.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{2f52ad525744b8793d49.js → a8258636096416c837a2.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{813dd84933b407c8fe86.js → b34305474a861aaf6ccb.js} +1 -1
  39. package/assets/esri/core/workers/chunks/c5b733c3a5b2680042a2.js +1 -0
  40. package/assets/esri/core/workers/chunks/{f0709c48daca93e759c8.js → c692e583e87af58f6d91.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{4f7e8e4ddf52b5245ea4.js → c77496c350004ee66eb2.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{0fba5c0e89b057da548d.js → cb7cb7d57c4e7f76600f.js} +1 -1
  43. package/assets/esri/core/workers/chunks/d371d9279b30548efa02.js +1 -0
  44. package/assets/esri/core/workers/chunks/d5f0fed415b5b155d57c.js +1 -0
  45. package/assets/esri/core/workers/chunks/{3f082329a544c2c1d62d.js → d5f72670634e73c0b53a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/d6e914f6ed45ea59034e.js +1 -0
  47. package/assets/esri/core/workers/chunks/{5afc12671a9a1bb6c56c.js → dc52e036547612949d32.js} +1 -1
  48. package/assets/esri/core/workers/chunks/e0894a308c84d5c158b0.js +1 -0
  49. package/assets/esri/core/workers/chunks/e1ae83ff3e0225708d4d.js +1 -0
  50. package/assets/esri/core/workers/chunks/{df79c00b5ddbef7148a0.js → eaa7cb3ffa8c11706a09.js} +1 -1
  51. package/assets/esri/core/workers/chunks/eebbc86a15ae3adb5f38.js +1 -0
  52. package/assets/esri/core/workers/chunks/fdbda3d2afea25142b86.js +1 -0
  53. package/assets/esri/libs/pdfjs/pdf.worker.mjs +4 -63051
  54. package/assets/esri/widgets/Editor/t9n/messages.ar.json +1 -1
  55. package/assets/esri/widgets/Editor/t9n/messages.bg.json +1 -1
  56. package/assets/esri/widgets/Editor/t9n/messages.bs.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/messages.ca.json +1 -1
  58. package/assets/esri/widgets/Editor/t9n/messages.cs.json +1 -1
  59. package/assets/esri/widgets/Editor/t9n/messages.da.json +1 -1
  60. package/assets/esri/widgets/Editor/t9n/messages.de.json +1 -1
  61. package/assets/esri/widgets/Editor/t9n/messages.el.json +1 -1
  62. package/assets/esri/widgets/Editor/t9n/messages.es.json +1 -1
  63. package/assets/esri/widgets/Editor/t9n/messages.et.json +1 -1
  64. package/assets/esri/widgets/Editor/t9n/messages.fi.json +1 -1
  65. package/assets/esri/widgets/Editor/t9n/messages.fr.json +1 -1
  66. package/assets/esri/widgets/Editor/t9n/messages.he.json +1 -1
  67. package/assets/esri/widgets/Editor/t9n/messages.hr.json +1 -1
  68. package/assets/esri/widgets/Editor/t9n/messages.hu.json +1 -1
  69. package/assets/esri/widgets/Editor/t9n/messages.id.json +1 -1
  70. package/assets/esri/widgets/Editor/t9n/messages.it.json +1 -1
  71. package/assets/esri/widgets/Editor/t9n/messages.ja.json +1 -1
  72. package/assets/esri/widgets/Editor/t9n/messages.ko.json +1 -1
  73. package/assets/esri/widgets/Editor/t9n/messages.lt.json +1 -1
  74. package/assets/esri/widgets/Editor/t9n/messages.lv.json +1 -1
  75. package/assets/esri/widgets/Editor/t9n/messages.nl.json +1 -1
  76. package/assets/esri/widgets/Editor/t9n/messages.no.json +1 -1
  77. package/assets/esri/widgets/Editor/t9n/messages.pl.json +1 -1
  78. package/assets/esri/widgets/Editor/t9n/messages.pt-BR.json +1 -1
  79. package/assets/esri/widgets/Editor/t9n/messages.pt-PT.json +1 -1
  80. package/assets/esri/widgets/Editor/t9n/messages.ro.json +1 -1
  81. package/assets/esri/widgets/Editor/t9n/messages.ru.json +1 -1
  82. package/assets/esri/widgets/Editor/t9n/messages.sk.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/messages.sl.json +1 -1
  84. package/assets/esri/widgets/Editor/t9n/messages.sr.json +1 -1
  85. package/assets/esri/widgets/Editor/t9n/messages.sv.json +1 -1
  86. package/assets/esri/widgets/Editor/t9n/messages.th.json +1 -1
  87. package/assets/esri/widgets/Editor/t9n/messages.tr.json +1 -1
  88. package/assets/esri/widgets/Editor/t9n/messages.uk.json +1 -1
  89. package/assets/esri/widgets/Editor/t9n/messages.vi.json +1 -1
  90. package/assets/esri/widgets/Editor/t9n/messages.zh-CN.json +1 -1
  91. package/assets/esri/widgets/Editor/t9n/messages.zh-HK.json +1 -1
  92. package/assets/esri/widgets/Editor/t9n/messages.zh-TW.json +1 -1
  93. package/chunks/GlobalIllumination.glsl.js +9 -9
  94. package/chunks/GlobalIlluminationBlur.glsl.js +8 -8
  95. package/chunks/HeatmapDensity.glsl.js +5 -5
  96. package/chunks/Pattern.glsl.js +30 -30
  97. package/chunks/RibbonLine.glsl.js +19 -19
  98. package/config.js +1 -1
  99. package/core/accessorSupport/types.d.ts +5 -1
  100. package/interfaces.d.ts +3 -0
  101. package/kernel.js +1 -1
  102. package/layers/ParquetLayer.d.ts +3 -2
  103. package/layers/ParquetLayer.js +1 -1
  104. package/layers/SceneLayer.js +1 -1
  105. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  106. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +2 -2
  107. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  108. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  109. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  110. package/layers/geospatialPDF/geospatialPDFParserUtils.js +2 -0
  111. package/layers/geospatialPDF/projectionToWKTUtils.js +2 -0
  112. package/layers/geospatialPDF/renderExtentUtils.js +1 -1
  113. package/layers/geospatialPDF/sharedUtils.js +1 -1
  114. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  115. package/layers/orientedImagery/transformations/utils.js +1 -1
  116. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  117. package/layers/raster/types.d.ts +6 -0
  118. package/layers/support/TimeSeriesCalculation.d.ts +32 -0
  119. package/layers/support/TimeSeriesCalculation.js +2 -0
  120. package/layers/support/TimeSeriesInfo.d.ts +19 -0
  121. package/layers/support/TimeSeriesInfo.js +1 -1
  122. package/layers/support/commonProperties.js +1 -1
  123. package/layers/support/timeSeriesUtils.d.ts +25 -1
  124. package/layers/support/timeSeriesUtils.js +1 -1
  125. package/layers/types.d.ts +1 -0
  126. package/package.json +2 -2
  127. package/popup/FeatureContentCollection.d.ts +4 -1
  128. package/popup/FeatureContentCollection.js +1 -1
  129. package/popup/types.d.ts +14 -3
  130. package/portal/schemas/definitions.js +1 -1
  131. package/portal/schemas/sceneLayerItem.js +1 -1
  132. package/renderers/support/AuthoringInfo.d.ts +8 -1
  133. package/renderers/support/AuthoringInfo.js +1 -1
  134. package/renderers/support/AuthoringInfoVisualVariable.d.ts +8 -1
  135. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  136. package/rest/imageService/fetchRasterInfo.js +1 -1
  137. package/rest/knowledgeGraph/DataModel.js +1 -1
  138. package/smartMapping/renderers/color.d.ts +12 -0
  139. package/smartMapping/renderers/color.js +1 -1
  140. package/smartMapping/renderers/opacity.d.ts +6 -0
  141. package/smartMapping/renderers/opacity.js +1 -1
  142. package/smartMapping/renderers/size.d.ts +12 -0
  143. package/smartMapping/renderers/size.js +1 -1
  144. package/smartMapping/renderers/support/regenerateUtils.js +1 -1
  145. package/smartMapping/renderers/support/rendererUtils.js +1 -1
  146. package/smartMapping/renderers/support/timeSeriesUtils.js +1 -1
  147. package/smartMapping/renderers/type.d.ts +6 -0
  148. package/smartMapping/renderers/type.js +1 -1
  149. package/smartMapping/renderers/univariateColorSize.d.ts +6 -0
  150. package/smartMapping/renderers/univariateColorSize.js +1 -1
  151. package/support/revision.js +1 -1
  152. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  153. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +8 -0
  154. package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
  155. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  156. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +8 -0
  157. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
  158. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +3 -2
  159. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  160. package/views/3d/analysis/Dimension/DimensionController.js +1 -1
  161. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  162. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +3 -2
  163. package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
  164. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  165. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  166. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  167. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  168. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  169. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.d.ts +1 -0
  170. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  171. package/views/3d/input/handlers/DragRotate.js +1 -1
  172. package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
  173. package/views/3d/input/handlers/ground/GroundDoubleClickMove.js +1 -1
  174. package/views/3d/input/handlers/ground/GroundNavigation.js +1 -1
  175. package/views/3d/state/Constraints.js +1 -1
  176. package/views/3d/state/controllers/GroundNavigationController.js +1 -1
  177. package/views/3d/state/controllers/RotateController.js +1 -1
  178. package/views/3d/support/engineContent/line.js +1 -1
  179. package/views/3d/support/planarDistanceToGroundRatio.js +2 -0
  180. package/views/3d/terrain/OverlayManager.js +1 -1
  181. package/views/3d/terrain/OverlayRenderer.js +1 -1
  182. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +13 -13
  183. package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +2 -2
  184. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  185. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  186. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  187. package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
  188. package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
  189. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  190. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  191. package/views/DOMContainer.js +1 -1
  192. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  193. package/views/analysis/LengthDimensionResult.d.ts +4 -1
  194. package/views/draw/support/managers/TooltipManager.js +1 -1
  195. package/views/interactive/options/SnappingOptions.d.ts +4 -2
  196. package/views/interactive/options/SnappingOptions.js +1 -1
  197. package/views/interactive/options/ViewOptions.d.ts +18 -0
  198. package/views/interactive/options/bindViewToolOptions.js +2 -0
  199. package/views/interactive/snapping/SnappingManagerPool.js +1 -1
  200. package/views/interactive/snapping/allLayerSnapping.js +1 -1
  201. package/views/overlay/FocusRegionOverlayItem.js +1 -1
  202. package/views/selection/SelectionOperation.d.ts +27 -1
  203. package/views/selection/types.d.ts +8 -20
  204. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +1 -0
  205. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  206. package/widgets/AreaMeasurement2D.js +1 -1
  207. package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -0
  208. package/widgets/BasemapLayerList.d.ts +1 -0
  209. package/widgets/BatchAttributeForm/expressions/types.d.ts +1 -0
  210. package/widgets/BatchAttributeForm/types.d.ts +5 -1
  211. package/widgets/BatchAttributeForm.d.ts +1 -0
  212. package/widgets/Bookmarks/BookmarksViewModel.d.ts +1 -0
  213. package/widgets/Bookmarks.d.ts +1 -0
  214. package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +1 -0
  215. package/widgets/CatalogLayerList.d.ts +1 -0
  216. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +1 -0
  217. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  218. package/widgets/DistanceMeasurement2D.js +1 -1
  219. package/widgets/Editor.d.ts +1 -0
  220. package/widgets/FeatureForm.d.ts +1 -0
  221. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +14 -0
  222. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  223. package/widgets/FeatureTable/support/FeatureStore.d.ts +14 -0
  224. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  225. package/widgets/FeatureTable.d.ts +1 -0
  226. package/widgets/FeatureTemplates.d.ts +1 -0
  227. package/widgets/Features/FeaturesViewModel.d.ts +1 -0
  228. package/widgets/Features.d.ts +2 -1
  229. package/widgets/HistogramRangeSlider.d.ts +1 -0
  230. package/widgets/Home/HomeViewModel.d.ts +1 -0
  231. package/widgets/Home.d.ts +1 -0
  232. package/widgets/LayerList/LayerListViewModel.d.ts +1 -0
  233. package/widgets/LayerList.d.ts +1 -0
  234. package/widgets/Locate/LocateViewModel.d.ts +1 -0
  235. package/widgets/Locate.d.ts +1 -0
  236. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  237. package/widgets/OrientedImageryViewer/navigation/NavigationManagerPanoramic.js +1 -1
  238. package/widgets/OrientedImageryViewer/types.d.ts +4 -1
  239. package/widgets/OrientedImageryViewer.d.ts +4 -1
  240. package/widgets/Popup.d.ts +1 -0
  241. package/widgets/Print/PrintViewModel.d.ts +1 -0
  242. package/widgets/Print.d.ts +1 -0
  243. package/widgets/Search.d.ts +1 -0
  244. package/widgets/Sketch.d.ts +1 -0
  245. package/widgets/Slider.d.ts +4 -0
  246. package/widgets/TimeSlider.d.ts +1 -0
  247. package/widgets/Track/TrackViewModel.d.ts +1 -0
  248. package/widgets/Track.d.ts +1 -0
  249. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.d.ts +1 -0
  250. package/widgets/UtilityNetworkTrace.d.ts +1 -0
  251. package/widgets/ValuePicker/types.d.ts +1 -0
  252. package/widgets/ValuePicker.d.ts +1 -0
  253. package/widgets/smartMapping/SmartMappingSliderBase.d.ts +1 -0
  254. package/widgets/support/SelectionList/types.d.ts +2 -0
  255. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +2 -1
  256. package/assets/esri/core/workers/chunks/0148cb611bf7c8c5fe8a.js +0 -1
  257. package/assets/esri/core/workers/chunks/0a4a5ed831a4e4d8e0fc.js +0 -1
  258. package/assets/esri/core/workers/chunks/0acc754907395e83bbc6.js +0 -1
  259. package/assets/esri/core/workers/chunks/0f8ff964461cf8e0673b.js +0 -1
  260. package/assets/esri/core/workers/chunks/1e46703cb566c25458ad.js +0 -1
  261. package/assets/esri/core/workers/chunks/25c90092def215949db9.js +0 -1
  262. package/assets/esri/core/workers/chunks/2a34760b3f0c134898ec.js +0 -1
  263. package/assets/esri/core/workers/chunks/38890ac5917942374ab8.js +0 -1
  264. package/assets/esri/core/workers/chunks/3b4ceaf21be540cb3499.js +0 -1
  265. package/assets/esri/core/workers/chunks/4c4ba466e23159991322.js +0 -1
  266. package/assets/esri/core/workers/chunks/606ac9358f508bda94f2.js +0 -1
  267. package/assets/esri/core/workers/chunks/6c4def0faaef861a09c9.js +0 -1
  268. package/assets/esri/core/workers/chunks/7285a37cd5359aa4bac5.js +0 -1
  269. package/assets/esri/core/workers/chunks/753d1ff177ecee8e2377.js +0 -1
  270. package/assets/esri/core/workers/chunks/8a8e94b5d7d153361b0b.js +0 -1
  271. package/assets/esri/core/workers/chunks/923c45ebcf45d9ce8ae0.js +0 -1
  272. package/assets/esri/core/workers/chunks/9af36ee6a0df224859bc.js +0 -1
  273. package/assets/esri/core/workers/chunks/a7ce5b958dfeb240c4a5.js +0 -1
  274. package/assets/esri/core/workers/chunks/aed479c14d93955f4798.js +0 -1
  275. package/assets/esri/core/workers/chunks/be52c319a0a81ce1ba36.js +0 -1
  276. package/assets/esri/core/workers/chunks/c0ec87800faf99cbd8bd.js +0 -1
  277. package/assets/esri/core/workers/chunks/ca5a4f62b09cc8579dc0.js +0 -1
  278. package/assets/esri/core/workers/chunks/d090baaa974e1e83fa44.js +0 -1
  279. package/assets/esri/core/workers/chunks/e9f8325a4cf89ae816cc.js +0 -1
  280. package/assets/esri/core/workers/chunks/ed7d4e8725aaa0ca4589.js +0 -1
  281. package/assets/esri/core/workers/chunks/f4572ad25712d204f258.js +0 -1
  282. package/layers/geospatialPDF/GeospatialPDFParserUtils.js +0 -2
  283. package/layers/geospatialPDF/Projection.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{cyclicalPI as r}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as i,deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as a,sync as o,when as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../core/accessorSupport/decorators.js";import{subtract as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as u,subtract as p,copy as m,distance as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as _,scale as f,add as v}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,create as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as R}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as P,width as O,center as D,copy as T,intersection as M,contains as b,offset as j}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as I}from"../../../geometry/support/normalizeUtils.js";import{create as E,wrap as U}from"../../../geometry/support/ray.js";import{Sphere as C}from"../../../geometry/support/sphere.js";import{angleAroundAxis as V}from"../../../geometry/support/vector.js";import{y2lat as A}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as q}from"../state/utils/viewUtils.js";import{debugFlags as F}from"../support/debugFlags.js";import{DebugPoint as H}from"../support/debugUtils.js";import{OverlayRenderer as z}from"./OverlayRenderer.js";import{Intersector as G}from"../webgl-engine/lib/Intersector.js";import{fromValues as L}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as B}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as W,ensureTextureSize as Y}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as k}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as N,noBudget as X}from"../../support/Scheduler.js";import{Yield as Z}from"../../support/Yield.js";const J=1.3,K=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let Q,$=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){const{view:e}=this;this.renderer=new z({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new G(e.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([a(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),a(()=>e.state.camera.pixelRatio,t),a(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.groundView.requestRender(1)),a(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),a(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),o),l(()=>e.groundAndIMSurface,e=>e.on("elevation-change",()=>this.setPlacementDirty())),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(N.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),Q&&(Q.hide(),Q=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=I(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||F.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!(this.terrainSurface.enabled&&this.terrainSurface.freeze)&&this.groundView.ready}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?R(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return J/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(e){return this._contentUpdated=!1,this.renderer.time=e,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new B({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return Z;if(!this.view.pointsOfInterest?.centerOnSurfaceFrequent)return Z;const i=this._computeOverlayHeight(t);this._computeOverlayExtents(t,i,se),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,se.stretch);const s=this._updateOverlay(0,se.inner,i,1*se.pixelRatioAdjustment,se.mapUnitsPerPixel),n=O(se.inner)/O(se.outer),a=this._updateOverlay(1,se.outer,i,n*se.pixelRatioAdjustment,se.mapUnitsPerPixel);1!==s&&1!==a||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(r)),0===s&&0===a||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,i=e.fullHeight/e.pixelRatio*t,s=Math.ceil(1.5*Math.max(r,i)),{maxPreferredTexturePixels:n,maxTextureSize:a}=this.view.stage.renderView.renderingContext.parameters,o=.5*a;return W(Y({width:s,height:s},{maxPreferredTexturePixels:2*n,maxTextureSize:o})[1],o)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,r,i,s){if(0===this.renderer.overlays.length)return 0;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=s,n.pixelRatio=i,ee(t,n.extent)&&r===n.resolution)return a===s?0:2;n.setExtent(t),n.resolution=r;const o=D(n.extent);return n.renderLocalOrigin=L(o[0],o[1],0,"OV_"+this._latestOriginId++),1}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],i=this.renderer.overlays[1],s=this._pointIsInExtent(e,r.extent)?r:i;return(s.extent[2]-s.extent[0])/s.resolution}reloadShaders(){k(),this.requestRender(),this.runTask(X)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,i,s){const n=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,oe,t,r);if(null==n)return!1;const a=n.origin,o=u(ie,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.groundAndIMSurface.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(s)&&l.withinDistance(i)}_findHorizonBasedPointOfInterest(e,t){let s=.5;const n=.55,a=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:a+l,e.aboveGround?a-l:1/0),d=e.aboveGround;if("global"===this.view.viewingMode){const t=ie;le.radius=R(this.view.spatialReference).radius+h,le.closestPointOnSilhouette(U(e.eye,e.viewForward),t),p(t,t,e.eye);const i=r.normalize(V(e.viewForward,t,e.viewRight))/e.fovY+.5,a=i<=0||i>=1?.5:n;s=d?a*i:i+a*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),r=Math.tan(t),a=w(0,r,1,0),o=_(a,a,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);s=1===l||0===l?.5:d?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,s,o.distance,t)}_computeOverlayExtents(e,t,r){const{view:i}=this,n=i.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,a=y();this._findHorizonBasedPointOfInterest(e,a)||m(a,n);const o=this._renderSR;F.OVERLAY_SHOW_CENTER?(null==Q&&(Q=new H(i.graphics,"red")),Q.show(a,o)):null!=Q&&Q.hide();const l=Math.max(.1,g(e.eye,a)),h=q(i.renderCoordsHelper,n,e.eye),d=this._spatialReference;this._overlaySREqualsRenderSR||S(a,o,a,d);const u=this._isSpherical,p=this.groundView.groundExtent,_=!u&&d?.isGeographic,w=_&&d?1/R(d).metersPerDegree:1,x=i.state.contentPixelRatio,P=e.perScreenPixelRatio/x*l*w;r.mapUnitsPerPixel=P/this.worldToPCSRatio,r.stretch=this._overlayStretch;let D=t*P/2*r.stretch,j=!1,I=_?90:1/0;u&&p&&d&&(d.isWebMercator?(D/=Math.cos(A(a[1])),I=p[3]):(j=!0,D/=R(d).metersPerDegree,I=90),D>=I&&(D=I,a[1]=0,d.isWebMercator&&(a[0]=0)));let E=1;j&&(E=1/Math.max(.2,Math.cos(Math.abs(s(a[1])))),D*E>180&&(E=180/D),r.mapUnitsPerPixel*=E);const U=Math.log(2)/12;D=Math.exp(Math.round(Math.log(D)/U)*U);const C=D*E,V=32,z=.5*t/(V*C),G=.5*t/(V*D);a[0]=Math.round(a[0]*z)/z,a[1]=Math.round(a[1]*G)/G;const L=r.inner;L[0]=a[0]-C,L[1]=a[1]-D,L[2]=a[0]+C,L[3]=a[1]+D,u&&this._shiftExtentToFitBounds(L,1/0,I);const B=r.outer;if(p&&6*C>O(p))T(B,p);else{if(Math.PI/2-Math.abs(h-Math.PI/2)<=.25*Math.PI)B[0]=L[0]-C,B[1]=L[1]-D,B[2]=L[2]+C,B[3]=L[3]+D;else{S(e.eye,o,ie,d),c(re,a,ie);let t=-Math.atan2(re[1],re[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(re,K[r],2*D),re[0]*=E,re[2]*=E,v(B,L,re)}}if(u&&this.longitudeCyclical)B[0]=this.longitudeCyclical.clamp(B[0]),B[2]=this.longitudeCyclical.clamp(B[2]),B[1]=Math.max(B[1],-I),B[3]=Math.min(B[3],I);else{const e=M(L,p,ne),t=M(B,p,ae);b(e,t)&&(B[2]=B[0],B[3]=B[1])}const W=Math.abs(L[2]-L[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,W),r.pixelRatioAdjustment=r.mapUnitsPerPixel/W}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),1===t&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,i=e.y;return r>t[0]&&r<t[2]&&i>t[1]&&i<t[3]}_shiftExtentToFitBounds(e,t,r){let i=0,s=0;e[0]<-t?i=e[0]+t:e[2]>t&&(i=t-e[2]),e[1]<-r?s=e[1]+r:e[3]>r&&(s=r-e[3]),j(e,i,s)}get test(){}};function ee(e,t){const r=1e-5,i=F.ENABLE_OPTIMIZATIONS?r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]):0;return Math.abs(t[0]-e[0])<=i&&Math.abs(t[1]-e[1])<=i&&Math.abs(t[2]-e[2])<=i&&Math.abs(t[3]-e[3])<=i}e([h()],$.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],$.prototype,"readyToRun",null),e([h()],$.prototype,"_placementDirty",void 0),e([h()],$.prototype,"_contentUpdated",void 0),e([h()],$.prototype,"_isSpherical",null),e([h()],$.prototype,"worldToPCSRatio",null),e([h()],$.prototype,"renderer",void 0),e([h({constructOnly:!0})],$.prototype,"view",void 0),e([h({constructOnly:!0})],$.prototype,"groundView",void 0),e([h({constructOnly:!0})],$.prototype,"terrainSurface",void 0),e([h()],$.prototype,"updating",null),$=e([d("esri.views.3d.terrain.OverlayManager")],$);class te{constructor(){this.inner=P(),this.outer=P(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=J}}const re=x(),ie=y(),se=new te,ne=P(),ae=P(),oe=E(),le=new C;export{$ as OverlayManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{cyclicalPI as r}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as i,deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as a,sync as o,when as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../core/accessorSupport/decorators.js";import{subtract as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as u,subtract as p,copy as m,distance as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as _,scale as f,add as v}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as x,create as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as R}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as P,width as D,center as O,copy as T,intersection as M,contains as b,offset as j}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as I}from"../../../geometry/support/normalizeUtils.js";import{create as U,wrap as E}from"../../../geometry/support/ray.js";import{Sphere as V}from"../../../geometry/support/sphere.js";import{angleAroundAxis as C}from"../../../geometry/support/vector.js";import{y2lat as A}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as q}from"../state/utils/viewUtils.js";import{debugFlags as F}from"../support/debugFlags.js";import{DebugPoint as G}from"../support/debugUtils.js";import{getPlanarDistanceToGroundRatio as H}from"../support/planarDistanceToGroundRatio.js";import{OverlayRenderer as z}from"./OverlayRenderer.js";import{Intersector as B}from"../webgl-engine/lib/Intersector.js";import{fromValues as L}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as W}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as Y,ensureTextureSize as k}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as N}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as X,noBudget as Z}from"../../support/Scheduler.js";import{Yield as J}from"../../support/Yield.js";const K=1.3,Q=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let $,ee=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){const{view:e}=this;this.renderer=new z({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new B(e.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([a(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),a(()=>e.state.camera.pixelRatio,t),a(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.groundView.requestRender(1)),a(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),a(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),o),l(()=>e.groundAndIMSurface,e=>e.on("elevation-change",()=>this.setPlacementDirty())),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(X.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),$&&($.hide(),$=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=I(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||F.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!(this.terrainSurface.enabled&&this.terrainSurface.freeze)&&this.groundView.ready}get _isSpherical(){return this.view.state.isGlobal}get mapUnitsToPlanarDistanceRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&this._isSpherical?R(this._spatialReference).metersPerDegree:1}getPlanarDistanceToGroundRatio(e){return null==this._spatialReference?1:H(this._spatialReference,this._isSpherical,e)}get _overlayStretch(){return K/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(e){return this._contentUpdated=!1,this.renderer.time=e,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new W({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return J;if(!this.view.pointsOfInterest?.centerOnSurfaceFrequent)return J;const i=this._computeOverlayHeight(t);this._computeOverlayExtents(t,i,ne),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,ne.stretch);const s=this._updateOverlay(0,ne.inner,i,1*ne.pixelRatioAdjustment,ne.mapUnitsPerPixel),n=D(ne.inner)/D(ne.outer),a=this._updateOverlay(1,ne.outer,i,n*ne.pixelRatioAdjustment,ne.mapUnitsPerPixel);1!==s&&1!==a||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(r)),0===s&&0===a||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,i=e.fullHeight/e.pixelRatio*t,s=Math.ceil(1.5*Math.max(r,i)),{maxPreferredTexturePixels:n,maxTextureSize:a}=this.view.stage.renderView.renderingContext.parameters,o=.5*a;return Y(k({width:s,height:s},{maxPreferredTexturePixels:2*n,maxTextureSize:o})[1],o)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,r,i,s){if(0===this.renderer.overlays.length)return 0;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=s,n.pixelRatio=i,te(t,n.extent)&&r===n.resolution)return a===s?0:2;n.setExtent(t),n.resolution=r;const o=O(n.extent);return n.renderLocalOrigin=L(o[0],o[1],0,"OV_"+this._latestOriginId++),1}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],i=this.renderer.overlays[1],s=this._pointIsInExtent(e,r.extent)?r:i;return(s.extent[2]-s.extent[0])/s.resolution}reloadShaders(){N(),this.requestRender(),this.runTask(Z)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,i,s){const n=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,le,t,r);if(null==n)return!1;const a=n.origin,o=u(se,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.groundAndIMSurface.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(s)&&l.withinDistance(i)}_findHorizonBasedPointOfInterest(e,t){let s=.5;const n=.55,a=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:a+l,e.aboveGround?a-l:1/0),d=e.aboveGround;if("global"===this.view.viewingMode){const t=se;he.radius=R(this.view.spatialReference).radius+h,he.closestPointOnSilhouette(E(e.eye,e.viewForward),t),p(t,t,e.eye);const i=r.normalize(C(e.viewForward,t,e.viewRight))/e.fovY+.5,a=i<=0||i>=1?.5:n;s=d?a*i:i+a*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),r=Math.tan(t),a=x(0,r,1,0),o=_(a,a,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);s=1===l||0===l?.5:d?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,s,o.distance,t)}_computeOverlayExtents(e,t,r){const{view:i}=this,n=i.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,a=y();this._findHorizonBasedPointOfInterest(e,a)||m(a,n);const o=this._renderSR;F.OVERLAY_SHOW_CENTER?(null==$&&($=new G(i.graphics,"red")),$.show(a,o)):null!=$&&$.hide();const l=Math.max(.1,g(e.eye,a)),h=q(i.renderCoordsHelper,n,e.eye),d=this._spatialReference;this._overlaySREqualsRenderSR||S(a,o,a,d);const u=this._isSpherical,p=this.groundView.groundExtent,_=!u&&d?.isGeographic,x=_&&d?1/R(d).metersPerDegree:1,w=i.state.contentPixelRatio,P=e.perScreenPixelRatio/w*l*x;r.mapUnitsPerPixel=_?P:P/this.mapUnitsToPlanarDistanceRatio,r.stretch=this._overlayStretch;let O=t*P/2*r.stretch,j=!1,I=_?90:1/0;u&&p&&d&&(d.isWebMercator?(O/=Math.cos(A(a[1])),I=p[3]):(j=!0,O/=R(d).metersPerDegree,I=90),O>=I&&(O=I,a[1]=0,d.isWebMercator&&(a[0]=0)));let U=1;j&&(U=1/Math.max(.2,Math.cos(Math.abs(s(a[1])))),O*U>180&&(U=180/O),r.mapUnitsPerPixel*=U);const E=Math.log(2)/12;O=Math.exp(Math.round(Math.log(O)/E)*E);const V=O*U,C=32,H=.5*t/(C*V),z=.5*t/(C*O);a[0]=Math.round(a[0]*H)/H,a[1]=Math.round(a[1]*z)/z;const B=r.inner;B[0]=a[0]-V,B[1]=a[1]-O,B[2]=a[0]+V,B[3]=a[1]+O,u&&this._shiftExtentToFitBounds(B,1/0,I);const L=r.outer;if(p&&6*V>D(p))T(L,p);else{if(Math.PI/2-Math.abs(h-Math.PI/2)<=.25*Math.PI)L[0]=B[0]-V,L[1]=B[1]-O,L[2]=B[2]+V,L[3]=B[3]+O;else{S(e.eye,o,se,d),c(ie,a,se);let t=-Math.atan2(ie[1],ie[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(ie,Q[r],2*O),ie[0]*=U,ie[2]*=U,v(L,B,ie)}}if(u&&this.longitudeCyclical)L[0]=this.longitudeCyclical.clamp(L[0]),L[2]=this.longitudeCyclical.clamp(L[2]),L[1]=Math.max(L[1],-I),L[3]=Math.min(L[3],I);else{const e=M(B,p,ae),t=M(L,p,oe);b(e,t)&&(L[2]=L[0],L[3]=L[1])}const W=Math.abs(B[2]-B[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,W),r.pixelRatioAdjustment=r.mapUnitsPerPixel/W}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),1===t&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,i=e.y;return r>t[0]&&r<t[2]&&i>t[1]&&i<t[3]}_shiftExtentToFitBounds(e,t,r){let i=0,s=0;e[0]<-t?i=e[0]+t:e[2]>t&&(i=t-e[2]),e[1]<-r?s=e[1]+r:e[3]>r&&(s=r-e[3]),j(e,i,s)}get test(){}};function te(e,t){const r=1e-5,i=F.ENABLE_OPTIMIZATIONS?r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]):0;return Math.abs(t[0]-e[0])<=i&&Math.abs(t[1]-e[1])<=i&&Math.abs(t[2]-e[2])<=i&&Math.abs(t[3]-e[3])<=i}e([h()],ee.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],ee.prototype,"readyToRun",null),e([h()],ee.prototype,"_placementDirty",void 0),e([h()],ee.prototype,"_contentUpdated",void 0),e([h()],ee.prototype,"_isSpherical",null),e([h()],ee.prototype,"mapUnitsToPlanarDistanceRatio",null),e([h()],ee.prototype,"renderer",void 0),e([h({constructOnly:!0})],ee.prototype,"view",void 0),e([h({constructOnly:!0})],ee.prototype,"groundView",void 0),e([h({constructOnly:!0})],ee.prototype,"terrainSurface",void 0),e([h()],ee.prototype,"updating",null),ee=e([d("esri.views.3d.terrain.OverlayManager")],ee);class re{constructor(){this.inner=P(),this.outer=P(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=K}}const ie=w(),se=y(),ne=new re,ae=P(),oe=P(),le=U(),he=new V;export{ee as OverlayManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,syncAndInitial as h,on as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{SyncRenderPlugin as x}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as S,renderHighlightBuffer as T}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as O,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as j}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as F}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as V}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q}from"../../support/Scheduler.js";import A from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends x{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new j,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:r,stage:s}=e.parent.view,i=s.renderer.fboCache,n=s.renderView.renderingContext,a=s.renderView.techniques;this._renderContext=new O(n,new P(i,r.viewingMode),a)}initialize(){const e=this._view,r=e.stage.renderView.waterTextures;this.addHandles([a(()=>r.updating,()=>this.events.emit("content-changed"),h),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),h),d(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>S(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},l),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const t=this._camera;t.near=1,t.far=1e4,t.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=t,this._bindParameters.updateLighting(new M(y()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}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}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(V)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(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(),r(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(a(()=>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(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?B:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(r?.done)break;(s.destroyed||e(s))&&(i.commitChanges()&&(t=!0,r?.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),r?.madeProgress()),r&&this.compact(r),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}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 s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),10===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=B),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.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,content:o}=r;if(this.isEmpty||4===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=B),!this.renders(o))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(10===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,H);const r=this._techniques.get(E,H);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,U[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(10===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),T(a,t,s,s,l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&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(V);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.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_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(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersectRay(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersectRay?.(e,r,t,s,i)??i}*intersectScreenPolygon(e,r,t){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let s=0;for(const{renderer:i}of this._sortedRenderers)s=yield*i.intersectScreenPolygon(e,r,t,s)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new I(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],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(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 G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([u()],k.prototype,"hasHighlights",void 0),e([u()],k.prototype,"renderOccludedFlags",void 0),e([u()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],k.prototype,"parent",void 0),e([u({readOnly:!0})],k.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([u()],k.prototype,"isEmpty",null),k=e([p("esri.views.3d.terrain.OverlayRenderer")],k);class I{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const U=[[1,.5,.5],[.5,.5,1]],B=4,H=new F;H.hasAlpha=!0;export{k as OverlayRenderer,B as overlayRenderOccludedFlag};
2
+ import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import a from"../../../core/PooledArray.js";import{watch as o,syncAndInitial as h,on as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import T from"../webgl/RenderCamera.js";import{SyncRenderPlugin as w}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as x,renderHighlightBuffer as b}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as S}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as O,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as M}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as j}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as E}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as F}from"../webgl-engine/lighting/Lightsources.js";import{O as V}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as q}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as U}from"../../support/Scheduler.js";import W from"../../webgl/Texture.js";import{TextureDescriptor as A}from"../../webgl/TextureDescriptor.js";let G=class extends w{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new V,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new a,this._passParameters=new M,this._screenToMapUnitsRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new T,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:r,stage:s}=e.parent.view,i=s.renderer.fboCache,n=s.renderView.renderingContext,o=s.renderView.techniques;this._renderContext=new O(n,new P(i,r.viewingMode),o)}initialize(){const e=this._view,r=e.stage.renderView.waterTextures;this.addHandles([o(()=>r.updating,()=>this.events.emit("content-changed"),h),o(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),h),d(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>x(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),o(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},l),e.resourceController.scheduler.registerTask(U.OVERLAY_RENDERER,this)]);const t=this._camera;t.near=1,t.far=1e4,t.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=t,this._bindParameters.updateLighting(new F(y()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}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 screenToMapUnitsRatio(){return this._screenToMapUnitsRatio}get mapUnitsToGroundRatio(){return this.parent.mapUnitsToPlanarDistanceRatio*this._bindParameters.planarDistanceToGroundRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new S(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(q)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(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(),r(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(o(()=>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(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?B:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(r?.done)break;(s.destroyed||e(s))&&(i.commitChanges()&&(t=!0,r?.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),r?.madeProgress()),r&&this.compact(r),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}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 s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),10===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=B),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.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._screenToMapUnitsRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:a}=r;if(this.isEmpty||4===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToMapUnitsRatio=this._screenToMapUnitsRatio,l.screenToPlanarDistanceRatio=this._screenToMapUnitsRatio*this.parent.mapUnitsToPlanarDistanceRatio,4===a&&(d.renderOccludedMask=B),!this.renders(a))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;o.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(10===n?o.gl.clearBufferuiv(o.gl.COLOR,0,[0,0,0,0]):(o.setClearColor(0,0,0,0),o.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==a&&2!==a){this._techniques.precompile(j,H);const r=this._techniques.get(j,H);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,I[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(10===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),b(o,t,s,s,l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:a}=i,o=null!=a&&a<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(o){this._bindTargetFBO(r),this._overlayParameters.texture=o.getTexture(),this._overlayParameters.opacity=a,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(q);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),o.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_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(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersectRay(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersectRay?.(e,r,t,s,i)??i}*intersectScreenPolygon(e,r,t){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let s=0;for(const{renderer:i}of this._sortedRenderers)s=yield*i.intersectScreenPolygon(e,r,t,s)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,a=s.renderGroup??(n?0:1),o=s.drapeSourcePriorityOffset??0,h=r*a+(n?i:0)+o;this._sortedRenderers.push(new k(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],this._bindParameters.planarDistanceToGroundRatio=this.parent.getPlanarDistanceToGroundRatio(.5*(e[1]+e[3])),_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(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),a=Math.floor(n/10);i<2||a<2||10*i>e-20||10*a>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&a?1&r^1&n?0:255:1&i^1&a?0:128)}const i=new A(e);i.samplingMode=9728,this._passParameters.texture=new W(this._rctx,i,t)}get test(){}};e([u()],G.prototype,"hasHighlights",void 0),e([u()],G.prototype,"renderOccludedFlags",void 0),e([u()],G.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],G.prototype,"parent",void 0),e([u({readOnly:!0})],G.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],G.prototype,"updating",null),e([u()],G.prototype,"isEmpty",null),G=e([p("esri.views.3d.terrain.OverlayRenderer")],G);class k{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const I=[[1,.5,.5],[.5,.5,1]],B=4,H=new E;H.hasAlpha=!0;export{G as OverlayRenderer,B as overlayRenderOccludedFlag};
@@ -1,19 +1,19 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{MixExternalColor as e}from"../util/MixExternalColor.glsl.js";import{NoPerspectiveRead as t}from"../util/NoPerspective.glsl.js";import{addCameraPosition as o,addPixelRatio as i}from"../util/View.glsl.js";import{Float4PassUniform as r}from"../../shaderModules/Float4PassUniform.js";import{FloatBindUniform as l}from"../../shaderModules/FloatBindUniform.js";import{FloatPassUniform as a}from"../../shaderModules/FloatPassUniform.js";import{glsl as p,If as s}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as n}from"../../shaderModules/Texture2DPassUniform.js";import{isImagePattern as d}from"../../../materials/lineStippleUtils.js";import{computeTextureSize as c}from"../../../materials/stippleTextureRepository.js";import{ensureColor4 as f}from"../../../shaders/ensureColor4.js";function m(d,c){if(!c.stippleEnabled)return void d.fragment.code.add(p`float getStippleAlpha(float lineWidth) { return 1.0; }
2
+ import{MixExternalColor as e}from"../util/MixExternalColor.glsl.js";import{NoPerspectiveRead as t}from"../util/NoPerspective.glsl.js";import{addCameraPosition as i,addPixelRatio as o}from"../util/View.glsl.js";import{Float4PassUniform as l}from"../../shaderModules/Float4PassUniform.js";import{FloatBindUniform as r}from"../../shaderModules/FloatBindUniform.js";import{FloatPassUniform as a}from"../../shaderModules/FloatPassUniform.js";import{glsl as p,If as s}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as n}from"../../shaderModules/Texture2DPassUniform.js";import{isImagePattern as c}from"../../../materials/lineStippleUtils.js";import{computeTextureSize as d}from"../../../materials/stippleTextureRepository.js";import{ensureColor4 as f}from"../../../shaders/ensureColor4.js";function m(c,d){if(!d.stippleEnabled)return void c.fragment.code.add(p`float getStippleAlpha(float lineWidth) { return 1.0; }
3
3
  void discardByStippleAlpha(float stippleAlpha, float threshold) {}
4
- vec4 blendStipple(vec4 color, float stippleAlpha) { return color; }`);const m=!(c.draped&&c.stipplePreferContinuous),{vertex:u,fragment:v}=d;c.draped||(o(u,c),u.uniforms.add(new l("worldToScreenPerDistanceRatio",({camera:e})=>1/e.perScreenPixelRatio)).code.add(p`float computeWorldToScreenRatio(vec3 segmentCenter) {
4
+ vec4 blendStipple(vec4 color, float stippleAlpha) { return color; }`);const m=!(d.draped&&d.stipplePreferContinuous),{vertex:u,fragment:v}=c;d.draped||(i(u,d),u.uniforms.add(new r("worldToScreenPerDistanceRatio",({camera:e})=>1/e.perScreenPixelRatio)).code.add(p`float computeWorldToScreenRatio(vec3 segmentCenter) {
5
5
  float segmentDistanceToCamera = length(segmentCenter - cameraPosition);
6
6
  return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
7
- }`)),d.varyings.add("vStippleDistance","float"),d.varyings.add("vStippleDistanceLimits","vec2"),d.varyings.add("vStipplePatternStretch","float"),u.code.add(p`
8
- float discretizeWorldToScreenRatio(float worldToScreenRatio) {
7
+ }`)),c.varyings.add("vStippleDistance","float"),c.varyings.add("vStippleDistanceLimits","vec2"),c.varyings.add("vStipplePatternStretch","float"),u.code.add(p`
8
+ float discretizeStippleDistanceToScreenRatio(float stippleDistanceToScreenRatio) {
9
9
  float step = ${p.float(g)};
10
10
 
11
- float discreteWorldToScreenRatio = log(worldToScreenRatio);
12
- discreteWorldToScreenRatio = ceil(discreteWorldToScreenRatio / step) * step;
13
- discreteWorldToScreenRatio = exp(discreteWorldToScreenRatio);
14
- return discreteWorldToScreenRatio;
11
+ float discreteStippleDistanceToScreenRatio = log(stippleDistanceToScreenRatio);
12
+ discreteStippleDistanceToScreenRatio = ceil(discreteStippleDistanceToScreenRatio / step) * step;
13
+ discreteStippleDistanceToScreenRatio = exp(discreteStippleDistanceToScreenRatio);
14
+ return discreteStippleDistanceToScreenRatio;
15
15
  }
16
- `),i(u),u.code.add(p`
16
+ `),o(u),u.code.add(p`
17
17
  vec2 computeStippleDistanceLimits(float startPseudoScreen, float segmentLengthPseudoScreen, float segmentLengthScreen, float patternLength) {
18
18
 
19
19
  // First check if the segment is long enough to support fully screen space patterns.
@@ -35,7 +35,7 @@ return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
35
35
  }
36
36
  return vec2(startPseudoScreen, startPseudoScreen + segmentLengthPseudoScreen);
37
37
  }
38
- `),v.uniforms.add(new n("stipplePatternTexture",e=>e.stippleTexture),new a("stipplePatternPixelSizeInv",e=>1/S(e))),c.stippleOffColorEnabled&&v.uniforms.add(new r("stippleOffColor",e=>f(e.stippleOffColor))),d.include(t);const h=c.worldSized&&c.imagePattern,C=!c.worldSized;h?(d.varyings.add("vStippleV","float"),d.fragment.include(e),v.code.add(p`vec4 getStippleColor(out bool isClamped) {
38
+ `),v.uniforms.add(new n("stipplePatternTexture",e=>e.stippleTexture),new a("stipplePatternPixelSizeInv",e=>1/S(e))),d.stippleOffColorEnabled&&v.uniforms.add(new l("stippleOffColor",e=>f(e.stippleOffColor))),c.include(t);const h=d.worldSized&&d.imagePattern,C=!d.worldSized;h?(c.varyings.add("vStippleV","float"),c.fragment.include(e),v.code.add(p`vec4 getStippleColor(out bool isClamped) {
39
39
  vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
40
40
  isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;
41
41
  float u = vStippleDistance * stipplePatternPixelSizeInv;
@@ -90,10 +90,10 @@ return vec4(col, opacity);
90
90
  }
91
91
 
92
92
  vec4 blendStipple(vec4 color, float stippleAlpha) {
93
- return ${c.stippleOffColorEnabled?"mix(color, stippleOffColor, stippleAlpha)":"vec4(color.rgb, color.a * stippleAlpha)"};
93
+ return ${d.stippleOffColorEnabled?"mix(color, stippleOffColor, stippleAlpha)":"vec4(color.rgb, color.a * stippleAlpha)"};
94
94
  }
95
95
  `),v.code.add(p`
96
96
  void discardByStippleAlpha(float stippleAlpha, float threshold) {
97
- ${s(!c.stippleOffColorEnabled,"if (stippleAlpha < threshold) { discard; }")}
97
+ ${s(!d.stippleOffColorEnabled,"if (stippleAlpha < threshold) { discard; }")}
98
98
  }
99
- `)}function S(e){const t=e.stipplePattern;return d(t)?t.length:t?c(t)/t.pixelRatio:1}const g=.4;export{m as LineStipple,S as computePixelSize};
99
+ `)}function S(e){const t=e.stipplePattern;return c(t)?t.length:t?d(t)/t.pixelRatio:1}const g=.4;export{m as LineStipple,S as computePixelSize};
@@ -1,8 +1,8 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{markerSizePerLineWidth as r}from"../../../../support/engineContent/marker.js";import{addPixelRatio as o}from"../util/View.glsl.js";import{FloatBindUniform as t}from"../../shaderModules/FloatBindUniform.js";import{FloatPassUniform as i}from"../../shaderModules/FloatPassUniform.js";import{If as a,glsl as n}from"../../shaderModules/glsl.js";import{parameter as s}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";import{ViewingModeConfiguration as d}from"../../../materials/ViewingModeConfiguration.js";import{NoParameters as l}from"../../../../../webgl/NoParameters.js";class c extends d{constructor(){super(...arguments),this.hasScreenSizePerspective=!1,this.worldSized=!1}}e([s()],c.prototype,"hasScreenSizePerspective",void 0),e([s()],c.prototype,"worldSized",void 0);class m extends l{constructor(){super(...arguments),this.markerScale=1}}function p(e,s){const d=e.vertex,l=s.hasScreenSizePerspective,c=s.worldSized;o(d),d.constants.add("markerSizePerLineWidth","float",r).uniforms.add(new t("worldToScreenRatio",e=>1/e.screenToPCSRatio),new i("markerScale",({markerScale:e})=>e)).code.add(n`
2
+ import{__decorate as e}from"tslib";import{markerSizePerLineWidth as r}from"../../../../support/engineContent/marker.js";import{addPixelRatio as o}from"../util/View.glsl.js";import{FloatBindUniform as t}from"../../shaderModules/FloatBindUniform.js";import{FloatPassUniform as i}from"../../shaderModules/FloatPassUniform.js";import{If as a,glsl as n}from"../../shaderModules/glsl.js";import{parameter as s}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";import{ViewingModeConfiguration as d}from"../../../materials/ViewingModeConfiguration.js";import{NoParameters as l}from"../../../../../webgl/NoParameters.js";class c extends d{constructor(){super(...arguments),this.hasScreenSizePerspective=!1,this.worldSized=!1}}e([s()],c.prototype,"hasScreenSizePerspective",void 0),e([s()],c.prototype,"worldSized",void 0);class m extends l{constructor(){super(...arguments),this.markerScale=1}}function p(e,s){const d=e.vertex,l=s.hasScreenSizePerspective,c=s.worldSized;o(d),d.constants.add("markerSizePerLineWidth","float",r),d.uniforms.add(new i("markerScale",({markerScale:e})=>e)),c&&d.uniforms.add(new t("groundMetersToScreenRatio",e=>1/(e.screenToPlanarDistanceRatio*e.planarDistanceToGroundRatio))),d.code.add(n`
3
3
  float getLineWidth(${a(l,"vec3 pos")}) {
4
4
  float size = max(getSize(${a(l,"pos")}), 1.0);
5
- return ${a(c,"size * pixelRatio * worldToScreenRatio","size * pixelRatio")};
5
+ return ${a(c,"size * pixelRatio * groundMetersToScreenRatio","size * pixelRatio")};
6
6
  }
7
7
 
8
8
  float getScreenMarkerSize(float lineWidth) {
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderLibrary/util/cameraUniforms.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,c as build,e as defaultColorBleedWeight,d as defaultRayMarchMaxReach,f as defaultRayMarchMaxReachEmissionWeight,b as defaultRayMarchMaxSteps,g as defaultRayMarchMinReach,h as defaultRayMarchMinReachEmissionWeight,i as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderLibrary/util/cameraUniforms.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,c as build,e as defaultColorBleedWeight,f as defaultEmissionBoostFactor,d as defaultRayMarchMaxReach,g as defaultRayMarchMaxReachEmissionWeight,b as defaultRayMarchMaxSteps,h as defaultRayMarchMinReach,i as defaultRayMarchMinReachEmissionWeight,j as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as i}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_W as l,ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as u}from"../../../webgl.js";import{AmbientIllumination as n}from"../AmbientIllumination.js";import{G as m}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as h}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as c}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as p}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as _}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as d}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as f}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as b,ColorAttachment1 as g}from"../../../../webgl/enums.js";const w=1,P=256,I=100;let T=class extends n{constructor(t){super(t),this._passParameters=new m,this._drawParameters=new h,this._drawParametersUpscale=new d,this._lowQualityResolutionScale=.35,this._configuration=new _,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(s(()=>this._mode,t=>{0===t?this._disable():this._enable()},r))}destroy(){this._lastOutput=e(this._lastOutput)}_disable(){super._disable(),this._resetAccumulation(),this._passParameters.temporalSampleFrame=0}get hasHighQuality(){return 2===this._mode}resetAccumulation(){this._isGlobalIlluminationUpdate||!(this._passParameters.accumulatedFrames>I)&&this._configuration.hasEmission||this._resetAccumulation()}_resetAccumulation(){this._passParameters.accumulatedFrames=0,this._lastOutput=e(this._lastOutput)}precompile(){this.techniques.getCompiled(f)}render(t){if(this._passParameters.accumulatedFrames>=P)return this._lastOutput?.retain(),this._lastOutput;const e=t.find(({name:t})=>"normals"===t),s=e?.getTexture(),r=e?.getTexture(b),a=this._mode;if(!s||!r)return this._emptyOutput;if(0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this._requestRender(),this._emptyOutput;const l=this.bindParameters;this._configuration.hasEmission=!!l.reprojection.lastFrameEmission;const o=this.techniques.getCompiled(p,this._configuration),n=this.techniques.getCompiled(c),m=1===a,h=m?this._lowQualityResolutionScale:1,_=m?this.techniques.getCompiled(f):null;if(!o||!n||m&&!_)return this._requestRender(),this._emptyOutput;const d=this.renderingContext,{camera:I}=l;this._passParameters.normalTexture=s,this._passParameters.depthTexture=r,this._passParameters.projScale=1/I.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=h;const{fullWidth:T,fullHeight:q}=I,x=Math.max(1,Math.floor(T*h)),O=Math.max(1,Math.floor(q*h)),C=this.fboCache.acquire(x,O,"global illumination input").acquireColor(g,2);d.bindFramebuffer(C.fbo),d.setViewport(0,0,x,O),d.bindTechnique(o,l,this._passParameters,this._drawParameters),d.screen.draw();const j=Math.max(1,Math.round(x/w)),F=Math.max(1,Math.round(O/w)),G=this.fboCache.acquire(j,F,"global illumination blur horizontal");d.bindFramebuffer(G.fbo);const M=C.obtainAttachment(g);this._drawParameters.texture=C.getTexture(),this._drawParameters.weightTexture=M.attachment,i(this._drawParameters.blurSize,0,w/O),d.bindTechnique(n,l,this._passParameters,this._drawParameters),d.setViewport(0,0,j,F),d.screen.draw(),C.release();const U=m?"global illumination blur vertical":u.AMBIENT_ILLUMINATION,A=this.fboCache.acquire(j,F,U);d.bindFramebuffer(A.fbo),d.setViewport(0,0,j,F),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.texture=G.getTexture(),this._drawParameters.weightTexture=M.attachment,i(this._drawParameters.blurSize,w/j,0),d.bindTechnique(n,l,this._passParameters,this._drawParameters),d.setViewport(0,0,j,F),d.screen.draw(),G.release(),A.attachColor(M,g),M.release();let B=A;return _&&(B=this.fboCache.acquire(T,q,u.AMBIENT_ILLUMINATION).acquireColor(g,2),d.bindFramebuffer(B.fbo),d.setViewport(0,0,T,q),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParametersUpscale.colorTexture=A.getTexture(),this._drawParametersUpscale.weightTexture=A.getTexture(g),d.bindTechnique(_,l,this._passParameters,this._drawParametersUpscale),d.screen.draw(),A.release()),d.setViewport4fv(I.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._storeOutput(B),this._passParameters.accumulatedFrames<P&&this._requestRender(),B}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(t){this._lastOutput!==t&&(this._lastOutput=e(this._lastOutput),this._lastOutput=t,this._lastOutput.retain())}get _emptyOutput(){const t=this.renderingContext,{fullWidth:e,fullHeight:s}=this.bindParameters.camera,r=this.fboCache.acquire(e,s,u.AMBIENT_ILLUMINATION).acquireColor(g,2);return t.bindFramebuffer(r.fbo),t.setViewport(0,0,e,s),t.clearBuffer(0,l),t.clearBuffer(1,o),r}get _canRender(){const{reprojection:t,hasEmission:e,globalIllumination:s}=this.bindParameters;return!(!t.lastFrameColor||e&&!t.lastFrameEmission||!t.lastFrameDepth||!s||this._resetBuffer)}get _mode(){return this._useGlobalIllumination?this.view.stage.renderer.isFeatureEnabled(10)?2:1:0}get test(){const t=this;return{passParameters:this._passParameters,configuration:this._configuration,get mode(){return t._mode}}}};T=t([a("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],T);export{T as GlobalIllumination,w as blurSizePixels,P as maxFrames};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{waitRender as r}from"../../../../../core/scheduling.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{UNIT_W as o,ZEROS as u}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as n}from"../../../webgl.js";import{AmbientIllumination as m}from"../AmbientIllumination.js";import{G as h}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as c}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as _}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as d}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as f}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as b}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as g,ColorAttachment1 as w}from"../../../../webgl/enums.js";const P=1,x=100;let I=class extends m{constructor(e){super(e),this._passParameters=new h,this._drawParameters=new c,this._drawParametersUpscale=new f,this._configuration=new d,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1,this._lowQualityResolutionScale=.35,this._maxFrames=256}initialize(){this.addHandles(s(()=>this._mode,e=>{0===e?this._disable():this._enable()},a))}destroy(){this._lastOutput=t(this._lastOutput)}_disable(){super._disable(),this._resetAccumulation(),this._passParameters.temporalSampleFrame=0}get hasHighQuality(){return 2===this._mode}resetAccumulation(){this._isGlobalIlluminationUpdate||!(this._passParameters.accumulatedFrames>x)&&this._configuration.hasEmission||this._resetAccumulation()}_resetAccumulation(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}precompile(){this.techniques.getCompiled(b)}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._lastOutput?.retain(),this._lastOutput;const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),a=t?.getTexture(g),r=this._mode;if(!s||!a)return this._emptyOutput;if(0===r)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this._requestRender(),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=!!i.reprojection.lastFrameEmission;const o=this.techniques.getCompiled(_,this._configuration),u=this.techniques.getCompiled(p),m=1===r,h=m?this._lowQualityResolutionScale:1,c=m?this.techniques.getCompiled(b):null;if(!o||!u||m&&!c)return this._requestRender(),this._emptyOutput;const d=this.renderingContext,{camera:f}=i;this._passParameters.normalTexture=s,this._passParameters.depthTexture=a,this._passParameters.projScale=1/f.computeScreenPixelSizeAtDist(1),this._passParameters.resolutionScale=h;const{fullWidth:x,fullHeight:I}=f,T=Math.max(1,Math.floor(x*h)),q=Math.max(1,Math.floor(I*h)),F=this.fboCache.acquire(T,q,"global illumination input").acquireColor(w,2);d.bindFramebuffer(F.fbo),d.setViewport(0,0,T,q),d.bindTechnique(o,i,this._passParameters,this._drawParameters),d.screen.draw();const O=Math.max(1,Math.round(T/P)),C=Math.max(1,Math.round(q/P)),j=this.fboCache.acquire(O,C,"global illumination blur horizontal");d.bindFramebuffer(j.fbo);const G=F.obtainAttachment(w);this._drawParameters.texture=F.getTexture(),this._drawParameters.weightTexture=G.attachment,l(this._drawParameters.blurSize,0,P/q),d.bindTechnique(u,i,this._passParameters,this._drawParameters),d.setViewport(0,0,O,C),d.screen.draw(),F.release();const S=m?"global illumination blur vertical":n.AMBIENT_ILLUMINATION,y=this.fboCache.acquire(O,C,S);d.bindFramebuffer(y.fbo),d.setViewport(0,0,O,C),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.texture=j.getTexture(),this._drawParameters.weightTexture=G.attachment,l(this._drawParameters.blurSize,P/O,0),d.bindTechnique(u,i,this._passParameters,this._drawParameters),d.setViewport(0,0,O,C),d.screen.draw(),j.release(),y.attachColor(G,w),G.release();let A=y;return c&&(A=this.fboCache.acquire(x,I,n.AMBIENT_ILLUMINATION).acquireColor(w,2),d.bindFramebuffer(A.fbo),d.setViewport(0,0,x,I),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParametersUpscale.colorTexture=y.getTexture(),this._drawParametersUpscale.weightTexture=y.getTexture(w),d.bindTechnique(c,i,this._passParameters,this._drawParametersUpscale),d.screen.draw(),y.release()),d.setViewport4fv(f.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._storeOutput(A),this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),A}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:s}=this.bindParameters.camera,a=this.fboCache.acquire(t,s,n.AMBIENT_ILLUMINATION).acquireColor(w,2);return e.bindFramebuffer(a.fbo),e.setViewport(0,0,t,s),e.clearBuffer(0,o),e.clearBuffer(1,u),a}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:s}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!s||this._resetBuffer)}get _mode(){return this._useGlobalIllumination?this.view.stage.renderer.isFeatureEnabled(10)?2:1:0}get test(){const e=this;return{get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},passParameters:this._passParameters,configuration:this._configuration,get mode(){return e._mode},async restartAccumulation(){"disabled"!==e.produces&&(e._disable(),await r(),e._enable())}}}};I=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],I);export{I as GlobalIllumination,P as blurSizePixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{releaseMaybe as i}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as a}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as o}from"../lighting/SceneLighting.js";class l{constructor(i,t){this.width=i,this.height=t}}const g=5e5;class c{constructor(i){this.shadowMap=i,this.output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.shadowAnalysisEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=t(new e),this._inverseViewport=s(),this._oldLighting=new o,this._newLighting=new o,this._fadedLighting=new o,this._lighting=this._newLighting,this.screenSpaceReflections=new a,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=i(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(i){this._emissions.value=i}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(i){this._camera.value=i,this._inverseViewport[0]=1/i.fullViewport[2],this._inverseViewport[1]=1/i.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(i,t,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=s,this._newLighting.set(i),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(i){i&&(i.name="geometry depth"),this._depth=i}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{c as BindParameters,l as ViewportSize};
2
+ import{releaseMaybe as i}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as a}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as o}from"../lighting/SceneLighting.js";class l{constructor(i,t){this.width=i,this.height=t}}const g=5e5;class c{constructor(i){this.shadowMap=i,this.output=0,this.slot=2,this.slicePlane=null,this.planarDistanceToGroundRatio=1,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.shadowAnalysisEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=t(new e),this._inverseViewport=s(),this._oldLighting=new o,this._newLighting=new o,this._fadedLighting=new o,this._lighting=this._newLighting,this.screenSpaceReflections=new a,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=i(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(i){this._emissions.value=i}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(i){this._camera.value=i,this._inverseViewport[0]=1/i.fullViewport[2],this._inverseViewport[1]=1/i.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(i,t,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=s,this._newLighting.set(i),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(i){i&&(i.name="geometry depth"),this._depth=i}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{c as BindParameters,l as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as t,scale as a,floor as i,subtract as r,set as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{positiveInfinity as n}from"../../../../geometry/support/aaBoundingBox.js";function s(e){return e.visibleGaussians>0&&null!=e.orderTexture.texture&&null!=e.textureAtlas.texture&&null!=e.headerTexture.texture}function o(e){return e.laserlinesEnabled||e.viewshedEnabled||e.shadowAnalysisEnabled}function u(e){return e.viewshedEnabled||e.shadowMap.ready}function d(a,i,r){m(a,i,r,r.eye),a.splatFading=i.data.fadingTexture.texture;const{fullHeight:l,fullWidth:n}=r,s=Math.tan(.5*r.fovY),o=s/l*n;e(a.tanFov,o,s),a.focalLength=l/(2*s),t(a.origin,r.eye)}function m(e,t,s,o){const u=t.data;e.splatOrder=u.orderTexture.texture,e.splatAtlas=u.textureAtlas.texture,e.splatHeader=u.headerTexture.texture;const{fullHeight:d,fullWidth:m}=s,x=t.view.qualitySettings.gaussianSplat.minimumPixelRadius;e.minSplatRadius=x*Math.sqrt(m*d)/Math.sqrt(2073600),a(e.tileCameraPosition,o,1/c),i(e.tileCameraPosition,e.tileCameraPosition),a(e.cameraDelta,e.tileCameraPosition,c),r(e.cameraDelta,o,e.cameraDelta),e.slicePlaneLocalOrigin=o;const p=t.clippingBox||n,[h,f,g,v,b,y]=p,[C,M,P]=o;l(e.clipMinCameraRelative,h-C,f-M,g-P),l(e.clipMaxCameraRelative,v-C,b-M,y-P)}const c=2.048;export{s as canRenderGaussianSplats,c as gaussianSplatTileSize,d as prepareGaussianSplatPerspectiveParameters,m as prepareGaussianSplatRenderParameters,u as requiresPreciseColorDepth,o as requiresPreciseDepth};
2
+ import{set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as t,scale as a,floor as i,subtract as r,set as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{positiveInfinity as n}from"../../../../geometry/support/aaBoundingBox.js";function s(e){return e.visibleGaussians>0&&null!=e.orderTexture.texture&&null!=e.textureAtlas.texture&&null!=e.headerTexture.texture}function o(e){return e.laserlinesEnabled||e.viewshedEnabled}function u(e){return e.viewshedEnabled}function m(a,i,r){c(a,i,r,r.eye),a.splatFading=i.data.fadingTexture.texture;const{fullHeight:l,fullWidth:n}=r,s=Math.tan(.5*r.fovY),o=s/l*n;e(a.tanFov,o,s),a.focalLength=l/(2*s),t(a.origin,r.eye)}function c(e,t,s,o){const u=t.data;e.splatOrder=u.orderTexture.texture,e.splatAtlas=u.textureAtlas.texture,e.splatHeader=u.headerTexture.texture;const{fullHeight:m,fullWidth:c}=s,d=t.view.qualitySettings.gaussianSplat.minimumPixelRadius;e.minSplatRadius=d*Math.sqrt(c*m)/Math.sqrt(2073600),a(e.tileCameraPosition,o,1/x),i(e.tileCameraPosition,e.tileCameraPosition),a(e.cameraDelta,e.tileCameraPosition,x),r(e.cameraDelta,o,e.cameraDelta),e.slicePlaneLocalOrigin=o;const p=t.clippingBox||n,[f,g,h,v,b,C]=p,[P,M,T]=o;l(e.clipMinCameraRelative,f-P,g-M,h-T),l(e.clipMaxCameraRelative,v-P,b-M,C-T)}const x=2.048;export{s as canRenderGaussianSplats,x as gaussianSplatTileSize,m as prepareGaussianSplatPerspectiveParameters,c as prepareGaussianSplatRenderParameters,u as requiresPreciseColorDepth,o as requiresPreciseDepth};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as n}from"../../webgl.js";import o from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as p,prepareGaussianSplatRenderParameters as h}from"./GaussianSplatRenderUtils.js";import{gaussianSplatDepthPolicy as l}from"../shaders/GaussianSplatDepthPolicy.js";import{G as d}from"../../../../chunks/GaussianSplatShadow.glsl.js";import{GaussianSplatShadowTechnique as c}from"../shaders/GaussianSplatShadowTechnique.js";import{GaussianSplatTechniqueConfiguration as u}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as m}from"../../../webgl/enums.js";let g=class extends o{constructor(e){super(e),this.consumes={required:[n.SHADOWMAP]},this.produces=n.SHADOWMAP,this.layerView=null,this._passParameters=new d,this._cameraPosition=r(),this._configuration=new u(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(c,this._configuration))}render(){const e=this.bindRenderTarget();return this._canRender&&this._render(),e}queryDepthRange(e){return this.layerView.suspended?null:this._data.queryVisibleTileDepthRange(e,this.layerView.clippingBox)}get _data(){return this.layerView.data}get _clippingEnabled(){return null!=this.layerView.clippingBox}get _canRender(){return!this.layerView.suspended&&p(this._data)}_render(){this._updateConfiguration();const e=this.techniques.get(c,this._configuration);this._prepareShadowParameters(this.bindParameters.camera),this.renderingContext.bindTechnique(e,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(m.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_updateConfiguration(){this._configuration.preciseDepth=!0,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.output=8===this.bindParameters.output?8:5}_prepareShadowParameters(e){s(this._passParameters.inverseProjectionMatrix,e.projectionMatrix);const i=this.bindParameters.renderingShadowAnalysisMap?l.accumulated:l.direct;this._passParameters.alphaCutoff=i.alphaCutoff,this._passParameters.depthBias=i.depthBias,this._updateShadowCameraPosition(e),h(this._passParameters,this.layerView,e,this._cameraPosition)}_updateShadowCameraPosition(e){const i=e.viewInverseTransposeMatrix;a(this._cameraPosition,i[3],i[7],i[11])}};e([i()],g.prototype,"consumes",void 0),e([i()],g.prototype,"produces",void 0),e([i({constructOnly:!0})],g.prototype,"layerView",void 0),g=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatShadows")],g);export{g as GaussianSplatShadows};
2
+ import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../../core/accessorSupport/decorators.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as n}from"../../webgl.js";import o from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as p,prepareGaussianSplatRenderParameters as h}from"./GaussianSplatRenderUtils.js";import{gaussianSplatDepthPolicy as l}from"../shaders/GaussianSplatDepthPolicy.js";import{G as d}from"../../../../chunks/GaussianSplatShadow.glsl.js";import{GaussianSplatShadowTechnique as u}from"../shaders/GaussianSplatShadowTechnique.js";import{GaussianSplatTechniqueConfiguration as c}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{PrimitiveType as m}from"../../../webgl/enums.js";let g=class extends o{constructor(e){super(e),this.consumes={required:[n.SHADOWMAP]},this.produces=n.SHADOWMAP,this.layerView=null,this._passParameters=new d,this._cameraPosition=r(),this._configuration=new c(e.view.state.isGlobal)}precompile(){this._canRender&&(this._updateConfiguration(),this.techniques.precompile(u,this._configuration))}render(){const e=this.bindRenderTarget();return this._canRender&&this._render(),e}queryDepthRange(e){return this.layerView.suspended?null:this._data.queryVisibleTileDepthRange(e,this.layerView.clippingBox)}get _data(){return this.layerView.data}get _clippingEnabled(){return null!=this.layerView.clippingBox}get _canRender(){return!this.layerView.suspended&&p(this._data)}_render(){this._updateConfiguration();const e=this.techniques.get(u,this._configuration);this._prepareShadowParameters(this.bindParameters.camera),this.renderingContext.bindTechnique(e,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(m.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_updateConfiguration(){this._configuration.preciseDepth=8===this.bindParameters.output,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this.layerView.slicePlaneEnabled&&null!=this.bindParameters.slicePlane,this._configuration.output=8===this.bindParameters.output?8:5}_prepareShadowParameters(e){s(this._passParameters.inverseProjectionMatrix,e.projectionMatrix);const i=this.bindParameters.renderingShadowAnalysisMap?l.accumulated:l.direct;this._passParameters.alphaCutoff=i.alphaCutoff,this._passParameters.depthBias=i.depthBias,this._updateShadowCameraPosition(e),h(this._passParameters,this.layerView,e,this._cameraPosition)}_updateShadowCameraPosition(e){const i=e.viewInverseTransposeMatrix;a(this._cameraPosition,i[3],i[7],i[11])}};e([i()],g.prototype,"consumes",void 0),e([i()],g.prototype,"produces",void 0),e([i({constructOnly:!0})],g.prototype,"layerView",void 0),g=e([t("esri.views.3d.webgl-engine.lib.GaussianSplatShadows")],g);export{g as GaussianSplatShadows};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as i,everyMap as s}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as g}from"./ChangeSet.js";import{IntersectorResultRay as m}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new _,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return i(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&i(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return s(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get _screenToWorldRatio(){return this.rendererContext.screenToWorldRatio}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=i(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=i(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const s of t)this._geometries.set(s.id,s);const i=this._pending.empty;for(const s of t)this._pending.adds.add(s);switch(i&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,i=this._pending.adds;for(const s of e)i.has(s)?(this._pending.removed.add(s),i.delete(s)):this._pending.removed.has(s)||this._pending.removes.add(s),this._geometries.delete(s.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const i of e){const e=new g;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(i),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,i,s){for(const n of this._geometries.values()){if(!i(n))continue;this._intersectRenderGeometry(n,t,r,0,e,s);const o=this.rendererContext.longitudeCyclical;if(o){const i=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);i[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,s),i[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,s)}s++}return s}*intersectScreenPolygon(e,r,t,i){for(const s of this._geometries.values()){if(!t(s))continue;this._intersectScreenPolygonRenderGeometry(s,r,0,e,i);const n=this.rendererContext.longitudeCyclical;if(n){const t=s.boundingSphere.center,o=this._effectiveGeometryRadius(s);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(s,r,n.range,e,i),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(s,r,-n.range,e,i)}i++,yield}return i}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||this._screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,i,s,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;0===e.type?(i+=e.transformation[12],o=e.transformation[13]):(i+=e.localOrigin.vec3[0],o=e.localOrigin.vec3[1]),v[0]=t[0]-i,v[1]=t[1]-o,e.material.intersectRayDraped(e,s,v,(t,i,o,a)=>{f(r,a,n,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)},r,this._screenToWorldRatio)}_intersectScreenPolygonRenderGeometry(e,r,t,i,s){if(!e.visible||!e.material.visible||!e.material.intersectScreenPolygonDraped)return;0===e.type?d(G,t+e.transformation[12],e.transformation[13]):d(G,t+e.localOrigin.vec3[0],e.localOrigin.vec3[1]);const n=this._screenToWorldRatio;for(const o of r){const r=e.material.intersectScreenPolygonDraped(e,G,i,o,n);if(r)return void R(o.distance,r.primitiveIndex,s,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)}}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return 1===e.type||null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class _{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function f(e,r,t,i,s,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.renderDistance,e.normal,e.transformation,t,i)};if((null==s.results.min.drapedLayerOrder||t>=s.results.min.drapedLayerOrder)&&(null==s.results.min.renderDistance||s.results.ground.renderDistance<=s.results.min.renderDistance)&&d(s.results.min),0!==s.options.store&&(null==s.results.max.drapedLayerOrder||t<s.results.max.drapedLayerOrder)&&(null==s.results.max.renderDistance||s.results.ground.renderDistance>s.results.max.renderDistance)&&d(s.results.max),2===s.options.store){const e=new m(s.ray);d(e),s.results.all.push(e)}}function R(e,r,t,i,s,n,o){s.polygonResults.add(5,new c(n,o,r),e,t,i)}const v=h(),G=h(),C=128;export{y as SortedRenderGeometryRenderer};
2
+ import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as i,everyMap as s}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as p}from"./ChangeSet.js";import{IntersectorResultRay as m}from"./IntersectorResult.js";import{RendererBase as g}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends g{constructor(e){super(e),this._pending=new _,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return i(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&i(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return s(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get _screenToMapUnitsRatio(){return this.rendererContext.screenToMapUnitsRatio}get _mapUnitsToGroundRatio(){return this.rendererContext.mapUnitsToGroundRatio}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=i(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=i(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const s of t)this._geometries.set(s.id,s);const i=this._pending.empty;for(const s of t)this._pending.adds.add(s);switch(i&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,i=this._pending.adds;for(const s of e)i.has(s)?(this._pending.removed.add(s),i.delete(s)):this._pending.removed.has(s)||this._pending.removes.add(s),this._geometries.delete(s.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const i of e){const e=new p;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(i),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,i,s){for(const n of this._geometries.values()){if(!i(n))continue;this._intersectRenderGeometry(n,t,r,0,e,s);const o=this.rendererContext.longitudeCyclical;if(o){const i=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);i[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,s),i[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,s)}s++}return s}*intersectScreenPolygon(e,r,t,i){for(const s of this._geometries.values()){if(!t(s))continue;this._intersectScreenPolygonRenderGeometry(s,r,0,e,i);const n=this.rendererContext.longitudeCyclical;if(n){const t=s.boundingSphere.center,o=this._effectiveGeometryRadius(s);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(s,r,n.range,e,i),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(s,r,-n.range,e,i)}i++,yield}return i}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||this._screenToMapUnitsRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,i,s,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;0===e.type?(i+=e.transformation[12],o=e.transformation[13]):(i+=e.localOrigin.vec3[0],o=e.localOrigin.vec3[1]),G[0]=t[0]-i,G[1]=t[1]-o,e.material.intersectRayDraped(e,s,G,(t,i,o,a)=>{f(r,a,n,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)},r,this._screenToMapUnitsRatio,this._mapUnitsToGroundRatio)}_intersectScreenPolygonRenderGeometry(e,r,t,i,s){if(!e.visible||!e.material.visible||!e.material.intersectScreenPolygonDraped)return;0===e.type?d(v,t+e.transformation[12],e.transformation[13]):d(v,t+e.localOrigin.vec3[0],e.localOrigin.vec3[1]);const n=this._screenToMapUnitsRatio;for(const o of r){const r=e.material.intersectScreenPolygonDraped(e,v,i,o,n,this._mapUnitsToGroundRatio);if(r)return void R(o.distance,r.primitiveIndex,s,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)}}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return 1===e.type||null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class _{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function f(e,r,t,i,s,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.renderDistance,e.normal,e.transformation,t,i)};if((null==s.results.min.drapedLayerOrder||t>=s.results.min.drapedLayerOrder)&&(null==s.results.min.renderDistance||s.results.ground.renderDistance<=s.results.min.renderDistance)&&d(s.results.min),0!==s.options.store&&(null==s.results.max.drapedLayerOrder||t<s.results.max.drapedLayerOrder)&&(null==s.results.max.renderDistance||s.results.ground.renderDistance>s.results.max.renderDistance)&&d(s.results.max),2===s.options.store){const e=new m(s.ray);d(e),s.results.all.push(e)}}function R(e,r,t,i,s,n,o){s.polygonResults.add(5,new c(n,o,r),e,t,i)}const G=h(),v=h(),C=128;export{y as SortedRenderGeometryRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as o,set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as p,subtract as c,dot as m,scale as u,add as h,copy as f,length as d,distance as g,lerp as b,transformMat4 as _,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as w,distance2 as E,closestLineSegmentPoint as v,projectPoint as x,projectPointFraction as T,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as L,getNormal as A,create as C}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as M,BufferViewFloat as F,BufferViewVec4Unorm8 as R,BufferViewVec4f16 as O,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as U,isColor as V,isDepth as I,isColorHighlightOLIDOrDepth as N,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as W}from"../effects/geometry/olidUtils.js";import D from"../lib/GLMaterial.js";import{LineMaterial as Y}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as J,screenPolygonIntersectsBufferedSegment as q}from"../lib/screenPolygonOverlapUtils.js";import{Hit as X,DrapedHit as G}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as H}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as K,assert as Q}from"../lib/Util.js";import{isImagePattern as Z}from"./lineStippleUtils.js";import{VisualVariablePassParameters as $}from"./VisualVariablePassParameters.js";import{writeColor as ee}from"./internal/bufferWriterUtils.js";import{n as te}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as re,getTextureBufferLayout as ie}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as se}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as ne}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as oe}from"../../../../webscene/support/AlphaCutoff.js";class ae extends Y{constructor(e,t){super(e,pe),this.produces=new Map([[2,e=>U(e)||V(e)&&8===this.parameters.renderOccluded],[3,e=>I(e)],[10,e=>N(e)&&8===this.parameters.renderOccluded],[11,e=>N(e)&&8===this.parameters.renderOccluded],[4,e=>V(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>V(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new ne(t)}updateConfiguration(e){super.updateConfiguration(e);const{draped:t}=this._configuration,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&this.parameters.isImagePattern(),s=t&&(this.parameters.worldSized||i);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ge(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&de(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!s,this._configuration.worldSized=s,this._configuration.imagePattern=i}get visible(){return this.parameters.color[3]>=oe||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>oe}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},r,i,s,n,o){if(!r.options.selectionMode)return;const a=this._getLineSize(e,!0),l=i[0],p=i[1],c=he(a,o,this.parameters.worldSized);let m=Number.MAX_VALUE,u=0;for(const h of fe(Pe,ye,this.parameters,e)){const e=l-Pe[0],r=p-Pe[1],i=ye[0]-Pe[0],s=ye[1]-Pe[1],n=t((i*e+s*r)/(i*i+s*s),0,1),o=i*n-e,a=s*n-r,c=o*o+a*a;c<m&&(m=c,u=h)}m<c*c&&s(n.distance,n.renderDistance,n.normal,u)}intersectRay(t,r,i,s,n,a){const{options:l,camera:b,rayBegin:_,rayEnd:S}=i;if(!l.selectionMode||!t.visible||!b)return;if(!K(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,x=this._getLineSize(P),T=je;o(T,i.point);const j=x*b.pixelRatio,C=Ye*b.pixelRatio,M=j/2+C;p(Ve[0],T[0]-M,T[1]+M,0),p(Ve[1],T[0]+M,T[1]+M,0),p(Ve[2],T[0]+M,T[1]-M,0),p(Ve[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(Ve[e],Ie[e]))return;z(b.eye,Ie[0],Ie[1],Ne),z(b.eye,Ie[1],Ie[2],ke),z(b.eye,Ie[2],Ie[3],We),z(b.eye,Ie[3],Ie[0],De);let F=Number.MAX_VALUE,R=0;for(const e of this._forEachTransformedLineSegment(_e,Se,y,r,ue(this.parameters,P))){if(L(Ne,_e)<0&&L(Ne,Se)<0||L(ke,_e)<0&&L(ke,Se)<0||L(We,_e)<0&&L(We,Se)<0||L(De,_e)<0&&L(De,Se)<0)continue;const t=b.projectToRenderScreen(_e,ze),r=b.projectToRenderScreen(Se,Le);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){c(xe,_e,Se);const e=b.frustum,r=-L(e[4],_e)/m(xe,A(e[4]));if(u(xe,xe,r),h(_e,_e,xe),!b.projectToRenderScreen(_e,t))continue}else if(t[2]>0&&r[2]<0){c(xe,Se,_e);const e=b.frustum,t=-L(e[4],Se)/m(xe,A(e[4]));if(u(xe,xe,t),h(Se,Se,xe),!b.projectToRenderScreen(Se,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=w(t,r,Re),s=E(i,T);if(!(s>=F)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,_e,Se,T,b,x,C);if(s>=e*e)continue}F=s,f(Me,_e),f(Fe,Se),R=e}}if(F<M*M){let e=Number.MAX_VALUE;if(v(w(Me,Fe,Re),w(_,S,Oe),Te)){c(Te,Te,_);const t=d(Te);u(Te,Te,1/t),e=t/g(_,S)}a(e,e,Te,R)}}intersectScreenPolygon(t,r,i,s){const{options:n,camera:o,screenPolygonPrimitiveProcessor:a}=i;if(!n.selectionMode||!t.visible)return null;if(!K(r))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,p=l.get("position").data,c=this._getLineSize(l),m=Ye,u=m*o.pixelRatio,h=new X(4);for(const e of this._forEachTransformedLineSegment(_e,Se,p,r,ue(this.parameters,l)))for(const[t,r]of a.processLineSegment(Je,_e,Se)){if(!J(o,t,r,ze,Le))continue;const i=w(ze,Le,Re);let n=c/2+m;this.parameters.screenSizePerspective&&(b(je,ze,Le,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(i,t,r,je,o,c,u)/o.pixelRatio)),o.renderToScreen(ze,Ae),o.renderToScreen(Le,Ce),q(s,Ae,Ce,n)&&(x(w(t,r,Oe),o.eye,we),h.updateIfCloserFromValues(g(o.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e},t,r,i,s){if(!r.options.selectionMode)return null;const n=he(this._getLineSize(e,!0),s,this.parameters.worldSized);for(const o of fe(Pe,ye,this.parameters,e,t))if(q(i,Pe,ye,n))return new G(o);return null}createBufferWriter(){return new ce(re(this.parameters),ie(this.parameters),this.parameters)}createGLMaterial(e){return new le(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,n,o){const a=T(e,i);b(we,t,r,a),_(Ee,we,s.viewMatrix);const l=d(Ee),p=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);be.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,r){return r?S(Te,e):p(Te,0,0,1),c(ve,e,t.eye),S(ve,ve),Math.abs(m(Te,ve))}_getLineSize(e,r=!1){let i=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?r&&(i*=this.parameters.vvSize.fallback[0]):i*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(i*=e.get("size").data[0]);return i}*_forEachTransformedLineSegment(e,t,r,i,s){const n=s?r.length-2:r.length-5;for(let o=0;o<n;o+=3){e[0]=r[o]+i[12],e[1]=r[o+1]+i[13],e[2]=r[o+2]+i[14];const s=(o+3)%r.length;t[0]=r[s]+i[12],t[1]=r[s+1]+i[13],t[2]=r[s+2]+i[14],yield o/3}}}class le extends D{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(se,e)}}class pe extends ${constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Z(this.stipplePattern)&&null!=this.stippleTexture}}class ce{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ge(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return ue(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,n){null!=n&&this._writeTextureBuffer(e,r,n),null!=i&&this._writeVertexBuffer(e,r,i,s)}_writeTextureBuffer(e,t,r){const i=t.get("position"),s=i.data.length/3,n=this._isClosed(t),{buffer:o,offset:a}=r,l=o.getField("position",M),p=o.getField("u0",F),c=o.getField("sizeFeatureAttribute",F),m=o.getField("size",F),u=o.getField("colorFeatureAttribute",F),h=o.getField("color",R),d=o.getField("olidColor",R),b=o.getField("timeStamps",O),_=o.getField("opacityFeatureAttribute",F),S=t.get("sizeFeatureAttribute")?.data,P=t.get("size")?.data,y=t.get("colorFeatureAttribute")?.data,w=t.get("color")?.data,E=t.get("opacityFeatureAttribute")?.data,v=t.get("distanceToStart")?.data,x=t.get("timeStamps");Q(null!==l,"Expected valid position field in texture buffer"),Q(null!==p,"Expected valid u0 field in texture buffer");let T=0;for(let z=0;z<s;++z){this._getTransformedPosition(Ue,i.data,z,e),z>0&&(null!=v?T=v[z]??T:T+=g(Be,Ue));const t=a+z+1;if(l.setVec(t,Ue),p.set(t,T),f(Be,Ue),c&&c.set(t,1===S?.length?S[0]:S?.[z]??0),m&&m.set(t,1===P?.length?P[0]:P?.[z]??1),u&&u.set(t,1===y?.length?y[0]:y?.[z]??0),h)if(null!=w){const e=Math.min(4*z,w.length-4);h.setValues(t,w[e],w[e+1],w[e+2],w[e+3])}else h.setValues(t,1,1,1,1);_&&_.set(t,1===E?.length?E[0]:E?.[z]??0)}if(null!=b&&null!=x){Q(4===x.size);const e=x.data;for(let t=0;t<s;++t){const r=4*t,i=a+t+1;b.set(i,0,e[r]),b.set(i,1,e[r+1]),b.set(i,2,e[r+2]),b.set(i,3,e[r+3])}}if(n){const e=a,t=a+1,r=a+2,i=a+s,n=i+1,c=i+2;o.copyItem(i,e),o.copyItem(t,n),o.copyItem(r,c),l.getVec(i,Be),l.getVec(t,Ue);const m=v?.[s]??T+g(Be,Ue);p.set(n,m)}else{const e=a,t=a+1,r=a+s,i=r+1;o.copyItem(t,e),o.copyItem(r,i)}const j=t.get("olidColor");W()&&null!=j&&null!=d&&ee(j,4,d,a)}_writeVertexBuffer(e,t,r,i){const{buffer:s,offset:n}=r,{layout:o}=this,a=t.get("position"),l=a.indices,p=a.data.length/3,c=this._isClosed(t),m=p+(c?3:2);l&&l.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const u=s.getField("textureElementIndex",B);Q(null!=u,"Missing texture buffer index field"),Q(null!=i,"Using a texture layout, but the texture range for this instance was not provided");const h=i.from;Q(i.numElements===m,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=new Float16Array(s.buffer),g=new Uint32Array(s.buffer),b=o.stride/4;let _=n*b;const S=_,P=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,y=(e,t,r)=>{const i=r+1;g[_]=h+i,_++;let s=_*P;d[s++]=e,d[s++]=t,_=Math.ceil(s/P)};_+=b;let w=0,E=0;c?(w=0,E=p):(y(1,-4,0),y(1,4,0),w=1,E=p-1);for(let v=w;v<E;v++){y(0,-1,v),y(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);y(r,-1,v),y(r,1,v)}y(1,-2,v),y(1,2,v)}c?(y(0,-1,E),y(0,1,E)):(y(0,-5,E),y(0,5,E)),me(f,S+b,f,S,b);_=me(f,_-b,f,_,b),this._parameters.wireframe&&this._addWireframeVertices(s,S,_,b)}_getTransformedPosition(e,t,r,i){const s=3*r;p(e,t[s+0],t[s+1],t[s+2]),i&&_(e,e,i)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),o=i*Float32Array.BYTES_PER_ELEMENT;let a=0;const l=e=>a=me(n,e,s,a,o);for(let p=0;p<=n.length-4*o;p+=2*o)l(p),l(p+2*o),l(p+1*o),l(p+2*o),l(p+1*o),l(p+3*o)}}function me(e,t,r,i,s){for(let n=0;n<s;n++)r[i++]=e[t++];return i}function ue(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function he(e,t,r){return r?e/2+Ye*t:(e/2+Ye)*t}function*fe(e,t,r,i,s){const n=i.get("position").data,l=ue(r,i)?n.length-2:n.length-5,p=s?.[0]??0,c=s?.[1]??0;a(e,n[0]+p,n[1]+c);for(let m=3;m<l+3;m+=3){const r=m%n.length;a(t,n[r]+p,n[r+1]+c),yield m/3,o(e,t)}}function de(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ge(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return te+r}}const be=new H,_e=P(),Se=P(),Pe=l(),ye=l(),we=P(),Ee=P(),ve=P(),xe=P(),Te=P(),je=P(),ze=r(),Le=r(),Ae=i(),Ce=i(),Me=P(),Fe=P(),Re=j(),Oe=j(),Be=P(),Ue=P(),Ve=[r(),r(),r(),r()],Ie=[P(),P(),P(),P()],Ne=C(),ke=C(),We=C(),De=C(),Ye=4,Je=[P(),P()];export{pe as Parameters,ae as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as a,set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as p,subtract as c,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as b,transformMat4 as _,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as w,distance2 as E,closestLineSegmentPoint as v,projectPoint as x,projectPointFraction as T,create as z}from"../../../../geometry/support/lineSegment.js";import{fromPoints as j,signedDistance as L,getNormal as A,create as C}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as M,BufferViewFloat as R,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as O,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as W,isColor as U,isDepth as V,isColorHighlightOLIDOrDepth as I,is2DGeometryOutput as N}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as k}from"../effects/geometry/olidUtils.js";import D from"../lib/GLMaterial.js";import{LineMaterial as Y}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as J,screenPolygonIntersectsBufferedSegment as q}from"../lib/screenPolygonOverlapUtils.js";import{Hit as X,DrapedHit as G}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as H}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as K,assert as Q}from"../lib/Util.js";import{isImagePattern as Z}from"./lineStippleUtils.js";import{VisualVariablePassParameters as $}from"./VisualVariablePassParameters.js";import{writeColor as ee}from"./internal/bufferWriterUtils.js";import{n as te}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as ie,getTextureBufferLayout as re}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as se}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as ne}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class oe extends Y{constructor(e,t){super(e,pe),this.produces=new Map([[2,e=>W(e)||U(e)&&8===this.parameters.renderOccluded],[3,e=>V(e)],[10,e=>I(e)&&8===this.parameters.renderOccluded],[11,e=>I(e)&&8===this.parameters.renderOccluded],[4,e=>U(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>U(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>N(e)]]),this._configuration=new ne(t)}updateConfiguration(e){super.updateConfiguration(e);const{draped:t}=this._configuration,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&this.parameters.isImagePattern(),s=t&&this.parameters.usesWorldSizedWidth(r);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ge(this.parameters.join,i),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&de(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!s,this._configuration.worldSized=s,this._configuration.imagePattern=r}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},i,r,s,n,a,o){if(!i.options.selectionMode)return;const l=this._getLineSize(e,!0),p=r[0],c=r[1],u=he(l,a,o,this.parameters.usesWorldSizedWidth());let m=Number.MAX_VALUE,h=0;for(const f of fe(Pe,ye,this.parameters,e)){const e=p-Pe[0],i=c-Pe[1],r=ye[0]-Pe[0],s=ye[1]-Pe[1],n=t((r*e+s*i)/(r*r+s*s),0,1),a=r*n-e,o=s*n-i,l=a*a+o*o;l<m&&(m=l,h=f)}m<u*u&&s(n.distance,n.renderDistance,n.normal,h)}intersectRay(t,i,r,s,n,o){const{options:l,camera:b,rayBegin:_,rayEnd:S}=r;if(!l.selectionMode||!t.visible||!b)return;if(!K(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,x=this._getLineSize(P),T=ze;a(T,r.point);const z=x*b.pixelRatio,C=Ye*b.pixelRatio,M=z/2+C;p(Ue[0],T[0]-M,T[1]+M,0),p(Ue[1],T[0]+M,T[1]+M,0),p(Ue[2],T[0]+M,T[1]-M,0),p(Ue[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(Ue[e],Ve[e]))return;j(b.eye,Ve[0],Ve[1],Ie),j(b.eye,Ve[1],Ve[2],Ne),j(b.eye,Ve[2],Ve[3],ke),j(b.eye,Ve[3],Ve[0],De);let R=Number.MAX_VALUE,F=0;for(const e of this._forEachTransformedLineSegment(_e,Se,y,i,me(this.parameters,P))){if(L(Ie,_e)<0&&L(Ie,Se)<0||L(Ne,_e)<0&&L(Ne,Se)<0||L(ke,_e)<0&&L(ke,Se)<0||L(De,_e)<0&&L(De,Se)<0)continue;const t=b.projectToRenderScreen(_e,je),i=b.projectToRenderScreen(Se,Le);if(null==t||null==i)continue;if(t[2]<0&&i[2]>0){c(xe,_e,Se);const e=b.frustum,i=-L(e[4],_e)/u(xe,A(e[4]));if(m(xe,xe,i),h(_e,_e,xe),!b.projectToRenderScreen(_e,t))continue}else if(t[2]>0&&i[2]<0){c(xe,Se,_e);const e=b.frustum,t=-L(e[4],Se)/u(xe,A(e[4]));if(m(xe,xe,t),h(Se,Se,xe),!b.projectToRenderScreen(Se,i))continue}else if(t[2]<0&&i[2]<0)continue;t[2]=0,i[2]=0;const r=w(t,i,Fe),s=E(r,T);if(!(s>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(r,_e,Se,T,b,x,C);if(s>=e*e)continue}R=s,f(Me,_e),f(Re,Se),F=e}}if(R<M*M){let e=Number.MAX_VALUE;if(v(w(Me,Re,Fe),w(_,S,Oe),Te)){c(Te,Te,_);const t=d(Te);m(Te,Te,1/t),e=t/g(_,S)}o(e,e,Te,F)}}intersectScreenPolygon(t,i,r,s){const{options:n,camera:a,screenPolygonPrimitiveProcessor:o}=r;if(!n.selectionMode||!t.visible)return null;if(!K(i))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,p=l.get("position").data,c=this._getLineSize(l),u=Ye,m=u*a.pixelRatio,h=new X(4);for(const e of this._forEachTransformedLineSegment(_e,Se,p,i,me(this.parameters,l)))for(const[t,i]of o.processLineSegment(qe,_e,Se)){if(!J(a,t,i,je,Le))continue;const r=w(je,Le,Fe);let n=c/2+u;this.parameters.screenSizePerspective&&(b(ze,je,Le,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(r,t,i,ze,a,c,m)/a.pixelRatio)),a.renderToScreen(je,Ae),a.renderToScreen(Le,Ce),q(s,Ae,Ce,n)&&(x(w(t,i,Oe),a.eye,we),h.updateIfCloserFromValues(g(a.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e},t,i,r,s,n){if(!i.options.selectionMode)return null;const a=he(this._getLineSize(e,!0),s,n,this.parameters.usesWorldSizedWidth());for(const o of fe(Pe,ye,this.parameters,e,t))if(q(r,Pe,ye,a))return new G(o);return null}createBufferWriter(){return new ce(ie(this.parameters),re(this.parameters),this.parameters)}createGLMaterial(e){return new le(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,n,a){const o=T(e,r);b(we,t,i,o),_(Ee,we,s.viewMatrix);const l=d(Ee),p=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);be.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+a}computeCameraAbsCosAngle(e,t,i){return i?S(Te,e):p(Te,0,0,1),c(ve,e,t.eye),S(ve,ve),Math.abs(u(Te,ve))}_getLineSize(e,i=!1){let r=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?i&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(r*=e.get("size").data[0]);return r}*_forEachTransformedLineSegment(e,t,i,r,s){const n=s?i.length-2:i.length-5;for(let a=0;a<n;a+=3){e[0]=i[a]+r[12],e[1]=i[a+1]+r[13],e[2]=i[a+2]+r[14];const s=(a+3)%i.length;t[0]=i[s]+r[12],t[1]=i[s+1]+r[13],t[2]=i[s+2]+r[14],yield a/3}}}class le extends D{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(se,e)}}class pe extends ${constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return Z(this.stipplePattern)&&null!=this.stippleTexture}}class ce{constructor(e,t,i){this.layout=e,this.textureBufferLayout=t,this._parameters=i,this.numJoinSubdivisions=ge(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return me(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,n){null!=n&&this._writeTextureBuffer(e,i,n),null!=r&&this._writeVertexBuffer(e,i,r,s)}_writeTextureBuffer(e,t,i){const r=t.get("position"),s=r.data.length/3,n=this._isClosed(t),{buffer:a,offset:o}=i,l=a.getField("position",M),p=a.getField("u0",R),c=a.getField("sizeFeatureAttribute",R),u=a.getField("size",R),m=a.getField("colorFeatureAttribute",R),h=a.getField("color",F),d=a.getField("olidColor",F),b=a.getField("timeStamps",O),_=a.getField("opacityFeatureAttribute",R),S=t.get("sizeFeatureAttribute")?.data,P=t.get("size")?.data,y=t.get("colorFeatureAttribute")?.data,w=t.get("color")?.data,E=t.get("opacityFeatureAttribute")?.data,v=t.get("distanceToStart")?.data,x=t.get("timeStamps");Q(null!==l,"Expected valid position field in texture buffer"),Q(null!==p,"Expected valid u0 field in texture buffer");let T=0;for(let j=0;j<s;++j){this._getTransformedPosition(We,r.data,j,e),j>0&&(null!=v?T=v[j]??T:T+=g(Be,We));const t=o+j+1;if(l.setVec(t,We),p.set(t,T),f(Be,We),c&&c.set(t,1===S?.length?S[0]:S?.[j]??0),u&&u.set(t,1===P?.length?P[0]:P?.[j]??1),m&&m.set(t,1===y?.length?y[0]:y?.[j]??0),h)if(null!=w){const e=Math.min(4*j,w.length-4);h.setValues(t,w[e],w[e+1],w[e+2],w[e+3])}else h.setValues(t,1,1,1,1);_&&_.set(t,1===E?.length?E[0]:E?.[j]??0)}if(null!=b&&null!=x){Q(4===x.size);const e=x.data;for(let t=0;t<s;++t){const i=4*t,r=o+t+1;b.set(r,0,e[i]),b.set(r,1,e[i+1]),b.set(r,2,e[i+2]),b.set(r,3,e[i+3])}}if(n){const e=o,t=o+1,i=o+2,r=o+s,n=r+1,c=r+2;a.copyItem(r,e),a.copyItem(t,n),a.copyItem(i,c),l.getVec(r,Be),l.getVec(t,We);const u=v?.[s]??T+g(Be,We);p.set(n,u)}else{const e=o,t=o+1,i=o+s,r=i+1;a.copyItem(t,e),a.copyItem(i,r)}const z=t.get("olidColor");k()&&null!=z&&null!=d&&ee(z,4,d,o)}_writeVertexBuffer(e,t,i,r){const{buffer:s,offset:n}=i,{layout:a}=this,o=t.get("position"),l=o.indices,p=o.data.length/3,c=this._isClosed(t),u=p+(c?3:2);l&&l.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",B);Q(null!=m,"Missing texture buffer index field"),Q(null!=r,"Using a texture layout, but the texture range for this instance was not provided");const h=r.from;Q(r.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=new Float16Array(s.buffer),g=new Uint32Array(s.buffer),b=a.stride/4;let _=n*b;const S=_,P=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,y=(e,t,i)=>{const r=i+1;g[_]=h+r,_++;let s=_*P;d[s++]=e,d[s++]=t,_=Math.ceil(s/P)};_+=b;let w=0,E=0;c?(w=0,E=p):(y(1,-4,0),y(1,4,0),w=1,E=p-1);for(let v=w;v<E;v++){y(0,-1,v),y(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const i=(t+1)/(e+1);y(i,-1,v),y(i,1,v)}y(1,-2,v),y(1,2,v)}c?(y(0,-1,E),y(0,1,E)):(y(0,-5,E),y(0,5,E)),ue(f,S+b,f,S,b);_=ue(f,_-b,f,_,b),this._parameters.wireframe&&this._addWireframeVertices(s,S,_,b)}_getTransformedPosition(e,t,i,r){const s=3*i;p(e,t[s+0],t[s+1],t[s+2]),r&&_(e,e,r)}_addWireframeVertices(e,t,i,r){const s=new Uint8Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(i-t)*Float32Array.BYTES_PER_ELEMENT),a=r*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ue(n,e,s,o,a);for(let p=0;p<=n.length-4*a;p+=2*a)l(p),l(p+2*a),l(p+1*a),l(p+2*a),l(p+1*a),l(p+3*a)}}function ue(e,t,i,r,s){for(let n=0;n<s;n++)i[r++]=e[t++];return r}function me(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function he(e,t,i,r){return r?e/(2*i)+Ye*t:(e/2+Ye)*t}function*fe(e,t,i,r,s){const n=r.get("position").data,l=me(i,r)?n.length-2:n.length-5,p=s?.[0]??0,c=s?.[1]??0;o(e,n[0]+p,n[1]+c);for(let u=3;u<l+3;u+=3){const i=u%n.length;o(t,n[i]+p,n[i+1]+c),yield u/3,a(e,t)}}function de(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ge(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return te+i}}const be=new H,_e=P(),Se=P(),Pe=l(),ye=l(),we=P(),Ee=P(),ve=P(),xe=P(),Te=P(),ze=P(),je=i(),Le=i(),Ae=r(),Ce=r(),Me=P(),Re=P(),Fe=z(),Oe=z(),Be=P(),We=P(),Ue=[i(),i(),i(),i()],Ve=[P(),P(),P(),P()],Ie=C(),Ne=C(),ke=C(),De=C(),Ye=4,Je={getDrapedRibbonLineMaxDistance:he},qe=[P(),P()];export{pe as Parameters,oe as RibbonLineMaterial,Je as test};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{byId as t,reparent as i}from"../core/domUtils.js";import{on as s}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import n from"../core/Logger.js";import{destroyMaybe as r,removeMaybe as a}from"../core/maybe.js";import{watch as l,initial as h,syncAndInitial as u}from"../core/reactiveUtils.js";import{addFrameTask as d}from"../core/scheduling.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import{Attribution as g}from"./Attribution.js";import m from"./overlay/FocusRegionOverlayItem.js";import f from"./overlay/ViewOverlay.js";const y=[0,0];function v(e){const t=(e.ownerDocument||window.document).defaultView,i=e.getBoundingClientRect();return y[0]=i.left+(t?.pageXOffset??0),y[1]=i.top+(t?.pageYOffset??0),y}function _(e){e&&(e.textContent="",e.parentNode&&e.parentNode.removeChild(e))}const b="test"===process.env.NODE_ENV,R=b?0:16,w=b?0:750,O=b?0:512,E=2,I=50,C={toggle:"KeyO",resizeLarger:"ArrowUp",resizeSmaller:"ArrowDown",select:new Set(["Enter","Space"])},H=y=>{const b=y;let H=class extends b{constructor(...e){super(...e),this._freqInfo={freq:R,time:w},this._overlayRenderTaskHandle=null,this._focusRegionOverlayItem=new m,this.aria={},this.attributionMode=null,this.height=0,this.focusRegionEnabled=!1,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([l(()=>[this.focusRegionEnabled,this.overlay],()=>this._syncFocusRegionOverlayItemVisibility(this.focusRegionEnabled),{initial:!0}),l(()=>this.cursor,e=>{const{surface:t}=this;t&&t.setAttribute("data-cursor",e)}),l(()=>this.navigating,e=>{const{surface:t}=this;t&&t.setAttribute("data-navigating",e.toString())}),l(()=>[this.aria,this.surface],()=>this._updateAria(),{initial:!0}),l(()=>[this.width,this.height],([e,t])=>{const{_focusRegionOverlayItem:i}=this;i.backgroundHeight=t,i.backgroundWidth=e,i.updateBoxSize()})])}initialize(){const e=this;this.addHandles([l(()=>this.ui,(e,t)=>this._handleUIChange(e,t),h),e.on("focus",()=>this.notifyChange("focused")),e.on("blur",()=>this.notifyChange("focused")),e.on("key-down",t=>{const{shiftKey:i,altKey:s,code:o,defaultPrevented:n}=t.native,{toggle:r,resizeLarger:a,resizeSmaller:l,select:h}=C,u=this.focusRegionEnabled&&i&&s&&(o===a||o===l);if(!t.repeat||u){if(!n&&i&&s&&o===r)return this._toggleFocusRegion(),void t.preventDefault();if(!n&&u){const{_focusRegionOverlayItem:e}=this;return e.resizeBoxSize(o===a?I:-I),t.preventDefault(),t.native.stopPropagation(),void t.stopPropagation()}!n&&this.focusRegionEnabled&&h.has(o)&&this._selectFocusRegion(t,e)}})])}destroy(){this.destroyed||(this.focusRegionEnabled=!1,this._syncFocusRegionOverlayItemVisibility(!1),this.ui?.destroy(),this.container=null)}get attributionHeight(){return this._attribution?.height??0}get container(){return this._get("container")??null}set container(e){const s=this._get("container"),o=t(e);if(o||"string"!=typeof e||n.getLogger(this).error("#container",`element with id '${e}' not found`),s===o)return;if(this._stopMeasuring(),this.removeHandles("container"),s&&(s.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this._attribution=r(this._attribution),this.root&&(_(this.root),this._set("root",null)),this.userContent&&(i(this.userContent,s),_(this.userContent),this._set("userContent",null))),!o)return this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),void this._set("container",null);o.classList.add("esri-view");const c=document.createElement("div");c.className="esri-view-user-storage",i(o,c),o.appendChild(c),this._set("userContent",c);const p=document.createElement("div");p.className="esri-view-root",o.insertBefore(p,o.firstChild),this._set("root",p);const m=document.createElement("div");m.className="esri-view-surface",m.setAttribute("role","application"),m.tabIndex=0,p.appendChild(m),this._set("surface",m);const y=new f;p.appendChild(y.surface),this._set("overlay",y),this._syncFocusRegionOverlayItemVisibility(this.focusRegionEnabled),this.addHandles(l(()=>y.needsRender,e=>{e&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=d({render:()=>this.overlay?.render()}):this._overlayRenderTaskHandle=a(this._overlayRenderTaskHandle)},h),"container"),this.addHandles([l(()=>({visible:this.attributionVisible,items:this.attributionItems,mode:this.attributionMode}),({visible:e,items:t,mode:i})=>{e?(this._attribution||(this._attribution=new g({attributionItems:this.attributionItems,mode:this.attributionMode})),this._attribution.appendBefore(p,this.ui?.container??null),this._attribution.attributionItems=t,this._attribution.mode=i):this._attribution=r(this._attribution)},u)],"container"),this.forceDOMReadyCycle(),this._set("container",o),this._startMeasuring()}get focused(){const e=document.activeElement===this.surface;return document.hasFocus()&&e}get focusRegion(){return this.focusRegionEnabled?this._focusRegionOverlayItem.getScreenRect():null}get size(){return[this.width,this.height]}get ui(){return this._get("ui")}set ui(e){const t=this._get("ui");t!==e&&t?.destroy(),this._set("ui",e)}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(e,t,i){const s=this.position;return e-=s?s[0]:0,t-=s?s[1]:0,i?(i[0]=e,i[1]=t):i=[e,t],i}containerToPage(e,t,i){const s=this.position;return e+=s?s[0]:0,t+=s?s[1]:0,i?(i[0]=e,i[1]=t):i=[e,t],i}_updateAria(){const{surface:e,aria:t}=this;e&&(e.ariaLabelledByElements=t?.labelledByElements??null,e.ariaDescribedByElements=t?.describedByElements??null,e.ariaLabel=t?.label??null,e.ariaDescription=t?.description??null)}_selectFocusRegion(e,t){const i=this._makeFocusRegionSelectEvent(e);t.emit("focus-region-select",i),e.preventDefault()}_makeFocusRegionSelectEvent(e){const t={type:"focus-region-select",native:e.native,defaultPrevented:!1,preventDefault:()=>{t.defaultPrevented=!0},stopPropagation:()=>{e.stopPropagation()}};return t}_toggleFocusRegion(){this.focusRegionEnabled=!this.focusRegionEnabled}_updateFocusRegionOverlayItem(){const{_focusRegionOverlayItem:e}=this;e.backgroundHeight=this.height,e.backgroundWidth=this.width,e.updateBoxSize()}_syncFocusRegionOverlayItemVisibility(e){const{_focusRegionOverlayItem:t,overlay:i}=this,s=e;t.visible=s,i&&(i.removeItem(t),s&&(this._updateFocusRegionOverlayItem(),i.addItem(t)))}_handleUIChange(e,t){this.removeHandles("ui"),t&&t!==e&&t.destroy(),e&&(e.view=this,this.addHandles(l(()=>this.root,t=>{if(t){const i=document.createElement("div");t.insertBefore(i,this._attribution?.surface??null),e.container=i}else e.container=null},h),"ui")),this._set("ui",e)}_stopMeasuring(){this.removeHandles("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const e=this._freqInfo;e.freq=R,e.time=w;const t=d({prepare:e=>{const i=this._measure(),s=this._freqInfo;if(s.time+=e.deltaTime,i&&(s.freq=R,this._get("resizing")||this._set("resizing",!0)),s.time<s.freq)return;s.time=0;const o=this._position();s.freq=o||i?R:Math.min(w,s.freq*E),!i&&s.freq>=O&&(t.pause(),this._get("resizing")&&this._set("resizing",!1))}}),i=new ResizeObserver(i=>{e.freq=R,e.time=w,t.resume()});null!=this.container&&i.observe(this.container);const n=o(()=>i.disconnect());this.addHandles([s(window,"resize",()=>{e.freq=R,e.time=w,t.resume()}),n,t],"measuring"),this._measure(),this._position()}_measure(){const e=this.container,t=e?e.clientWidth:0,i=e?e.clientHeight:0;if(0===t||0===i)return this.suspended||this._set("suspended",!0),!1;const s=this.width,o=this.height;if(t===s&&i===o)return this.suspended&&this._set("suspended",!1),!1;this._set("width",t),this._set("height",i),this.suspended&&this._set("suspended",!1);return this.emit("resize",{oldWidth:s,oldHeight:o,width:t,height:i}),!0}_position(){const e=this.container,t=this.position,i=e&&v(e);return!!i&&((!t||i[0]!==t[0]||i[1]!==t[1])&&(this._set("position",[i[0],i[1]]),!0))}forceDOMReadyCycle(){}};return e([c()],H.prototype,"_attribution",void 0),e([c()],H.prototype,"aria",void 0),e([c()],H.prototype,"attributionHeight",null),e([c()],H.prototype,"attributionMode",void 0),e([c()],H.prototype,"container",null),e([c({readOnly:!0})],H.prototype,"focused",null),e([c({readOnly:!0})],H.prototype,"height",void 0),e([c()],H.prototype,"focusRegionEnabled",void 0),e([c()],H.prototype,"focusRegion",null),e([c()],H.prototype,"messagesCommon",void 0),e([c({type:f})],H.prototype,"overlay",void 0),e([c({readOnly:!0})],H.prototype,"position",void 0),e([c({readOnly:!0})],H.prototype,"resizing",void 0),e([c({readOnly:!0})],H.prototype,"root",void 0),e([c({value:null,readOnly:!0})],H.prototype,"size",null),e([c({readOnly:!0})],H.prototype,"surface",void 0),e([c({readOnly:!0})],H.prototype,"suspended",void 0),e([c({nonNullable:!0})],H.prototype,"ui",null),e([c({readOnly:!0})],H.prototype,"userContent",void 0),e([c({readOnly:!0})],H.prototype,"width",void 0),e([c()],H.prototype,"widthBreakpoint",void 0),H=e([p("esri.views.DOMContainer")],H),H};export{H as DOMContainer};
2
+ import{__decorate as t}from"tslib";import{byId as e,reparent as i}from"../core/domUtils.js";import{on as s}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import n from"../core/Logger.js";import{destroyMaybe as r,removeMaybe as a}from"../core/maybe.js";import{watch as l,initial as h,syncAndInitial as u}from"../core/reactiveUtils.js";import{addFrameTask as d}from"../core/scheduling.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import{Attribution as g}from"./Attribution.js";import m from"./overlay/FocusRegionOverlayItem.js";import f from"./overlay/ViewOverlay.js";const y=[0,0];function v(t){const e=(t.ownerDocument||window.document).defaultView,i=t.getBoundingClientRect();return y[0]=i.left+(e?.pageXOffset??0),y[1]=i.top+(e?.pageYOffset??0),y}function _(t){t&&(t.textContent="",t.parentNode&&t.parentNode.removeChild(t))}const b="test"===process.env.NODE_ENV,R=b?0:16,w=b?0:750,O=b?0:512,E=2,I=50,C={left:0,top:0,right:0,bottom:0},H={toggle:"KeyO",resizeLarger:"ArrowUp",resizeSmaller:"ArrowDown",select:new Set(["Enter","Space"])},z=y=>{const b=y;let z=class extends b{constructor(...t){super(...t),this._freqInfo={freq:R,time:w},this._overlayRenderTaskHandle=null,this._focusRegionOverlayItem=new m,this.aria={},this.attributionMode=null,this.height=0,this.focusRegionEnabled=!1,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([l(()=>[this.focusRegionEnabled,this.overlay],()=>this._syncFocusRegionOverlayItemVisibility(this.focusRegionEnabled),{initial:!0}),l(()=>this.cursor,t=>{const{surface:e}=this;e&&e.setAttribute("data-cursor",t)}),l(()=>this.navigating,t=>{const{surface:e}=this;e&&e.setAttribute("data-navigating",t.toString())}),l(()=>[this.aria,this.surface],()=>this._updateAria(),{initial:!0}),l(()=>{const{left:t,top:e,right:i,bottom:s}=this.padding??C;return[this.width,this.height,t,e,i,s]},([t,e,i,s,o,n])=>{const{_focusRegionOverlayItem:r}=this;r.backgroundHeight=e,r.backgroundWidth=t,r.padding={left:i,top:s,right:o,bottom:n},r.updateBoxSize()})])}initialize(){const t=this;this.addHandles([l(()=>this.ui,(t,e)=>this._handleUIChange(t,e),h),t.on("focus",()=>this.notifyChange("focused")),t.on("blur",()=>this.notifyChange("focused")),t.on("key-down",e=>{const{shiftKey:i,altKey:s,code:o,defaultPrevented:n}=e.native,{toggle:r,resizeLarger:a,resizeSmaller:l,select:h}=H,u=this.focusRegionEnabled&&i&&s&&(o===a||o===l);if(!e.repeat||u){if(!n&&i&&s&&o===r)return this._toggleFocusRegion(),void e.preventDefault();if(!n&&u){const{_focusRegionOverlayItem:t}=this;return t.resizeBoxSize(o===a?I:-I),e.preventDefault(),e.native.stopPropagation(),void e.stopPropagation()}!n&&this.focusRegionEnabled&&h.has(o)&&this._selectFocusRegion(e,t)}})])}destroy(){this.destroyed||(this.focusRegionEnabled=!1,this._syncFocusRegionOverlayItemVisibility(!1),this.ui?.destroy(),this.container=null)}get attributionHeight(){return this._attribution?.height??0}get container(){return this._get("container")??null}set container(t){const s=this._get("container"),o=e(t);if(o||"string"!=typeof t||n.getLogger(this).error("#container",`element with id '${t}' not found`),s===o)return;if(this._stopMeasuring(),this.removeHandles("container"),s&&(s.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this._attribution=r(this._attribution),this.root&&(_(this.root),this._set("root",null)),this.userContent&&(i(this.userContent,s),_(this.userContent),this._set("userContent",null))),!o)return this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),void this._set("container",null);o.classList.add("esri-view");const c=document.createElement("div");c.className="esri-view-user-storage",i(o,c),o.appendChild(c),this._set("userContent",c);const p=document.createElement("div");p.className="esri-view-root",o.insertBefore(p,o.firstChild),this._set("root",p);const m=document.createElement("div");m.className="esri-view-surface",m.setAttribute("role","application"),m.tabIndex=0,p.appendChild(m),this._set("surface",m);const y=new f;p.appendChild(y.surface),this._set("overlay",y),this._syncFocusRegionOverlayItemVisibility(this.focusRegionEnabled),this.addHandles(l(()=>y.needsRender,t=>{t&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=d({render:()=>this.overlay?.render()}):this._overlayRenderTaskHandle=a(this._overlayRenderTaskHandle)},h),"container"),this.addHandles([l(()=>({visible:this.attributionVisible,items:this.attributionItems,mode:this.attributionMode}),({visible:t,items:e,mode:i})=>{t?(this._attribution||(this._attribution=new g({attributionItems:this.attributionItems,mode:this.attributionMode})),this._attribution.appendBefore(p,this.ui?.container??null),this._attribution.attributionItems=e,this._attribution.mode=i):this._attribution=r(this._attribution)},u)],"container"),this.forceDOMReadyCycle(),this._set("container",o),this._startMeasuring()}get focused(){const t=document.activeElement===this.surface;return document.hasFocus()&&t}get focusRegion(){return this.focusRegionEnabled?this._focusRegionOverlayItem.getScreenRect():null}get size(){return[this.width,this.height]}get ui(){return this._get("ui")}set ui(t){const e=this._get("ui");e!==t&&e?.destroy(),this._set("ui",t)}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(t,e,i){const s=this.position;return t-=s?s[0]:0,e-=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}containerToPage(t,e,i){const s=this.position;return t+=s?s[0]:0,e+=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}_updateAria(){const{surface:t,aria:e}=this;t&&(t.ariaLabelledByElements=e?.labelledByElements??null,t.ariaDescribedByElements=e?.describedByElements??null,t.ariaLabel=e?.label??null,t.ariaDescription=e?.description??null)}_selectFocusRegion(t,e){const i=this._makeFocusRegionSelectEvent(t);e.emit("focus-region-select",i),t.preventDefault()}_makeFocusRegionSelectEvent(t){const e={type:"focus-region-select",native:t.native,defaultPrevented:!1,preventDefault:()=>{e.defaultPrevented=!0},stopPropagation:()=>{t.stopPropagation()}};return e}_toggleFocusRegion(){this.focusRegionEnabled=!this.focusRegionEnabled}_updateFocusRegionOverlayItem(){const{_focusRegionOverlayItem:t}=this;t.backgroundHeight=this.height,t.backgroundWidth=this.width,t.padding=this.padding??C,t.updateBoxSize()}_syncFocusRegionOverlayItemVisibility(t){const{_focusRegionOverlayItem:e,overlay:i}=this,s=t;e.visible=s,i&&(i.removeItem(e),s&&(this._updateFocusRegionOverlayItem(),i.addItem(e)))}_handleUIChange(t,e){this.removeHandles("ui"),e&&e!==t&&e.destroy(),t&&(t.view=this,this.addHandles(l(()=>this.root,e=>{if(e){const i=document.createElement("div");e.insertBefore(i,this._attribution?.surface??null),t.container=i}else t.container=null},h),"ui")),this._set("ui",t)}_stopMeasuring(){this.removeHandles("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const t=this._freqInfo;t.freq=R,t.time=w;const e=d({prepare:t=>{const i=this._measure(),s=this._freqInfo;if(s.time+=t.deltaTime,i&&(s.freq=R,this._get("resizing")||this._set("resizing",!0)),s.time<s.freq)return;s.time=0;const o=this._position();s.freq=o||i?R:Math.min(w,s.freq*E),!i&&s.freq>=O&&(e.pause(),this._get("resizing")&&this._set("resizing",!1))}}),i=new ResizeObserver(i=>{t.freq=R,t.time=w,e.resume()});null!=this.container&&i.observe(this.container);const n=o(()=>i.disconnect());this.addHandles([s(window,"resize",()=>{t.freq=R,t.time=w,e.resume()}),n,e],"measuring"),this._measure(),this._position()}_measure(){const t=this.container,e=t?t.clientWidth:0,i=t?t.clientHeight:0;if(0===e||0===i)return this.suspended||this._set("suspended",!0),!1;const s=this.width,o=this.height;if(e===s&&i===o)return this.suspended&&this._set("suspended",!1),!1;this._set("width",e),this._set("height",i),this.suspended&&this._set("suspended",!1);return this.emit("resize",{oldWidth:s,oldHeight:o,width:e,height:i}),!0}_position(){const t=this.container,e=this.position,i=t&&v(t);return!!i&&((!e||i[0]!==e[0]||i[1]!==e[1])&&(this._set("position",[i[0],i[1]]),!0))}forceDOMReadyCycle(){}};return t([c()],z.prototype,"_attribution",void 0),t([c()],z.prototype,"aria",void 0),t([c()],z.prototype,"attributionHeight",null),t([c()],z.prototype,"attributionMode",void 0),t([c()],z.prototype,"container",null),t([c({readOnly:!0})],z.prototype,"focused",null),t([c({readOnly:!0})],z.prototype,"height",void 0),t([c()],z.prototype,"focusRegionEnabled",void 0),t([c()],z.prototype,"focusRegion",null),t([c()],z.prototype,"messagesCommon",void 0),t([c({type:f})],z.prototype,"overlay",void 0),t([c({readOnly:!0})],z.prototype,"position",void 0),t([c({readOnly:!0})],z.prototype,"resizing",void 0),t([c({readOnly:!0})],z.prototype,"root",void 0),t([c({value:null,readOnly:!0})],z.prototype,"size",null),t([c({readOnly:!0})],z.prototype,"surface",void 0),t([c({readOnly:!0})],z.prototype,"suspended",void 0),t([c({nonNullable:!0})],z.prototype,"ui",null),t([c({readOnly:!0})],z.prototype,"userContent",void 0),t([c({readOnly:!0})],z.prototype,"width",void 0),t([c()],z.prototype,"widthBreakpoint",void 0),z=t([p("esri.views.DOMContainer")],z),z};export{z as DOMContainer};