@arcgis/core 6.0.0-next.40 → 6.0.0-next.42

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 (529) hide show
  1. package/Camera.js +1 -1
  2. package/applications/Components/arcadeFeatureUtils.d.ts +12 -0
  3. package/applications/Components/arcadeFeatureUtils.js +1 -1
  4. package/arcgisGlobal.d.ts +0 -2
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/00d43f02119167531d1b.js +1 -0
  7. package/assets/esri/core/workers/chunks/{1c406ab2bf99ac563316.js → 0696fa44a04b99738d7b.js} +1 -1
  8. package/assets/esri/core/workers/chunks/075fe33152fd79fe6d72.js +1 -0
  9. package/assets/esri/core/workers/chunks/098ac10877d92fde1006.js +1 -0
  10. package/assets/esri/core/workers/chunks/0a29d87b6e58a3c6df8f.js +1 -0
  11. package/assets/esri/core/workers/chunks/0d04353843ccb7440342.js +1 -0
  12. package/assets/esri/core/workers/chunks/0d87cb6417672de95d53.js +1 -0
  13. package/assets/esri/core/workers/chunks/11877d4dc97f756e4711.js +1 -0
  14. package/assets/esri/core/workers/chunks/1860104c2b33f68785dd.js +1 -0
  15. package/assets/esri/core/workers/chunks/1980fd7ae1617ef4d19d.js +1 -0
  16. package/assets/esri/core/workers/chunks/1c7096eb48a3a7f27d4f.js +1 -0
  17. package/assets/esri/core/workers/chunks/1cc03067f8405285057c.js +1 -0
  18. package/assets/esri/core/workers/chunks/{14d81280807a3d3c1b7e.js → 244ffdb91237d1cbade3.js} +1 -1
  19. package/assets/esri/core/workers/chunks/24bdeafbb16ae83bb8c3.js +1 -0
  20. package/assets/esri/core/workers/chunks/2690d5fcd9d5ca92ebf6.js +1 -0
  21. package/assets/esri/core/workers/chunks/2b27d3bc492e000bbe58.js +1 -0
  22. package/assets/esri/core/workers/chunks/2d64a13c2303e9cae613.js +1 -0
  23. package/assets/esri/core/workers/chunks/2e760d04641755d1820d.js +1 -0
  24. package/assets/esri/core/workers/chunks/{0b21d0e2e5a91c34a108.js → 2f54e4feb554c1a7b9c4.js} +1 -1
  25. package/assets/esri/core/workers/chunks/348f28d7ab46df878c6f.js +1 -0
  26. package/assets/esri/core/workers/chunks/{7023651ed6398dcf8efb.js → 36bafcc29ac133a05558.js} +7 -7
  27. package/assets/esri/core/workers/chunks/36e5f070009b29b7ac3d.js +1 -0
  28. package/assets/esri/core/workers/chunks/39c23a52d7c3e1ee121c.js +1 -0
  29. package/assets/esri/core/workers/chunks/{5504ec9bd9ee4d10af07.js → 3f74c61359b4bd6dcf00.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{00311d1b18d5952a014b.js → 446d172834f8675f1202.js} +1 -1
  31. package/assets/esri/core/workers/chunks/45aaefbdffe5e15dfb24.js +1 -0
  32. package/assets/esri/core/workers/chunks/48c6230b8a6d3a8a7906.js +1 -0
  33. package/assets/esri/core/workers/chunks/4c73c493dabe949c2512.js +1 -0
  34. package/assets/esri/core/workers/chunks/{592b5db1459c02cf6a0c.js → 4d62877f521cc9663535.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{2fcd7db1e192858a650e.js → 503ee206e7de1f65e291.js} +1 -1
  36. package/assets/esri/core/workers/chunks/55c0c074e4afe05f5d4d.js +1 -0
  37. package/assets/esri/core/workers/chunks/5bfb962ca192f90a2724.js +1 -0
  38. package/assets/esri/core/workers/chunks/{76e80381fa6d1e084796.js → 5dea74fe52583e77f3ce.js} +1 -1
  39. package/assets/esri/core/workers/chunks/6699fac01ccd842851ba.js +1 -0
  40. package/assets/esri/core/workers/chunks/672a5390182b20d632be.js +1 -0
  41. package/assets/esri/core/workers/chunks/67c2e5953087dadfd245.js +1 -0
  42. package/assets/esri/core/workers/chunks/67caef2ecf0dc5f2eed3.js +1 -0
  43. package/assets/esri/core/workers/chunks/68fd7b314377d27aaa54.js +1 -0
  44. package/assets/esri/core/workers/chunks/6d863761f29f31a030eb.js +1 -0
  45. package/assets/esri/core/workers/chunks/{ce8ef2eec290e1df6b2a.js → 7390af96250e89194332.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7452b5ae971a9ff2e6e9.js +1 -0
  47. package/assets/esri/core/workers/chunks/7672c123cfb960f4ddad.js +1 -0
  48. package/assets/esri/core/workers/chunks/{9934e8e19f94e9169eea.js → 776b64a1e1a57878c34c.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{1ec772eaa63eb6937231.js → 8140ed6e44c3d8536d3e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{58716a3a6106a1b0fb9d.js → 832c887fdc5af4c08cf2.js} +1 -1
  51. package/assets/esri/core/workers/chunks/84fb27e3425515cd0e3f.js +1 -0
  52. package/assets/esri/core/workers/chunks/867502158997cb2d6406.js +1 -0
  53. package/assets/esri/core/workers/chunks/8ceb6697e8adbeffe019.js +1 -0
  54. package/assets/esri/core/workers/chunks/8fe22c2370219f25c15b.js +1 -0
  55. package/assets/esri/core/workers/chunks/91586bf29492735e692d.js +1 -0
  56. package/assets/esri/core/workers/chunks/{b2d6b1ac9fbb50c7c8ab.js → 929ca32ddbb43328ef31.js} +1 -1
  57. package/assets/esri/core/workers/chunks/a03f15f2cbc3fed291c2.js +1 -0
  58. package/assets/esri/core/workers/chunks/{123541f79be7adff0818.js → a422a801e55fa125546e.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{22e73501e1435a896826.js → a5f17e9a025ac2b6e1bf.js} +1 -1
  60. package/assets/esri/core/workers/chunks/a6e846361bf5dd3a11c7.js +1 -0
  61. package/assets/esri/core/workers/chunks/{fd967a9f3cf0e2890dbb.js → a91dc05a6a609d04ed04.js} +1 -1
  62. package/assets/esri/core/workers/chunks/a99c50b4e1c7568210e1.js +1 -0
  63. package/assets/esri/core/workers/chunks/ab48faea5432e2dbd45c.js +1 -0
  64. package/assets/esri/core/workers/chunks/afe3e89737fb45189a99.js +1 -0
  65. package/assets/esri/core/workers/chunks/b18459c1bed75dbdec08.js +1 -0
  66. package/assets/esri/core/workers/chunks/{d03b82e962c70a3fd377.js → b4928831a2a13b2da745.js} +1 -1
  67. package/assets/esri/core/workers/chunks/b7205620ca248f4efc88.js +1 -0
  68. package/assets/esri/core/workers/chunks/bbddeb1c893ff8bbae5d.js +1 -0
  69. package/assets/esri/core/workers/chunks/bc2e2bdf1194e6e9eb5e.js +1 -0
  70. package/assets/esri/core/workers/chunks/{dae2036faa28dade2119.js → beccbfff549902733c4e.js} +1 -1
  71. package/assets/esri/core/workers/chunks/c3ba1a3247e14f6b7b3a.js +1 -0
  72. package/assets/esri/core/workers/chunks/c5d0a034ff31d5954571.js +1 -0
  73. package/assets/esri/core/workers/chunks/{396299c22994c502e41c.js → c8057b47c7c6c02a0bda.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{9e2c30b67bab5795306e.js → cb2329d1ea72ce5cc057.js} +1 -1
  75. package/assets/esri/core/workers/chunks/cd46d9b4a8de644e7332.js +1 -0
  76. package/assets/esri/core/workers/chunks/d0172d31389dbfaaa848.js +1 -0
  77. package/assets/esri/core/workers/chunks/{f07fb9b3fa30d7ee1681.js → d4c8673ca65df874a7ce.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{947f3a1cad976bba9738.js → d5e251cddd41d643510c.js} +1 -1
  79. package/assets/esri/core/workers/chunks/da1e6962ba0c85c37953.js +1 -0
  80. package/assets/esri/core/workers/chunks/dff845574c0037a1dca6.js +1 -0
  81. package/assets/esri/core/workers/chunks/e0864ca82ffa3c9a0776.js +1 -0
  82. package/assets/esri/core/workers/chunks/e0cf6e1e21d0ee739009.js +1 -0
  83. package/assets/esri/core/workers/chunks/e69cd62f824ce7a22fa0.js +1 -0
  84. package/assets/esri/core/workers/chunks/{c9feffb9884cfed52c4b.js → f190a3124d6d03417d73.js} +1 -1
  85. package/assets/esri/core/workers/chunks/f4135779bfdaf349352a.js +1 -0
  86. package/assets/esri/core/workers/chunks/fbe3a3b9d6c8c0b52f65.js +1 -0
  87. package/assets/esri/core/workers/chunks/fd17c4a9e13bf77aa86a.js +1 -0
  88. package/assets/esri/core/workers/chunks/fdd2b35388f9fe42b623.js +1 -0
  89. package/assets/esri/core/workers/chunks/fe7184993ef5713d13fb.js +1 -0
  90. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  91. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  92. package/assets/esri/themes/base/_core.scss +0 -2
  93. package/assets/esri/themes/dark/main.css +1 -1
  94. package/assets/esri/themes/light/main.css +1 -1
  95. package/assets/esri/themes/light/view.css +1 -1
  96. package/chunks/cameraUtilsPlanar.js +1 -1
  97. package/chunks/cameraUtilsSpherical.js +1 -1
  98. package/chunks/lyr3DMain.js +1 -1
  99. package/chunks/lyr3DWorker.js +1 -1
  100. package/config.js +1 -1
  101. package/core/Accessor.d.ts +1 -1
  102. package/core/Accessor.js +1 -1
  103. package/core/Logger.js +1 -1
  104. package/core/accessorSupport/DefaultsStore.js +1 -1
  105. package/core/accessorSupport/Properties.js +1 -1
  106. package/core/accessorSupport/Property.js +1 -1
  107. package/core/accessorSupport/watch.js +1 -1
  108. package/core/deprecate.js +1 -1
  109. package/core/has.js +1 -1
  110. package/core/libs/gl-matrix-2/math/mat4.js +1 -1
  111. package/core/types.d.ts +0 -5
  112. package/core/workers/workers.js +1 -6
  113. package/core/workers.d.ts +1 -2
  114. package/geometry/Extent.js +1 -1
  115. package/geometry/Geometry.js +1 -1
  116. package/geometry/Multipoint.js +1 -1
  117. package/geometry/Point.js +1 -1
  118. package/geometry/Polygon.js +1 -1
  119. package/geometry/Polyline.js +1 -1
  120. package/geometry/coordinateFormatter.js +1 -1
  121. package/geometry/operators/gx/operatorRelate.js +2 -0
  122. package/geometry/operators/relateOperator.js +1 -1
  123. package/identity/IdentityModal.js +1 -1
  124. package/interfaces.d.ts +0 -17
  125. package/kernel.js +1 -1
  126. package/layers/BaseElevationLayer.js +1 -1
  127. package/layers/BaseTileLayer.js +1 -1
  128. package/layers/BuildingSceneLayer.js +1 -1
  129. package/layers/CatalogLayer.js +1 -1
  130. package/layers/ElevationLayer.d.ts +1 -1
  131. package/layers/ElevationLayer.js +1 -1
  132. package/layers/FeatureLayer.js +1 -1
  133. package/layers/GeoRSSLayer.js +1 -1
  134. package/layers/ImageryLayer.js +1 -1
  135. package/layers/ImageryTileLayer.js +1 -1
  136. package/layers/IntegratedMesh3DTilesLayer.d.ts +4 -3
  137. package/layers/IntegratedMeshLayer.d.ts +4 -3
  138. package/layers/IntegratedMeshLayer.js +1 -1
  139. package/layers/KMLLayer.js +1 -1
  140. package/layers/Layer.js +1 -1
  141. package/layers/LinkChartLayer.js +1 -1
  142. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  143. package/layers/MapImageLayer.js +1 -1
  144. package/layers/OpenStreetMapLayer.js +1 -1
  145. package/layers/PointCloudLayer.js +1 -1
  146. package/layers/SceneLayer.js +1 -1
  147. package/layers/StreamLayer.js +1 -1
  148. package/layers/SubtypeGroupLayer.js +1 -1
  149. package/layers/TileLayer.js +1 -1
  150. package/layers/VectorTileLayer.js +1 -1
  151. package/layers/WCSLayer.js +1 -1
  152. package/layers/WMSLayer.js +1 -1
  153. package/layers/WMTSLayer.js +1 -1
  154. package/layers/WebTileLayer.js +1 -1
  155. package/layers/graphics/sources/CSVSource.js +1 -1
  156. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  157. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  158. package/layers/graphics/sources/MemorySource.js +1 -1
  159. package/layers/graphics/sources/WFSSource.js +1 -1
  160. package/layers/graphics/sources/support/QueryTask.js +1 -1
  161. package/layers/mixins/ArcGISImageService.js +1 -1
  162. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  163. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  164. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  165. package/layers/raster/datasets/BaseRaster.js +1 -1
  166. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  167. package/layers/raster/datasets/MRFRaster.js +1 -1
  168. package/layers/raster/datasets/RasterFactory.js +1 -1
  169. package/layers/raster/datasets/ZarrRaster.js +2 -0
  170. package/layers/raster/datasets/datasetUtils.js +1 -1
  171. package/layers/raster/datasets/zarrParser.js +2 -0
  172. package/layers/raster/datasets/zarrUtils.js +2 -0
  173. package/layers/raster/formats/pixelRangeUtils.js +1 -1
  174. package/layers/raster/formats/tiffParser.js +1 -1
  175. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  176. package/layers/support/GeometryDescriptor.js +1 -1
  177. package/layers/support/KMLSublayer.js +1 -1
  178. package/layers/support/SceneModifications.d.ts +1 -3
  179. package/layers/support/SceneModifications.js +1 -1
  180. package/layers/support/TileInfo.js +1 -1
  181. package/layers/support/featureLayerUtils.js +1 -1
  182. package/layers/support/tiles3DUtils.js +1 -1
  183. package/layers/support/wmtsUtils.js +1 -1
  184. package/layers/video/videoUtils.js +1 -1
  185. package/legend/ActiveLayerInfo.js +1 -1
  186. package/package.json +4 -4
  187. package/portal/Portal.js +1 -1
  188. package/portal/PortalItem.js +1 -1
  189. package/rest/query/executePivotQuery.js +1 -1
  190. package/rest/query/operations/queryPivot.js +1 -1
  191. package/rest/query/operations/queryUtils.js +1 -1
  192. package/rest/support/PivotQuery.js +1 -1
  193. package/rest/support/Query.js +1 -1
  194. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  195. package/support/LayersMixin.d.ts +2 -2
  196. package/symbols/PictureFillSymbol.js +1 -1
  197. package/symbols/PictureMarkerSymbol.js +1 -1
  198. package/symbols/SimpleFillSymbol.js +1 -1
  199. package/symbols/SimpleLineSymbol.js +1 -1
  200. package/symbols/SimpleMarkerSymbol.js +1 -1
  201. package/symbols/Symbol3D.js +1 -1
  202. package/symbols/TextSymbol.js +1 -1
  203. package/symbols/cim/Rasterizer.js +1 -1
  204. package/symbols/cim/utils.js +1 -1
  205. package/views/2d/PaddedViewState.js +1 -1
  206. package/views/2d/ViewState.js +1 -1
  207. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  208. package/views/2d/engine/webgl/TextureManager.js +1 -1
  209. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  210. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  211. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  212. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  213. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  214. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  215. package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
  216. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  217. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  218. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  219. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  220. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  221. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  222. package/views/3d/layers/DrapedSubView3D.js +1 -1
  223. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  224. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  225. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  226. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  227. package/views/3d/layers/SceneLayerView3D.js +1 -1
  228. package/views/3d/layers/WMSLayerView3D.js +1 -1
  229. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  230. package/views/3d/layers/graphics/Graphics3DObjectStateSet.js +1 -1
  231. package/views/3d/layers/graphics/Graphics3DObjectStates.js +1 -1
  232. package/views/3d/layers/i3s/Highlights.js +1 -1
  233. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  234. package/views/3d/layers/support/SceneLayerViewRequiredFields.js +1 -1
  235. package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +2 -0
  236. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  237. package/views/3d/layers/support/createFeatureFilterHighlight.js +2 -0
  238. package/views/3d/layers/support/createTileBVHForLayer.js +2 -0
  239. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  240. package/views/3d/layers/support/highlightUtils.js +1 -1
  241. package/views/3d/layers/support/selectTiles3DSpatialReference.js +2 -0
  242. package/views/3d/layers/support/tileBoundingVolumeUtils.js +2 -0
  243. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  244. package/views/3d/support/cameraUtils.js +1 -1
  245. package/views/3d/support/earthUtils.js +1 -1
  246. package/views/3d/support/engineContent/line.js +1 -1
  247. package/views/3d/support/flow/geometryUtils.js +1 -1
  248. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  249. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  250. package/views/3d/support/gaussianSplatting/GaussianSplatSortCoordinator.js +2 -0
  251. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  252. package/views/3d/support/hitTest.js +1 -1
  253. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  254. package/views/3d/terrain/TextureFader.js +1 -1
  255. package/views/3d/webgl-engine/Stage.js +1 -1
  256. package/views/3d/webgl-engine/createWebGLContext.js +2 -0
  257. package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
  258. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  259. package/views/3d/webgl-engine/lib/LineMaterial.js +1 -1
  260. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  261. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  262. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  263. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  264. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  265. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  266. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  267. package/views/3d/webgl-engine/materials/internal/ribbonLineBufferUtils.js +1 -1
  268. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  269. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  270. package/views/3d/webgl-engine/shaders/ShadedMaterialConfiguration.js +2 -0
  271. package/views/3d/webgl.d.ts +2 -1
  272. package/views/3d/webgl.js +1 -1
  273. package/views/SceneView.d.ts +9 -5
  274. package/views/SceneView.js +1 -1
  275. package/views/VideoView.js +1 -1
  276. package/views/View.d.ts +1 -3
  277. package/views/View2D.d.ts +2 -2
  278. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  279. package/views/draw/support/Box.js +1 -1
  280. package/views/interactive/options/ViewOptions.d.ts +0 -2
  281. package/views/layers/FeatureLikeLayerView.d.ts +3 -1
  282. package/views/layers/FeatureLikeLayerView.js +1 -1
  283. package/views/layers/GraphicsLayerView.d.ts +3 -1
  284. package/views/layers/ImageryLayerView.js +1 -1
  285. package/views/layers/ImageryTileLayerView.js +1 -1
  286. package/views/layers/SceneLayerView.d.ts +3 -2
  287. package/views/layers/SceneLayerView.js +1 -1
  288. package/views/support/Scheduler.js +1 -1
  289. package/views/types.d.ts +1 -0
  290. package/webscene/version.js +1 -1
  291. package/widgets/AreaMeasurement2D.js +1 -1
  292. package/widgets/AreaMeasurement3D.js +1 -1
  293. package/widgets/Attachments.js +1 -1
  294. package/widgets/Attribution.js +1 -1
  295. package/widgets/BasemapGallery.js +1 -1
  296. package/widgets/BasemapLayerList.js +1 -1
  297. package/widgets/BasemapToggle.js +1 -1
  298. package/widgets/BatchAttributeForm.js +1 -1
  299. package/widgets/Bookmarks.js +1 -1
  300. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  301. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  302. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  303. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  304. package/widgets/BuildingExplorer.js +1 -1
  305. package/widgets/CatalogLayerList.js +1 -1
  306. package/widgets/Compass.js +1 -1
  307. package/widgets/CoordinateConversion.js +1 -1
  308. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  309. package/widgets/Daylight.js +1 -1
  310. package/widgets/DirectLineMeasurement3D.js +1 -1
  311. package/widgets/Directions.js +1 -1
  312. package/widgets/DistanceMeasurement2D.js +1 -1
  313. package/widgets/Editor/EditorViewModel.d.ts +0 -1
  314. package/widgets/Editor.d.ts +0 -1
  315. package/widgets/Editor.js +1 -1
  316. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  317. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  318. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  319. package/widgets/ElevationProfile.js +1 -1
  320. package/widgets/Expand.js +1 -1
  321. package/widgets/Feature/FeatureAttachments.js +1 -1
  322. package/widgets/Feature/FeatureContent.js +1 -1
  323. package/widgets/Feature/FeatureExpression.js +1 -1
  324. package/widgets/Feature/FeatureFields.js +1 -1
  325. package/widgets/Feature/FeatureMedia.js +1 -1
  326. package/widgets/Feature/FeatureRelationship.js +1 -1
  327. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  328. package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
  329. package/widgets/Feature/support/FeatureElementInfo.js +1 -1
  330. package/widgets/Feature.js +1 -1
  331. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  332. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  333. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  334. package/widgets/FeatureForm.js +1 -1
  335. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  336. package/widgets/FeatureTable.js +1 -1
  337. package/widgets/FeatureTemplates.js +1 -1
  338. package/widgets/Features/FeaturesDrillIn.js +1 -1
  339. package/widgets/Features.js +1 -1
  340. package/widgets/FloorFilter.js +1 -1
  341. package/widgets/Fullscreen.js +1 -1
  342. package/widgets/Histogram.js +1 -1
  343. package/widgets/HistogramRangeSlider.js +1 -1
  344. package/widgets/Home.js +1 -1
  345. package/widgets/LayerList/ListItemPanel.js +1 -1
  346. package/widgets/LayerList.js +1 -1
  347. package/widgets/Legend/styles/card/CardView.js +1 -1
  348. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  349. package/widgets/Legend/styles/card/LegendElement.js +1 -1
  350. package/widgets/Legend/styles/card/SizeRamp.js +1 -1
  351. package/widgets/Legend/styles/card/UnivariateAboveAndBelowRamp.js +1 -1
  352. package/widgets/Legend/styles/card/UnivariateColorSizeRamp.js +1 -1
  353. package/widgets/Legend/styles/classic/ClassicView.js +1 -1
  354. package/widgets/Legend/styles/classic/ColorRamp.js +1 -1
  355. package/widgets/Legend/styles/classic/LegendElement.js +1 -1
  356. package/widgets/Legend/styles/classic/SizeRamp.js +1 -1
  357. package/widgets/Legend/styles/classic/UnivariateAboveAndBelowRamp.js +1 -1
  358. package/widgets/Legend/styles/classic/UnivariateColorSizeRamp.js +1 -1
  359. package/widgets/Legend.js +1 -1
  360. package/widgets/LineOfSight.js +1 -1
  361. package/widgets/Locate.js +1 -1
  362. package/widgets/Measurement.js +1 -1
  363. package/widgets/NavigationToggle.js +1 -1
  364. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  365. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  366. package/widgets/OrientedImageryViewer/support/geometryUtils.js +1 -1
  367. package/widgets/OrientedImageryViewer.js +1 -1
  368. package/widgets/Popup.js +1 -1
  369. package/widgets/Print.js +1 -1
  370. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  371. package/widgets/ScaleBar.js +1 -1
  372. package/widgets/ScaleRangeSlider.js +1 -1
  373. package/widgets/Search/SearchResultRenderer.js +1 -1
  374. package/widgets/Search.js +1 -1
  375. package/widgets/ShadowCast/components/ShadowTooltip.js +1 -1
  376. package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
  377. package/widgets/ShadowCast.js +1 -1
  378. package/widgets/Sketch/SketchViewModel.d.ts +0 -1
  379. package/widgets/Sketch.d.ts +0 -1
  380. package/widgets/Sketch.js +1 -1
  381. package/widgets/Slice.js +1 -1
  382. package/widgets/Slider.js +1 -1
  383. package/widgets/Spinner.js +1 -1
  384. package/widgets/Swipe.js +1 -1
  385. package/widgets/TableList/ListItemPanel.js +1 -1
  386. package/widgets/TableList.js +1 -1
  387. package/widgets/TimeSlider.js +1 -1
  388. package/widgets/TimeZoneLabel.js +1 -1
  389. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
  390. package/widgets/UtilityNetworkAssociations.js +1 -1
  391. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  392. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  393. package/widgets/UtilityNetworkTrace.js +1 -1
  394. package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
  395. package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
  396. package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
  397. package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
  398. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  399. package/widgets/ValuePicker.js +1 -1
  400. package/widgets/Widget.js +1 -1
  401. package/widgets/Zoom.js +1 -1
  402. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  403. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  404. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  405. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  406. package/widgets/smartMapping/ColorSlider.js +1 -1
  407. package/widgets/smartMapping/HeatmapSlider.js +1 -1
  408. package/widgets/smartMapping/OpacitySlider.js +1 -1
  409. package/widgets/smartMapping/SizeSlider.js +1 -1
  410. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  411. package/widgets/support/ColorPicker.js +1 -1
  412. package/widgets/support/FilterBuilder.js +1 -1
  413. package/widgets/support/FilterCondition.js +1 -1
  414. package/widgets/support/GridControls.js +1 -1
  415. package/widgets/support/MeasurementWidgetContent.js +1 -1
  416. package/widgets/support/PluginSettingsControls.js +1 -1
  417. package/widgets/support/SelectionList.js +1 -1
  418. package/widgets/support/SelectionToolbar.d.ts +1 -1
  419. package/widgets/support/SelectionToolbar.js +1 -1
  420. package/widgets/support/SketchTooltipControls.js +1 -1
  421. package/widgets/support/SnappingControls.js +1 -1
  422. package/widgets/support/TimezonePicker.js +1 -1
  423. package/widgets/support/UnitSelect.js +1 -1
  424. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
  425. package/assets/esri/core/workers/chunks/01803f76bc0d9f2cd566.js +0 -1
  426. package/assets/esri/core/workers/chunks/02940f7ddaf98e69521e.js +0 -1
  427. package/assets/esri/core/workers/chunks/07e5482e1fc69be5de09.js +0 -1
  428. package/assets/esri/core/workers/chunks/0c893837f67829757df7.js +0 -1
  429. package/assets/esri/core/workers/chunks/15950c2fb173b62ee0ec.js +0 -1
  430. package/assets/esri/core/workers/chunks/1a91443970d64a59521d.js +0 -1
  431. package/assets/esri/core/workers/chunks/1deca3de77b1a9a07da4.js +0 -1
  432. package/assets/esri/core/workers/chunks/1fd82fcba2758741996a.js +0 -1
  433. package/assets/esri/core/workers/chunks/20a2124cbe43e5527c40.js +0 -1
  434. package/assets/esri/core/workers/chunks/26ea39dfdf887f357fce.js +0 -1
  435. package/assets/esri/core/workers/chunks/276a0b549acf048e8673.js +0 -1
  436. package/assets/esri/core/workers/chunks/2c3612379111457c3221.js +0 -1
  437. package/assets/esri/core/workers/chunks/34467f7d84baffd772a3.js +0 -1
  438. package/assets/esri/core/workers/chunks/398ec098fffe6abceedd.js +0 -1
  439. package/assets/esri/core/workers/chunks/3b32a24488b3068f0cb7.js +0 -1
  440. package/assets/esri/core/workers/chunks/427d929dc7f89b0a1ea9.js +0 -1
  441. package/assets/esri/core/workers/chunks/432728c557be5dfa26b5.js +0 -1
  442. package/assets/esri/core/workers/chunks/4c240ca50f70bf30813f.js +0 -1
  443. package/assets/esri/core/workers/chunks/4d8833f48348cbbcc947.js +0 -1
  444. package/assets/esri/core/workers/chunks/514cc15acb77dc85035c.js +0 -1
  445. package/assets/esri/core/workers/chunks/585ae43c7bcb86a26762.js +0 -1
  446. package/assets/esri/core/workers/chunks/5e48898cebb6dbaf09b5.js +0 -1
  447. package/assets/esri/core/workers/chunks/5ec5a6cef9ee9a8cc400.js +0 -1
  448. package/assets/esri/core/workers/chunks/601e1d020b8115497944.js +0 -1
  449. package/assets/esri/core/workers/chunks/687deb918eb48a963c8f.js +0 -1
  450. package/assets/esri/core/workers/chunks/6a21dc13a465757ba007.js +0 -1
  451. package/assets/esri/core/workers/chunks/6e910342ada398c98e30.js +0 -1
  452. package/assets/esri/core/workers/chunks/78818c2a898444f7e890.js +0 -1
  453. package/assets/esri/core/workers/chunks/7d2cbc767c336d15e4d5.js +0 -1
  454. package/assets/esri/core/workers/chunks/7d497df6e13162156342.js +0 -1
  455. package/assets/esri/core/workers/chunks/7dbf4c7480bf9c72820d.js +0 -1
  456. package/assets/esri/core/workers/chunks/80c234ee5276ea1645db.js +0 -1
  457. package/assets/esri/core/workers/chunks/8c3779de09291170497f.js +0 -1
  458. package/assets/esri/core/workers/chunks/966204d6dedc8149c3e9.js +0 -1
  459. package/assets/esri/core/workers/chunks/9ab0735e86cf8932bf9d.js +0 -1
  460. package/assets/esri/core/workers/chunks/a0356702f2d3f787aeac.js +0 -1
  461. package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.js +0 -1
  462. package/assets/esri/core/workers/chunks/ab0ea4042f4e13874aed.js +0 -1
  463. package/assets/esri/core/workers/chunks/ab98ade3257360015d6c.js +0 -1
  464. package/assets/esri/core/workers/chunks/b13d8f4e4e80ef00b1bd.js +0 -1
  465. package/assets/esri/core/workers/chunks/b15a8d4322f3b7819d2f.js +0 -1
  466. package/assets/esri/core/workers/chunks/b3aa29589dcfb5b93106.js +0 -1
  467. package/assets/esri/core/workers/chunks/b472c0a21ae29e653f7d.js +0 -1
  468. package/assets/esri/core/workers/chunks/b90271ce38522bcf813b.js +0 -1
  469. package/assets/esri/core/workers/chunks/ba91df9835cdea7698a9.js +0 -1
  470. package/assets/esri/core/workers/chunks/bd812dd75d2a3d7d0441.js +0 -1
  471. package/assets/esri/core/workers/chunks/bfe13ac9fa1aafb190a1.js +0 -1
  472. package/assets/esri/core/workers/chunks/c1cf3edce15f09648eb4.js +0 -1
  473. package/assets/esri/core/workers/chunks/c31830ee897d5a7f2582.js +0 -1
  474. package/assets/esri/core/workers/chunks/c48d97c38e821be17dc5.js +0 -1
  475. package/assets/esri/core/workers/chunks/c7ad62f54d2abe1d17a0.js +0 -1
  476. package/assets/esri/core/workers/chunks/cf21b217b13770757cb8.js +0 -1
  477. package/assets/esri/core/workers/chunks/d42a4f47843e075c56a8.js +0 -1
  478. package/assets/esri/core/workers/chunks/deb408bee61ca192b2ce.js +0 -1
  479. package/assets/esri/core/workers/chunks/e121d15b883184ee83e7.js +0 -1
  480. package/assets/esri/core/workers/chunks/e4042e43f0081fe49f7b.js +0 -1
  481. package/assets/esri/core/workers/chunks/e932951598499befabf5.js +0 -1
  482. package/assets/esri/core/workers/chunks/eaab787a5f2445be5e5a.js +0 -1
  483. package/assets/esri/core/workers/chunks/f06ef153e106b26a6748.js +0 -1
  484. package/assets/esri/core/workers/chunks/faae3c43048b42341536.js +0 -1
  485. package/assets/esri/themes/base/widgets/_UtilityNetworkValidateTopology.scss +0 -46
  486. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ar.json +0 -1
  487. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.bg.json +0 -1
  488. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.bs.json +0 -1
  489. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ca.json +0 -1
  490. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.cs.json +0 -1
  491. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.da.json +0 -1
  492. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.de.json +0 -1
  493. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.el.json +0 -1
  494. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.en.json +0 -1
  495. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.es.json +0 -1
  496. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.et.json +0 -1
  497. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.fi.json +0 -1
  498. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.fr.json +0 -1
  499. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.he.json +0 -1
  500. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.hr.json +0 -1
  501. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.hu.json +0 -1
  502. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.id.json +0 -1
  503. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.it.json +0 -1
  504. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ja.json +0 -1
  505. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ko.json +0 -1
  506. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.lt.json +0 -1
  507. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.lv.json +0 -1
  508. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.nl.json +0 -1
  509. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.no.json +0 -1
  510. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pl.json +0 -1
  511. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pt-BR.json +0 -1
  512. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pt-PT.json +0 -1
  513. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ro.json +0 -1
  514. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ru.json +0 -1
  515. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sk.json +0 -1
  516. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sl.json +0 -1
  517. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sr.json +0 -1
  518. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sv.json +0 -1
  519. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.th.json +0 -1
  520. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.tr.json +0 -1
  521. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.uk.json +0 -1
  522. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.vi.json +0 -1
  523. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-CN.json +0 -1
  524. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-HK.json +0 -1
  525. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-TW.json +0 -1
  526. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.d.ts +0 -72
  527. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +0 -2
  528. package/widgets/UtilityNetworkValidateTopology.d.ts +0 -130
  529. package/widgets/UtilityNetworkValidateTopology.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../Camera.js";import t from"../../../core/Logger.js";import{deg2rad as n,rad2deg as r,asinClamped as i}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{copy as o,distance as s,dist as c,length as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,clone as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Point.js";import{projectAsync as m,project as h}from"../../../geometry/projectionUtils.js";import g from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as _,projectPointToVector as v}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as y,projectVectorToPoint as b}from"../../../geometry/projection/projectVectorToPoint.js";import{gcsCyclical as x,webMercatorCyclical as S}from"../../../geometry/support/normalizeUtils.js";import{toRenderCamera as C}from"../webgl.js";import{scaleToDistance as w,distanceToScale as T}from"./cameraScaleUtils.js";import{getGreatCircleSpanAt as E}from"./earthUtils.js";import{getElevationAtPoint as D}from"./ElevationProvider.js";import{viewModeDependentUtil as O,directionToHeadingTilt as k}from"./viewingModeUtils.js";import{isSpatialReferenceSupported as A}from"../../support/spatialReferenceSupport.js";const j=()=>t.getLogger(`esri.views.3d.support.cameraUtils`),M=u();function N(e){return e.spatialReference??g.WGS84}function ee(e,t,n,r,i){return O(e).headingTiltToDirectionUp(t,n,r,i)}function P(e,t,n,r){let i=r.levelAtScale(t),a=k(e,n.eye,n.viewForward,n.up).tilt,o=I(a),s=Math.max(i-o,0);return r.scaleAtLevel(s)}function F(e,t,n){let r=n.levelAtScale(e),i=I(t);return n.scaleAtLevel(r+i)}function I(e){return 2*((e>90?180-e:e)/90)**2}function te(e,t,n=0){let r=e.basemapTerrain?.tilingScheme;if(!r)return 0;let i=f(e.spatialReference).radius,a=e.state.viewingMode===2?t.eye[2]:l(t.eye)-i,o=Math.abs(a-n);return P(e,T(e,o),t,r)}function ne(e,t,n=0){let r=C(e,t);return r?te(e,r,n):0}const re=1;function ie(e,t,a,o){if(t===0)return 0;let c=e.state.contentCamera,u=s(c.eye,a),d=e.basemapTerrain?.tilingScheme;if(!d)return j().error(`#scaleToTargetDistance()`,`Cannot compute distance from scale without a tiling scheme`),u;let p=u,m=k(e,c.eye,c.viewForward,c.up),h=m.tilt>90;if(e.state.isLocal){let r=F(t,m.tilt,d),i=(w(e,r)-Math.abs(c.eye[2]-o[2]))/Math.cos(n(m.tilt));return p=h?p-i:p+i,p}let g=1/0,_=0,v=z(e,m.heading,m.tilt,a,u,1);if(!v)return p;let y=l(o);for(;g>1&&_<100;){let o=l(v.eye),u=h?180-v.tilt:v.tilt,b=n(u),x=Math.sin(b)*o,S=Math.cos(b)*o,C=F(t,v.tilt,d),T=w(e,C),E=h?y-T:y+T,D=i(x/E),O=Math.cos(D)*E-S,k=s(v.eye,a);p=h?k-O:k+O,v=z(e,m.heading,m.tilt,a,p,1);let A=Q(e,v,r(c.fov));if(!v||!A)return p;let j=f(e.spatialReference).radius,M=ne(e,A,y-j);g=Math.abs(t-M),++_}return p}async function ae(e,t,n,r,i,a){return L(e,t,w(e,n),r,i,a)}function oe(e,t,n,r,i,a){return Q(e,z(e,r.heading,r.tilt,t,n,i),r.fov,a)}async function L(e,t,n,r,i,o){let s=await B(e,r.heading,r.tilt,t,n,i,o);return a(o),$(e,s,r.fov,o)}function R(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,M,e.spatialReference)&&e.elevationProvider&&(D(e.elevationProvider,M)??0)>M[2]-1)}async function se(e,t,n){if(R(e,t))return!0;let{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(r==null||!o.fromRenderCoords(t,M,i))return!1;let[s,c,l]=M,u=await r.queryElevation(s,c,l,i,`ground`,n)??0;return a(n),u>l-1}async function ce(e,t,n){let r=u();if(t==null)return o(r,e.state.camera.center);if(t instanceof p){let{renderSpatialReference:i,basemapTerrain:o,elevationProvider:s}=e,c=t.spatialReference;if(await _(t,r,i,{signal:n}),a(n),t.z==null&&o!=null&&s!=null){let i=await s.queryElevation(t.x,t.y,t.z??0,c,`ground`,n);a(n),i!=null&&e.renderCoordsHelper.setAltitude(r,i)}return r}return o(r,t)}function le(e,t){let n=u();if(t==null)return o(n,e.state.camera.center);if(t instanceof p){if(!v(t,n,e.renderSpatialReference))return null;let{basemapTerrain:r,elevationProvider:i}=e;if(t.z==null&&r!=null&&i!=null){let r=D(i,t);r!=null&&e.renderCoordsHelper.setAltitude(n,r)}return n}return o(n,t)}function z(e,t,n,r,i,a){return V(e,t,n,r instanceof p?r:null,le(e,r),i,a)}async function B(e,t,n,r,i,o,s){let c=r instanceof p?r:null,l=await ce(e,r,s);return a(s),H(e,t,n,c,l,i,o,s)}function V(e,t,n,r,i,a,o){if(i==null||!r&&(r=new p({spatialReference:N(e)}),!b(i,e.renderSpatialReference,r)))return null;let s=U(e,t,n,i,a,o);if(W(e,n,o)&&R(e,s.eye)){let{tilt:o,mode:s}=G(e,n,i,a);return V(e,t,o,r,i,a,s)}return K(s,i)}async function H(e,t,n,r,i,o,s,c){r||(r=new p({spatialReference:N(e)}),await y(i,e.renderSpatialReference,r,{signal:c})||(r=null)),a(c);let l=U(e,t,n,i,o,s);if(W(e,n,s)&&await se(e,l.eye,c)){a(c);let{tilt:s,mode:l}=G(e,n,i,o);return H(e,t,s,r,i,o,l,c)}return K(l,i)}function U(e,t,n,r,i,a){i=Math.max(i,e.state.constraints.minimumPoiDistance);let o=he(e,t,n,r,i,a),s=O(e).eyeForCenterWithHeadingTilt;return s(r,i,o.heading,o.tilt)}function W(e,t,n){let r=e.map.ground.navigationConstraint;return n===1&&e.state.isGlobal&&t>0&&(r==null||r.type===`stay-above`)}function G(e,t,n,r){let i=X(e,n,r,_e(e,r,t,n));return{tilt:i,mode:t-i<1?0:1}}function K(e,t){return{...e,center:d(t)}}function q(e,t){let{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&A(i,1)||n.isLocal&&r.equals(i)}function J(e,t){let n,r,i;if(e.state.isGlobal){let e=new p(t.xmin,t.ymin,t.spatialReference),a=new p(t.xmax,t.ymax,t.spatialReference),o=t.spatialReference.isGeographic?x:S;n=new p({x:o.center(e.x,a.x),y:(a.y+e.y)/2,z:t.zmax!=null&&t.zmin!=null?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});let s=f(t.spatialReference),c=E(n,e,a);r=c.lon,i=c.lat,o.diff(e.x,a.x)>o.range/2&&(r+=s.halfCircumference),r=Math.min(r,s.halfCircumference),i=Math.min(i,s.halfCircumference)}else{let a=e.renderSpatialReference??t.spatialReference;a.equals(t.spatialReference)||(t=h(t,a)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;let o=t.zmax!=null&&t.zmin!=null?(t.zmax+t.zmin)/2:void 0;n=new p({x:t.xmin+.5*r,y:t.ymin+.5*i,z:o,spatialReference:a})}let a=t.zmax!=null&&t.zmin!=null?t.zmax-t.zmin:0,o=e.state.camera,s=1/Math.tan(o.fovX/2),c=1/Math.tan(o.fovY/2),l=1/Math.tan(o.fov/2),u=Math.max(.5*r*s,.5*i*c,.5*a*l)/1;return{center:n,distance:u}}async function ue(e,t,n,r,i,o){let s=q(e,t)?t:await m(t,e.spatialReference,{signal:o});a(o);let{center:c,distance:l}=J(e,s),u=await B(e,n,r,c,l,i,o);return a(o),$(e,u,e.camera.fov,o)}function de(e,t,n,r,i,a){let o;try{o=q(e,t)?t:h(t,e.spatialReference)}catch{return null}let{center:s,distance:c}=J(e,o),l=z(e,n,r,s,c,i);return l==null?null:Q(e,l,e.camera.fov,a)}function fe(e,t,n){let r=e.renderSpatialReference,i=new p({spatialReference:N(e)});if(!b(n,r,i))return null;let a=Math.tan(t.fovX/2),o=Math.tan(t.fovY/2),s=c(t.eye,n),l=2*s*a*1,u=2*s*o*1;return O(e).toExtent(e,i,l,u)}function pe(e,t){return O(e).toArea(e,t)}function me(e,t,n){let r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>8)return!0;let i=t,a=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return s(i,a)/(Math.tan(e.state.camera.fov*.5)*r)>5}function he(e,t,n,r,i,a){let o=0;return a===1&&me(e,r,i)?(t=0,o=ge(e,i,n,r)):o=Z(e,r,i,n),o=e.state.constraints.clampTilt(i,o),n=X(e,r,i,o),{heading:t,tilt:n}}const Y=.7;function ge(e,t,n,r){let i=Z(e,r,t,n);if(!e.state.constraints.tilt)return i;let a=e.state.constraints.tilt(t);a.max=Math.min(a.max,Math.PI*.5);let o=a.min*.30000000000000004+a.max*Y;return Math.min(i,o)}function _e(e,t,n,r){let i=Z(e,r,t,n);if(!e.state.constraints.tilt)return i;let a=e.state.constraints.tilt(t);return i=Math.min(i,Math.PI*.5),a.min*.30000000000000004+i*Y}function X(e,t,n,r){return O(e).lookAtTiltToEyeTilt(r,t,n)}function Z(e,t,n,r){return O(e).eyeTiltToLookAtTilt(r,t,n)}function Q(t,n,r,i){if(n==null)return null;let a=t.renderSpatialReference,o=new p({spatialReference:N(t)});return b(n.eye,a,o)?(i??=new e,i.position=o,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function $(t,n,r,i){let o=t.renderSpatialReference,s=new p({spatialReference:N(t)});return await y(n.eye,o,s,{signal:i}),a(i),new e(s,n.heading,n.tilt,r)}function ve(e,t){let n=e.basemapTerrain?.tilingScheme;if(!n)j().error(`#scaleToZoom()`,`Cannot compute zoom from scale without a tiling scheme`);else return n.levelAtScale(t)}function ye(e,t){let n=e.basemapTerrain?.tilingScheme;if(!n)j().error(`#zoomToScale()`,`Cannot compute scale from zoom without a tiling scheme`);else return n.scaleAtLevel(t)}export{P as applyTiltAdjustToScale,L as fromCenterDistanceAsync,oe as fromCenterDistanceSync,ae as fromCenterScale,ue as fromExtentAsync,de as fromExtentSync,B as getObserverForPointAtDistanceAsync,z as getObserverForPointAtDistanceSync,N as getViewSR,ee as headingTiltToDirectionUp,F as removeTiltAdjustFromScale,re as scaleErrorThreshold,ve as scaleToZoom,pe as toArea,fe as toExtent,ie as viewScaleToCameraDistance,ye as zoomToScale};
2
+ import e from"../../../Camera.js";import t from"../../../core/Logger.js";import{deg2rad as n,rad2deg as r,asinClamped as i}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{copy as o,distance as s,dist as c,length as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,clone as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Point.js";import{projectAsync as m,project as h}from"../../../geometry/projectionUtils.js";import g from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as _,projectPointToVector as v}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as y,projectVectorToPoint as b}from"../../../geometry/projection/projectVectorToPoint.js";import{gcsCyclical as x,webMercatorCyclical as S}from"../../../geometry/support/normalizeUtils.js";import{toRenderCamera as C}from"../webgl.js";import{scaleToDistance as w,distanceToScale as T}from"./cameraScaleUtils.js";import{getGreatCircleSpanAt as E}from"./earthUtils.js";import{getElevationAtPoint as D}from"./ElevationProvider.js";import{viewModeDependentUtil as O,directionToHeadingTilt as k}from"./viewingModeUtils.js";import{isSpatialReferenceSupported as A}from"../../support/spatialReferenceSupport.js";const j=()=>t.getLogger(`esri.views.3d.support.cameraUtils`),M=u();function N(e){return e.spatialReference??g.WGS84}function ee(e,t,n,r,i){return O(e).headingTiltToDirectionUp(t,n,r,i)}function P(e,t,n,r){let i=r.levelAtScale(t),a=k(e,n.eye,n.viewForward,n.up).tilt,o=I(a),s=Math.max(i-o,0);return r.scaleAtLevel(s)}function F(e,t,n){let r=n.levelAtScale(e),i=I(t);return n.scaleAtLevel(r+i)}function I(e){return 2*((e>90?180-e:e)/90)**2}function te(e,t,n=0){let r=e.basemapTerrain?.tilingScheme;if(!r)return 0;let i=f(e.spatialReference).radius,a=e.state.viewingMode===2?t.eye[2]:l(t.eye)-i,o=Math.abs(a-n);return P(e,T(e,o),t,r)}function ne(e,t,n=0){let r=C(e,t);return r?te(e,r,n):0}const re=1;function ie(e,t,a,o){if(t===0)return 0;let c=e.state.contentCamera,u=s(c.eye,a),d=e.basemapTerrain?.tilingScheme;if(!d)return j().error(`#scaleToTargetDistance()`,`Cannot compute distance from scale without a tiling scheme`),u;let p=u,m=k(e,c.eye,c.viewForward,c.up),h=m.tilt>90;if(e.state.isLocal){let r=F(t,m.tilt,d),i=(w(e,r)-Math.abs(c.eye[2]-o[2]))/Math.cos(n(m.tilt));return p=h?p-i:p+i,p}let g=1/0,_=0,v=z(e,m.heading,m.tilt,a,u,1);if(!v)return p;let y=l(o);for(;g>1&&_<100;){let o=l(v.eye),u=h?180-v.tilt:v.tilt,b=n(u),x=Math.sin(b)*o,S=Math.cos(b)*o,C=F(t,v.tilt,d),T=w(e,C),E=h?y-T:y+T,D=i(x/E),O=Math.cos(D)*E-S,k=s(v.eye,a);p=h?k-O:k+O,v=z(e,m.heading,m.tilt,a,p,1);let A=Q(e,v,r(c.fov));if(!v||!A)return p;let j=f(e.spatialReference).radius,M=ne(e,A,y-j);g=Math.abs(t-M),++_}return p}async function ae(e,t,n,r,i,a){return L(e,t,w(e,n),r,i,a)}function oe(e,t,n,r,i,a){return Q(e,z(e,r.heading,r.tilt,t,n,i),r.fov,a)}async function L(e,t,n,r,i,o){let s=await B(e,r.heading,r.tilt,t,n,i,o);return a(o),$(e,s,r.fov,o)}function R(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,M,e.spatialReference)&&e.elevationProvider&&(D(e.elevationProvider,M)??0)>M[2]-1)}async function se(e,t,n){if(R(e,t))return!0;let{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(r==null||!o.fromRenderCoords(t,M,i))return!1;let[s,c,l]=M,u=await r.queryElevation(s,c,l,i,`ground`,n)??0;return a(n),u>l-1}async function ce(e,t,n){let r=u();if(t==null)return o(r,e.state.camera.center);if(t instanceof p){let{renderSpatialReference:i,basemapTerrain:o,elevationProvider:s}=e,c=t.spatialReference;if(await _(t,r,i,{signal:n}),a(n),t.z==null&&o!=null&&s!=null){let i=await s.queryElevation(t.x,t.y,t.z??0,c,`ground`,n);a(n),i!=null&&e.renderCoordsHelper.setAltitude(r,i)}return r}return o(r,t)}function le(e,t){let n=u();if(t==null)return o(n,e.state.camera.center);if(t instanceof p){if(!v(t,n,e.renderSpatialReference))return null;let{basemapTerrain:r,elevationProvider:i}=e;if(t.z==null&&r!=null&&i!=null){let r=D(i,t);r!=null&&e.renderCoordsHelper.setAltitude(n,r)}return n}return o(n,t)}function z(e,t,n,r,i,a){return V(e,t,n,r instanceof p?r:null,le(e,r),i,a)}async function B(e,t,n,r,i,o,s){let c=r instanceof p?r:null,l=await ce(e,r,s);return a(s),H(e,t,n,c,l,i,o,s)}function V(e,t,n,r,i,a,o){if(i==null||!r&&(r=new p({spatialReference:N(e)}),!b(i,e.renderSpatialReference,r)))return null;let s=U(e,t,n,i,a,o);if(W(e,n,o)&&R(e,s.eye)){let{tilt:o,mode:s}=G(e,n,i,a);return V(e,t,o,r,i,a,s)}return K(s,i)}async function H(e,t,n,r,i,o,s,c){r||(r=new p({spatialReference:N(e)}),await y(i,e.renderSpatialReference,r,{signal:c})||(r=null)),a(c);let l=U(e,t,n,i,o,s);if(W(e,n,s)&&await se(e,l.eye,c)){a(c);let{tilt:s,mode:l}=G(e,n,i,o);return H(e,t,s,r,i,o,l,c)}return K(l,i)}function U(e,t,n,r,i,a){i=Math.max(i,e.state.constraints.minimumPoiDistance);let o=he(e,t,n,r,i,a),s=O(e).eyeForCenterWithHeadingTilt;return s(r,i,o.heading,o.tilt)}function W(e,t,n){let r=e.map.ground.navigationConstraint;return n===1&&e.state.isGlobal&&t>0&&(r==null||r.type===`stay-above`)}function G(e,t,n,r){let i=X(e,n,r,_e(e,r,t,n));return{tilt:i,mode:t-i<1?0:1}}function K(e,t){return{...e,center:d(t)}}function q(e,t){let{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&A(i,1)||n.isLocal&&r.equals(i)}function J(e,t){let n,r,i;if(e.state.isGlobal){let e=new p({x:t.xmin,y:t.ymin,spatialReference:t.spatialReference}),a=new p({x:t.xmax,y:t.ymax,spatialReference:t.spatialReference}),o=t.spatialReference.isGeographic?x:S;n=new p({x:o.center(e.x,a.x),y:(a.y+e.y)/2,z:t.zmax!=null&&t.zmin!=null?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});let s=f(t.spatialReference),c=E(n,e,a);r=c.lon,i=c.lat,o.diff(e.x,a.x)>o.range/2&&(r+=s.halfCircumference),r=Math.min(r,s.halfCircumference),i=Math.min(i,s.halfCircumference)}else{let a=e.renderSpatialReference??t.spatialReference;a.equals(t.spatialReference)||(t=h(t,a)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;let o=t.zmax!=null&&t.zmin!=null?(t.zmax+t.zmin)/2:void 0;n=new p({x:t.xmin+.5*r,y:t.ymin+.5*i,z:o,spatialReference:a})}let a=t.zmax!=null&&t.zmin!=null?t.zmax-t.zmin:0,o=e.state.camera,s=1/Math.tan(o.fovX/2),c=1/Math.tan(o.fovY/2),l=1/Math.tan(o.fov/2),u=Math.max(.5*r*s,.5*i*c,.5*a*l)/1;return{center:n,distance:u}}async function ue(e,t,n,r,i,o){let s=q(e,t)?t:await m(t,e.spatialReference,{signal:o});a(o);let{center:c,distance:l}=J(e,s),u=await B(e,n,r,c,l,i,o);return a(o),$(e,u,e.camera.fov,o)}function de(e,t,n,r,i,a){let o;try{o=q(e,t)?t:h(t,e.spatialReference)}catch{return null}let{center:s,distance:c}=J(e,o),l=z(e,n,r,s,c,i);return l==null?null:Q(e,l,e.camera.fov,a)}function fe(e,t,n){let r=e.renderSpatialReference,i=new p({spatialReference:N(e)});if(!b(n,r,i))return null;let a=Math.tan(t.fovX/2),o=Math.tan(t.fovY/2),s=c(t.eye,n),l=2*s*a*1,u=2*s*o*1;return O(e).toExtent(e,i,l,u)}function pe(e,t){return O(e).toArea(e,t)}function me(e,t,n){let r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>8)return!0;let i=t,a=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return s(i,a)/(Math.tan(e.state.camera.fov*.5)*r)>5}function he(e,t,n,r,i,a){let o=0;return a===1&&me(e,r,i)?(t=0,o=ge(e,i,n,r)):o=Z(e,r,i,n),o=e.state.constraints.clampTilt(i,o),n=X(e,r,i,o),{heading:t,tilt:n}}const Y=.7;function ge(e,t,n,r){let i=Z(e,r,t,n);if(!e.state.constraints.tilt)return i;let a=e.state.constraints.tilt(t);a.max=Math.min(a.max,Math.PI*.5);let o=a.min*.30000000000000004+a.max*Y;return Math.min(i,o)}function _e(e,t,n,r){let i=Z(e,r,t,n);if(!e.state.constraints.tilt)return i;let a=e.state.constraints.tilt(t);return i=Math.min(i,Math.PI*.5),a.min*.30000000000000004+i*Y}function X(e,t,n,r){return O(e).lookAtTiltToEyeTilt(r,t,n)}function Z(e,t,n,r){return O(e).eyeTiltToLookAtTilt(r,t,n)}function Q(t,n,r,i){if(n==null)return null;let a=t.renderSpatialReference,o=new p({spatialReference:N(t)});return b(n.eye,a,o)?(i??=new e,i.position=o,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function $(t,n,r,i){let o=t.renderSpatialReference,s=new p({spatialReference:N(t)});return await y(n.eye,o,s,{signal:i}),a(i),new e({position:s,heading:n.heading,tilt:n.tilt,fov:r})}function ve(e,t){let n=e.basemapTerrain?.tilingScheme;if(!n)j().error(`#scaleToZoom()`,`Cannot compute zoom from scale without a tiling scheme`);else return n.levelAtScale(t)}function ye(e,t){let n=e.basemapTerrain?.tilingScheme;if(!n)j().error(`#zoomToScale()`,`Cannot compute scale from zoom without a tiling scheme`);else return n.scaleAtLevel(t)}export{P as applyTiltAdjustToScale,L as fromCenterDistanceAsync,oe as fromCenterDistanceSync,ae as fromCenterScale,ue as fromExtentAsync,de as fromExtentSync,B as getObserverForPointAtDistanceAsync,z as getObserverForPointAtDistanceSync,N as getViewSR,ee as headingTiltToDirectionUp,F as removeTiltAdjustFromScale,re as scaleErrorThreshold,ve as scaleToZoom,pe as toArea,fe as toExtent,ie as viewScaleToCameraDistance,ye as zoomToScale};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{asinClamped as e,deg2rad as t,rad2deg as n}from"../../../core/mathUtils.js";import{getReferenceEllipsoid as r}from"../../../geometry/ellipsoidUtils.js";import i from"../../../geometry/Point.js";function a(e,t,n){if(t.longitude==null||t.latitude==null||n.longitude==null||n.latitude==null)throw Error(`Invalid points: no lon/lat`);return o(e,t.longitude,t.latitude,n.longitude,n.latitude)}function o(n,r,i,a,o){let s=t(i),c=t(o),l=t(r),u=t(a),d=s-c,f=l-u,p=Math.sin(d/2),m=Math.sin(f/2),h=2*e(Math.sqrt(p*p+Math.cos(s)*Math.cos(c)*m*m))*n;return Math.round(h*1e4)/1e4}function s(e,t,n){let o=t.spatialReference,s=r(o),c=new i(t.x,e.y,o),l=new i(n.x,e.y,o),u=new i(e.x,t.y,o),d=new i(e.x,n.y,o);return{lon:a(s.radius,c,l),lat:a(s.radius,u,d)}}function c(r,i,a){let o=i/a,s=t(r),c=Math.sin(o/2),l=Math.cos(s),u=2*e(Math.sqrt(c*c/(l*l)));return n(u)}function l(e,t){let n=e/15;return t||(n=Math.round(n)),n}function u(e,t){let n=e?.[0];if(n==null)return null;t||={hours:0,minutes:0,seconds:0},t.hours=l(n,!0);let r=t.hours%1;t.hours-=r,t.minutes=r*60;let i=t.minutes%1;return t.minutes-=i,t.seconds=Math.round(i*60),t}export{o as getGreatCircleDistance,a as getGreatCircleDistanceFromPoints,s as getGreatCircleSpanAt,c as getLonDeltaForDistance,l as longitudeToTimezone,u as positionToTimezoneInfo};
2
+ import{asinClamped as e,deg2rad as t,rad2deg as n}from"../../../core/mathUtils.js";import{getReferenceEllipsoid as r}from"../../../geometry/ellipsoidUtils.js";import i from"../../../geometry/Point.js";function a(e,t,n){if(t.longitude==null||t.latitude==null||n.longitude==null||n.latitude==null)throw Error(`Invalid points: no lon/lat`);return o(e,t.longitude,t.latitude,n.longitude,n.latitude)}function o(n,r,i,a,o){let s=t(i),c=t(o),l=t(r),u=t(a),d=s-c,f=l-u,p=Math.sin(d/2),m=Math.sin(f/2),h=2*e(Math.sqrt(p*p+Math.cos(s)*Math.cos(c)*m*m))*n;return Math.round(h*1e4)/1e4}function s(e,t,n){let o=t.spatialReference,s=r(o),c=new i({x:t.x,y:e.y,spatialReference:o}),l=new i({x:n.x,y:e.y,spatialReference:o}),u=new i({x:e.x,y:t.y,spatialReference:o}),d=new i({x:e.x,y:n.y,spatialReference:o});return{lon:a(s.radius,c,l),lat:a(s.radius,u,d)}}function c(r,i,a){let o=i/a,s=t(r),c=Math.sin(o/2),l=Math.cos(s),u=2*e(Math.sqrt(c*c/(l*l)));return n(u)}function l(e,t){let n=e/15;return t||(n=Math.round(n)),n}function u(e,t){let n=e?.[0];if(n==null)return null;t||={hours:0,minutes:0,seconds:0},t.hours=l(n,!0);let r=t.hours%1;t.hours-=r,t.minutes=r*60;let i=t.minutes%1;return t.minutes-=i,t.seconds=Math.round(i*60),t}export{o as getGreatCircleDistance,a as getGreatCircleDistanceFromPoints,s as getGreatCircleSpanAt,c as getLonDeltaForDistance,l as longitudeToTimezone,u as positionToTimezoneInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,dist as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{negate as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as c}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as l}from"../../../../geometry/projection/projectors.js";import{fromBuffer as u,center as d,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as p}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as m}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as h}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as g}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as _}from"../../layers/graphics/olidUtils.js";import{getPlanarDistanceToGroundRatio as v}from"../planarDistanceToGroundRatio.js";import{Attribute as y}from"../../webgl-engine/lib/Attribute.js";import{BufferGeometry as b}from"../../webgl-engine/lib/BufferGeometry.js";import{Buffers as x}from"../../webgl-engine/lib/Buffers.js";import{Geometry as S}from"../../webgl-engine/lib/Geometry.js";import{createVerticesView as C}from"../../webgl-engine/lib/VerticesView.js";import{isImagePattern as w}from"../../webgl-engine/materials/lineStippleUtils.js";import{ribbonLineVertexCount as T,writeRibbonLineTextureBuffer as E,writeRibbonLineVertices as D}from"../../webgl-engine/materials/internal/ribbonLineBufferUtils.js";import{getLayout as ee,getTextureBufferLayout as te}from"../../webgl-engine/shaders/RibbonLineLayouts.js";function O(e,t,n=null){let r=[],i=t.mapPositions,a=j(t,r),o=a.data,s=a.indices.length,c=g(s);return M(t,r,c),F(t,r,c),N(t,r,c),P(t,r,a.indices,c),I(t,r,a.indices,c),L(t,r),R(t,r,a.indices,c),z(e,t,r,o),n!=null&&_(r,n,c),new S(e,r,i)}function k(e,t){return u(e,X),d(X,Z),t.getOrigin(Z)}function A(t,n,r,i){let o=n.attributeData,s=C({data:o.position,size:3,stride:3},3),c=!!t.parameters.isClosed&&s.count>2,l=ee(t.parameters).createBuffer(T(s.count,c,t.parameters)),u=te(t.parameters).createBuffer(s.count+(c?3:2)),d=u.layout.fields.has(`u0`)?B(t.parameters,n.overlayInfo,o.position):null;return a(Q,r.vec3),e($,Q),E({...o,position:s,distancesToStart:d,olidColor:i},c,{buffer:u,offset:0},$),D(s.count,c,t.parameters,{buffer:l,offset:0},0),new b(t,new x(l,u),r,n.mapPositions)}function j(e,t){let{attributeData:{position:n},removeDuplicateStartEnd:r}=e,i=n.length/3,a=i>2&&V(n)&&r,o=i-+!!a,s=Array(2*(o-1)),c=a?n.slice(0,-3):n,l=0;for(let e=0;e<o-1;e++)s[l++]=e,s[l++]=e+1;let u=new y(c,s,3,a);return t.push([`position`,u]),u}function M(e,t,n){if(e.attributeData.colorFeature!=null)return;let r=e.attributeData.color;t.push([`color`,new y(r??s,n,4)])}function N(e,t,n){e.attributeData.normal&&t.push([`normal`,new y(e.attributeData.normal,n,3)])}function P(e,t,n,r){let i=e.attributeData.colorFeature;i!=null&&(typeof i==`number`?t.push([`colorFeatureAttribute`,new y([i],r,1,!0)]):t.push([`colorFeatureAttribute`,new y(i,n,1,!0)]))}function F(e,t,n){e.attributeData.sizeFeature??t.push([`size`,new y([e.attributeData.size??1],n,1,!0)])}function I(e,t,n,r){let i=e.attributeData.sizeFeature;i!=null&&(typeof i==`number`?t.push([`sizeFeatureAttribute`,new y([i],r,1,!0)]):t.push([`sizeFeatureAttribute`,new y(i,n,1,!0)]))}function L(e,t){let{attributeData:{position:n,timeStamps:r}}=e;if(!r)return;let i=n.length/3,a=Array(2*(i-1)),o=0;for(let e=0;e<i-1;e++)a[o++]=e,a[o++]=e+1;t.push([`timeStamps`,new y(r,a,G,!0)])}function R(e,t,n,r){let i=e.attributeData.opacityFeature;i!=null&&(typeof i==`number`?t.push([`opacityFeatureAttribute`,new y([i],r,1,!0)]):t.push([`opacityFeatureAttribute`,new y(i,n,1,!0)]))}function z(e,{overlayInfo:t},n,r){let i=B(e.parameters,t,r);i!=null&&n.push([`distanceToStart`,new y(i,n[0][1].indices,1,!0)])}function B(e,t,i){if(t==null||!H(e)||e.stipplePattern==null)return null;let{renderCoordsHelper:a,spatialReference:o}=t,s=o.isGeographic&&a.viewingMode===1,u=e.worldSized||w(e.stipplePattern);if(!u&&!s)return null;let d=i;if(s){let e=p(i.length),t=c(o);for(let n=0;n<e.length;n+=3)l(i,n,e,n,t);d=e}let f=i.length/3,h=m(f+1),g=a.viewingMode===1,_=U,y=W,b=0,x=0,S=0;n(_,d[x++],d[x++]),x++,h[0]=0;for(let e=1;e<f+1;++e){e===f&&(x=0);let t=x;n(y,d[x++],d[x++]),x++;let a=(i[S+1]+i[t+1])/2,s=u?v(o,g,a):1;b+=r(_,y)*s,h[e]=b,[_,y]=[y,_],S=t}return h}function V(e){let t=e.length;return e[0]===e[t-3]&&e[1]===e[t-2]&&e[2]===e[t-1]}function H(e){return`stipplePattern`in e}const U=i(),W=i(),G=4;function K(e,t,n,r,i){if(e==null||e.length===0)return[];let a=[];return e.forEach((e,o)=>{let s=e.length,c=p(s*3);e.forEach((e,t)=>{c[t*3]=e[0],c[t*3+1]=e[1],c[t*3+2]=e[2]});let l={attributeData:{position:c,normal:t,colorFeature:n?.[o],opacityFeature:r?.[o],sizeFeature:i?.[o]},removeDuplicateStartEnd:!1};a.push(l)}),a}function q(e,t,n,r,i,a){if(e==null||e.length===0)return[];let o=K(e,t,r,i,a);return e.forEach((e,t)=>{let r=n?.[t],i=r==null?void 0:Y(r.timeStamps,r.stage);o[t].attributeData.timeStamps=i}),o}function J(e,t=0,n=.01){let r=h(e.length);r[0]=0;for(let t=1;t<e.length;t++){let n=e[t-1],i=e[t],a=Math.sqrt((i[0]-n[0])**2+(i[1]-n[1])**2+(i[2]-n[2])**2);r[t]=r[t-1]+a}let i=r.map(e=>e*n);if(t!==0&&t<i.length){let e=i[t];for(let t=0;t<i.length;t++)i[t]-=e}return i}function Y(e,t){let n=h(e.length*4),r=e[0],i=e[e.length-1];for(let a=0;a<e.length;a++)n[a*4]=e[a],n[a*4+1]=r,n[a*4+2]=i,n[a*4+3]=t+.5;return n}const X=f(),Z=o(),Q=o(),$=t();export{q as animatedLineStripsToParameters,B as computeLineDistances,A as createBufferGeometry,O as createGeometry,J as getLinearTimeStamps,K as lineStripsToParameters,G as numTimeStampValuesPerVertex,k as selectLocalOrigin,Y as timeStampsToAttribute};
2
+ import{translateAffine as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as r,dist as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{negate as o,set as s,transformMat4 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as f}from"../../../../geometry/projection/projectors.js";import{center as p,fromBuffer as m,setEmpty as h,expandWithVec3 as g,create as _}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as ee}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as y}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as b}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as te}from"../../layers/graphics/olidUtils.js";import{getPlanarDistanceToGroundRatio as ne}from"../planarDistanceToGroundRatio.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{BufferGeometry as S}from"../../webgl-engine/lib/BufferGeometry.js";import{Buffers as C}from"../../webgl-engine/lib/Buffers.js";import{Geometry as w}from"../../webgl-engine/lib/Geometry.js";import{createVerticesView as T}from"../../webgl-engine/lib/VerticesView.js";import{isImagePattern as re}from"../../webgl-engine/materials/lineStippleUtils.js";import{writeRibbonLineTextureBuffer as E,isClosed as D,ribbonLineVertexCount as ie,writeRibbonLineVertices as ae}from"../../webgl-engine/materials/internal/ribbonLineBufferUtils.js";import{getLayout as oe,getTextureBufferLayout as O}from"../../webgl-engine/shaders/RibbonLineLayouts.js";function k(e,t,n=null){let r=[],i=t.mapPositions,a=P(t,r),o=a.data,s=a.indices.length,c=b(s);return F(t,r,c),R(t,r,c),I(t,r,c),L(t,r,a.indices,c),z(t,r,a.indices,c),B(t,r),V(t,r,a.indices,c),H(e,t,r,o),n!=null&&te(r,n,c),new w(e,r,i)}function A(n,r,i,a,s=null){let c=r.attributeData,l=T({data:c.position,size:3,stride:3},3),u=D(n.parameters,l.count),d=oe(n.parameters).createBuffer(ie(l.count,u,n.parameters)),f=O(n.parameters).createBuffer(l.count+(u?3:2)),p=f.layout.fields.has(`u0`)?U(n.parameters,r.overlayInfo,c.position):null;return o(Q,i.vec3),e($,s??t,Q),E({...c,position:l,distancesToStart:p,olidColor:a},u,{buffer:f,offset:0},$),ae(l.count,u,n.parameters,{buffer:d,offset:0},0),new S(n,new C(d,f),i,r.mapPositions)}function j(n,r,i,a=null){o(Q,n.localOrigin.vec3),e($,a??t,Q);let s=T({data:r,size:3,stride:3},3);E({position:s,color:i},D(n.material.parameters,s.count),{buffer:n.getMutableBuffers().storage,offset:0},$)}function M(e,t,n=null){let r=Y(X,e,n);return p(r,Z),t.getOrigin(Z)}function N(e,t,n,r=null){let i=Y(X,n,r);return p(i,Z),t.needsOriginUpdate(e,Z,0)}function P(e,t){let{attributeData:{position:n},removeDuplicateStartEnd:r}=e,i=n.length/3,a=i>2&&W(n)&&r,o=i-+!!a,s=Array(2*(o-1)),c=a?n.slice(0,-3):n,l=0;for(let e=0;e<o-1;e++)s[l++]=e,s[l++]=e+1;let u=new x(c,s,3,a);return t.push([`position`,u]),u}function F(e,t,n){if(e.attributeData.colorFeature!=null)return;let r=e.attributeData.color;t.push([`color`,new x(r??u,n,4)])}function I(e,t,n){e.attributeData.normal&&t.push([`normal`,new x(e.attributeData.normal,n,3)])}function L(e,t,n,r){let i=e.attributeData.colorFeature;i!=null&&(typeof i==`number`?t.push([`colorFeatureAttribute`,new x([i],r,1,!0)]):t.push([`colorFeatureAttribute`,new x(i,n,1,!0)]))}function R(e,t,n){e.attributeData.sizeFeature??t.push([`size`,new x([e.attributeData.size??1],n,1,!0)])}function z(e,t,n,r){let i=e.attributeData.sizeFeature;i!=null&&(typeof i==`number`?t.push([`sizeFeatureAttribute`,new x([i],r,1,!0)]):t.push([`sizeFeatureAttribute`,new x(i,n,1,!0)]))}function B(e,t){let{attributeData:{position:n,timeStamps:r}}=e;if(!r)return;let i=n.length/3,a=Array(2*(i-1)),o=0;for(let e=0;e<i-1;e++)a[o++]=e,a[o++]=e+1;t.push([`timeStamps`,new x(r,a,q,!0)])}function V(e,t,n,r){let i=e.attributeData.opacityFeature;i!=null&&(typeof i==`number`?t.push([`opacityFeatureAttribute`,new x([i],r,1,!0)]):t.push([`opacityFeatureAttribute`,new x(i,n,1,!0)]))}function H(e,{overlayInfo:t},n,r){let i=U(e.parameters,t,r);i!=null&&n.push([`distanceToStart`,new x(i,n[0][1].indices,1,!0)])}function U(e,t,n){if(t==null||!G(e)||e.stipplePattern==null)return null;let{renderCoordsHelper:a,spatialReference:o}=t,s=o.isGeographic&&a.viewingMode===1,c=e.worldSized||re(e.stipplePattern);if(!c&&!s)return null;let l=n;if(s){let e=v(n.length),t=d(o);for(let r=0;r<e.length;r+=3)f(n,r,e,r,t);l=e}let u=n.length/3,p=ee(u+1),m=a.viewingMode===1,h=K,g=se,_=0,y=0,b=0;r(h,l[y++],l[y++]),y++,p[0]=0;for(let e=1;e<u+1;++e){e===u&&(y=0);let t=y;r(g,l[y++],l[y++]),y++;let a=(n[b+1]+n[t+1])/2,s=c?ne(o,m,a):1;_+=i(h,g)*s,p[e]=_,[h,g]=[g,h],b=t}return p}function W(e){let t=e.length;return e[0]===e[t-3]&&e[1]===e[t-2]&&e[2]===e[t-1]}function G(e){return`stipplePattern`in e}const K=a(),se=a(),q=4;function ce(e,t,n,r,i,a){if(e==null||e.length===0)return[];let o=[];for(let s=0;s<e.length;s++){let c=e[s];if(c.length<2)continue;let l=c.length,u=v(l*3);for(let e=0;e<l;e++){let t=c[e];u[e*3]=t[0],u[e*3+1]=t[1],u[e*3+2]=t[2]}let d=a?.[s];o.push({attributeData:{position:u,normal:t,colorFeature:n?.[s],opacityFeature:r?.[s],sizeFeature:i?.[s],timeStamps:d==null?void 0:J(d.timeStamps,d.stage)},removeDuplicateStartEnd:!1})}return o}function le(e,t=0,n=.01){let r=y(e.length);r[0]=0;for(let t=1;t<e.length;t++){let n=e[t-1],i=e[t],a=Math.sqrt((i[0]-n[0])**2+(i[1]-n[1])**2+(i[2]-n[2])**2);r[t]=r[t-1]+a}let i=r.map(e=>e*n);if(t!==0&&t<i.length){let e=i[t];for(let t=0;t<i.length;t++)i[t]-=e}return i}function J(e,t){let n=y(e.length*4),r=e[0],i=e[e.length-1];for(let a=0;a<e.length;a++)n[a*4]=e[a],n[a*4+1]=r,n[a*4+2]=i,n[a*4+3]=t+.5;return n}function Y(e,t,n){if(n==null)return m(t,e);h(e);for(let r=0;r<t.length;r+=3)s(Z,t[r],t[r+1],t[r+2]),c(Z,Z,n),g(e,Z);return e}const X=_(),Z=l(),Q=l(),$=n();export{U as computeLineDistances,A as createBufferGeometry,k as createGeometry,le as getLinearTimeStamps,ce as lineStripsToParameters,N as needsBufferGeometryOriginUpdate,q as numTimeStampValuesPerVertex,M as selectLocalOrigin,J as timeStampsToAttribute,j as updateBufferGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as t}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as n}from"../../../../geometry/support/HalfFloatArray.js";import{zValueInAbsoluteHeightMode as r}from"../../../../support/elevationInfoUtils.js";import{convertVisualVariables as i,ConvertOptions as a}from"../../layers/support/FastSymbolUpdates.js";import{animatedLineStripsToParameters as o,selectLocalOrigin as s,createBufferGeometry as c}from"../engineContent/line.js";import{valuesPerFlowVertex as l}from"./loadUtils.js";import{drapedZ as u}from"../../terrain/DrapedZ.js";function d(e,r,{vertices:i,stage:a,hasMagnitude:d},f,m,h){let{spatialReference:g}=r.extent,_=[],v=l(d),y=r.flowExtentInfo.modelSize[0],b=0;for(let t=0;t<i.length;t+=v){if(h&&t>0){let e=i[t]-i[t-v];e>y/2?b-=y:-e>y/2&&(b+=y)}let[n,a]=r.modelToMapSpace(i[t]+b,i[t+1],!1),o=h?[n,a,u]:p(n,a,g,e,f);_.push(o)}let x=Math.floor(i.length/v),S=n(x);for(let e=0;e<x;e++)S[e]=i[e*v+2];let{hasVVColor:C,hasVVOpacity:w,hasVVSize:T}=m.parameters,E=C||w||T,D,O,k;if(d&&E){let e=t(x);for(let t=0;t<x;t++)e[t]=i[t*v+3];C&&(D=[e]),w&&(O=[e]),T&&(k=[e])}let A=o([_],void 0,[{timeStamps:S,stage:a}],D,O,k),j=h?e.overlayManager.renderer.localOriginFactory:e.stage.localOriginFactory,M=s(A[0].attributeData.position,j);return c(m,A[0],M)}function f(e,t,n){if(e==null)return{};let r=null;if(e.visualVariables){let t=[],n=e.visualVariables,o=new a({supports:{size:!0,color:!0,rotation:!1,opacity:!0}});r=i(n,o,t)}let o=r?.color?[1,1,1,1]:e.color.toUnitRGBA();return o[3]*=t,{color:o,width:e.trailWidth,cap:0,animationSpeed:e.flowSpeed,trailLength:e.trailLength,animation:3,emissiveStrength:n,vvColor:r?.color,vvOpacity:r?.opacity,vvSize:r?.size}}function p(t,n,i,a,o){let{absoluteZ:s}=r(t,n,0,i,a,o),c=e(t,n,s);return a.renderCoordsHelper.toRenderCoords(c,i,c),c}export{d as createStreamlineGeometry,f as materialParametersFromRenderer};
2
+ import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as t}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as n}from"../../../../geometry/support/HalfFloatArray.js";import{zValueInAbsoluteHeightMode as r}from"../../../../support/elevationInfoUtils.js";import{convertVisualVariables as i,ConvertOptions as a}from"../../layers/support/FastSymbolUpdates.js";import{lineStripsToParameters as o,selectLocalOrigin as s,createBufferGeometry as c}from"../engineContent/line.js";import{valuesPerFlowVertex as l}from"./loadUtils.js";import{drapedZ as u}from"../../terrain/DrapedZ.js";function d(e,r,{vertices:i,stage:a,hasMagnitude:d},f,m,h){let{spatialReference:g}=r.extent,_=[],v=l(d),y=r.flowExtentInfo.modelSize[0],b=0;for(let t=0;t<i.length;t+=v){if(h&&t>0){let e=i[t]-i[t-v];e>y/2?b-=y:-e>y/2&&(b+=y)}let[n,a]=r.modelToMapSpace(i[t]+b,i[t+1],!1),o=h?[n,a,u]:p(n,a,g,e,f);_.push(o)}let x=Math.floor(i.length/v),S=n(x);for(let e=0;e<x;e++)S[e]=i[e*v+2];let{hasVVColor:C,hasVVOpacity:w,hasVVSize:T}=m.parameters,E=C||w||T,D,O,k;if(d&&E){let e=t(x);for(let t=0;t<x;t++)e[t]=i[t*v+3];C&&(D=[e]),w&&(O=[e]),T&&(k=[e])}let A=o([_],void 0,D,O,k,[{timeStamps:S,stage:a}]),j=h?e.overlayManager.renderer.localOriginFactory:e.stage.localOriginFactory,M=s(A[0].attributeData.position,j);return c(m,A[0],M)}function f(e,t,n){if(e==null)return{};let r=null;if(e.visualVariables){let t=[],n=e.visualVariables,o=new a({supports:{size:!0,color:!0,rotation:!1,opacity:!0}});r=i(n,o,t)}let o=r?.color?[1,1,1,1]:e.color.toUnitRGBA();return o[3]*=t,{color:o,width:e.trailWidth,cap:0,animationSpeed:e.flowSpeed,trailLength:e.trailLength,animation:3,emissiveStrength:n,vvColor:r?.color,vvOpacity:r?.opacity,vvSize:r?.size}}function p(t,n,i,a,o){let{absoluteZ:s}=r(t,n,0,i,a,o),c=e(t,n,s);return a.renderCoordsHelper.toRenderCoords(c,i,c),c}export{d as createStreamlineGeometry,f as materialParametersFromRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as n}from"../../../../core/memoryEstimations.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{signal as i}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{exactEquals as s,copy as c,normalize as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as f,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as h}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as _}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as v}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as y}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as b}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as x}from"./GaussianSplatTextureAtlas.js";import{DepthRange as S}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as C}from"../../../support/Scheduler.js";class w{constructor(e,t,n){this._updating=i(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this._sortWorkerMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new S,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=[],this._latestSortedGaussianTiles=[],this._nextCommittedVisibleGaussianTiles=[],this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortReason=null,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._viewSortInterval=a(80),this._dataSortInterval=a(160),this._renderer=e,this._onSortComplete=t,this._orderTexture=new b(this._renderer.renderingContext),this._fadingTexture=new v(this._renderer.renderingContext),this._headerTexture=new y(this._renderer.renderingContext),this._textureAtlas=new x(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,n);let{resourceController:r}=this._renderer.view;this._workerHandle=new _(h(r)),this._frameTask=r.scheduler.registerTask(C.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get sortWorkerMemory(){return this._sortWorkerMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory+this.sortWorkerMemory}queryVisibleTileDepthRange(e,t){if(this.visibleGaussians===0)return null;let{eye:n,viewForward:r}=e,i=n[0],a=n[1],o=n[2],l=r[0],u=r[1],d=r[2],h=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&s(this._previousVisibleTileDepthRangeEye,n)&&s(this._previousVisibleTileDepthRangeViewForward,r)&&(t==null?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&f(this._previousVisibleTileDepthRangeClippingBox,t)))return h.near<=h.far?h:null;let g=1/0,_=-1/0,v=this._latestSortedGaussianTiles;for(let e=0;e<v.length;e++){let n=v[e];if(t!=null){let e=n.boundingBox;if(!p(e,t))continue}let r=l*(n.obbCenterX-i)+u*(n.obbCenterY-a)+d*(n.obbCenterZ-o),s=n.paddedMbsRadius,c=r-s;c<g&&(g=c);let f=r+s;f>_&&(_=f)}let y=g<=_;return y?h.set(g,_):h.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=t!=null,c(this._previousVisibleTileDepthRangeEye,n),c(this._previousVisibleTileDepthRangeViewForward,r),t!=null&&m(this._previousVisibleTileDepthRangeClippingBox,t),y?h:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort(`data`)}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortReason=null,this._updating.value=!1,this._scheduledSortStartTimeout!=null&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._sortWorkerMemory=0,this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(e=`view`){this._updating.value=!0,this._pendingSortReason!==`view`&&this._pendingSortReason!==e&&(this._pendingSortReason=e,this._scheduledSortStartTimeout!=null&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;let e=o()-this._lastSortStartTime,t=(this._pendingSortReason===`view`?this._viewSortInterval:this._dataSortInterval)-e;t<=0?this._startSortIfRequired():this._scheduledSortStartTimeout??=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortReason!=null&&!this._isSorting&&this._scheduleSortStart()},t)}_startSortIfRequired(){if(this._isSorting||this._pendingSortReason==null)return;let e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortReason=null,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortReason==null?this._updating.value=!1:this._scheduleSortStart()}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,n){let r=Math.max(1,t);for(;r<n;)r=Math.ceil(r*e);return r}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){let t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=n(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._sortWorkerMemory=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(this._latestUpdatedGaussianTiles.length===0){this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1);return}this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);let t=this._latestUpdatedGaussianTiles,n=t.length,r=this._requestedLyr3dVisibilityChange,i=0;for(let e=0;e<n;e++)i+=t[e].gaussianCount;this._ensureSortBufferCapacity(i),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);let a=this._renderer.camera;l(this._cameraDirectionNormalized,a.ray.direction);let o=this._cameraDirectionNormalized[0],s=this._cameraDirectionNormalized[1],c=this._cameraDirectionNormalized[2],u=0,d=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0,{frustum:h}=a,_=this._renderer.tileCullingRevision,v=h[0],y=h[1],b=h[2],x=h[3],S=h[4],C=h[5];for(let e=0;e<n;e++){let n=t[e],{obbCenterX:r,obbCenterY:i,obbCenterZ:a,paddedMbsRadius:o}=n,s=n.gaussianCount;if(n.cullingRevision!==_){let e=d==null||p(n.boundingBox,d);if(e){let t=o*1.5;e=v[0]*r+v[1]*i+v[2]*a+v[3]<t&&y[0]*r+y[1]*i+y[2]*a+y[3]<t&&b[0]*r+b[1]*i+b[2]*a+b[3]<t&&x[0]*r+x[1]*i+x[2]*a+x[3]<t&&S[0]*r+S[1]*i+S[2]*a+S[3]<t&&C[0]*r+C[1]*i+C[2]*a+C[3]<t}n.cullingRevision=_,n.cullingVisible=e}n.cullingVisible&&(f[m++]=n,u+=s)}if(f.length=m,u===0){this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=r,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1);return}let w=new Map,T=[],E=new Uint32Array(m);for(let e=0;e<m;e++){let t=f[e],n=t.handle;w.set(n,t),E[e]=n,this._workerResidentTiles.get(n)!==t&&T.push({handle:n,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}let D=[];for(let e of this._workerResidentTiles.keys())w.has(e)||D.push(e);let O=new g(T,Uint32Array.from(D),E,this._sortedAtlasIndicesBuffer,u,o,s,c,this._useDeterministicSort),k=await this._workerHandle?.sort(O,e);if(e.aborted)return;k&&(this._sortedAtlasIndicesBuffer=k.sortedAtlasIndices,this._sortWorkerMemory=k.usedMemory,this._workerResidentTiles=w),await this._frameTask.schedule(async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);let t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=r,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()},e)}catch(e){if(r(e))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{w as GaussianSplatDataStore};
2
+ import{exactEquals as e,copy as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,exactEquals as i,intersects as a,copy as o}from"../../../../geometry/support/aaBoundingBox.js";import{GaussianSplatFadeTexture as s}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as c}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as l}from"./GaussianSplatOrderTexture.js";import{GaussianSplatSortCoordinator as u}from"./GaussianSplatSortCoordinator.js";import{GaussianSplatTextureAtlas as d}from"./GaussianSplatTextureAtlas.js";import{DepthRange as f}from"../../webgl-engine/lib/DepthRange.js";class p{constructor(e,t,i){this._visibleTileDepthRange=new f,this._previousVisibleTileDepthRangeEye=n(),this._previousVisibleTileDepthRangeViewForward=n(),this._previousVisibleTileDepthRangeClippingBox=r(),this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._orderTexture=new l(e.renderingContext),this._fadingTexture=new s(e.renderingContext),this._headerTexture=new c(e.renderingContext),this._textureAtlas=new d(e.renderingContext,e.view.resourceController.memoryController,e.fboCache,i),this._sortCoordinator=new u(e,{ensureCapacity:()=>{this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount)},clear:()=>{this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear(),this._previousVisibleTileDepthRangeTilesVersion=-1},setOrder:(e,t)=>this._orderTexture.setData(e,t)},t)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortCoordinator.sortBufferMemory}get sortWorkerMemory(){return this._sortCoordinator.sortWorkerMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory+this.sortWorkerMemory}get visibleGaussians(){return this._sortCoordinator.visibleGaussians}get updating(){return this._sortCoordinator.updating}set useDeterministicSort(e){this._sortCoordinator.useDeterministicSort=e}queryVisibleTileDepthRange(n,r){if(this.visibleGaussians===0)return null;let{eye:s,viewForward:c}=n,l=s[0],u=s[1],d=s[2],f=c[0],p=c[1],m=c[2],h=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._sortCoordinator.visibleTilesVersion&&e(this._previousVisibleTileDepthRangeEye,s)&&e(this._previousVisibleTileDepthRangeViewForward,c)&&(r==null?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&i(this._previousVisibleTileDepthRangeClippingBox,r)))return h.near<=h.far?h:null;let g=1/0,_=-1/0,v=this._sortCoordinator.visibleTiles;for(let e=0;e<v.length;e++){let t=v[e];if(r!=null){let e=t.boundingBox;if(!a(e,r))continue}let n=f*(t.obbCenterX-l)+p*(t.obbCenterY-u)+m*(t.obbCenterZ-d),i=t.paddedMbsRadius,o=n-i;o<g&&(g=o);let s=n+i;s>_&&(_=s)}let y=g<=_;return y?h.set(g,_):h.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._sortCoordinator.visibleTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=r!=null,t(this._previousVisibleTileDepthRangeEye,s),t(this._previousVisibleTileDepthRangeViewForward,c),r!=null&&o(this._previousVisibleTileDepthRangeClippingBox,r),y?h:null}updateGaussianVisibility(e,t){this._sortCoordinator.updateGaussianVisibility(e,t)}requestSort(e=`view`){this._sortCoordinator.requestSort(e)}destroy(){this._sortCoordinator.destroy(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}}export{p as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{subtract as e,length as t,scale as n,negate as r,dot as i,transformQuatValues as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{project as c}from"../../../../geometry/projectionUtils.js";import{intersects as l,contains as u}from"../../../../geometry/support/aaBoundingBox.js";import{fromExtent as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as f}from"../../../../geometry/support/plane.js";import{fromPoints as p}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as m}from"../../layers/i3s/Intersector.js";import{createTileBVH as h}from"../../layers/support/Tiles3DBVH.js";import{ElevationRange as g}from"../ElevationRange.js";import{gaussianEllipsoidScaleMultiplier as _}from"./formatConstants.js";import{IntersectorResultRay as v}from"../../webgl-engine/lib/IntersectorResult.js";class y{constructor(e){this.layerView=e,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this._ellipsoidLocalRayOrigin=o(),this._ellipsoidLocalRayDir=o(),this.intersectionNormal=o(),this.intersectionRayDir=o(),this.intersectionPlane=f(),this.layerViewUid=e.uid;let t=e.view.viewingMode,n=(e.useEsriCrs?e.fullExtentInLocalViewSpatialReference:e.layer.fullExtent?c(e.layer.fullExtent,e.view.renderSpatialReference):void 0)??e.view.extent,r=d(n);this._bvh=h(t,r)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}get elevationRange(){let e=this._bvh.elevationRange;return e!=null&&!e.isEmpty?new g(e.minElevation,e.maxElevation):null}intersectRay(a,c,d,f,h,g){let{intersectionRayDir:_,intersectionPlane:y,layerViewUid:S,intersectionNormal:C}=this,w=p(d,f);e(_,f,d);let T=1/t(_);n(_,_,T),r(C,_),s(y,_[0],_[1],_[2],-i(_,d));let E=new x,D=new x,O=a.options.store,k=O===0,A=O===2,j=O===1||A,M=A?[]:null,N=(e,t,n,r,i,a,s,c)=>{let l=e.point??=o();l[0]=n,l[1]=r,l[2]=i,e.dist=t,e.normal=C;let u=e.outwardDirection??=o(),d=a*a+s*s+c*c;if(d>0){let e=1/Math.sqrt(d);u[0]=a*e,u[1]=s*e,u[2]=c*e}else u[0]=C[0],u[1]=C[1],u[2]=C[2];return e.layerViewUid=S,e},P=d[0],F=d[1],I=d[2],L=_[0],R=_[1],z=_[2],B=this.layerView.clippingBox,V=e=>{let{relativePositions:t,packedRotations:n,packedOpacityScaledScales:r,gaussianCount:i,obb:a,maxSplatMbsRadiusSquared:o}=e,s=a.centerX,l=a.centerY,u=a.centerZ,p=-1,m=B[0],h=B[1],g=B[2],_=B[3],v=B[4],y=B[5];for(let e=0,a=0;e<i;e++,a+=3){let i=t[a]+s,b=t[a+1]+l,S=t[a+2]+u;if(i<m||b<h||S<g||i>_||b>v||S>y)continue;let C=i-P,w=b-F,O=S-I,B=C*L+w*R+O*z;if(B<0&&B*B>o)continue;let V=B<0?0:B;if(C*C+w*w+O*O-V*V>o||k&&E.dist!=null&&(p<0&&(p=Math.sqrt(o)),Math.max(B-p,0)*T>=E.dist))continue;let H=this._intersectGaussianEllipsoid(C,w,O,L,R,z,n[e],r[e]);if(H<0)continue;let U=H*T;if(c!=null&&!c(d,f,U))continue;let W=E.dist==null||U<E.dist,G=j&&(D.dist==null||U>D.dist);if(!W&&!G&&!A)continue;let K=L*H,q=R*H,ee=z*H,J=P+K,Y=F+q,X=I+ee,Z=K-C,Q=q-w,$=ee-O;if(W&&N(E,U,J,Y,X,Z,Q,$),G&&N(D,U,J,Y,X,Z,Q,$),A){let e=new x;M.push(N(e,U,J,Y,X,Z,Q,$))}}},H=e=>{let{relativePositions:t,packedRotations:n,packedOpacityScaledScales:r,gaussianCount:i,obb:a,maxSplatMbsRadiusSquared:o}=e,s=a.centerX,l=a.centerY,u=a.centerZ,p=-1,m=P-s,h=F-l,g=I-u;for(let e=0,a=0;e<i;e++,a+=3){let i=t[a]-m,s=t[a+1]-h,l=t[a+2]-g,u=i*L+s*R+l*z;if(u<0&&u*u>o)continue;let _=u<0?0:u;if(i*i+s*s+l*l-_*_>o||k&&E.dist!=null&&(p<0&&(p=Math.sqrt(o)),Math.max(u-p,0)*T>=E.dist))continue;let v=this._intersectGaussianEllipsoid(i,s,l,L,R,z,n[e],r[e]);if(v<0)continue;let y=v*T;if(c!=null&&!c(d,f,y))continue;let b=E.dist==null||y<E.dist,S=j&&(D.dist==null||y>D.dist);if(!b&&!S&&!A)continue;let C=L*v,w=R*v,O=z*v,B=P+C,V=F+w,H=I+O,U=C-i,W=w-s,G=O-l;if(b&&N(E,y,B,V,H,U,W,G),S&&N(D,y,B,V,H,U,W,G),A){let e=new x;M.push(N(e,y,B,V,H,U,W,G))}}},U=(e,t)=>{let{min:n,max:r}=e.obb.signedDistanceRangePlane(y);if(r<0)return;let i=n*T;if(!(k&&E.dist!=null&&E.dist<i)){if(E.dist!=null&&D.dist!=null){let e=r*T;if(E.dist<i&&D.dist>e)return}t?V(e):H(e)}};this._bvh.forEachTileIntersectingRay(d,f,B==null?e=>{U(e,!1)}:e=>{let t=e.boundingBox;l(t,B)&&U(e,!u(B,t))},g);let W=(e,t)=>{let{layerViewUid:n}=t,r=new m(t.point,t.outwardDirection,n);e.set(0,r,t.dist,t.dist,t.normal)};if(b(E)){let e=a.results.min;(e.distance==null||E.dist<e.distance)&&W(e,E)}if(b(D)&&j){let e=a.results.max;(e.distance==null||D.dist>e.distance)&&W(e,D)}if(A&&M?.length)for(let e of M){let t=new v(w);W(t,e),a.results.all.push(t)}}_intersectGaussianEllipsoid(e,t,n,r,i,o,s,c){let l=s>>>30,u=s&1023,d=s>>>10&1023,f=s>>>20&1023,p=(u&S)*C*(1-(u>>>9&1)*2),m=(d&S)*C*(1-(d>>>9&1)*2),h=(f&S)*C*(1-(f>>>9&1)*2),g,_,v,y,b=p*p+m*m+h*h,x=Math.sqrt(Math.max(0,1-b));switch(l){case 0:g=x,_=h,v=m,y=p;break;case 1:g=h,_=x,v=m,y=p;break;case 2:g=h,_=m,v=x,y=p;break;default:g=h,_=m,v=p,y=x}let E=this._ellipsoidLocalRayOrigin;E[0]=-e,E[1]=-t,E[2]=-n,a(E,E,-g,-_,-v,y);let D=this._ellipsoidLocalRayDir;D[0]=r,D[1]=i,D[2]=o,a(D,D,-g,-_,-v,y);let O=T[c&255],k=T[c>>>8&255],A=T[c>>>16],j=E[0]*O,M=E[1]*k,N=E[2]*A,P=j*j+M*M+N*N;if(P<=1)return 0;let F=D[0]*O,I=D[1]*k,L=D[2]*A,R=F*F+I*I+L*L,z=j*F+M*I+N*L;if(z>0)return w;let B=z*z-R*(P-1);return B<0?w:(-z-Math.sqrt(B))/R}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new g(0,0)}}function b(e){return e.dist!=null&&e.point!=null}class x{constructor(){this.point=null,this.dist=null,this.normal=null,this.outwardDirection=null,this.layerViewUid=``}}const S=511,C=Math.SQRT1_2/511,w=-1,T=(()=>{let e=new Float64Array(256);for(let t=0;t<e.length;t++)e[t]=Math.exp(10-t/16)/_;return e})();export{y as GaussianSplatIntersectionHandler};
2
+ import{subtract as e,length as t,scale as n,negate as r,dot as i,transformQuatValues as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{intersects as c,contains as l}from"../../../../geometry/support/aaBoundingBox.js";import{create as u}from"../../../../geometry/support/plane.js";import{fromPoints as d}from"../../../../geometry/support/ray.js";import{GaussianSplatTarget as f}from"../../layers/i3s/Intersector.js";import{createTileBVHForLayer as p}from"../../layers/support/createTileBVHForLayer.js";import{ElevationRange as m}from"../ElevationRange.js";import{gaussianEllipsoidScaleMultiplier as h}from"./formatConstants.js";import{IntersectorResultRay as g}from"../../webgl-engine/lib/IntersectorResult.js";class _{constructor(e){this.layerView=e,this.type=0,this.slicePlaneEnabled=!1,this.isGround=!1,this._ellipsoidLocalRayOrigin=o(),this._ellipsoidLocalRayDir=o(),this.intersectionNormal=o(),this.intersectionRayDir=o(),this.intersectionPlane=u(),this.layerViewUid=e.uid,this._bvh=p(e)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}get elevationRange(){let e=this._bvh.elevationRange;return e!=null&&!e.isEmpty?new m(e.minElevation,e.maxElevation):null}intersectRay(a,u,p,m,h,_){let{intersectionRayDir:b,intersectionPlane:x,layerViewUid:S,intersectionNormal:C}=this,w=d(p,m);e(b,m,p);let T=1/t(b);n(b,b,T),r(C,b),s(x,b[0],b[1],b[2],-i(b,p));let E=new y,D=new y,O=a.options.store,k=O===0,A=O===2,j=O===1||A,M=A?[]:null,N=(e,t,n,r,i,a,s,c)=>{let l=e.point??=o();l[0]=n,l[1]=r,l[2]=i,e.dist=t,e.normal=C;let u=e.outwardDirection??=o(),d=a*a+s*s+c*c;if(d>0){let e=1/Math.sqrt(d);u[0]=a*e,u[1]=s*e,u[2]=c*e}else u[0]=C[0],u[1]=C[1],u[2]=C[2];return e.layerViewUid=S,e},P=p[0],F=p[1],I=p[2],L=b[0],R=b[1],z=b[2],B=this.layerView.clippingBox,V=e=>{let{relativePositions:t,packedRotations:n,packedOpacityScaledScales:r,gaussianCount:i,obb:a,maxSplatMbsRadiusSquared:o}=e,s=a.centerX,c=a.centerY,l=a.centerZ,d=-1,f=B[0],h=B[1],g=B[2],_=B[3],v=B[4],b=B[5];for(let e=0,a=0;e<i;e++,a+=3){let i=t[a]+s,x=t[a+1]+c,S=t[a+2]+l;if(i<f||x<h||S<g||i>_||x>v||S>b)continue;let C=i-P,w=x-F,O=S-I,B=C*L+w*R+O*z;if(B<0&&B*B>o)continue;let V=B<0?0:B;if(C*C+w*w+O*O-V*V>o||k&&E.dist!=null&&(d<0&&(d=Math.sqrt(o)),Math.max(B-d,0)*T>=E.dist))continue;let H=this._intersectGaussianEllipsoid(C,w,O,L,R,z,n[e],r[e]);if(H<0)continue;let U=H*T;if(u!=null&&!u(p,m,U))continue;let W=E.dist==null||U<E.dist,G=j&&(D.dist==null||U>D.dist);if(!W&&!G&&!A)continue;let K=L*H,q=R*H,ee=z*H,J=P+K,Y=F+q,X=I+ee,Z=K-C,Q=q-w,$=ee-O;if(W&&N(E,U,J,Y,X,Z,Q,$),G&&N(D,U,J,Y,X,Z,Q,$),A){let e=new y;M.push(N(e,U,J,Y,X,Z,Q,$))}}},H=e=>{let{relativePositions:t,packedRotations:n,packedOpacityScaledScales:r,gaussianCount:i,obb:a,maxSplatMbsRadiusSquared:o}=e,s=a.centerX,c=a.centerY,l=a.centerZ,d=-1,f=P-s,h=F-c,g=I-l;for(let e=0,a=0;e<i;e++,a+=3){let i=t[a]-f,s=t[a+1]-h,c=t[a+2]-g,l=i*L+s*R+c*z;if(l<0&&l*l>o)continue;let _=l<0?0:l;if(i*i+s*s+c*c-_*_>o||k&&E.dist!=null&&(d<0&&(d=Math.sqrt(o)),Math.max(l-d,0)*T>=E.dist))continue;let v=this._intersectGaussianEllipsoid(i,s,c,L,R,z,n[e],r[e]);if(v<0)continue;let b=v*T;if(u!=null&&!u(p,m,b))continue;let x=E.dist==null||b<E.dist,S=j&&(D.dist==null||b>D.dist);if(!x&&!S&&!A)continue;let C=L*v,w=R*v,O=z*v,B=P+C,V=F+w,H=I+O,U=C-i,W=w-s,G=O-c;if(x&&N(E,b,B,V,H,U,W,G),S&&N(D,b,B,V,H,U,W,G),A){let e=new y;M.push(N(e,b,B,V,H,U,W,G))}}},U=(e,t)=>{let{min:n,max:r}=e.obb.signedDistanceRangePlane(x);if(r<0)return;let i=n*T;if(!(k&&E.dist!=null&&E.dist<i)){if(E.dist!=null&&D.dist!=null){let e=r*T;if(E.dist<i&&D.dist>e)return}t?V(e):H(e)}};this._bvh.forEachTileIntersectingRay(p,m,B==null?e=>{U(e,!1)}:e=>{let t=e.boundingBox;c(t,B)&&U(e,!l(B,t))},_);let W=(e,t)=>{let{layerViewUid:n}=t,r=new f(t.point,t.outwardDirection,n);e.set(0,r,t.dist,t.dist,t.normal)};if(v(E)){let e=a.results.min;(e.distance==null||E.dist<e.distance)&&W(e,E)}if(v(D)&&j){let e=a.results.max;(e.distance==null||D.dist>e.distance)&&W(e,D)}if(A&&M?.length)for(let e of M){let t=new g(w);W(t,e),a.results.all.push(t)}}_intersectGaussianEllipsoid(e,t,n,r,i,o,s,c){let l=s>>>30,u=s&1023,d=s>>>10&1023,f=s>>>20&1023,p=(u&b)*x*(1-(u>>>9&1)*2),m=(d&b)*x*(1-(d>>>9&1)*2),h=(f&b)*x*(1-(f>>>9&1)*2),g,_,v,y,w=p*p+m*m+h*h,T=Math.sqrt(Math.max(0,1-w));switch(l){case 0:g=T,_=h,v=m,y=p;break;case 1:g=h,_=T,v=m,y=p;break;case 2:g=h,_=m,v=T,y=p;break;default:g=h,_=m,v=p,y=T}let E=this._ellipsoidLocalRayOrigin;E[0]=-e,E[1]=-t,E[2]=-n,a(E,E,-g,-_,-v,y);let D=this._ellipsoidLocalRayDir;D[0]=r,D[1]=i,D[2]=o,a(D,D,-g,-_,-v,y);let O=C[c&255],k=C[c>>>8&255],A=C[c>>>16],j=E[0]*O,M=E[1]*k,N=E[2]*A,P=j*j+M*M+N*N;if(P<=1)return 0;let F=D[0]*O,I=D[1]*k,L=D[2]*A,R=F*F+I*I+L*L,z=j*F+M*I+N*L;if(z>0)return S;let B=z*z-R*(P-1);return B<0?S:(-z-Math.sqrt(B))/R}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new m(0,0)}}function v(e){return e.dist!=null&&e.point!=null}class y{constructor(){this.point=null,this.dist=null,this.normal=null,this.outwardDirection=null,this.layerViewUid=``}}const b=511,x=Math.SQRT1_2/511,S=-1,C=(()=>{let e=new Float64Array(256);for(let t=0;t<e.length;t++)e[t]=Math.exp(10-t/16)/h;return e})();export{_ as GaussianSplatIntersectionHandler};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as n}from"../../../../core/memoryEstimations.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{signal as i}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{normalize as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as l}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as u}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as d}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as f}from"../GaussianSplatWorkerHandle.js";import{TaskPriority as p}from"../../../support/Scheduler.js";class m{constructor(e,t,n){this._textures=t,this._updating=i(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this._sortWorkerMemory=0,this.visibleGaussians=0,this._latestSortedGaussianTilesVersion=0,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=[],this._latestSortedGaussianTiles=[],this._nextCommittedVisibleGaussianTiles=[],this._workerResidentTiles=new Map,this._cameraDirectionNormalized=c(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortReason=null,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._viewSortInterval=a(80),this._dataSortInterval=a(160),this._renderer=e,this._onSortComplete=n;let{resourceController:r}=this._renderer.view;this._workerHandle=new f(u(r)),this._frameTask=r.scheduler.registerTask(p.GAUSSIAN_SPLAT_SORTING)}get visibleTiles(){return this._latestSortedGaussianTiles}get visibleTilesVersion(){return this._latestSortedGaussianTilesVersion}get sortBufferMemory(){return this._sortBufferMemory}get sortWorkerMemory(){return this._sortWorkerMemory}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort(`data`)}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortReason=null,this._updating.value=!1,this._scheduledSortStartTimeout!=null&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._sortWorkerMemory=0}requestSort(e=`view`){this._updating.value=!0,this._pendingSortReason!==`view`&&this._pendingSortReason!==e&&(this._pendingSortReason=e,this._scheduledSortStartTimeout!=null&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;let e=o()-this._lastSortStartTime,t=(this._pendingSortReason===`view`?this._viewSortInterval:this._dataSortInterval)-e;t<=0?this._startSortIfRequired():this._scheduledSortStartTimeout??=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortReason!=null&&!this._isSorting&&this._scheduleSortStart()},t)}_startSortIfRequired(){if(this._isSorting||this._pendingSortReason==null)return;let e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortReason=null,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortReason==null?this._updating.value=!1:this._scheduleSortStart()}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._textures.clear()}_computeExpandedCapacity(t,n){let r=Math.max(1,t);for(;r<n;)r=Math.ceil(r*e);return r}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){let t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=n(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._sortWorkerMemory=0,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(this._latestUpdatedGaussianTiles.length===0){this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1);return}this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);let t=this._latestUpdatedGaussianTiles,n=t.length,r=this._requestedLyr3dVisibilityChange,i=0;for(let e=0;e<n;e++)i+=t[e].gaussianCount;this._ensureSortBufferCapacity(i),this._textures.ensureCapacity();let a=this._renderer.camera;s(this._cameraDirectionNormalized,a.ray.direction);let o=this._cameraDirectionNormalized[0],c=this._cameraDirectionNormalized[1],u=this._cameraDirectionNormalized[2],f=0,p=this._renderer.clippingBox,m=this._nextCommittedVisibleGaussianTiles;m.length=0;let h=0,{frustum:g}=a,_=this._renderer.tileCullingRevision,v=g[0],y=g[1],b=g[2],x=g[3],S=g[4],C=g[5];for(let e=0;e<n;e++){let n=t[e],{obbCenterX:r,obbCenterY:i,obbCenterZ:a,paddedMbsRadius:o}=n,s=n.gaussianCount;if(n.cullingRevision!==_){let e=p==null||l(n.boundingBox,p);if(e){let t=o*1.5;e=v[0]*r+v[1]*i+v[2]*a+v[3]<t&&y[0]*r+y[1]*i+y[2]*a+y[3]<t&&b[0]*r+b[1]*i+b[2]*a+b[3]<t&&x[0]*r+x[1]*i+x[2]*a+x[3]<t&&S[0]*r+S[1]*i+S[2]*a+S[3]<t&&C[0]*r+C[1]*i+C[2]*a+C[3]<t}n.cullingRevision=_,n.cullingVisible=e}n.cullingVisible&&(m[h++]=n,f+=s)}if(m.length=h,f===0){this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=r,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1);return}let w=new Map,T=[],E=new Uint32Array(h);for(let e=0;e<h;e++){let t=m[e],n=t.handle;w.set(n,t),E[e]=n,this._workerResidentTiles.get(n)!==t&&T.push({handle:n,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}let D=[];for(let e of this._workerResidentTiles.keys())w.has(e)||D.push(e);let O=new d({addedTiles:T,removedTileHandles:Uint32Array.from(D),visibleTileHandles:E,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:f,directionX:o,directionY:c,directionZ:u,preciseSort:this._useDeterministicSort}),k=await this._workerHandle?.sort(O,e);if(e.aborted)return;k&&(this._sortedAtlasIndicesBuffer=k.sortedAtlasIndices,this._sortWorkerMemory=k.usedMemory,this._workerResidentTiles=w),await this._frameTask.schedule(async e=>{this._textures.setOrder(this._sortedAtlasIndicesBuffer,f);let t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=m,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=r,this.visibleGaussians=f,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()},e)}catch(e){if(r(e))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{m as GaussianSplatSortCoordinator};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,diameter as r}from"../../../../geometry/support/aaBoundingBox.js";class i{constructor({handle:i,obb:a,pageIds:o,relativePositions:s,packedRotations:c,packedOpacityScaledScales:l,gaussianCount:u,maxSplatMbsRadiusSquared:d,maxGaussianOpacity:f,elevationRange:p}){this.bvhIntersectionGeneration=0,this.lifecycleState=0,this.cullingRevision=-1,this.cullingVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.handle=i,this.obb=a,this.pageIds=o,this.relativePositions=s,this.packedRotations=c,this.packedOpacityScaledScales=l,this.gaussianCount=u,this.maxSplatMbsRadiusSquared=d,this.maxGaussianOpacity=f,this.elevationRange=p,this.usedMemory=e(this.pageIds,this.relativePositions,this.packedRotations,this.packedOpacityScaledScales);let m=t();a.getCenter(m),this.obbCenterX=m[0],this.obbCenterY=m[1],this.obbCenterZ=m[2];let h=a.radius??-1;this._mbsRadius=h;let g=h<0?-1:h*h;this._mbsRadiusSquared=g,this._obbShortestHalfsize=Math.min(a.halfSizeX,a.halfSizeY,a.halfSizeZ);let _=n();a.toAaBoundingBox(_),this.boundingBox=_;let v=h>=0?h:r(_)*.5;this.paddedMbsRadius=v+Math.sqrt(Math.max(0,d))}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;let{obbCenterX:n,obbCenterY:r,obbCenterZ:i}=this,a=n-e[0],o=r-e[1],s=i-e[2],c=a*t[0]+o*t[1]+s*t[2],l=a*a+o*o+s*s-c*c;return(this._mbsRadiusSquared<0||l<=this._mbsRadiusSquared)&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){let t=this._mbsRadius;if(t<0)return!0;let n=e.center,r=e.radius,i=t+r,a=this.obbCenterX-n[0];if(a>i)return!1;let o=this.obbCenterY-n[1];if(o>i)return!1;let s=this.obbCenterZ-n[2];if(s>i)return!1;let c=a*a+o*o+s*s;return c>i*i?!1:c<=(this._obbShortestHalfsize+r)**2||Math.sqrt(c)+t<=r?!0:this.obb?.intersectSphere(e)??!0}}export{i as GaussianTile};
2
+ import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,diameter as r}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsRay as i,intersectsSphere as a}from"../../layers/support/tileBoundingVolumeUtils.js";class o{constructor({handle:i,obb:a,pageIds:o,relativePositions:s,packedRotations:c,packedOpacityScaledScales:l,gaussianCount:u,maxSplatMbsRadiusSquared:d,maxGaussianOpacity:f,elevationRange:p}){this.bvhIntersectionGeneration=0,this.lifecycleState=0,this.cullingRevision=-1,this.cullingVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.handle=i,this.obb=a,this.pageIds=o,this.relativePositions=s,this.packedRotations=c,this.packedOpacityScaledScales=l,this.gaussianCount=u,this.maxSplatMbsRadiusSquared=d,this.maxGaussianOpacity=f,this.elevationRange=p,this.usedMemory=e(this.pageIds,this.relativePositions,this.packedRotations,this.packedOpacityScaledScales);let m=t();a.getCenter(m),this.obbCenterX=m[0],this.obbCenterY=m[1],this.obbCenterZ=m[2];let h=a.radius??-1;this._mbsRadius=h;let g=h<0?-1:h*h;this._mbsRadiusSquared=g,this._obbShortestHalfsize=Math.min(a.halfSizeX,a.halfSizeY,a.halfSizeZ);let _=n();a.toAaBoundingBox(_),this.boundingBox=_;let v=h>=0?h:r(_)*.5;this.paddedMbsRadius=v+Math.sqrt(Math.max(0,d))}boundingVolumeIntersectsRay(e,t){return i(this.obb,this.obbCenterX,this.obbCenterY,this.obbCenterZ,this._mbsRadiusSquared,e,t)}boundingVolumeIntersectsSphere(e){return a(this.obb,this.obbCenterX,this.obbCenterY,this.obbCenterZ,this._mbsRadius,this._obbShortestHalfsize,e)}}export{o as GaussianTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../Graphic.js";import has from"../../../core/has.js";import{isIterable as t}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as n,isScreenPolygon as r,isScreenRect as i,createScreenPointArray as a,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{Sphere as d}from"../../../geometry/support/sphere.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as p}from"../../../layers/support/layerUtils.js";import{debugFlags as m}from"./debugFlags.js";import{getElevationAtPoint as h}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as g,resolveOrderedIntersectionHits as _}from"./intersectionHitUtils.js";import{Intersector as v}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as y}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as b,toOwner as x}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as S}from"../webgl-engine/lib/verticalOffsetUtils.js";async function C(e,t,n,o){let s=n?F(e,n):o;if(r(t))return w(e,t,s,n?.excludeLabels);if(i(t))return w(e,D(t),s,n?.excludeLabels);let c=t,l=a(c.x,c.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;let u=new v(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=n?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(l,u,s);let d=await Array.fromAsync(k(e,u.results.all,s.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:t=>A(e,t),stopAtSupportSurface:!0})),f=u.results.ground,h=x(f,e),g=h!=null&&`type`in h&&p(h)&&(!has(`enable-feature:im-as-ground`)||h.isUsedAsGroundLayer)?h:null,_={screenPoint:c,results:d,ground:{mapPoint:A(e,f),distance:y(f)?f.distanceInRenderSpace:0,layer:g}};return m.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(_.intersector=u),_}async function w(e,t,r,i){r.enableDraped=!0;let a=new v(e.state.viewingMode);a.options.selectionMode=!0,a.options.store=2,a.options.excludeLabels=i??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(t.map(e=>n(e)),a,r);let o=[];await e.sceneIntersectionHelper.screenPolygonIntersectionTask.scheduleGenerator(async function*(t){for await(let n of k(e,T(e,a.polygonResults.all),r.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}))o.push(n),t.madeProgress()&&(t=yield)});let s={screenPoint:null,results:o,ground:{mapPoint:null,distance:0,layer:null}};return m.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(s.intersector=a),s}function*T(e,t){let n=E(e);if(n==null)yield*t;else for(let e of t)e.distance!=null&&e.distance<=n&&(yield e)}function E(e){let t=e.basemapTerrain,n=e.state.camera;return e.state.viewingMode!==1||!n.aboveGround||!t?.opaque?null:(W.radius=t.getLowerBoundRadius(),W.distanceToSilhouette(n.eye)*G)}function D(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function O(e,t,r,i){let a=r?F(e,r):i,o=!!(a.graphics?.include||a.graphics?.exclude),s=!!(a.mediaElements?.include||a.mediaElements?.exclude),c=n(t);a.enableDraped=a.include&&!a.include.has(S)||a.exclude?.has(S);let l=e.sceneIntersectionHelper,u=new v(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||s?2:0,u.options.excludeLabels=r?.excludeLabels??!1,l.intersectIntersectorScreen(c,u,a),o||s){for(let t of u.results.all){let n=b(t,e);if(n==null||o&&(n.type!==`graphic`||M(a.graphics,n.graphic))||s&&(n.type!==`media`||N(a.mediaElements,n.element)))return A(e,t)}return null}return A(e,u.results.min)}async function*k(e,t,n,r){let i=_(e,r.stopAtSupportSurface?(function*(){for(let n of t){yield n;let t=x(n,e);if(t!=null&&(t===e.map.ground||`type`in t&&p(t)&&(!has(`enable-feature:im-as-ground`)||t.isUsedAsGroundLayer)))break}})():t,{getDedupeKey:e=>e.type===`graphic`?j(e.graphic):null,filterHit:e=>e.type!==`graphic`||M(n,e.graphic)});for await(let{input:e,hit:t}of i){let n=r.getMapPoint(e),i=r.getDistance(e);if(t.type===`media`){let e=n?t.element.toSource(n):null;yield{...t,mapPoint:n,distance:i,sourcePoint:e}}else yield{...t,mapPoint:n,distance:i}}}function A(e,t,n){return t.getIntersectionPoint(U)?(n=P(e,U,n),t.intersector===7&&e.basemapTerrain&&(n.z=h(e.basemapTerrain,n)??0),n):null}function j(e){let t=e.getObjectId()??e.attributes?.[f];return e.origin&&t!=null?`o-${e.origin.id}-${t}`:`u-${g(e)}`}function M(e,t){return N(e,j(t))}function N(e,t){return e==null||(e.include==null||e.include.has(t))&&(e.exclude==null||!e.exclude.has(t))}function P(e,t,n){let r=e.spatialReference||l.WGS84;return u(t,e.renderSpatialReference,U,r)?t=U:(r=l.WGS84,u(t,e.renderSpatialReference,U,r)&&(t=U)),n?(n.x=t[0],n.y=t[1],n.z=t[2],n.spatialReference=r):n=new c(t,r),n}function F(e,t){let n=I(e,t.include,0),r=I(e,t.exclude,1);return{include:n.layerViewUids,exclude:r.layerViewUids,graphics:{include:n.graphicUids,exclude:r.graphicUids},mediaElements:{include:n.mediaElements,exclude:r.mediaElements}}}function I(n,r,i,a=new L){if(!r)return a;if(r instanceof e)V(a,j(r)),i===0&&(n.graphicsView!=null&&r.layer===n?z(a,n.graphicsView.uid):r.layer&&R(a,n,r.layer.uid));else if(`layer`in r&&`element`in r)H(a,r.element),i===0&&R(a,n,r.layer.uid);else if(!t(r))`layer`in r&&B(a,n,r),`uid`in r&&R(a,n,r.uid);else for(let e of r)if(e===n.graphics&&n.graphicsView!=null)z(a,n.graphicsView.uid);else if(e===n.map.ground){z(a,S);for(let e of n.map.ground.allIntegratedMeshGround)R(a,n,e.uid)}else I(n,e,i,a);return a}class L{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function R(e,t,n){let r=t.allLayerViews.find(e=>e.layer.uid===n);r&&z(e,r.uid)}function z(e,t){e.layerViewUids??=new Map,e.layerViewUids.set(t,!0)}function B(e,t,n){let r=t.allLayerViews.find(e=>e.layer.uid===n.layer.uid);if(!r)return;e.layerViewUids??=new Map;let i=e.layerViewUids.get(r.uid);i!==!0&&(i?i.add(n.id):e.layerViewUids.set(r.uid,new Set([n.id])))}function V(e,t){e.graphicUids??=new Set,e.graphicUids.add(t)}function H(e,t){e.mediaElements??=new Set,e.mediaElements.add(t)}const U=s(),W=new d,G=1.2;export{P as computeMapPointFromVec3d,F as externalToInternalIntersectOptions,C as hitTest,A as intersectResultToMapPoint,M as testGraphicUidFilter,O as toMap};
2
+ import e from"../../../Graphic.js";import has from"../../../core/has.js";import{isIterable as t}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as n,isScreenPolygon as r,isScreenRect as i,createScreenPointArray as a,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{Sphere as d}from"../../../geometry/support/sphere.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as p}from"../../../layers/support/layerUtils.js";import{debugFlags as m}from"./debugFlags.js";import{getElevationAtPoint as h}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as g,resolveOrderedIntersectionHits as _}from"./intersectionHitUtils.js";import{Intersector as v}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as y}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as b,toOwner as x}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as S}from"../webgl-engine/lib/verticalOffsetUtils.js";async function C(e,t,n,o){let s=n?F(e,n):o;if(r(t))return w(e,t,s,n?.excludeLabels);if(i(t))return w(e,D(t),s,n?.excludeLabels);let c=t,l=a(c.x,c.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;let u=new v(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=n?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(l,u,s);let d=await Array.fromAsync(k(e,u.results.all,s.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:t=>A(e,t),stopAtSupportSurface:!0})),f=u.results.ground,h=x(f,e),g=h!=null&&`type`in h&&p(h)&&(!has(`enable-feature:im-as-ground`)||h.isUsedAsGroundLayer)?h:null,_={screenPoint:c,results:d,ground:{mapPoint:A(e,f),distance:y(f)?f.distanceInRenderSpace:0,layer:g}};return m.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(_.intersector=u),_}async function w(e,t,r,i){r.enableDraped=!0;let a=new v(e.state.viewingMode);a.options.selectionMode=!0,a.options.store=2,a.options.excludeLabels=i??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(t.map(e=>n(e)),a,r);let o=[];await e.sceneIntersectionHelper.screenPolygonIntersectionTask.scheduleGenerator(async function*(t){for await(let n of k(e,T(e,a.polygonResults.all),r.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}))o.push(n),t.madeProgress()&&(t=yield)});let s={screenPoint:null,results:o,ground:{mapPoint:null,distance:0,layer:null}};return m.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(s.intersector=a),s}function*T(e,t){let n=E(e);if(n==null)yield*t;else for(let e of t)e.distance!=null&&e.distance<=n&&(yield e)}function E(e){let t=e.basemapTerrain,n=e.state.camera;return e.state.viewingMode!==1||!n.aboveGround||!t?.opaque?null:(W.radius=t.getLowerBoundRadius(),W.distanceToSilhouette(n.eye)*G)}function D(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function O(e,t,r,i){let a=r?F(e,r):i,o=!!(a.graphics?.include||a.graphics?.exclude),s=!!(a.mediaElements?.include||a.mediaElements?.exclude),c=n(t);a.enableDraped=a.include&&!a.include.has(S)||a.exclude?.has(S);let l=e.sceneIntersectionHelper,u=new v(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||s?2:0,u.options.excludeLabels=r?.excludeLabels??!1,l.intersectIntersectorScreen(c,u,a),o||s){for(let t of u.results.all){let n=b(t,e);if(n==null||o&&(n.type!==`graphic`||M(a.graphics,n.graphic))||s&&(n.type!==`media`||N(a.mediaElements,n.element)))return A(e,t)}return null}return A(e,u.results.min)}async function*k(e,t,n,r){let i=_(e,r.stopAtSupportSurface?(function*(){for(let n of t){yield n;let t=x(n,e);if(t!=null&&(t===e.map.ground||`type`in t&&p(t)&&(!has(`enable-feature:im-as-ground`)||t.isUsedAsGroundLayer)))break}})():t,{getDedupeKey:e=>e.type===`graphic`?j(e.graphic):null,filterHit:e=>e.type!==`graphic`||M(n,e.graphic)});for await(let{input:e,hit:t}of i){let n=r.getMapPoint(e),i=r.getDistance(e);if(t.type===`media`){let e=n?t.element.toSource(n):null;yield{...t,mapPoint:n,distance:i,sourcePoint:e}}else yield{...t,mapPoint:n,distance:i}}}function A(e,t,n){return t.getIntersectionPoint(U)?(n=P(e,U,n),t.intersector===7&&e.basemapTerrain&&(n.z=h(e.basemapTerrain,n)??0),n):null}function j(e){let t=e.getObjectId()??e.attributes?.[f];return e.origin&&t!=null?`o-${e.origin.id}-${t}`:`u-${g(e)}`}function M(e,t){return N(e,j(t))}function N(e,t){return e==null||(e.include==null||e.include.has(t))&&(e.exclude==null||!e.exclude.has(t))}function P(e,t,n){let r=e.spatialReference||l.WGS84;return u(t,e.renderSpatialReference,U,r)?t=U:(r=l.WGS84,u(t,e.renderSpatialReference,U,r)&&(t=U)),n?(n.x=t[0],n.y=t[1],n.z=t[2],n.spatialReference=r):n=new c({x:t[0],y:t[1],z:t[2],m:t[3],spatialReference:r}),n}function F(e,t){let n=I(e,t.include,0),r=I(e,t.exclude,1);return{include:n.layerViewUids,exclude:r.layerViewUids,graphics:{include:n.graphicUids,exclude:r.graphicUids},mediaElements:{include:n.mediaElements,exclude:r.mediaElements}}}function I(n,r,i,a=new L){if(!r)return a;if(r instanceof e)V(a,j(r)),i===0&&(n.graphicsView!=null&&r.layer===n?z(a,n.graphicsView.uid):r.layer&&R(a,n,r.layer.uid));else if(`layer`in r&&`element`in r)H(a,r.element),i===0&&R(a,n,r.layer.uid);else if(!t(r))`layer`in r&&B(a,n,r),`uid`in r&&R(a,n,r.uid);else for(let e of r)if(e===n.graphics&&n.graphicsView!=null)z(a,n.graphicsView.uid);else if(e===n.map.ground){z(a,S);for(let e of n.map.ground.allIntegratedMeshGround)R(a,n,e.uid)}else I(n,e,i,a);return a}class L{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function R(e,t,n){let r=t.allLayerViews.find(e=>e.layer.uid===n);r&&z(e,r.uid)}function z(e,t){e.layerViewUids??=new Map,e.layerViewUids.set(t,!0)}function B(e,t,n){let r=t.allLayerViews.find(e=>e.layer.uid===n.layer.uid);if(!r)return;e.layerViewUids??=new Map;let i=e.layerViewUids.get(r.uid);i!==!0&&(i?i.add(n.id):e.layerViewUids.set(r.uid,new Set([n.id])))}function V(e,t){e.graphicUids??=new Set,e.graphicUids.add(t)}function H(e,t){e.mediaElements??=new Set,e.mediaElements.add(t)}const U=s(),W=new d,G=1.2;export{P as computeMapPointFromVec3d,F as externalToInternalIntersectOptions,C as hitTest,A as intersectResultToMapPoint,M as testGraphicUidFilter,O as toMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{clamp as e,isPowerOfTwo as t}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as r}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as i}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as a,sampleSingleElevation as o}from"./ElevationData.js";import{PatchGeometryLUT as s}from"./PatchGeometryLUT.js";import{zeroToFour as c,neighborTileIfLoadedOrSelf as l}from"./PatchRenderData.js";import{maxPatchTesselation as u,elevationNoDataValue as d}from"./TerrainConst.js";import{internalAssert as f,enableTerrainInternalChecks as p,neighborEdgeIndices as m,almostEquals as h}from"./terrainUtils.js";import{isCornerNeighbor as g}from"./Tile.js";import{compareTilesByLij as _}from"./tileUtils.js";import{compressNormal as v}from"../webgl-engine/lib/Normals.js";function y(e,t){let{tile:n,geometry:i,geometryState:a}=e,{extentInRadians:o,surface:s}=n,{isWebMercator:c,renderer:l}=s,{numVerticesPerSide:u,wireframe:d}=a,f=u-1,p=(u-2)**2,m=c&&(t===2||t===3),h=c&&(t===1||t===3),g=(+!!m+ +!!h)*Ee*u,_=xe(a),v=4*_,y=p+g+v,S=l.tileGeometryCache.acquire(y);i.numVerticesPerSide=u,i.vertexAttributes=S,i.maxEdgeVertexCount=_;let{boundingBox:C}=i;r(C);let w=P(e);$.update(f,o,w),x(e),i.poleVerticesStartIndex=p;let T=b(e,m,h);i.edgeVerticesStartIndex=p+g,J(e),O(e,we,Te),U(i,T,d),e.intersectionData=null}function b(e,t,r){let{tile:i,localOrigin:a,geometry:o}=e,{extent:s,ellipsoid:c}=i,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=o,p=u-1,m=a[0],h=a[1],g=a[2],_=c.radius,y=s[1],b=s[3],x=[],S=f,C=(e,t)=>{let r=t*u;be(-m,-h,-g+e*_,l),x.push(new oe(e===1,r,e===1?0:2,S,Ee));let i=j(e===-1?y:b,_),a=e*Math.PI/2-i,o=(e===1?1:-1)*.99,s=_+0,{position:c,uv0:f}=d,{typedBuffer:C,typedBufferStride:w}=d.normalCompressed;for(let e=1;e<=Ee;++e){let t=i+e/Ee*a,r=Math.cos(t),u=Math.sin(t);for(let e=0;e<=p;e++){let t=e/p,i=$.sinLonLUT[e],a=$.cosLonLUT[e]*r,d=i*r,_=u,y=a*s-m,b=d*s-h,x=_*s-g;be(y,b,x,l),c.setValues(S,y,b,x),f.setValues(S,Math.round(t*n),Math.round(o*n)),v(C,S,a,d,_,w),++S}}};return t&&C(-1,0),r&&C(1,p),x}function x(e){let t=e.geometryState.samplerData,n=t?.length===1?t[0]:null;n?S(e,n):C(e)}function S(e,t){let{tile:n}=e;if(!n.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:a}=e,{numVerticesPerSide:o}=i,s=o-2,c=o-1,{vertexAttributes:l,boundingBox:u}=r,{position:d,uv0:f}=l,{typedBuffer:p,typedBufferStride:m}=l.normalCompressed,{extent:h}=n,g=n.ellipsoid.radius,_=a[0],y=a[1],b=a[2],x=d.typedBuffer,S=d.typedBufferStride,C=f.typedBuffer,E=f.typedBufferStride;w(c,h,t);let D=0,O=t.data.values;if(1<=s){let e=le[1],t=$.sinLatLUT[1],n=$.cosLatLUT[1];for(let r=1;r<=s;r++){let i=$.sinLonLUT[r],a=$.cosLonLUT[r],o=g+T(r,1,O),s=-_+o*a*n,c=-y+o*i*n,l=-b+o*t;be(s,c,l,u);let d=(r-1)*S;x[d]=s,x[d+1]=c,x[d+2]=l;let f=(r-1)*E;C[f]=le[r],C[f+1]=e}}for(let e=1;e<=s;e++){let t=$.sinLatLUT[e],n=$.cosLatLUT[e],r=e+1,i=le[r],a=$.sinLatLUT[r],o=$.cosLatLUT[r],l=$.sinLonLUT[0],d=$.cosLonLUT[0],f=g+T(0,e,O),h=d*n*f-_,w=l*n*f-y,k=t*f-b,A=D*S,j=x[A],M=x[A+1],N=x[A+2];for(let l=1;l<=s;l++){let d=$.sinLonLUT[l],f=$.cosLonLUT[l],A=0,P=0,F=0;if(l<s){let e=(D+1)*S;A=x[e],P=x[e+1],F=x[e+2]}else{let r=$.sinLonLUT[c],i=$.cosLonLUT[c],a=g+T(c,e,O);A=i*n*a-_,P=r*n*a-y,F=t*a-b}let I=h,L=w,R=k;h=j,w=M,k=N,j=A,M=P,N=F;let z=A-I,B=P-L,ee=F-R,V=0,H=0,te=0;if(e>1){let e=(D-s)*S;V=x[e],H=x[e+1],te=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=g+T(l,0,O);V=f*t*n-_,H=d*t*n-y,te=e*n-b}let U=g+T(l,r,O),W=f*o*U-_,G=d*o*U-y,K=a*U-b;if(e<s){let e=D+s,t=e*S;x[t]=W,x[t+1]=G,x[t+2]=K,be(W,G,K,u);let n=e*E;C[n]=le[l],C[n+1]=i}let q=V-W,ne=H-G,re=te-K,J=f*n,Y=d*n,X=t;X*X<.999&&(J=ee*ne-B*re,Y=z*re-ee*q,X=B*q-z*ne);let Z=1/Math.sqrt(J*J+Y*Y+X*X);v(p,D,J*Z,Y*Z,X*Z,m),++D}}}function C(e){let{tile:t}=e;if(!t.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:o}=e,{numVerticesPerSide:s,samplerData:c}=i,l=s-2,u=s-1,{vertexAttributes:d,boundingBox:f}=r,{position:p,uv0:m}=d,{typedBuffer:h,typedBufferStride:g}=d.normalCompressed,{extent:_}=t,y=_[0],b=_[2],x=_[1],S=_[3],C=t.ellipsoid.radius,w=o[0],T=o[1],E=o[2],D=p.typedBuffer,O=p.typedBufferStride,k=1/u,A=0;if(1<=l){let e=k,t=x*(1-e)+S*e,r=$.sinLatLUT[1],i=$.cosLatLUT[1];for(let o=1;o<=l;o++){let s=o*k,l=y*(1-s)+b*s,u=$.sinLonLUT[o],d=$.cosLonLUT[o],p=C+a(l,t,c),h=-w+p*d*i,g=-T+p*u*i,_=-E+p*r;be(h,g,_,f);let v=(o-1)*O;D[v]=h,D[v+1]=g,D[v+2]=_,m.setValues(o-1,Math.round(s*n),Math.round(e*n))}}for(let e=1;e<=l;e++){let t=e*k,r=x*(1-t)+S*t,i=$.sinLatLUT[e],o=$.cosLatLUT[e],s=e+1,d=s*k,p=x*(1-d)+S*d,_=$.sinLatLUT[s],j=$.cosLatLUT[s],M=$.sinLonLUT[0],N=$.cosLonLUT[0],P=C+a(y,r,c),F=N*o*P-w,I=M*o*P-T,L=i*P-E,R=A*O,z=D[R],B=D[R+1],ee=D[R+2];for(let t=1;t<=l;t++){let s=t*k,S=y*(1-s)+b*s,M=$.sinLonLUT[t],N=$.cosLonLUT[t],P=0,R=0,V=0;if(t<l){let e=(A+1)*O;P=D[e],R=D[e+1],V=D[e+2]}else{let e=$.sinLonLUT[u],t=$.cosLonLUT[u],n=C+a(b,r,c);P=t*o*n-w,R=e*o*n-T,V=i*n-E}let H=F,te=I,U=L;F=z,I=B,L=ee,z=P,B=R,ee=V;let W=P-H,G=R-te,K=V-U,q=0,ne=0,re=0;if(e>1){let e=(A-l)*O;q=D[e],ne=D[e+1],re=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+a(S,x,c);q=N*t*n-w,ne=M*t*n-T,re=e*n-E}let J=C+a(S,p,c),Y=N*j*J-w,X=M*j*J-T,Z=_*J-E;if(e<l){let e=A+l,t=e*O;D[t]=Y,D[t+1]=X,D[t+2]=Z,be(Y,X,Z,f),m.setValues(e,Math.round(s*n),Math.round(d*n))}let ie=q-Y,Q=ne-X,ae=re-Z,oe=N*o,se=M*o,ce=i;ce*ce<.999&&(oe=K*Q-G*ae,se=W*ae-K*ie,ce=G*ie-W*Q);let le=1/Math.sqrt(oe*oe+se*se+ce*ce);v(h,A,oe*le,se*le,ce*le,g),++A}}}function w(t,r,i){let a=r[0],o=r[2],s=r[1],c=r[3],l=1/t,{dx:u,dy:d,x0:f,y1:p,safeWidth:m}=i,h=i.data.width;for(let r=0;r<=t;r++){let t=r*l,i=e(u*(a*(1-t)+o*t-f),0,m),g=Math.floor(i);ue[r]=g,pe[r]=i-g;let _=e(d*(p-(s*(1-t)+c*t)),0,m),v=Math.floor(_);de[r]=v*h,fe[r]=(v+1)*h,me[r]=_-v,le[r]=Math.round(t*n)}}function T(e,t,n){let r=ue[e],i=pe[e],a=de[t],o=fe[t],s=me[t],c=a+r,l=n[c],u=n[c+1],d=n[o+r],f=n[o+r+1];if(l+d+u+f>=ce)return 0;let p=l+(u-l)*i;return p+(d+(f-d)*i-p)*s}function E(e,t=!1){e.tile.intersectsClippingArea&&(O(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(Y(e),O(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function O(e,t,n){e.tile.intersectsClippingArea&&(n&&A(e,n),t&&k(e,t))}function k(e,r){let{geometry:i,geometryState:s,tile:c,localOrigin:u}=e,{level:d,extent:g,extentInRadians:y,ellipsoid:b}=c,x=b.radius,S=y[0],C=y[2],w=y[1],T=y[3],{samplerData:E}=s,D=g[0],O=g[2],k=g[1],A=g[3],j=P(e),{boundingBox:M,vertexAttributes:N}=i,F=u[0],I=u[1],L=u[2],{position:R,uv0:z}=N,B=R.typedBuffer,ee=R.typedBufferStride,V=z.typedBuffer,H=z.typedBufferStride,{typedBuffer:te,typedBufferStride:U}=N.normalCompressed,W=E?.length===1?E[0]:null,G=(e,t,n)=>W?o(e,t,W)??0:a(e,t,E)??0;for(let u=0;u<4;++u){if(!(r&1<<u))continue;let y=u===1||u===3,b=s.edgeResolutions[u];f(t(b));let N=b+1,P=l(c,s.edgePeerNeighbors[u]);if(_e(c,P,u)&&X(e,u,P))continue;let R=P!=null;f(!R||P.level===c.level),f(!R||_(c,P)<=0);let z=P?.renderData?.geometryState;if(p){let e=c.surface;if(!P&&e&&!e.updatingRootTiles){let t=m[u],n=c.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===c.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===d)):f(e?.rootTiles==null||!c.shouldHaveNeighbor(t))}}let K=u===1?g[2]:g[0],q=P?.extent,ne=q&&y?u===1?q[0]:q[2]:K,re=u===0?g[3]:g[1],J=+(u===1),Y=+(u===0),Z=u===1?C:S,ie=u===0?T:w,Q=Math.sin(Z),ae=Math.cos(Z),oe=Math.sin(ie),se=Math.cos(ie),$=z?.samplerData,ce=$?.length===1?$[0]:null,le=(e,t,n)=>ce?o(n,t,ce)??0:a(n,t,$)??0,ue=R?(e,t,n)=>(G(e,t)+le(e,t,n))*.5:G,de=i.outerEdgesOffsetAndLength[u*2+0],fe=W!=null||E!=null&&E.some(e=>e!=null),pe=ce!=null||$!=null&&$.some(e=>e!=null),me=fe||pe,he=1/b,ge=n*he,ve=J*n,ye=Y*n,xe=de;f(!q||h(q[2]-q[0],g[2]-g[0])),(()=>{let e=u===1?-1:+(u===3),t=u===0?-1:+(u===2),n=(g[2]-g[0])*he,r=e*n,i=t*n,s=C-S,c=y?s*he*e:0,l=y?0:t*he,d=Y,f=y?Z+c:Z,p=y?Math.sin(f):Q,m=y?Math.cos(f):ae,h=y?Z-c:Z,_=y?Math.sin(h):Q,b=y?Math.cos(h):ae,w=d+l,T=y?ie:j(w),P=y?oe:Math.sin(T),z=y?se:Math.cos(T),G=d-l,q=y?ie:j(G),J=y?oe:Math.sin(q),X=y?se:Math.cos(q),le=0,de=0,fe=0;{let e=0*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);le=o*l*u,de=a*l*u,fe=c*u}let pe=0,_e=0,Se=0;{let e=1*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);pe=o*l*u,_e=a*l*u,Se=c*u}for(let e=1;e<N-1;++e){let t=0,n=0,s=0;{let r=(e+1)*he,i=y?K:D*(1-r)+O*r,a=y?ne:i,o=y?k*(1-r)+A*r:re,c=y?Z:S*(1-r)+C*r,l=y?Q:Math.sin(c),u=y?ae:Math.cos(c),d=y?j(r):ie,f=y?Math.sin(d):oe,p=y?Math.cos(d):se,m=x+ue(i,o,a);t=u*p*m,n=l*p*m,s=f*m}let c=t,l=n,d=s,f=pe,h=_e,g=Se;pe=c,_e=l,Se=d;{let t=xe+e,n=t*ee,r=f-F,i=h-I,a=g-L;B[n]=r,B[n+1]=i,B[n+2]=a,be(r,i,a,M);let o=Math.round(e*ge),s=t*H;V[s]=y?ve:o,V[s+1]=y?o:ye}let w=le,T=de,N=fe;le=f,de=h,fe=g;let G=f,q=h,Y=g,Ce=1/Math.sqrt(G*G+q*q+Y*Y),we=Y*Ce,Te=0,Ee=0,De=0;if(me&&we*we<.999){let t=0,n=0,s=0;{let e=u===0?-1:1;t=e*(c-w),n=e*(l-T),s=e*(d-N)}{let c=e*he,l=y?K:D*(1-c)+O*c,d=y?ne:l,f=y?k*(1-c)+A*c:re,h=y?Z:S*(1-c)+C*c,g=y?Q:Math.sin(h),v=y?ae:Math.cos(h),w=y?j(c):ie,T=y?Math.sin(w):oe,M=y?Math.cos(w):se,N=G,F=q,I=Y;if(R){let e=d-r,t=f-i,n=x+(ce?o(e,t,ce)??0:a(e,t,$)??0),s=y?_:g,c=y?b:v,l=y?T:J,u=y?M:X;N=c*u*n,F=s*u*n,I=l*n}{let e=l+r,c=f+i,d=x+(W?o(e,c,W)??0:a(e,c,E)??0),h=y?p:g,_=y?m:v,b=y?T:P,S=y?M:z,C=_*S*d,w=h*S*d,D=b*d;R||(N=2*G-C,F=2*q-w,I=2*Y-D);let O=u===3?-1:1,k=O*(N-C),A=O*(F-w),j=O*(I-D);Te=s*A-n*j,Ee=t*j-s*k,De=n*k-t*A;let L=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=L,Ee*=L,De*=L}}}else Te=G*Ce,Ee=q*Ce,De=Y*Ce;v(te,xe+e,Te,Ee,De,U)}})()}}function A(e,t){Z(e,t)}function j(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function M(e,t,n,r){return j(e*(1-r)+t*r,n)}function N(e,t,n){return e*(1-n)+t*n}function P(e){let{tile:t}=e;if(t.surface.isWebMercator){let e=t.extent,n=t.ellipsoid.radius;return t=>M(e[1],e[3],n,t)}let n=t.extentInRadians;return e=>N(n[1],n[3],e)}function F(e){let{tile:t,geometryState:n,geometry:i}=e,{extent:a,surface:o}=t,{wireframe:s}=n,c=a[0],l=a[1],u=a[2],d=a[3],f=u-c,p=d-l,{numVerticesPerSide:m,clippingArea:h}=n,g=h==null?0:Math.max(0,(h[0]-c)/f),_=h==null?0:Math.max(0,(h[1]-l)/p),v=h==null?1:Math.min(1,(h[2]-c)/f),y=h==null?1:Math.min(1,(h[3]-l)/p),b=(m-2)**2,x=xe(n),S=b+4*x,C=o.renderer.tileGeometryCache.acquire(S),{boundingBox:w}=i;r(w),i.numVerticesPerSide=m,i.vertexAttributes=C,i.maxEdgeVertexCount=x,i.minu=g,i.minv=_,i.maxu=v,i.maxv=y,I(e),i.edgeVerticesStartIndex=b,J(e),z(e,we,Te),U(i,[],s),e.intersectionData=null}function I(t){let r=t.tile;if(!r.intersectsClippingArea)return;let{geometry:i,geometryState:s,localOrigin:c}=t,{samplerData:l,clippingArea:u,numVerticesPerSide:d}=s,{surface:f,extent:p,ellipsoid:m}=r,{isWebMercatorOnPlateCarree:h}=f,g=u??he,_=p[0],y=p[1],b=p[2],x=p[3],S=Math.max(_,g[0]),C=Math.min(b,g[2]),w=Math.max(y,g[1]),T=Math.min(x,g[3]),E=m.radius,D=r.horizontalScale,O=d-1,k=d-2,{minu:A,minv:j,maxu:M,maxv:N,boundingBox:P,vertexAttributes:F}=i,{position:I,uv0:L}=F,{typedBuffer:R,typedBufferStride:z}=F.normalCompressed,B=c[0],ee=c[1],V=c[2],H=I.typedBuffer,te=I.typedBufferStride,U=0,W=e(y,w,T),G=h?(Math.PI/2-2*Math.atan(Math.exp(-W/E)))*E:W*D,K=1/O,q=e(y*(1-K)+x*K,w,T),ne=h?(Math.PI/2-2*Math.atan(Math.exp(-q/E)))*E:q*D,re=G,J=ne,Y=l?.length===1?l[0]:null,X=Y?(e,t)=>o(e,t,Y)??0:(e,t)=>a(e,t,l)??0;for(let t=1;t<=k;t++){let r=t/O,i=e(y*(1-r)+x*r,w,T),a=e(r,j,N),o=J,s=(t-1)/O,c=e(y*(1-s)+x*s,w,T),l=re,u=(t+1)/O,d=e(y*(1-u)+x*u,w,T),f=h?(Math.PI/2-2*Math.atan(Math.exp(-d/E)))*E:d*D,p=e(u,j,N);re=J,J=f;let m=e(_,S,C),g=m*D,F=X(m,i),I=1/O,W=e(I,A,M),G=e(_*(1-W)+b*W,S,C),K=W,q=G,ne=G*D,Y=X(G,i);if(t===1){let t=ne-B,r=re-ee,i=Y-V,o=0*te;H[o]=t,H[o+1]=r,H[o+2]=i,be(t,r,i,P);let s=e(I,A,M);L.setValues(U,Math.round(s*n),Math.round(a*n))}for(let r=1;r<=k;r++){let s=ne,u=Y,m=(r+1)/O,h=e(m,A,M),y=e(_*(1-m)+b*m,S,C),x=q;q=y;{let e=U+1,s=e*te;if(t===1||r===k){let c=X(y,i),l=y*D,u=o,d=c;if(t===1&&r<k){let t=l-B,r=u-ee,i=d-V;H[s]=t,H[s+1]=r,H[s+2]=i,be(t,r,i,P),L.setValues(e,Math.round(h*n),Math.round(a*n))}ne=l,Y=d}else ne=H[s]+B,Y=H[s+2]+V}let w=ne,T=Y,E=g,j=F;g=s,F=u;let N=(U-k)*te,I=t===1?X(x,c):H[N+2]+V,W=X(x,d);if(t<k){let e=U+k,t=e*te,r=s-B,i=f-ee,a=W-V;H[t]=r,H[t+1]=i,H[t+2]=a,be(r,i,a,P);let o=K;K=h,L.setValues(e,Math.round(o*n),Math.round(p*n))}{let e=w-E,t=T-j,n=l-f,r=I-W,i=n*t,a=e*r,o=-n*e,s=i*i+a*a+o*o;if(s===0)v(R,U,0,0,1,z);else{let e=1/Math.sqrt(s);v(R,U,i*e,a*e,o*e,z)}}++U}}}function L(e){e.tile.intersectsClippingArea&&(Y(e),z(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function R(e,t=!1){e.tile.intersectsClippingArea&&(z(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function z(e,t,n){e.tile.intersectsClippingArea&&(n&&ee(e,n),t&&B(e,t))}function B(n,r){let{geometry:i,geometryState:s,localOrigin:c}=n,u=n.tile,{surface:d,extent:h}=u,{clippingArea:g,samplerData:v}=s,y=g??he,b=h[0],x=h[2],S=h[1],C=h[3],w=[C>y[3],x>y[2],S<y[1],b<y[0]],T=u.horizontalScale,E=te(d.isWebMercatorOnPlateCarree,u.ellipsoid.radius,T),{minu:D,minv:O,maxu:k,maxv:A,boundingBox:j}=i,M=Math.max(b,y[0]),N=Math.min(x,y[2]),P=Math.max(S,y[1]),F=Math.min(C,y[3]),I=c[0],L=c[1],R=c[2],z=v?.length===1?v[0]:void 0,B=z?(e,t)=>o(e,t,z)??0:(e,t)=>a(e,t,v)??0;for(let c=0;c<4;++c){if(!(r&1<<c))continue;let h=c===1||c===3,g=s.edgeResolutions[c];f(t(g));let y=g+1,z=w[c],ee=l(u,s.edgePeerNeighbors[c]);if(!z&&_e(u,ee,c)&&X(n,c,ee))continue;let V=ee!=null&&!z,H=ee?.renderData?.geometryState;if(p&&(f(!V||ee.level===u.level),f(!V||_(u,ee)<=0),u&&!ee&&!d.updatingRootTiles)){let e=m[c],t=u.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===u.level);d.updatingRootTiles||(t?t.intersectsClippingArea&&(f(!t.loaded),f(!t.leaf),f(t.level===u.level)):f(d?.rootTiles==null||!u.shouldHaveNeighbor(e)))}let te=e(c===1?x:b,M,N),U=e(c===0?C:S,P,F),W=H?.samplerData,G=e(+(c===1),D,k),K=e(+(c===0),O,A),q=W?.length===1?W[0]:null,ne=(e,t)=>q?o(e,t,q)??0:a(e,t,W)??0,re=V?(e,t)=>(ne(e,t)+B(e,t))*.5:B,J=(x-b)/g,Y=h?c===1?J:-J:0,Z=h?0:c===0?J:-J,ie=-Y,Q=-Z,ae=0,oe=0,se=0;{let t=0/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r);ae=n*T,oe=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r),a=n*T,o=E(r),s=i;$=a,ce=o,le=s}for(let t=1;t<y-1;++t){let n=t/g,r=$,o=ce,s=le;{let a=h?G:e(n,D,k),l=h?e(n,O,A):K,u=r-I,d=o-L,f=s-R;be(r,d,f,j),i.setEdgeVertexFromValuesRawPositionUV(c,t,u,d,f,a,l)}{let n=(t+1)/g,r=h?te:e(b*(1-n)+x*n,M,N),i=h?e(S*(1-n)+C*n,P,F):U,a=re(r,i);$=r*T,ce=E(i),le=a}let l=$,u=ce,d=le,f=ae,p=oe,m=se;ae=r,oe=o,se=s;let _=0,y=0,w=0;if(h){let t=u-o,i=d-s,l=p-o,f=m-s,h=e(S*(1-n)+C*n,P,F),g=te+ie,b=h,x=g*T,E=a(g,b,v),D=x-r,O=E-s,k=c===3?-1:1;if(_=k*(-l+t)*O,y=k*D*(-f+i),w=-k*D*(-l+t),V){let e=te+Y,n=h,o=e*T,c=a(e,n,W),u=o-r,d=c-s;_=(-l+t)*(O-d),y=(D-u)*(-f+i),w=-(D-u)*(-l+t)}}else{let t=l-r,i=d-s,u=f-r,p=m-s,h=e(b*(1-n)+x*n,M,N),g=h,S=U+Q,C=a(g,S,v)-s,T=E(S)-o,D=c===2?-1:1;if(_=D*T*(-p+i),y=D*(-u+t)*C,w=-D*T*(-u+t),V){let e=h,n=U+Z,r=E(n),c=a(e,n,W)-s,l=r-o;_=(-T+l)*(-p+i),y=(-u+t)*(-C+c),w=-(-T+l)*(-u+t)}}let z=1/Math.sqrt(_*_+y*y+w*w);i.setEdgeNormalFromValues(c,t,_*z,y*z,w*z)}}}function ee(e,t){Z(e,t)}function V(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function H(e,t){return e*t}function te(e,t,n){return e?e=>V(e,t):e=>H(e,n)}function U(e,t,n){let{numVerticesPerSide:r,vertexAttributes:i,maxEdgeVertexCount:a}=e,o=r-1,s=i.count,l=r-3,u=r-3,d=2*l*u,f=4*(o+a-3),p=c.reduce((t,n)=>t+(o+e.getEdgeCount(n)-3),0),m=t.reduce((e,t)=>e+o*((t.latitudeResolution-1)*2+1),0),h=3*(n?2:1),g=(d+f+m)*h;e.indices=s>=65536?new Uint32Array(g):new Uint16Array(g),e.indexCount=(d+p+m)*h,e.poleIndicesStartIndex=d*h,e.edgeIndicesStartIndex=(d+m)*h,n?(q(e),ne(e,t),re(e)):(W(e),G(e,t),K(e))}function W(e){let{numVerticesPerSide:t,indices:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=t-2,c=t-3,l=t-3,u=0;for(let e=0;e<c;++e){let t=e*s;for(let e=0;e<l;++e){let r=t+e,i=r+1,c=i+s,l=c-1;Se(r,i,c,l,o,a)?(n[u]=r,n[u+1]=i,n[u+2]=c,n[u+3]=c,n[u+4]=l,n[u+5]=r):(n[u]=r,n[u+1]=i,n[u+2]=l,n[u+3]=l,n[u+4]=i,n[u+5]=c),u+=6}}}function G(e,t){let{numVerticesPerSide:n,indices:r,poleIndicesStartIndex:i}=e,a=n-1,o=i;for(let i of t){let t=i.isNorth?1:2,s=i.isNorth?2:1,c=i.isNorth?3:4,l=i.isNorth?4:3,u=e.getEdgeVertexIndex(i.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<i.latitudeResolution;++e){let f=e===0?i.rowOffset:u+n;for(let n=0;n<a;n++){let a=f+n;r[o]=u,r[o+t]=u+1,r[o+s]=a,e<i.latitudeResolution-1?(r[o+c]=u+1,r[o+l]=a+1,r[o+5]=a,o+=6):o+=3,u+=d}u=f,d=1}}}function K(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:2,m=d?2:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+m]=b,o+=3}}e.indexCount=o}function q(e){let{indices:t,numVerticesPerSide:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=n-2,c=0;for(let e=0;e<n-3;++e){let r=e*s;for(let i=0;i<n-3;++i){let n=e*s+i,l=n+1,u=l+s,d=u-1,f=r+i,p=f+1,m=p+s;Se(f,p,m,m-1,o,a)?(Ce(t,c,n,l,u),c+=6,Ce(t,c,u,d,n)):(Ce(t,c,n,l,d),c+=6,Ce(t,c,d,u,l)),c+=6}}}function ne(e,t){let{indices:n,numVerticesPerSide:r,poleIndicesStartIndex:i}=e,a=r-1,o=i;for(let i of t){let t=i.connectedOuterEdgeOffset,s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<i.latitudeResolution;++e){let t=e===0?i.rowOffset:s+r;for(let r=0;r<a;r++)Ce(n,o,s,s+1,t+r),o+=6,e<i.latitudeResolution-1&&(Ce(n,o,s+1,t+r+1,t+r),o+=6),s+=c;s=t,c=1}}}function re(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:3,m=d?3:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+p+1]=n,t[o+m]=b,t[o+m+1]=b,t[o+5]=e,o+=6}}e.indexCount=o}function J(e){let{geometry:t,geometryState:n}=e,{edgeResolutions:r}=n,{numVerticesPerSide:i,edgeVerticesStartIndex:a}=t,o=i-2,s=a;for(let e=0;e<4;++e){{let t=e===1?o-1:0,n=e===0?o-1:0,r=e===0||e===2,i=+!!r,a=+!r,s=n*o+t,c=a*o+i,l=ye[e];l.vertex0Index=s,l.stride=c,l.count=o}{let n=r[e]+1;t.outerEdgesOffsetAndLength[e*2+0]=s,t.outerEdgesOffsetAndLength[e*2+1]=n,s+=n}}}function Y(e){J(e),e.geometryState.wireframe?re(e.geometry):K(e.geometry)}function X(r,i,a){let{geometryState:o,geometry:s,tile:c,localOrigin:l}=r,u=i===1||i===3,d=o.edgeResolutions[i];f(t(d));let p=d+1,{boundingBox:m,minu:h,minv:g,maxu:_,maxv:v,vertexAttributes:y}=s,b=e(+(i===1),h,_),x=e(+(i===0),g,v),S=a.renderData,C=S.geometryState;if(!C||!S.geometry.vertexAttributes)return!1;let w=S.geometry,T=(i+2)%4,E=w.getEdgeCount(T),D=c.getNeighborEdgeStartVertexIndex(i,a)*d,O=d*2**(c.level-a.level);f(C.edgeResolutions[T]===O),f(E-1===O);let k=S.localOrigin[0]-l[0],A=S.localOrigin[1]-l[1],j=S.localOrigin[2]-l[2],M=s.getEdgeFirstVertexIndex(i),{position:N,uv0:P}=y,F=N.typedBuffer,I=N.typedBufferStride,L=y.normalCompressed,R=L.typedBuffer,z=L.typedBufferStride,B=w.vertexAttributes,ee=w.getEdgeFirstVertexIndex(T),V=B.position.typedBuffer,H=B.position.typedBufferStride,te=B.normalCompressed.typedBuffer,U=B.normalCompressed.typedBufferStride;for(let t=1;t<p-1;++t){let r=D+t,i=M+t,a=ee+r,o=i*I,s=a*H,c=V[s]+k,l=V[s+1]+A,f=V[s+2]+j;F[o]=c,F[o+1]=l,F[o+2]=f,be(c,l,f,m);let p=i*z,y=a*U;R[p]=te[y],R[p+1]=te[y+1];let S=t/d,C=u?b:e(S,h,_),w=u?e(S,g,v):x;P.setValues(i,Math.round(C*n),Math.round(w*n))}return!0}function Z(t,r){let{geometry:i,geometryState:o,localOrigin:s}=t,{clippingArea:c,samplerData:l}=o,{minu:u,minv:d,maxu:p,maxv:m,boundingBox:h,vertexAttributes:g}=i,v=t.tile,{surface:y,ellipsoid:b,extent:x,extentInRadians:S,horizontalScale:C}=v,w=y.view?.viewingMode===`local`,T=b.radius,E=0,D=0,O=0,k=w?(()=>{let t=c,n=t!=null&&(x[3]>t[3]||x[2]>t[2]||x[1]<t[1]||x[0]<t[0]),r=te(y.isWebMercatorOnPlateCarree,T,C);return(i,a,o)=>{let s=i===0?x[0]:x[2],c=a===0?x[1]:x[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;E=l*C,D=r(u),O=d}})():(e,t,n)=>{let r=S[t===0?1:3],i=S[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=T+n;E=c*a*l,D=s*a*l,O=o*l},A=0,j=0,M=0,N=0,F=0,I=0,L=0,R=0,z=0,B=w&&y.isWebMercatorOnPlateCarree,ee=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(w){let e=t*C,i=B?(Math.PI/2-2*Math.atan(Math.exp(-n/T)))*T:n*C,c=r;a=e-E,o=i-D,s=c-O}else{let i=P(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),p=u[0]*(1-d)+u[2]*d,m=i(f),h=Math.cos(m),g=Math.sin(m),_=Math.sin(p),v=Math.cos(p),y=T+r,b=v*h*y,x=_*h*y,S=g*y;a=b-E,o=x-D,s=S-O}switch(i){case 0:L+=a,R+=o,z+=s;break;case 1:N-=a,F-=o,I-=s;break;case 2:L-=a,R-=o,z-=s;break;case 3:N+=a,F+=o,I+=s}},V=c??he,H=x[0],U=x[2],W=x[1],G=x[3],K=[G>V[3],U>V[2],W<V[1],H<V[0]],q=Math.max(H,V[0]),ne=Math.min(U,V[2]),re=Math.max(W,V[1]),J=Math.min(G,V[3]),Y=e=>Math.max(V[0],Math.min(V[2],e)),X=e=>Math.max(V[1],Math.min(V[3],e)),Z=e=>{let t=o.cornerNeighborCornerTiles;A=0,j=0,M=1,N=0,F=0,I=0,L=0,R=0,z=0;let n=1/0;for(let r=0;r<4;++r){let i=t[e*4+r];n=Math.min(n,i?.level??1/0)}for(let r=0;r<4;++r){let i=t[e*4+r];ge[r]=i?.level===n?i:null}let r=1,i=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}let s=i,c=r;f(c>1);let l=s/c;for(let e=0;e<4;++e){let t=ge[(e+3)%4],n=ge[e%4];if(!t&&!n)continue;let r=e===0?1:e===1?2:e===2?3:0,i=e===0?2:e===1?3:e===2?0:1;if(t&&n){let o=se[e][0]*l,s=se[e][1]*l,c=t.extent,u=Y(c[r===0||r===1?2:0]+o),d=X(c[r===0||r===3?3:1]+s),f=n.extent,p=Y(f[i===0||i===1?2:0]+o),m=X(f[i===0||i===3?3:1]+s),h=t.renderData,g=n.renderData,_=a(u,d,h.geometryState.samplerData),v=a(p,m,g.geometryState.samplerData);ee(h,u,d,.5*(_+v),e)}else{let o=t??n,s=t?r:i,c=o.extent,u=se[e],d=Y(c[s===0||s===1?2:0]+u[0]*l),f=X(c[s===0||s===3?3:1]+u[1]*l),p=o.renderData,m=a(d,f,p.geometryState.samplerData);ee(p,d,f,m,e)}}if(!w){let e=Math.sqrt(E*E+D*D+O*O);A=E/e,j=D/e,M=O/e}if(w||M*M<.999){let e=Math.sqrt(N*N+F*F+I*I);N/=e,F/=e,I/=e;let t=Math.sqrt(L*L+R*R+z*z);L/=t,R/=t,z/=t,A=I*R-F*z,j=N*z-I*L,M=F*L-N*R;let n=1/Math.sqrt(A*A+j*j+M*M);A*=n,j*=n,M*=n}},Q=o.cornerNeighborCornerTiles;for(let t=0;t<4;++t){if(!(r&1<<t))continue;let c=t,y=(t+1)%4,b=+(t===0||t===1),x=+(t===0||t===3),S=e(b,u,p),C=e(x,d,m),w=i.getEdgeFirstVertexIndex(c),T=i.getEdgeCount(c),N=t===0||t===3?T-1:0,P=i.getEdgeFirstVertexIndex(y),F=i.getEdgeCount(y),I=t===0||t===1?F-1:0,L=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+L];n&&(L===-1||_(r,n)>0)&&(L=e)}let R=L,z=Q[t*4+R];if(z!==v){let e=v.level-z.level,r=2**e,i=[z.lij[0]+e,z.lij[1]*r,z.lij[2]*r],a=[i[1]+r===v.lij[1],t===0&&(R===1||R===0&&z!==Q[t*4+3])||t===1&&(R===0||R===1&&z!==Q[t*4+2]),i[1]===v.lij[1]+1,t===2&&(R===3||R===2&&z!==Q[t*4+1])||t===3&&(R===2||R===3&&z!==Q[t*4+0])],c=a.reduce((e,t)=>e+ +!!t,0);f(c===1||c===2);let l=-1,u=-1,d=z.renderData;if(c===1){let e=a.findIndex(e=>e);f(0<=e&&e<=3),l=(e+2)%4;let n=o.edgeResolutions[e];u=v.getNeighborEdgeStartVertexIndex(e,z)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{f(a[1]||a[3]),l=a[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let p=d.geometry;{let e=w+N,t=P+I,r=p.getEdgeFirstVertexIndex(l)+u,i=p.vertexAttributes,a=d.localOrigin,o=i.position,c=o.typedBuffer,f=r*o.typedBufferStride,m=c[f]+a[0]-s[0],_=c[f+1]+a[1]-s[1],v=c[f+2]+a[2]-s[2];be(m,_,v,h);let y=g.position,b=y.typedBuffer,x=e*y.typedBufferStride;b[x]=m,b[x+1]=_,b[x+2]=v;let T=t*y.typedBufferStride;b[T]=m,b[T+1]=_,b[T+2]=v;let E=g.uv0;E.setValues(e,Math.round(S*n),Math.round(C*n)),E.setValues(t,Math.round(S*n),Math.round(C*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=g.normalCompressed,s=o.typedBuffer;{let t=e*o.typedBufferStride;s[t]=n[a],s[t+1]=n[a+1]}{let e=t*o.typedBufferStride;s[e]=n[a],s[e+1]=n[a+1]}}}}else{let n=K[c],r=K[y],o;if(n||r){let t=e(H*(1-b)+U*b,q,ne),n=e(W*(1-x)+G*x,re,J);o=a(t,n,l)}else o=ie(Q,t);k(b,x,o),Z(t);let u=E-s[0],d=D-s[1],f=O-s[2];be(u,d,f,h),i.setEdgeVertexFromValuesRawPositionUVNormal(c,N,u,d,f,S,C,A,j,M),i.setEdgeVertexFromValuesRawPositionUVNormal(y,I,u,d,f,S,C,A,j,M)}}for(let e=0;e<4;++e)ge[e]=null}function ie(e,t){let n=t*4,r=c.reduce((t,r)=>Math.min(t,e[n+r]?.level??1/0),1/0);p&&(f(!e[n+0]||!e[n+2]||g(e[n+0],e[n+2],5)),f(!e[n+1]||!e[n+3]||g(e[n+1],e[n+3],7)));let i=0,o=0;for(let t=0;t<4;++t){let s=e[n+t];if(s?.level===r){let e=t===0||t===1,n=t===0||t===3,r=s.extent,c=r[e?0:2],l=r[n?1:3],u=s.renderData?.geometryState?.samplerData,d=a(c,l,u);o+=d,i++}}let s=i?o/i:0;return f(s!=null),s}function Q(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,o.length)}function ae(e){let{vao:t,geometry:n}=e,{indices:r,indexCount:i,edgeIndicesStartIndex:a}=n;t.indexBuffer.setSubData(r,a,a,i)}class oe{constructor(e,t,n,r,i){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=r,this.latitudeResolution=i}}const se=[[0,1],[1,0],[0,-1],[-1,0]],$=new s,ce=.5*d,le=new Uint16Array(u+1),ue=new Int32Array(u+1),de=new Int32Array(u+1),fe=new Int32Array(u+1),pe=new Float64Array(u+1),me=new Float64Array(u+1),he=i(-1/0,-1/0,1/0,1/0),ge=[null,null,null,null];function _e(e,t,n){if(!t)return!1;let r=_(e,t);return r>0||r===0&&n>=2}class ve{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return f(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ye=[new ve,new ve,new ve,new ve];function be(e,t,n,r){e<r[0]?r[0]=e:e>r[3]&&(r[3]=e),t<r[1]?r[1]=t:t>r[4]&&(r[4]=t),n<r[2]?r[2]=n:n>r[5]&&(r[5]=n)}function xe(e){let{edgeResolutions:t,numVerticesPerSide:n}=e,r=1+Math.max(...t);return Math.max(n,r)}function Se(e,t,n,r,i,a){let o=e*i,s=a[o],c=a[o+1],l=a[o+2],u=t*i,d=a[u],f=a[u+1],p=a[u+2],m=n*i,h=a[m],g=a[m+1],_=a[m+2],v=r*i,y=a[v],b=a[v+1],x=a[v+2],S=(s-h)*(s-h)+(c-g)*(c-g)+(l-_)*(l-_);return(d-y)*(d-y)+(f-b)*(f-b)+(p-x)*(p-x)>S}function Ce(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=r,e[t+3]=i,e[t+4]=i,e[t+5]=n}const we=15,Te=15,Ee=6;export{F as createPlanarGlobePatch,y as createSphericalGlobePatch,L as updateEdgeElevationsAndResolutionsPlanar,D as updateEdgeElevationsAndResolutionsSpherical,R as updateEdgesAndCornersPlanar,E as updateEdgesAndCornersSpherical};
2
+ import{clamp as e,isPowerOfTwo as t}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as r}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as i}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevation as a,sampleSingleElevation as o}from"./ElevationData.js";import{PatchGeometryLUT as s}from"./PatchGeometryLUT.js";import{zeroToFour as c,neighborTileIfLoadedOrSelf as l}from"./PatchRenderData.js";import{maxPatchTesselation as u,elevationNoDataValue as d}from"./TerrainConst.js";import{internalAssert as f,enableTerrainInternalChecks as p,neighborEdgeIndices as m,almostEquals as h}from"./terrainUtils.js";import{isCornerNeighbor as g}from"./Tile.js";import{compareTilesByLij as _}from"./tileUtils.js";import{compressNormal as v}from"../webgl-engine/lib/Normals.js";function y(e,t){let{tile:n,geometry:i,geometryState:a}=e,{extentInRadians:o,surface:s}=n,{isWebMercator:c,renderer:l}=s,{numVerticesPerSide:u,wireframe:d}=a,f=u-1,p=(u-2)**2,m=c&&(t===2||t===3),h=c&&(t===1||t===3),g=(+!!m+ +!!h)*Ee*u,_=xe(a),v=4*_,y=p+g+v,S=l.tileGeometryCache.acquire(y);i.numVerticesPerSide=u,i.vertexAttributes=S,i.maxEdgeVertexCount=_;let{boundingBox:C}=i;r(C);let w=P(e);$.update(f,o,w),x(e),i.poleVerticesStartIndex=p;let T=b(e,m,h);i.edgeVerticesStartIndex=p+g,J(e),O(e,we,Te),U(i,T,d),e.intersectionData=null}function b(e,t,r){let{tile:i,localOrigin:a,geometry:o}=e,{extent:s,ellipsoid:c}=i,{boundingBox:l,numVerticesPerSide:u,vertexAttributes:d,poleVerticesStartIndex:f}=o,p=u-1,m=a[0],h=a[1],g=a[2],_=c.radius,y=s[1],b=s[3],x=[],S=f,C=(e,t)=>{let r=t*u;be(-m,-h,-g+e*_,l),x.push(new oe(e===1,r,e===1?0:2,S,Ee));let i=j(e===-1?y:b,_),a=e*Math.PI/2-i,o=(e===1?1:-1)*.99,s=_+0,{position:c,uv0:f}=d,{typedBuffer:C,typedBufferStride:w}=d.normalCompressed;for(let e=1;e<=Ee;++e){let t=i+e/Ee*a,r=Math.cos(t),u=Math.sin(t);for(let e=0;e<=p;e++){let t=e/p,i=$.sinLonLUT[e],a=$.cosLonLUT[e]*r,d=i*r,_=u,y=a*s-m,b=d*s-h,x=_*s-g;be(y,b,x,l),c.setValues(S,y,b,x),f.setValues(S,Math.round(t*n),Math.round(o*n)),v(C,S,a,d,_,w),++S}}};return t&&C(-1,0),r&&C(1,p),x}function x(e){let t=e.geometryState.samplerData,n=t?.length===1?t[0]:null;n?S(e,n):C(e)}function S(e,t){let{tile:n}=e;if(!n.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:a}=e,{numVerticesPerSide:o}=i,s=o-2,c=o-1,{vertexAttributes:l,boundingBox:u}=r,{position:d,uv0:f}=l,{typedBuffer:p,typedBufferStride:m}=l.normalCompressed,{extent:h}=n,g=n.ellipsoid.radius,_=a[0],y=a[1],b=a[2],x=d.typedBuffer,S=d.typedBufferStride,C=f.typedBuffer,E=f.typedBufferStride;w(c,h,t);let D=0,O=t.data.values;if(1<=s){let e=le[1],t=$.sinLatLUT[1],n=$.cosLatLUT[1];for(let r=1;r<=s;r++){let i=$.sinLonLUT[r],a=$.cosLonLUT[r],o=g+T(r,1,O),s=-_+o*a*n,c=-y+o*i*n,l=-b+o*t;be(s,c,l,u);let d=(r-1)*S;x[d]=s,x[d+1]=c,x[d+2]=l;let f=(r-1)*E;C[f]=le[r],C[f+1]=e}}for(let e=1;e<=s;e++){let t=$.sinLatLUT[e],n=$.cosLatLUT[e],r=e+1,i=le[r],a=$.sinLatLUT[r],o=$.cosLatLUT[r],l=$.sinLonLUT[0],d=$.cosLonLUT[0],f=g+T(0,e,O),h=d*n*f-_,w=l*n*f-y,k=t*f-b,A=D*S,j=x[A],M=x[A+1],N=x[A+2];for(let l=1;l<=s;l++){let d=$.sinLonLUT[l],f=$.cosLonLUT[l],A=0,P=0,F=0;if(l<s){let e=(D+1)*S;A=x[e],P=x[e+1],F=x[e+2]}else{let r=$.sinLonLUT[c],i=$.cosLonLUT[c],a=g+T(c,e,O);A=i*n*a-_,P=r*n*a-y,F=t*a-b}let I=h,L=w,R=k;h=j,w=M,k=N,j=A,M=P,N=F;let z=A-I,B=P-L,ee=F-R,V=0,H=0,te=0;if(e>1){let e=(D-s)*S;V=x[e],H=x[e+1],te=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=g+T(l,0,O);V=f*t*n-_,H=d*t*n-y,te=e*n-b}let U=g+T(l,r,O),W=f*o*U-_,G=d*o*U-y,K=a*U-b;if(e<s){let e=D+s,t=e*S;x[t]=W,x[t+1]=G,x[t+2]=K,be(W,G,K,u);let n=e*E;C[n]=le[l],C[n+1]=i}let q=V-W,ne=H-G,re=te-K,J=f*n,Y=d*n,X=t;X*X<.999&&(J=ee*ne-B*re,Y=z*re-ee*q,X=B*q-z*ne);let Z=1/Math.sqrt(J*J+Y*Y+X*X);v(p,D,J*Z,Y*Z,X*Z,m),++D}}}function C(e){let{tile:t}=e;if(!t.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:o}=e,{numVerticesPerSide:s,samplerData:c}=i,l=s-2,u=s-1,{vertexAttributes:d,boundingBox:f}=r,{position:p,uv0:m}=d,{typedBuffer:h,typedBufferStride:g}=d.normalCompressed,{extent:_}=t,y=_[0],b=_[2],x=_[1],S=_[3],C=t.ellipsoid.radius,w=o[0],T=o[1],E=o[2],D=p.typedBuffer,O=p.typedBufferStride,k=1/u,A=0;if(1<=l){let e=k,t=x*(1-e)+S*e,r=$.sinLatLUT[1],i=$.cosLatLUT[1];for(let o=1;o<=l;o++){let s=o*k,l=y*(1-s)+b*s,u=$.sinLonLUT[o],d=$.cosLonLUT[o],p=C+a(l,t,c),h=-w+p*d*i,g=-T+p*u*i,_=-E+p*r;be(h,g,_,f);let v=(o-1)*O;D[v]=h,D[v+1]=g,D[v+2]=_,m.setValues(o-1,Math.round(s*n),Math.round(e*n))}}for(let e=1;e<=l;e++){let t=e*k,r=x*(1-t)+S*t,i=$.sinLatLUT[e],o=$.cosLatLUT[e],s=e+1,d=s*k,p=x*(1-d)+S*d,_=$.sinLatLUT[s],j=$.cosLatLUT[s],M=$.sinLonLUT[0],N=$.cosLonLUT[0],P=C+a(y,r,c),F=N*o*P-w,I=M*o*P-T,L=i*P-E,R=A*O,z=D[R],B=D[R+1],ee=D[R+2];for(let t=1;t<=l;t++){let s=t*k,S=y*(1-s)+b*s,M=$.sinLonLUT[t],N=$.cosLonLUT[t],P=0,R=0,V=0;if(t<l){let e=(A+1)*O;P=D[e],R=D[e+1],V=D[e+2]}else{let e=$.sinLonLUT[u],t=$.cosLonLUT[u],n=C+a(b,r,c);P=t*o*n-w,R=e*o*n-T,V=i*n-E}let H=F,te=I,U=L;F=z,I=B,L=ee,z=P,B=R,ee=V;let W=P-H,G=R-te,K=V-U,q=0,ne=0,re=0;if(e>1){let e=(A-l)*O;q=D[e],ne=D[e+1],re=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+a(S,x,c);q=N*t*n-w,ne=M*t*n-T,re=e*n-E}let J=C+a(S,p,c),Y=N*j*J-w,X=M*j*J-T,Z=_*J-E;if(e<l){let e=A+l,t=e*O;D[t]=Y,D[t+1]=X,D[t+2]=Z,be(Y,X,Z,f),m.setValues(e,Math.round(s*n),Math.round(d*n))}let ie=q-Y,Q=ne-X,ae=re-Z,oe=N*o,se=M*o,ce=i;ce*ce<.999&&(oe=K*Q-G*ae,se=W*ae-K*ie,ce=G*ie-W*Q);let le=1/Math.sqrt(oe*oe+se*se+ce*ce);v(h,A,oe*le,se*le,ce*le,g),++A}}}function w(t,r,i){let a=r[0],o=r[2],s=r[1],c=r[3],l=1/t,{dx:u,dy:d,x0:f,y1:p,safeWidth:m}=i,h=i.data.width;for(let r=0;r<=t;r++){let t=r*l,i=e(u*(a*(1-t)+o*t-f),0,m),g=Math.floor(i);ue[r]=g,pe[r]=i-g;let _=e(d*(p-(s*(1-t)+c*t)),0,m),v=Math.floor(_);de[r]=v*h,fe[r]=(v+1)*h,me[r]=_-v,le[r]=Math.round(t*n)}}function T(e,t,n){let r=ue[e],i=pe[e],a=de[t],o=fe[t],s=me[t],c=a+r,l=n[c],u=n[c+1],d=n[o+r],f=n[o+r+1];if(l+d+u+f>=ce)return 0;let p=l+(u-l)*i;return p+(d+(f-d)*i-p)*s}function E(e,t=!1){e.tile.intersectsClippingArea&&(O(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(Y(e),O(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function O(e,t,n){e.tile.intersectsClippingArea&&(n&&A(e,n),t&&k(e,t))}function k(e,r){let{geometry:i,geometryState:s,tile:c,localOrigin:u}=e,{level:d,extent:g,extentInRadians:y,ellipsoid:b}=c,x=b.radius,S=y[0],C=y[2],w=y[1],T=y[3],{samplerData:E}=s,D=g[0],O=g[2],k=g[1],A=g[3],j=P(e),{boundingBox:M,vertexAttributes:N}=i,F=u[0],I=u[1],L=u[2],{position:R,uv0:z}=N,B=R.typedBuffer,ee=R.typedBufferStride,V=z.typedBuffer,H=z.typedBufferStride,{typedBuffer:te,typedBufferStride:U}=N.normalCompressed,W=E?.length===1?E[0]:null,G=(e,t,n)=>W?o(e,t,W)??0:a(e,t,E)??0;for(let u=0;u<4;++u){if(!(r&1<<u))continue;let y=u===1||u===3,b=s.edgeResolutions[u];f(t(b));let N=b+1,P=l(c,s.edgePeerNeighbors[u]);if(_e(c,P,u)&&X(e,u,P))continue;let R=P!=null;f(!R||P.level===c.level),f(!R||_(c,P)<=0);let z=P?.renderData?.geometryState;if(p){let e=c.surface;if(!P&&e&&!e.updatingRootTiles){let t=m[u],n=c.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===c.level);n?n.intersectsClippingArea&&(f(!n.loaded),f(!n.leaf),f(n.level===d)):f(e?.rootTiles==null||!c.shouldHaveNeighbor(t))}}let K=u===1?g[2]:g[0],q=P?.extent,ne=q&&y?u===1?q[0]:q[2]:K,re=u===0?g[3]:g[1],J=+(u===1),Y=+(u===0),Z=u===1?C:S,ie=u===0?T:w,Q=Math.sin(Z),ae=Math.cos(Z),oe=Math.sin(ie),se=Math.cos(ie),$=z?.samplerData,ce=$?.length===1?$[0]:null,le=(e,t,n)=>ce?o(n,t,ce)??0:a(n,t,$)??0,ue=R?(e,t,n)=>(G(e,t)+le(e,t,n))*.5:G,de=i.outerEdgesOffsetAndLength[u*2+0],fe=W!=null||E!=null&&E.some(e=>e!=null),pe=ce!=null||$!=null&&$.some(e=>e!=null),me=fe||pe,he=1/b,ge=n*he,ve=J*n,ye=Y*n,xe=de;f(!q||h(q[2]-q[0],g[2]-g[0])),(()=>{let e=u===1?-1:+(u===3),t=u===0?-1:+(u===2),n=(g[2]-g[0])*he,r=e*n,i=t*n,s=C-S,c=y?s*he*e:0,l=y?0:t*he,d=Y,f=y?Z+c:Z,p=y?Math.sin(f):Q,m=y?Math.cos(f):ae,h=y?Z-c:Z,_=y?Math.sin(h):Q,b=y?Math.cos(h):ae,w=d+l,T=y?ie:j(w),P=y?oe:Math.sin(T),z=y?se:Math.cos(T),G=d-l,q=y?ie:j(G),J=y?oe:Math.sin(q),X=y?se:Math.cos(q),le=0,de=0,fe=0;{let e=0*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);le=o*l*u,de=a*l*u,fe=c*u}let pe=0,_e=0,Se=0;{let e=1*he,t=y?K:D*(1-e)+O*e,n=y?ne:t,r=y?k*(1-e)+A*e:re,i=y?Z:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);pe=o*l*u,_e=a*l*u,Se=c*u}for(let e=1;e<N-1;++e){let t=0,n=0,s=0;{let r=(e+1)*he,i=y?K:D*(1-r)+O*r,a=y?ne:i,o=y?k*(1-r)+A*r:re,c=y?Z:S*(1-r)+C*r,l=y?Q:Math.sin(c),u=y?ae:Math.cos(c),d=y?j(r):ie,f=y?Math.sin(d):oe,p=y?Math.cos(d):se,m=x+ue(i,o,a);t=u*p*m,n=l*p*m,s=f*m}let c=t,l=n,d=s,f=pe,h=_e,g=Se;pe=c,_e=l,Se=d;{let t=xe+e,n=t*ee,r=f-F,i=h-I,a=g-L;B[n]=r,B[n+1]=i,B[n+2]=a,be(r,i,a,M);let o=Math.round(e*ge),s=t*H;V[s]=y?ve:o,V[s+1]=y?o:ye}let w=le,T=de,N=fe;le=f,de=h,fe=g;let G=f,q=h,Y=g,Ce=1/Math.sqrt(G*G+q*q+Y*Y),we=Y*Ce,Te=0,Ee=0,De=0;if(me&&we*we<.999){let t=0,n=0,s=0;{let e=u===0?-1:1;t=e*(c-w),n=e*(l-T),s=e*(d-N)}{let c=e*he,l=y?K:D*(1-c)+O*c,d=y?ne:l,f=y?k*(1-c)+A*c:re,h=y?Z:S*(1-c)+C*c,g=y?Q:Math.sin(h),v=y?ae:Math.cos(h),w=y?j(c):ie,T=y?Math.sin(w):oe,M=y?Math.cos(w):se,N=G,F=q,I=Y;if(R){let e=d-r,t=f-i,n=x+(ce?o(e,t,ce)??0:a(e,t,$)??0),s=y?_:g,c=y?b:v,l=y?T:J,u=y?M:X;N=c*u*n,F=s*u*n,I=l*n}{let e=l+r,c=f+i,d=x+(W?o(e,c,W)??0:a(e,c,E)??0),h=y?p:g,_=y?m:v,b=y?T:P,S=y?M:z,C=_*S*d,w=h*S*d,D=b*d;R||(N=2*G-C,F=2*q-w,I=2*Y-D);let O=u===3?-1:1,k=O*(N-C),A=O*(F-w),j=O*(I-D);Te=s*A-n*j,Ee=t*j-s*k,De=n*k-t*A;let L=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=L,Ee*=L,De*=L}}}else Te=G*Ce,Ee=q*Ce,De=Y*Ce;v(te,xe+e,Te,Ee,De,U)}})()}}function A(e,t){Z(e,t)}function j(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function M(e,t,n,r){return j(e*(1-r)+t*r,n)}function N(e,t,n){return e*(1-n)+t*n}function P(e){let{tile:t}=e;if(t.surface.isWebMercator){let e=t.extent,n=t.ellipsoid.radius;return t=>M(e[1],e[3],n,t)}let n=t.extentInRadians;return e=>N(n[1],n[3],e)}function F(e){let{tile:t,geometryState:n,geometry:i}=e,{extent:a,surface:o}=t,{wireframe:s}=n,c=a[0],l=a[1],u=a[2],d=a[3],f=u-c,p=d-l,{numVerticesPerSide:m,clippingArea:h}=n,g=h==null?0:Math.max(0,(h[0]-c)/f),_=h==null?0:Math.max(0,(h[1]-l)/p),v=h==null?1:Math.min(1,(h[2]-c)/f),y=h==null?1:Math.min(1,(h[3]-l)/p),b=(m-2)**2,x=xe(n),S=b+4*x,C=o.renderer.tileGeometryCache.acquire(S),{boundingBox:w}=i;r(w),i.numVerticesPerSide=m,i.vertexAttributes=C,i.maxEdgeVertexCount=x,i.minu=g,i.minv=_,i.maxu=v,i.maxv=y,I(e),i.edgeVerticesStartIndex=b,J(e),z(e,we,Te),U(i,[],s),e.intersectionData=null}function I(t){let r=t.tile;if(!r.intersectsClippingArea)return;let{geometry:i,geometryState:s,localOrigin:c}=t,{samplerData:l,clippingArea:u,numVerticesPerSide:d}=s,{surface:f,extent:p,ellipsoid:m}=r,{isWebMercatorOnPlateCarree:h}=f,g=u??he,_=p[0],y=p[1],b=p[2],x=p[3],S=Math.max(_,g[0]),C=Math.min(b,g[2]),w=Math.max(y,g[1]),T=Math.min(x,g[3]),E=m.radius,D=r.horizontalScale,O=d-1,k=d-2,{minu:A,minv:j,maxu:M,maxv:N,boundingBox:P,vertexAttributes:F}=i,{position:I,uv0:L}=F,{typedBuffer:R,typedBufferStride:z}=F.normalCompressed,B=c[0],ee=c[1],V=c[2],H=I.typedBuffer,te=I.typedBufferStride,U=0,W=e(y,w,T),G=h?(Math.PI/2-2*Math.atan(Math.exp(-W/E)))*E:W*D,K=1/O,q=e(y*(1-K)+x*K,w,T),ne=h?(Math.PI/2-2*Math.atan(Math.exp(-q/E)))*E:q*D,re=G,J=ne,Y=l?.length===1?l[0]:null,X=Y?(e,t)=>o(e,t,Y)??0:(e,t)=>a(e,t,l)??0;for(let t=1;t<=k;t++){let r=t/O,i=e(y*(1-r)+x*r,w,T),a=e(r,j,N),o=J,s=(t-1)/O,c=e(y*(1-s)+x*s,w,T),l=re,u=(t+1)/O,d=e(y*(1-u)+x*u,w,T),f=h?(Math.PI/2-2*Math.atan(Math.exp(-d/E)))*E:d*D,p=e(u,j,N);re=J,J=f;let m=e(_,S,C),g=m*D,F=X(m,i),I=1/O,W=e(I,A,M),G=e(_*(1-W)+b*W,S,C),K=W,q=G,ne=G*D,Y=X(G,i);if(t===1){let t=ne-B,r=re-ee,i=Y-V,o=0*te;H[o]=t,H[o+1]=r,H[o+2]=i,be(t,r,i,P);let s=e(I,A,M);L.setValues(U,Math.round(s*n),Math.round(a*n))}for(let r=1;r<=k;r++){let s=ne,u=Y,m=(r+1)/O,h=e(m,A,M),y=e(_*(1-m)+b*m,S,C),x=q;q=y;{let e=U+1,s=e*te;if(t===1||r===k){let c=X(y,i),l=y*D,u=o,d=c;if(t===1&&r<k){let t=l-B,r=u-ee,i=d-V;H[s]=t,H[s+1]=r,H[s+2]=i,be(t,r,i,P),L.setValues(e,Math.round(h*n),Math.round(a*n))}ne=l,Y=d}else ne=H[s]+B,Y=H[s+2]+V}let w=ne,T=Y,E=g,j=F;g=s,F=u;let N=(U-k)*te,I=t===1?X(x,c):H[N+2]+V,W=X(x,d);if(t<k){let e=U+k,t=e*te,r=s-B,i=f-ee,a=W-V;H[t]=r,H[t+1]=i,H[t+2]=a,be(r,i,a,P);let o=K;K=h,L.setValues(e,Math.round(o*n),Math.round(p*n))}{let e=w-E,t=T-j,n=l-f,r=I-W,i=n*t,a=e*r,o=-n*e,s=i*i+a*a+o*o;if(s===0)v(R,U,0,0,1,z);else{let e=1/Math.sqrt(s);v(R,U,i*e,a*e,o*e,z)}}++U}}}function L(e){e.tile.intersectsClippingArea&&(Y(e),z(e,we,Te),Q(e),ae(e),e.intersectionData=null)}function R(e,t=!1){e.tile.intersectsClippingArea&&(z(e,t?we:e.dirtyEdges,t?Te:e.dirtyCorners),Q(e),e.intersectionData=null)}function z(e,t,n){e.tile.intersectsClippingArea&&(n&&ee(e,n),t&&B(e,t))}function B(n,r){let{geometry:i,geometryState:s,localOrigin:c}=n,u=n.tile,{surface:d,extent:h}=u,{clippingArea:g,samplerData:v}=s,y=g??he,b=h[0],x=h[2],S=h[1],C=h[3],w=[C>y[3],x>y[2],S<y[1],b<y[0]],T=u.horizontalScale,E=te(d.isWebMercatorOnPlateCarree,u.ellipsoid.radius,T),{minu:D,minv:O,maxu:k,maxv:A,boundingBox:j}=i,M=Math.max(b,y[0]),N=Math.min(x,y[2]),P=Math.max(S,y[1]),F=Math.min(C,y[3]),I=c[0],L=c[1],R=c[2],z=v?.length===1?v[0]:void 0,B=z?(e,t)=>o(e,t,z)??0:(e,t)=>a(e,t,v)??0;for(let c=0;c<4;++c){if(!(r&1<<c))continue;let h=c===1||c===3,g=s.edgeResolutions[c];f(t(g));let y=g+1,z=w[c],ee=l(u,s.edgePeerNeighbors[c]);if(!z&&_e(u,ee,c)&&X(n,c,ee))continue;let V=ee!=null&&!z,H=ee?.renderData?.geometryState;if(p&&(f(!V||ee.level===u.level),f(!V||_(u,ee)<=0),u&&!ee&&!d.updatingRootTiles)){let e=m[c],t=u.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===u.level);d.updatingRootTiles||(t?t.intersectsClippingArea&&(f(!t.loaded),f(!t.leaf),f(t.level===u.level)):f(d?.rootTiles==null||!u.shouldHaveNeighbor(e)))}let te=e(c===1?x:b,M,N),U=e(c===0?C:S,P,F),W=H?.samplerData,G=e(+(c===1),D,k),K=e(+(c===0),O,A),q=W?.length===1?W[0]:null,ne=(e,t)=>q?o(e,t,q)??0:a(e,t,W)??0,re=V?(e,t)=>(ne(e,t)+B(e,t))*.5:B,J=(x-b)/g,Y=h?c===1?J:-J:0,Z=h?0:c===0?J:-J,ie=-Y,Q=-Z,ae=0,oe=0,se=0;{let t=0/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r);ae=n*T,oe=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=h?te:e(b*(1-t)+x*t,M,N),r=h?e(S*(1-t)+C*t,P,F):U,i=re(n,r),a=n*T,o=E(r),s=i;$=a,ce=o,le=s}for(let t=1;t<y-1;++t){let n=t/g,r=$,o=ce,s=le;{let a=h?G:e(n,D,k),l=h?e(n,O,A):K,u=r-I,d=o-L,f=s-R;be(r,d,f,j),i.setEdgeVertexFromValuesRawPositionUV(c,t,u,d,f,a,l)}{let n=(t+1)/g,r=h?te:e(b*(1-n)+x*n,M,N),i=h?e(S*(1-n)+C*n,P,F):U,a=re(r,i);$=r*T,ce=E(i),le=a}let l=$,u=ce,d=le,f=ae,p=oe,m=se;ae=r,oe=o,se=s;let _=0,y=0,w=0;if(h){let t=u-o,i=d-s,l=p-o,f=m-s,h=e(S*(1-n)+C*n,P,F),g=te+ie,b=h,x=g*T,E=a(g,b,v),D=x-r,O=E-s,k=c===3?-1:1;if(_=k*(-l+t)*O,y=k*D*(-f+i),w=-k*D*(-l+t),V){let e=te+Y,n=h,o=e*T,c=a(e,n,W),u=o-r,d=c-s;_=(-l+t)*(O-d),y=(D-u)*(-f+i),w=-(D-u)*(-l+t)}}else{let t=l-r,i=d-s,u=f-r,p=m-s,h=e(b*(1-n)+x*n,M,N),g=h,S=U+Q,C=a(g,S,v)-s,T=E(S)-o,D=c===2?-1:1;if(_=D*T*(-p+i),y=D*(-u+t)*C,w=-D*T*(-u+t),V){let e=h,n=U+Z,r=E(n),c=a(e,n,W)-s,l=r-o;_=(-T+l)*(-p+i),y=(-u+t)*(-C+c),w=-(-T+l)*(-u+t)}}let z=1/Math.sqrt(_*_+y*y+w*w);i.setEdgeNormalFromValues(c,t,_*z,y*z,w*z)}}}function ee(e,t){Z(e,t)}function V(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function H(e,t){return e*t}function te(e,t,n){return e?e=>V(e,t):e=>H(e,n)}function U(e,t,n){let{numVerticesPerSide:r,vertexAttributes:i,maxEdgeVertexCount:a}=e,o=r-1,s=i.count,l=r-3,u=r-3,d=2*l*u,f=4*(o+a-3),p=c.reduce((t,n)=>t+(o+e.getEdgeCount(n)-3),0),m=t.reduce((e,t)=>e+o*((t.latitudeResolution-1)*2+1),0),h=3*(n?2:1),g=(d+f+m)*h;e.indices=s>=65536?new Uint32Array(g):new Uint16Array(g),e.indexCount=(d+p+m)*h,e.poleIndicesStartIndex=d*h,e.edgeIndicesStartIndex=(d+m)*h,n?(q(e),ne(e,t),re(e)):(W(e),G(e,t),K(e))}function W(e){let{numVerticesPerSide:t,indices:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=t-2,c=t-3,l=t-3,u=0;for(let e=0;e<c;++e){let t=e*s;for(let e=0;e<l;++e){let r=t+e,i=r+1,c=i+s,l=c-1;Se(r,i,c,l,o,a)?(n[u]=r,n[u+1]=i,n[u+2]=c,n[u+3]=c,n[u+4]=l,n[u+5]=r):(n[u]=r,n[u+1]=i,n[u+2]=l,n[u+3]=l,n[u+4]=i,n[u+5]=c),u+=6}}}function G(e,t){let{numVerticesPerSide:n,indices:r,poleIndicesStartIndex:i}=e,a=n-1,o=i;for(let i of t){let t=i.isNorth?1:2,s=i.isNorth?2:1,c=i.isNorth?3:4,l=i.isNorth?4:3,u=e.getEdgeVertexIndex(i.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<i.latitudeResolution;++e){let f=e===0?i.rowOffset:u+n;for(let n=0;n<a;n++){let a=f+n;r[o]=u,r[o+t]=u+1,r[o+s]=a,e<i.latitudeResolution-1?(r[o+c]=u+1,r[o+l]=a+1,r[o+5]=a,o+=6):o+=3,u+=d}u=f,d=1}}}function K(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:2,m=d?2:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+m]=b,o+=3}}e.indexCount=o}function q(e){let{indices:t,numVerticesPerSide:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=n-2,c=0;for(let e=0;e<n-3;++e){let r=e*s;for(let i=0;i<n-3;++i){let n=e*s+i,l=n+1,u=l+s,d=u-1,f=r+i,p=f+1,m=p+s;Se(f,p,m,m-1,o,a)?(Ce(t,c,n,l,u),c+=6,Ce(t,c,u,d,n)):(Ce(t,c,n,l,d),c+=6,Ce(t,c,d,u,l)),c+=6}}}function ne(e,t){let{indices:n,numVerticesPerSide:r,poleIndicesStartIndex:i}=e,a=r-1,o=i;for(let i of t){let t=i.connectedOuterEdgeOffset,s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<i.latitudeResolution;++e){let t=e===0?i.rowOffset:s+r;for(let r=0;r<a;r++)Ce(n,o,s,s+1,t+r),o+=6,e<i.latitudeResolution-1&&(Ce(n,o,s+1,t+r+1,t+r),o+=6),s+=c;s=t,c=1}}}function re(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;f(u===i-1);let d=n===1||n===2,p=d?1:3,m=d?3:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,f=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||f<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+p]=n,t[o+p+1]=n,t[o+m]=b,t[o+m+1]=b,t[o+5]=e,o+=6}}e.indexCount=o}function J(e){let{geometry:t,geometryState:n}=e,{edgeResolutions:r}=n,{numVerticesPerSide:i,edgeVerticesStartIndex:a}=t,o=i-2,s=a;for(let e=0;e<4;++e){{let t=e===1?o-1:0,n=e===0?o-1:0,r=e===0||e===2,i=+!!r,a=+!r,s=n*o+t,c=a*o+i,l=ye[e];l.vertex0Index=s,l.stride=c,l.count=o}{let n=r[e]+1;t.outerEdgesOffsetAndLength[e*2+0]=s,t.outerEdgesOffsetAndLength[e*2+1]=n,s+=n}}}function Y(e){J(e),e.geometryState.wireframe?re(e.geometry):K(e.geometry)}function X(r,i,a){let{geometryState:o,geometry:s,tile:c,localOrigin:l}=r,u=i===1||i===3,d=o.edgeResolutions[i];f(t(d));let p=d+1,{boundingBox:m,minu:h,minv:g,maxu:_,maxv:v,vertexAttributes:y}=s,b=e(+(i===1),h,_),x=e(+(i===0),g,v),S=a.renderData,C=S.geometryState;if(!C||!S.geometry.vertexAttributes)return!1;let w=S.geometry,T=(i+2)%4,E=w.getEdgeCount(T),D=c.getNeighborEdgeStartVertexIndex(i,a)*d,O=d*2**(c.level-a.level);f(C.edgeResolutions[T]===O),f(E-1===O);let k=S.localOrigin[0]-l[0],A=S.localOrigin[1]-l[1],j=S.localOrigin[2]-l[2],M=s.getEdgeFirstVertexIndex(i),{position:N,uv0:P}=y,F=N.typedBuffer,I=N.typedBufferStride,L=y.normalCompressed,R=L.typedBuffer,z=L.typedBufferStride,B=w.vertexAttributes,ee=w.getEdgeFirstVertexIndex(T),V=B.position.typedBuffer,H=B.position.typedBufferStride,te=B.normalCompressed.typedBuffer,U=B.normalCompressed.typedBufferStride;for(let t=1;t<p-1;++t){let r=D+t,i=M+t,a=ee+r,o=i*I,s=a*H,c=V[s]+k,l=V[s+1]+A,f=V[s+2]+j;F[o]=c,F[o+1]=l,F[o+2]=f,be(c,l,f,m);let p=i*z,y=a*U;R[p]=te[y],R[p+1]=te[y+1];let S=t/d,C=u?b:e(S,h,_),w=u?e(S,g,v):x;P.setValues(i,Math.round(C*n),Math.round(w*n))}return!0}function Z(t,r){let{geometry:i,geometryState:o,localOrigin:s}=t,{clippingArea:c,samplerData:l}=o,{minu:u,minv:d,maxu:p,maxv:m,boundingBox:h,vertexAttributes:g}=i,v=t.tile,{surface:y,ellipsoid:b,extent:x,extentInRadians:S,horizontalScale:C}=v,w=y.view?.viewingMode===`local`,T=b.radius,E=0,D=0,O=0,k=w?(()=>{let t=c,n=t!=null&&(x[3]>t[3]||x[2]>t[2]||x[1]<t[1]||x[0]<t[0]),r=te(y.isWebMercatorOnPlateCarree,T,C);return(i,a,o)=>{let s=i===0?x[0]:x[2],c=a===0?x[1]:x[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;E=l*C,D=r(u),O=d}})():(e,t,n)=>{let r=S[t===0?1:3],i=S[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=T+n;E=c*a*l,D=s*a*l,O=o*l},A=0,j=0,M=0,N=0,F=0,I=0,L=0,R=0,z=0,B=w&&y.isWebMercatorOnPlateCarree,ee=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(w){let e=t*C,i=B?(Math.PI/2-2*Math.atan(Math.exp(-n/T)))*T:n*C,c=r;a=e-E,o=i-D,s=c-O}else{let i=P(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),p=u[0]*(1-d)+u[2]*d,m=i(f),h=Math.cos(m),g=Math.sin(m),_=Math.sin(p),v=Math.cos(p),y=T+r,b=v*h*y,x=_*h*y,S=g*y;a=b-E,o=x-D,s=S-O}switch(i){case 0:L+=a,R+=o,z+=s;break;case 1:N-=a,F-=o,I-=s;break;case 2:L-=a,R-=o,z-=s;break;case 3:N+=a,F+=o,I+=s}},V=c??he,H=x[0],U=x[2],W=x[1],G=x[3],K=[G>V[3],U>V[2],W<V[1],H<V[0]],q=Math.max(H,V[0]),ne=Math.min(U,V[2]),re=Math.max(W,V[1]),J=Math.min(G,V[3]),Y=e=>Math.max(V[0],Math.min(V[2],e)),X=e=>Math.max(V[1],Math.min(V[3],e)),Z=e=>{let t=o.cornerNeighborCornerTiles;A=0,j=0,M=1,N=0,F=0,I=0,L=0,R=0,z=0;let n=1/0;for(let r=0;r<4;++r){let i=t[e*4+r];n=Math.min(n,i?.level??1/0)}for(let r=0;r<4;++r){let i=t[e*4+r];ge[r]=i?.level===n?i:null}let r=1,i=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}let s=i,c=r;f(c>1);let l=s/c;for(let e=0;e<4;++e){let t=ge[(e+3)%4],n=ge[e%4];if(!t&&!n)continue;let r=e===0?1:e===1?2:e===2?3:0,i=e===0?2:e===1?3:e===2?0:1;if(t&&n){let o=se[e][0]*l,s=se[e][1]*l,c=t.extent,u=Y(c[r===0||r===1?2:0]+o),d=X(c[r===0||r===3?3:1]+s),f=n.extent,p=Y(f[i===0||i===1?2:0]+o),m=X(f[i===0||i===3?3:1]+s),h=t.renderData,g=n.renderData,_=a(u,d,h.geometryState.samplerData),v=a(p,m,g.geometryState.samplerData);ee(h,u,d,.5*(_+v),e)}else{let o=t??n,s=t?r:i,c=o.extent,u=se[e],d=Y(c[s===0||s===1?2:0]+u[0]*l),f=X(c[s===0||s===3?3:1]+u[1]*l),p=o.renderData,m=a(d,f,p.geometryState.samplerData);ee(p,d,f,m,e)}}if(!w){let e=Math.sqrt(E*E+D*D+O*O);A=E/e,j=D/e,M=O/e}if(w||M*M<.999){let e=Math.sqrt(N*N+F*F+I*I);N/=e,F/=e,I/=e;let t=Math.sqrt(L*L+R*R+z*z);L/=t,R/=t,z/=t,A=I*R-F*z,j=N*z-I*L,M=F*L-N*R;let n=1/Math.sqrt(A*A+j*j+M*M);A*=n,j*=n,M*=n}},Q=o.cornerNeighborCornerTiles;for(let t=0;t<4;++t){if(!(r&1<<t))continue;let c=t,y=(t+1)%4,b=+(t===0||t===1),x=+(t===0||t===3),S=e(b,u,p),C=e(x,d,m),w=i.getEdgeFirstVertexIndex(c),T=i.getEdgeCount(c),N=t===0||t===3?T-1:0,P=i.getEdgeFirstVertexIndex(y),F=i.getEdgeCount(y),I=t===0||t===1?F-1:0,L=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+L];n&&(L===-1||_(r,n)>0)&&(L=e)}let R=L,z=Q[t*4+R];if(z!==v){let e=v.level-z.level,r=2**e,i=[z.lij[0]+e,z.lij[1]*r,z.lij[2]*r],a=[i[1]+r===v.lij[1],t===0&&(R===1||R===0&&z!==Q[t*4+3])||t===1&&(R===0||R===1&&z!==Q[t*4+2]),i[1]===v.lij[1]+1,t===2&&(R===3||R===2&&z!==Q[t*4+1])||t===3&&(R===2||R===3&&z!==Q[t*4+0])],c=a.reduce((e,t)=>e+ +!!t,0);f(c===1||c===2);let l=-1,u=-1,d=z.renderData;if(c===1){let e=a.findIndex(e=>e);f(0<=e&&e<=3),l=(e+2)%4;let n=o.edgeResolutions[e];u=v.getNeighborEdgeStartVertexIndex(e,z)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{f(a[1]||a[3]),l=a[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let p=d.geometry;{let e=w+N,t=P+I,r=p.getEdgeFirstVertexIndex(l)+u,i=p.vertexAttributes,a=d.localOrigin,o=i.position,c=o.typedBuffer,f=r*o.typedBufferStride,m=c[f]+a[0]-s[0],_=c[f+1]+a[1]-s[1],v=c[f+2]+a[2]-s[2];be(m,_,v,h);let y=g.position,b=y.typedBuffer,x=e*y.typedBufferStride;b[x]=m,b[x+1]=_,b[x+2]=v;let T=t*y.typedBufferStride;b[T]=m,b[T+1]=_,b[T+2]=v;let E=g.uv0;E.setValues(e,Math.round(S*n),Math.round(C*n)),E.setValues(t,Math.round(S*n),Math.round(C*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=g.normalCompressed,s=o.typedBuffer;{let t=e*o.typedBufferStride;s[t]=n[a],s[t+1]=n[a+1]}{let e=t*o.typedBufferStride;s[e]=n[a],s[e+1]=n[a+1]}}}}else{let n=K[c],r=K[y],o;if(n||r){let t=e(H*(1-b)+U*b,q,ne),n=e(W*(1-x)+G*x,re,J);o=a(t,n,l)}else o=ie(Q,t);k(b,x,o),Z(t);let u=E-s[0],d=D-s[1],f=O-s[2];be(u,d,f,h),i.setEdgeVertexFromValuesRawPositionUVNormal(c,N,u,d,f,S,C,A,j,M),i.setEdgeVertexFromValuesRawPositionUVNormal(y,I,u,d,f,S,C,A,j,M)}}for(let e=0;e<4;++e)ge[e]=null}function ie(e,t){let n=t*4,r=c.reduce((t,r)=>Math.min(t,e[n+r]?.level??1/0),1/0);p&&(f(!e[n+0]||!e[n+2]||g(e[n+0],e[n+2],5)),f(!e[n+1]||!e[n+3]||g(e[n+1],e[n+3],7)));let i=0,o=0;for(let t=0;t<4;++t){let s=e[n+t];if(s?.level===r){let e=t===0||t===1,n=t===0||t===3,r=s.extent,c=r[e?0:2],l=r[n?1:3],u=s.renderData?.geometryState?.samplerData,d=a(c,l,u);o+=d,i++}}let s=i?o/i:0;return f(s!=null),s}function Q(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride,c=(n.getEdgeFirstVertexIndex(3)+n.getEdgeCount(3))*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,c)}function ae(e){let{vao:t,geometry:n}=e,{indices:r,indexCount:i,edgeIndicesStartIndex:a}=n;t.indexBuffer.setSubData(r,a,a,i)}class oe{constructor(e,t,n,r,i){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=r,this.latitudeResolution=i}}const se=[[0,1],[1,0],[0,-1],[-1,0]],$=new s,ce=.5*d,le=new Uint16Array(u+1),ue=new Int32Array(u+1),de=new Int32Array(u+1),fe=new Int32Array(u+1),pe=new Float64Array(u+1),me=new Float64Array(u+1),he=i(-1/0,-1/0,1/0,1/0),ge=[null,null,null,null];function _e(e,t,n){if(!t)return!1;let r=_(e,t);return r>0||r===0&&n>=2}class ve{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return f(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ye=[new ve,new ve,new ve,new ve];function be(e,t,n,r){e<r[0]?r[0]=e:e>r[3]&&(r[3]=e),t<r[1]?r[1]=t:t>r[4]&&(r[4]=t),n<r[2]?r[2]=n:n>r[5]&&(r[5]=n)}function xe(e){let{edgeResolutions:t,numVerticesPerSide:n}=e,r=1+Math.max(...t);return Math.max(n,r)}function Se(e,t,n,r,i,a){let o=e*i,s=a[o],c=a[o+1],l=a[o+2],u=t*i,d=a[u],f=a[u+1],p=a[u+2],m=n*i,h=a[m],g=a[m+1],_=a[m+2],v=r*i,y=a[v],b=a[v+1],x=a[v+2],S=(s-h)*(s-h)+(c-g)*(c-g)+(l-_)*(l-_);return(d-y)*(d-y)+(f-b)*(f-b)+(p-x)*(p-x)>S}function Ce(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=r,e[t+3]=i,e[t+4]=i,e[t+5]=n}const we=15,Te=15,Ee=6;export{F as createPlanarGlobePatch,y as createSphericalGlobePatch,L as updateEdgeElevationsAndResolutionsPlanar,D as updateEdgeElevationsAndResolutionsSpherical,R as updateEdgesAndCornersPlanar,E as updateEdgesAndCornersSpherical};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{destroyMaybe as e}from"../../../core/maybe.js";class t{constructor(e){this._getFadeDuration=e,this._fadeStart=0,this._delayedTime=0}clear(){this._current=e(this._current),this._next=e(this._next),this._waiting=e(this._waiting),this._delayed=e(this._delayed)}get current(){if(this._current==null)return null;if(!this._isFadingEnabled){let e=null;this._delayed?(e=this._delayed,this._delayed=null):this._waiting?(e=this._waiting,this._waiting=null):this._next&&=(e=this._next,null),e&&(this.clear(),this._current=e)}let n=t.test.fadeMoment;if(this._delayed&&(n||=performance.now(),n>=this._delayedTime&&(this._push(this._delayed,0),this._delayed=null)),this._next){n||=performance.now();let t=this._fadeDuration,r=this._current!=null&&this._next.texture===this._current.texture,i=this._next.update!==0,a=n-this._fadeStart>=t;(r||i||a)&&(e(this._current),this._current=this._next,this._next=this._waiting,this._waiting=null,this._fadeStart=this._alignFadeStart(n))}return this._current}get next(){return this._next}get fadeFactor(){if(this._next==null)return 1;let e=t.test.fadeMoment||performance.now(),n=Math.max(0,e-this._fadeStart),r=this._fadeDuration;return n>r?0:1-n/r}get isFading(){return this._next!=null||this._delayed!=null}push(t,n=0){this._delayed=e(this._delayed),this._push(t,n)}_push(n,r){if(this._isFadingEnabled||this.clear(),this._current==null){this._current=n;return}let i=this._waiting??this._next??this._current;if(n?.equals(i)){n.destroy();return}let a=t.test.fadeMoment||performance.now();r===0?this._next==null?(this._next=n,this._fadeStart=this._alignFadeStart(a)):n!=null&&(e(this._waiting),this._waiting=n):(this._delayed=n,this._delayedTime=a+r)}get _fadeDuration(){let e=this._getFadeDuration();return this._waiting?e*.5:e}_alignFadeStart(e){let t=this._getFadeDuration();return e+t-e%t}get _isFadingEnabled(){return this._getFadeDuration()>0}static{this.test={fadeMoment:0}}}export{t as TextureFader};
2
+ import{destroyMaybe as e}from"../../../core/maybe.js";class t{constructor(e){this._getFadeDuration=e,this._fadeStart=0,this._delayedTime=0}clear(){this._current=e(this._current),this._next=e(this._next),this._waiting=e(this._waiting),this._delayed=e(this._delayed)}get current(){if(this._current==null)return null;if(!this.isFading)return this._current;if(!this._isFadingEnabled){let e=null;this._delayed?(e=this._delayed,this._delayed=null):this._waiting?(e=this._waiting,this._waiting=null):this._next&&=(e=this._next,null),e&&(this.clear(),this._current=e)}let n=t.test.fadeMoment;if(this._delayed&&(n||=performance.now(),n>=this._delayedTime&&(this._push(this._delayed,0),this._delayed=null)),this._next){n||=performance.now();let t=this._fadeDuration,r=this._current!=null&&this._next.texture===this._current.texture,i=this._next.update!==0,a=n-this._fadeStart>=t;(r||i||a)&&(e(this._current),this._current=this._next,this._next=this._waiting,this._waiting=null,this._fadeStart=this._alignFadeStart(n))}return this._current}get next(){return this._next}get fadeFactor(){if(this._next==null)return 1;let e=t.test.fadeMoment||performance.now(),n=Math.max(0,e-this._fadeStart),r=this._fadeDuration;return n>r?0:1-n/r}get isFading(){return this._next!=null||this._delayed!=null}push(t,n=0){this._delayed=e(this._delayed),this._push(t,n)}_push(n,r){if(this._isFadingEnabled||this.clear(),this._current==null){this._current=n;return}let i=this._waiting??this._next??this._current;if(n?.equals(i)){n.destroy();return}let a=t.test.fadeMoment||performance.now();r===0?this._next==null?(this._next=n,this._fadeStart=this._alignFadeStart(a)):n!=null&&(e(this._waiting),this._waiting=n):(this._delayed=n,this._delayedTime=a+r)}get _fadeDuration(){let e=this._getFadeDuration();return this._waiting?e*.5:e}_alignFadeStart(e){let t=this._getFadeDuration();return e+t-e%t}get _isFadingEnabled(){return this._getFadeDuration()>0}static{this.test={fadeMoment:0}}}export{t as TextureFader};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{removeUnordered as n}from"../../../core/arrayUtils.js";import{toConst as r}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{isPromiseLike as a}from"../../../core/promiseUtils.js";import{signal as o}from"../../../core/signal.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{isIntersectionHandler as l}from"../state/helpers/SceneIntersectionHelper.js";import{debugFlags as u}from"../support/debugFlags.js";import{TextureCollection as d}from"../support/TextureCollection.js";import{ChangeSet as f}from"./lib/ChangeSet.js";import{Model as p}from"./parts/Model.js";import{RenderView as m}from"./parts/RenderView.js";import{TaskPriority as h,noBudget as g}from"../../support/Scheduler.js";import{Yield as _}from"../../support/Yield.js";let v=class extends t{constructor(e){super(e),this._model=new p,this._canCompact=o(!1),this._layers=[],this._asyncChangeSet=new f,this._syncChangeSet=new f,this._layerSyncSet=new Set,this._textures=new d(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(h.STAGE,this),this.addHandles(this._frameTask)}initialize(){try{this._renderView=new m({view:this.view},this)}catch(e){console.error(`Failed to initialize render view`,e);return}}destroy(){this.removeAllHandles(),this._textures.destroy(),this._set(`textures`,null),this._renderView=i(this._renderView),this._set(`renderView`,null),this._layers.length=0,this._model=null,this._set(`renderer`,null),this.options.canvas=null,this._set(`options`,null)}get viewingMode(){return this.view.state.viewingMode}get updating(){if(this.destroyed||this.destroying)return!1;let e=this.readyToRun||this.renderView.updating||this._frameTask.updating||this.textures.updating;return e&&u.UPDATING&&console.log(` Stage:`,this.readyToRun,this.renderView.updating,this._frameTask.updating,this.textures.updating),e}get localOriginFactory(){return this._model.localOriginFactory}get renderView(){return this._renderView}get renderer(){return this.renderView?.renderer}get textures(){return this._textures}addTexture(e){this._model.addTexture(e),this.renderView.requestRender()}removeTexture(e){e!=null&&!this.destroyed&&this._model.hasTexture(e)&&(this._model.removeTexture(e),this.renderView.requestRender())}addTextures(e){e!=null&&(this._model.addTextures(e),this.renderView.requestRender())}removeTextures(e){e!=null&&(this._model?.removeTextures(e),this.renderView.requestRender())}forEachTexture(e){this._model.forEachTexture(e)}getTexture(e){return this._model.getTexture(e)}addLayer(e){this._layers.includes(e)||(this._model.addLayer(e),this._layers.push(e),this._model.dirtySet.layerAdded(e),this.renderView.requestRender())}removeLayer(e){e!=null&&!this.destroyed&&this._model.hasLayer(r(e))&&(this._model.dirtySet.layerRemoved(e),this.commitLayer(e),n(this._layers,e),this._model.dirtySet.assertLayerClean(e.id),this._model.removeLayer(e),this.renderView.requestRender())}getLayer(e){return this._model.getLayer(e)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get readyToRun(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return _}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){let t=this._model.dirtySet;!this._asyncChangeSet.empty&&!e.done&&(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(n=>{if(e.done)return;let r=this._layerSyncSet.has(n.id)||n.updatePolicy===1,i=r?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(n.id,i),this._layerSyncSet.delete(n.id),i.empty||(this.renderer.commit(i,r?g:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(n=>{e.done||!this._layerSyncSet.has(n.id)&&n.updatePolicy===0&&(t.commitLayer(n.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange(`readyToRun`)}commitSyncLayers(){let e=this._model.dirtySet;this._layers.forEach(t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===1?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)});for(let t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender())}commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}scheduleGenerator(e,t){return this._frameTask.scheduleGenerator(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}get layers(){return this._layers}addRenderPlugin(e,t){let n=this.renderer.plugins.add(e,t),r=()=>{l(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(a(n))return n.then(r);r()}removeRenderPlugin(e){this.destroyed||(l(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get test(){}};e([s({constructOnly:!0})],v.prototype,`view`,void 0),e([s({constructOnly:!0})],v.prototype,`options`,void 0),e([s({constructOnly:!0})],v.prototype,`container`,void 0),e([s()],v.prototype,`viewingMode`,null),e([s()],v.prototype,`updating`,null),e([s()],v.prototype,`renderView`,null),e([s()],v.prototype,`renderer`,null),e([s()],v.prototype,`textures`,null),e([s()],v.prototype,`readyToRun`,null),v=e([c(`esri.views.3d.webgl-engine.Stage`)],v);export{v as Stage};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{removeUnordered as n}from"../../../core/arrayUtils.js";import{toConst as r}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{isPromiseLike as a}from"../../../core/promiseUtils.js";import{signal as o}from"../../../core/signal.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{isIntersectionHandler as l}from"../state/helpers/SceneIntersectionHelper.js";import{debugFlags as u}from"../support/debugFlags.js";import{TextureCollection as d}from"../support/TextureCollection.js";import{ChangeSet as f}from"./lib/ChangeSet.js";import{Model as p}from"./parts/Model.js";import{RenderView as m}from"./parts/RenderView.js";import{TaskPriority as h,noBudget as g}from"../../support/Scheduler.js";import{Yield as _}from"../../support/Yield.js";let v=class extends t{constructor(e){super(e),this._model=new p,this._canCompact=o(!1),this._layers=[],this._asyncChangeSet=new f,this._syncChangeSet=new f,this._layerSyncSet=new Set,this._textures=new d(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(h.STAGE,this),this.addHandles(this._frameTask)}initialize(){this._renderView=new m({view:this.view},this)}destroy(){this.removeAllHandles(),this._textures.destroy(),this._set(`textures`,null),this._renderView=i(this._renderView),this._set(`renderView`,null),this._layers.length=0,this._model=null,this._set(`renderer`,null),this.options.context=null,this._set(`options`,null)}get viewingMode(){return this.view.state.viewingMode}get updating(){if(this.destroyed||this.destroying)return!1;let e=this.readyToRun||this.renderView.updating||this._frameTask.updating||this.textures.updating;return e&&u.UPDATING&&console.log(` Stage:`,this.readyToRun,this.renderView.updating,this._frameTask.updating,this.textures.updating),e}get localOriginFactory(){return this._model.localOriginFactory}get renderView(){return this._renderView}get renderer(){return this.renderView?.renderer}get textures(){return this._textures}addTexture(e){this._model.addTexture(e),this.renderView.requestRender()}removeTexture(e){e!=null&&!this.destroyed&&this._model.hasTexture(e)&&(this._model.removeTexture(e),this.renderView.requestRender())}addTextures(e){e!=null&&(this._model.addTextures(e),this.renderView.requestRender())}removeTextures(e){e!=null&&(this._model?.removeTextures(e),this.renderView.requestRender())}forEachTexture(e){this._model.forEachTexture(e)}getTexture(e){return this._model.getTexture(e)}addLayer(e){this._layers.includes(e)||(this._model.addLayer(e),this._layers.push(e),this._model.dirtySet.layerAdded(e),this.renderView.requestRender())}removeLayer(e){e!=null&&!this.destroyed&&this._model.hasLayer(r(e))&&(this._model.dirtySet.layerRemoved(e),this.commitLayer(e),n(this._layers,e),this._model.dirtySet.assertLayerClean(e.id),this._model.removeLayer(e),this.renderView.requestRender())}getLayer(e){return this._model.getLayer(e)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get readyToRun(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return _}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){let t=this._model.dirtySet;!this._asyncChangeSet.empty&&!e.done&&(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(n=>{if(e.done)return;let r=this._layerSyncSet.has(n.id)||n.updatePolicy===1,i=r?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(n.id,i),this._layerSyncSet.delete(n.id),i.empty||(this.renderer.commit(i,r?g:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(n=>{e.done||!this._layerSyncSet.has(n.id)&&n.updatePolicy===0&&(t.commitLayer(n.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange(`readyToRun`)}commitSyncLayers(){let e=this._model.dirtySet;this._layers.forEach(t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===1?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)});for(let t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender())}commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,g),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}scheduleGenerator(e,t){return this._frameTask.scheduleGenerator(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}get layers(){return this._layers}addRenderPlugin(e,t){let n=this.renderer.plugins.add(e,t),r=()=>{l(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(a(n))return n.then(r);r()}removeRenderPlugin(e){this.destroyed||(l(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get test(){}};e([s({constructOnly:!0})],v.prototype,`view`,void 0),e([s({constructOnly:!0})],v.prototype,`options`,void 0),e([s({constructOnly:!0})],v.prototype,`container`,void 0),e([s()],v.prototype,`viewingMode`,null),e([s()],v.prototype,`updating`,null),e([s()],v.prototype,`renderView`,null),e([s()],v.prototype,`renderer`,null),e([s()],v.prototype,`textures`,null),e([s()],v.prototype,`readyToRun`,null),v=e([c(`esri.views.3d.webgl-engine.Stage`)],v);export{v as Stage};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import e from"../../../core/Error.js";function t(t,n){t??=document.createElement(`canvas`);let r=t.getContext(`webgl2`,{alpha:n.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:n.stencil??!0,powerPreference:`high-performance`,preserveDrawingBuffer:n.preserveDrawingBuffer??!1});if(r==null)throw new e(`webgl:context-creation-failed`,`A WebGL2 context could not be created.`);if(r.isContextLost())throw new e(`webgl-context-lost`,`WebGL context lost during context creation`);return{canvas:t,gl:r}}export{t as createWebGLContext};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{integerArrayElementBytes as e}from"../../../../core/memoryEstimations.js";import{add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as n}from"../../../../geometry/support/Indices.js";import{NullSphere as r,Sphere as i}from"../../../../geometry/support/sphere.js";import{affectsGeometry as a}from"./affectsGeometry.js";import{BoundingInfo as o}from"./BoundingInfo.js";import{BufferGeometryBaseInstance as s}from"./BufferGeometryBaseInstance.js";import{Object3DHighlightStateID as c}from"./Object3DStateID.js";import{assert as l}from"./Util.js";class u extends s{constructor(e,t,n,r=null,i=null){super(t),this.material=e,this.localOrigin=n,this.mapPositions=r,this.baseGeometry=i,this.layerViewUid=null,this.graphicUid=null,this.castShadow=!1,this._readPrimitivePosition=null,this._boundingInfo=null,this._boundingSphere=null,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0;let a=e?.useIndexing??!1,o=t.index!=null,s=i!=null;l(!s||!a&&i.buffers.index==null&&!o,`Instancing for index materials is not supported`),l(!s||t.vertex.count===1,`Instanced BufferGeometry requires exactly one instance`),l(a===o,`Material index requirement and BufferGeometry.buffers.index must match`)}instantiate(e){return new u(e,this._buffers,this.localOrigin,this.mapPositions,this.baseGeometry)}get usedMemoryExcludingBuffers(){return this._boundingInfo?.usedMemory??0}computeBufferMemory(t){return t.arrayMemory(this._buffers.index,e,!0)+t.arrayMemory(this._buffers.storage?.texelElementBuffer)+t.arrayMemory(this.mapPositions)+t.bufferMemory(this._buffers.vertex.buffer)}get indexCount(){return this.baseGeometry?.buffers.indexCount??this._buffers.indexCount??0}get faceCount(){return this.indexCount/3}get readPrimitivePosition(){return this._readPrimitivePosition??=this.material.createPrimitivePositionReader(this.buffers,this.baseGeometry?.buffers),this._readPrimitivePosition}get boundingInfo(){return this._boundingInfo||(this._boundingInfo=this._calculateBoundingInfo(),this._boundingInfo&&this.notifyMemoryChange?.(this._boundingInfo.usedMemory)),this._boundingInfo}get boundingSphere(){let e=this.boundingInfo?.sphere;if(e==null)return r;if(this._boundingSphere==null){let n=new i;n.copyFrom(e),t(n.center,n.center,this.localOrigin.vec3),this._boundingSphere=n}return this._boundingSphere}_calculateBoundingInfo(){let e=this.indexCount;if(e===0)return null;let t=this.material.primitiveVertexCount;l(e%t===0,`Indexing error: `+e+` not divisible by `+t);let r=n(e/t);return new o(r,t,this.readPrimitivePosition,e=>this.notifyMemoryChange?.(e))}invalidateBoundingInfo(){let e=this._boundingInfo?.usedMemory??0;this._boundingInfo=null,this._boundingSphere=null,e&&this.notifyMemoryChange?.(-e)}getMutableVertexField(e,t){let n=this._buffers.vertex.getField(e,t);return n!=null&&a(e)&&this._invalidatePositionCaches(),n}getMutableStorageField(e,t){let n=this._buffers.storage?.getField(e,t);return n!=null&&a(e)&&this._invalidatePositionCaches(),n}_invalidatePositionCaches(){this._readPrimitivePosition=null,this.invalidateBoundingInfo()}computeAttachmentOrigin(e){return this.material.computeAttachmentOrigin(e,this.readPrimitivePosition,this.indexCount)?(t(e,e,this.localOrigin.vec3),!0):!1}get highlights(){return this._highlights||d}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(e){this._highlightOptionsCounts?.forEach((t,n)=>e(n))}allocateIdAndHighlight(e){let t=new c(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);let{highlightName:t}=e,n=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,n),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){let{highlightName:t}=e,n=this._highlightOptionsCounts?.get(t)??0;n<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,n-1)}}}const d=new Set;export{u as BufferGeometry};
2
+ import{integerArrayElementBytes as e}from"../../../../core/memoryEstimations.js";import{add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as n}from"../../../../geometry/support/Indices.js";import{NullSphere as r,Sphere as i}from"../../../../geometry/support/sphere.js";import{affectsGeometry as a}from"./affectsGeometry.js";import{BoundingInfo as o}from"./BoundingInfo.js";import{BufferGeometryBaseInstance as s}from"./BufferGeometryBaseInstance.js";import{Object3DHighlightStateID as c}from"./Object3DStateID.js";import{assert as l}from"./Util.js";class u extends s{constructor(e,t,n,r=null,i=null){super(t),this.material=e,this.localOrigin=n,this.mapPositions=r,this.baseGeometry=i,this.layerViewUid=null,this.graphicUid=null,this.castShadow=!1,this._readPrimitivePosition=null,this._boundingInfo=null,this._boundingSphere=null,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0;let a=e?.useIndexing??!1,o=t.index!=null,s=i!=null;l(!s||!a&&i.buffers.index==null&&!o,`Instancing for index materials is not supported`),l(!s||t.vertex.count===1,`Instanced BufferGeometry requires exactly one instance`),l(a===o,`Material index requirement and BufferGeometry.buffers.index must match`)}instantiate(e){return new u(e,this._buffers,this.localOrigin,this.mapPositions,this.baseGeometry)}get usedMemoryExcludingBuffers(){return this._boundingInfo?.usedMemory??0}computeBufferMemory(t){return t.arrayMemory(this._buffers.index,e,!0)+t.arrayMemory(this._buffers.storage?.texelElementBuffer)+t.arrayMemory(this.mapPositions)+t.bufferMemory(this._buffers.vertex.buffer)}get indexCount(){return this.baseGeometry?.buffers.indexCount??this._buffers.indexCount??0}get faceCount(){return this.indexCount/3}get readPrimitivePosition(){return this._readPrimitivePosition??=this.material.createPrimitivePositionReader(this.buffers,this.baseGeometry?.buffers),this._readPrimitivePosition}get boundingInfo(){return this._boundingInfo||(this._boundingInfo=this._calculateBoundingInfo(),this._boundingInfo&&this.notifyMemoryChange?.(this._boundingInfo.usedMemory)),this._boundingInfo}get boundingSphere(){let e=this.boundingInfo?.sphere;if(e==null)return r;if(this._boundingSphere==null){let n=new i;n.copyFrom(e),t(n.center,n.center,this.localOrigin.vec3),this._boundingSphere=n}return this._boundingSphere}_calculateBoundingInfo(){let e=this.indexCount;if(e===0)return null;let t=this.material.primitiveVertexCount;l(e%t===0,`Indexing error: `+e+` not divisible by `+t);let r=n(e/t);return new o(r,t,this.readPrimitivePosition,e=>this.notifyMemoryChange?.(e))}invalidateBoundingInfo(){let e=this._boundingInfo?.usedMemory??0;this._boundingInfo=null,this._boundingSphere=null,e&&this.notifyMemoryChange?.(-e)}getMutableBuffers(){return this._invalidatePositionCaches(),this._buffers}getMutableVertexField(e,t){let n=this._buffers.vertex.getField(e,t);return n!=null&&a(e)&&this._invalidatePositionCaches(),n}getMutableStorageField(e,t){let n=this._buffers.storage?.getField(e,t);return n!=null&&a(e)&&this._invalidatePositionCaches(),n}_invalidatePositionCaches(){this._readPrimitivePosition=null,this.invalidateBoundingInfo()}computeAttachmentOrigin(e){return this.material.computeAttachmentOrigin(e,this.readPrimitivePosition,this.indexCount)?(t(e,e,this.localOrigin.vec3),!0):!1}get highlights(){return this._highlights||d}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(e){this._highlightOptionsCounts?.forEach((t,n)=>e(n))}allocateIdAndHighlight(e){let t=new c(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);let{highlightName:t}=e,n=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,n),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){let{highlightName:t}=e,n=this._highlightOptionsCounts?.get(t)??0;n<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,n-1)}}}const d=new Set;export{u as BufferGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,set as s,positiveInfinity as c,equals as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as u}from"../../webgl.js";import{addWraparound as d}from"../../layers/i3s/I3SUtil.js";import f from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as p,requiresPreciseColorDepth as m,prepareGaussianSplatPerspectiveParameters as h}from"./GaussianSplatRenderUtils.js";import{G as g}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as _}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as v}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as y}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as b}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatPassParameters as x}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechnique as S}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as C}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as T,PrimitiveType as E}from"../../../webgl/enums.js";let D=class extends f{constructor(e){super(e),this.consumes={required:[u.GAUSSIAN_SPLAT]},this.produces=u.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new x,this._compositionPassParameters=new g,this._depthCompositionPassParameters=new y,this._compositionConfiguration=new v,this._clipBox=o(),this._previousSortRequestCameraDirection=a(),this._cameraSortDirty=!1,this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._configuration=new C(e.view.state.isGlobal),s(this._clipBox,c)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>this.view.state.mode===2,e=>{e&&this._cameraSortDirty&&this._requestCameraSort(this.view.state.camera.ray.direction),this.requestRender(1)})])}precompile(){this._canRender&&(this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(S,this._configuration),this.techniques.precompile(_,this._compositionConfiguration),this.techniques.precompile(b))}render(){let e=this.input;if(this._updateConfigurations(),this._fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;let t=e.getAttachment(w);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=t!=null;let{fullWidth:n,fullHeight:r}=this.bindParameters.camera;this._prepareParameters();let i=this.renderingContext,a=this.fboCache,o=a.acquire(n,r,`gaussian color output`),s=e.getAttachment(T);o.attachDepth(s);let c=this.techniques.get(S,this._configuration);this._renderGaussianColorAndDepth(o,c);let l=a.acquire(n,r,this.produces);this._depthCompositionPassParameters.splatDepth=o.getTexture(w),l.attachDepth(e.getAttachment(T)),i.bindFramebuffer(l.fbo);let u=this.techniques.get(b);i.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),i.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=o.getTexture(),t?(l.acquireColor(w,8,`emissive`),this._compositionPassParameters.emission=e.getTexture(w)):this._compositionPassParameters.emission=null,i.bindFramebuffer(l.fbo);let d=this.techniques.get(_,this._compositionConfiguration);return i.bindTechnique(d,this.bindParameters,this._compositionPassParameters),i.screen.draw(),o.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){let t=e||c;this._hasSameClipBox(t)||(s(this._clipBox,t),this._tileCullingRevision=d(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!l(this._clipBox,c,(e,t)=>e===t)}get _isIdle(){return this.view.state.mode===2}get _data(){return this.layerView.data}get _canRender(){return p(this._data)}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.fragmentShading=this._configuration.receiveShadows&&this.view.stage.renderer.isFeatureEnabled(12),this._configuration.preciseDepth=m(this.bindParameters),this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&this.bindParameters.slicePlane!=null}_onCameraChange(){this._tileCullingRevision=d(this._tileCullingRevision,1);let e=this.view.state.camera.ray.direction;this._cameraSortDirty=!0,(this._isIdle||this._shouldRequestSort(e))&&this._requestCameraSort(e)}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_requestCameraSort(e){this._data.requestSort(),i(this._previousSortRequestCameraDirection,e),this._cameraSortDirty=!1}_prepareParameters(){h(this._passParameters,this.layerView,this.bindParameters.camera)}_hasSameClipBox(e){return l(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){let n=this.renderingContext;e.acquireColor(w,5,`gaussian depth output`),n.bindFramebuffer(e.fbo),n.setClearColor(0,0,0,0),n.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}};e([n()],D.prototype,`consumes`,void 0),e([n()],D.prototype,`produces`,void 0),e([n({constructOnly:!0})],D.prototype,`layerView`,void 0),D=e([r(`esri.views.3d.webgl-engine.lib.GaussianSplatRenderer`)],D);export{D as GaussianSplatRenderer};
2
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,set as s,positiveInfinity as c,equals as l}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as u}from"../../webgl.js";import{addWraparound as d}from"../../layers/i3s/I3SUtil.js";import f from"../../webgl/RenderNode.js";import{canRenderGaussianSplats as p,requiresPreciseColorDepth as m,prepareGaussianSplatPerspectiveParameters as h}from"./GaussianSplatRenderUtils.js";import{G as g}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as _}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as v}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as y}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as b}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatPassParameters as x}from"../shaders/GaussianSplatPassParameters.js";import{GaussianSplatTechnique as S}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as C}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as T,PrimitiveType as E}from"../../../webgl/enums.js";let D=class extends f{constructor(e){super(e),this.consumes={required:[u.GAUSSIAN_SPLAT]},this.produces=u.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new x,this._compositionPassParameters=new g,this._depthCompositionPassParameters=new y,this._compositionConfiguration=new v,this._clipBox=o(),this._previousSortRequestCameraDirection=a(),this._cameraSortDirty=!1,this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._configuration=new C(e.view.state.isGlobal),s(this._clipBox,c)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>this.view.state.mode===2,e=>{e&&this._cameraSortDirty&&this._requestCameraSort(this.view.state.camera.ray.direction),this.requestRender(1)})])}precompile(){this._canRender&&(this._updateConfigurations(),this.techniques.precompile(S,this._configuration),this.techniques.precompile(_,this._compositionConfiguration),this.techniques.precompile(b))}render(){let e=this.input;if(this._fadeHelper.updateForFrame(this.view.stage.renderView.renderer.renderContext.time),!this._canRender)return e;let t=e.getAttachment(w);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=t!=null;let{fullWidth:n,fullHeight:r}=this.bindParameters.camera;this._prepareParameters();let i=this.renderingContext,a=this.fboCache,o=a.acquire(n,r,`gaussian color output`),s=e.getAttachment(T);o.attachDepth(s);let c=this.techniques.get(S,this._configuration);this._renderGaussianColorAndDepth(o,c);let l=a.acquire(n,r,this.produces);this._depthCompositionPassParameters.splatDepth=o.getTexture(w),l.attachDepth(e.getAttachment(T)),i.bindFramebuffer(l.fbo);let u=this.techniques.get(b);i.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),i.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=o.getTexture(),t?(l.acquireColor(w,8,`emissive`),this._compositionPassParameters.emission=e.getTexture(w)):this._compositionPassParameters.emission=null,i.bindFramebuffer(l.fbo);let d=this.techniques.get(_,this._compositionConfiguration);return i.bindTechnique(d,this.bindParameters,this._compositionPassParameters),i.screen.draw(),o.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){let t=e||c;this._hasSameClipBox(t)||(s(this._clipBox,t),this._tileCullingRevision=d(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!l(this._clipBox,c,(e,t)=>e===t)}get _isIdle(){return this.view.state.mode===2}get _data(){return this.layerView.data}get _canRender(){return p(this._data)}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.fragmentShading=this._configuration.receiveShadows&&this.view.stage.renderer.isFeatureEnabled(12),this._configuration.preciseDepth=m(this.bindParameters),this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&this.bindParameters.slicePlane!=null,this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission}_onCameraChange(){this._tileCullingRevision=d(this._tileCullingRevision,1);let e=this.view.state.camera.ray.direction;this._cameraSortDirty=!0,(this._isIdle||this._shouldRequestSort(e))&&this._requestCameraSort(e)}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_requestCameraSort(e){this._data.requestSort(),i(this._previousSortRequestCameraDirection,e),this._cameraSortDirty=!1}_prepareParameters(){h(this._passParameters,this.layerView,this.bindParameters.camera)}_hasSameClipBox(e){return l(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){let n=this.renderingContext;e.acquireColor(w,5,`gaussian depth output`),n.bindFramebuffer(e.fbo),n.setClearColor(0,0,0,0),n.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}};e([n()],D.prototype,`consumes`,void 0),e([n()],D.prototype,`produces`,void 0),e([n({constructOnly:!0})],D.prototype,`layerView`,void 0),D=e([r(`esri.views.3d.webgl-engine.lib.GaussianSplatRenderer`)],D);export{D as GaussianSplatRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{VisualVariablesParameters as e}from"../../layers/support/FastSymbolUpdates.js";import{isColor as t}from"../core/shaderLibrary/ShaderOutput.js";import{computeAttachmentOriginLines as n}from"./geometryDataUtils.js";import{Material as r}from"./Material.js";import{hasShadowHighlights as i}from"../shaders/ReceiveShadowsConfiguration.js";class a extends e{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.shadingEnabled=!1,this.isDecoration=!1,this.worldSized=!1}}class o extends r{constructor(){super(...arguments),this.primitiveVertexCount=1}updateConfiguration(e){super.updateConfiguration(e),this._configuration.pbrMode=this.parameters.shadingEnabled?2:0,this._configuration.draped=e.slot===18,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.worldSized=this.parameters.worldSized,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===8,t(e.output)&&this.parameters.shadingEnabled?(this._configuration.receiveShadows=e.shadowMap.enabled,this._configuration.hasShadowHighlights=i(this._configuration,e),this._configuration.receiveAmbientOcclusion=e.ssao!=null,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1}computeAttachmentOrigin(e,t,r){return n(e,t,r,this._isClosed(r))}_isClosed(e){return(this.parameters.isClosed??!1)&&e>2}}export{o as LineMaterial,a as LineMaterialParameters};
2
+ import{VisualVariablesParameters as e}from"../../layers/support/FastSymbolUpdates.js";import{computeAttachmentOriginLines as t}from"./geometryDataUtils.js";import{Material as n}from"./Material.js";import{configureShadedMaterial as r}from"../shaders/ShadedMaterialConfiguration.js";class i extends e{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.shadingEnabled=!1,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.isDecoration=!1,this.worldSized=!1}}class a extends n{constructor(){super(...arguments),this.primitiveVertexCount=1}updateConfiguration(e){super.updateConfiguration(e),this._configuration.pbrMode=this.parameters.shadingEnabled?2:0,this._configuration.draped=e.slot===18,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.worldSized=this.parameters.worldSized,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===8,r(this._configuration,e,this.parameters)}computeAttachmentOrigin(e,n,r){return t(e,n,r,this._isClosed(r))}_isClosed(e){return(this.parameters.isClosed??!1)&&e>2}}export{a as LineMaterial,i as LineMaterialParameters};