@arcgis/core 4.34.0-next.2 → 4.34.0-next.4

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 (260) hide show
  1. package/Map.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{bf3555f91492a1a3b613.js → 09f76ca9b47b465c934f.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{397b15d46f22718c9f38.js → 0d78fc2c2bc1152f84db.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{ead5d4e271effc04def3.js → 1415d4e2f5f3193be004.js} +1 -1
  6. package/assets/esri/core/workers/chunks/17e43a050fbf8dc87588.js +1 -0
  7. package/assets/esri/core/workers/chunks/{ac2607f1e8cd2e99907c.js → 1bc4cb6366e733a7c7ef.js} +2 -2
  8. package/assets/esri/core/workers/chunks/1ee6e9a88f0676032e91.js +1 -0
  9. package/assets/esri/core/workers/chunks/{ece68a25651ef03fc95d.js → 342f61e784c9364a493b.js} +1 -1
  10. package/assets/esri/core/workers/chunks/3adcf78ed1e7cd82666d.js +1 -0
  11. package/assets/esri/core/workers/chunks/{07e58dff44fcbb3b3539.js → 562800b0af52a38a311b.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{32ee2708edd307954125.js → 7174150bf7595c22f976.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{e77371ddbaf4b2d9be8d.js → 74c0db9e3a62e9839b23.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{aba19485b6cdcb70dac6.js → 8008f5479f4d16964088.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{40f54c4f8ae63c6f3df9.js → a32dcd5bc4680374d30c.js} +1 -1
  16. package/assets/esri/core/workers/chunks/ad4f65d764654c70a117.js +1 -0
  17. package/assets/esri/core/workers/chunks/{d7b640f7a181bd26c7c7.js → bac5e1d50b69f0d94694.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{9ca480eb8b2312381ccf.js → bcadcb709e622f2aaaf9.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{677af0281e4fc9f3bd98.js → c6cd8784a3e222eb2d4a.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{54f4a1131f99468db076.js → d33a5d79f2163ad62b1d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{e3c1aea34ece8336dae1.js → e9aa1d9ded8a52a40c57.js} +1 -1
  22. package/assets/esri/core/workers/chunks/f2aa8090827086c62dde.js +1 -0
  23. package/assets/esri/core/workers/chunks/fd4c020297badcb81947.js +1 -0
  24. package/assets/esri/core/workers/chunks/{b160dcbea6256e0cf689.js → feaf79b69d2e2a1f2aa2.js} +1 -1
  25. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  26. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  27. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  28. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  29. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  30. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  31. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  32. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  33. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  34. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  35. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  36. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  37. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  38. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  39. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  40. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  41. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  42. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  43. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  44. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  45. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  46. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  47. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  48. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  49. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  50. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  51. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  52. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  53. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  54. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  55. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  56. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  58. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  59. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  60. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  61. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  62. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  63. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  64. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  65. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  66. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  67. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  68. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  69. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  70. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  71. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  72. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  73. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  74. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  75. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  76. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  77. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  78. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  79. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  80. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  81. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  82. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  83. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  84. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  85. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  86. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  87. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  88. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  89. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  90. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  91. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  92. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  93. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  94. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  95. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  96. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  97. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  98. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  99. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  100. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  101. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  102. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  103. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  104. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  105. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  106. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  107. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  108. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  109. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  110. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  111. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  112. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  113. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  114. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  115. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  116. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  117. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  118. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  119. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  120. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  121. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  122. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  123. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  124. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  125. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  126. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  127. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  128. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  129. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  130. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  131. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  132. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  133. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  134. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  135. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  136. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  137. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  138. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  139. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  140. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  141. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  142. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  143. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  144. package/chunks/Laserlines.glsl.js +2 -2
  145. package/chunks/cameraUtilsSpherical.js +1 -1
  146. package/chunks/sphere.js +1 -1
  147. package/chunks/vec42.js +1 -1
  148. package/config.js +1 -1
  149. package/core/accessorSupport/ensureType.js +1 -1
  150. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  151. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  152. package/effects/FocusArea.js +5 -0
  153. package/{views → effects}/FocusAreaOutline.js +1 -1
  154. package/{views → effects}/FocusAreas.js +1 -1
  155. package/geometry/support/frustum.js +1 -1
  156. package/geometry/support/sphere.js +1 -1
  157. package/interfaces.d.ts +137 -66
  158. package/kernel.js +1 -1
  159. package/layers/VideoLayer.js +1 -1
  160. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  161. package/layers/video/VideoController.js +1 -1
  162. package/networks/support/UNTraceConfiguration.js +1 -1
  163. package/networks/support/typeUtils.js +1 -1
  164. package/package.json +1 -1
  165. package/rest/knowledgeGraph/GraphAddFieldIndexResult.js +5 -0
  166. package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +1 -1
  167. package/rest/knowledgeGraph/GraphAddPropertyResult.js +1 -1
  168. package/rest/knowledgeGraph/GraphDataModelOperationResult.js +5 -0
  169. package/rest/knowledgeGraph/GraphDeleteFieldIndexResult.js +5 -0
  170. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
  171. package/rest/knowledgeGraph/GraphDeletePropertyResult.js +1 -1
  172. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.js +1 -1
  173. package/rest/knowledgeGraph/GraphUpdatePropertyResult.js +1 -1
  174. package/rest/knowledgeGraph/GraphUpdateSearchIndexResult.js +1 -1
  175. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  176. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  177. package/rest/knowledgeGraphService.js +1 -1
  178. package/rest/networks/support/CircuitPath.js +5 -0
  179. package/rest/networks/support/CircuitPathConnectivityElement.js +5 -0
  180. package/rest/networks/support/TraceLocation.js +1 -1
  181. package/rest/networks/support/TraceResult.js +1 -1
  182. package/smartMapping/renderers/pieChart.js +1 -1
  183. package/smartMapping/renderers/predominance.js +1 -1
  184. package/smartMapping/renderers/support/rendererUtils.js +1 -1
  185. package/smartMapping/renderers/support/spikeUtils.d.ts +4 -0
  186. package/support/revision.js +1 -1
  187. package/views/2d/engine/Bitmap.js +1 -1
  188. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  189. package/views/2d/engine/vectorTiles/GlyphMosaic.js +1 -1
  190. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  191. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  192. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  193. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  194. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  195. package/views/2d/engine/webgl/Overlay.js +1 -1
  196. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  197. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  198. package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
  199. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  200. package/views/2d/engine/webgl/effects/post-processing/Colorize.js +1 -1
  201. package/views/2d/engine/webgl/effects/post-processing/DropShadow.js +1 -1
  202. package/views/2d/engine/webgl/effects/post-processing/Opacity.js +1 -1
  203. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  204. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  205. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  206. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
  207. package/views/2d/layers/VideoLayerView2D.js +1 -1
  208. package/views/3d/FocusAreasView.js +1 -1
  209. package/views/3d/camera/constraintUtils/distance.js +1 -1
  210. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  211. package/views/3d/environment/LocalAtmosphere.js +1 -1
  212. package/views/3d/environment/MarsAtmosphere.js +1 -1
  213. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  214. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  215. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  216. package/views/3d/state/NearFarHeuristic.js +1 -1
  217. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  218. package/views/3d/state/utils/navigationUtils.js +1 -1
  219. package/views/3d/support/engineContent/marker.js +1 -1
  220. package/views/3d/support/geometryUtils/sphere.js +1 -1
  221. package/views/3d/support/sunUtils.js +1 -1
  222. package/views/3d/terrain/OverlayManager.js +1 -1
  223. package/views/3d/terrain/OverlayRenderer.js +1 -1
  224. package/views/3d/webgl/RenderCamera.js +1 -1
  225. package/views/3d/webgl/RenderNode.js +1 -1
  226. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  227. package/views/3d/webgl-engine/effects/focusArea/FocusAreaOutlineItem.js +5 -0
  228. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  229. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  230. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  231. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  232. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  233. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  234. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  235. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  236. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  237. package/views/VideoView.js +1 -1
  238. package/views/support/imageReprojection.js +1 -1
  239. package/views/webgl/RenderingContext.js +1 -1
  240. package/views/webgl/Texture.js +1 -1
  241. package/views/webgl/rasterUtils.js +1 -1
  242. package/widgets/Daylight/DaylightViewModel.js +1 -1
  243. package/widgets/Editor/EditorViewModel.js +1 -1
  244. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  245. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  246. package/widgets/Editor/UpdateWorkflow.js +1 -1
  247. package/widgets/Editor/components/Notices.js +1 -1
  248. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  249. package/widgets/Editor/workflowUtils.js +1 -1
  250. package/widgets/Editor.js +1 -1
  251. package/widgets/FeatureTable/FieldColumn.js +1 -1
  252. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  253. package/assets/esri/core/workers/chunks/094e8aae6dada24c8115.js +0 -1
  254. package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +0 -1
  255. package/assets/esri/core/workers/chunks/62b2d3720693c93a60f2.js +0 -1
  256. package/assets/esri/core/workers/chunks/a0f2df8ca7cd14bfa013.js +0 -1
  257. package/assets/esri/core/workers/chunks/b06cb23048c32940f5de.js +0 -1
  258. package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +0 -1
  259. package/views/FocusArea.js +0 -5
  260. package/views/FocusAreaOutlineItem.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{c as e,d as r,f as n,j as t,E as o}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{h as s,l as a}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as f,interactionDirectionTowardsConstraintMinimization as m,adjustRangeForInteraction as u}from"./common.js";import{InteractionType as p}from"./InteractionType.js";function d(e,r,n=f){if(!e.state.isLocal)return 0;const t=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||t===1/0)return 0;x.min=0,x.max=t,l(e,n,x);const o=O(e,r),i=x.max-o;return i>=-1e-6?0:i}function y(t,o,i=f){const u=d(t,o,i);if(0===u)return!1;const p=t.pointsOfInterest.surfaceOrigin;if(!p.renderLocation)return!1;const y=O(t,o)+u,l=e(L,o.eye),x=m(o,i.interactionDirection,j(o,p.renderLocation,h),I);if(!s(a(p.renderLocation,y),c(o.eye,x),C))return!1;o.eye=C;const N=r(g,o.eye,l);o.center=n(C,o.center,N);const k=t.renderCoordsHelper.getAltitude(o.center),v=t.renderCoordsHelper.intersectInfiniteManifold(o.ray,k,C);return null!=v&&(o.center=v),!0}function l(e,r,n){const t=r.interactionType;if(t===p.NONE)return;const{min:o,max:i}=n,{interactionStartCamera:c,interactionFactor:s}=r;if(!c)return;const a=t===p.ZOOM||t===p.PAN,f=d(e,c),m=0===f?0:O(e,c);n.min=o,n.max=i;u(f,m,a,s,.05*m,n)}function O(e,r){const n=e.pointsOfInterest.surfaceOrigin;return n.renderLocation?t(r.eye,n.renderLocation):0}function j(e,r,n){return o(n,e.eye,r)}const x={min:0,max:0},L=i(),g=i(),I=i(),h=i(),C=i();export{y as applyDistanceConstraint,d as getDistanceConstraintError};
5
+ import{c as e,d as r,f as n,j as t,E as o}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{i as s,l as a}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as f,interactionDirectionTowardsConstraintMinimization as m,adjustRangeForInteraction as u}from"./common.js";import{InteractionType as p}from"./InteractionType.js";function d(e,r,n=f){if(!e.state.isLocal)return 0;const t=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||t===1/0)return 0;x.min=0,x.max=t,l(e,n,x);const o=O(e,r),i=x.max-o;return i>=-1e-6?0:i}function y(t,o,i=f){const u=d(t,o,i);if(0===u)return!1;const p=t.pointsOfInterest.surfaceOrigin;if(!p.renderLocation)return!1;const y=O(t,o)+u,l=e(L,o.eye),x=m(o,i.interactionDirection,j(o,p.renderLocation,h),I);if(!s(a(p.renderLocation,y),c(o.eye,x),C))return!1;o.eye=C;const N=r(g,o.eye,l);o.center=n(C,o.center,N);const k=t.renderCoordsHelper.getAltitude(o.center),v=t.renderCoordsHelper.intersectInfiniteManifold(o.ray,k,C);return null!=v&&(o.center=v),!0}function l(e,r,n){const t=r.interactionType;if(t===p.NONE)return;const{min:o,max:i}=n,{interactionStartCamera:c,interactionFactor:s}=r;if(!c)return;const a=t===p.ZOOM||t===p.PAN,f=d(e,c),m=0===f?0:O(e,c);n.min=o,n.max=i;u(f,m,a,s,.05*m,n)}function O(e,r){const n=e.pointsOfInterest.surfaceOrigin;return n.renderLocation?t(r.eye,n.renderLocation):0}function j(e,r,n){return o(n,e.eye,r)}const x={min:0,max:0},L=i(),g=i(),I=i(),h=i(),C=i();export{y as applyDistanceConstraint,d as getDistanceConstraintError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as e}from"../../../../core/compilerUtils.js";import{acosClamped as t,clamp as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as o,t as c,g as u,f as l,k as m,j as d,e as f,n as p,l as M}from"../../../../chunks/vec32.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as y}from"../../../../geometry/ellipsoidUtils.js";import{k as C,b as T,t as I}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as O,hasConstraintType as A,adjustRangeForInteraction as x}from"./common.js";import{ConstraintTypes as S}from"./ConstraintTypes.js";import{InteractionType as v}from"./InteractionType.js";import{TiltMode as R}from"./TiltMode.js";import{viewAngle as j}from"../../state/utils/viewUtils.js";function w(t,r,n,i=!0){W.eyeCenterDistance=0,W.requiresTwoSteps=!1;const s=U(t,r,n,O,W);if(0===s)return!1;switch(a(_,-s,r.viewRight),n.tiltMode){case R.LOOK_AROUND:c(K,r.viewForward,_),u(K,K,W.eyeCenterDistance),r.center=l(z,r.eye,K);break;case R.TUMBLE:o(K,r.center,r.eye),c(K,K,_),r.eye=o(z,r.center,K);break;default:e(n.tiltMode)}return r.up=c(z,r.up,_),!W.requiresTwoSteps||!i||w(t,r,n,!1)}function U(e,t,r,n=O,i){if(!e.state.constraints.tilt)return 0;const a=Math.min(t.relativeElevation*J,t.distance),s=e.state.constraints.tilt(a,Q);return N(e,r,s),n.interactionType===v.TUMBLE&&A(n.selection,S.ALTITUDE)&&B(e,n.interactionStartCamera,s),r.tiltMode===R.LOOK_AROUND||n.tiltMode===R.LOOK_AROUND?P(e,t,s,i):D(e,t,s)}function D(e,t,n){const i=j(e.renderCoordsHelper,t.center,t.eye),a=i-r(i,n.min,n.max);return g(a)?a:0}function P(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return E(e,t,r,n);case"local":return b(e,t,r,n)}}function b(e,t,n,i){const a=j(e.renderCoordsHelper,t.center,t.eye),s=r(a,n.min,n.max),o=a-s;if(!g(o))return 0;if(i){const r=Math.abs(e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude),n=e.renderCoordsHelper.getAltitude(t.eye)-r,a=Math.max(Math.cos(s),1e-4);Math.abs(a)>1e-4?i.eyeCenterDistance=n/a:i.eyeCenterDistance=t.distance}return o}function E(e,t,n,i){const a=L(e,t,V),s=r(a.tiltAtCenter,n.min,n.max);if(!g(a.tiltAtCenter-s))return 0;let o,c;return a.centerIsOnSurface?(o=q(a),c=k(a,o)):(o=a.constraints.clampTilt(a.distance,a.tiltAtCenter),i&&o<Math.PI/2&&(i.requiresTwoSteps=!0,o=Math.PI/2-1e-5),c=F(a,o)),i&&(i.eyeCenterDistance=H(a,o)),c}function L(e,r,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+y(e.spatialReference).radius,s=e.renderCoordsHelper.intersectManifold(r.ray,i,z);return n.distance=Math.min(r.relativeElevation*J,r.distance),n.centerIsOnSurface=!1,null!=s?(n.distance=Math.min(r.relativeElevation*J,d(r.eye,s)),n.tiltAtCenter=j(e.renderCoordsHelper,s,r.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=j(e.renderCoordsHelper,r.center,r.eye):(C(T(I,a),r.ray,z),n.distance=Math.min(r.relativeElevation*J,d(r.eye,z)),n.tiltAtCenter=t(-f(r.viewForward,p(z,z)))),n.radius=a,n.eyeRadius=M(r.eye),n.constraints=e.state.constraints,n}function g(e){return Math.abs(e)>1e-9}function q(e){const{constraints:t,distance:r,tiltAtCenter:n}=e;let i=n,a=t.clampTilt(r,n);const s=H(e,a);if(t.clampTilt(s,n)===a)return a;let o=0;for(;o<10&&g(a-i);){const r=(i+a)/2,n=H(e,r);g(t.clampTilt(n,r)-r)?i=r:a=r,o++}return a}function H(e,t){if(!e.centerIsOnSurface)return e.distance;const i=Math.PI-r(t,0,Math.PI),a=n(e.radius/e.eyeRadius*Math.sin(i)),s=Math.PI-i-a,o=Math.sin(s)/Math.sin(i);if(e.eyeRadius<e.radius&&o>1){const t=Math.PI-a,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return o*e.eyeRadius}function k(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function N(e,t,r){if(t.interactionType===v.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:a,max:s}=r,o=U(e,n,O,t),c=0===o?0:j(e.renderCoordsHelper,n.center,n.eye);r.min=a,r.max=s,t.interactionType===v.TUMBLE?(A(t.selection,S.ALTITUDE)&&B(e,n,r),x(o,c,!0,i,G,r)):x(o,c,!1,i,G,r)}function B(e,r,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!r)return;const a=m(r.center),s=Math.sqrt(a),o=r.distance,c=y(e.spatialReference).radius,u=i.altitude.min+c,l=i.altitude.max+c,d=(u*u-o*o-a)/(-2*s*o),f=(l*l-o*o-a)/(-2*s*o);n.min=Math.max(n.min,Math.min(Math.PI-t(f),n.max)),n.max=Math.min(n.max,Math.PI-t(d))}const K=h(),_=s(),z=h(),G=i(5),J=30,Q={min:0,max:0},V={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,distance:0,tiltAtCenter:0},W={eyeCenterDistance:0,requiresTwoSteps:!1};export{w as applyTiltConstraint,U as getTiltConstraintError};
5
+ import{neverReached as e}from"../../../../core/compilerUtils.js";import{acosClamped as t,clamp as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as o,t as c,g as u,f as l,k as m,j as d,e as f,n as p,l as M}from"../../../../chunks/vec32.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as y}from"../../../../geometry/ellipsoidUtils.js";import{j as C,b as T,t as I}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as O,hasConstraintType as A,adjustRangeForInteraction as x}from"./common.js";import{ConstraintTypes as S}from"./ConstraintTypes.js";import{InteractionType as j}from"./InteractionType.js";import{TiltMode as v}from"./TiltMode.js";import{viewAngle as R}from"../../state/utils/viewUtils.js";function w(t,r,n,i=!0){W.eyeCenterDistance=0,W.requiresTwoSteps=!1;const s=U(t,r,n,O,W);if(0===s)return!1;switch(a(_,-s,r.viewRight),n.tiltMode){case v.LOOK_AROUND:c(K,r.viewForward,_),u(K,K,W.eyeCenterDistance),r.center=l(z,r.eye,K);break;case v.TUMBLE:o(K,r.center,r.eye),c(K,K,_),r.eye=o(z,r.center,K);break;default:e(n.tiltMode)}return r.up=c(z,r.up,_),!W.requiresTwoSteps||!i||w(t,r,n,!1)}function U(e,t,r,n=O,i){if(!e.state.constraints.tilt)return 0;const a=Math.min(t.relativeElevation*J,t.distance),s=e.state.constraints.tilt(a,Q);return N(e,r,s),n.interactionType===j.TUMBLE&&A(n.selection,S.ALTITUDE)&&B(e,n.interactionStartCamera,s),r.tiltMode===v.LOOK_AROUND||n.tiltMode===v.LOOK_AROUND?P(e,t,s,i):D(e,t,s)}function D(e,t,n){const i=R(e.renderCoordsHelper,t.center,t.eye),a=i-r(i,n.min,n.max);return g(a)?a:0}function P(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return E(e,t,r,n);case"local":return b(e,t,r,n)}}function b(e,t,n,i){const a=R(e.renderCoordsHelper,t.center,t.eye),s=r(a,n.min,n.max),o=a-s;if(!g(o))return 0;if(i){const r=Math.abs(e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude),n=e.renderCoordsHelper.getAltitude(t.eye)-r,a=Math.max(Math.cos(s),1e-4);Math.abs(a)>1e-4?i.eyeCenterDistance=n/a:i.eyeCenterDistance=t.distance}return o}function E(e,t,n,i){const a=L(e,t,V),s=r(a.tiltAtCenter,n.min,n.max);if(!g(a.tiltAtCenter-s))return 0;let o,c;return a.centerIsOnSurface?(o=q(a),c=k(a,o)):(o=a.constraints.clampTilt(a.distance,a.tiltAtCenter),i&&o<Math.PI/2&&(i.requiresTwoSteps=!0,o=Math.PI/2-1e-5),c=F(a,o)),i&&(i.eyeCenterDistance=H(a,o)),c}function L(e,r,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+y(e.spatialReference).radius,s=e.renderCoordsHelper.intersectManifold(r.ray,i,z);return n.distance=Math.min(r.relativeElevation*J,r.distance),n.centerIsOnSurface=!1,null!=s?(n.distance=Math.min(r.relativeElevation*J,d(r.eye,s)),n.tiltAtCenter=R(e.renderCoordsHelper,s,r.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=R(e.renderCoordsHelper,r.center,r.eye):(C(T(I,a),r.ray,z),n.distance=Math.min(r.relativeElevation*J,d(r.eye,z)),n.tiltAtCenter=t(-f(r.viewForward,p(z,z)))),n.radius=a,n.eyeRadius=M(r.eye),n.constraints=e.state.constraints,n}function g(e){return Math.abs(e)>1e-9}function q(e){const{constraints:t,distance:r,tiltAtCenter:n}=e;let i=n,a=t.clampTilt(r,n);const s=H(e,a);if(t.clampTilt(s,n)===a)return a;let o=0;for(;o<10&&g(a-i);){const r=(i+a)/2,n=H(e,r);g(t.clampTilt(n,r)-r)?i=r:a=r,o++}return a}function H(e,t){if(!e.centerIsOnSurface)return e.distance;const i=Math.PI-r(t,0,Math.PI),a=n(e.radius/e.eyeRadius*Math.sin(i)),s=Math.PI-i-a,o=Math.sin(s)/Math.sin(i);if(e.eyeRadius<e.radius&&o>1){const t=Math.PI-a,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return o*e.eyeRadius}function k(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function N(e,t,r){if(t.interactionType===j.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:a,max:s}=r,o=U(e,n,O,t),c=0===o?0:R(e.renderCoordsHelper,n.center,n.eye);r.min=a,r.max=s,t.interactionType===j.TUMBLE?(A(t.selection,S.ALTITUDE)&&B(e,n,r),x(o,c,!0,i,G,r)):x(o,c,!1,i,G,r)}function B(e,r,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!r)return;const a=m(r.center),s=Math.sqrt(a),o=r.distance,c=y(e.spatialReference).radius,u=i.altitude.min+c,l=i.altitude.max+c,d=(u*u-o*o-a)/(-2*s*o),f=(l*l-o*o-a)/(-2*s*o);n.min=Math.max(n.min,Math.min(Math.PI-t(f),n.max)),n.max=Math.min(n.max,Math.PI-t(d))}const K=h(),_=s(),z=h(),G=i(5),J=30,Q={min:0,max:0},V={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,distance:0,tiltAtCenter:0},W={eyeCenterDistance:0,requiresTwoSteps:!1};export{w as applyTiltConstraint,U as getTiltConstraintError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{watch as r,initial as i}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{copy as o}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as n}from"../webgl.js";import{S as a}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as p}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as c,SimpleAtmosphereGeometry as f}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as l}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as h}from"../support/buffer/glUtil.js";import{newLayout as u}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as b}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as g}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as j}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as _}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as d}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as w}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as v}from"../../webgl/BufferObject.js";import{TextureWrapMode as x,PrimitiveType as A,Usage as T}from"../../webgl/enums.js";import{Texture as P}from"../../webgl/Texture.js";import{TextureDescriptor as y}from"../../webgl/TextureDescriptor.js";import{vertexCount as C}from"../../webgl/Util.js";let E=class extends b{constructor(){super(...arguments),this._configuration=new c,this._passParameters=new a,this._vao=null,this._vaoCount=0}initialize(){this._configuration.geometry=f.Cylinder,this.addHandles([r((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),i)])}destroy(){this._passParameters.texture=t(this._passParameters.texture),this._vao=t(this._vao)}precompile(){this.techniques.precompile(p,this._configuration)}render(e){const t=e.find((({name:e})=>e===n.OPAQUE_ENVIRONMENT)),r=this.techniques.get(p,this._configuration);if(!r.compiled)return this.requestRender(g.UPDATE),t;const i=this.renderingContext;if(this._vao||(this._vao=O(i),this._vaoCount=C(this._vao,"geometry")),!this._passParameters.texture){const e=new y;e.wrapMode=x.CLAMP_TO_EDGE,e.flipped=!0,e.width=1,e.height=512,this._passParameters.texture=new P(i,e,l)}const s=i.bindTechnique(r,this.bindParameters,this._passParameters);return S(L,this.bindParameters.camera.viewMatrix),s.setUniformMatrix4fv("view",L),i.bindVAO(this._vao),s.assertCompatibleVertexAttributeLocations(this._vao),i.drawArrays(A.TRIANGLES,0,this._vaoCount),t}};function O(e){const t=_(1,2,!1),{data:r,indices:i}=t[0][1],s=q.createBuffer(i.length),o=s.position;for(let m=0;m<i.length;++m){const e=3*i[m%3==0?m+2:m%3==2?m-2:m];o.set(m,0,r[e]),o.set(m,1,r[e+1]),o.set(m,2,r[e+2])}return new d(e,j,new Map([["geometry",h(q)]]),new Map([["geometry",v.createVertex(e,T.STATIC_DRAW,s.buffer)]]))}function S(e,t){o(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}E=e([s("esri.views.3d.environment.LocalAtmosphere")],E);const L=m(),q=u().vec3f(w.POSITION);export{E as LocalAtmosphere};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{watch as r,initial as s}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{copy as o}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as n}from"../webgl.js";import{S as a}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as p}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as c,SimpleAtmosphereGeometry as f}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as l}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as u}from"../support/buffer/glUtil.js";import{newLayout as h}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as b}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as g}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as j}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as _}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as d}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as w}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as v}from"../../webgl/BufferObject.js";import{TextureWrapMode as x,PrimitiveType as A,Usage as T}from"../../webgl/enums.js";import{Texture as P}from"../../webgl/Texture.js";import{TextureDescriptor as y}from"../../webgl/TextureDescriptor.js";import{vertexCount as C}from"../../webgl/Util.js";let E=class extends b{constructor(){super(...arguments),this._configuration=new c,this._passParameters=new a,this._vao=null,this._vaoCount=0}initialize(){this._configuration.geometry=f.Cylinder,this.addHandles([r((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),s)])}destroy(){this._passParameters.texture=t(this._passParameters.texture),this._vao=t(this._vao)}precompile(){this.techniques.precompile(p,this._configuration)}render(e){const t=e.find((({name:e})=>e===n.OPAQUE_ENVIRONMENT)),r=this.techniques.get(p,this._configuration);if(!r.compiled)return this.requestRender(g.UPDATE),t;const s=this.renderingContext;if(this._vao||(this._vao=O(s),this._vaoCount=C(this._vao,"geometry")),!this._passParameters.texture){const e=new y(1,512);e.wrapMode=x.CLAMP_TO_EDGE,e.flipped=!0,this._passParameters.texture=new P(s,e,l)}const i=s.bindTechnique(r,this.bindParameters,this._passParameters);return S(L,this.bindParameters.camera.viewMatrix),i.setUniformMatrix4fv("view",L),s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(A.TRIANGLES,0,this._vaoCount),t}};function O(e){const t=_(1,2,!1),{data:r,indices:s}=t[0][1],i=q.createBuffer(s.length),o=i.position;for(let m=0;m<s.length;++m){const e=3*s[m%3==0?m+2:m%3==2?m-2:m];o.set(m,0,r[e]),o.set(m,1,r[e+1]),o.set(m,2,r[e+2])}return new d(e,j,new Map([["geometry",u(q)]]),new Map([["geometry",v.createVertex(e,T.STATIC_DRAW,i.buffer)]]))}function S(e,t){o(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}E=e([i("esri.views.3d.environment.LocalAtmosphere")],E);const L=m(),q=h().vec3f(w.POSITION);export{E as LocalAtmosphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{lookAt as n}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as p,g as c,f as u,j as l,h as f,k as _}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as b}from"../../../geometry/support/FloatArray.js";import{InternalRenderCategory as j}from"../webgl.js";import{computeInnerAltitudeFade as x}from"./atmosphereUtils.js";import{S as V}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as w}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as v,SimpleAtmosphereGeometry as A}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as P}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as R}from"../support/mathUtils.js";import{glLayout as y}from"../support/buffer/glUtil.js";import{newLayout as S}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as T}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as M}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as U}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as q}from"../webgl-engine/lib/glUtil3D.js";import{project as F}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as C}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as E}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as O}from"../../webgl/BufferObject.js";import{TextureWrapMode as I,PrimitiveType as D,Usage as L}from"../../webgl/enums.js";import{Texture as N}from"../../webgl/Texture.js";import{TextureDescriptor as W}from"../../webgl/TextureDescriptor.js";import{vertexCount as k}from"../../webgl/Util.js";const G=128,B=-1e4,z=0,H=50,Q=()=>1-511/512,J=R([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let K=class extends T{constructor(e){super(e),this._passParameters=new V,this._configuration=new v,this._vao=null,this._vaoCount=0,this._fadeVao=null,this._fadeVaoCount=0,this._texV1=1;const t=e.view,r=g(t.spatialReference),{outerAtmosphereRimWidth:s,radius:i}=r;this._planetRadius=i,this._innerRimFactor=1+B/i,this._middleRimFactor=1+z/i,this._outerRimFactor=1+s/i,this._texV0=z/s,this._texVScale=this._texV1-this._texV0;const o=t.stage.renderView.techniques;o.precompile(w,this._configuration),this._configuration.geometry=A.Underground,o.precompile(w,this._configuration)}initialize(){this.addHandles(i((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(e){const t=e.find((({name:e})=>e===j.OPAQUE_ENVIRONMENT));this._update();const r=this.renderingContext;if(!this._passParameters.texture){const e=new W;e.wrapMode=I.CLAMP_TO_EDGE,e.flipped=!0,e.width=1,e.height=512,this._passParameters.texture=new N(r,e,P)}if(this._passParameters.undergroundFadeAlpha<1){this._vao||(this._vao=this._createRibbon(r),this._vaoCount=k(this._vao,"geometry")),this._configuration.geometry=A.Cone;const e=this.techniques.get(w,this._configuration);if(!e.compiled)return this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLES,0,this._vaoCount)}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao||(this._fadeVao=q(r),this._fadeVaoCount=k(this._fadeVao,"geometry")),this._configuration.geometry=A.Underground;const e=this.techniques.get(w,this._configuration);if(!e.compiled)return this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(D.TRIANGLE_STRIP,0,this._fadeVaoCount)}return t}_update(){const e=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(e.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max(H,a),m=i+B;this._passParameters.innerScale=ee(i+n,i,m)-1,this._passParameters.altitudeFade=x(a),c(s,e.eye,(i+H)/o),X(s,e.center,e.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(e,s,e.up,this._passParameters.silhouette),l=Q(),f=J(a);let _=this._texV0+l*this._texVScale,g=this._texV0+u*f*this._texVScale;if(a>H){X(e.eye,e.center,e.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),o=r((s-1.5)/(u-1.5),0,1);_=this._texV0+o*l*this._texVScale,g=this._texV0+t(this._texV1,u*f,o)*this._texVScale}h(this._passParameters.texV,_,g)}_createRibbon(e){const t=b(3+3*G*3),r=new Uint32Array(3*G*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<G;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const s=3*o+1,i=o===G-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=te.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const e=3*r[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new C(e,U,new Map([["geometry",y(te)]]),new Map([["geometry",O.createVertex(e,L.STATIC_DRAW,s.buffer)]]))}_computeScreenRimWidth(e,t,r,s){return u(Z,s.center,s.v2),c($,Z,this._outerRimFactor),n(Y,t,Z,r),F(Z,Y,e.projectionMatrix,e.viewport,Z),F($,Y,e.projectionMatrix,e.viewport,$),l(Z,$)/e.height}};function X(e,t,r,s,i){const o=p(e),a=s*Math.sqrt(o*o-s*s)/o,n=Math.sqrt(s*s-a*a),m=i.v1,h=i.v2;return c(i.center,e,n/o),f(m,e,t),_(m)<1&&f(m,e,r),c(m,m,a/p(m)),f(h,m,e),c(h,h,a/p(h)),a}K=e([a("esri.views.3d.environment.MarsAtmosphere")],K);const Y=m(),Z=d(),$=d();function ee(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const te=S().vec3f(E.POSITION),re=K;export{re as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{lookAt as n}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as p,g as c,f as u,j as l,h as f,k as _}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as b}from"../../../geometry/support/FloatArray.js";import{InternalRenderCategory as j}from"../webgl.js";import{computeInnerAltitudeFade as x}from"./atmosphereUtils.js";import{S as V}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as w}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as v,SimpleAtmosphereGeometry as A}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as P}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as R}from"../support/mathUtils.js";import{glLayout as y}from"../support/buffer/glUtil.js";import{newLayout as S}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as T}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as M}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as U}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as q}from"../webgl-engine/lib/glUtil3D.js";import{project as F}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as C}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as E}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as O}from"../../webgl/BufferObject.js";import{TextureWrapMode as I,PrimitiveType as D,Usage as L}from"../../webgl/enums.js";import{Texture as N}from"../../webgl/Texture.js";import{TextureDescriptor as W}from"../../webgl/TextureDescriptor.js";import{vertexCount as k}from"../../webgl/Util.js";const G=128,B=-1e4,z=0,H=50,Q=()=>1-511/512,J=R([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let K=class extends T{constructor(e){super(e),this._passParameters=new V,this._configuration=new v,this._vao=null,this._vaoCount=0,this._fadeVao=null,this._fadeVaoCount=0,this._texV1=1;const t=e.view,r=g(t.spatialReference),{outerAtmosphereRimWidth:s,radius:i}=r;this._planetRadius=i,this._innerRimFactor=1+B/i,this._middleRimFactor=1+z/i,this._outerRimFactor=1+s/i,this._texV0=z/s,this._texVScale=this._texV1-this._texV0;const o=t.stage.renderView.techniques;o.precompile(w,this._configuration),this._configuration.geometry=A.Underground,o.precompile(w,this._configuration)}initialize(){this.addHandles(i((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(e){const t=e.find((({name:e})=>e===j.OPAQUE_ENVIRONMENT));this._update();const r=this.renderingContext;if(!this._passParameters.texture){const e=new W(1,512);e.wrapMode=I.CLAMP_TO_EDGE,e.flipped=!0,this._passParameters.texture=new N(r,e,P)}if(this._passParameters.undergroundFadeAlpha<1){this._vao||(this._vao=this._createRibbon(r),this._vaoCount=k(this._vao,"geometry")),this._configuration.geometry=A.Cone;const e=this.techniques.get(w,this._configuration);if(!e.compiled)return this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLES,0,this._vaoCount)}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao||(this._fadeVao=q(r),this._fadeVaoCount=k(this._fadeVao,"geometry")),this._configuration.geometry=A.Underground;const e=this.techniques.get(w,this._configuration);if(!e.compiled)return this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(D.TRIANGLE_STRIP,0,this._fadeVaoCount)}return t}_update(){const e=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(e.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max(H,a),m=i+B;this._passParameters.innerScale=ee(i+n,i,m)-1,this._passParameters.altitudeFade=x(a),c(s,e.eye,(i+H)/o),X(s,e.center,e.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(e,s,e.up,this._passParameters.silhouette),l=Q(),f=J(a);let _=this._texV0+l*this._texVScale,g=this._texV0+u*f*this._texVScale;if(a>H){X(e.eye,e.center,e.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),o=r((s-1.5)/(u-1.5),0,1);_=this._texV0+o*l*this._texVScale,g=this._texV0+t(this._texV1,u*f,o)*this._texVScale}h(this._passParameters.texV,_,g)}_createRibbon(e){const t=b(3+3*G*3),r=new Uint32Array(3*G*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<G;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const s=3*o+1,i=o===G-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=te.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const e=3*r[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new C(e,U,new Map([["geometry",y(te)]]),new Map([["geometry",O.createVertex(e,L.STATIC_DRAW,s.buffer)]]))}_computeScreenRimWidth(e,t,r,s){return u(Z,s.center,s.v2),c($,Z,this._outerRimFactor),n(Y,t,Z,r),F(Z,Y,e.projectionMatrix,e.viewport,Z),F($,Y,e.projectionMatrix,e.viewport,$),l(Z,$)/e.height}};function X(e,t,r,s,i){const o=p(e),a=s*Math.sqrt(o*o-s*s)/o,n=Math.sqrt(s*s-a*a),m=i.v1,h=i.v2;return c(i.center,e,n/o),f(m,e,t),_(m)<1&&f(m,e,r),c(m,m,a/p(m)),f(h,m,e),c(h,h,a/p(h)),a}K=e([a("esri.views.3d.environment.MarsAtmosphere")],K);const Y=m(),Z=d(),$=d();function ee(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const te=S().vec3f(E.POSITION),re=K;export{re as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import s from"../../../../core/Identifiable.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrapeSourceType as i,DrapedRenderGroup as c}from"../../layers/interfaces.js";import{DirtyOperation as u}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{UpdatePolicy as a}from"../../webgl-engine/lib/UpdatePolicy.js";class n{constructor(e){this._resourceFactory=e,this._resources=null,this._visible=!0,this._attached=!1,this._renderGroup=c.Outline}destroy(){this._destroyResources()}get resources(){return this._resources?.external}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this._syncGeometriesToRenderer())}get attached(){return this._attached}set attached(e){e!==this._attached&&(this._attached=e,this._createOrDestroyResources())}get renderGroup(){return this._renderGroup}set renderGroup(e){this._renderGroup=e;const r=this._resources?.layerView;r&&(r.renderGroup=e)}recreate(){this.attached&&this._createResources()}recreateGeometry(){this._resourceFactory.recreateGeometry?null!=this._resources&&(this._ensureRenderGeometriesRemoved(),this._resourceFactory.recreateGeometry(this._resources.external),this._syncGeometriesToRenderer()):this.recreate()}forEachMaterial(e){this._resources&&this._resourceFactory.forEachMaterial(this._resources.external,e)}_createOrDestroyResources(){this._attached?null==this._resources&&this._createResources():this._destroyResources()}_createResources(){this._destroyResources();const e=this._resourceFactory.createResources(),r=new d({view:this._resourceFactory.view,renderGroup:this._renderGroup}),s=this._resourceFactory.view.basemapTerrain?.overlayManager;this._resources={layerView:new d({view:this._resourceFactory.view,renderGroup:this._renderGroup}),external:e,geometriesAdded:!1},s&&(this._resources.drapeSourceRenderer=s.registerGeometryDrapeSource(r)),this._syncGeometriesToRenderer()}_destroyResources(){if(null==this._resources)return;this._ensureRenderGeometriesRemoved();const e=this._resourceFactory.view.basemapTerrain?.overlayManager;e&&e.unregisterDrapeSource(this._resources.layerView),this._resourceFactory.destroyResources(this._resources.external),this._resources=null}_syncGeometriesToRenderer(){this._visible?this._ensureRenderGeometriesAdded():this._ensureRenderGeometriesRemoved()}_ensureRenderGeometriesRemoved(){if(null==this._resources?.drapeSourceRenderer)return;if(!this._resources.geometriesAdded)return;this._resources.drapeSourceRenderer.removeGeometries(this._resources.external.geometries,u.UPDATE),this._resources.geometriesAdded=!1}_ensureRenderGeometriesAdded(){if(null==this._resources?.drapeSourceRenderer)return;if(this._resources.geometriesAdded)return;this._resources.drapeSourceRenderer.addGeometries(this._resources.external.geometries,u.UPDATE),this._resources.geometriesAdded=!0}}let d=class extends(s.IdentifiableMixin(r)){constructor(e){super(e),this.drapeSourceType=i.Features,this.updatePolicy=a.SYNC,this.renderGroup=c.Outline}};e([t({constructOnly:!0})],d.prototype,"view",void 0),e([t({readOnly:!0})],d.prototype,"drapeSourceType",void 0),e([t()],d.prototype,"renderGroup",void 0),d=e([o("esri.views.3d.interactive.visualElements.DrapedVisualElementResources")],d);export{n as DrapedVisualElementResources};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import s from"../../../../core/Identifiable.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrapedRenderGroup as i,DrapeSourceType as c}from"../../layers/interfaces.js";import{DirtyOperation as u}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{UpdatePolicy as a}from"../../webgl-engine/lib/UpdatePolicy.js";class n{constructor(e){this._resourceFactory=e,this._resources=null,this._visible=!0,this._attached=!1,this._renderGroup=i.Outline}destroy(){this._destroyResources()}get resources(){return this._resources?.external}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this._syncGeometriesToRenderer())}get attached(){return this._attached}set attached(e){e!==this._attached&&(this._attached=e,this._createOrDestroyResources())}get renderGroup(){return this._renderGroup}set renderGroup(e){this._renderGroup=e;const r=this._resources?.layerView;r&&(r.renderGroup=e)}recreate(){this.attached&&this._createResources()}recreateGeometry(){this._resourceFactory.recreateGeometry?null!=this._resources&&(this._ensureRenderGeometriesRemoved(),this._resourceFactory.recreateGeometry(this._resources.external),this._syncGeometriesToRenderer()):this.recreate()}forEachMaterial(e){this._resources&&this._resourceFactory.forEachMaterial(this._resources.external,e)}_createOrDestroyResources(){this._attached?null==this._resources&&this._createResources():this._destroyResources()}_createResources(){this._destroyResources();const e=this._resourceFactory.createResources(),r=new d({view:this._resourceFactory.view,renderGroup:this._renderGroup}),s=this._resourceFactory.view.basemapTerrain?.overlayManager;this._resources={layerView:new d({view:this._resourceFactory.view,renderGroup:this._renderGroup}),external:e,geometriesAdded:!1},s&&(this._resources.drapeSourceRenderer=s.registerGeometryDrapeSource(r)),this._syncGeometriesToRenderer()}_destroyResources(){if(null==this._resources)return;this._ensureRenderGeometriesRemoved();const e=this._resourceFactory.view.basemapTerrain?.overlayManager;e&&e.unregisterDrapeSource(this._resources.layerView),this._resourceFactory.destroyResources(this._resources.external),this._resources=null}_syncGeometriesToRenderer(){this._visible?this._ensureRenderGeometriesAdded():this._ensureRenderGeometriesRemoved()}_ensureRenderGeometriesRemoved(){if(null==this._resources?.drapeSourceRenderer)return;if(!this._resources.geometriesAdded)return;this._resources.drapeSourceRenderer.removeGeometries(this._resources.external.geometries,u.UPDATE),this._resources.geometriesAdded=!1}_ensureRenderGeometriesAdded(){if(null==this._resources?.drapeSourceRenderer)return;if(this._resources.geometriesAdded)return;this._resources.drapeSourceRenderer.addGeometries(this._resources.external.geometries,u.UPDATE),this._resources.geometriesAdded=!0}}let d=class extends(s.IdentifiableMixin(r)){constructor(e){super(e),this.drapeSourceType=c.Features,this.updatePolicy=a.SYNC,this.renderGroup=i.Outline}};e([t({constructOnly:!0})],d.prototype,"view",void 0),e([t({readOnly:!0})],d.prototype,"drapeSourceType",void 0),e([t()],d.prototype,"renderGroup",void 0),d=e([o("esri.views.3d.interactive.visualElements.DrapedVisualElementResources")],d);export{n as DrapedVisualElementResources};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as l,g as h,i as u,c as d}from"../../../../chunks/vec32.js";import{ZEROS as p,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as _,t as m,b as g}from"../../../../chunks/vec42.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../../../geometry/ellipsoidUtils.js";import{create as O,empty as w,copy as I,offset as D,width as C,height as j,expand as G}from"../../../../geometry/support/aaBoundingRect.js";import{e as k,d as S,a as A}from"../../../../chunks/boundedPlane.js";import{create as Q}from"../../../../geometry/support/ray.js";import{a as N,c as P,j as T,h as x}from"../../../../chunks/sphere.js";import{DeconflictAABR as E}from"./DeconflictAABR.js";import{prepare as V,drawPoly as L}from"./deconflictorDebug.js";import{VisibilityGroup as U,VisibilityFlag as F}from"./enums.js";import R from"../../webgl/RenderCamera.js";import{GPUPointOcclusionQuery as H}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{applyPrecomputedScaleFactor as B}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as M}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as W}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as z}from"../../webgl-engine/materials/ScaleInfo.js";import{Yield as Y}from"../../../support/Yield.js";const q=f(),J=f(),K=y(),X=y(),Z=f(),$=n(),ii=P(),ti=Q(),ei=f(),si=O();class ri{constructor(i){this.id=i,this.aabr=O(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function ci(i,t){const e=0!==i.distanceToOccluder&&i.distance>i.distanceToOccluder,s=0!==t.distanceToOccluder&&t.distance>t.distanceToOccluder;return e!==s?+e-+s:i.priority!==t.priority?t.priority-i.priority:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id}class oi{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(i){let t=this.getInfo(i);return t||(t=new ri(this.graphics3DGraphic.graphic.uid),this._setInfo(i,t)),t}getInfo(i){return i===U.LABEL?this._labelInfo:this._info}removeInfo(i){this._setInfo(i,null)}_setInfo(i,t){i===U.LABEL?this._labelInfo=t:this._info=t}}var ni;!function(i){i[i.Idle=0]="Idle",i[i.CheckOcclusion=1]="CheckOcclusion",i[i.WaitOcclusion=2]="WaitOcclusion",i[i.Collect=3]="Collect",i[i.Deconflict=4]="Deconflict",i[i.NumStates=5]="NumStates"}(ni||(ni={}));class ai{constructor(){this.camera=new R,this.slicePlane=S(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),A(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let li=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new ai,this._state=ni.Idle,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=new Array,this._updatingHandles=new v,this._deconflictor=new E(((i,t)=>{i.visible=t,this._setGraphicVisibility(this._active.get(i.id),t)}),((i,t)=>i.id!==t.id),ci),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add((()=>(this.view?.map?.ground?.opacity??0)>0),(()=>this.setDirty())),this._updatingHandles.add((()=>this.view.ready),(()=>this._occlusionQuery=null))}destroy(){this._occlusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}setPriority(i,t){const e=this._active.get(i.graphic.uid)?.getInfo(this.visibilityGroup);e&&(e.priority=t)}get updating(){return this._state!==ni.Idle||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/ni.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case ni.Idle:this._startUpdate(),i.madeProgress();case ni.CheckOcclusion:if(this._state=ni.CheckOcclusion,!this._processCheckOcclusion(i))return;case ni.WaitOcclusion:if(this._state=ni.WaitOcclusion,this._occlusionQuery&&!this._occlusionQuery.done)return Y;this._readOcclusionQueryResult(),i.madeProgress();case ni.Collect:if(this._state=ni.Collect,!this._collectActiveGraphics(i))return;case ni.Deconflict:if(this._state=ni.Deconflict,this._deconflictor.run(i),!this._deconflictor.done)return;default:this._state=ni.Idle,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i)))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof W}_startUpdate(){V(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(i,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=s(this._occlusionQuery))}addToActiveGraphics(i){i.ensureInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){hi(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToCheckOcclusion(i){this._checkOcclusion.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromCheckOcclusion(i){this._checkOcclusion.delete(i.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(i){if(0===this._checkOcclusion.size)return!0;const t=this._ensureCheckOcclusionIterator(),e=this._viewState.camera,r=o($,e.viewInverseTransposeMatrix),c=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&c&&e.relativeElevation>0?ii:null;let a=0;null!=n&&(l(N(n),p,e.viewMatrix),n[3]=b(this.view.spatialReference).radius,a=T(n,p));const h=O();for(;;){if(i.done)return!1;i.madeProgress();const s=t.next();if(!0===s.done)break;const c=s.value,o=c.graphics3DGraphic;if(o.destroyed)continue;if(!o.isVisible(U.GRAPHIC,F.DECONFLICTION))continue;const u=fi(o,this.visibilityGroup);let d=null,p=!0;for(const i of u){if(!this.layerSupportsDeconfliction(i))continue;d=_i,this._projectHudLayer(i,e,d),w(h);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(h,e,i,t,d),d.isOutsideScreen){p=!1;break}if(this._isCulledBySlice(c,d.positionView)){p=!1;break}if(null!=n&&pi(d,n,a)){p=!1;break}l(J,d.positionView,r),d.altitude=this.view.renderCoordsHelper.getAltitude(J);const s=c.ensureInfo(this.visibilityGroup);if(s.altitude=d.altitude,s.distance=d.distance,s.distanceToOccluder=d.distanceToOccluder,s.culled=!1,I(s.aabr,h),t.parameters.occlusionTest)break;this._ensureOcclusionQuery().addPosition(J)===this._occlusionQueryUids.length&&this._occlusionQueryUids.push(o.graphic.uid);break}if(this._active.has(o.graphic.uid)&&(!p||!d)){const i=c.ensureInfo(this.visibilityGroup);i.visible=!d,i.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=s(this._occlusionQuery)),this._occlusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;const i=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(i.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){const i=this._occlusionQueryUids[e],s=this._checkOcclusion.get(i);if(!s)continue;const r=this._occlusionQuery.getOcclusion(e)??-1,c=s.getInfo(this.visibilityGroup);c&&(c.distanceToOccluder=r>0?c.distance-r:0);const o=r<=0||this._occludedVisibility(c?.distanceToOccluder??0,c?.distance??r,c?.altitude??0,t);this._active.has(i)?c&&(c.culled=!o,c.visible=o):this._setGraphicVisibility(s,o)}this._occlusionQueryUids.length=0}_collectActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=this.visibilityGroup===U.LABEL;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._activeIterator=null,!0;const r=s.value,c=r.getInfo(this.visibilityGroup);if(!c)continue;!(!e||r.graphics3DGraphic.isVisible())||c.culled?(L(c.aabr,!1,!0),this._setGraphicVisibility(r,c.visible)):this._deconflictor.add(c)}return!1}_occludedVisibility(i,t,e,s){const r=Math.max(this._minAltitudeDifference,Math.abs(e-s))-this._minAltitudeDifference;return 0===i||t-i<=this._baseOccludedVisibility+this._altitudeFactor*r}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_ensureOcclusionQuery(){return this._occlusionQuery??=new H({view:this.view}),this._occlusionQueryUids.length||this._occlusionQuery.init(this._checkOcclusion.size,this._viewState.camera.eye),this._occlusionQuery}_projectHudLayer(i,t,e){const s=i.stageObject,r=s.geometries[0],c=r.material,o=N(s.boundingVolumeWorldSpace.bounds);l(q,o,t.viewMatrix);const n=r.attributes,a=n.get(M.NORMAL).data,d=n.get(M.CENTEROFFSETANDDISTANCE).data;c.applyShaderOffsetsView(q,a,s.transformation,d,t,e.scaleInfo,q),_(K,q[0],q[1],q[2],1),m(X,K,t.projectionMatrix),h(e.positionNDC,X,1/X[3]),c.applyShaderOffsetsNDC(e.positionNDC,d,t,e.positionNDC,Z),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(Z[2]),e.distance=Z[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),_(X,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),m(K,X,t.inverseProjectionMatrix),g(K,K,1/K[3]),u(e.positionView,q[0],q[1],q[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&k(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:c,scaleInfo:o}){const n=s.getScreenSize(ui);B(n,o.factor,n),n[0]*=t.pixelRatio,n[1]*=t.pixelRatio;const a=D(r.calculateRelativeScreenBounds(n,o.factorAlignment.scale*t.pixelRatio,si),e(0,t.fullWidth,.5+.5*c[0]),e(0,t.fullHeight,.5+.5*c[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(C(a),j(a));a[0]-=i,a[1]-=i,a[2]+=i,a[3]+=i}G(i,a,i)}_setGraphicVisibility(i,t){const e=i?.graphics3DGraphic;e&&!e.destroyed&&(e.setVisibilityFlag(this.visibilityGroup,F.DECONFLICTION,t),this.visibilityGroup===U.LABEL&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function hi(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,F.DECONFLICTION,!0)}i([r({constructOnly:!0})],li.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],li.prototype,"updating",null),i([r({readOnly:!0})],li.prototype,"_updatingHandles",void 0),li=i([c("esri.views.3d.layers.graphics.Deconflictor")],li);const ui=a();class di{constructor(){this.positionView=f(),this.positionNDC=f(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new z}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function pi(i,t,e){return d(ti.direction,i.positionView),u(ti.origin,0,0,0),!!x(t,ti,ei)&&i.distanceWithoutPolygonOffset>e}function fi(i,t){return t===U.LABEL?i.labelLayers:i.layers}const _i=new di;export{li as Deconflictor,oi as DeconflictorGraphic,ai as DeconflictorViewState,ni as State};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as l,g as h,i as u,c as d}from"../../../../chunks/vec32.js";import{ZEROS as p,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as _,t as m,d as g}from"../../../../chunks/vec42.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../../../geometry/ellipsoidUtils.js";import{create as O,empty as w,copy as I,offset as D,width as C,height as j,expand as G}from"../../../../geometry/support/aaBoundingRect.js";import{e as k,d as S,a as A}from"../../../../chunks/boundedPlane.js";import{create as Q}from"../../../../geometry/support/ray.js";import{a as N,c as P,h as T,i as x}from"../../../../chunks/sphere.js";import{DeconflictAABR as E}from"./DeconflictAABR.js";import{prepare as V,drawPoly as L}from"./deconflictorDebug.js";import{VisibilityGroup as U,VisibilityFlag as F}from"./enums.js";import R from"../../webgl/RenderCamera.js";import{GPUPointOcclusionQuery as H}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{applyPrecomputedScaleFactor as B}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as M}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as W}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as z}from"../../webgl-engine/materials/ScaleInfo.js";import{Yield as Y}from"../../../support/Yield.js";const q=f(),J=f(),K=y(),X=y(),Z=f(),$=n(),ii=P(),ti=Q(),ei=f(),si=O();class ri{constructor(i){this.id=i,this.aabr=O(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function ci(i,t){const e=0!==i.distanceToOccluder&&i.distance>i.distanceToOccluder,s=0!==t.distanceToOccluder&&t.distance>t.distanceToOccluder;return e!==s?+e-+s:i.priority!==t.priority?t.priority-i.priority:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id}class oi{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(i){let t=this.getInfo(i);return t||(t=new ri(this.graphics3DGraphic.graphic.uid),this._setInfo(i,t)),t}getInfo(i){return i===U.LABEL?this._labelInfo:this._info}removeInfo(i){this._setInfo(i,null)}_setInfo(i,t){i===U.LABEL?this._labelInfo=t:this._info=t}}var ni;!function(i){i[i.Idle=0]="Idle",i[i.CheckOcclusion=1]="CheckOcclusion",i[i.WaitOcclusion=2]="WaitOcclusion",i[i.Collect=3]="Collect",i[i.Deconflict=4]="Deconflict",i[i.NumStates=5]="NumStates"}(ni||(ni={}));class ai{constructor(){this.camera=new R,this.slicePlane=S(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),A(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let li=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new ai,this._state=ni.Idle,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=new Array,this._updatingHandles=new v,this._deconflictor=new E(((i,t)=>{i.visible=t,this._setGraphicVisibility(this._active.get(i.id),t)}),((i,t)=>i.id!==t.id),ci),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add((()=>(this.view?.map?.ground?.opacity??0)>0),(()=>this.setDirty())),this._updatingHandles.add((()=>this.view.ready),(()=>this._occlusionQuery=null))}destroy(){this._occlusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}setPriority(i,t){const e=this._active.get(i.graphic.uid)?.getInfo(this.visibilityGroup);e&&(e.priority=t)}get updating(){return this._state!==ni.Idle||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/ni.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case ni.Idle:this._startUpdate(),i.madeProgress();case ni.CheckOcclusion:if(this._state=ni.CheckOcclusion,!this._processCheckOcclusion(i))return;case ni.WaitOcclusion:if(this._state=ni.WaitOcclusion,this._occlusionQuery&&!this._occlusionQuery.done)return Y;this._readOcclusionQueryResult(),i.madeProgress();case ni.Collect:if(this._state=ni.Collect,!this._collectActiveGraphics(i))return;case ni.Deconflict:if(this._state=ni.Deconflict,this._deconflictor.run(i),!this._deconflictor.done)return;default:this._state=ni.Idle,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i)))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof W}_startUpdate(){V(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(i,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=s(this._occlusionQuery))}addToActiveGraphics(i){i.ensureInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){hi(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToCheckOcclusion(i){this._checkOcclusion.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromCheckOcclusion(i){this._checkOcclusion.delete(i.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(i){if(0===this._checkOcclusion.size)return!0;const t=this._ensureCheckOcclusionIterator(),e=this._viewState.camera,r=o($,e.viewInverseTransposeMatrix),c=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&c&&e.relativeElevation>0?ii:null;let a=0;null!=n&&(l(N(n),p,e.viewMatrix),n[3]=b(this.view.spatialReference).radius,a=T(n,p));const h=O();for(;;){if(i.done)return!1;i.madeProgress();const s=t.next();if(!0===s.done)break;const c=s.value,o=c.graphics3DGraphic;if(o.destroyed)continue;if(!o.isVisible(U.GRAPHIC,F.DECONFLICTION))continue;const u=fi(o,this.visibilityGroup);let d=null,p=!0;for(const i of u){if(!this.layerSupportsDeconfliction(i))continue;d=_i,this._projectHudLayer(i,e,d),w(h);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(h,e,i,t,d),d.isOutsideScreen){p=!1;break}if(this._isCulledBySlice(c,d.positionView)){p=!1;break}if(null!=n&&pi(d,n,a)){p=!1;break}l(J,d.positionView,r),d.altitude=this.view.renderCoordsHelper.getAltitude(J);const s=c.ensureInfo(this.visibilityGroup);if(s.altitude=d.altitude,s.distance=d.distance,s.distanceToOccluder=d.distanceToOccluder,s.culled=!1,I(s.aabr,h),t.parameters.occlusionTest)break;this._ensureOcclusionQuery().addPosition(J)===this._occlusionQueryUids.length&&this._occlusionQueryUids.push(o.graphic.uid);break}if(this._active.has(o.graphic.uid)&&(!p||!d)){const i=c.ensureInfo(this.visibilityGroup);i.visible=!d,i.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=s(this._occlusionQuery)),this._occlusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;const i=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(i.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){const i=this._occlusionQueryUids[e],s=this._checkOcclusion.get(i);if(!s)continue;const r=this._occlusionQuery.getOcclusion(e)??-1,c=s.getInfo(this.visibilityGroup);c&&(c.distanceToOccluder=r>0?c.distance-r:0);const o=r<=0||this._occludedVisibility(c?.distanceToOccluder??0,c?.distance??r,c?.altitude??0,t);this._active.has(i)?c&&(c.culled=!o,c.visible=o):this._setGraphicVisibility(s,o)}this._occlusionQueryUids.length=0}_collectActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=this.visibilityGroup===U.LABEL;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._activeIterator=null,!0;const r=s.value,c=r.getInfo(this.visibilityGroup);if(!c)continue;!(!e||r.graphics3DGraphic.isVisible())||c.culled?(L(c.aabr,!1,!0),this._setGraphicVisibility(r,c.visible)):this._deconflictor.add(c)}return!1}_occludedVisibility(i,t,e,s){const r=Math.max(this._minAltitudeDifference,Math.abs(e-s))-this._minAltitudeDifference;return 0===i||t-i<=this._baseOccludedVisibility+this._altitudeFactor*r}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_ensureOcclusionQuery(){return this._occlusionQuery??=new H({view:this.view}),this._occlusionQueryUids.length||this._occlusionQuery.init(this._checkOcclusion.size,this._viewState.camera.eye),this._occlusionQuery}_projectHudLayer(i,t,e){const s=i.stageObject,r=s.geometries[0],c=r.material,o=N(s.boundingVolumeWorldSpace.bounds);l(q,o,t.viewMatrix);const n=r.attributes,a=n.get(M.NORMAL).data,d=n.get(M.CENTEROFFSETANDDISTANCE).data;c.applyShaderOffsetsView(q,a,s.transformation,d,t,e.scaleInfo,q),_(K,q[0],q[1],q[2],1),m(X,K,t.projectionMatrix),h(e.positionNDC,X,1/X[3]),c.applyShaderOffsetsNDC(e.positionNDC,d,t,e.positionNDC,Z),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(Z[2]),e.distance=Z[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),_(X,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),m(K,X,t.inverseProjectionMatrix),g(K,K,1/K[3]),u(e.positionView,q[0],q[1],q[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&k(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:c,scaleInfo:o}){const n=s.getScreenSize(ui);B(n,o.factor,n),n[0]*=t.pixelRatio,n[1]*=t.pixelRatio;const a=D(r.calculateRelativeScreenBounds(n,o.factorAlignment.scale*t.pixelRatio,si),e(0,t.fullWidth,.5+.5*c[0]),e(0,t.fullHeight,.5+.5*c[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(C(a),j(a));a[0]-=i,a[1]-=i,a[2]+=i,a[3]+=i}G(i,a,i)}_setGraphicVisibility(i,t){const e=i?.graphics3DGraphic;e&&!e.destroyed&&(e.setVisibilityFlag(this.visibilityGroup,F.DECONFLICTION,t),this.visibilityGroup===U.LABEL&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function hi(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,F.DECONFLICTION,!0)}i([r({constructOnly:!0})],li.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],li.prototype,"updating",null),i([r({readOnly:!0})],li.prototype,"_updatingHandles",void 0),li=i([c("esri.views.3d.layers.graphics.Deconflictor")],li);const ui=a();class di{constructor(){this.positionView=f(),this.positionNDC=f(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new z}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function pi(i,t,e){return d(ti.direction,i.positionView),u(ti.origin,0,0,0),!!x(t,ti,ei)&&i.distanceWithoutPolygonOffset>e}function fi(i,t){return t===U.LABEL?i.labelLayers:i.layers}const _i=new di;export{li as Deconflictor,oi as DeconflictorGraphic,ai as DeconflictorViewState,ni as State};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as m,expandWithAABB as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newHalfFloatArray as y,halfFloatSubArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{perVertexElevationAligner as x}from"./ElevationAligners.js";import{SymbolUpdateType as v,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as j,createWaterGeometry as S,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class I extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:v.RECREATE,staysOnTheGround:v.NONE,onTheGroundChanged:v.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(I.elevationModeChangeTypes,r,o);if(i!==v.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=j(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new H(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new C(this,l,null,x,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,k),!h(k,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const m=f(o,2*n,2*i),p=S({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:m}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=j(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new N(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=m(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!h(k,this._context.clippingExtent))continue;p(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const c=f(t,2*s,2*a),m=S({material:this._materials[0],indices:o,attributeData:{position:i,uv0:c}},e.objectAndLayerIdColor);e.outGeometries.push(new O(m,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);u(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),g(W,z);s(W,W,a);const l=W[0]%I.unitSizeOfTexture,c=W[1]%I.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/I.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/I.unitSizeOfTexture}const V=n(),W=d(),z=n(),k=c();class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{I as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
5
+ import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as m,expandWithAABB as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as d,create as u,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newHalfFloatArray as y,halfFloatSubArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{perVertexElevationAligner as x}from"./ElevationAligners.js";import{SymbolUpdateType as v,elevationModeChangeUpdateType as _,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as j,createWaterGeometry as S,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class I extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:v.RECREATE,staysOnTheGround:v.NONE,onTheGroundChanged:v.RECREATE}}constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=_(I.elevationModeChangeTypes,r,o);if(i!==v.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=j(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new H(i,s,this._context.layerViewUid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new C(this,l,null,x,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,k),!h(k,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const m=f(o,2*n,2*i),p=S({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:m}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=j(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new N(r,i,this._context.layerViewUid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=m(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(l(i,k),!h(k,this._context.clippingExtent))continue;p(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const c=f(t,2*s,2*a),m=S({material:this._materials[0],indices:o,attributeData:{position:i,uv0:c}},e.objectAndLayerIdColor);e.outGeometries.push(new O(m,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);d(W);for(let t=0;t<i;t++)o(z,r[3*t],r[3*t+1]),g(W,z);s(W,W,a);const l=W[0]%I.unitSizeOfTexture,c=W[1]%I.unitSizeOfTexture;V[0]=W[0]-l,V[1]=W[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-V[0])/I.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/I.unitSizeOfTexture}const V=n(),W=u(),z=n(),k=c();class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{I as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{l as s,n,g as a,e as o,d as m}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/Extent.js";import{create as f,fromValues as x}from"../../../geometry/support/ray.js";import{b as p,c as u,h as M}from"../../../chunks/sphere.js";import{ViewingMode as d}from"../../ViewingMode.js";import{computeInnerAltitudeFade as _}from"../environment/atmosphereUtils.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";function v(e,t,i){return e===d.Global?new E(t,i):new g(t,i)}class g{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,s,a){const{eye:h,center:l}=e;let f=h[2]*this._unitInMeters;const x=f,p=f-a,u=this._elevationProvider?.visibleElevationBounds;u&&(f=p>=0?x-this._unitInMeters*u.min:this._unitInMeters*u.max-x),r??=new c({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});const M={x:r.xmax-r.xmin,y:r.ymax-r.ymin,z:4*Math.max(r.xmax-r.xmin,r.ymax-r.ymin)},d=Math.max(M.x,M.y,M.z);m(B,l,h),q[0]=B[0]>0?r.xmax:r.xmin,q[1]=B[1]>0?r.ymax:r.ymin,q[2]=B[2]>0?d/2:-d/2,m(q,q,h),n(B,B);const _=1.1*o(q,B)*this._unitInMeters,y=Math.sqrt(f*(f+2*this._referenceEllipsoid.radius)),v=Math.max(r.xmax-r.xmin,r.ymax-r.ymin),g=v*z*this._unitInMeters,E=v*k*this._unitInMeters,b=i((f-E)/(g-E),0,1)**3,I=Math.min(t(y,_,b),y)*Math.max(Math.log(Math.abs(p)),1);return j(Math.min(I,Math.max(34064e4,d))/this._unitInMeters,w,this._unitInMeters,D)}}class E{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t)}compute(r,h,l,c){const{eye:f}=r,u=s(f),d=u-this._referenceEllipsoid.radius,v=this._referenceEllipsoid.radius+Math.min(0,c),g=Math.abs(d-c),E=Math.max(g,Math.abs(d)),z=this._elevationProvider?.visibleElevationBounds.max??0,k=_(E),H=Math.sqrt(E*(E+2*v)),R=u+this._referenceEllipsoid.radius,V=1.2*t(H,R,k),Y=(Math.log(E)-b)/(I-b);j(V,i(w-Y*(w-P),P,w),1,D);const A=this._referenceEllipsoid.radius+z,C=this._referenceEllipsoid.radius+this._referenceEllipsoid.atmosphereHeight,J=Math.max(A,C),K=u-J;if(k>0&&K>U){const i=n(q,a(q,r.eye,-1)),h=n(B,r.viewForward),c=e(o(i,h)),f=.5*r.fovY,u=Math.cos(f);let d=y.infinite.near;if(c<=f)d=K*u;else{const e=n(q,r.viewUp),t=Math.tan(f),i=a(q,e,t),o=n(q,m(q,h,i)),l=x(r.eye,o,G),c=p(F,J);if(M(c,l,q)){const e=m(q,q,r.eye);d=s(e)*u}}const _=.99*Math.min(l.near,d);if(_<y.infinite.near&&_>D.near){const e=t(D.near,_,k);D.near=e}}return D}}function j(e,t,i,r){const s=U/i,n=e/t;return n>s?(r.far=e,r.near=n):(r.near=s,r.far=r.near*t),r}const b=7.983,I=16.994,w=2e4,P=100,U=2,z=.001,k=1e-4,q=h(),B=h(),D={near:0,far:0},F=u(),G=f();export{v as createNearFarHeuristic,U as minNearDistanceInMeters};
5
+ import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{l as s,n,g as a,e as o,d as m}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/Extent.js";import{create as f,fromValues as x}from"../../../geometry/support/ray.js";import{b as p,c as u,i as M}from"../../../chunks/sphere.js";import{ViewingMode as d}from"../../ViewingMode.js";import{computeInnerAltitudeFade as _}from"../environment/atmosphereUtils.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";function v(e,t,i){return e===d.Global?new E(t,i):new g(t,i)}class g{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,s,a){const{eye:h,center:l}=e;let f=h[2]*this._unitInMeters;const x=f,p=f-a,u=this._elevationProvider?.visibleElevationBounds;u&&(f=p>=0?x-this._unitInMeters*u.min:this._unitInMeters*u.max-x),r??=new c({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});const M={x:r.xmax-r.xmin,y:r.ymax-r.ymin,z:4*Math.max(r.xmax-r.xmin,r.ymax-r.ymin)},d=Math.max(M.x,M.y,M.z);m(B,l,h),q[0]=B[0]>0?r.xmax:r.xmin,q[1]=B[1]>0?r.ymax:r.ymin,q[2]=B[2]>0?d/2:-d/2,m(q,q,h),n(B,B);const _=1.1*o(q,B)*this._unitInMeters,y=Math.sqrt(f*(f+2*this._referenceEllipsoid.radius)),v=Math.max(r.xmax-r.xmin,r.ymax-r.ymin),g=v*z*this._unitInMeters,E=v*k*this._unitInMeters,b=i((f-E)/(g-E),0,1)**3,I=Math.min(t(y,_,b),y)*Math.max(Math.log(Math.abs(p)),1);return j(Math.min(I,Math.max(34064e4,d))/this._unitInMeters,w,this._unitInMeters,D)}}class E{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t)}compute(r,h,l,c){const{eye:f}=r,u=s(f),d=u-this._referenceEllipsoid.radius,v=this._referenceEllipsoid.radius+Math.min(0,c),g=Math.abs(d-c),E=Math.max(g,Math.abs(d)),z=this._elevationProvider?.visibleElevationBounds.max??0,k=_(E),H=Math.sqrt(E*(E+2*v)),R=u+this._referenceEllipsoid.radius,V=1.2*t(H,R,k),Y=(Math.log(E)-b)/(I-b);j(V,i(w-Y*(w-P),P,w),1,D);const A=this._referenceEllipsoid.radius+z,C=this._referenceEllipsoid.radius+this._referenceEllipsoid.atmosphereHeight,J=Math.max(A,C),K=u-J;if(k>0&&K>U){const i=n(q,a(q,r.eye,-1)),h=n(B,r.viewForward),c=e(o(i,h)),f=.5*r.fovY,u=Math.cos(f);let d=y.infinite.near;if(c<=f)d=K*u;else{const e=n(q,r.viewUp),t=Math.tan(f),i=a(q,e,t),o=n(q,m(q,h,i)),l=x(r.eye,o,G),c=p(F,J);if(M(c,l,q)){const e=m(q,q,r.eye);d=s(e)*u}}const _=.99*Math.min(l.near,d);if(_<y.infinite.near&&_>D.near){const e=t(D.near,_,k);D.near=e}}return D}}function j(e,t,i,r){const s=U/i,n=e/t;return n>s?(r.far=e,r.near=n):(r.near=s,r.far=r.near*t),r}const b=7.983,I=16.994,w=2e4,P=100,U=2,z=.001,k=1e-4,q=h(),B=h(),D={near:0,far:0},F=u(),G=f();export{v as createNearFarHeuristic,U as minNearDistanceInMeters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as h,t as p,f as d,g as u,c as _,u as f,l as v,i as C,n as g,h as y,j as w,E as O,e as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{k as L,b as M,t as A}from"../../../../chunks/sphere.js";import{angle as T}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as D}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as R}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as N,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as G}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as B}from"../../support/cameraUtils.js";import{createDirectionUp as V}from"../../support/cameraUtilsInternal.js";import K from"../../webgl/RenderCamera.js";import{extractTransformation as X,isZeroTransformation as Z,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(D.ALL,R.NONE,0,new K,null,U.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||Z(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce(((t,e)=>e>0?t+1:t),0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);Z(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=R.NONE,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(rt,e.center,e.eye),p(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=p(rt,e.up,t.matrix),this._constraintOptions.interactionType=R.LOOK_AROUND,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p(rt,e.eye,t.matrix),e.center=p(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p(rt,e.up,t.matrix)),this._constraintOptions.interactionType=R.PAN,this._constraintOptions.selection=D.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=R.ZOOM,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=R.ASCEND,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,h=C(E.get(),s[0],s[1],0);g(h,h);const p=m.translation[0]*t.pan;if(0!==p){const t=u(E.get(),o,p);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),h,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,k.min,k.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),N(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(k.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(k.max,e.origin,a,r)}else{L(M(A,a+r.radius),e,c);const t=Math.PI+T(e.direction,c);s=G(t,e.origin,a,r),n=G(k.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=B(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=h(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,h=$*r.width,p=c*Math.tan(.5*r.fovX)/m,d=p/a,u=p/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:p)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*h,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||Z(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=V();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as h,t as p,f as d,g as u,c as _,u as f,l as v,i as C,n as g,h as y,j as w,E as O,e as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{j as L,b as M,t as A}from"../../../../chunks/sphere.js";import{angle as T}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as D}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as R}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as N,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as G}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as B}from"../../support/cameraUtils.js";import{createDirectionUp as V}from"../../support/cameraUtilsInternal.js";import K from"../../webgl/RenderCamera.js";import{extractTransformation as X,isZeroTransformation as Z,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(D.ALL,R.NONE,0,new K,null,U.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||Z(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce(((t,e)=>e>0?t+1:t),0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);Z(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=R.NONE,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(rt,e.center,e.eye),p(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=p(rt,e.up,t.matrix),this._constraintOptions.interactionType=R.LOOK_AROUND,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p(rt,e.eye,t.matrix),e.center=p(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p(rt,e.up,t.matrix)),this._constraintOptions.interactionType=R.PAN,this._constraintOptions.selection=D.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=R.ZOOM,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=R.ASCEND,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,h=C(E.get(),s[0],s[1],0);g(h,h);const p=m.translation[0]*t.pan;if(0!==p){const t=u(E.get(),o,p);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),h,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,k.min,k.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),N(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(k.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(k.max,e.origin,a,r)}else{L(M(A,a+r.radius),e,c);const t=Math.PI+T(e.direction,c);s=G(t,e.origin,a,r),n=G(k.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=B(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=h(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,h=$*r.width,p=c*Math.tan(.5*r.fovX)/m,d=p/a,u=p/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:p)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*h,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||Z(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=V();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as i,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as h,l as M,d as g,t as y,f as b,n as d,s as x,c as v,h as j,g as z,m as P,i as w}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as H,fromPoints as S,axis as k,wrapAxisAngle as A}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as E,vectorCoordinates as T}from"../../../../geometry/support/coordinateSystem.js";import{create as U,fromNormalAndOffset as G,intersectRay as R}from"../../../../geometry/support/plane.js";import{c as q,k as C,h as F,a as V}from"../../../../chunks/sphere.js";import{sm4d as O,sv3d as W}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as B,fromScreen as D}from"../../support/geometryUtils/ray.js";import{intersectScreen as J}from"../../support/geometryUtils/sphere.js";import K from"../../webgl/RenderCamera.js";import{terrainId as L}from"../../webgl-engine/lib/verticalOffsetUtils.js";var N;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(N||(N={}));const Q=30,X=[1,3e8],Y=80,Z=8,$=200,_=1508e5,tt=5,et=50,nt=5,ot=10,rt=90,at={exclude:new Set([L])};function it(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function st(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ct(t,e,n){const o=i(O.get(),n[3],k(n));null==o||s(o,m)||(g(re,t.eye,e),y(re,re,o),t.eye=b(re,re,e),g(re,t.center,e),y(re,re,o),t.center=b(re,re,e),t.up=y(re,t.up,o))}function lt(t,e,n,o){return R(t,D(e,n,le),o)}function mt(t,e,n,o){return R(t,B(e,n,le),o)}function ut(t,e,n,o){const r=W.get();let a=1-n;g(r,e,t.eye);const i=M(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(z(r,r,a),t.eye=b(re,t.eye,r),t.center=P(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(pt),J(t,e,pt,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=z(W.get(),e.viewForward,r);e.eye=g(re,e.center,a)}const pt=a();function ht(t,e){w(e,0,0,0);for(const n of t)b(e,e,n);z(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/M(e))*(n+o.radius)}function gt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var yt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(yt||(yt={}));const bt={Elevation:3e4,Angle:e(16)},dt=e(80);function xt(t,e,n,o,r,a){const i=I(),s=q();let c=!0,l=!0;return t.intersectScreen(n,i,a)?s[3]=M(i):(l=!1,e.aboveGround&&r!==N.Ellipsoid?s[3]=Math.max(M(e.center),.9*o.radius):s[3]=M(e.eye)-e.relativeElevation,r===N.Silhouette?Pt(s,e,n,i):c=J(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:l}}function vt(t,e,n,o){const r=t.relativeElevation;if(r>bt.Elevation&&"global"===o)return yt.Horizontal;B(t,e,me);const a=Math.sign(r),i=n.worldUpAtPosition(t.eye,re);return-a*h(i,me.direction)<Math.sin(bt.Angle)*M(me.direction)?yt.Vertical:yt.Horizontal}function jt(t,e,n){g(zt,n,e),t.eye=g(re,t.eye,zt),t.center=g(re,t.center,zt)}const zt=I();function Pt(t,e,n,o){const r=B(e,n,le);return null!=r&&(C(t,r,wt),F(t,r,o)?!(x(wt,r.origin)<x(o,r.origin))||(v(o,wt),!1):(g(It,e.eye,e.center),d(It,It),G(It,-h(d(It,It),wt),Ht),R(Ht,r,o),!1))}const wt=I(),It=I(),Ht=U();function St(a,i,s,c,l,m){let u=0;if(j(se,a,i),g(ae,a,i),M(a)<=l||!c.aboveGround){j(s,ae,c.eye);const f=h(a,i)/(M(a)*M(i));if(f<.9999)u=o(f);else{const t=M(j(I(),a,i))/(M(a)*M(i));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,dt));u=-u-Math.max(0,M(i)-l)/(p*l)}else g(kt,c.eye,c.center),j(s,ae,kt),u=-M(ae)/l;return d(s,s),z(s,s,M(se)),u}const kt=I();function At(r,a,i,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,dt));return c=a>i?-(a-i)/(m*i):a<-i?Math.PI-(a+i)/(m*i):o(a/i),l=r>i?-(r-i)/(m*i):r<-i?Math.PI-(r+i)/(m*i):o(r/i),(l-c)*i}function Et(t,e,n,o,r,a,i,s,c,l){const m=At(t[2],e[2],a[3],s),u=c?At(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(i)*u-Math.cos(i)*m,M=Math.cos(i)*u+Math.sin(i)*m;d(re,r);const g=c?p/Math.sqrt(Math.abs(a[3]**2-h(n,re)**2)):p/a[3],y=M/Math.sqrt(Math.abs(a[3]**2-h(n,o)**2));f(l,g,y)}function Tt(t,e,n,o,r,a,i,s,c,l){j(se,t,e),E(a.up,a.eye,Nt,Qt,Xt),E([0,0,1],a.eye,Jt,Kt,Lt),v(n,Kt),v(o,Jt),d(n,n),z(n,n,M(se)),T(t,d(Qt,Qt),d(Xt,Xt),d(Nt,Nt),Yt),T(e,Qt,Xt,Nt,Zt),Et(Yt,Zt,t,Jt,Kt,i,s,c,l,r)}function Ut(t,e,n,o,r,a,s){i(te,r,o),i(ee,s,a),l(ne,te,ee),g(e,t,n),y(e,e,ne),b(e,e,n)}function Gt(t,e,n,o,r,a){i(te,o,n),i(ee,a,r),l(ne,te,ee),g(re,t.eye,e),y(re,re,ne),t.eye=b(re,re,e),g(re,t.center,e),y(re,re,ne),t.center=b(re,re,e),g(re,t.up,e),y(re,re,ne),t.up=b(re,re,e)}const Rt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let qt=!1;function Ct(t,e,n,o,r,a){const i=Math.abs(o)>Math.PI-Rt.Angle||Math.abs(o)<Rt.Angle,s=(Math.abs(t[2])<n*Rt.Pole||Math.abs(e)>n)&&a;return i&&s?!qt&&r<Rt.Tilt-Rt.TiltHysteresisMargin?qt=!0:qt&&r>Rt.Tilt+Rt.TiltHysteresisMargin&&(qt=!1):qt=!1,qt}function Ft(t,e,n,o,r,a){if(a)S(n,o,_t),ct(e,V(t),_t);else{const a=St(n,o,ce,e,t[3],r);ct(e,V(t),A(ce,a))}}function Vt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let l,m;v(oe,o),ie.copyFrom(e);for(let u=0;u<s&&x(n,oe)>c&&(l=x(n,oe),Tt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Gt(ie,V(t),Jt,$t[1],Kt,$t[0]),Ut(oe,oe,V(t),Jt,$t[1],Kt,$t[0]),m=x(n,oe),m<l||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Ct(r,h(o.up,r),n[3],-t.normalize(e(i)),s,o.aboveGround)?Vt(n,o,r,a,-t.normalize(e(i)),s,c):Ft(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;E([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,l="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-h(t.center,Jt)**2/M(t.center)**2)),.5),u=(Math.sin(a)*l+Math.cos(a)*s)/m,f=-Math.cos(a)*l+Math.sin(a)*s;switch(c(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,f,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=j(W.get(),i,a),l=e.translation[0]*n.pan;switch(0!==l&&(c(o.pan.matrix,o.pan.matrix,-l,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,l,m){Ct(n.center,h(n.up,n.center),M(n.center),-t.normalize(e(s)),c,o.aboveGround)?Wt(o,r,a,l,m,-t.normalize(e(i))):Bt(o,r,a,l,m)}const Jt=I(),Kt=I(),Lt=I(),Nt=I(),Qt=I(),Xt=I(),Yt=I(),Zt=I(),$t=p(),_t=H(),te=u(),ee=u(),ne=u(),oe=I(),re=I(),ae=I(),ie=new K,se=I(),ce=I(),le={origin:I(),direction:I()},me={origin:I(),direction:I()};export{yt as NavigationMode,N as SpherePickPointFallback,dt as TiltThresholdPanningSpeed,bt as VerticalPanTresholds,jt as applyPanPlanar,Ft as applyPanSphericalDirectRotation,Vt as applyPanSphericalPreserveHeading,ct as applyRotation,Gt as applyRotationWithTwoAxes,ft as applyZoomOnSphere,ut as applyZoomToPoint,ht as centroid,at as contentIntersectorOptions,X as distanceClampValues,lt as intersectPlaneFromScreenPoint,mt as intersectPlaneFromScreenPointAtEye,At as lengthFromPoints,et as minHeightLimit,vt as navigationMode,it as normalizeCoordinate,st as normalizeRotationDelta,gt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,tt as panDistanceModifier,Dt as panMotionToRotationMatrix,Ot as panToPosition,xt as pickPointAndInitSphere,Q as pivotDistanceModifier,Rt as preservingHeadingThresholds,nt as rotatePivotDistanceModifier,ot as rotatePivotMinDistanceModifier,Ut as rotatePointAroundTwoAxes,rt as rotateScreenPixelArea,St as rotationAngleAndAxisDirectRotation,Tt as rotationAnglesAndAxesHeadingPreserving,Et as rotationAnglesHeadingPreserving,Y as screenPixelArea,Ct as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,Z as zoomDistanceModifier,_ as zoomMaxDistanceModifier,$ as zoomMinDistanceModifier};
5
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as i,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as h,l as M,d as g,t as y,f as b,n as d,s as x,c as v,h as j,g as z,m as P,i as w}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as H,fromPoints as S,axis as A,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as k,vectorCoordinates as T}from"../../../../geometry/support/coordinateSystem.js";import{create as U,fromNormalAndOffset as G,intersectRay as R}from"../../../../geometry/support/plane.js";import{c as q,j as C,i as F,a as V}from"../../../../chunks/sphere.js";import{sm4d as O,sv3d as W}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as B,fromScreen as D}from"../../support/geometryUtils/ray.js";import{intersectScreen as J}from"../../support/geometryUtils/sphere.js";import K from"../../webgl/RenderCamera.js";import{terrainId as L}from"../../webgl-engine/lib/verticalOffsetUtils.js";var N;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(N||(N={}));const Q=30,X=[1,3e8],Y=80,Z=8,$=200,_=1508e5,tt=5,et=50,nt=5,ot=10,rt=90,at={exclude:new Set([L])};function it(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function st(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ct(t,e,n){const o=i(O.get(),n[3],A(n));null==o||s(o,m)||(g(re,t.eye,e),y(re,re,o),t.eye=b(re,re,e),g(re,t.center,e),y(re,re,o),t.center=b(re,re,e),t.up=y(re,t.up,o))}function lt(t,e,n,o){return R(t,D(e,n,le),o)}function mt(t,e,n,o){return R(t,B(e,n,le),o)}function ut(t,e,n,o){const r=W.get();let a=1-n;g(r,e,t.eye);const i=M(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(z(r,r,a),t.eye=b(re,t.eye,r),t.center=P(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(pt),J(t,e,pt,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=z(W.get(),e.viewForward,r);e.eye=g(re,e.center,a)}const pt=a();function ht(t,e){w(e,0,0,0);for(const n of t)b(e,e,n);z(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/M(e))*(n+o.radius)}function gt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var yt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(yt||(yt={}));const bt={Elevation:3e4,Angle:e(16)},dt=e(80);function xt(t,e,n,o,r,a){const i=I(),s=q();let c=!0,l=!0;return t.intersectScreen(n,i,a)?s[3]=M(i):(l=!1,e.aboveGround&&r!==N.Ellipsoid?s[3]=Math.max(M(e.center),.9*o.radius):s[3]=M(e.eye)-e.relativeElevation,r===N.Silhouette?Pt(s,e,n,i):c=J(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:l}}function vt(t,e,n,o){const r=t.relativeElevation;if(r>bt.Elevation&&"global"===o)return yt.Horizontal;B(t,e,me);const a=Math.sign(r),i=n.worldUpAtPosition(t.eye,re);return-a*h(i,me.direction)<Math.sin(bt.Angle)*M(me.direction)?yt.Vertical:yt.Horizontal}function jt(t,e,n){g(zt,n,e),t.eye=g(re,t.eye,zt),t.center=g(re,t.center,zt)}const zt=I();function Pt(t,e,n,o){const r=B(e,n,le);return null!=r&&(C(t,r,wt),F(t,r,o)?!(x(wt,r.origin)<x(o,r.origin))||(v(o,wt),!1):(g(It,e.eye,e.center),d(It,It),G(It,-h(d(It,It),wt),Ht),R(Ht,r,o),!1))}const wt=I(),It=I(),Ht=U();function St(a,i,s,c,l,m){let u=0;if(j(se,a,i),g(ae,a,i),M(a)<=l||!c.aboveGround){j(s,ae,c.eye);const f=h(a,i)/(M(a)*M(i));if(f<.9999)u=o(f);else{const t=M(j(I(),a,i))/(M(a)*M(i));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,dt));u=-u-Math.max(0,M(i)-l)/(p*l)}else g(At,c.eye,c.center),j(s,ae,At),u=-M(ae)/l;return d(s,s),z(s,s,M(se)),u}const At=I();function Et(r,a,i,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,dt));return c=a>i?-(a-i)/(m*i):a<-i?Math.PI-(a+i)/(m*i):o(a/i),l=r>i?-(r-i)/(m*i):r<-i?Math.PI-(r+i)/(m*i):o(r/i),(l-c)*i}function kt(t,e,n,o,r,a,i,s,c,l){const m=Et(t[2],e[2],a[3],s),u=c?Et(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(i)*u-Math.cos(i)*m,M=Math.cos(i)*u+Math.sin(i)*m;d(re,r);const g=c?p/Math.sqrt(Math.abs(a[3]**2-h(n,re)**2)):p/a[3],y=M/Math.sqrt(Math.abs(a[3]**2-h(n,o)**2));f(l,g,y)}function Tt(t,e,n,o,r,a,i,s,c,l){j(se,t,e),k(a.up,a.eye,Nt,Qt,Xt),k([0,0,1],a.eye,Jt,Kt,Lt),v(n,Kt),v(o,Jt),d(n,n),z(n,n,M(se)),T(t,d(Qt,Qt),d(Xt,Xt),d(Nt,Nt),Yt),T(e,Qt,Xt,Nt,Zt),kt(Yt,Zt,t,Jt,Kt,i,s,c,l,r)}function Ut(t,e,n,o,r,a,s){i(te,r,o),i(ee,s,a),l(ne,te,ee),g(e,t,n),y(e,e,ne),b(e,e,n)}function Gt(t,e,n,o,r,a){i(te,o,n),i(ee,a,r),l(ne,te,ee),g(re,t.eye,e),y(re,re,ne),t.eye=b(re,re,e),g(re,t.center,e),y(re,re,ne),t.center=b(re,re,e),g(re,t.up,e),y(re,re,ne),t.up=b(re,re,e)}const Rt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let qt=!1;function Ct(t,e,n,o,r,a){const i=Math.abs(o)>Math.PI-Rt.Angle||Math.abs(o)<Rt.Angle,s=(Math.abs(t[2])<n*Rt.Pole||Math.abs(e)>n)&&a;return i&&s?!qt&&r<Rt.Tilt-Rt.TiltHysteresisMargin?qt=!0:qt&&r>Rt.Tilt+Rt.TiltHysteresisMargin&&(qt=!1):qt=!1,qt}function Ft(t,e,n,o,r,a){if(a)S(n,o,_t),ct(e,V(t),_t);else{const a=St(n,o,ce,e,t[3],r);ct(e,V(t),E(ce,a))}}function Vt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let l,m;v(oe,o),ie.copyFrom(e);for(let u=0;u<s&&x(n,oe)>c&&(l=x(n,oe),Tt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Gt(ie,V(t),Jt,$t[1],Kt,$t[0]),Ut(oe,oe,V(t),Jt,$t[1],Kt,$t[0]),m=x(n,oe),m<l||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Ct(r,h(o.up,r),n[3],-t.normalize(e(i)),s,o.aboveGround)?Vt(n,o,r,a,-t.normalize(e(i)),s,c):Ft(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;k([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,l="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-h(t.center,Jt)**2/M(t.center)**2)),.5),u=(Math.sin(a)*l+Math.cos(a)*s)/m,f=-Math.cos(a)*l+Math.sin(a)*s;switch(c(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,f,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=j(W.get(),i,a),l=e.translation[0]*n.pan;switch(0!==l&&(c(o.pan.matrix,o.pan.matrix,-l,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,l,m){Ct(n.center,h(n.up,n.center),M(n.center),-t.normalize(e(s)),c,o.aboveGround)?Wt(o,r,a,l,m,-t.normalize(e(i))):Bt(o,r,a,l,m)}const Jt=I(),Kt=I(),Lt=I(),Nt=I(),Qt=I(),Xt=I(),Yt=I(),Zt=I(),$t=p(),_t=H(),te=u(),ee=u(),ne=u(),oe=I(),re=I(),ae=I(),ie=new K,se=I(),ce=I(),le={origin:I(),direction:I()},me={origin:I(),direction:I()};export{yt as NavigationMode,N as SpherePickPointFallback,dt as TiltThresholdPanningSpeed,bt as VerticalPanTresholds,jt as applyPanPlanar,Ft as applyPanSphericalDirectRotation,Vt as applyPanSphericalPreserveHeading,ct as applyRotation,Gt as applyRotationWithTwoAxes,ft as applyZoomOnSphere,ut as applyZoomToPoint,ht as centroid,at as contentIntersectorOptions,X as distanceClampValues,lt as intersectPlaneFromScreenPoint,mt as intersectPlaneFromScreenPointAtEye,Et as lengthFromPoints,et as minHeightLimit,vt as navigationMode,it as normalizeCoordinate,st as normalizeRotationDelta,gt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,tt as panDistanceModifier,Dt as panMotionToRotationMatrix,Ot as panToPosition,xt as pickPointAndInitSphere,Q as pivotDistanceModifier,Rt as preservingHeadingThresholds,nt as rotatePivotDistanceModifier,ot as rotatePivotMinDistanceModifier,Ut as rotatePointAroundTwoAxes,rt as rotateScreenPixelArea,St as rotationAngleAndAxisDirectRotation,Tt as rotationAnglesAndAxesHeadingPreserving,kt as rotationAnglesHeadingPreserving,Y as screenPixelArea,Ct as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,Z as zoomDistanceModifier,_ as zoomMaxDistanceModifier,$ as zoomMinDistanceModifier};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{createPrimitive as r}from"./sdfPrimitives.js";import{PixelFormat as e,TextureWrapMode as t}from"../../../webgl/enums.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";const m=64,s=m/2,n=s/5,p=m/n,w=.25;function f(p,w){const f=r(p,m,s,n),u=new i;return u.internalFormat=e.RGBA,u.width=m,u.height=m,u.wrapMode=t.CLAMP_TO_EDGE,new o(w,u,f)}export{f as createMarkerTexture,p as markerSizePerLineWidth,s as markerSymbolSize,m as markerTextureSize,n as markerThickness,w as markerTipThicknessFactor};
5
+ import{createPrimitive as r}from"./sdfPrimitives.js";import{PixelFormat as e,TextureWrapMode as t}from"../../../webgl/enums.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../webgl/TextureDescriptor.js";const s=64,i=s/2,n=i/5,p=s/n,f=.25;function u(p,f){const u=r(p,s,i,n),w=new m(s);return w.internalFormat=e.RGBA,w.wrapMode=t.CLAMP_TO_EDGE,new o(f,w,u)}export{u as createMarkerTexture,p as markerSizePerLineWidth,i as markerSymbolSize,s as markerTextureSize,n as markerThickness,f as markerTipThicknessFactor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{create as r}from"../../../../geometry/support/ray.js";import{h as o}from"../../../../chunks/sphere.js";import{fromScreenAtEye as t}from"./ray.js";function s(r,s,p,e){const n=t(s,p,m);return o(r,n,e)}const m=r();export{s as intersectScreen};
5
+ import{create as r}from"../../../../geometry/support/ray.js";import{i as o}from"../../../../chunks/sphere.js";import{fromScreenAtEye as t}from"./ray.js";function s(r,s,p,e){const n=t(s,p,m);return o(r,n,e)}const m=r();export{s as intersectScreen};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t,lerp as e}from"../../../core/mathUtils.js";import{fromRotation as i,identity as o,rotateX as n,rotateY as a,rotateZ as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as c,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,create as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as g,m as f,n as d,g as h,t as b,f as y,c as p}from"../../../chunks/vec32.js";import{fromValues as A,clone as w,create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as N}from"../../ViewingMode.js";import{S as v}from"../../../chunks/SunCalc.js";import{angle as T}from"./mathUtils.js";const M={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};class S{constructor(t,e){this.direct=t,this.ambient=e}}function j(i,o,n,a,l,r){g(r.ambient.color,1,1,1),r.ambient.intensity=M.global.ambient,g(r.direct.color,1,1,1),r.direct.intensity=M.global.direct;const c=o[2],s=t((Math.abs(c)-M.local.altitude)/(M.global.altitude-M.local.altitude),0,1);let u;if(r.globalFactor=s,null!=i&&(u=v.getTimes(i,o[1],o[0])),s<1){let t;if(null!=i)t=ot(i,u,a);else{const e=L(a);t={direct:{intensity:M.local.directAtNoon*e.direct,color:A(1,1,1)},ambient:{intensity:M.local.ambientAtNoon*e.ambient,color:A(1,1,1)},timeOfDay:"early afternoon"}}f(r.ambient.color,t.ambient.color,r.ambient.color,s),r.ambient.intensity=e(t.ambient.intensity,r.ambient.intensity,s),f(r.direct.color,t.direct.color,r.direct.color,s),r.direct.intensity=e(t.direct.intensity,r.direct.intensity,s),r.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,r.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}r.noonFactor=null!=i?F(i,u):1,null!=i?P(i,o,n,r.direct.directionToLightSource):O(l,n,r.direct.directionToLightSource)}function O(t,e,o){e===N.Global?d(lt,t.eye):g(lt,0,0,1),h(rt,t.viewForward,-1);const n=T(rt,lt),a=Math.max(n-2*st,0),l=.85*a/(a+1),r=Math.max(st,n-st-l);i(at,-r,t.viewRight),b(o,rt,at),y(o,o,h(ct,t.viewRight,ut)),d(o,o)}function P(e,i,r,c){const s=H,u=o(G);if(r===N.Global)v.getPosition(e,0,0,s),g(c,0,0,-1),n(u,u,-s.azimuth),a(u,u,-s.altitude),b(c,c,u);else{const o=M.planarDirection,a=o.globalAngles,r=i[2];let m=(Math.abs(r)-o.localAltitude)/(o.globalAltitude-o.localAltitude);m=t(m,0,1),m<1?(v.getPosition(e,i[1],i[0],s),s.azimuth=(1-m)*s.azimuth+m*a.azimuth,s.altitude=(1-m)*s.altitude+m*a.altitude):(s.azimuth=a.azimuth,s.altitude=a.altitude),g(c,0,-1,0),l(u,u,-s.azimuth),n(u,u,-s.altitude),b(c,c,u)}}function z(t,e){if(e===N.Global)return!0;const i=M.planarDirection;return Math.abs(t)<i.localAltitude}function D(t,e,i,o,n){const a=t.getTime(),l=e.getTime()-a,r=Math.floor(l/i)+1,c=new Array(r);for(let s=0;s<r;++s)nt.setTime(a+i*s),c[s]=x(),P(nt,o,n,c[s]);return c}const E=A(.5773502691896258,-.5773502691896258,.5773502691896258);class I{constructor(){this.ambient={color:A(1,1,1),intensity:.55},this.direct={color:A(1,1,1),intensity:.55,directionToLightSource:w(E)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const G=r(),H={azimuth:0,altitude:0};function F(e,i){const o=e.valueOf();let n,a;i.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(e.getHours()+48)*60*1e3-60*e.getMinutes()*1e3,a=n+432e6):i.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=i.sunrise.valueOf(),a=i.sunset.valueOf());const l=n+(a-n)/2;return 1-t(Math.abs(o-l)/432e5,0,1)}function L(t){switch(t){case"disabled":case"sunny":case"cloudy":return new S(1,1);case"rainy":return new S(.4,1.2);case"snowy":return new S(.5,1.3);case"foggy":return new S(.2,1.6)}}function R(t,e){const i=(t[0]+t[1]+t[2])/3;t[0]+=(i-t[0])*e,t[1]+=(i-t[1])*e,t[2]+=(i-t[2])*e}const U=A(.01,.01,.01),_=A(1,.6,.5),k=A(1,.98,.98),V=A(1,1,1),C=A(.8,.8,1),q=A(.8,.8,1),B=A(.98,.98,1),J=A(1,1,1),K=u(.01,M.local.ambientAtNight),Q=u(M.local.directAtTwilight,M.local.ambientAtTwilight),W=u(.9*M.local.directAtNoon,M.local.ambientAtNoon),X=u(M.local.directAtNoon,M.local.ambientAtNoon),Y=W,Z=k,$=B,tt=Q,et=_,it=q;function ot(t,e,i){const o=t.valueOf();let n,a;e.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):e.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=e.sunrise.valueOf(),a=e.sunset.valueOf());const l=a-n,r=n+l/2,u=l/4,g=r-u,d=r+u,h=.06*l,b=n-h/2,y=n+h/2,A=a-h/2,w=a+h/2,N=m(),T=x(),M=x();let S="";if(o<b||o>w)c(N,K),p(T,U),p(M,C),S="night";else if(o<y){const t=(o-b)/(y-b);s(N,K,Q,t),f(T,U,_,t),f(M,C,q,t),S="sun rising"}else if(o<g){const t=(o-y)/(g-y);s(N,Q,W,t),f(T,_,k,t),f(M,q,B,t),S="early morning"}else if(o<r){const t=(o-g)/(r-g);s(N,W,X,t),f(T,k,V,t),f(M,B,J,t),S="late morning"}else if(o<d){const t=(o-r)/(d-r);s(N,X,Y,t),f(T,V,Z,t),f(M,J,$,t),S="early afternoon"}else if(o<A){const t=(o-d)/(A-d);s(N,Y,tt,t),f(T,Z,et,t),f(M,$,it,t),S="late afternoon"}else if(o<w){const t=(o-A)/(w-A);s(N,tt,K,t),f(T,et,U,t),f(M,it,C,t),S="sun setting"}let j=0;switch(i){case"rainy":case"foggy":j=.8;break;case"snowy":j=.5}j>0&&(R(T,j),R(M,j));const O=L(i);return{direct:{intensity:N[0]*O.direct,color:T},ambient:{intensity:N[1]*O.ambient,color:M},timeOfDay:S}}const nt=new Date(0),at=r(),lt=x(),rt=x(),ct=x(),st=.25,ut=.2;export{I as ColorAndIntensity,j as computeColorAndIntensity,D as computeDirectionsOverTime,z as computeShadowsEnabled,O as computeVirtualLightDirection};
5
+ import{clamp as t,lerp as e}from"../../../core/mathUtils.js";import{fromRotation as i,identity as o,rotateX as n,rotateY as a,rotateZ as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as c,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,create as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as g,m as f,n as d,g as h,t as b,f as y,c as p}from"../../../chunks/vec32.js";import{fromValues as A,clone as w,create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as N}from"../../ViewingMode.js";import{S as v}from"../../../chunks/SunCalc.js";import{angle as M}from"./mathUtils.js";const T={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};class S{constructor(t,e){this.direct=t,this.ambient=e}}function j(i,o,n,a,l,r){g(r.ambient.color,1,1,1),r.ambient.intensity=T.global.ambient,g(r.direct.color,1,1,1),r.direct.intensity=T.global.direct;const c=o[2],s=t((Math.abs(c)-T.local.altitude)/(T.global.altitude-T.local.altitude),0,1);let u;if(r.globalFactor=s,null!=i&&(u=v.getTimes(i,o[1],o[0])),s<1){let t;if(null!=i)t=ot(i,u,a);else{const e=L(a);t={direct:{intensity:T.local.directAtNoon*e.direct,color:A(1,1,1)},ambient:{intensity:T.local.ambientAtNoon*e.ambient,color:A(1,1,1)},timeOfDay:"early afternoon"}}f(r.ambient.color,t.ambient.color,r.ambient.color,s),r.ambient.intensity=e(t.ambient.intensity,r.ambient.intensity,s),f(r.direct.color,t.direct.color,r.direct.color,s),r.direct.intensity=e(t.direct.intensity,r.direct.intensity,s),r.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,r.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}r.noonFactor=null!=i?F(i,u):1,null!=i?P(i,o,n,r.direct.directionToLightSource):O(l,n,r.direct.directionToLightSource)}function O(t,e,o){e===N.Global?d(lt,t.eye):g(lt,0,0,1),h(rt,t.viewForward,-1);const n=M(rt,lt),a=Math.max(n-2*st,0),l=.85*a/(a+1),r=Math.max(st,n-st-l);i(at,-r,t.viewRight),b(o,rt,at),y(o,o,h(ct,t.viewRight,ut)),d(o,o)}function P(e,i,r,c){const s=H,u=o(G);if(r===N.Global)v.getPosition(e,0,0,s),g(c,0,0,-1),n(u,u,-s.azimuth),a(u,u,-s.altitude),b(c,c,u);else{const o=T.planarDirection,a=o.globalAngles,r=i[2];let m=(Math.abs(r)-o.localAltitude)/(o.globalAltitude-o.localAltitude);m=t(m,0,1),m<1?(v.getPosition(e,i[1],i[0],s),s.azimuth=(1-m)*s.azimuth+m*a.azimuth,s.altitude=(1-m)*s.altitude+m*a.altitude):(s.azimuth=a.azimuth,s.altitude=a.altitude),g(c,0,-1,0),l(u,u,-s.azimuth),n(u,u,-s.altitude),b(c,c,u)}}function z(t,e){if(e===N.Global)return!0;const i=T.planarDirection;return Math.abs(t)<i.localAltitude}function D(t,e,i,o,n){const a=t.getTime(),l=Math.max(0,e.getTime()-a),r=Math.floor(l/i)+1,c=new Array(r);for(let s=0;s<r;++s)nt.setTime(a+i*s),c[s]=x(),P(nt,o,n,c[s]);return c}const E=A(.5773502691896258,-.5773502691896258,.5773502691896258);class I{constructor(){this.ambient={color:A(1,1,1),intensity:.55},this.direct={color:A(1,1,1),intensity:.55,directionToLightSource:w(E)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const G=r(),H={azimuth:0,altitude:0};function F(e,i){const o=e.valueOf();let n,a;i.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(e.getHours()+48)*60*1e3-60*e.getMinutes()*1e3,a=n+432e6):i.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=i.sunrise.valueOf(),a=i.sunset.valueOf());const l=n+(a-n)/2;return 1-t(Math.abs(o-l)/432e5,0,1)}function L(t){switch(t){case"disabled":case"sunny":case"cloudy":return new S(1,1);case"rainy":return new S(.4,1.2);case"snowy":return new S(.5,1.3);case"foggy":return new S(.2,1.6)}}function R(t,e){const i=(t[0]+t[1]+t[2])/3;t[0]+=(i-t[0])*e,t[1]+=(i-t[1])*e,t[2]+=(i-t[2])*e}const U=A(.01,.01,.01),_=A(1,.6,.5),k=A(1,.98,.98),V=A(1,1,1),C=A(.8,.8,1),q=A(.8,.8,1),B=A(.98,.98,1),J=A(1,1,1),K=u(.01,T.local.ambientAtNight),Q=u(T.local.directAtTwilight,T.local.ambientAtTwilight),W=u(.9*T.local.directAtNoon,T.local.ambientAtNoon),X=u(T.local.directAtNoon,T.local.ambientAtNoon),Y=W,Z=k,$=B,tt=Q,et=_,it=q;function ot(t,e,i){const o=t.valueOf();let n,a;e.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):e.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=e.sunrise.valueOf(),a=e.sunset.valueOf());const l=a-n,r=n+l/2,u=l/4,g=r-u,d=r+u,h=.06*l,b=n-h/2,y=n+h/2,A=a-h/2,w=a+h/2,N=m(),M=x(),T=x();let S="";if(o<b||o>w)c(N,K),p(M,U),p(T,C),S="night";else if(o<y){const t=(o-b)/(y-b);s(N,K,Q,t),f(M,U,_,t),f(T,C,q,t),S="sun rising"}else if(o<g){const t=(o-y)/(g-y);s(N,Q,W,t),f(M,_,k,t),f(T,q,B,t),S="early morning"}else if(o<r){const t=(o-g)/(r-g);s(N,W,X,t),f(M,k,V,t),f(T,B,J,t),S="late morning"}else if(o<d){const t=(o-r)/(d-r);s(N,X,Y,t),f(M,V,Z,t),f(T,J,$,t),S="early afternoon"}else if(o<A){const t=(o-d)/(A-d);s(N,Y,tt,t),f(M,Z,et,t),f(T,$,it,t),S="late afternoon"}else if(o<w){const t=(o-A)/(w-A);s(N,tt,K,t),f(M,et,U,t),f(T,it,C,t),S="sun setting"}let j=0;switch(i){case"rainy":case"foggy":j=.8;break;case"snowy":j=.5}j>0&&(R(M,j),R(T,j));const O=L(i);return{direct:{intensity:N[0]*O.direct,color:M},ambient:{intensity:N[1]*O.ambient,color:T},timeOfDay:S}}const nt=new Date(0),at=r(),lt=x(),rt=x(),ct=x(),st=.25,ut=.2;export{I as ColorAndIntensity,j as computeColorAndIntensity,D as computeDirectionsOverTime,z as computeShadowsEnabled,O as computeVirtualLightDirection};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as n}from"../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{f as u,d as p,c as m,j as _}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as y,b as f,g as v}from"../../../chunks/vec42.js";import{fromValues as R,create as O}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as w}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{create as S,width as D,copy as T,center as E,height as P,intersection as M,contains as b,intersects as j,offset as I}from"../../../geometry/support/aaBoundingRect.js";import{create as U,wrap as C}from"../../../geometry/support/ray.js";import{k as N,b as A,t as q}from"../../../chunks/sphere.js";import{angleAroundAxis as G}from"../../../geometry/support/vector.js";import{y2lat as V}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as F}from"../state/utils/viewUtils.js";import{debugFlags as L}from"../support/debugFlags.js";import{DebugPoint as B}from"../support/debugUtils.js";import{OverlayIndex as H}from"./interfaces.js";import{OverlayRenderer as k}from"./OverlayRenderer.js";import{RenderRequestType as Y}from"../webgl-engine/lib/basicInterfaces.js";import{Intersector as z}from"../webgl-engine/lib/Intersector.js";import{fromValues as W}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as X}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as K}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Z}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as J,noBudget as Q}from"../../support/Scheduler.js";import{Yield as $}from"../../support/Yield.js";const ee=1.3,te=[[-.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 re,se=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._maxResolution=has("esri-mobile")?2048:4096}initialize(){const e=this.view;this.renderer=new k({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new z(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(()=>e.stage?.renderer.updateHasFlags())),this.renderer.events.on("content-changed",t),o((()=>e.state.camera.pixelRatio),t),o((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),o((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),o((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),l),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask(J.OVERLAY,this),e.stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays(Q,e.camera,Y.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(Y.BACKGROUND,e)}))]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null),re&&(re.hide(),re=null),this.renderer=a(this.renderer)}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=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180))):this.renderer.disposeOverlays()}get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||L.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?w(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return ee/this.view.resolutionScale}get _longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}render(){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._precompileShaders()?this._drawOverlays(Y.UPDATE):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("running")}registerGeometryDrapeSource(e){const t=new X({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("running"))}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,Y.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return $;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,le),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,le.stretch);const i=this._updateOverlay(H.INNER,le.inner,s,1*le.pixelRatioAdjustment,le.mapUnitsPerPixel),n=D(le.inner)/D(le.outer),a=this._updateOverlay(H.OUTER,le.outer,s,n*le.pixelRatioAdjustment,le.mapUnitsPerPixel);i!==ue.EXTENT&&a!==ue.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.updateOverlayParameters(r)),i===ue.NONE&&a===ue.NONE||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(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));return K(i,this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return ue.NONE;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=i,n.pixelRatio=s,ie(t,n.extent)&&r===n.resolution)return a===i?ue.NONE:ue.RERENDER_ONLY;T(n.extent,t),n.resolution=r;const o=E(n.extent);return n.renderLocalOrigin=W(o[0],o[1],0,"OV_"+this._latestOriginId++),ue.EXTENT}updateOverlayParameters(e){this.surface.allTiles.forAll((e=>this.updateTileOverlayParameters(e))),this.surface.requestRender(e)}updateTileOverlayParameters(e){if(!e.renderData)return;const t=e.renderData.overlay;if(0===this.renderer.overlays.length)this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t);else{const[r,s]=this.renderer.overlays,i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,H.INNER,t),this._setTileOverlayData(i,H.OUTER,t)):(this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t))}}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=D(s),n=P(s);let a=e[0];if(this._longitudeCyclical){a=this._longitudeCyclical.minimalMonotonic(s[0],a);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);a>t&&(a=t-(e[2]-e[0]))}r.setScale(t,D(e)/i,P(e)/n),r.setOffset(t,(a-s[0])/i,(e[1]-s[1])/n)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){Z(),this.requestRender(),this.runTask(Q)}requestRender(e=Y.UPDATE){this.renderer.hasOverlays?(e===Y.UPDATE?(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,de,t,r);if(null==n)return!1;const a=n.origin,o=u(oe,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let r=.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),c=e.aboveGround;if("global"===this.view.viewingMode){const t=oe;N(A(q,w(this.view.spatialReference).radius+h),C(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(G(e.viewForward,t,e.viewRight))/e.fovY+.5,a=i<=0||i>=1?.5:n;r=c?a*i:i+a*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),a=R(0,s,1,0),o=y(a,a,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,r,o.distance,t)}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=g();this._findHorizonBasedPointOfInterest(e,i)||m(i,s),L.OVERLAY_SHOW_CENTER?(null==re&&(re=new B(this.view.graphics,"red")),re.show(i,this._renderSR)):null!=re&&re.hide();const a=Math.max(.1,_(e.eye,i)),o=F(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||x(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,c=h&&this._spatialReference?1/w(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*a*c;r.mapUnitsPerPixel=p/this.worldToPCSRatio,r.stretch=this._overlayStretch;let y=t*p/2*r.stretch,R=!1,O=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(y/=Math.cos(V(i[1])),O=l[3]):(R=!0,y/=w(this._spatialReference).metersPerDegree,O=90),y>=O&&(y=O,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let S=1;R&&(S=1/Math.max(.2,Math.cos(Math.abs(n(i[1])))),y*S>180&&(S=180/y),r.mapUnitsPerPixel*=S);const E=Math.log(2)/12;y=Math.exp(Math.round(Math.log(y)/E)*E);const P=y*S,j=32,I=.5*t/(j*P),U=.5*t/(j*y);i[0]=Math.round(i[0]*I)/I,i[1]=Math.round(i[1]*U)/U;const C=r.inner;C[0]=i[0]-P,C[1]=i[1]-y,C[2]=i[0]+P,C[3]=i[1]+y,this._isSpherical&&this._shiftExtentToFitBounds(C,1/0,O);const N=r.outer;if(6*P>D(l))T(N,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)N[0]=C[0]-P,N[1]=C[1]-y,N[2]=C[2]+P,N[3]=C[3]+y;else{x(e.eye,this._renderSR,oe,this._spatialReference),d(ae,i,oe);let t=-Math.atan2(ae[1],ae[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(ae,te[r],2*y),ae[0]*=S,ae[2]*=S,v(N,C,ae)}}if(this._isSpherical)N[0]=this._longitudeCyclical.clamp(N[0]),N[2]=this._longitudeCyclical.clamp(N[2]),N[1]=Math.max(N[1],-O),N[3]=Math.min(N[3],O);else{const e=M(C,l,he),t=M(N,l,ce);b(e,t)&&(N[2]=N[0],N[3]=N[1])}const A=Math.abs(C[2]-C[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_precompileShaders(){return!!this.renderer.hasOverlays&&(this.renderer.precompileShaders(this.view.state),!0)}_drawOverlays(e,t=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.updateOverlayParameters(Y.UPDATE),r?(this.surface.requestRender(e),e===Y.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(Y.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):j(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:b(e,t))}_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]),I(e,s,i)}get test(){}};function ie(e,t){const r=1e-5,s=L.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);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()],se.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],se.prototype,"running",null),e([h()],se.prototype,"_placementDirty",void 0),e([h()],se.prototype,"_contentUpdated",void 0),e([h()],se.prototype,"_isSpherical",null),e([h()],se.prototype,"worldToPCSRatio",null),e([h()],se.prototype,"renderer",void 0),e([h({constructOnly:!0})],se.prototype,"view",void 0),e([h({constructOnly:!0})],se.prototype,"surface",void 0),e([h()],se.prototype,"suspended",null),e([h()],se.prototype,"updating",null),e([h({type:Boolean})],se.prototype,"rendersOccludedDraped",null),se=e([c("esri.views.3d.terrain.OverlayManager")],se);class ne{constructor(){this.inner=S(),this.outer=S(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=ee}}const ae=O(),oe=g(),le=new ne,he=S(),ce=S(),de=U();var ue;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(ue||(ue={}));export{se as OverlayManager};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as n}from"../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{f as u,d as p,c as m,j as _}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as y,d as f,g as v}from"../../../chunks/vec42.js";import{fromValues as R,create as O}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as w}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{create as S,width as D,copy as T,center as E,height as P,intersection as M,contains as j,intersects as b,offset as I}from"../../../geometry/support/aaBoundingRect.js";import{create as U,wrap as C}from"../../../geometry/support/ray.js";import{j as N,b as A,t as q}from"../../../chunks/sphere.js";import{angleAroundAxis as G}from"../../../geometry/support/vector.js";import{y2lat as V}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as F}from"../state/utils/viewUtils.js";import{debugFlags as L}from"../support/debugFlags.js";import{DebugPoint as B}from"../support/debugUtils.js";import{OverlayIndex as H}from"./interfaces.js";import{OverlayRenderer as k}from"./OverlayRenderer.js";import{RenderRequestType as Y}from"../webgl-engine/lib/basicInterfaces.js";import{Intersector as z}from"../webgl-engine/lib/Intersector.js";import{fromValues as W}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as X}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as K}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Z}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as J,noBudget as Q}from"../../support/Scheduler.js";import{Yield as $}from"../../support/Yield.js";const ee=1.3,te=[[-.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 re,se=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._maxResolution=has("esri-mobile")?2048:4096}initialize(){const e=this.view;this.renderer=new k({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new z(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(()=>e.stage?.renderer.updateHasFlags())),this.renderer.events.on("content-changed",t),o((()=>e.state.camera.pixelRatio),t),o((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),o((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),o((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),l),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask(J.OVERLAY,this),e.stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays(Q,e.camera,Y.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(Y.BACKGROUND,e)}))]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null),re&&(re.hide(),re=null),this.renderer=a(this.renderer)}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=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180))):this.renderer.disposeOverlays()}get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||L.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?w(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return ee/this.view.resolutionScale}get _longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}render(){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._precompileShaders()?this._drawOverlays(Y.UPDATE):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("running")}registerGeometryDrapeSource(e){const t=new X({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("running"))}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,Y.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return $;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,le),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,le.stretch);const i=this._updateOverlay(H.INNER,le.inner,s,1*le.pixelRatioAdjustment,le.mapUnitsPerPixel),n=D(le.inner)/D(le.outer),a=this._updateOverlay(H.OUTER,le.outer,s,n*le.pixelRatioAdjustment,le.mapUnitsPerPixel);i!==ue.EXTENT&&a!==ue.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.updateOverlayParameters(r)),i===ue.NONE&&a===ue.NONE||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(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));return K(i,this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return ue.NONE;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=i,n.pixelRatio=s,ie(t,n.extent)&&r===n.resolution)return a===i?ue.NONE:ue.RERENDER_ONLY;T(n.extent,t),n.resolution=r;const o=E(n.extent);return n.renderLocalOrigin=W(o[0],o[1],0,"OV_"+this._latestOriginId++),ue.EXTENT}updateOverlayParameters(e){this.surface.allTiles.forAll((e=>this.updateTileOverlayParameters(e))),this.surface.requestRender(e)}updateTileOverlayParameters(e){if(!e.renderData)return;const t=e.renderData.overlay;if(0===this.renderer.overlays.length)this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t);else{const[r,s]=this.renderer.overlays,i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,H.INNER,t),this._setTileOverlayData(i,H.OUTER,t)):(this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t))}}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=D(s),n=P(s);let a=e[0];if(this._longitudeCyclical){a=this._longitudeCyclical.minimalMonotonic(s[0],a);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);a>t&&(a=t-(e[2]-e[0]))}r.setScale(t,D(e)/i,P(e)/n),r.setOffset(t,(a-s[0])/i,(e[1]-s[1])/n)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){Z(),this.requestRender(),this.runTask(Q)}requestRender(e=Y.UPDATE){this.renderer.hasOverlays?(e===Y.UPDATE?(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,de,t,r);if(null==n)return!1;const a=n.origin,o=u(oe,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let r=.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),c=e.aboveGround;if("global"===this.view.viewingMode){const t=oe;N(A(q,w(this.view.spatialReference).radius+h),C(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(G(e.viewForward,t,e.viewRight))/e.fovY+.5,a=i<=0||i>=1?.5:n;r=c?a*i:i+a*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),a=R(0,s,1,0),o=y(a,a,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,r,o.distance,t)}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=g();this._findHorizonBasedPointOfInterest(e,i)||m(i,s),L.OVERLAY_SHOW_CENTER?(null==re&&(re=new B(this.view.graphics,"red")),re.show(i,this._renderSR)):null!=re&&re.hide();const a=Math.max(.1,_(e.eye,i)),o=F(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||x(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,c=h&&this._spatialReference?1/w(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*a*c;r.mapUnitsPerPixel=p/this.worldToPCSRatio,r.stretch=this._overlayStretch;let y=t*p/2*r.stretch,R=!1,O=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(y/=Math.cos(V(i[1])),O=l[3]):(R=!0,y/=w(this._spatialReference).metersPerDegree,O=90),y>=O&&(y=O,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let S=1;R&&(S=1/Math.max(.2,Math.cos(Math.abs(n(i[1])))),y*S>180&&(S=180/y),r.mapUnitsPerPixel*=S);const E=Math.log(2)/12;y=Math.exp(Math.round(Math.log(y)/E)*E);const P=y*S,b=32,I=.5*t/(b*P),U=.5*t/(b*y);i[0]=Math.round(i[0]*I)/I,i[1]=Math.round(i[1]*U)/U;const C=r.inner;C[0]=i[0]-P,C[1]=i[1]-y,C[2]=i[0]+P,C[3]=i[1]+y,this._isSpherical&&this._shiftExtentToFitBounds(C,1/0,O);const N=r.outer;if(6*P>D(l))T(N,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)N[0]=C[0]-P,N[1]=C[1]-y,N[2]=C[2]+P,N[3]=C[3]+y;else{x(e.eye,this._renderSR,oe,this._spatialReference),d(ae,i,oe);let t=-Math.atan2(ae[1],ae[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(ae,te[r],2*y),ae[0]*=S,ae[2]*=S,v(N,C,ae)}}if(this._isSpherical)N[0]=this._longitudeCyclical.clamp(N[0]),N[2]=this._longitudeCyclical.clamp(N[2]),N[1]=Math.max(N[1],-O),N[3]=Math.min(N[3],O);else{const e=M(C,l,he),t=M(N,l,ce);j(e,t)&&(N[2]=N[0],N[3]=N[1])}const A=Math.abs(C[2]-C[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_precompileShaders(){return!!this.renderer.hasOverlays&&(this.renderer.precompileShaders(this.view.state),!0)}_drawOverlays(e,t=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.updateOverlayParameters(Y.UPDATE),r?(this.surface.requestRender(e),e===Y.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(Y.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):b(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:j(e,t))}_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]),I(e,s,i)}get test(){}};function ie(e,t){const r=1e-5,s=L.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);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()],se.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],se.prototype,"running",null),e([h()],se.prototype,"_placementDirty",void 0),e([h()],se.prototype,"_contentUpdated",void 0),e([h()],se.prototype,"_isSpherical",null),e([h()],se.prototype,"worldToPCSRatio",null),e([h()],se.prototype,"renderer",void 0),e([h({constructOnly:!0})],se.prototype,"view",void 0),e([h({constructOnly:!0})],se.prototype,"surface",void 0),e([h()],se.prototype,"suspended",null),e([h()],se.prototype,"updating",null),e([h({type:Boolean})],se.prototype,"rendersOccludedDraped",null),se=e([c("esri.views.3d.terrain.OverlayManager")],se);class ne{constructor(){this.inner=S(),this.outer=S(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=ee}}const ae=O(),oe=g(),le=new ne,he=S(),ce=S(),de=U();var ue;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(ue||(ue={}));export{se as OverlayManager};