@arcgis/core 5.2.0-next.75 → 5.2.0-next.77

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 (295) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/013c9cc198736a72f7f2.js +1 -0
  4. package/assets/esri/core/workers/chunks/0194244a3f437ad74045.js +1 -0
  5. package/assets/esri/core/workers/chunks/040a73b2a23577e1eabd.js +1 -0
  6. package/assets/esri/core/workers/chunks/{0d3b2d9a19383bb63f0a.js → 05663093b1d2a268b953.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{ad1d06a91121ebfe9162.js → 06c8547521ce9c97b258.js} +2 -2
  8. package/assets/esri/core/workers/chunks/{4dcd4a052b40047a9230.js → 08cac27df6c216ae1995.js} +1 -1
  9. package/assets/esri/core/workers/chunks/08ec5461af74356e7570.js +1 -0
  10. package/assets/esri/core/workers/chunks/0909816f13d25cacf250.js +1 -0
  11. package/assets/esri/core/workers/chunks/0933203eee15ea50e123.js +1 -0
  12. package/assets/esri/core/workers/chunks/{5e1d84e97de0e662aaa9.js → 1142f8e9c80207d6bdae.js} +1 -1
  13. package/assets/esri/core/workers/chunks/16929524565a677db4dc.js +1 -0
  14. package/assets/esri/core/workers/chunks/16a04fc184728d66e6e1.js +1 -0
  15. package/assets/esri/core/workers/chunks/177c3b23c1cbd4737049.js +1 -0
  16. package/assets/esri/core/workers/chunks/{d03e7be74c57c3dbf003.js → 17e9324a02b69733307a.js} +2 -2
  17. package/assets/esri/core/workers/chunks/1a467da4c0b33f655199.js +1 -0
  18. package/assets/esri/core/workers/chunks/1ef28d4457c8c943ad19.js +1 -0
  19. package/assets/esri/core/workers/chunks/{2b93888e61ca638490cf.js → 20b54e7872d967f3be32.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{5f31b375971ab067121e.js → 21f763694a41968ac21a.js} +1 -1
  21. package/assets/esri/core/workers/chunks/230925079cee040a8d77.js +1 -0
  22. package/assets/esri/core/workers/chunks/257f1e8316877f611e11.js +1 -0
  23. package/assets/esri/core/workers/chunks/270ed3070d118edb3f37.js +1 -0
  24. package/assets/esri/core/workers/chunks/29a20a37e7837142fa6b.js +2 -0
  25. package/assets/esri/core/workers/chunks/2e7c830b5b1fe406169f.js +1 -0
  26. package/assets/esri/core/workers/chunks/315031323e11a18154e3.js +1 -0
  27. package/assets/esri/core/workers/chunks/385b23d4bd5275031fb6.js +1 -0
  28. package/assets/esri/core/workers/chunks/393f79843d5a78c1cc37.js +1 -0
  29. package/assets/esri/core/workers/chunks/3958d92c737b3a2a3bc2.js +1 -0
  30. package/assets/esri/core/workers/chunks/3b5c5356353f1a2303a0.js +1 -0
  31. package/assets/esri/core/workers/chunks/{6743d726e45e7b660505.js → 4115bab15c19b4f5ae08.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{99e3aa4832ed87474ab4.js → 44857a76be2c0ac65bb9.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{4491dc227c28e2ab4f8e.js → 484b251fbcbffcb58323.js} +1 -1
  34. package/assets/esri/core/workers/chunks/48e2d0bfb62e1f4f2ad9.js +1 -0
  35. package/assets/esri/core/workers/chunks/{7f2f2a92dce3f68e579b.js → 4b54444c04fbd6f42c18.js} +1 -1
  36. package/assets/esri/core/workers/chunks/4c82f5f23004f905a18f.js +1 -0
  37. package/assets/esri/core/workers/chunks/53eed0941a39b56cc034.js +1 -0
  38. package/assets/esri/core/workers/chunks/56e6d8c4a9ed893ce951.js +1 -0
  39. package/assets/esri/core/workers/chunks/57159bcac86d660dcceb.js +1 -0
  40. package/assets/esri/core/workers/chunks/{36ec5b84e551ab08b24a.js → 57e26a86d46e02c89c4f.js} +1 -1
  41. package/assets/esri/core/workers/chunks/58026fc30d8a0ded4102.js +1 -0
  42. package/assets/esri/core/workers/chunks/59598023c0aea62a6297.js +1 -0
  43. package/assets/esri/core/workers/chunks/5bf2ce280ea35ea4c96b.js +1 -0
  44. package/assets/esri/core/workers/chunks/5fd2aa0be03dfb494efa.js +1 -0
  45. package/assets/esri/core/workers/chunks/619aa1381296172ff47b.js +1 -0
  46. package/assets/esri/core/workers/chunks/62f37d1075390a177ae9.js +1 -0
  47. package/assets/esri/core/workers/chunks/65d1e338612e59063eba.js +1 -0
  48. package/assets/esri/core/workers/chunks/680dd7b7638465eb33de.js +1 -0
  49. package/assets/esri/core/workers/chunks/{b14961a9f1f40028f141.js → 6c982779d6d47ec99899.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{a52c88e2d837b525ff6c.js → 71ee7c51d2c60a180f1e.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{6b783f440c4a5d36e879.js → 75fc0b1db8e2e3fd2458.js} +1 -1
  52. package/assets/esri/core/workers/chunks/79429c8be5da85713200.js +1 -0
  53. package/assets/esri/core/workers/chunks/7b470d6ad182548b9e95.js +1 -0
  54. package/assets/esri/core/workers/chunks/7d8eb4dbea1916320f74.js +1 -0
  55. package/assets/esri/core/workers/chunks/{67f54586156d1ab80257.js → 81cd0cb9ae1371765d32.js} +1 -1
  56. package/assets/esri/core/workers/chunks/83556c9f6f85c2a46779.js +1 -0
  57. package/assets/esri/core/workers/chunks/{d1c7c877edc6948f3801.js → 8762da315cf5086167c3.js} +1 -1
  58. package/assets/esri/core/workers/chunks/87eaed6fdabd482d142e.js +1 -0
  59. package/assets/esri/core/workers/chunks/88d5541679e77117bf03.js +1 -0
  60. package/assets/esri/core/workers/chunks/894ebc64b698e5d7604b.js +1 -0
  61. package/assets/esri/core/workers/chunks/{4046bd65d7d0677f4600.js → 8d9a7fa14489897780d3.js} +1 -1
  62. package/assets/esri/core/workers/chunks/8e225dd0319672103561.js +1 -0
  63. package/assets/esri/core/workers/chunks/9199300ffd225a1bbef1.js +1 -0
  64. package/assets/esri/core/workers/chunks/{3e2b4e734aa20a308f3e.js → 95956d62591d689f1135.js} +1 -1
  65. package/assets/esri/core/workers/chunks/98613fded899c59f34a4.js +1 -0
  66. package/assets/esri/core/workers/chunks/9e1392a0c608a13ab036.js +1 -0
  67. package/assets/esri/core/workers/chunks/{53d165b4f30fd64e5d8a.js → a4e4fa4dd1a122bbf7cd.js} +1 -1
  68. package/assets/esri/core/workers/chunks/a5240c8a47842138f31f.js +1 -0
  69. package/assets/esri/core/workers/chunks/a69c10bfd632a5546b34.js +1 -0
  70. package/assets/esri/core/workers/chunks/a7727a2377470d586ff9.js +1 -0
  71. package/assets/esri/core/workers/chunks/{7a24cc0f3b4eff2bdb8e.js → ac2ba5c3d613d7d5183a.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{6cd6d0cfd313f0475d98.js → ac59218847e5ef4c4160.js} +1 -1
  73. package/assets/esri/core/workers/chunks/ac87be2210f868524996.js +1 -0
  74. package/assets/esri/core/workers/chunks/aed16c3e26652960ad3f.js +1 -0
  75. package/assets/esri/core/workers/chunks/{43713bc6f7eea07259d0.js → b084829a3fd709dc47a8.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{05f6887805d92da03122.js → b24fc7eeda580ef020d2.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{5ba3a30b7cbfa9e3aa62.js → b2812279662f1a5f8d06.js} +1 -1
  78. package/assets/esri/core/workers/chunks/b37a20c5c4a4686257d4.js +1 -0
  79. package/assets/esri/core/workers/chunks/{43a65cab888d43954564.js → b4abf82b8ac974a55ae1.js} +1 -1
  80. package/assets/esri/core/workers/chunks/b82763e9401b16121f8d.js +2 -0
  81. package/assets/esri/core/workers/chunks/bab5f4b2424b487b87ac.js +1 -0
  82. package/assets/esri/core/workers/chunks/bbc6b270d2032189107c.js +1 -0
  83. package/assets/esri/core/workers/chunks/bc6e488f5fbd50f9f3d0.js +1 -0
  84. package/assets/esri/core/workers/chunks/bd7d87d175ba933ab2ce.js +1 -0
  85. package/assets/esri/core/workers/chunks/{1c49c9472167a2e0c923.js → c17dda6fadb8bfad0d51.js} +1 -1
  86. package/assets/esri/core/workers/chunks/c1e5ffe9a251be5a0744.js +1 -0
  87. package/assets/esri/core/workers/chunks/c69cf08da4e4c2c824ee.js +1717 -0
  88. package/assets/esri/core/workers/chunks/ca6652c6304ad0e37e8f.js +1 -0
  89. package/assets/esri/core/workers/chunks/cd74de12005834244a47.js +1 -0
  90. package/assets/esri/core/workers/chunks/{762be5d3e6aeaea33f74.js → cef02ed3942c010da2e8.js} +1 -1
  91. package/assets/esri/core/workers/chunks/d520d407043bc52e5410.js +1 -0
  92. package/assets/esri/core/workers/chunks/da0ef984509057ec8507.js +1 -0
  93. package/assets/esri/core/workers/chunks/dff932682d6386a861ce.js +1 -0
  94. package/assets/esri/core/workers/chunks/{2c31648a4b95275516ee.js → e227eb44cd139fe2bc1b.js} +1 -1
  95. package/assets/esri/core/workers/chunks/e4e5a171a4874c5af4a4.js +1 -0
  96. package/assets/esri/core/workers/chunks/{ddb92c815d17c67a45e6.js → e5d114f2b57d2b8e2f1c.js} +1 -1
  97. package/assets/esri/core/workers/chunks/e89e6eea380ca2c13b64.js +1 -0
  98. package/assets/esri/core/workers/chunks/e9d352d030dcad1619a6.js +1 -0
  99. package/assets/esri/core/workers/chunks/{3de6e54b6ed0feae1940.js → eae51e827f629ab37207.js} +1 -1
  100. package/assets/esri/core/workers/chunks/eee1fd629619021ea279.js +1 -0
  101. package/assets/esri/core/workers/chunks/{b6cd165d0e58598f28a5.js → ef47a5da641cb0d33fdf.js} +1 -1
  102. package/assets/esri/core/workers/chunks/{0eb35e09765fd74eb698.js → ef803fb25741e9f2a0a1.js} +1 -1
  103. package/assets/esri/core/workers/chunks/f35e749bb5be39880cbe.js +1 -0
  104. package/assets/esri/core/workers/chunks/f3bbebedad51f776bb98.js +1 -0
  105. package/assets/esri/core/workers/chunks/{3dff36f6de181d9dcdc5.js → f40e4433e7608d0962a6.js} +1 -1
  106. package/assets/esri/core/workers/chunks/f703bc002c732d1c045d.js +1 -0
  107. package/assets/esri/core/workers/chunks/fdd4f78facec6387cdb0.js +1 -0
  108. package/assets/esri/core/workers/chunks/ffd5285c7b2c83208f87.js +2 -0
  109. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  110. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  111. package/assets/esri/libs/text/pkg/bundle_bg.wasm +0 -0
  112. package/chunks/HeatmapDensity.glsl.js +5 -5
  113. package/chunks/bundle2.js +1 -1
  114. package/chunks/lyr3DMain.js +1 -1
  115. package/chunks/lyr3DWorker.js +1 -1
  116. package/config.js +1 -1
  117. package/geometry/geometryEngine.js +1 -1
  118. package/geometry/support/centroid.js +1 -1
  119. package/geometry/support/extentUtils.js +1 -1
  120. package/geometry/support/frustum.js +1 -1
  121. package/geometry/support/webMercatorUtils.d.ts +38 -14
  122. package/kernel.js +1 -1
  123. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  124. package/layers/VectorTileLayer.d.ts +40 -22
  125. package/layers/graphics/data/QueryEngineResult.js +1 -1
  126. package/layers/graphics/data/projectionSupport.js +1 -1
  127. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  128. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  129. package/layers/support/RasterJobHandler.js +1 -1
  130. package/layers/video/VideoController.js +1 -1
  131. package/package.json +4 -4
  132. package/support/revision.js +1 -1
  133. package/symbols/cim/animationUtils.js +1 -1
  134. package/symbols/cim/cimAnalyzer.js +1 -1
  135. package/symbols/cim/effects/EffectCircularSector.js +1 -1
  136. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  137. package/views/2d/engine/webgl/animations/infos.js +1 -1
  138. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  140. package/views/3d/GroundView3D.js +1 -1
  141. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  142. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  143. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  144. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  145. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  146. package/views/3d/layers/MediaLayerView3D.js +1 -1
  147. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  148. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  149. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  150. package/views/3d/state/HUDOccludedFragmentOpacity.js +1 -1
  151. package/views/3d/state/ViewState.js +1 -1
  152. package/views/3d/state/ViewStateManager.js +1 -1
  153. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  154. package/views/3d/support/GaussianSplatWorkerHandle.js +1 -1
  155. package/views/3d/support/flow/geometryUtils.js +1 -1
  156. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  157. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  158. package/views/3d/support/renderInfoUtils/line.js +1 -1
  159. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  160. package/views/3d/terrain/DrapedZ.js +2 -0
  161. package/views/3d/terrain/OverlayManager.js +1 -1
  162. package/views/3d/terrain/OverlayRenderer.js +1 -1
  163. package/views/3d/terrain/PatchRenderDataWaterproofness.js +1 -1
  164. package/views/3d/terrain/TerrainRenderer.js +1 -1
  165. package/views/3d/terrain/TerrainSurface.js +1 -1
  166. package/views/3d/terrain/TerrainWaterproofnessDiagnostics.js +2 -0
  167. package/views/3d/webgl/RenderCamera.js +1 -1
  168. package/views/3d/webgl/RenderNode.js +1 -1
  169. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +2 -2
  170. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +2 -2
  171. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  172. package/views/3d/webgl-engine/lib/PositionReader.js +1 -1
  173. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  174. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  175. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  176. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  177. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  178. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  179. package/views/3d/webgl-engine/parts/Model.js +1 -1
  180. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
  181. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  182. package/views/support/waitForResources.js +1 -1
  183. package/views/webgl/RenderingContext.js +1 -1
  184. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +20 -6
  185. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  186. package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.d.ts +100 -0
  187. package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.js +2 -0
  188. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  189. package/widgets/BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js +1 -1
  190. package/widgets/BatchAttributeForm.js +1 -1
  191. package/widgets/Feature/FeatureViewModel.d.ts +4 -3
  192. package/widgets/Feature/FeatureViewModel.js +1 -1
  193. package/widgets/Feature.js +1 -1
  194. package/widgets/Features/FeaturesViewModel.d.ts +4 -2
  195. package/widgets/Features/FeaturesViewModel.js +1 -1
  196. package/widgets/Features.js +1 -1
  197. package/widgets/OrientedImageryViewer.js +1 -1
  198. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  199. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  200. package/widgets/Popup/PopupViewModel.d.ts +1 -0
  201. package/widgets/Popup/PopupViewModel.js +1 -1
  202. package/widgets/Popup.js +1 -1
  203. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  204. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  205. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  206. package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
  207. package/assets/esri/core/workers/chunks/02dd79beb13eff6be85e.js +0 -1
  208. package/assets/esri/core/workers/chunks/0502641d9a214b37ff29.js +0 -1
  209. package/assets/esri/core/workers/chunks/0823961e5d0bdedbf8cf.js +0 -2
  210. package/assets/esri/core/workers/chunks/0aedeb837399d3f92e4a.js +0 -1
  211. package/assets/esri/core/workers/chunks/0bf644f93c180a2bc2f8.js +0 -705
  212. package/assets/esri/core/workers/chunks/0daaa89de339e8ea4b81.js +0 -1
  213. package/assets/esri/core/workers/chunks/1119a33245138e7b3914.js +0 -1
  214. package/assets/esri/core/workers/chunks/12234a63d3fa4bc25e7e.js +0 -1
  215. package/assets/esri/core/workers/chunks/186bedc377cc97731ca2.js +0 -2
  216. package/assets/esri/core/workers/chunks/1cf8fb704c48ac3d3b15.js +0 -1
  217. package/assets/esri/core/workers/chunks/2435ef7d11f8dbb920b7.js +0 -256
  218. package/assets/esri/core/workers/chunks/2791f3fe16ca5ee2f39a.js +0 -1
  219. package/assets/esri/core/workers/chunks/27f574acf52f2c8bc2c9.js +0 -1
  220. package/assets/esri/core/workers/chunks/2d45daacec0d5ed38782.js +0 -1
  221. package/assets/esri/core/workers/chunks/2ea3ca68cfa4d34e8f3b.js +0 -1
  222. package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +0 -1
  223. package/assets/esri/core/workers/chunks/3235e14fedb19dd94807.js +0 -1
  224. package/assets/esri/core/workers/chunks/32f5112c848efec6c33b.js +0 -1
  225. package/assets/esri/core/workers/chunks/3bc2943035391b44d4cf.js +0 -29
  226. package/assets/esri/core/workers/chunks/3c32471785bc8570e41c.js +0 -1
  227. package/assets/esri/core/workers/chunks/4295822fa6ef743c76f1.js +0 -1
  228. package/assets/esri/core/workers/chunks/42d5ed44111bea77ec71.js +0 -1462
  229. package/assets/esri/core/workers/chunks/46873badbd6ce8ff4e1e.js +0 -1
  230. package/assets/esri/core/workers/chunks/4710f21b138a2c9a0345.js +0 -1
  231. package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +0 -1
  232. package/assets/esri/core/workers/chunks/4c2794687aea172775a0.js +0 -1
  233. package/assets/esri/core/workers/chunks/4d9bde9f66817a92ceca.js +0 -1
  234. package/assets/esri/core/workers/chunks/4fe2cca405180af23364.js +0 -1
  235. package/assets/esri/core/workers/chunks/519af918050b47f93516.js +0 -1
  236. package/assets/esri/core/workers/chunks/5600fc334d20c4f0c83d.js +0 -1
  237. package/assets/esri/core/workers/chunks/5627f562dea8bae2f346.js +0 -1
  238. package/assets/esri/core/workers/chunks/5bf4ab72b9634b06cc5d.js +0 -1
  239. package/assets/esri/core/workers/chunks/5e3d5347223f0111f40f.js +0 -1
  240. package/assets/esri/core/workers/chunks/6f58cb9dffe8016397a2.js +0 -1
  241. package/assets/esri/core/workers/chunks/6fc3553c52af6ace926d.js +0 -1
  242. package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +0 -1
  243. package/assets/esri/core/workers/chunks/7dc5aedc964eacd1be5a.js +0 -1
  244. package/assets/esri/core/workers/chunks/7f91e45156bbe88f9a62.js +0 -1
  245. package/assets/esri/core/workers/chunks/8302bffd28cc6720e0fe.js +0 -2
  246. package/assets/esri/core/workers/chunks/8a48a6760c33ed50b650.js +0 -1
  247. package/assets/esri/core/workers/chunks/8d21e2dabc5165f1c8ca.js +0 -1
  248. package/assets/esri/core/workers/chunks/903e1cd8b76eff19ebdf.js +0 -1
  249. package/assets/esri/core/workers/chunks/917c11cb40a7742d7f98.js +0 -1
  250. package/assets/esri/core/workers/chunks/91d133c04ca764d74934.js +0 -1
  251. package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +0 -1
  252. package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +0 -1
  253. package/assets/esri/core/workers/chunks/9482a6d7baa24bbf5693.js +0 -1
  254. package/assets/esri/core/workers/chunks/96cec8a02ca96175d602.js +0 -1
  255. package/assets/esri/core/workers/chunks/9902fcd2070c8eb6d043.js +0 -1
  256. package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +0 -1
  257. package/assets/esri/core/workers/chunks/9be6827e5756031a56c1.js +0 -1
  258. package/assets/esri/core/workers/chunks/9cff18e6f751d1b3085e.js +0 -1
  259. package/assets/esri/core/workers/chunks/a101152066dd56259619.js +0 -1
  260. package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +0 -1
  261. package/assets/esri/core/workers/chunks/a3bf8aa81ee398da5b52.js +0 -1
  262. package/assets/esri/core/workers/chunks/a7a7d3289d4ca95f545f.js +0 -1
  263. package/assets/esri/core/workers/chunks/abb6c76d5dba3559a68e.js +0 -1
  264. package/assets/esri/core/workers/chunks/afeeb11b39e140303b5a.js +0 -1
  265. package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +0 -1
  266. package/assets/esri/core/workers/chunks/b78f509fd8e95f728178.js +0 -1
  267. package/assets/esri/core/workers/chunks/b858adff7043683fe41c.js +0 -1
  268. package/assets/esri/core/workers/chunks/be1d2c3a61e6447fbbc7.js +0 -1
  269. package/assets/esri/core/workers/chunks/c02ae1d40c1fe95ae6c5.js +0 -1
  270. package/assets/esri/core/workers/chunks/c1189316d24fb4cdb2a0.js +0 -1
  271. package/assets/esri/core/workers/chunks/c53b2be005721591e29b.js +0 -1
  272. package/assets/esri/core/workers/chunks/c82ab4f0908290e70ee9.js +0 -1
  273. package/assets/esri/core/workers/chunks/cc5ec6e99aa09342c704.js +0 -1
  274. package/assets/esri/core/workers/chunks/cd892c9603710d6130a9.js +0 -1
  275. package/assets/esri/core/workers/chunks/d021775cf747556660a5.js +0 -1
  276. package/assets/esri/core/workers/chunks/d633e98b0dfa0490e4de.js +0 -1
  277. package/assets/esri/core/workers/chunks/d79ce047afbc034f6008.js +0 -1
  278. package/assets/esri/core/workers/chunks/d8eca13c127b443141b7.js +0 -1
  279. package/assets/esri/core/workers/chunks/dbc9249dae41096d750d.js +0 -1
  280. package/assets/esri/core/workers/chunks/eb1a86159dbc098f06fe.js +0 -1
  281. package/assets/esri/core/workers/chunks/ec1841e6e498d54012eb.js +0 -1
  282. package/assets/esri/core/workers/chunks/ed1de8b7406269e217b9.js +0 -29
  283. package/assets/esri/core/workers/chunks/ee9eb381e675d2d01260.js +0 -1
  284. package/assets/esri/core/workers/chunks/f2ab8e49c7f17f488aa8.js +0 -1
  285. package/assets/esri/core/workers/chunks/f43a0edf58941e2ac78e.js +0 -1
  286. package/assets/esri/core/workers/chunks/f78acff510ca615d42e4.js +0 -1
  287. package/assets/esri/core/workers/chunks/f7a5c4d22a24e1ac433c.js +0 -1
  288. package/chunks/geometryEngineBase.js +0 -2
  289. package/geometry/geometryAdapters/json.js +0 -2
  290. package/geometry/geometryEngineJSON.js +0 -2
  291. /package/assets/esri/core/workers/chunks/{ad1d06a91121ebfe9162.js.LICENSE.txt → 06c8547521ce9c97b258.js.LICENSE.txt} +0 -0
  292. /package/assets/esri/core/workers/chunks/{d03e7be74c57c3dbf003.js.LICENSE.txt → 17e9324a02b69733307a.js.LICENSE.txt} +0 -0
  293. /package/assets/esri/core/workers/chunks/{0823961e5d0bdedbf8cf.js.LICENSE.txt → 29a20a37e7837142fa6b.js.LICENSE.txt} +0 -0
  294. /package/assets/esri/core/workers/chunks/{8302bffd28cc6720e0fe.js.LICENSE.txt → b82763e9401b16121f8d.js.LICENSE.txt} +0 -0
  295. /package/assets/esri/core/workers/chunks/{186bedc377cc97731ca2.js.LICENSE.txt → ffd5285c7b2c83208f87.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../core/a11yUtils.js";import r from"../../../core/Accessor.js";import{EventEmitter as o}from"../../../core/Evented.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{when as i}from"../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../core/accessorSupport/decorators.js";import{afterDispatch as l}from"../../../core/accessorSupport/watch.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import m from"../../ViewAnimation.js";import{viewingModeFromString as h}from"../../ViewingMode.js";import{applySurfaceCollisionConstraint as d}from"../camera/constraintUtils/surfaceCollision.js";import{Constraints as u}from"./Constraints.js";import{HUDOccludedFragmentOpacity as g}from"./HUDOccludedFragmentOpacity.js";import{AnimationController as y}from"./controllers/AnimationController.js";import C from"../webgl/RenderCamera.js";import{DepthRange as w}from"../webgl-engine/lib/DepthRange.js";import{maximumHighlights as f}from"../../support/HighlightDefaults.js";import{PropertiesPool as v}from"../../support/PropertiesPool.js";let _=class extends r{constructor(e){super(e),this._propertiesPool=new v({camera:()=>new C},this),this._lastSeenCameraProjectionValues=new C,this.mode=0,this._cssCamera=new C,this._camera=new C,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.constraints=new u({state:this}),this.events=new o,this.fading=!1,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}reset(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new v({camera:()=>new C},this)}destroy(){this.cameraController=null,this._propertiesPool=a(this._propertiesPool)}createInitialCamera(){if(1===this.viewingMode){const e=c(this.spatialReference).radius;this.camera=new C({eye:p(4*e,0,0),center:p(e,0,0),up:p(0,0,1)})}else this.camera=new C({eye:p(0,0,100),center:p(0,0,0),up:p(0,1,0)})}get animation(){return this.cameraController instanceof y&&null!=this.cameraController.viewAnimation?this.cameraController.viewAnimation:null}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:t,width:r,pixelRatio:o}=this.camera;return e.pixelRatio=1,e.height=Math.round(t/o),e.width=Math.round(r/o),e}get camera(){return this._camera}set camera(e){e!==x&&x.copyFrom(e),x.computeUp(this.viewingMode),this.events.emit("before-camera-change",{camera:x});const t=this._camera;if(O(this._lastSeenCameraProjectionValues,x)&&(this._lastSeenCameraProjectionValues.copyFrom(x),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!t.equals(x)&&(this._camera=this._propertiesPool.get("camera").copyFrom(x),this._cameraChanged=!t.almostEquals(x),this._cameraChanged)){const e=l(()=>{this._cameraChanged=!1,e.remove()})}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&2===this.mode}get updating(){return 2!==this.mode}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){if(null==e)return void(this._contentCamera=null);const t=e.clone();this.events.emit("before-camera-change",{camera:t,sceneDepthRange:w.Infinite}),this._contentCamera=t}get fixedContentCamera(){return null!=this._contentCamera}get isGlobal(){return 1===this.viewingMode}get isLocal(){return 2===this.viewingMode}get viewingMode(){return h(this.view.viewingMode)}get spatialReference(){return this.view.spatialReference}ensureOccludedFragmentOpacity(){return this.occludedFragmentOpacity??=new g({requestRender:()=>this.view.stage?.renderView.requestRender(2)}),this.occludedFragmentOpacity}get highlights(){const e=this.view.highlights.items.slice(0,f);for(let t=0;t<e.length;){const r=e[t],o=e.findIndex(e=>e.name===r.name);o>=0&&t>o?e.splice(t,1):++t}return e}get highlightOrderMap(){return new Map(this.highlights.map(({name:e},t)=>[e,t]))}get animationsEnabled(){return this.view.animationsEnabled&&!t()}get navigating(){return!!this.cameraController?.isInteractive}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){this.stopActiveCameraController()?(this.removeHandles(P),this.cameraController?.destroy(),e&&(this.addHandles(i(()=>4===e.state||3===e.state,()=>{this.updateCamera(t=>{e.onControllerEnd(t),this.view.stateManager?.setCollisionSourceCamera(t),d(this.view,null,t,1)}),this.cameraController===e&&(this._set("cameraController",null),e.destroy())},{sync:!0,once:!0}),P),e.onControllerStart(this.camera),this.view.stateManager?.setCollisionSourceCamera(this.camera)),this._set("cameraController",e)):e&&(e.state=1)}switchCameraController(e){this.cameraController=e}stopActiveCameraController(){return!this.cameraController||this.cameraController.stopController()}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(0===this._updateQueue.length||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();x.copyFrom(this.camera),e(x),this.camera=x,this._processingUpdates=!1,this._processUpdateQueue()}static cleanupViewstate(){x=new C}};e([n({constructOnly:!0})],_.prototype,"view",void 0),e([n()],_.prototype,"mode",void 0),e([n({readOnly:!0,type:m})],_.prototype,"animation",null),e([n({type:C})],_.prototype,"cssCamera",null),e([n()],_.prototype,"_cssCamera",void 0),e([n({type:C})],_.prototype,"camera",null),e([n()],_.prototype,"_camera",void 0),e([n({readOnly:!0})],_.prototype,"pixelRatio",null),e([n()],_.prototype,"rasterPixelRatio",void 0),e([n()],_.prototype,"contentPixelRatio",void 0),e([n({readOnly:!0})],_.prototype,"alignPixelEnabled",null),e([n({readOnly:!0})],_.prototype,"updating",null),e([n({})],_.prototype,"_contentCamera",void 0),e([n({type:C})],_.prototype,"contentCamera",null),e([n({readOnly:!0})],_.prototype,"fixedContentCamera",null),e([n({readOnly:!0})],_.prototype,"events",void 0),e([n({readOnly:!0})],_.prototype,"isGlobal",null),e([n({readOnly:!0})],_.prototype,"isLocal",null),e([n({readOnly:!0})],_.prototype,"viewingMode",null),e([n()],_.prototype,"occludedFragmentOpacity",void 0),e([n({readOnly:!0})],_.prototype,"highlights",null),e([n({readOnly:!0})],_.prototype,"highlightOrderMap",null),e([n({readOnly:!0})],_.prototype,"navigating",null),e([n()],_.prototype,"fading",void 0),e([n({readOnly:!0})],_.prototype,"stationary",null),e([n()],_.prototype,"_cameraChanged",void 0),e([n()],_.prototype,"cameraController",null),_=e([s("esri.views.3d.state.ViewState")],_);const j=_;function O(e,t){return e.fov!==t.fov||(e.fullViewport[0]!==t.fullViewport[0]||e.fullViewport[1]!==t.fullViewport[1]||e.fullViewport[2]!==t.fullViewport[2]||e.fullViewport[3]!==t.fullViewport[3]||(e.padding[0]!==t.padding[0]||e.padding[1]!==t.padding[1]||e.padding[2]!==t.padding[2]||e.padding[3]!==t.padding[3]))}let x=new C;const P="ViewStateHandles";export{j as default};
2
+ import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../core/a11yUtils.js";import r from"../../../core/Accessor.js";import{EventEmitter as o}from"../../../core/Evented.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{when as i}from"../../../core/reactiveUtils.js";import{property as n,subclass as s}from"../../../core/accessorSupport/decorators.js";import{afterDispatch as l}from"../../../core/accessorSupport/watch.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import m from"../../ViewAnimation.js";import{viewingModeFromString as h}from"../../ViewingMode.js";import{applySurfaceCollisionConstraint as d}from"../camera/constraintUtils/surfaceCollision.js";import{Constraints as u}from"./Constraints.js";import{HUDOccludedFragmentOpacity as g,labelVisibleConfiguration as y,labelAdaptiveConfiguration as C,iconVisibleConfiguration as f,iconAdaptiveConfiguration as w}from"./HUDOccludedFragmentOpacity.js";import{AnimationController as v}from"./controllers/AnimationController.js";import _ from"../webgl/RenderCamera.js";import{DepthRange as j}from"../webgl-engine/lib/DepthRange.js";import{maximumHighlights as O}from"../../support/HighlightDefaults.js";import{PropertiesPool as x}from"../../support/PropertiesPool.js";let P=class extends r{constructor(e){super(e),this._propertiesPool=new x({camera:()=>new _},this),this._lastSeenCameraProjectionValues=new _,this.mode=0,this._cssCamera=new _,this._camera=new _,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.constraints=new u({state:this}),this.events=new o,this.occludedFragmentOpacity=[null,null,null,null],this.fading=!1,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}reset(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new x({camera:()=>new _},this)}destroy(){this.cameraController=null,this._propertiesPool=a(this._propertiesPool)}createInitialCamera(){if(1===this.viewingMode){const e=c(this.spatialReference).radius;this.camera=new _({eye:p(4*e,0,0),center:p(e,0,0),up:p(0,0,1)})}else this.camera=new _({eye:p(0,0,100),center:p(0,0,0),up:p(0,1,0)})}get animation(){return this.cameraController instanceof v&&null!=this.cameraController.viewAnimation?this.cameraController.viewAnimation:null}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:t,width:r,pixelRatio:o}=this.camera;return e.pixelRatio=1,e.height=Math.round(t/o),e.width=Math.round(r/o),e}get camera(){return this._camera}set camera(e){e!==b&&b.copyFrom(e),b.computeUp(this.viewingMode),this.events.emit("before-camera-change",{camera:b});const t=this._camera;if(V(this._lastSeenCameraProjectionValues,b)&&(this._lastSeenCameraProjectionValues.copyFrom(b),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!t.equals(b)&&(this._camera=this._propertiesPool.get("camera").copyFrom(b),this._cameraChanged=!t.almostEquals(b),this._cameraChanged)){const e=l(()=>{this._cameraChanged=!1,e.remove()})}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&2===this.mode}get updating(){return 2!==this.mode}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){if(null==e)return void(this._contentCamera=null);const t=e.clone();this.events.emit("before-camera-change",{camera:t,sceneDepthRange:j.Infinite}),this._contentCamera=t}get fixedContentCamera(){return null!=this._contentCamera}get isGlobal(){return 1===this.viewingMode}get isLocal(){return 2===this.viewingMode}get viewingMode(){return h(this.view.viewingMode)}get spatialReference(){return this.view.spatialReference}ensureOccludedFragmentOpacity(e,t){const r="visible"===t,o=(r?2:0)+(e?1:0),a=e?r?y:C:r?f:w,i=()=>this.view.stage?.renderView.requestRender(2);return this.occludedFragmentOpacity[o]??=new g({configuration:a,requestRender:i}),this.occludedFragmentOpacity[o]}get highlights(){const e=this.view.highlights.items.slice(0,O);for(let t=0;t<e.length;){const r=e[t],o=e.findIndex(e=>e.name===r.name);o>=0&&t>o?e.splice(t,1):++t}return e}get highlightOrderMap(){return new Map(this.highlights.map(({name:e},t)=>[e,t]))}get animationsEnabled(){return this.view.animationsEnabled&&!t()}get navigating(){return!!this.cameraController?.isInteractive}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){this.stopActiveCameraController()?(this.removeHandles(M),this.cameraController?.destroy(),e&&(this.addHandles(i(()=>4===e.state||3===e.state,()=>{this.updateCamera(t=>{e.onControllerEnd(t),this.view.stateManager?.setCollisionSourceCamera(t),d(this.view,null,t,1)}),this.cameraController===e&&(this._set("cameraController",null),e.destroy())},{sync:!0,once:!0}),M),e.onControllerStart(this.camera),this.view.stateManager?.setCollisionSourceCamera(this.camera)),this._set("cameraController",e)):e&&(e.state=1)}switchCameraController(e){this.cameraController=e}stopActiveCameraController(){return!this.cameraController||this.cameraController.stopController()}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(0===this._updateQueue.length||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();b.copyFrom(this.camera),e(b),this.camera=b,this._processingUpdates=!1,this._processUpdateQueue()}static cleanupViewstate(){b=new _}};e([n({constructOnly:!0})],P.prototype,"view",void 0),e([n()],P.prototype,"mode",void 0),e([n({readOnly:!0,type:m})],P.prototype,"animation",null),e([n({type:_})],P.prototype,"cssCamera",null),e([n()],P.prototype,"_cssCamera",void 0),e([n({type:_})],P.prototype,"camera",null),e([n()],P.prototype,"_camera",void 0),e([n({readOnly:!0})],P.prototype,"pixelRatio",null),e([n()],P.prototype,"rasterPixelRatio",void 0),e([n()],P.prototype,"contentPixelRatio",void 0),e([n({readOnly:!0})],P.prototype,"alignPixelEnabled",null),e([n({readOnly:!0})],P.prototype,"updating",null),e([n({})],P.prototype,"_contentCamera",void 0),e([n({type:_})],P.prototype,"contentCamera",null),e([n({readOnly:!0})],P.prototype,"fixedContentCamera",null),e([n({readOnly:!0})],P.prototype,"events",void 0),e([n({readOnly:!0})],P.prototype,"isGlobal",null),e([n({readOnly:!0})],P.prototype,"isLocal",null),e([n({readOnly:!0})],P.prototype,"viewingMode",null),e([n()],P.prototype,"occludedFragmentOpacity",void 0),e([n({readOnly:!0})],P.prototype,"highlights",null),e([n({readOnly:!0})],P.prototype,"highlightOrderMap",null),e([n({readOnly:!0})],P.prototype,"navigating",null),e([n()],P.prototype,"fading",void 0),e([n({readOnly:!0})],P.prototype,"stationary",null),e([n()],P.prototype,"_cameraChanged",void 0),e([n()],P.prototype,"cameraController",null),P=e([s("esri.views.3d.state.ViewState")],P);const R=P;function V(e,t){return e.fov!==t.fov||(e.fullViewport[0]!==t.fullViewport[0]||e.fullViewport[1]!==t.fullViewport[1]||e.fullViewport[2]!==t.fullViewport[2]||e.fullViewport[3]!==t.fullViewport[3]||(e.padding[0]!==t.padding[0]||e.padding[1]!==t.padding[1]||e.padding[2]!==t.padding[2]||e.padding[3]!==t.padding[3]))}let b=new _;const M="ViewStateHandles";export{R as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../core/scheduling.js";import{createScreenPoint as p}from"../../../core/screenUtils.js";import{Milliseconds as m}from"../../../core/time.js";import{property as d,subclass as v}from"../../../core/accessorSupport/decorators.js";import{runUntracked as u}from"../../../core/accessorSupport/tracking.js";import{squaredDistance as w}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as _}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import C from"../../../geometry/Point.js";import x from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as R,requiresLoad as S}from"../../../geometry/projectionUtils.js";import{fromRenderCamera as P,toRenderCamera as O}from"../webgl.js";import{applyAll as b}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as T,surfaceElevationBelowRenderLocation as j}from"../camera/intersectionUtils.js";import{ConstraintsManager as z}from"./ConstraintsManager.js";import{Frustum as M}from"./Frustum.js";import{GoToOperation as I}from"./GoToOperation.js";import{toArea as H,toExtent as V,applyTiltAdjustToScale as B,scaleToZoom as L,fromExtentSync as D,getObserverForPointAtDistanceSync as E,viewScaleToCameraDistance as U,zoomToScale as k}from"../support/cameraUtils.js";import{fromCamera as A,toCameraSync as F}from"../support/viewpointUtils.js";import N from"../webgl/RenderCamera.js";import{PropertiesPool as G}from"../../support/PropertiesPool.js";import{ensureAttachmentMaxSize as q}from"../../webgl/FramebufferObject.js";let W=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ie,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,getDevicePixelRatioOverride:()=>this._devicePixelRatioOverride,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ie:0}},this._propertiesPool=new G({frustum:()=>new M(null)},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new Z}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n(()=>this.view.state.events,"before-camera-change",({camera:e})=>e&&this._updateElevation(e)),o(()=>this.view.state?.camera,(e,t)=>this._cameraChangedHandler(e,t),h)]),l(()=>this.view.state?.camera,e=>this._updateElevation(e),{once:!0,sync:!0}),this.addHandles([c({prepare:e=>this._prepareFrame(e.time)}),o(()=>this.view.state.cameraController,()=>{this._cameraSetByUser=!0,this.removeHandles(ee)}),n(()=>this.view.state.events,"camera-projection-changed",()=>this.notifyChange("scale"))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const{view:t}=this,i=t.state.camera;return u(()=>{const r=P(t,i,X);return r&&e&&r.equals(e)?e:r.clone()})}set camera(e){if(this._updatePropertyBeforeReady("camera",e))return;this.view.elevationProvider.enableCache(!0);const t=O(this.view,e);t?this.setStateCamera(t,{applyConstraints:!1})||a.getLogger(this).warnOnce("#camera=","There is a currently active camera controller that has priority."):a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider.enableCache(!1)}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const{view:t}=this,i=t.state.contentCamera;return u(()=>{const r=P(t,i,X);return r&&e&&r.equals(e)?e:r.clone()})}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=O(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(te),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=g(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o(()=>this.contentCamera,()=>{e.sticky||(this.removeHandles(te),this.test.contentCameraResetState.clear())}),o(()=>this.zoom,e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))}),o(()=>this.view.state.camera,e=>{const t=w(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)})],te),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?x.fromExtent(e):null}return H(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=V(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?B(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[0]/i),s=Math.round(t[1]/i),n=Math.round(t[2]/i),o=Math.round(t[3]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,$),this.view.state.updateCamera(e=>e.padding=$))}_paddingToArray(e,t,i){e?_(i,e.top||0,e.right||0,e.bottom||0,e.left||0):_(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return p((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?A(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e){if(!this.isCompatible(e)){const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;return void a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?L(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._useDevicePixelResolution()?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&q(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._useDevicePixelResolution(2)?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}_useDevicePixelResolution(e){return this.view?.stage?.renderer.isFeatureEnabled(8,e)??!1}preinit(e){return!(this._isOverridden("center")&&!R(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!R(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!R(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||R(this.viewpoint.targetGeometry?.spatialReference,e)&&R(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new z({view:this.view}),this._prepareFrame(m(0));const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):2===this.view.state.viewingMode&&this.addHandles(l(()=>this.view.groundView.ready,()=>{this.removeHandles(ee),this._setInitialView(this.view.dataExtent)},{once:!0,initial:!0}),ee)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ee),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:this.view.state.animationsEnabled,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new I(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(T(this.view),{applyConstraints:!1})}step(e){const t=this.view.state?.cameraController;t?.stepController&&this.view.state.updateCamera(i=>t.stepController(e,i))}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of K){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach(t=>e.add(t))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(O(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=D(this.view,e.targetGeometry,0,.5,0);return void(null!=t&&this.setStateCamera(O(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=D(this.view,e,0,.5,0);null!=r&&this.setStateCamera(O(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&J.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!S(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Q){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=Y){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=E(this.view,r,a,e,t,1);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=D(this.view,e,t,i,1,X);return r?O(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=U(t,e,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(k(this.view,e))}_viewpointToCamera(e){return O(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera(i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&b(this.view,i),this.setCollisionSourceCamera(i)}),!0)}setCollisionSourceCamera(e){this._constraintsManager?.surfaceCollisionConstraint.setSourceCamera(e)}_prepareFrame(e){const{surface:t,canvas:i,stage:r}=this.view;if(!t||!i||!r||r.destroyed||r.destroying)return;this._windowDevicePixelRatio=window.devicePixelRatio;const a=this._computeCanvasSize();if(0!==a.width&&0!==a.height&&(i.width===a.width&&i.height===a.height||(i.width=a.width,i.height=a.height),this.view.state)){const t=this.view.state.camera;t.fullWidth===a.width&&t.fullHeight===a.height&&t.pixelRatio===a.pixelRatio||(Y.copyFrom(t),Y.pixelRatio!==a.pixelRatio&&(this._paddingToArray(this.padding,a.pixelRatio,$),Y.padding=$),Y.fullWidth=a.width,Y.fullHeight=a.height,Y.pixelRatio=a.pixelRatio,this.view.state.camera=Y),this._updateState(),this.view.state.occludedFragmentOpacity?.update(this.view,this.view.state.mode,e)}}_updateElevation(e){const t=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,i=this.view.groundView?.spatialReference,r=i?j(this.view,e.eye):0;e.relativeElevation=t-r}_updateState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=0:this.view.interacting?this.view.state.mode=1:(0===this.view.state.mode&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=1:this.view.state.mode=2),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateState())}};e([d({type:t})],W.prototype,"camera",null),e([d({type:t})],W.prototype,"contentCamera",null),e([d({type:C})],W.prototype,"center",null),e([d()],W.prototype,"visibleArea",null),e([d({type:y})],W.prototype,"extent",null),e([d({readOnly:!0})],W.prototype,"frustum",null),e([d()],W.prototype,"_constraintsManager",void 0),e([d({readOnly:!0})],W.prototype,"constraintsManager",null),e([d()],W.prototype,"_initialViewpoint",null),e([d({readOnly:!0})],W.prototype,"hasInitialView",null),e([d({readOnly:!0,type:Boolean})],W.prototype,"ready",void 0),e([d({type:Number})],W.prototype,"scale",null),e([d()],W.prototype,"padding",null),e([d({readOnly:!0})],W.prototype,"screenCenter",null),e([d({constructOnly:!0})],W.prototype,"view",void 0),e([d({type:i})],W.prototype,"viewpoint",null),e([d({type:Number})],W.prototype,"zoom",null),e([d({readOnly:!0})],W.prototype,"_rasterPixelRatio",null),e([d({readOnly:!0})],W.prototype,"_useDevicePixelResolution",null),e([d()],W.prototype,"_windowDevicePixelRatio",void 0),e([d()],W.prototype,"_devicePixelRatioOverride",void 0),W=e([v("esri.views.3d.state.ViewStateManager")],W);class Z{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const J=new Set(["camera","viewpoint","extent","scale","center","zoom"]),K=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],Q={heading:0,tilt:0};let X=new t,Y=new N;const $=f(),ee="pending-initial-view",te="content-camera-reset",ie=300,re=100;function ae(){X=new t,Y=new N}export{W as ViewStateManager,ae as cleanupViewStateManager,re as interactingTimeout};
2
+ import{__decorate as e}from"tslib";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../core/scheduling.js";import{createScreenPoint as p}from"../../../core/screenUtils.js";import{Milliseconds as m}from"../../../core/time.js";import{property as d,subclass as v}from"../../../core/accessorSupport/decorators.js";import{runUntracked as u}from"../../../core/accessorSupport/tracking.js";import{squaredDistance as w}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as _}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import C from"../../../geometry/Point.js";import x from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as R,requiresLoad as S}from"../../../geometry/projectionUtils.js";import{fromRenderCamera as P,toRenderCamera as O}from"../webgl.js";import{applyAll as b}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as T,surfaceElevationBelowRenderLocation as j}from"../camera/intersectionUtils.js";import{ConstraintsManager as z}from"./ConstraintsManager.js";import{Frustum as M}from"./Frustum.js";import{GoToOperation as I}from"./GoToOperation.js";import{toArea as H,toExtent as V,applyTiltAdjustToScale as B,scaleToZoom as L,fromExtentSync as D,getObserverForPointAtDistanceSync as E,viewScaleToCameraDistance as U,zoomToScale as k}from"../support/cameraUtils.js";import{fromCamera as A,toCameraSync as F}from"../support/viewpointUtils.js";import N from"../webgl/RenderCamera.js";import{PropertiesPool as G}from"../../support/PropertiesPool.js";import{ensureAttachmentMaxSize as q}from"../../webgl/FramebufferObject.js";let W=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ie,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,getDevicePixelRatioOverride:()=>this._devicePixelRatioOverride,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ie:0}},this._propertiesPool=new G({frustum:()=>new M(null)},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new Z}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n(()=>this.view.state.events,"before-camera-change",({camera:e})=>e&&this._updateElevation(e)),o(()=>this.view.state?.camera,(e,t)=>this._cameraChangedHandler(e,t),h)]),l(()=>this.view.state?.camera,e=>this._updateElevation(e),{once:!0,sync:!0}),this.addHandles([c({prepare:e=>this._prepareFrame(e.time)}),o(()=>this.view.state.cameraController,()=>{this._cameraSetByUser=!0,this.removeHandles(ee)}),n(()=>this.view.state.events,"camera-projection-changed",()=>this.notifyChange("scale"))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const{view:t}=this,i=t.state.camera;return u(()=>{const r=P(t,i,X);return r&&e&&r.equals(e)?e:r.clone()})}set camera(e){if(this._updatePropertyBeforeReady("camera",e))return;this.view.elevationProvider.enableCache(!0);const t=O(this.view,e);t?this.setStateCamera(t,{applyConstraints:!1})||a.getLogger(this).warnOnce("#camera=","There is a currently active camera controller that has priority."):a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider.enableCache(!1)}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const{view:t}=this,i=t.state.contentCamera;return u(()=>{const r=P(t,i,X);return r&&e&&r.equals(e)?e:r.clone()})}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=O(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(te),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=g(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o(()=>this.contentCamera,()=>{e.sticky||(this.removeHandles(te),this.test.contentCameraResetState.clear())}),o(()=>this.zoom,e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))}),o(()=>this.view.state.camera,e=>{const t=w(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)})],te),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?x.fromExtent(e):null}return H(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=V(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?B(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[0]/i),s=Math.round(t[1]/i),n=Math.round(t[2]/i),o=Math.round(t[3]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,$),this.view.state.updateCamera(e=>e.padding=$))}_paddingToArray(e,t,i){e?_(i,e.top||0,e.right||0,e.bottom||0,e.left||0):_(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return p((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?A(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e){if(!this.isCompatible(e)){const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;return void a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?L(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._useDevicePixelResolution()?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&q(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._useDevicePixelResolution(2)?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}_useDevicePixelResolution(e){return this.view?.stage?.renderer.isFeatureEnabled(8,e)??!1}preinit(e){return!(this._isOverridden("center")&&!R(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!R(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!R(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||R(this.viewpoint.targetGeometry?.spatialReference,e)&&R(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new z({view:this.view}),this._prepareFrame(m(0));const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):2===this.view.state.viewingMode&&this.addHandles(l(()=>this.view.groundView.ready,()=>{this.removeHandles(ee),this._setInitialView(this.view.dataExtent)},{once:!0,initial:!0}),ee)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ee),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:this.view.state.animationsEnabled,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new I(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(T(this.view),{applyConstraints:!1})}step(e){const t=this.view.state?.cameraController;t?.stepController&&this.view.state.updateCamera(i=>t.stepController(e,i))}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of K){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach(t=>e.add(t))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(O(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=D(this.view,e.targetGeometry,0,.5,0);return void(null!=t&&this.setStateCamera(O(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=D(this.view,e,0,.5,0);null!=r&&this.setStateCamera(O(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&J.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!S(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Q){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=Y){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=E(this.view,r,a,e,t,1);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=D(this.view,e,t,i,1,X);return r?O(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=U(t,e,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(k(this.view,e))}_viewpointToCamera(e){return O(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera(i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&b(this.view,i),this.setCollisionSourceCamera(i)}),!0)}setCollisionSourceCamera(e){this._constraintsManager?.surfaceCollisionConstraint.setSourceCamera(e)}_prepareFrame(e){const{surface:t,canvas:i,stage:r}=this.view;if(!t||!i||!r||r.destroyed||r.destroying)return;this._windowDevicePixelRatio=window.devicePixelRatio;const a=this._computeCanvasSize();if(0!==a.width&&0!==a.height&&(i.width===a.width&&i.height===a.height||(i.width=a.width,i.height=a.height),this.view.state)){const t=this.view.state.camera;t.fullWidth===a.width&&t.fullHeight===a.height&&t.pixelRatio===a.pixelRatio||(Y.copyFrom(t),Y.pixelRatio!==a.pixelRatio&&(this._paddingToArray(this.padding,a.pixelRatio,$),Y.padding=$),Y.fullWidth=a.width,Y.fullHeight=a.height,Y.pixelRatio=a.pixelRatio,this.view.state.camera=Y),this._updateState(),this.view.state.occludedFragmentOpacity.forEach(t=>t?.update(this.view,this.view.state.mode,e))}}_updateElevation(e){const t=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,i=this.view.groundView?.spatialReference,r=i?j(this.view,e.eye):0;e.relativeElevation=t-r}_updateState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=0:this.view.interacting?this.view.state.mode=1:(0===this.view.state.mode&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=1:this.view.state.mode=2),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateState())}};e([d({type:t})],W.prototype,"camera",null),e([d({type:t})],W.prototype,"contentCamera",null),e([d({type:C})],W.prototype,"center",null),e([d()],W.prototype,"visibleArea",null),e([d({type:y})],W.prototype,"extent",null),e([d({readOnly:!0})],W.prototype,"frustum",null),e([d()],W.prototype,"_constraintsManager",void 0),e([d({readOnly:!0})],W.prototype,"constraintsManager",null),e([d()],W.prototype,"_initialViewpoint",null),e([d({readOnly:!0})],W.prototype,"hasInitialView",null),e([d({readOnly:!0,type:Boolean})],W.prototype,"ready",void 0),e([d({type:Number})],W.prototype,"scale",null),e([d()],W.prototype,"padding",null),e([d({readOnly:!0})],W.prototype,"screenCenter",null),e([d({constructOnly:!0})],W.prototype,"view",void 0),e([d({type:i})],W.prototype,"viewpoint",null),e([d({type:Number})],W.prototype,"zoom",null),e([d({readOnly:!0})],W.prototype,"_rasterPixelRatio",null),e([d({readOnly:!0})],W.prototype,"_useDevicePixelResolution",null),e([d()],W.prototype,"_windowDevicePixelRatio",void 0),e([d()],W.prototype,"_devicePixelRatioOverride",void 0),W=e([v("esri.views.3d.state.ViewStateManager")],W);class Z{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const J=new Set(["camera","viewpoint","extent","scale","center","zoom"]),K=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],Q={heading:0,tilt:0};let X=new t,Y=new N;const $=f(),ee="pending-initial-view",te="content-camera-reset",ie=300,re=100;function ae(){X=new t,Y=new N}export{W as ViewStateManager,ae as cleanupViewStateManager,re as interactingTimeout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- class t{constructor(t,s,n,e,r=!1){this.distances=t,this.atlasIndices=s,this.sortedAtlasIndices=n,this.numGaussians=e,this.preciseSort=r}}class s{constructor(t,s,n){this.distances=t,this.atlasIndices=s,this.sortedAtlasIndices=n}}let n=null,e=null,r=0,a=0;const l=10,i=20,o=.25,c=1.5;function f(t,s){let n=Math.max(1,t);for(;n<s;)n=Math.ceil(n*c);return n}function u(t,s){t>r&&(r=f(r,t),n=new Uint32Array(r)),s>a&&(a=f(a,s),e=new Uint32Array(a)),e.fill(0,0,s)}function h(t,s,r){const a=t.length,c=Math.max(l,Math.min(i,Math.round(Math.log2(a/o)))),f=1+(1<<c);u(a,f);let h=t[0],d=t[0];for(let n=0;n<t.length;n++)h=Math.min(h,t[n]),d=Math.max(d,t[n]);const b=d-h;if(b<1e-6)for(let l=0;l<a;++l)n[l]=0,e[0]++;else{const s=(1<<c)/b;for(let r=0;r<a;r++){const a=(t[r]-h)*s>>>0;n[r]=a,e[a]++}}for(let n=1;n<f;n++)e[n]+=e[n-1];for(let l=0;l<a;l++){const t=n[l];r[--e[t]]=s[l]}}async function d(t){const{distances:n,atlasIndices:e,sortedAtlasIndices:r,preciseSort:a,numGaussians:l}=t,i=n.subarray(0,l),o=e.subarray(0,l),c=r.subarray(0,l);if(0===i.length||0===o.length||0===c.length)return{result:new s(n,e,r),transferList:[n.buffer,e.buffer,r.buffer]};if(a){const t=new Array(l);for(let s=0;s<l;s++)t[s]=s;t.sort((t,s)=>i[t]-i[s]||t-s);for(let s=0;s<l;s++)c[s]=o[t[s]]}else h(i,o,c);return{result:new s(n,e,r),transferList:[n.buffer,e.buffer,r.buffer]}}function b(){M()}function M(){n=null,e=null,r=0,a=0}export{t as SplatSortWorkerInput,s as SplatSortWorkerOutput,M as clear,b as destroy,d as sort};
2
+ import{gaussiansPerPage as t}from"./gaussianSplatting/GaussianSplatAtlasPages.js";class e{constructor(t,e,n,s,r,i,o,a,l=!1){this.addedTiles=t,this.removedTileHandles=e,this.visibleTileHandles=n,this.sortedAtlasIndices=s,this.numGaussians=r,this.directionX=i,this.directionY=o,this.directionZ=a,this.preciseSort=l}}class n{constructor(t){this.sortedAtlasIndices=t}}let s=null,r=0,i=null,o=0,a=null,l=0;const c=new Map,u=10,d=20,f=.25,h=1.5;function g(t,e){let n=Math.max(1,t);for(;n<e;)n=Math.ceil(n*h);return n}function w(t){t>r&&(r=g(r,t),s=new Uint32Array(r)),s.fill(0,0,t)}function p(t){t<=o||(o=g(o,t),i=new Float64Array(o))}function m(t){return t>l&&(l=g(l,t),a=new Uint32Array(l)),a}function M(e,n){let s=0;for(let r=0;r<e.length;r++){const i=c.get(e[r]);if(null==i)throw new Error("Gaussian splat sort worker is missing resident tile data");const o=s+i.gaussianCount;for(let e=0;e<i.pageIds.length&&s<o;e++){const r=i.pageIds[e]*t,a=Math.min(o-s,t);for(let t=0;t<a;t++,s++)n[s]=r+t}}if(s!==n.length)throw new Error("Gaussian splat sort worker received inconsistent resident tile data")}function G(e,n,r){const i=e.length,o=Math.max(u,Math.min(d,Math.round(Math.log2(i/f)))),a=1+(1<<o);w(a);let l=e[0],h=e[0];for(let t=0;t<i;t++)l=Math.min(l,e[t]),h=Math.max(h,e[t]);const g=h-l,p=g>=1e-6,m=p?(1<<o)/g:0;if(p)for(let t=0;t<i;t++){const n=(e[t]-l)*m>>>0;s[n]++}else s[0]=i;for(let t=1;t<a;t++)s[t]+=s[t-1];let M=0;for(let u=0;u<n.length;u++){const i=c.get(n[u]);if(null==i)throw new Error("Gaussian splat sort worker is missing resident tile data");const o=M+i.gaussianCount;for(let n=0;n<i.pageIds.length&&M<o;n++){const a=i.pageIds[n]*t,c=Math.min(o-M,t);for(let t=0;t<c;t++,M++){const n=p?(e[M]-l)*m>>>0:0;r[--s[n]]=a+t}}}if(M!==i)throw new Error("Gaussian splat sort worker received inconsistent resident tile data")}async function v(t){const{addedTiles:e,removedTileHandles:s,visibleTileHandles:r,sortedAtlasIndices:o,numGaussians:a,directionX:l,directionY:u,directionZ:d,preciseSort:f}=t;for(let n=0;n<s.length;n++)c.delete(s[n]);for(let n=0;n<e.length;n++){const t=e[n];c.set(t.handle,t)}if(0===a)return{result:new n(o),transferList:[o.buffer]};p(a);const h=i.subarray(0,a),g=o.subarray(0,a);let w=0;for(let n=0;n<r.length;n++){const t=c.get(r[n]);if(null==t)throw new Error("Gaussian splat sort worker is missing resident tile data");const{relativePositions:e,gaussianCount:s,originX:i,originY:o,originZ:a}=t,f=w+s,g=l*i+u*o+d*a;for(let n=0;w<f;w++,n+=3)h[w]=e[n]*l+e[n+1]*u+e[n+2]*d+g}if(w!==a)throw new Error("Gaussian splat sort worker received inconsistent resident tile data");if(f){const t=m(a).subarray(0,a);M(r,t);const e=new Array(a);for(let n=0;n<a;n++)e[n]=n;e.sort((t,e)=>h[t]-h[e]||t-e);for(let n=0;n<a;n++)g[n]=t[e[n]]}else a>0&&G(h,r,g);return{result:new n(o),transferList:[o.buffer]}}function y(){A()}function A(){c.clear(),i=null,o=0,a=null,l=0,s=null,r=0}export{e as SplatSortWorkerInput,n as SplatSortWorkerOutput,A as clear,y as destroy,v as sort};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{WorkerHandle as r}from"../../../core/workers/WorkerHandle.js";class s extends r{constructor(r){super("GaussianSplatSortWorker","sort",{sort:r=>[r.distances.buffer,r.atlasIndices.buffer,r.sortedAtlasIndices.buffer]},r,{strategy:"dedicated"})}sort(r,s){return this.invokeMethod("sort",r,s)}clear(){return this.broadcast({},"clear")}async destroyWorkerAndSelf(){await this.broadcast({},"destroy"),this.destroy()}}export{s as GaussianSplatSortWorkerHandle};
2
+ import{WorkerHandle as r}from"../../../core/workers/WorkerHandle.js";class t extends r{constructor(r){super("GaussianSplatSortWorker","sort",{sort:r=>[r.sortedAtlasIndices.buffer]},r,{strategy:"dedicated"})}sort(r,t){return this.invokeMethod("sort",r,t)}clear(){return this.broadcast({},"clear")}async destroyWorkerAndSelf(){await this.broadcast({},"destroy"),this.destroy()}}export{t as GaussianSplatSortWorkerHandle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as o}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as e}from"../../../../geometry/support/HalfFloatArray.js";import{zValueInAbsoluteHeightMode as r}from"../../../../support/elevationInfoUtils.js";import{convertVisualVariables as i,ConvertOptions as s}from"../../layers/support/FastSymbolUpdates.js";import{animatedLineStripsToParameters as n,createGeometry as a}from"../engineContent/line.js";import{valuesPerFlowVertex as l}from"./loadUtils.js";import{drapedZ as p}from"../../terrain/OverlayRenderer.js";function c(t,r,{vertices:i,stage:s,hasMagnitude:c},m,u,d){const{spatialReference:v}=r.extent,h=[],g=l(c),y=r.flowExtentInfo.modelSize[0];let S=0;for(let o=0;o<i.length;o+=g){if(d&&o>0){const t=i[o]-i[o-g];t>y/2?S-=y:-t>y/2&&(S+=y)}const[e,s]=r.modelToMapSpace(i[o]+S,i[o+1],!1),n=d?[e,s,p]:f(e,s,v,t,m);h.push(n)}const j=Math.floor(i.length/g),V=e(j);for(let o=0;o<j;o++)V[o]=i[o*g+2];const{hasVVColor:b,hasVVOpacity:z,hasVVSize:C}=u.parameters;let w,x,R;if(c&&(b||z||C)){const t=o(j);for(let o=0;o<j;o++)t[o]=i[o*g+3];b&&(w=[t]),z&&(x=[t]),C&&(R=[t])}const U=n([h],void 0,[{timeStamps:V,stage:s}],w,x,R);return a(u,U[0])}function m(t,o,e){if(null==t)return{};let r=null;if(t.visualVariables){const o=[],e=t.visualVariables,n=new s({supports:{size:!0,color:!0,rotation:!1,opacity:!0}});r=i(e,n,o)}const n=r?.color?[1,1,1,1]:t.color.toUnitRGBA();n[3]*=o;return{color:n,width:t.trailWidth,cap:0,animationSpeed:t.flowSpeed,trailLength:t.trailLength,animation:3,emissiveStrength:e,vvColor:r?.color,vvOpacity:r?.opacity,vvSize:r?.size}}function f(o,e,i,s,n){const{absoluteZ:a}=r(o,e,0,i,s,n),l=t(o,e,a);return s.renderCoordsHelper.toRenderCoords(l,i,l),l}export{c as createStreamlineGeometry,m as materialParametersFromRenderer};
2
+ import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as o}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as e}from"../../../../geometry/support/HalfFloatArray.js";import{zValueInAbsoluteHeightMode as r}from"../../../../support/elevationInfoUtils.js";import{convertVisualVariables as i,ConvertOptions as s}from"../../layers/support/FastSymbolUpdates.js";import{animatedLineStripsToParameters as a,createGeometry as n}from"../engineContent/line.js";import{valuesPerFlowVertex as l}from"./loadUtils.js";import{drapedZ as p}from"../../terrain/DrapedZ.js";function c(t,r,{vertices:i,stage:s,hasMagnitude:c},m,u,d){const{spatialReference:h}=r.extent,v=[],g=l(c),y=r.flowExtentInfo.modelSize[0];let S=0;for(let o=0;o<i.length;o+=g){if(d&&o>0){const t=i[o]-i[o-g];t>y/2?S-=y:-t>y/2&&(S+=y)}const[e,s]=r.modelToMapSpace(i[o]+S,i[o+1],!1),a=d?[e,s,p]:f(e,s,h,t,m);v.push(a)}const j=Math.floor(i.length/g),V=e(j);for(let o=0;o<j;o++)V[o]=i[o*g+2];const{hasVVColor:b,hasVVOpacity:z,hasVVSize:C}=u.parameters;let w,x,U;if(c&&(b||z||C)){const t=o(j);for(let o=0;o<j;o++)t[o]=i[o*g+3];b&&(w=[t]),z&&(x=[t]),C&&(U=[t])}const A=a([v],void 0,[{timeStamps:V,stage:s}],w,x,U);return n(u,A[0])}function m(t,o,e){if(null==t)return{};let r=null;if(t.visualVariables){const o=[],e=t.visualVariables,a=new s({supports:{size:!0,color:!0,rotation:!1,opacity:!0}});r=i(e,a,o)}const a=r?.color?[1,1,1,1]:t.color.toUnitRGBA();a[3]*=o;return{color:a,width:t.trailWidth,cap:0,animationSpeed:t.flowSpeed,trailLength:t.trailLength,animation:3,emissiveStrength:e,vvColor:r?.color,vvOpacity:r?.opacity,vvSize:r?.size}}function f(o,e,i,s,a){const{absoluteZ:n}=r(o,e,0,i,s,a),l=t(o,e,n);return s.renderCoordsHelper.toRenderCoords(l,i,l),l}export{c as createStreamlineGeometry,m as materialParametersFromRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}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 _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as T}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as b}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as S}from"./GaussianSplatTextureAtlas.js";import{DepthRange as y}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class C{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new y,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._sortInterval=a(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new b(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._headerTexture=new T(this._renderer.renderingContext),this._textureAtlas=new S(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new m(f(i)),this._frameTask=i.scheduler.registerTask(x.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 usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],a=s[1],o=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-a)+d*(e.obbCenterZ-o),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=o()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._sortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);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);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const a=this._renderer.camera;h(this._cameraDirectionNormalized,a.ray.direction);const o=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=a,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],x=g[3],C=g[4],A=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:a,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:V}=s,v=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*V;e=b[0]*a+b[1]*h+b[2]*g+b[3]<t&&S[0]*a+S[1]*h+S[2]*g+S[3]<t&&y[0]*a+y[1]*h+y[2]*g+y[3]<t&&x[0]*a+x[1]*h+x[2]*g+x[3]<t&&C[0]*a+C[1]*h+C[2]*g+C[3]<t&&A[0]*a+A[1]*h+A[2]*g+A[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=o*a+n*h+l*g,G=u+v;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],a=r[t+2];_[e]=s*o+i*n+a*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},v=await(this._workerHandle?.sort(V,e));if(e.aborted)return;v&&(this._distancesBuffer=v.distances,this._atlasIndicesBuffer=v.atlasIndices,this._sortedAtlasIndicesBuffer=v.sortedAtlasIndices);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as n}from"../../../../core/time.js";import{exactEquals as a,copy as l,normalize as h}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 _,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as c}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as T}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as f}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as b}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as S}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as y}from"./GaussianSplatTextureAtlas.js";import{DepthRange as C}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class V{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new C,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=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new S(this._renderer.renderingContext),this._fadingTexture=new f(this._renderer.renderingContext),this._headerTexture=new b(this._renderer.renderingContext),this._textureAtlas=new y(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new T(c(i)),this._frameTask=i.scheduler.registerTask(x.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 usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],n=s[2],h=i[0],u=i[1],d=i[2],c=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&a(this._previousVisibleTileDepthRangeEye,s)&&a(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return c.near<=c.far?c:null;let g=1/0,T=-1/0;const f=this._latestSortedGaussianTiles;for(let a=0;a<f.length;a++){const e=f[a];if(null!=t){const s=e.boundingBox;if(!p(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-n),i=e.paddedMbsRadius,l=s-i;l<g&&(g=l);const _=s+i;_>T&&(T=_)}const b=g<=T;return b?c.set(g,T):c.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&m(this._previousVisibleTileDepthRangeClippingBox,t),b?c:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=n()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=n(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){const t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=s(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);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);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacity(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const n=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._renderer.clippingBox,_=this._nextCommittedVisibleGaussianTiles;_.length=0;let m=0;const{frustum:c}=o,T=this._renderer.tileCullingRevision,f=c[0],b=c[1],S=c[2],y=c[3],C=c[4],x=c[5];for(let e=0;e<s;e++){const s=t[e],{obbCenterX:i,obbCenterY:r,obbCenterZ:o,paddedMbsRadius:n}=s,a=s.gaussianCount;if(s.cullingRevision!==T){let e=null==d||p(s.boundingBox,d);if(e){const t=1.5*n;e=f[0]*i+f[1]*r+f[2]*o+f[3]<t&&b[0]*i+b[1]*r+b[2]*o+b[3]<t&&S[0]*i+S[1]*r+S[2]*o+S[3]<t&&y[0]*i+y[1]*r+y[2]*o+y[3]<t&&C[0]*i+C[1]*r+C[2]*o+C[3]<t&&x[0]*i+x[1]*r+x[2]*o+x[3]<t}s.cullingRevision=T,s.cullingVisible=e}s.cullingVisible&&(_[m++]=s,u+=a)}if(_.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V=new Map,A=[],v=new Uint32Array(m);for(let e=0;e<m;e++){const t=_[e],s=t.handle;V.set(s,t),v[e]=s,this._workerResidentTiles.get(s)!==t&&A.push({handle:s,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}const w=[];for(const e of this._workerResidentTiles.keys())V.has(e)||w.push(e);const R=new g(A,Uint32Array.from(w),v,this._sortedAtlasIndicesBuffer,u,n,a,l,this._useDeterministicSort),B=await(this._workerHandle?.sort(R,e));if(e.aborted)return;B&&(this._sortedAtlasIndicesBuffer=B.sortedAtlasIndices,this._workerResidentTiles=V);const G=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=_,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(G,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{V as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,diameter as e}from"../../../../geometry/support/aaBoundingBox.js";class a{constructor(a,o,n,r,h,c,b,u,d,l,m){this.handle=a,this.obb=o,this.gaussianAtlasIndices=n,this.pageIds=r,this.relativePositions=h,this.packedRotations=c,this.packedOpacityScaledScales=b,this.gaussianCount=u,this.maxSplatMbsRadiusSquared=d,this.maxGaussianOpacity=l,this.elevationRange=m,this.bvhIntersectionGeneration=0,this.lifecycleState=0,this.cullingRevision=-1,this.cullingVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.usedMemory=t(this.gaussianAtlasIndices,this.pageIds,this.relativePositions,this.packedRotations,this.packedOpacityScaledScales);const f=s();o.getCenter(f),this.obbCenterX=f[0],this.obbCenterY=f[1],this.obbCenterZ=f[2];const p=o.radius??-1;this._mbsRadius=p;const S=p<0?-1:p*p;this._mbsRadiusSquared=S,this._obbShortestHalfsize=Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ);const g=i();o.toAaBoundingBox(g),this.boundingBox=g;const R=p>=0?p:.5*e(g);this.paddedMbsRadius=R+Math.sqrt(Math.max(0,d))}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{obbCenterX:i,obbCenterY:e,obbCenterZ:a}=this,o=i-t[0],n=e-t[1],r=a-t[2],h=o*s[0]+n*s[1]+r*s[2],c=o*o+n*n+r*r-h*h;return(this._mbsRadiusSquared<0||c<=this._mbsRadiusSquared)&&this.obb.intersectRay(t,s)}boundingVolumeIntersectsSphere(t){const s=this._mbsRadius;if(s<0)return!0;const i=t.center,e=t.radius,a=s+e,o=this.obbCenterX-i[0];if(o>a)return!1;const n=this.obbCenterY-i[1];if(n>a)return!1;const r=this.obbCenterZ-i[2];if(r>a)return!1;const h=o*o+n*n+r*r;if(h>a*a)return!1;if(h<=(this._obbShortestHalfsize+e)**2)return!0;return Math.sqrt(h)+s<=e||(this.obb?.intersectSphere(t)??!0)}}export{a as GaussianTile};
2
+ import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,diameter as e}from"../../../../geometry/support/aaBoundingBox.js";class o{constructor(o,r,a,n,h,b,c,u,d,l){this.handle=o,this.obb=r,this.pageIds=a,this.relativePositions=n,this.packedRotations=h,this.packedOpacityScaledScales=b,this.gaussianCount=c,this.maxSplatMbsRadiusSquared=u,this.maxGaussianOpacity=d,this.elevationRange=l,this.bvhIntersectionGeneration=0,this.lifecycleState=0,this.cullingRevision=-1,this.cullingVisible=!1,this.fadeDirection=0,this.opacityModifier=0,this.usedMemory=t(this.pageIds,this.relativePositions,this.packedRotations,this.packedOpacityScaledScales);const m=s();r.getCenter(m),this.obbCenterX=m[0],this.obbCenterY=m[1],this.obbCenterZ=m[2];const f=r.radius??-1;this._mbsRadius=f;const p=f<0?-1:f*f;this._mbsRadiusSquared=p,this._obbShortestHalfsize=Math.min(r.halfSizeX,r.halfSizeY,r.halfSizeZ);const S=i();r.toAaBoundingBox(S),this.boundingBox=S;const g=f>=0?f:.5*e(S);this.paddedMbsRadius=g+Math.sqrt(Math.max(0,u))}boundingVolumeIntersectsRay(t,s){if(!this.obb)return!0;const{obbCenterX:i,obbCenterY:e,obbCenterZ:o}=this,r=i-t[0],a=e-t[1],n=o-t[2],h=r*s[0]+a*s[1]+n*s[2],b=r*r+a*a+n*n-h*h;return(this._mbsRadiusSquared<0||b<=this._mbsRadiusSquared)&&this.obb.intersectRay(t,s)}boundingVolumeIntersectsSphere(t){const s=this._mbsRadius;if(s<0)return!0;const i=t.center,e=t.radius,o=s+e,r=this.obbCenterX-i[0];if(r>o)return!1;const a=this.obbCenterY-i[1];if(a>o)return!1;const n=this.obbCenterZ-i[2];if(n>o)return!1;const h=r*r+a*a+n*n;if(h>o*o)return!1;if(h<=(this._obbShortestHalfsize+e)**2)return!0;return Math.sqrt(h)+s<=e||(this.obb?.intersectSphere(t)??!0)}}export{o as GaussianTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{projectBuffer as e}from"../../../../geometry/projection/projectBuffer.js";import{newDoubleArray as o,doubleSubArray as n}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as t}from"../../layers/graphics/elevationAlignmentUtils.js";import{ringsToOutlinedTessellationInfo as s}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as r}from"../../terrain/OverlayRenderer.js";function i(e,n,r,i){const l="polygon"===e.type,a="polygon"===e.type?e.rings:e.paths,{positions:c,outlines:f}=s(a,{hasZ:!!e.hasZ,ccwRingsAsHoles:l,spatialReference:e.spatialReference}),u=o(c.length),g=t(c,e.spatialReference,0,u,0,c,0,c.length/3,n,r,i),m=null!=g;return{lines:m?p(f,c,u):[],projectionSuccess:m,sampledElevation:g}}function l(o,n){const t="polygon"===o.type,i="polygon"===o.type?o.rings:o.paths,{positions:l,outlines:a}=s(i,{hasZ:!1,ccwRingsAsHoles:t,spatialReference:o.spatialReference}),c=e(l,o.spatialReference,0,l,n,0);for(let e=2;e<l.length;e+=3)l[e]=r;return{lines:c?p(a,l):[],projectionSuccess:c}}function p(e,o,t=null){const s=new Array;for(const{index:r,count:i}of e){if(i<=1)continue;const e=3*r,l=3*i;s.push({position:n(o,3*r,3*i),mapPositions:null!=t?n(t,e,l):void 0})}return s}export{i as geometryToRenderInfo,l as geometryToRenderInfoDraped};
2
+ import{projectBuffer as e}from"../../../../geometry/projection/projectBuffer.js";import{newDoubleArray as o,doubleSubArray as n}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as t}from"../../layers/graphics/elevationAlignmentUtils.js";import{ringsToOutlinedTessellationInfo as s}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as i}from"../../terrain/DrapedZ.js";function r(e,n,i,r){const l="polygon"===e.type,a="polygon"===e.type?e.rings:e.paths,{positions:c,outlines:f}=s(a,{hasZ:!!e.hasZ,ccwRingsAsHoles:l,spatialReference:e.spatialReference}),u=o(c.length),g=t(c,e.spatialReference,0,u,0,c,0,c.length/3,n,i,r),m=null!=g;return{lines:m?p(f,c,u):[],projectionSuccess:m,sampledElevation:g}}function l(o,n){const t="polygon"===o.type,r="polygon"===o.type?o.rings:o.paths,{positions:l,outlines:a}=s(r,{hasZ:!1,ccwRingsAsHoles:t,spatialReference:o.spatialReference}),c=e(l,o.spatialReference,0,l,n,0);for(let e=2;e<l.length;e+=3)l[e]=i;return{lines:c?p(a,l):[],projectionSuccess:c}}function p(e,o,t=null){const s=new Array;for(const{index:i,count:r}of e){if(r<=1)continue;const e=3*i,l=3*r;s.push({position:n(o,3*i,3*r),mapPositions:null!=t?n(t,e,l):void 0})}return s}export{r as geometryToRenderInfo,l as geometryToRenderInfoDraped};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{doubleSubArray as n,newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as s}from"../../layers/graphics/elevationAlignmentUtils.js";import{axisFromRings as i,ringsToOutlinedTessellationInfo as r,tessellateOrLoad as l,load as u}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as c}from"../../terrain/OverlayRenderer.js";async function a(){return u()}class p{constructor(e,t,n,o){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=o,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=A(e.outlineIndices[n]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){t+=A(e.outlineIndices[n])}return t}}class d extends p{}class f extends p{}class h extends p{constructor(e,t,n,o,s,i){super(e,n,o,s),this.mapPositions=t,this.sampledElevation=i}}function g(t,n){const o=v(t,n);return e(o)?null:o}function m(t,n,o,s,i){const r=w(t,n,o,s,i);return e(r)?null:r}function x(t,n){const o=R(t,n);return e(o)?null:o}function v(t,n){const{projectIfNearlyVertical:o=!1,outlineOutput:s="none",method:u,owner:c}=n??{},a="tessellated-indices"===s,p=i(t.rings,!!t.hasZ,t.spatialReference),d=r(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:p}),h=l(d,{projectionAxis:o?p:void 0,outlines:a?d.outlines:void 0,method:u,owner:c});if(e(h))return h;if(!h.succeeded)return null;let g={output:"none"};if("vertex-data"===s){const e=h.positions!==d.positions?d.positions:d.positions.slice();g={output:"vertex-data",outlines:y(d.outlines,e)}}else"tessellated-indices"===s&&(g=j(h));return new f(h.positions,h.indices,g,!0)}function R(n,o){const{drapedSpatialReference:s,projectIfNearlyVertical:u=!1,outlineOutput:a="none",method:p,owner:f}=o,h=i(n.rings,!1,n.spatialReference),g=r(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:h}),m="none"!==a,x=t(g.positions,n.spatialReference,0,g.positions,s,0),v=l(g,{projectionAxis:u?h:void 0,outlines:m?g.outlines:void 0,method:p,owner:f});if(e(v))return v;if(!v.succeeded)return null;const{positions:R,indices:w}=v;for(let e=2;e<R.length;e+=3)R[e]=c;let I={output:"none"};if("vertex-data"===a){if(R!==g.positions)for(let t=2;t<g.positions.length;t+=3)g.positions[t]=c;const e=R!==g.positions?g.positions:g.positions.slice();I={output:"vertex-data",outlines:y(g.outlines,e)}}else"tessellated-indices"===a&&(I=j(v));return new d(R,w,I,x)}function w(t,n,u,c,a){const{projectIfNearlyVertical:p=!1,outlineOutput:d="none",method:f,owner:g}=a??{},m="none"!==d,x=!!t.hasZ&&"on-the-ground"!==c.mode,v=i(t.rings,x,t.spatialReference),R=r(t.rings,{hasZ:x,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:v}),w=l(R,{projectionAxis:p?v:void 0,outlines:m?R.outlines:void 0,method:f,owner:g});if(e(w))return w;if(!w.succeeded)return null;const{positions:y,vertexCount:A}=w,Z=o(y.length),C=s(y,t.spatialReference,0,Z,0,y,0,A,n,u,c);let O={output:"none"};"vertex-data"===d?O={output:"vertex-data",outlines:I(w,Z)}:"tessellated-indices"===d&&(O=j(w));const B=null!=C;return new h(y,Z,w.indices,O,B,C)}function y(e,t,o=null){return e.values().filter(({count:e})=>e>1).map(({index:e,count:s})=>{const i=3*e,r=3*s;return null!=o?new C(e,s,n(t,i,r),n(o,i,r)):new Z(e,s,n(t,i,r))}).toArray()}function j(e){const{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(null==t||null==n)return{output:"none"};const o=new Array(n.length);let s=0;for(let i=0;i<n.length;i++){const e=n[i],r=t.slice(s,s+e);o[i]=r,s+=e}return{output:"tessellated-indices",outlineIndices:o}}function I(e,t){const{outlineIndexBuffer:s,outlineRingLengths:i,positions:r}=e;if(null==s||null==i)return[];let l=0;for(let n=0;n<i.length;n++)l+=i[n]-1;const u=o(3*l),c=o(3*l),a=new Array;let p=0,d=0;for(let o=0;o<i.length;o++){const e=i[o],l=e-1;for(let n=0;n<l;n++){const e=3*s[p+n],o=3*(d+n);u[o]=r[e],u[o+1]=r[e+1],u[o+2]=r[e+2],c[o]=t[e],c[o+1]=t[e+1],c[o+2]=t[e+2]}a.push(new C(d,l,n(u,3*d,3*l),n(c,3*d,3*l))),p+=e,d+=l}return a}function A(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class Z{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class C extends Z{constructor(e,t,n,o){super(e,t,n),this.mapPositions=o}}export{C as OutlineVertexData,Z as OutlineVertexDataDraped,p as PolygonRenderInfoBase,d as PolygonRenderInfoDraped,h as PolygonRenderInfoElevationAligned,f as PolygonRenderInfoNotElevationAligned,a as loadTessellationUtils,R as polygonToRenderInfoDraped,w as polygonToRenderInfoElevationAligned,v as polygonToRenderInfoNotElevationAligned,x as preloadedPolygonToRenderInfoDraped,m as preloadedPolygonToRenderInfoElevationAligned,g as preloadedPolygonToRenderInfoNotElevationAligned,j as splitOutlineIndexRings,I as tessellatedOutlineIndicesToVertexData};
2
+ import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{doubleSubArray as n,newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{applyPerVertexElevationAlignment as s}from"../../layers/graphics/elevationAlignmentUtils.js";import{axisFromRings as i,ringsToOutlinedTessellationInfo as r,tessellateOrLoad as l,load as u}from"../../layers/graphics/tessellationUtils.js";import{drapedZ as c}from"../../terrain/DrapedZ.js";async function a(){return u()}class p{constructor(e,t,n,o){this.positions=e,this.polygonIndices=t,this.outline=n,this.projectionSuccess=o,this.count=e.length/3}get vertexCount(){return this.positions.length/3}get polygonIndexCount(){return this.polygonIndices.length}get outlineIndexCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++)t+=A(e.outlineIndices[n]);return t}get outlineSegmentCount(){const{outline:e}=this;if("tessellated-indices"!==e.output)return 0;let t=0;for(let n=0;n<e.outlineIndices.length;n++){t+=A(e.outlineIndices[n])}return t}}class d extends p{}class f extends p{}class h extends p{constructor(e,t,n,o,s,i){super(e,n,o,s),this.mapPositions=t,this.sampledElevation=i}}function g(t,n){const o=v(t,n);return e(o)?null:o}function m(t,n,o,s,i){const r=R(t,n,o,s,i);return e(r)?null:r}function x(t,n){const o=w(t,n);return e(o)?null:o}function v(t,n){const{projectIfNearlyVertical:o=!1,outlineOutput:s="none",method:u,owner:c}=n??{},a="tessellated-indices"===s,p=i(t.rings,!!t.hasZ,t.spatialReference),d=r(t.rings,{hasZ:!!t.hasZ,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:p}),h=l(d,{projectionAxis:o?p:void 0,outlines:a?d.outlines:void 0,method:u,owner:c});if(e(h))return h;if(!h.succeeded)return null;let g={output:"none"};if("vertex-data"===s){const e=h.positions!==d.positions?d.positions:d.positions.slice();g={output:"vertex-data",outlines:j(d.outlines,e)}}else"tessellated-indices"===s&&(g=y(h));return new f(h.positions,h.indices,g,!0)}function w(n,o){const{drapedSpatialReference:s,projectIfNearlyVertical:u=!1,outlineOutput:a="none",method:p,owner:f}=o,h=i(n.rings,!1,n.spatialReference),g=r(n.rings,{hasZ:!1,ccwRingsAsHoles:!0,spatialReference:n.spatialReference,axis:h}),m="none"!==a,x=t(g.positions,n.spatialReference,0,g.positions,s,0),v=l(g,{projectionAxis:u?h:void 0,outlines:m?g.outlines:void 0,method:p,owner:f});if(e(v))return v;if(!v.succeeded)return null;const{positions:w,indices:R}=v;for(let e=2;e<w.length;e+=3)w[e]=c;let I={output:"none"};if("vertex-data"===a){if(w!==g.positions)for(let t=2;t<g.positions.length;t+=3)g.positions[t]=c;const e=w!==g.positions?g.positions:g.positions.slice();I={output:"vertex-data",outlines:j(g.outlines,e)}}else"tessellated-indices"===a&&(I=y(v));return new d(w,R,I,x)}function R(t,n,u,c,a){const{projectIfNearlyVertical:p=!1,outlineOutput:d="none",method:f,owner:g}=a??{},m="none"!==d,x=!!t.hasZ&&"on-the-ground"!==c.mode,v=i(t.rings,x,t.spatialReference),w=r(t.rings,{hasZ:x,ccwRingsAsHoles:!0,spatialReference:t.spatialReference,axis:v}),R=l(w,{projectionAxis:p?v:void 0,outlines:m?w.outlines:void 0,method:f,owner:g});if(e(R))return R;if(!R.succeeded)return null;const{positions:j,vertexCount:A}=R,Z=o(j.length),C=s(j,t.spatialReference,0,Z,0,j,0,A,n,u,c);let B={output:"none"};"vertex-data"===d?B={output:"vertex-data",outlines:I(R,Z)}:"tessellated-indices"===d&&(B=y(R));const H=null!=C;return new h(j,Z,R.indices,B,H,C)}function j(e,t,o=null){return e.values().filter(({count:e})=>e>1).map(({index:e,count:s})=>{const i=3*e,r=3*s;return null!=o?new C(e,s,n(t,i,r),n(o,i,r)):new Z(e,s,n(t,i,r))}).toArray()}function y(e){const{outlineIndexBuffer:t,outlineRingLengths:n}=e;if(null==t||null==n)return{output:"none"};const o=new Array(n.length);let s=0;for(let i=0;i<n.length;i++){const e=n[i],r=t.slice(s,s+e);o[i]=r,s+=e}return{output:"tessellated-indices",outlineIndices:o}}function I(e,t){const{outlineIndexBuffer:s,outlineRingLengths:i,positions:r}=e;if(null==s||null==i)return[];let l=0;for(let n=0;n<i.length;n++)l+=i[n]-1;const u=o(3*l),c=o(3*l),a=new Array;let p=0,d=0;for(let o=0;o<i.length;o++){const e=i[o],l=e-1;for(let n=0;n<l;n++){const e=3*s[p+n],o=3*(d+n);u[o]=r[e],u[o+1]=r[e+1],u[o+2]=r[e+2],c[o]=t[e],c[o+1]=t[e+1],c[o+2]=t[e+2]}a.push(new C(d,l,n(u,3*d,3*l),n(c,3*d,3*l))),p+=e,d+=l}return a}function A(e,t=0,n=e.length){return n>1&&e[t]===e[t+n-1]?n-1:n}class Z{constructor(e,t,n){this.index=e,this.count=t,this.position=n}}class C extends Z{constructor(e,t,n,o){super(e,t,n),this.mapPositions=o}}export{C as OutlineVertexData,Z as OutlineVertexDataDraped,p as PolygonRenderInfoBase,d as PolygonRenderInfoDraped,h as PolygonRenderInfoElevationAligned,f as PolygonRenderInfoNotElevationAligned,a as loadTessellationUtils,w as polygonToRenderInfoDraped,R as polygonToRenderInfoElevationAligned,v as polygonToRenderInfoNotElevationAligned,x as preloadedPolygonToRenderInfoDraped,m as preloadedPolygonToRenderInfoElevationAligned,g as preloadedPolygonToRenderInfoNotElevationAligned,y as splitOutlineIndexRings,I as tessellatedOutlineIndicesToVertexData};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ const o=-2;export{o as drapedZ};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{cyclicalPI as r}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as s,deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as a,sync as o,when as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../core/accessorSupport/decorators.js";import{subtract as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as u,subtract as p,copy as m,distance as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as _,scale as v,add as f}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,create as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as R}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as P,width as O,center as D,copy as T,intersection as M,contains as b,offset as j}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as I}from"../../../geometry/support/normalizeUtils.js";import{create as E,wrap as U}from"../../../geometry/support/ray.js";import{Sphere as V}from"../../../geometry/support/sphere.js";import{angleAroundAxis as C}from"../../../geometry/support/vector.js";import{y2lat as q}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as A}from"../state/utils/viewUtils.js";import{debugFlags as F}from"../support/debugFlags.js";import{DebugPoint as H}from"../support/debugUtils.js";import{OverlayRenderer as G}from"./OverlayRenderer.js";import{Intersector as z}from"../webgl-engine/lib/Intersector.js";import{fromValues as L}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as B}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as W,ensureTextureSize as Y}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as k}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as N,noBudget as X}from"../../support/Scheduler.js";import{Yield as Z}from"../../support/Yield.js";const J=1.3,K=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let Q,$=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){const{view:e}=this;this.renderer=new G({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new z(e.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([a(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),a(()=>e.state.camera.pixelRatio,t),a(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.groundView.requestRender(1)),a(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),a(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),o),l(()=>this.groundView,e=>e.on("elevation-change",()=>this.setPlacementDirty())),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(N.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),Q&&(Q.hide(),Q=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=I(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||F.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.groundView.ready}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?R(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return J/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.terrainSurface.enabled&&this.terrainSurface.suspended}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(e){return this._contentUpdated=!1,this.renderer.time=e,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new B({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return Z;if(!this.view.pointsOfInterest?.centerOnSurfaceFrequent)return Z;const s=this._computeOverlayHeight(t);this._computeOverlayExtents(t,s,ie),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,ie.stretch);const i=this._updateOverlay(0,ie.inner,s,1*ie.pixelRatioAdjustment,ie.mapUnitsPerPixel),n=O(ie.inner)/O(ie.outer),a=this._updateOverlay(1,ie.outer,s,n*ie.pixelRatioAdjustment,ie.mapUnitsPerPixel);1!==i&&1!==a||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(r)),0===i&&0===a||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s)),{maxPreferredTexturePixels:n,maxTextureSize:a}=this.view.stage.renderView.renderingContext.parameters,o=.5*a;return W(Y({width:i,height:i},{maxPreferredTexturePixels:2*n,maxTextureSize:o})[1],o)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return 0;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=i,n.pixelRatio=s,ee(t,n.extent)&&r===n.resolution)return a===i?0:2;n.setExtent(t),n.resolution=r;const o=D(n.extent);return n.renderLocalOrigin=L(o[0],o[1],0,"OV_"+this._latestOriginId++),1}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],s=this.renderer.overlays[1],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}reloadShaders(){k(),this.requestRender(),this.runTask(X)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const n=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,oe,t,r);if(null==n)return!1;const a=n.origin,o=u(se,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.groundView.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let i=.5;const n=.55,a=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=s(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:a+l,e.aboveGround?a-l:1/0),d=e.aboveGround;if("global"===this.view.viewingMode){const t=se;le.radius=R(this.view.spatialReference).radius+h,le.closestPointOnSilhouette(U(e.eye,e.viewForward),t),p(t,t,e.eye);const s=r.normalize(C(e.viewForward,t,e.viewRight))/e.fovY+.5,a=s<=0||s>=1?.5:n;i=d?a*s:s+a*(1-s)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),r=Math.tan(t),a=w(0,r,1,0),o=_(a,a,e.projectionMatrix)[1],l=s(.5+.5*o,0,1);i=1===l||0===l?.5:d?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,i,o.distance,t)}_computeOverlayExtents(e,t,r){const{view:s}=this,n=s.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,a=y();this._findHorizonBasedPointOfInterest(e,a)||m(a,n);const o=this._renderSR;F.OVERLAY_SHOW_CENTER?(null==Q&&(Q=new H(s.graphics,"red")),Q.show(a,o)):null!=Q&&Q.hide();const l=Math.max(.1,g(e.eye,a)),h=A(s.renderCoordsHelper,n,e.eye),d=this._spatialReference;this._overlaySREqualsRenderSR||S(a,o,a,d);const u=this._isSpherical,p=this.groundView.groundExtent,_=!u&&d?.isGeographic,w=_&&d?1/R(d).metersPerDegree:1,x=s.state.contentPixelRatio,P=e.perScreenPixelRatio/x*l*w;r.mapUnitsPerPixel=P/this.worldToPCSRatio,r.stretch=this._overlayStretch;let D=t*P/2*r.stretch,j=!1,I=_?90:1/0;u&&p&&d&&(d.isWebMercator?(D/=Math.cos(q(a[1])),I=p[3]):(j=!0,D/=R(d).metersPerDegree,I=90),D>=I&&(D=I,a[1]=0,d.isWebMercator&&(a[0]=0)));let E=1;j&&(E=1/Math.max(.2,Math.cos(Math.abs(i(a[1])))),D*E>180&&(E=180/D),r.mapUnitsPerPixel*=E);const U=Math.log(2)/12;D=Math.exp(Math.round(Math.log(D)/U)*U);const V=D*E,C=32,G=.5*t/(C*V),z=.5*t/(C*D);a[0]=Math.round(a[0]*G)/G,a[1]=Math.round(a[1]*z)/z;const L=r.inner;L[0]=a[0]-V,L[1]=a[1]-D,L[2]=a[0]+V,L[3]=a[1]+D,u&&this._shiftExtentToFitBounds(L,1/0,I);const B=r.outer;if(p&&6*V>O(p))T(B,p);else{if(Math.PI/2-Math.abs(h-Math.PI/2)<=.25*Math.PI)B[0]=L[0]-V,B[1]=L[1]-D,B[2]=L[2]+V,B[3]=L[3]+D;else{S(e.eye,o,se,d),c(re,a,se);let t=-Math.atan2(re[1],re[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));v(re,K[r],2*D),re[0]*=E,re[2]*=E,f(B,L,re)}}if(u&&this.longitudeCyclical)B[0]=this.longitudeCyclical.clamp(B[0]),B[2]=this.longitudeCyclical.clamp(B[2]),B[1]=Math.max(B[1],-I),B[3]=Math.min(B[3],I);else{const e=M(L,p,ne),t=M(B,p,ae);b(e,t)&&(B[2]=B[0],B[3]=B[1])}const W=Math.abs(L[2]-L[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,W),r.pixelRatioAdjustment=r.mapUnitsPerPixel/W}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),1===t&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),j(e,s,i)}get test(){}};function ee(e,t){const r=1e-5,s=F.ENABLE_OPTIMIZATIONS?r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]):0;return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],$.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],$.prototype,"readyToRun",null),e([h()],$.prototype,"_placementDirty",void 0),e([h()],$.prototype,"_contentUpdated",void 0),e([h()],$.prototype,"_isSpherical",null),e([h()],$.prototype,"worldToPCSRatio",null),e([h()],$.prototype,"renderer",void 0),e([h({constructOnly:!0})],$.prototype,"view",void 0),e([h({constructOnly:!0})],$.prototype,"groundView",void 0),e([h({constructOnly:!0})],$.prototype,"terrainSurface",void 0),e([h()],$.prototype,"suspended",null),e([h()],$.prototype,"updating",null),$=e([d("esri.views.3d.terrain.OverlayManager")],$);class te{constructor(){this.inner=P(),this.outer=P(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=J}}const re=x(),se=y(),ie=new te,ne=P(),ae=P(),oe=E(),le=new V;export{$ as OverlayManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{cyclicalPI as r}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as i,deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as a,sync as o,when as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../core/accessorSupport/decorators.js";import{subtract as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as u,subtract as p,copy as m,distance as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as _,scale as v,add as f}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,create as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as R}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as P,width as O,center as D,copy as T,intersection as M,contains as b,offset as j}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as I}from"../../../geometry/support/normalizeUtils.js";import{create as E,wrap as U}from"../../../geometry/support/ray.js";import{Sphere as V}from"../../../geometry/support/sphere.js";import{angleAroundAxis as C}from"../../../geometry/support/vector.js";import{y2lat as q}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as A}from"../state/utils/viewUtils.js";import{debugFlags as F}from"../support/debugFlags.js";import{DebugPoint as H}from"../support/debugUtils.js";import{OverlayRenderer as z}from"./OverlayRenderer.js";import{Intersector as G}from"../webgl-engine/lib/Intersector.js";import{fromValues as L}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as B}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as W,ensureTextureSize as Y}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as k}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as N,noBudget as X}from"../../support/Scheduler.js";import{Yield as Z}from"../../support/Yield.js";const J=1.3,K=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let Q,$=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){const{view:e}=this;this.renderer=new z({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new G(e.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([a(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),a(()=>e.state.camera.pixelRatio,t),a(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.groundView.requestRender(1)),a(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),a(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),o),l(()=>this.groundView,e=>e.on("elevation-change",()=>this.setPlacementDirty())),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(N.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),Q&&(Q.hide(),Q=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=I(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||F.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!(this.terrainSurface.enabled&&this.terrainSurface.freeze)&&this.groundView.ready}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?R(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return J/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(e){return this._contentUpdated=!1,this.renderer.time=e,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new B({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return Z;if(!this.view.pointsOfInterest?.centerOnSurfaceFrequent)return Z;const i=this._computeOverlayHeight(t);this._computeOverlayExtents(t,i,se),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,se.stretch);const s=this._updateOverlay(0,se.inner,i,1*se.pixelRatioAdjustment,se.mapUnitsPerPixel),n=O(se.inner)/O(se.outer),a=this._updateOverlay(1,se.outer,i,n*se.pixelRatioAdjustment,se.mapUnitsPerPixel);1!==s&&1!==a||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(r)),0===s&&0===a||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,i=e.fullHeight/e.pixelRatio*t,s=Math.ceil(1.5*Math.max(r,i)),{maxPreferredTexturePixels:n,maxTextureSize:a}=this.view.stage.renderView.renderingContext.parameters,o=.5*a;return W(Y({width:s,height:s},{maxPreferredTexturePixels:2*n,maxTextureSize:o})[1],o)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,r,i,s){if(0===this.renderer.overlays.length)return 0;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=s,n.pixelRatio=i,ee(t,n.extent)&&r===n.resolution)return a===s?0:2;n.setExtent(t),n.resolution=r;const o=D(n.extent);return n.renderLocalOrigin=L(o[0],o[1],0,"OV_"+this._latestOriginId++),1}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],i=this.renderer.overlays[1],s=this._pointIsInExtent(e,r.extent)?r:i;return(s.extent[2]-s.extent[0])/s.resolution}reloadShaders(){k(),this.requestRender(),this.runTask(X)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,i,s){const n=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,oe,t,r);if(null==n)return!1;const a=n.origin,o=u(ie,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.groundView.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(s)&&l.withinDistance(i)}_findHorizonBasedPointOfInterest(e,t){let s=.5;const n=.55,a=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:a+l,e.aboveGround?a-l:1/0),d=e.aboveGround;if("global"===this.view.viewingMode){const t=ie;le.radius=R(this.view.spatialReference).radius+h,le.closestPointOnSilhouette(U(e.eye,e.viewForward),t),p(t,t,e.eye);const i=r.normalize(C(e.viewForward,t,e.viewRight))/e.fovY+.5,a=i<=0||i>=1?.5:n;s=d?a*i:i+a*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),r=Math.tan(t),a=w(0,r,1,0),o=_(a,a,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);s=1===l||0===l?.5:d?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,s,o.distance,t)}_computeOverlayExtents(e,t,r){const{view:i}=this,n=i.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,a=y();this._findHorizonBasedPointOfInterest(e,a)||m(a,n);const o=this._renderSR;F.OVERLAY_SHOW_CENTER?(null==Q&&(Q=new H(i.graphics,"red")),Q.show(a,o)):null!=Q&&Q.hide();const l=Math.max(.1,g(e.eye,a)),h=A(i.renderCoordsHelper,n,e.eye),d=this._spatialReference;this._overlaySREqualsRenderSR||S(a,o,a,d);const u=this._isSpherical,p=this.groundView.groundExtent,_=!u&&d?.isGeographic,w=_&&d?1/R(d).metersPerDegree:1,x=i.state.contentPixelRatio,P=e.perScreenPixelRatio/x*l*w;r.mapUnitsPerPixel=P/this.worldToPCSRatio,r.stretch=this._overlayStretch;let D=t*P/2*r.stretch,j=!1,I=_?90:1/0;u&&p&&d&&(d.isWebMercator?(D/=Math.cos(q(a[1])),I=p[3]):(j=!0,D/=R(d).metersPerDegree,I=90),D>=I&&(D=I,a[1]=0,d.isWebMercator&&(a[0]=0)));let E=1;j&&(E=1/Math.max(.2,Math.cos(Math.abs(s(a[1])))),D*E>180&&(E=180/D),r.mapUnitsPerPixel*=E);const U=Math.log(2)/12;D=Math.exp(Math.round(Math.log(D)/U)*U);const V=D*E,C=32,z=.5*t/(C*V),G=.5*t/(C*D);a[0]=Math.round(a[0]*z)/z,a[1]=Math.round(a[1]*G)/G;const L=r.inner;L[0]=a[0]-V,L[1]=a[1]-D,L[2]=a[0]+V,L[3]=a[1]+D,u&&this._shiftExtentToFitBounds(L,1/0,I);const B=r.outer;if(p&&6*V>O(p))T(B,p);else{if(Math.PI/2-Math.abs(h-Math.PI/2)<=.25*Math.PI)B[0]=L[0]-V,B[1]=L[1]-D,B[2]=L[2]+V,B[3]=L[3]+D;else{S(e.eye,o,ie,d),c(re,a,ie);let t=-Math.atan2(re[1],re[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));v(re,K[r],2*D),re[0]*=E,re[2]*=E,f(B,L,re)}}if(u&&this.longitudeCyclical)B[0]=this.longitudeCyclical.clamp(B[0]),B[2]=this.longitudeCyclical.clamp(B[2]),B[1]=Math.max(B[1],-I),B[3]=Math.min(B[3],I);else{const e=M(L,p,ne),t=M(B,p,ae);b(e,t)&&(B[2]=B[0],B[3]=B[1])}const W=Math.abs(L[2]-L[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,W),r.pixelRatioAdjustment=r.mapUnitsPerPixel/W}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),1===t&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,i=e.y;return r>t[0]&&r<t[2]&&i>t[1]&&i<t[3]}_shiftExtentToFitBounds(e,t,r){let i=0,s=0;e[0]<-t?i=e[0]+t:e[2]>t&&(i=t-e[2]),e[1]<-r?s=e[1]+r:e[3]>r&&(s=r-e[3]),j(e,i,s)}get test(){}};function ee(e,t){const r=1e-5,i=F.ENABLE_OPTIMIZATIONS?r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]):0;return Math.abs(t[0]-e[0])<=i&&Math.abs(t[1]-e[1])<=i&&Math.abs(t[2]-e[2])<=i&&Math.abs(t[3]-e[3])<=i}e([h()],$.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],$.prototype,"readyToRun",null),e([h()],$.prototype,"_placementDirty",void 0),e([h()],$.prototype,"_contentUpdated",void 0),e([h()],$.prototype,"_isSpherical",null),e([h()],$.prototype,"worldToPCSRatio",null),e([h()],$.prototype,"renderer",void 0),e([h({constructOnly:!0})],$.prototype,"view",void 0),e([h({constructOnly:!0})],$.prototype,"groundView",void 0),e([h({constructOnly:!0})],$.prototype,"terrainSurface",void 0),e([h()],$.prototype,"updating",null),$=e([d("esri.views.3d.terrain.OverlayManager")],$);class te{constructor(){this.inner=P(),this.outer=P(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=J}}const re=x(),ie=y(),se=new te,ne=P(),ae=P(),oe=E(),le=new V;export{$ as OverlayManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,syncAndInitial as h,on as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{SyncRenderPlugin as x}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as S,renderHighlightBuffer as T}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as O,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as j}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as F}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as V}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q}from"../../support/Scheduler.js";import A from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends x{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new j,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:r,stage:s}=e.parent.view,i=s.renderer.fboCache,n=s.renderView.renderingContext,a=s.renderView.techniques;this._renderContext=new O(n,new P(i,r.viewingMode),a)}initialize(){const e=this._view,r=e.stage.renderView.waterTextures;this.addHandles([a(()=>r.updating,()=>this.events.emit("content-changed"),h),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),h),d(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>S(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},l),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const t=this._camera;t.near=1,t.far=1e4,t.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=t,this._bindParameters.updateLighting(new M(y()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(V)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(r?.done)break;(s.destroyed||e(s))&&(i.commitChanges()&&(t=!0,r?.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),r?.madeProgress()),r&&this.compact(r),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),10===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||4===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=H),!this.renders(o))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(10===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,L);const r=this._techniques.get(E,L);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,U[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(10===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),T(a,t,s,s,l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(V);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersectRay(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersectRay?.(e,r,t,s,i)??i}*intersectScreenPolygon(e,r,t){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let s=0;for(const{renderer:i}of this._sortedRenderers)s=yield*i.intersectScreenPolygon(e,r,t,s)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new I(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([u()],k.prototype,"hasHighlights",void 0),e([u()],k.prototype,"renderOccludedFlags",void 0),e([u()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],k.prototype,"parent",void 0),e([u({readOnly:!0})],k.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([u()],k.prototype,"isEmpty",null),k=e([p("esri.views.3d.terrain.OverlayRenderer")],k);class I{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const U=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,L=new F;L.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
2
+ import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,syncAndInitial as h,on as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{SyncRenderPlugin as x}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as S,renderHighlightBuffer as T}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as O,defaultRenderOccludedMask as C}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{T as j}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as F}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as V}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q}from"../../support/Scheduler.js";import A from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends x{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new j,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>10!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;const{state:r,stage:s}=e.parent.view,i=s.renderer.fboCache,n=s.renderView.renderingContext,a=s.renderView.techniques;this._renderContext=new O(n,new P(i,r.viewingMode),a)}initialize(){const e=this._view,r=e.stage.renderView.waterTextures;this.addHandles([a(()=>r.updating,()=>this.events.emit("content-changed"),h),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),h),d(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>S(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},l),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const t=this._camera;t.near=1,t.far=1e4,t.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=t,this._bindParameters.updateLighting(new M(y()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(V)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?B:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(r?.done)break;(s.destroyed||e(s))&&(i.commitChanges()&&(t=!0,r?.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),r?.madeProgress()),r&&this.compact(r),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._setOutput(this._renderTargets?.targets.find(r=>r.content===e)?.output??0);++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(t),s}_setOutput(e){const r=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=4===e?19:18,r}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._setOutput(e),10===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=B),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n,content:o}=r;if(this.isEmpty||4===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:a,_camera:h,_renderContext:d,_bindParameters:l}=this;if(h.pixelRatio=t.pixelRatio*i,this._setOutput(n),l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,4===o&&(d.renderOccludedMask=B),!this.renders(o))return d.renderOccludedMask=C,!1;const{resolution:c}=t,u=0===e,p=u?0:c;a.setViewport(p,0,c,c),this._bindTargetFBO(r),u&&(10===n?a.gl.clearBufferuiv(a.gl.COLOR,0,[0,0,0,0]):(a.setClearColor(0,0,0,0),a.clear(16384)));if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==o&&2!==o){this._techniques.precompile(E,H);const r=this._techniques.get(E,H);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,U[e]),a.bindTechnique(r,l,this._passParameters),a.screen.draw()}if(10===n){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),T(a,t,s,s,l,()=>this._renderAllGeometry(e,r),p)}else this._renderAllGeometry(e,r);return a.bindFramebuffer(null),d.renderOccludedMask=C,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(V);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersectRay(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersectRay?.(e,r,t,s,i)??i}*intersectScreenPolygon(e,r,t){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let s=0;for(const{renderer:i}of this._sortedRenderers)s=yield*i.intersectScreenPolygon(e,r,t,s)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new I(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([u()],k.prototype,"hasHighlights",void 0),e([u()],k.prototype,"renderOccludedFlags",void 0),e([u()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],k.prototype,"parent",void 0),e([u({readOnly:!0})],k.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([u()],k.prototype,"isEmpty",null),k=e([p("esri.views.3d.terrain.OverlayRenderer")],k);class I{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const U=[[1,.5,.5],[.5,.5,1]],B=4,H=new F;H.hasAlpha=!0;export{k as OverlayRenderer,B as overlayRenderOccludedFlag};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{distance as e,dist as t,len as o,subtract as r,normalize as i,dot as n,sub as s,equals as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a,clone as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{containsXY as d}from"../../../geometry/support/aaBoundingRect.js";import{earth as c}from"../../../geometry/support/Ellipsoid.js";import{enableTerrainInternalChecks as $,internalAssert as m,neighborEdgeIndices as u,neighborCornerIndices as p,v32s as f,lij2s as h}from"./terrainUtils.js";function E(E){if(!$)return;const S=E.tile;if(!S.loaded||!S.intersectsClippingArea||0===S.level)return void m(S?.loaded);const V=S.surface.groundExtent;if(null!=V&&!S.intersectsExtent(V))return;const w=u.map((e,t)=>null!=V&&(t<2?-1:1)*(S.extent[3-t]-V[3-t])<0),T=S.level;m(0===E.dirtyCorners),m(0===E.dirtyEdges),m(0===E.dirtyEdgeResolutions),m(!E.numVerticesPerSideChanged),m(!E.samplerDataChanged),m(!E.clippingAreaChanged),m(!E.wireframeChanged);const M=p.map(e=>S.findNeighborCornerTileExact(e,e=>!e.intersectsClippingArea||e.loaded||e.level===S.level)??null).map(e=>e?.intersectsClippingArea?e:null),O=E.geometryState;for(let e=0;e<4;++e){const t=O.cornerPeerNeighbors[e],o=M[e];m(o===t,`Tile[${S.lij}].corner[${e}] out of date: cur=[${t?.lij}] exp=[${o?.lij}]`)}u.forEach(($,u)=>{if(w[u])return;const p=S.findNeighborTile($,e=>(e.level===T||e.loaded)&&e.intersectsClippingArea);if(!p){const e=!S.surface.updatingRootTiles&&null!=S.surface.rootTiles&&S.surface.rootTiles.length>0&&S.shouldHaveNeighbor($);return void m(!e)}m(p.loaded||p.level===S.level),m(p===E.geometryState.edgePeerNeighbors[u]);const P=T-p.level;if(!p.loaded)return m(!p.leaf),void m(0===P);const V=p.renderData;m(S.isEdgeNeighbor(p,$)),m(P>=0);const M=2**P;if(P<0)return void m(!1);const O=S.renderData,D=O.geometry,X=O.localOrigin,A=D.getEdgeCount(u),R=D.numVerticesPerSide-1,B=V.geometry;if(!B)return void m(!1);const H=V.localOrigin,I=E.geometryState.edgePeerNeighbors[u];if(I?.loaded){const e=I.renderData;m(O.geometryState.edgePeerNeighborSamplerVersions[u]===e.geometryState.samplerDataVersion),m(E.geometryState.edgePeerNeighborSamplerVersions[u]===e.geometryState.samplerDataVersion)}const U=(u+2)%4,k=B.getEdgeCount(U),q=A-1,z=k-1;m(q*M===z,`Tile[${S.lij}]:e${u},res=${q} edgeRes mismatch with Neighbor[${p.lij}]:e${U},res=${z} (expected:${q*M})`);const F=S.extent,G=0===$||4===$,J=k-1,K=J>>P,L=A-1;if(K<1)return void m(1===L);m(K===L),m(!(K&K-1));const Q=B.numVerticesPerSide-1;m(P>0||K===Math.max(Q,R));const W=S.getNeighborEdgeStartVertexIndex(u,p);m(0<=W&&W<M);const Y=W*K;m(0<=Y&&Y<=J-K);let Z=0,_=Y;D.getEdgeVertexPosition(u,v,X,0),D.getEdgeVertexPosition(u,x,X,A-1);const ee=e(v,x),te=Math.max(C,1e-4*ee);for(let e=0;e<=K;++e){D.getEdgeVertexPosition(u,v,X,Z),B.getEdgeVertexPosition(U,x,H,_);const E=e/K,C=G?F[0]+E*(F[2]-F[0]):6===$?F[0]:F[2],P=G?4===$?F[1]:F[3]:F[1]+E*(F[3]-F[1]),w=S.surface.groundExtent;if(null==w||d(w,C,P)){const e=t(v,x),d=o(v)-c.radius,$=o(x)-c.radius,E=e<te;if(!E){console.warn(`Tile edge vertex position mismatch: between [${S.lij}].edge${u}[${Z}/${A}] and [${p.lij}].edge${U}[${_}/${k}]`),null!=w&&console.warn(" surface extent= ",w," x,y=",C,",",P);const t=a();r(t,O.localOrigin,V.localOrigin),o(t)>0&&console.warn(` localOrigins: ${O.localOrigin} vs ${V.localOrigin} d=${o(t)} [${t}]`);(()=>{const e=g(v),t=g(x);S.updateEdgeElevations(),p.updateEdgeElevations(),D.getEdgeVertexPosition(u,v,X,Z),B.getEdgeVertexPosition(U,x,H,_);const r=a();s(r,v,e),o(r)>0&&console.warn(` XXX Tile[${S.lij}] edge out of date: ${e} vs ${v} d=${o(r)} [${r}]`),s(r,x,t),o(r)>0&&console.warn(` XXX Neighbor[${p.lij}] edge out of date: ${t} vs ${x} d=${o(r)} [${r}]`)})();const i=D.getEdgeCount(u),n=B.getEdgeCount(U);m(E,`Mismatch in tile [${S.lij}].edge[${u}][${Z}/${i}] vs neighbor [${p.lij}].edge[${U}][${_}/${n}] ${f(v)} vs ${f(x)} dist=${e} h(t|n|d)=${d}|${$}|${$-d}`)}D.getEdgeNormal(u,b,Z),B.getEdgeNormal(U,j,_),i(y,b),i(N,j);const T=n(y,N),M=1-T<.01||!1||S===p;if(!M){const e=a();s(e,b,j);const t=()=>`Mismatch in tile edge normal ${h(S.lij)} (${Z}/${A-1}) edge ${u} vs neighbor ${h(p.lij)} (${_}/${k-1}) nedge ${U} :${f(b)} vs ${f(j)} dot = ${T} : ${f(e)}`;console.warn("Mismatch in tile edge normal: ",t());{S.updateEdgeElevations(),p.updateEdgeElevations();const e=a(),t=a();D.getEdgeNormal(u,e,Z),B.getEdgeNormal(U,t,_),l(b,e)||console.warn("Missing update in tile normal: ",f(b)," => ",f(e)),l(j,t)||console.warn("Missing update in neighbor normal: ",f(j)," => ",f(t))}m(M,t())}}Z+=1,_+=1}}),$&&m(P.every(e=>E.geometryState.edgeResolutions[e]>0))}const v=a(),x=a(),b=a(),j=a(),y=a(),N=a(),C=1,P=[0,1,2,3];export{E as checkPatchGeometryWaterproofness};
2
+ import{distance as e,dist as r,len as o,subtract as t,normalize as i,dot as l,sub as n,equals as a}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,clone as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{containsXY as d}from"../../../geometry/support/aaBoundingRect.js";import{earth as $}from"../../../geometry/support/Ellipsoid.js";import{enableTerrainInternalChecks as c,internalAssert as p,neighborEdgeIndices as m,neighborCornerIndices as u,v32s as f,lij2s as h}from"./terrainUtils.js";function j(j){if(!c)return;const S=j.tile;if(!S.loaded||!S.intersectsClippingArea||0===S.level)return void p(S.loaded,`waterproof.tile-not-loaded: Tile[${S.lij}] has indexed geometry but is not loaded`);const V=S.surface.groundExtent;if(null!=V&&!S.intersectsExtent(V))return;const N=m.map((e,r)=>null!=V&&(r<2?-1:1)*(S.extent[3-r]-V[3-r])<0),P=S.level;p(0===j.dirtyCorners,`waterproof.dirty-corners: Tile[${S.lij}] dirtyCorners=${j.dirtyCorners}`),p(0===j.dirtyEdges,`waterproof.dirty-edges: Tile[${S.lij}] dirtyEdges=${j.dirtyEdges}`),p(0===j.dirtyEdgeResolutions,`waterproof.dirty-edge-resolutions: Tile[${S.lij}] dirtyEdgeResolutions=${j.dirtyEdgeResolutions}`),p(!j.numVerticesPerSideChanged,`waterproof.vertices-per-side-changed: Tile[${S.lij}] numVerticesPerSideChanged=true`),p(!j.samplerDataChanged,`waterproof.sampler-data-changed: Tile[${S.lij}] samplerDataChanged=true`),p(!j.clippingAreaChanged,`waterproof.clipping-area-changed: Tile[${S.lij}] clippingAreaChanged=true`),p(!j.wireframeChanged,`waterproof.wireframe-changed: Tile[${S.lij}] wireframeChanged=true`);const D=u.map(e=>S.findNeighborCornerTileExact(e,e=>!e.intersectsClippingArea||e.loaded||e.level===S.level)??null).map(e=>e?.intersectsClippingArea?e:null),O=j.geometryState;for(let e=0;e<4;++e){const r=O.cornerPeerNeighbors[e],o=D[e];p(o===r,`waterproof.corner-peer-mismatch: Tile[${S.lij}].corner[${e}] current=[${r?.lij}] expected=[${o?.lij}]`)}m.forEach((c,m)=>{if(N[m])return;const u=S.findNeighborTile(c,e=>(e.level===P||e.loaded)&&e.intersectsClippingArea);if(!u){const e=!S.surface.updatingRootTiles&&null!=S.surface.rootTiles&&S.surface.rootTiles.length>0&&S.shouldHaveNeighbor(c);return void p(!e,`waterproof.required-neighbor-missing: Tile[${S.lij}].edge[${m}]`)}p(u.loaded||u.level===S.level,`waterproof.invalid-neighbor-state: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}] loaded=${u.loaded}`);const C=j.geometryState.edgePeerNeighbors[m];p(u===C,`waterproof.peer-neighbor-mismatch: Tile[${S.lij}].edge[${m}] current=[${C?.lij}] expected=[${u.lij}] dirtyEdges=${j.dirtyEdges} dirtyEdgeResolutions=${j.dirtyEdgeResolutions}`);const V=P-u.level;if(!u.loaded)return p(!u.leaf,`waterproof.unloaded-neighbor-is-leaf: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}]`),void p(0===V,`waterproof.unloaded-neighbor-level-mismatch: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}] levelDelta=${V}`);const D=u.renderData;p(S.isEdgeNeighbor(u,c),`waterproof.invalid-edge-neighbor: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}]`),p(V>=0,`waterproof.higher-level-peer-neighbor: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}] levelDelta=${V}`);const O=2**V;if(V<0)return void p(!1,`waterproof.negative-level-delta: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}] levelDelta=${V}`);const R=S.renderData,A=R.geometry,M=R.localOrigin,X=A.getEdgeCount(m),q=A.numVerticesPerSide-1,B=D.geometry;if(!B)return void p(!1,`waterproof.loaded-neighbor-without-geometry: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}]`);const H=D.localOrigin,I=j.geometryState.edgePeerNeighbors[m];if(I?.loaded){const e=I.renderData;p(R.geometryState.edgePeerNeighborSamplerVersions[m]===e.geometryState.samplerDataVersion,`waterproof.tile-peer-sampler-version-mismatch: Tile[${S.lij}].edge[${m}] stored=${R.geometryState.edgePeerNeighborSamplerVersions[m]} neighbor[${I.lij}]=${e.geometryState.samplerDataVersion}`),p(j.geometryState.edgePeerNeighborSamplerVersions[m]===e.geometryState.samplerDataVersion,`waterproof.render-peer-sampler-version-mismatch: Tile[${S.lij}].edge[${m}] stored=${j.geometryState.edgePeerNeighborSamplerVersions[m]} neighbor[${I.lij}]=${e.geometryState.samplerDataVersion}`)}const U=(m+2)%4,k=B.getEdgeCount(U),z=X-1,F=k-1;p(z*O===F,`waterproof.edge-resolution-mismatch: Tile[${S.lij}].edge[${m}] resolution=${z} neighbor[${u.lij}].edge[${U}] resolution=${F} expected=`+z*O);const G=S.extent,J=0===c||4===c,K=k-1,L=K>>V,Q=X-1;if(L<1)return void p(1===Q,`waterproof.subvertex-neighbor-overlap: Tile[${S.lij}].edge[${m}] tileOverlapCount=${Q} neighborOverlapCount=${L}`);p(L===Q,`waterproof.overlap-count-mismatch: Tile[${S.lij}].edge[${m}] tileOverlapCount=${Q} neighbor[${u.lij}].edge[${U}] neighborOverlapCount=${L}`),p(!(L&L-1),`waterproof.overlap-count-not-power-of-two: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}].edge[${U}] overlapCount=${L}`);const W=B.numVerticesPerSide-1;p(V>0||L===Math.max(W,q),`waterproof.same-level-segment-count-mismatch: Tile[${S.lij}].edge[${m}] tileSegments=${q} neighbor[${u.lij}].edge[${U}] neighborSegments=${W} overlapCount=${L}`);const Y=S.getNeighborEdgeStartVertexIndex(m,u);p(0<=Y&&Y<O,`waterproof.edge-start-offset-out-of-range: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}] offset=${Y} scale=${O}`);const Z=Y*L;p(0<=Z&&Z<=K-L,`waterproof.neighbor-edge-offset-out-of-range: Tile[${S.lij}].edge[${m}] neighbor[${u.lij}].edge[${U}] offset=${Z} validMax=`+(K-L));let _=0,ee=Z;A.getEdgeVertexPosition(m,v,M,0),A.getEdgeVertexPosition(m,b,M,X-1);const re=e(v,b),oe=Math.max(x,1e-4*re);for(let e=0;e<=L;++e){A.getEdgeVertexPosition(m,v,M,_),B.getEdgeVertexPosition(U,b,H,ee);const j=e/L,x=J?G[0]+j*(G[2]-G[0]):6===c?G[0]:G[2],C=J?4===c?G[1]:G[3]:G[1]+j*(G[3]-G[1]),V=S.surface.groundExtent;if(null==V||d(V,x,C)){const e=r(v,b),d=o(v)-$.radius,c=o(b)-$.radius,j=e<oe;if(!j){console.warn(`Tile edge vertex position mismatch: between [${S.lij}].edge${m}[${_}/${X}] and [${u.lij}].edge${U}[${ee}/${k}]`),null!=V&&console.warn(" surface extent= ",V," x,y=",x,",",C);const r=g();t(r,R.localOrigin,D.localOrigin),o(r)>0&&console.warn(` localOrigins: ${R.localOrigin} vs ${D.localOrigin} d=${o(r)} [${r}]`);(()=>{const e=s(v),r=s(b);S.updateEdgeElevations(),u.updateEdgeElevations(),A.getEdgeVertexPosition(m,v,M,_),B.getEdgeVertexPosition(U,b,H,ee);const t=g();n(t,v,e),o(t)>0&&console.warn(` XXX Tile[${S.lij}] edge out of date: ${e} vs ${v} d=${o(t)} [${t}]`),n(t,b,r),o(t)>0&&console.warn(` XXX Neighbor[${u.lij}] edge out of date: ${r} vs ${b} d=${o(t)} [${t}]`)})();const i=A.getEdgeCount(m),l=B.getEdgeCount(U);p(j,`waterproof.edge-position-mismatch: Tile[${S.lij}].edge[${m}][${_}/${i}] neighbor[${u.lij}].edge[${U}][${ee}/${l}] ${f(v)} vs ${f(b)} dist=${e} h(t|n|d)=${d}|${c}|${c-d}`)}A.getEdgeNormal(m,w,_),B.getEdgeNormal(U,E,ee),i(y,w),i(T,E);const N=l(y,T),P=1-N<.01||!1||S===u;if(!P){const e=g();n(e,w,E);const r=()=>`waterproof.edge-normal-mismatch: Tile${h(S.lij)}.edge[${m}][${_}/${X-1}] neighbor${h(u.lij)}.edge[${U}][${ee}/${k-1}]:${f(w)} vs ${f(E)} dot = ${N} : ${f(e)}`;console.warn("Mismatch in tile edge normal: ",r());{S.updateEdgeElevations(),u.updateEdgeElevations();const e=g(),r=g();A.getEdgeNormal(m,e,_),B.getEdgeNormal(U,r,ee),a(w,e)||console.warn("Missing update in tile normal: ",f(w)," => ",f(e)),a(E,r)||console.warn("Missing update in neighbor normal: ",f(E)," => ",f(r))}p(P,r())}}_+=1,ee+=1}}),c&&p(C.every(e=>j.geometryState.edgeResolutions[e]>0),`waterproof.nonpositive-edge-resolution: Tile[${S.lij}] edgeResolutions=${j.geometryState.edgeResolutions.join(",")}`)}const v=g(),b=g(),w=g(),E=g(),y=g(),T=g(),x=1,C=[0,1,2,3];export{j as checkPatchGeometryWaterproofness};