@arcgis/core 5.1.0-next.110 → 5.1.0-next.112

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 (312) hide show
  1. package/analysis/ElevationProfile/ElevationProfileGroup.d.ts +3 -0
  2. package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +1 -0
  3. package/analysis/ElevationProfileAnalysis.d.ts +5 -0
  4. package/analysis/ShadowCast/DiscreteOptions.d.ts +2 -2
  5. package/analysis/ShadowCast/TotalDurationOptions.d.ts +13 -4
  6. package/analysis/ShadowCastAnalysis.d.ts +8 -5
  7. package/arcade/Dictionary.js +1 -1
  8. package/arcade/Feature.js +1 -1
  9. package/arcade/Pixel.js +1 -1
  10. package/arcade/Voxel.js +1 -1
  11. package/arcade/arcade.js +1 -1
  12. package/arcade/arcadeAsyncRuntime.js +1 -1
  13. package/arcade/arcadeCompiler.js +1 -1
  14. package/arcade/arcadeEnvironment.js +1 -1
  15. package/arcade/arcadeRuntime.js +1 -1
  16. package/arcade/compilerUtils.js +1 -1
  17. package/arcade/containerUtils.js +1 -1
  18. package/arcade/debug.js +1 -1
  19. package/arcade/enum.js +1 -1
  20. package/arcade/executionError.js +1 -1
  21. package/arcade/functions/convertdirection.js +1 -1
  22. package/arcade/functions/date.js +1 -1
  23. package/arcade/functions/feature.js +1 -1
  24. package/arcade/functions/featuresetbase.js +1 -1
  25. package/arcade/functions/featuresetgeom.js +1 -1
  26. package/arcade/functions/featuresetstats.js +1 -1
  27. package/arcade/functions/featuresetstring.js +1 -1
  28. package/arcade/functions/geomasync.js +1 -1
  29. package/arcade/functions/geometry.js +1 -1
  30. package/arcade/functions/geomsync.js +1 -1
  31. package/arcade/functions/knowledgegraph.js +1 -1
  32. package/arcade/functions/maths.js +1 -1
  33. package/arcade/functions/stats.js +1 -1
  34. package/arcade/functions/string.js +1 -1
  35. package/arcade/functions/track.js +1 -1
  36. package/arcade/geometry/constructors.js +1 -1
  37. package/arcade/geometry/functions.js +1 -1
  38. package/arcade/geometry/unitConversion.js +1 -1
  39. package/arcade.js +1 -1
  40. package/assets/components/assets/icon/returnToDefault16.json +1 -0
  41. package/assets/components/assets/icon/returnToDefault24.json +1 -0
  42. package/assets/components/assets/icon/returnToDefault32.json +1 -0
  43. package/assets/components/assets/icon/reviewMap16.json +1 -0
  44. package/assets/components/assets/icon/reviewMap24.json +1 -0
  45. package/assets/components/assets/icon/reviewMap32.json +1 -0
  46. package/assets/esri/core/workers/RemoteClient.js +1 -1
  47. package/assets/esri/core/workers/chunks/03babc21d1781142a974.js +1 -0
  48. package/assets/esri/core/workers/chunks/08efd64acdfe46985293.js +1 -0
  49. package/assets/esri/core/workers/chunks/0b76534b60014d74ecb9.js +1 -0
  50. package/assets/esri/core/workers/chunks/{622bdd1b9d5d292ec12b.js → 0e6a388d51d9dbae46ba.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{34e026549ba2822b8ebd.js → 13d43a0683c42b94feb6.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{4f9ea7544b2d0e88a05c.js → 13f0e08de2dfab07d212.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{35bbd63319d8aa9f31cc.js → 169c9eb6cd000e067c4b.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{d4014213c476bf8099af.js → 18c4207b1cb0777560ba.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{58c15c42e6a618386a2f.js → 1c8c8050d60205cf2156.js} +1 -1
  56. package/assets/esri/core/workers/chunks/1f537c05c2f643acb5e7.js +1 -0
  57. package/assets/esri/core/workers/chunks/241aeff6afd074ce105b.js +1 -0
  58. package/assets/esri/core/workers/chunks/{ddebc1dc10a2d207389f.js → 282f3d364411efac7b80.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{d6d5ee9d0d998d730f81.js → 2bd334f9ab89334df713.js} +1 -1
  60. package/assets/esri/core/workers/chunks/340c68d09d2e8bef6727.js +2 -0
  61. package/assets/esri/core/workers/chunks/{17604cbd4d24158e2c16.js → 3835097520296b0517af.js} +1 -1
  62. package/assets/esri/core/workers/chunks/481dc7503587972a6bd2.js +2 -0
  63. package/assets/esri/core/workers/chunks/{9f4a9b193485f88d4461.js → 4afe76de6e82e86fe697.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{ac408c62565e2c8b5975.js → 4c5cdd2712c938fafc5d.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{ece30bfd5c49b8d99752.js → 5e5c7cc74ff1c9603aff.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{502c3da8c49bf885f51d.js → 63ea9035dcf9ce45560c.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{33ec193e6d7a0cb9d8dd.js → 6b66a6f69aa03338c346.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{56b6b68d9459b1edea43.js → 6c97b5bc408f051606d2.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{94eab215bab3e4e0e5b5.js → 711d1873c760313e287f.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{4e13d639419ac64f7563.js → 7c077e1a63ab97bf3e87.js} +1 -1
  71. package/assets/esri/core/workers/chunks/86f2de7dda7992ae706c.js +1 -0
  72. package/assets/esri/core/workers/chunks/{a29cd1f5c7bb4f6a5a4f.js → 8d4881c879c86b353e08.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{6e21675bbd7a44070771.js → 8ff83c59462dea6e3427.js} +1 -1
  74. package/assets/esri/core/workers/chunks/979bab62cad788180770.js +1 -0
  75. package/assets/esri/core/workers/chunks/9890c85a238879490926.js +1 -0
  76. package/assets/esri/core/workers/chunks/9ebc461529d5286fa2c2.js +2 -0
  77. package/assets/esri/core/workers/chunks/a95398214e530f896a2d.js +1 -0
  78. package/assets/esri/core/workers/chunks/{fc1fe1f58a65a1694c09.js → b02a68bbab07557cf02d.js} +1 -1
  79. package/assets/esri/core/workers/chunks/ba31616de9d73d83d867.js +1 -0
  80. package/assets/esri/core/workers/chunks/c7662455252b48531da1.js +1 -0
  81. package/assets/esri/core/workers/chunks/ca92176d5348e2c533d7.js +1 -0
  82. package/assets/esri/core/workers/chunks/cd5206e19d86c60e3cf0.js +1 -0
  83. package/assets/esri/core/workers/chunks/{bfb417d72d0c90e116fe.js → cedf3e316d6f89cf7005.js} +1 -1
  84. package/assets/esri/core/workers/chunks/d02aa7438f46c1c2167a.js +2 -0
  85. package/assets/esri/core/workers/chunks/d33a08e5f589355c57a3.js +1 -0
  86. package/assets/esri/core/workers/chunks/dd29fd1b3da90d3ca6b1.js +1 -0
  87. package/assets/esri/core/workers/chunks/e0036fa0324a96a88248.js +1 -0
  88. package/assets/esri/core/workers/chunks/{55334ad3618899cdbf78.js → e5854a3f69dffaf9464d.js} +2 -2
  89. package/assets/esri/core/workers/chunks/ed939fd5d3827a3f70e0.js +1 -0
  90. package/assets/esri/core/workers/chunks/fe8334352d256d691a95.js +1 -0
  91. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +7 -0
  92. package/assets/esri/themes/dark/main.css +1 -1
  93. package/assets/esri/themes/light/main.css +1 -1
  94. package/assets/esri/themes/light/view.css +1 -1
  95. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis.json +1 -1
  96. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ar.json +1 -1
  97. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_en.json +1 -1
  98. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  99. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  100. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  101. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  102. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  103. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  104. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  105. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  106. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  107. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  108. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  109. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  110. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  111. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  112. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  113. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  114. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  115. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  116. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  117. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  118. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  119. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  120. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  121. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  122. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  123. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  124. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  125. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  126. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  127. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  128. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  129. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  130. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  131. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  132. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  133. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  134. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  135. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  136. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  137. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  138. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  139. package/chunks/aiServices.js +1 -1
  140. package/chunks/arcade.js +1 -1
  141. package/chunks/array.js +1 -1
  142. package/chunks/languageUtils.js +1 -1
  143. package/config.js +1 -1
  144. package/identity/IdentityModal.js +1 -1
  145. package/kernel.js +1 -1
  146. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  147. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  148. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  149. package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
  150. package/layers/support/SceneModification.js +1 -1
  151. package/layers/support/SceneModifications.js +1 -1
  152. package/layers/support/parquetUtils.js +1 -1
  153. package/package.json +2 -2
  154. package/renderers/ClassBreaksRenderer.js +1 -1
  155. package/renderers/UniqueValueRenderer.js +1 -1
  156. package/rest/print.js +1 -1
  157. package/rest/support/TranslateContent.js +1 -1
  158. package/rest/support/TranslateParameters.js +1 -1
  159. package/rest/support/TranslateResult.js +1 -1
  160. package/rest/translate.js +1 -1
  161. package/rest/utils.js +1 -1
  162. package/support/arcadeUtils.js +1 -1
  163. package/support/revision.js +1 -1
  164. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  165. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  166. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  167. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  168. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  169. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  170. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  171. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  172. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  173. package/views/3d/state/utils/navigationUtils.js +1 -1
  174. package/views/3d/support/QualityProfile.js +1 -1
  175. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  176. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  177. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  178. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  179. package/views/3d/webgl-engine/lib/PathEvaluator.js +2 -0
  180. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  181. package/views/3d/webgl-engine/lib/PathFrame2D.js +2 -0
  182. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  183. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  184. package/views/3d/webgl-engine/lib/PathVertexInfo.js +2 -0
  185. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  186. package/views/DOMContainer.d.ts +2 -0
  187. package/views/LinkChartView.d.ts +47 -0
  188. package/views/MapView.d.ts +1 -85
  189. package/views/VideoView.d.ts +8 -1
  190. package/views/View2D.d.ts +78 -2
  191. package/views/draw/support/Reshape.js +1 -1
  192. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  193. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  194. package/views/types.d.ts +2 -3
  195. package/views/ui/DefaultUI.d.ts +1 -0
  196. package/widgets/Attachments.js +1 -1
  197. package/widgets/BasemapGallery.js +1 -1
  198. package/widgets/BasemapLayerList.js +1 -1
  199. package/widgets/BasemapToggle.js +1 -1
  200. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +10 -1
  201. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  202. package/widgets/BatchAttributeForm/css.js +1 -1
  203. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +25 -1
  204. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  205. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  206. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  207. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  208. package/widgets/BatchAttributeForm.js +1 -1
  209. package/widgets/Bookmarks.js +1 -1
  210. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  211. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  212. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  213. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  214. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  215. package/widgets/CatalogLayerList.js +1 -1
  216. package/widgets/Compass.js +1 -1
  217. package/widgets/CoordinateConversion.js +1 -1
  218. package/widgets/Daylight.js +1 -1
  219. package/widgets/DirectionalPad.js +1 -1
  220. package/widgets/Directions.js +1 -1
  221. package/widgets/Editor/components/FeatureList.js +1 -1
  222. package/widgets/Editor/components/FooterActions.js +1 -1
  223. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  224. package/widgets/Editor/components/Prompt.js +1 -1
  225. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  226. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  227. package/widgets/ElevationProfile.js +1 -1
  228. package/widgets/Expand.js +1 -1
  229. package/widgets/Feature/FeatureMedia.js +1 -1
  230. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  231. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  232. package/widgets/FeatureForm.js +1 -1
  233. package/widgets/FeatureTable.js +1 -1
  234. package/widgets/Features/FeaturesDrillIn.js +1 -1
  235. package/widgets/Features.js +1 -1
  236. package/widgets/FloorFilter.js +1 -1
  237. package/widgets/FovOverlay.js +1 -1
  238. package/widgets/Fullscreen.js +1 -1
  239. package/widgets/Home.js +1 -1
  240. package/widgets/LayerList/LayerListItem.js +1 -1
  241. package/widgets/LayerList.js +1 -1
  242. package/widgets/Locate.js +1 -1
  243. package/widgets/NavigationToggle.js +1 -1
  244. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  245. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  246. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  247. package/widgets/OrientedImageryViewer/components/NavigationActions.js +1 -1
  248. package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
  249. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  250. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  251. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  252. package/widgets/OrientedImageryViewer.js +1 -1
  253. package/widgets/PanoramicVideoViewer.js +1 -1
  254. package/widgets/Print/PrintViewModel.js +1 -1
  255. package/widgets/Print.js +1 -1
  256. package/widgets/Search.js +1 -1
  257. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  258. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  259. package/widgets/Sketch.js +1 -1
  260. package/widgets/Slice.js +1 -1
  261. package/widgets/Slider.js +1 -1
  262. package/widgets/Swipe.js +1 -1
  263. package/widgets/TableList.js +1 -1
  264. package/widgets/TimeSlider.js +1 -1
  265. package/widgets/TimeZoneLabel.js +1 -1
  266. package/widgets/Track.js +1 -1
  267. package/widgets/UtilityNetworkAssociations.js +1 -1
  268. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  269. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  270. package/widgets/UtilityNetworkTrace.js +1 -1
  271. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  272. package/widgets/ValuePicker.js +1 -1
  273. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  274. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  275. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  276. package/widgets/Weather.js +1 -1
  277. package/widgets/Zoom.js +1 -1
  278. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  279. package/widgets/support/ColorPicker.js +1 -1
  280. package/widgets/support/ContingentValuesManager.js +1 -1
  281. package/widgets/support/FilterBuilder.js +1 -1
  282. package/widgets/support/GridControls.js +1 -1
  283. package/widgets/support/ItemList.js +1 -1
  284. package/widgets/support/LabeledSwitch.js +1 -1
  285. package/widgets/support/SelectionList.js +1 -1
  286. package/assets/esri/core/workers/chunks/1d1929f98d941179be29.js +0 -2
  287. package/assets/esri/core/workers/chunks/286bf3be9f524bde9529.js +0 -1
  288. package/assets/esri/core/workers/chunks/36ecb0082b8804b10fbf.js +0 -1
  289. package/assets/esri/core/workers/chunks/41a95ad470ec42ecd5a2.js +0 -1
  290. package/assets/esri/core/workers/chunks/547dc6ccb989bd962661.js +0 -1
  291. package/assets/esri/core/workers/chunks/549d348ca181d06aefb7.js +0 -2
  292. package/assets/esri/core/workers/chunks/56d9d3f108ff6e719dd4.js +0 -1
  293. package/assets/esri/core/workers/chunks/5c44638670e40e092ce3.js +0 -1
  294. package/assets/esri/core/workers/chunks/63934843c9f4ef779a07.js +0 -1
  295. package/assets/esri/core/workers/chunks/69c9eb93553b006b640d.js +0 -2
  296. package/assets/esri/core/workers/chunks/8330302096d4312a4393.js +0 -1
  297. package/assets/esri/core/workers/chunks/885eac78a76184efa1e5.js +0 -1
  298. package/assets/esri/core/workers/chunks/95dee5853c6e89f15ea9.js +0 -1
  299. package/assets/esri/core/workers/chunks/9da2f2b67837b491cfa3.js +0 -1
  300. package/assets/esri/core/workers/chunks/a913a1c83a667ed0e711.js +0 -1
  301. package/assets/esri/core/workers/chunks/b69d1d528e271568cbd8.js +0 -2
  302. package/assets/esri/core/workers/chunks/bc249bb667f0564ad093.js +0 -1
  303. package/assets/esri/core/workers/chunks/c8b96104641cb4afd4df.js +0 -1
  304. package/assets/esri/core/workers/chunks/cdb48d198145493f76f3.js +0 -1
  305. package/assets/esri/core/workers/chunks/e2bb95d601789bbda73b.js +0 -1
  306. package/assets/esri/core/workers/chunks/f1bb426400dac02880f1.js +0 -1
  307. package/assets/esri/core/workers/chunks/f3f984c62311c20a9db8.js +0 -1
  308. /package/assets/esri/core/workers/chunks/{69c9eb93553b006b640d.js.LICENSE.txt → 340c68d09d2e8bef6727.js.LICENSE.txt} +0 -0
  309. /package/assets/esri/core/workers/chunks/{549d348ca181d06aefb7.js.LICENSE.txt → 481dc7503587972a6bd2.js.LICENSE.txt} +0 -0
  310. /package/assets/esri/core/workers/chunks/{1d1929f98d941179be29.js.LICENSE.txt → 9ebc461529d5286fa2c2.js.LICENSE.txt} +0 -0
  311. /package/assets/esri/core/workers/chunks/{b69d1d528e271568cbd8.js.LICENSE.txt → d02aa7438f46c1c2167a.js.LICENSE.txt} +0 -0
  312. /package/assets/esri/core/workers/chunks/{55334ad3618899cdbf78.js.LICENSE.txt → e5854a3f69dffaf9464d.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as r}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as a,convertUnit as n}from"../../../core/units.js";import{property as l,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import u from"../../../geometry/HeightModelInfo.js";import{create as c}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as m}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as p,isWebMercator as f,equals as g,isGeographic as y}from"../../../geometry/support/spatialReferenceUtils.js";import _ from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as w}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as v}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as S}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as b}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as C}from"./LayerView3D.js";import{addLayerViewToWasm as M,getLyr3DWasm as x,removeLayerViewFromWasm as I}from"./Lyr3DWasm.js";import{LayerElevationProvider as T}from"./i3s/LayerElevationProvider.js";import{ElevationRange as H}from"../support/ElevationRange.js";import{projectToBoundingBox as A}from"../support/extentUtils.js";import{Obb as R}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as P,packedGaussianSizeInU32 as j,splatPageSizeInU32WithoutHeader as F,gaussiansPerSplatPage as O,elementsPerSplatPage as G,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as E}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as V}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as B}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as z}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as k}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import N from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as q,isInEffectiveScaleRange as D}from"../../support/layerViewUtils.js";import{TaskPriority as W}from"../../support/Scheduler.js";var $;const X=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),Z=3,J=Z*Z,K=255,Y=(()=>{const e=new Int16Array(K+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/K));return e})();let Q=class extends(C(N)){static{$=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(P),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(W.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=c();return A(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw q("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=M(this).then(e=>{this._wasmLayerId=e,this._renderNode=new z({view:this.view,layerView:this}),this.data=new E(this._renderNode,(e,t)=>this._onSortComplete(e,t)),this._shadowRenderNode=new k({view:this.view,layerView:this}),this.fadeHelper=new V(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new T({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),s(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),r)]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r),this.addHandles([s(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,r)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([s(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),s(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),s(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return x(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return v(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new H(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return D(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return()=>({memUsageBytes:0,numGaussians:0});const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)return X().warnOnce("unexpected meshData.data format"),()=>({memUsageBytes:0,numGaussians:0});l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),u=2.048,c=o.tileOrigin.x*u,m=o.tileOrigin.y*u,p=o.tileOrigin.z*u;let f=null;if(t.desc.obb){const e=t.desc.obb.quaternion;f=new R(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}f||(X().warnOnce("encountered tile without a bounding box"),f=new R);const g=this.view.state.isGlobal,y=g?d(this.view.spatialReference).radius:0,_={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:m,z:p},invPosScale:o.invPosScale,obb:f,origin:{x:f.centerX,y:f.centerY,z:f.centerZ},isGlobal:g,ellipsoidRadius:y},w=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(_,e),this._createRenderableAbortController.signal);return()=>w}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,m=n.y,p=n.z,f=h.x,g=h.y,y=h.z,_=new Uint32Array(r),w=new Float32Array(3*r),v=new Uint32Array(r),S=new Uint32Array(r),b=new Array,C=Math.ceil(r/O);for(let H=0;H<C;H++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)return X().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};b.push(e);const i=r-H*O,n=Math.min(i,O),l=H*O,o=G*e;for(let t=0;t<n;t++)_[l+t]=o+t;const h=H*F;this._pageBuffer.set(s.subarray(h,h+n*j)),this._pageBuffer.set(a,F);const d=e*G,u=d%U,c=Math.floor(d/U);this.data.textureAtlas.update(u,c,this._pageBuffer),t.madeProgress()&&(t=yield)}let M=1/0,x=-1/0,I=1/0,T=-1/0,A=0,R=-1,P=0;for(let H=0;H<r;H++){const e=H*j,i=s[e],r=s[e+1],a=s[e+2],n=s[e+3],o=16383&r,h=r>>>14&16383,u=r>>>28&15|(1023&a)<<4,_=Y[n>>>24],b=(a>>>10&255)+_,C=(a>>>18&255)+_,F=(a>>>26&63|(3&n)<<6)+_,O=b>0?b:0,G=C>0?C:0,U=F>0?F:0,E=O|G<<8|U<<16,V=Math.max(O,G,U),L=o*l+c,B=h*l+m,z=u*l+p;if(w[A]=L-f,w[A+1]=B-g,w[A+2]=z-y,d){const e=L*L+B*B+z*z;I=Math.min(I,e),T=Math.max(T,e)}else M=Math.min(M,z),x=Math.max(x,z);v[H]=i,S[H]=E,V>R&&(R=V),A+=3,P++,P===$.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(M=Math.sqrt(I)-u,x=Math.sqrt(T)-u);const E=this._extractGaussianSplatMbsRadiusSquared(R),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(M=Math.max(M,V.zmin),x=Math.min(x,V.zmax));const L=new H(M,x),z=new B(i,o,_,b,w,v,S,r,E,L);return this._memCache.put(`${z.handle}`,z),this._tileHandles.set(i,z),this._cacheTileMemory+=z.usedMemory,{memUsageBytes:z.usedMemory,numGaussians:r}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*J}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);let t=!1;const i=this._tileHandles.get(e);if(i){0!==i.lifecycleState?(t=!0,this.fadeHelper.onTileDiscarded(i),this._usedTileMemory-=i.usedMemory,this._intersectionHandler.removeTile(i)):this._cacheTileMemory-=i.usedMemory,i.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(i),this._tileHandles.delete(e)}t&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1;let r=!1;for(let a=0;a<i;a++){const i=this._tileHandles.get(e[a]);if(!i)continue;const n=t[a]?this._prepareTileFadeIn(i,s):this._prepareTileFadeOut(i,s);r||=n}r&&(this._currentLyr3dVisibilityChange=s,this.updateGaussians())}_prepareTileFadeIn(e,t){const i=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):i}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}this._triggerFadeIns(t,s,i);const r=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians()}_triggerFadeIns(e,t,i){for(const[s,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(s))continue;const a=this._tileHandles.get(s);if(!a){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=0===a.lifecycleState;2!==a.lifecycleState&&(a.lifecycleState=2,n&&this._popTileFromCache(a),i.push(a)),this.fadeHelper.fadeTile(a,0),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState;this.fadeHelper.fadeTile(a,1),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(`${e.handle}`,e)}destroy(){this._createRenderableAbortController.abort(),I(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode.destroy(),this._renderNode.destroy(),this.data.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(p(this.view.renderSpatialReference)||f(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&g(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=w(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!y(t)&&t.wkid&&-1!==t.wkid&&(i=a(_.units[_[t.wkid]])),i&&(e=new u({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===m(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=S(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,v(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,a=this.data?.sortBufferMemory??0;return new b(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a)}get test(){}};e([l()],Q.prototype,"layer",void 0),e([l({readOnly:!0})],Q.prototype,"_clippingBox",null),e([l()],Q.prototype,"elevationOffset",null),e([l({readOnly:!0})],Q.prototype,"visibleAtCurrentScale",null),e([l()],Q.prototype,"fullExtentInLocalViewSpatialReference",void 0),Q=$=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],Q);const ee=Q;export{ee as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as r,convertUnit as n}from"../../../core/units.js";import{property as l,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import u from"../../../geometry/HeightModelInfo.js";import{create as c}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as p}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as f,equals as g,isGeographic as y}from"../../../geometry/support/spatialReferenceUtils.js";import _ from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as w}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as v}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as b}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as S}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as C}from"./LayerView3D.js";import{addLayerViewToWasm as M,getLyr3DWasm as x,removeLayerViewFromWasm as H}from"./Lyr3DWasm.js";import{LayerElevationProvider as I}from"./i3s/LayerElevationProvider.js";import{ElevationRange as T}from"../support/ElevationRange.js";import{projectToBoundingBox as A}from"../support/extentUtils.js";import{Obb as P}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as F,packedGaussianSizeInU32 as R,splatPageSizeInU32WithoutHeader as V,gaussiansPerSplatPage as j,elementsPerSplatPage as O,splatAtlasTextureWidth as G}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as U}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as E}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as D}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as L}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as B}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as z}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import k from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as N,isInEffectiveScaleRange as q}from"../../support/layerViewUtils.js";import{TaskPriority as W}from"../../support/Scheduler.js";var $;const X=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),Z=3,J=Z*Z,K=255,Y=(()=>{const e=new Int16Array(K+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/K));return e})();let Q=class extends(C(k)){static{$=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(F),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(W.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=c();return A(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw N("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=M(this).then(e=>{this._wasmLayerId=e,this._renderNode=new B({view:this.view,layerView:this}),this.data=new U(this._renderNode,(e,t)=>this._onSortComplete(e,t)),this._shadowRenderNode=new z({view:this.view,layerView:this}),this.fadeHelper=new E(this),this._intersectionHandler=new D(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new I({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),s(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([s(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([s(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),s(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),s(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return x(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return v(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new T(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return q(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return()=>({memUsageBytes:0,numGaussians:0});const a=i.atrbs[0].view,r=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==a.type)return X().warnOnce("unexpected meshData.data format"),()=>({memUsageBytes:0,numGaussians:0});l=new Uint32Array(t.data.buffer,n,r/4);const o=this.extractHeader(l),u=2.048,c=o.tileOrigin.x*u,p=o.tileOrigin.y*u,m=o.tileOrigin.z*u;let f=null;if(t.desc.obb){const e=t.desc.obb.quaternion;f=new P(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}f||(X().warnOnce("encountered tile without a bounding box"),f=new P);const g=this.view.state.isGlobal,y=g?d(this.view.spatialReference).radius:0,_={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:p,z:m},invPosScale:o.invPosScale,obb:f,origin:{x:f.centerX,y:f.centerY,z:f.centerZ},isGlobal:g,ellipsoidRadius:y},w=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(_,e),this._createRenderableAbortController.signal);return()=>w}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:a,packedHeader:r,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,m=n.z,f=h.x,g=h.y,y=h.z,_=new Uint32Array(a),w=new Float32Array(3*a),v=new Uint32Array(a),b=new Uint32Array(a),S=new Array,C=Math.ceil(a/j);for(let T=0;T<C;T++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)return X().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};S.push(e);const i=a-T*j,n=Math.min(i,j),l=T*j,o=O*e;for(let t=0;t<n;t++)_[l+t]=o+t;const h=T*V;this._pageBuffer.set(s.subarray(h,h+n*R)),this._pageBuffer.set(r,V);const d=e*O,u=d%G,c=Math.floor(d/G);this.data.textureAtlas.update(u,c,this._pageBuffer),t.madeProgress()&&(t=yield)}let M=1/0,x=-1/0,H=1/0,I=-1/0,A=0,P=-1,F=0;for(let T=0;T<a;T++){const e=T*R,i=s[e],a=s[e+1],r=s[e+2],n=s[e+3],o=16383&a,h=a>>>14&16383,u=a>>>28&15|(1023&r)<<4,_=Y[n>>>24],S=(r>>>10&255)+_,C=(r>>>18&255)+_,V=(r>>>26&63|(3&n)<<6)+_,j=S>0?S:0,O=C>0?C:0,G=V>0?V:0,U=j|O<<8|G<<16,E=Math.max(j,O,G),D=o*l+c,L=h*l+p,B=u*l+m;if(w[A]=D-f,w[A+1]=L-g,w[A+2]=B-y,d){const e=D*D+L*L+B*B;H=Math.min(H,e),I=Math.max(I,e)}else M=Math.min(M,B),x=Math.max(x,B);v[T]=i,b[T]=U,E>P&&(P=E),A+=3,F++,F===$.createRenderableBatchSize&&(F=0,t.madeProgress()&&(t=yield))}F>0&&t.madeProgress(),d&&(M=Math.sqrt(H)-u,x=Math.sqrt(I)-u);const U=this._extractGaussianSplatMbsRadiusSquared(P),{fullExtent:E}=this.layer;E?.hasZ&&E.zmax&&E.zmin&&(M=Math.max(M,E.zmin),x=Math.min(x,E.zmax));const D=new T(M,x),B=new L(i,o,_,S,w,v,b,a,U,D);return this._memCache.put(`${B.handle}`,B),this._tileHandles.set(i,B),this._cacheTileMemory+=B.usedMemory,{memUsageBytes:B.usedMemory,numGaussians:a}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*J}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);let t=!1;const i=this._tileHandles.get(e);if(i){0!==i.lifecycleState?(t=!0,this.fadeHelper.onTileDiscarded(i),this._usedTileMemory-=i.usedMemory,this._intersectionHandler.removeTile(i)):this._cacheTileMemory-=i.usedMemory,i.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(i),this._tileHandles.delete(e)}t&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,a=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,a);let r=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,a):this._prepareTileFadeOut(i,s);r||=l}r?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let r=0;r<e.length;r++){const t=e[r];s.add(t.handle)}this._triggerFadeIns(t,s,i);const a=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),a&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,a]of this._tileFadeInsAwaitingInitialSort){if(a>e||!t.has(s))continue;const r=this._tileHandles.get(s);if(!r){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(a),l=0===r.lifecycleState;2!==r.lifecycleState&&(r.lifecycleState=2,l&&this._popTileFromCache(r),i.push(r)),this.fadeHelper.fadeTile(r,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,a]of this._tileFadeOutsAwaitingInitialSort){if(a>e)continue;const r=this._tileHandles.get(s);if(r){const e=2===r.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(a);this.fadeHelper.fadeTile(r,1,s),e&&0===r.lifecycleState&&(t.push(r),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(`${e.handle}`,e)}destroy(){this._createRenderableAbortController.abort(),H(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode.destroy(),this._renderNode.destroy(),this.data.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||f(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&g(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=w(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!y(t)&&t.wkid&&-1!==t.wkid&&(i=r(_.units[_[t.wkid]])),i&&(e=new u({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===p(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=b(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,v(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),a=this.reinterpretU32AsFloat(e[t+2]),r=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:a},invPosScale:r}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,r=this.data?.sortBufferMemory??0;return new S(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,a,r)}get test(){}};e([l()],Q.prototype,"layer",void 0),e([l({readOnly:!0})],Q.prototype,"_clippingBox",null),e([l()],Q.prototype,"elevationOffset",null),e([l({readOnly:!0})],Q.prototype,"visibleAtCurrentScale",null),e([l()],Q.prototype,"fullExtentInLocalViewSpatialReference",void 0),Q=$=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],Q);const ee=Q;export{ee as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as a,when as n}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as p}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as y,dot as _,set as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,freeze as x,clone as T,fromValues as j,ZEROS as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as O,clone as E,ONES as M}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as R,isMars as V,getReferenceEllipsoid as S,SphericalECEFSpatialReferenceLike as U}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as H}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as D}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as P}from"../../../geometry/projection/projectVectorToVector.js";import{create as I}from"../../../geometry/support/aaBoundingRect.js";import{isCGCS2000 as k}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as L,BufferViewVec4u8 as A,BufferViewVec4u16 as F,BufferViewVec3f as G,BufferViewVec3u8 as B,BufferViewVec3u16 as z,BufferViewVec2f as N,BufferViewUint32 as W,BufferViewUint16 as q}from"../../../geometry/support/buffer/BufferView.js";import $ from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as X}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as Z}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as J}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as Y}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as K,getLyr3DWasm as ee}from"./Lyr3DWasm.js";import{toWasmModification as te}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as ie}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as se}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as re,alphaModeConversion as oe,faceCullingConversion as ae,wrapModeConversion as ne}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as le}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as ce}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as de}from"../state/Frustum.js";import{ElevationRange as he}from"../support/ElevationRange.js";import{toBoundingRect as ue}from"../support/extentUtils.js";import{Obb as me}from"../support/orientedBoundingBox.js";import{glLayout as pe}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as be,SourceGeometry as fe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ge}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ye}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as _e}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as ve}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as we}from"../webgl-engine/materials/pbrUtils.js";import xe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Te,isInEffectiveScaleRange as je,validateScaleRange as Ce}from"../../support/layerViewUtils.js";import{TaskPriority as Oe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ee}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as Me,SizedPixelFormat as Re}from"../../webgl/enums.js";import{alphaCutoff as Ve}from"../../../webscene/support/AlphaCutoff.js";var Se;function Ue(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return Me.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return Me.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Re.RG8;case 6407:return Re.RGB8;case 6408:return Re.RGBA8;case 6403:return Re.R8;default:return null}}let He=class extends(J(xe)){static{Se=se}constructor(e){super(e),this[Se]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ee,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Oe.TILES3D,this),this._frustum=new de(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new Z(le(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Te("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=Q(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ce(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new ie({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([a(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.fullOpacity,()=>this._opacityChange()),a(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),K(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=te(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=I();this._layerClippingArea=ue(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,X(e))}get _wasm(){return ee(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||je(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Ce(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(a=>{a.isLoaded?(e+=a.textureMemoryUsage,t+=a.vboMemoryUsage,r++):(i+=a.textureMemoryUsage,s+=a.vboMemoryUsage,o++)}),new Y(this.usedMemory,r,o,Ie(t),Ie(e),Ie(s),Ie(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return X(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new he(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new he;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||k(i)||R(i)||V(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=S(i).radius,{eye:o,viewForward:a,near:n}=t.state.camera,l=g(w(),a),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,b=w();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;y(b,s,o);const r=_(b,l);Math.abs(r)<p&&r+i>n&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!Ge(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage?.removeTexture(e)),o}let r=null;try{if(r=await this._createRenderableMain(t,s),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:a,elevationRange:n}=r;let l=0,c=0,d=0;for(const e of a){const{texture:t,textureMetallicRoughness:i,textureEmissive:s,textureOcclusion:r,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Pe(e.handle,a,h,d,c,l,o,e.stableNodeId,e.nodeDepth,n);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(Le(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(o){throw s.forEach(e=>e.cleanup()),r?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{const r=e.desc;for(let o=0;o<s;o++){const s=r.prims[o].materialId,a=r.materials&&null!=s?r.materials[s]:null;let n=Promise.resolve(Ae),l=null,c=null,d=null,h=null,u=null;if(a){const i="Pbr"===a.lightingModel;l=this._getTexture(a.baseColorTex,e,t),c=i?this._getTexture(a.metalTex,e,t):null,d=i?this._getTexture(a.emissiveTex,e,t):null,h=i?this._getTexture(a.occlusionTex,e,t):null,u=i?this._getTexture(a.normalTex,e,t):null;const s=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(s)}i.push(new Fe(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,s=e.desc,r=e.data.buffer,o=s.prims.length,a=x(...s.origin),n=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=p;if(l){const e=b();H(U,a,e,n),c=h(m(),e)}if(null==s.obb)throw new Error("meshData.desc.obb undefined");const d=ke(s.obb),f=l?S(this.view.spatialReference).radius:0,g=new Array;try{for(let i=0;i<o;i++){const e=s.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==re[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:a,normalsData:n,colorView:l,texCoord0Data:c,indicesView:d}=this.getBufferViews(e,r);if(null==a||null==d){o.cleanup();continue}const h=a.count,u=(e,t)=>null==e||e===h||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);u(null!=c?c.length/2:void 0,"numTexcoord")&&u(l?.count,"numColors")&&u(n?.length,"normals")?g.push({componentIndex:i,positionView:a,indicesView:d,texCoord0Data:c,colorView:l,normalsData:n}):o.cleanup()}const e=c!==p,h=e?u(m(),c)??p:p,{vertexProcessingOutputs:b,obbHalfSizeAccumulator:y,elevationRange:_}=await this._workerHandle.processTiles3DVertices(g,a,f,l,c,d,this._imVertexNormals);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const v=s.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");for(const r of b){const{componentIndex:o,positionView:l,indicesView:c,layout:u,textureCoordinateType:m,interleavedVertexData:p,indices:b}=r,f=s.prims[o],g=t[o],y=d.clone(),_=pe(u),x=new Uint32Array([0,c.typedBuffer.length]),T=new be(_,this._imShading?2:0,m,e?2:0),j=new fe({interleavedVertexData:p,vertexCount:p.byteLength/_[0].stride,indexData:b},{positions:l.typedBuffer,indices:c.typedBuffer},x,T),C=this.view.renderSpatialReference,E=w(),M=[1,1,1];D(a,C,M,n)||this._dbg(3,"Unsupported coordinate system for IM overlay"),P(a,C,E,n);const R=v&&null!=f.materialId?v[f.materialId]:null,V=this._createComponentMaterialInitParameters(R,g);V.baseColorTexture||this._dbg(3,"No colour texture 1");const S=this._collection.createObject({toMapSpace:O(E[0],E[1],M[0],M[1]),transform:new ge(a,h),obb:y,geometry:j,elevationAlignable:!1},V);i.push(S)}i.length>0&&d.setHalfSize(y[0],y[1],y[2]);const{fullExtent:x}=this.layer;return x?.hasZ&&x.zmax&&x.zmin&&(_.minElevation=Math.max(_.minElevation,x.zmin),_.maxElevation=Math.min(_.maxElevation,x.zmax)),{tileObb:d,componentObjects:i,elevationRange:_}}catch(y){throw i.forEach(e=>this._collection.destroyObject(e)),y}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let s=M,r=Ve,o=1,a=!1,n=2,l=j(0,0,0);const c=T(we),d=t.baseColorTexture,h=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(s=E(e.baseColorFactor),r=e.alphaCutoff??Ve,i&&(v(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=oe[e.alphaMode],a=e.isDoubleSided,n=ae[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:r,mrrFactors:c,baseColorTexture:d,metallicRoughnessTexture:h,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:a,cullFace:n,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Le(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,a=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Le(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),a||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Le(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),a&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new ye(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,a=ne[e.wrapMode??"None"];let n=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,n=6403,d=""):"Rg8"===s.pixelFormat||"Ga8"===s.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===s.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=Ue(n,d,s.format),l=new _e(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:a,pixelFormat:n,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(l),i.set(s,l),l}return null}getBufferViews(e,t){let i,s,r,o,a;for(let l=0;l<e.atrbs.length;l++){const a=e.atrbs[l],{view:c}=a,d=void 0,h=c.byteOffset+c.byteCount;try{switch(a.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new G(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new G(t,c.byteOffset,d,h);o=new Uint32Array(e.count),ve(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new N(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new L(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new A(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new F(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new G(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new B(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new z(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+a.sem+"). Skipping vertex attribute.")}}catch(n){this._dbg(2,"Error Creating buffer ("+n+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":a=new q(t,i.byteOffset,s,r);break;case"U32":a=new W(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==a&&null!=i){const e=i.count;a=a=e<65535?new q(new Uint16Array(e).buffer):new W(new Uint32Array(e).buffer);for(let t=0;t<e;t++)a.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:a,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],He.prototype,"fullOpacity",null),e([c({readOnly:!0})],He.prototype,"ready",null),e([c({type:[$]})],He.prototype,"_modifications",void 0),e([c()],He.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],He.prototype,"layer",void 0),e([c({readOnly:!0})],He.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],He.prototype,"_collection",null),e([c()],He.prototype,"elevationOffset",null),e([c({readOnly:!0})],He.prototype,"visibleElevationRange",null),He=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],He);const De=He;class Pe{constructor(e,t,i,s,r,o,a,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=a,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=w();a?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=a?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=a?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=a?T(a.center):C}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],a=s-e[1],n=r-e[2],l=o*t[0]+a*t[1]+n*t[2];return o*o+a*a+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const a=this._obbCenterY-i[1];if(a>r)return!1;const n=this._obbCenterZ-i[2];if(n>r)return!1;const l=o*o+a*a+n*n;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;const c=s-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Ie(e){return Math.round(e/1048.576)/1e3}function ke(e){return new me(e.center,e.halfSize,f(...e.quaternion))}function Le(e){return`${e}`}const Ae=new Array;class Fe{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}function Ge(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}export{De as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{unitFromRESTJSON as c,convertUnit as d}from"../../../core/units.js";import{property as h,subclass as u}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as m,invert as p}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f,IDENTITY as b}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as _,sub as v,dot as w,set as x}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as C,freeze as T,clone as j,fromValues as E,ZEROS as R}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as M,clone as O,ONES as S}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as V,isMars as U,getReferenceEllipsoid as H,SphericalECEFSpatialReferenceLike as D}from"../../../geometry/ellipsoidUtils.js";import I from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as P}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as k}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as L}from"../../../geometry/projection/projectVectorToVector.js";import{create as A}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as F}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as G,isWebMercator as B,equals as z,isGeographic as N,isCGCS2000 as W}from"../../../geometry/support/spatialReferenceUtils.js";import q from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4f as $,BufferViewVec4u8 as X,BufferViewVec4u16 as Z,BufferViewVec3f as J,BufferViewVec3u8 as Y,BufferViewVec3u16 as K,BufferViewVec2f as Q,BufferViewUint32 as ee,BufferViewUint16 as te}from"../../../geometry/support/buffer/BufferView.js";import ie from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as se}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as re}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as oe}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as ne}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as ae}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as le,removeLayerViewFromWasm as ce,getLyr3DWasm as de}from"./Lyr3DWasm.js";import{toWasmModification as he}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as ue}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as me}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as pe,alphaModeConversion as fe,faceCullingConversion as be,wrapModeConversion as ge}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as ye}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as _e}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as ve}from"../state/Frustum.js";import{ElevationRange as we}from"../support/ElevationRange.js";import{toBoundingRect as xe}from"../support/extentUtils.js";import{Obb as Ce}from"../support/orientedBoundingBox.js";import{glLayout as Te}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as je,SourceGeometry as Ee}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Re}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Me}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as Oe}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Se}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ve}from"../webgl-engine/materials/pbrUtils.js";import Ue from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as He,isInEffectiveScaleRange as De,validateScaleRange as Ie}from"../../support/layerViewUtils.js";import{TaskPriority as Pe}from"../../support/Scheduler.js";import{TextureCompressionTracker as ke}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as Le,SizedPixelFormat as Ae}from"../../webgl/enums.js";import{alphaCutoff as Fe}from"../../../webscene/support/AlphaCutoff.js";var Ge;function Be(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return Le.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return Le.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Ae.RG8;case 6407:return Ae.RGB8;case 6408:return Ae.RGBA8;case 6403:return Ae.R8;default:return null}}let ze=class extends(ne(Ue)){static{Ge=me}constructor(e){super(e),this[Ge]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.drapeTargetType=1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new ke,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Pe.TILES3D,this),this._frustum=new ve(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new oe(ye(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw He("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=le(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new _e(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new ue({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),ce(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=he(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=A();this._layerClippingArea=xe(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,re(e))}get _wasm(){return de(this.view)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||De(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Ie(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new ae(this.usedMemory,r,o,qe(t),qe(e),qe(s),qe(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(G(this.view.renderSpatialReference)||B(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&z(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=se(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!N(t)&&t.wkid&&-1!==t.wkid&&(i=c(q.units[q[t.wkid]])),i&&(e=new I({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===F(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=d(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return re(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new we(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new we;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||W(i)||V(i)||U(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=H(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=_(C(),n),c=500,d=Math.max(o[2],c),h=d+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=d>.5*r?.5*Math.PI*r:m,f=C();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;v(f,s,o);const r=w(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!Ye(t))throw new Error("meshData not valid");const i=new Map;let s;try{s=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage?.removeTexture(e)),o}let r=null;try{if(r=await this._createRenderableMain(t,s),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:n,elevationRange:a}=r;let l=0,c=0,d=0;for(const e of n){const{texture:t,textureMetallicRoughness:i,textureEmissive:s,textureOcclusion:r,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(s?.usedMemory??0)+(r?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new We(e.handle,n,h,d,c,l,o,e.stableNodeId,e.nodeDepth,a);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(Xe(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(o){throw s.forEach(e=>e.cleanup()),r?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,s=e.desc.prims.length;try{const r=e.desc;for(let o=0;o<s;o++){const s=r.prims[o].materialId,n=r.materials&&null!=s?r.materials[s]:null;let a=Promise.resolve(Ze),l=null,c=null,d=null,h=null,u=null;if(n){const i="Pbr"===n.lightingModel;l=this._getTexture(n.baseColorTex,e,t),c=i?this._getTexture(n.metalTex,e,t):null,d=i?this._getTexture(n.emissiveTex,e,t):null,h=i?this._getTexture(n.occlusionTex,e,t):null,u=i?this._getTexture(n.normalTex,e,t):null;const s=[l,c,d,h,u].map(e=>e?.loadPromise??null);a=Promise.all(s)}i.push(new Je(a,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,s=e.desc,r=e.data.buffer,o=s.prims.length,n=T(...s.origin),a=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=b;if(l){const e=g();P(D,n,e,a),c=m(f(),e)}if(null==s.obb)throw new Error("meshData.desc.obb undefined");const d=$e(s.obb),h=l?H(this.view.spatialReference).radius:0,u=new Array;try{for(let i=0;i<o;i++){const e=s.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==pe[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:n,normalsData:a,colorView:l,texCoord0Data:c,indicesView:d}=this.getBufferViews(e,r);if(null==n||null==d){o.cleanup();continue}const h=n.count,m=(e,t)=>null==e||e===h||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);m(null!=c?c.length/2:void 0,"numTexcoord")&&m(l?.count,"numColors")&&m(a?.length,"normals")?u.push({componentIndex:i,positionView:n,indicesView:d,texCoord0Data:c,colorView:l,normalsData:a}):o.cleanup()}const e=c!==b,m=e?p(f(),c)??b:b,{vertexProcessingOutputs:g,obbHalfSizeAccumulator:y,elevationRange:_}=await this._workerHandle.processTiles3DVertices(u,n,h,l,c,d,this._imVertexNormals);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const v=s.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");for(const r of g){const{componentIndex:o,positionView:l,indicesView:c,layout:h,textureCoordinateType:u,interleavedVertexData:p,indices:f}=r,b=s.prims[o],g=t[o],y=d.clone(),_=Te(h),w=new Uint32Array([0,c.typedBuffer.length]),x=new je(_,this._imShading?2:0,u,e?2:0),T=new Ee({interleavedVertexData:p,vertexCount:p.byteLength/_[0].stride,indexData:f},{positions:l.typedBuffer,indices:c.typedBuffer},w,x),j=this.view.renderSpatialReference,E=C(),R=[1,1,1];k(n,j,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),L(n,j,E,a);const O=v&&null!=b.materialId?v[b.materialId]:null,S=this._createComponentMaterialInitParameters(O,g);S.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:M(E[0],E[1],R[0],R[1]),transform:new Re(n,m),obb:y,geometry:T,elevationAlignable:!1},S);i.push(V)}i.length>0&&d.setHalfSize(y[0],y[1],y[2]);const{fullExtent:w}=this.layer;return w?.hasZ&&w.zmax&&w.zmin&&(_.minElevation=Math.max(_.minElevation,w.zmin),_.maxElevation=Math.min(_.maxElevation,w.zmax)),{tileObb:d,componentObjects:i,elevationRange:_}}catch(y){throw i.forEach(e=>this._collection.destroyObject(e)),y}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let s=S,r=Fe,o=1,n=!1,a=2,l=E(0,0,0);const c=j(Ve),d=t.baseColorTexture,h=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(s=O(e.baseColorFactor),r=e.alphaCutoff??Fe,i&&(x(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=fe[e.alphaMode],n=e.isDoubleSided,a=be[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:r,mrrFactors:c,baseColorTexture:d,metallicRoughnessTexture:h,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:n,cullFace:a,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Xe(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Xe(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Xe(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=i.get(s)??this._createTexture(e,t,i);return r?new Me(this._stage.renderView.textures,r.id):null}_createTexture(e,t,i){const s=e&&t.desc?.images?.[e.imageId];if(!s||!t.data?.buffer)return null;const r=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!s.mipCount||r>1,n=ge[e.wrapMode??"None"];let a=s.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let c=null,d=null,h=null;switch(s.format){case"Raw":"R8"===s.pixelFormat?(c=l,a=6403,d=""):"Rg8"===s.pixelFormat||"Ga8"===s.pixelFormat?(c=l,a=33319,d=""):"Rgb8"===s.pixelFormat?(c=l,a=6407,d=""):"Rgba8"===s.pixelFormat&&(c=l,a=6408,d="");break;case"Dxt1":c=l,a=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,a=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,a=6407,d="image/ktx2";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=Be(a,d,s.format),l=new Oe(c,{mipmap:o,maxAnisotropy:r,encoding:d,wrap:n,pixelFormat:a,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height});return this._stage.addTexture(l),i.set(s,l),l}return null}getBufferViews(e,t){let i,s,r,o,n;for(let l=0;l<e.atrbs.length;l++){const n=e.atrbs[l],{view:c}=n,d=void 0,h=c.byteOffset+c.byteCount;try{switch(n.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new J(t,c.byteOffset,d,h);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new J(t,c.byteOffset,d,h);o=new Uint32Array(e.count),Se(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===r&&(r=new Q(t,c.byteOffset,d,h).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(s=new $(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new X(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new Z(t,c.byteOffset,d,h))):3===c.ncomp&&("F32"===c.type&&(s=new J(t,c.byteOffset,d,h)),"U8"===c.type&&(s=new Y(t,c.byteOffset,d,h)),"U16"===c.type&&(s=new K(t,c.byteOffset,d,h))),null==s&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+n.sem+"). Skipping vertex attribute.")}}catch(a){this._dbg(2,"Error Creating buffer ("+a+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":n=new te(t,i.byteOffset,s,r);break;case"U32":n=new ee(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==n&&null!=i){const e=i.count;n=n=e<65535?new te(new Uint16Array(e).buffer):new ee(new Uint32Array(e).buffer);for(let t=0;t<e;t++)n.set(t,t)}return{positionView:i,colorView:s,texCoord0Data:r,indicesView:n,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([h()],ze.prototype,"fullOpacity",null),e([h({readOnly:!0})],ze.prototype,"ready",null),e([h({type:[ie]})],ze.prototype,"_modifications",void 0),e([h()],ze.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([h()],ze.prototype,"layer",void 0),e([h({readOnly:!0})],ze.prototype,"visibleAtCurrentScale",null),e([h({readOnly:!0})],ze.prototype,"_collection",null),e([h()],ze.prototype,"elevationOffset",null),e([h({readOnly:!0})],ze.prototype,"visibleElevationRange",null),e([h()],ze.prototype,"fullExtentInLocalViewSpatialReference",void 0),ze=e([u("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],ze);const Ne=ze;class We{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=C();n?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?j(n.center):R}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;const c=s-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function qe(e){return Math.round(e/1048.576)/1e3}function $e(e){return new Ce(e.center,e.halfSize,y(...e.quaternion))}function Xe(e){return`${e}`}const Ze=new Array;class Je{constructor(e,t,i,s,r,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=s,this.occlusionTexture=r,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}function Ye(e){return null!=e.data&&("string"==typeof e.desc&&(e.desc=JSON.parse(e.desc)),null!=e.desc)}export{Ne as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import{translate as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,fromArray as n,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as c,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as m}from"../../../../geometry/projection/projectBuffer.js";import{create as f,fromSubBuffer as d,intersectsClippingArea as u}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as g,doubleArrayFrom as _}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{needsElevationUpdates3D as y,evaluateElevationAlignmentAtPoint as v,SampleElevationInfo as w}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as x}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as S,pathNumRoundCapExtrusionSubdivisions as C}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as P,nanFallbackColor as D}from"./Graphics3DSymbolLayer.js";import{isValidSize as j}from"./graphicUtils.js";import{ConvertOptions as V,initFastSymbolUpdatesState as U,updateFastSymbolUpdatesState as z,getSizeAttributeValue as A,getAttributeValue as E}from"../support/FastSymbolUpdates.js";import{SamplePosition as R}from"../../support/ElevationProvider.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{Path as L}from"../../webgl-engine/lib/Path.js";import{PathBuilder as G}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as O,TriangulationCapBuilder as I,NoCapBuilder as B}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as F,MiterExtruder as M}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as T,isPathGeometry as q}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as H,StaticPathGeometry as N}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as W}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as Z,circleProfiles as J}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as K}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as Q}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as X}from"../../webgl-engine/materials/PathMaterial.js";const Y=["polyline"];class $ extends P{constructor(e,t,r,i){super(e,t,r,i,se(t)),this._intrinsicSize=o(1,1),this._upVectorAlignment=1,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,r=null!=t.width?t.width:t.height,i=null!=t.height?t.height:r;this._vvConvertOptions=new V({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[r,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(D),fallbackSize:[r,1,i]});const o=this._context.renderer?.visualVariables;this._fastUpdates=o?.length?U(this._context.renderer,this._vvConvertOptions):null;const l=t.anchor||"center";this._upVectorAlignment="heading"===t.profileRotation?0:1;const h=t.profile||"circle";switch(h){default:case"circle":this._profile=J[l];break;case"quad":this._profile=Z[l]}switch(t.join){case"round":this._extruder=new M(0,S);break;case"bevel":this._extruder=new M(0,1);break;case"miter":this._extruder=new M(.8*Math.PI,1);break;default:this._extruder=new F}switch(this._cap){case"none":this._startCap=new B,this._endCap=new B;break;case"butt":default:this._startCap=new I(this._profile,0),this._endCap=new I(this._profile,0,!0);break;case"square":this._startCap=new I(this._profile,-.5),this._endCap=new I(this._profile,.5,!0);break;case"round":{const e="quad"===h;this._startCap=new O({profile:this._profile,flip:!1,breakNormals:e,subdivisions:C}),this._endCap=new O({profile:this._profile,flip:!0,breakNormals:e,subdivisions:C});break}}const p=this._materialColor,m=this._getCombinedOpacityAndColor(p),f=c(m),d=m[3],u=this.needsDrivenTransparentPass,g=t.material?.emissive,_={diffuse:f,ambient:f,emissiveStrengthFromSymbol:("color"===g?.source?g?.strength:void 0)??0,emissiveSource:1,opacity:d,drivenOpacity:u,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(s(this._intrinsicSize,r,i),!j(this._intrinsicSize[0])||!j(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let b;this._fastUpdates?.visualVariables.size||a(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?b=new X({..._,...this._fastUpdates.materialParameters,size:n(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=1,b=new Q(_,this._context)),b.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._materials[0]=b,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Y,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,y)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!z(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of r)t+=c.length;const n=g(3*t);let l,h=0;for(const c of r){i.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||m(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=_(n):(l=g(3*t),m(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,s){const{graphic:a,renderingInfo:o}=e,n=a.geometry,c=this._getVertexData(n);if(null==c)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===c.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some(e=>e.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const p=new Array,m=n.spatialReference,g=f(),_=this._context.renderCoordsHelper,w=new R(c.vertexDataES),S=a.uid,C=b(c.vertexDataRS.length);for(const f of c.pathVertexDataInfos){const e=f.numVertices;if(e<2)continue;const a=f.offset;if(null!=this._context.clippingExtent&&(d(c.vertexDataES,a,e,g),!u(g,this._context.clippingExtent)))continue;const n=new Array,b=a+3*e;for(let t=a;t<b;t+=3){w.offset=t;const e=v(w,this._context.elevationProvider,s,_);h(ae,c.vertexDataRS[t],c.vertexDataRS[t+1],c.vertexDataRS[t+2]),_.setAltitude(ae,e),c.vertexDataRS[t]=ae[0],c.vertexDataRS[t+1]=ae[1],c.vertexDataRS[t+2]=ae[2],n.push(K(this._upVectorAlignment))}const y=new L(n,c.vertexDataES,c.vertexDataRS,a,C);ee(y,this._upVectorAlignment,this._context.renderCoordsHelper);const x=new G(y,this._profile,this._extruder,this._startCap,this._endCap);let P=null;if(this._fastUpdates){const{size:e,color:t,opacity:r}=this._fastUpdates.visualVariables,i=A(e,o.size),s=E(t,o.color),a=E(r,o.opacity);P=new H(x,i,s,a)}else{const e=l(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size?.output??["symbol-value","symbol-value","symbol-value"];e[0]*=te(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=te(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}const t=new N(x);t.bake(e);const r=this._getDrivenColor(o);r&&t.bakeVertexColors(r),P=t}const D=P.createGeometryData(),j=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:S,layerViewUid:this._context.layerViewUid}),V=new T(this._materials[0],D,P,m,this._stencilWidth,j);V.transformation=t(i(),r,x.path.origin),p.push(V)}if(0===p.length)return null;const P=new k({geometries:p,layerViewUid:this._context.layerViewUid,graphicUid:S}),D=new x(this,P,null,(e,t,r,i,s)=>ie(e,t,i,s,this._upVectorAlignment),s,null);return D.alignedSampledElevation=0,D.needsElevationUpdates=y(s.mode),D}_getDrivenColor(e){return this._hasDrivenColorOrOpacity?this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!1):null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function ee(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)ae[0]=s[a++]+i[0],ae[1]=s[a++]+i[1],ae[2]=s[a++]+i[2],r.worldUpAtPosition(ae,ae),t.setFrameFromUpVector(ae);break;case 1:ae[0]=s[a]+i[0],ae[1]=s[a+1]+i[1],ae[2]=s[a+2]+i[2],r.worldUpAtPosition(ae,ae),W(e,ae)}}function te(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function re(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)h(ae,l[p],l[p+1],l[p+2]),r(ae,oe),s+=oe.sampledElevation,ae[0]=n[p]+a[0],ae[1]=n[p+1]+a[1],ae[2]=n[p+2]+a[2],i.setAltitude(ae,oe.z),n[p]=ae[0]-a[0],n[p+1]=ae[1]-a[1],n[p+2]=ae[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function ie(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!q(l))continue;const e=l.path,o=e.builder.path;n+=re(o,t,r,i),0!==s&&ee(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}function se(e){return 1===(e.material?.color?.a??0)}const ae=p(),oe=new w;export{$ as Graphics3DPathSymbolLayer};
2
+ import e from"../../../../core/Error.js";import{translate as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,fromArray as n,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as h,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as m}from"../../../../geometry/projection/projectBuffer.js";import{create as d,fromSubBuffer as f,intersectsClippingArea as u}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as g,doubleArrayFrom as _}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{needsElevationUpdates3D as y,evaluateElevationAlignmentAtPoint as v,SampleElevationInfo as x}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as w}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as S}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as P,nanFallbackColor as D}from"./Graphics3DSymbolLayer.js";import{isValidSize as j}from"./graphicUtils.js";import{ConvertOptions as C,initFastSymbolUpdatesState as V,updateFastSymbolUpdatesState as U,getSizeAttributeValue as A,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as E}from"../../support/ElevationProvider.js";import{Object3D as R}from"../../webgl-engine/lib/Object3D.js";import{Path as B}from"../../webgl-engine/lib/Path.js";import{PathBuilder as L}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as k,TriangulationCapBuilder as G,NoCapBuilder as O}from"../../webgl-engine/lib/PathCapBuilder.js";import{MiterExtruder as I}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as F,isPathGeometry as M}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as T,StaticPathGeometry as q}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as H}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as W,circleProfiles as N}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Z}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as J}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as K}from"../../webgl-engine/materials/PathMaterial.js";const Q=["polyline"];class X extends P{constructor(e,t,r,i){super(e,t,r,i,re(t)),this._intrinsicSize=o(1,1),this._upVectorAlignment=1,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,r=null!=t.width?t.width:t.height,i=null!=t.height?t.height:r;this._vvConvertOptions=new C({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[r,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(D),fallbackSize:[r,1,i]});const o=this._context.renderer?.visualVariables;this._fastUpdates=o?.length?V(this._context.renderer,this._vvConvertOptions):null;const l=t.anchor||"center";this._upVectorAlignment="heading"===t.profileRotation?0:1;const c=t.profile||"circle";switch(c){default:case"circle":this._profile=N[l];break;case"quad":this._profile=W[l]}switch(t.join){case"round":this._extruder=new I(0,S);break;default:case"bevel":this._extruder=new I(0,1);break;case"miter":this._extruder=new I(.8*Math.PI,1)}switch(this._cap){case"none":this._capBuilder=new O;break;case"butt":default:this._capBuilder=new G(this._profile,1);break;case"square":this._capBuilder=new G(this._profile,2);break;case"round":{const e="quad"===c;this._capBuilder=new k(this._profile,e);break}}const p=this._materialColor,m=this._getCombinedOpacityAndColor(p),d=h(m),f=m[3],u=this.needsDrivenTransparentPass,g=t.material?.emissive,_={diffuse:d,ambient:d,emissiveStrengthFromSymbol:("color"===g?.source?g?.strength:void 0)??0,emissiveSource:1,opacity:f,drivenOpacity:u,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(s(this._intrinsicSize,r,i),!j(this._intrinsicSize[0])||!j(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let b;this._fastUpdates?.visualVariables.size||a(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?b=new K({..._,...this._fastUpdates.materialParameters,size:n(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=1,b=new J(_,this._context)),b.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._materials[0]=b,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Q,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,y)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!U(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of r)t+=h.length;const n=g(3*t);let l,c=0;for(const h of r){i.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||m(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=_(n):(l=g(3*t),m(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,s){const{graphic:a,renderingInfo:o}=e,n=a.geometry,h=this._getVertexData(n);if(null==h)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===h.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some(e=>e.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const p=new Array,m=n.spatialReference,g=d(),_=this._context.renderCoordsHelper,x=new E(h.vertexDataES),S=a.uid,P=b(h.vertexDataRS.length);for(const d of h.pathVertexDataInfos){const e=d.numVertices;if(e<2)continue;const a=d.offset;if(null!=this._context.clippingExtent&&(f(h.vertexDataES,a,e,g),!u(g,this._context.clippingExtent)))continue;const n=new Array,b=a+3*e;for(let t=a;t<b;t+=3){x.offset=t;const e=v(x,this._context.elevationProvider,s,_);c(ie,h.vertexDataRS[t],h.vertexDataRS[t+1],h.vertexDataRS[t+2]),_.setAltitude(ie,e),h.vertexDataRS[t]=ie[0],h.vertexDataRS[t+1]=ie[1],h.vertexDataRS[t+2]=ie[2],n.push(Z(this._upVectorAlignment))}const y=new B(n,h.vertexDataES,h.vertexDataRS,a,P);Y(y,this._upVectorAlignment,this._context.renderCoordsHelper);const w=new L(y,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment);let D=null;if(this._fastUpdates){const{size:e,color:t,opacity:r}=this._fastUpdates.visualVariables,i=A(e,o.size),s=z(t,o.color),a=z(r,o.opacity);D=new T(w,i,s,a)}else{const e=l(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size?.output??["symbol-value","symbol-value","symbol-value"];e[0]*=$(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=$(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}const t=new q(w);t.bake(e);const r=this._getDrivenColor(o);r&&t.bakeVertexColors(r),D=t}const j=D.createGeometryData(),C=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:S,layerViewUid:this._context.layerViewUid}),V=new F(this._materials[0],j,D,m,this._stencilWidth,C);V.transformation=t(i(),r,w.path.origin),p.push(V)}if(0===p.length)return null;const D=new R({geometries:p,layerViewUid:this._context.layerViewUid,graphicUid:S}),j=new w(this,D,null,(e,t,r,i,s)=>te(e,t,i,s,this._upVectorAlignment),s,null);return j.alignedSampledElevation=0,j.needsElevationUpdates=y(s.mode),j}_getDrivenColor(e){return this._hasDrivenColorOrOpacity?this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!1):null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function Y(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)ie[0]=s[a++]+i[0],ie[1]=s[a++]+i[1],ie[2]=s[a++]+i[2],r.worldUpAtPosition(ie,ie),t.setFrameFromUpVector(ie);break;case 1:ie[0]=s[a]+i[0],ie[1]=s[a+1]+i[1],ie[2]=s[a+2]+i[2],r.worldUpAtPosition(ie,ie),H(e,ie)}}function $(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function ee(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,h=e.offset+3*o.length;for(let p=e.offset;p<h;p+=3)c(ie,l[p],l[p+1],l[p+2]),r(ie,se),s+=se.sampledElevation,ie[0]=n[p]+a[0],ie[1]=n[p+1]+a[1],ie[2]=n[p+2]+a[2],i.setAltitude(ie,se.z),n[p]=ie[0]-a[0],n[p+1]=ie[1]-a[1],n[p+2]=ie[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function te(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!M(l))continue;const e=l.path,o=e.builder.path;n+=ee(o,t,r,i),0!==s&&Y(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}function re(e){return 1===(e.material?.color?.a??0)}const ie=p(),se=new x;export{X as Graphics3DPathSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as t}from"../../../../geometry/projectionUtils.js";import{fromExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{createTileBVH as r}from"./Tiles3DBVH.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as o}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as l,computeInvDir as a,intersectAabbInvDir as c}from"../../webgl-engine/lib/RayIntersections.js";class d{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid;const n=e.view.viewingMode,s=e.layer.fullExtent,o=(s?t(s,e.view.renderSpatialReference):void 0)??e.view.extent,l=i(o);this._bvh=r(n,l)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}intersect(e,t,i,r,s,d){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:u,tolerance:h}=e,p=2===e.options.store,{componentObjectCollection:f}=this.layerView.view.stage.renderView,g=new l(h,d,e.options.normalRequired),v=a(i,r,m),w=(s,l,a)=>{if(l<0)return;if(null!=t&&!t(i,r,l))return;const c=e=>{const t=new n(this.layerView.uid);e.set(this.type,t,l,a)};if(this.isGround&&(null==u.ground.distance||l<u.ground.distance)&&c(u.ground),!e.options.isFiltered&&((null==u.min.distance||l<u.min.distance)&&c(u.min),(null==u.max.distance||l>u.max.distance)&&c(u.max),p)){const t=new o(e.ray);c(t),e.results.all.push(t)}};this._bvh.forEachTileIntersectingRay(i,r,e=>{const{componentObjects:t}=e;for(const n of t)c(n.aabbInWorldCoordinates,i,v,0)&&f.intersect(n,i,r,null,g,w)},d)}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new s(0,0)}}const m=e();export{d as Tiles3DMeshIntersectionHandler};
2
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{project as t}from"../../../../geometry/projectionUtils.js";import{fromExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{Tiles3DTarget as n}from"../i3s/Intersector.js";import{createTileBVH as r}from"./Tiles3DBVH.js";import{ElevationRange as s}from"../../support/ElevationRange.js";import{IntersectorResult as o}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as l,computeInvDir as a,intersectAabbInvDir as c}from"../../webgl-engine/lib/RayIntersections.js";class d{constructor(e){this.layerView=e,this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerViewUid=e.uid;const n=e.view.viewingMode,s=(e.useEsriCrs?e.fullExtentInLocalViewSpatialReference:e.layer.fullExtent?t(e.layer.fullExtent,e.view.renderSpatialReference):void 0)??e.view.extent,o=i(s);this._bvh=r(n,o)}destroy(){this._bvh.destroy()}addTile(e){this._bvh.addTile(e)}removeTile(e){this._bvh.removeTile(e)}intersect(e,t,i,r,s,d){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const{results:m,tolerance:p}=e,h=2===e.options.store,{componentObjectCollection:f}=this.layerView.view.stage.renderView,g=new l(p,d,e.options.normalRequired),w=a(i,r,u),v=(s,l,a)=>{if(l<0)return;if(null!=t&&!t(i,r,l))return;const c=e=>{const t=new n(this.layerView.uid);e.set(this.type,t,l,a)};if(this.isGround&&(null==m.ground.distance||l<m.ground.distance)&&c(m.ground),!e.options.isFiltered&&((null==m.min.distance||l<m.min.distance)&&c(m.min),(null==m.max.distance||l>m.max.distance)&&c(m.max),h)){const t=new o(e.ray);c(t),e.results.all.push(t)}};this._bvh.forEachTileIntersectingRay(i,r,e=>{const{componentObjects:t}=e;for(const n of t)c(n.aabbInWorldCoordinates,i,w,0)&&f.intersect(n,i,r,null,g,v)},d)}getElevationRange(e){return this._bvh.getElevationRangeIntersectingSphere(e)??new s(0,0)}}const u=e();export{d as Tiles3DMeshIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{copy as r,distance as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as h,negate as c,length as _,subtract as p,normalize as l,add as u,scale as d,dot as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as w,fromPositionAndNormal as M,getNormal as b}from"../../../../geometry/support/plane.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as f,applyAll as j}from"../../camera/constraintUtils.js";import{ConstraintOptions as E}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as y}from"../../input/util.js";import{InteractiveController as O}from"./InteractiveController.js";import{PanPlanarMomentumController as x}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as A}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as z}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as R}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as k}from"./momentum/ZoomSphericalMomentumController.js";import{pickPointAndInitSphere as H,excludeTerrain as F,inferNavigationMode as D,sphereOrPlanePointFromScreenPoint as T,maxPanDistanceModifier as U,minPinchAndPanCameraHeight as G,pivotSearchAreaSize as I,intersectPlaneFromScreenPointAtEye as Z,applyZoomOnSphere as V,shouldPreserveHeading as q,applyPanSphericalPreserveHeading as B,applyPanSphericalDirectRotation as J,normalizeRotationDelta as K,applyRotation as L,applyPanPlanar as N,applyZoomToPoint as Q}from"../utils/navigationUtils.js";import W from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as X}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as Y}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as $}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as tt}from"../../../navigation/ZoomMomentumEstimator.js";let it=class extends O{constructor(t){super(t),this.forceHorizontalPan=!1,this._smoothRotation=new y(.05),this._rotationAxis=P(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=w(),this._beginRadius=0,this._smoothScaling=new y(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new tt,this._rotationMomentumEstimator=new $,this._panSphericalMomentumEstimator=new Y,this._panPlanarMomentumEstimator=new X,this._adjustedSphere=new S,this._tmp3d=P(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=P(),this._screenPickPoint=n(),this._scenePickPoint=P(),this._navigationMode=1,this._sphere=new S,this._pointerCount=0,this._tmpInteractionDirection=P(),this._beginCamera=new W,this._constraintOptions=new E(15,0,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._beginAngle=t.angle,this._pointerCount=t.pointers.size,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),r(this._beginScreenPoint,this._screenPickPoint);const n=H(this._intersectionHelper,this.startCamera,this._screenPickPoint,v(this.view.spatialReference).radius,1,this.view.basemapTerrain.invisible?F:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,h(this._beginScenePoint,this._scenePickPoint),this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=D(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),0===this._navigationMode&&this._preparePlanarPanMode(t,n.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navigationMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navigationMode?new k({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new R({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new z({view:this.view,momentum:e,center:this._sphere.center,axis:this._rotationAxis});if(1===this._navigationMode){const t=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new A({view:this.view,momentum:t})}else{const t=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);M(this._scenePickPoint,e,this._panningPlane);const o=n(this._screenPickPoint[0],0),a=P(),r=_(this.startCamera.eye);this._adjustedSphere.radius=r<this._sphere.radius?r-100:this._sphere.radius,T(this._adjustedSphere,this.startCamera,o,a);const m=P(),v=P(),C=P();p(m,this._scenePickPoint,this.currentCamera.eye);const w=_(m);l(m,m);const S=U*Math.max(Math.abs(this.view.camera.position.z),G),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,I);let j=null!=f?f:S;i&&(j=Math.min(j,w)),h(C,u(v,this.currentCamera.eye,d(v,m,j))),this._panningPlane[3]=-g(b(this._panningPlane),C),this.startCamera.center=u(v,this.startCamera.eye,d(v,this.startCamera.viewForward,j));const E=s(t.center,this._tmpScreenPointArray);Z(this._panningPlane,this.startCamera,E,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),V(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),j(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);T(this._sphere,this.currentCamera,i,this._tmp3d),q(this._beginScenePoint,g(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(B(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(J(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(m(this._screenPickPoint,i)),j(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+K(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),L(this.currentCamera,this._sphere.center,C(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*e),j(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);Z(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(N(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(m(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),j(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),Q(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),j(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){h(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=K(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),L(this.currentCamera,this._sphere.center,C(this._rotationAxis,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*o),j(this.view,this.currentCamera,this._constraintOptions)}};t([o({constructOnly:!0})],it.prototype,"forceHorizontalPan",void 0),it=t([a("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],it);export{it as PinchAndPanControllerGlobal};
2
+ import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as m,negate as c,length as _,subtract as p,normalize as l,add as u,scale as d,dot as P}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as C,fromPositionAndNormal as b,getNormal as w}from"../../../../geometry/support/plane.js";import{Sphere as M}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as f,applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as E}from"../../input/util.js";import{InteractiveController as A}from"./InteractiveController.js";import{PanPlanarMomentumController as k}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as y}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as R}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as x}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as O}from"./momentum/ZoomSphericalMomentumController.js";import{inferNavigationMode as H,pickPointAndInitSphere as F,excludeTerrain as Y,sphereOrPlanePointFromScreenPoint as L,maxPanDistanceModifier as T,minPinchAndPanCameraHeight as D,pivotSearchAreaSize as U,intersectPlaneFromScreenPointAtEye as G,applyZoomOnSphere as I,findHorizonScreenY as V,computeHorizonDownLimitScreenY as Z,shouldClampScreenY as q,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as J,applyPanSphericalDirectRotation as K,computeHorizonUpLimitScreenY as N,normalizeRotationDelta as Q,applyRotation as W,applyPanPlanar as X,applyZoomToPoint as $,intersectsSphereAtScreenPoint as tt}from"../utils/navigationUtils.js";import it from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as et}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as nt}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as st}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as rt}from"../../../navigation/ZoomMomentumEstimator.js";let ot=class extends A{constructor(t){super(t),this.forceHorizontalPan=!1,this._smoothRotation=new E(.05),this._rotationAxis=g(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=C(),this._beginRadius=0,this._smoothScaling=new E(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new rt,this._rotationMomentumEstimator=new st,this._panSphericalMomentumEstimator=new nt,this._panPlanarMomentumEstimator=new et,this._adjustedSphere=new M,this._referenceSphere=new M,this._tmp3d=g(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=g(),this._screenPickPoint=n(),this._clampedScreenPoint=n(),this._scenePickPoint=g(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._navigationMode=1,this._sphere=new M,this._pointerCount=0,this._tmpInteractionDirection=g(),this._beginCamera=new it,this._constraintOptions=new j(15,0,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._beginAngle=t.angle,this._pointerCount=t.pointers.size,this._smoothRotation.reset(),this._referenceSphere.radius=S(this.view.spatialReference).radius,s(t.center,this._screenPickPoint),this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=H(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),a(this._screenPickPoint,this._clampScreenPointToHorizonPaddingRegion(this._screenPickPoint))),a(this._beginScreenPoint,this._screenPickPoint);const n=F(this._intersectionHelper,this.startCamera,this._screenPickPoint,this._referenceSphere.radius,1,this.view.basemapTerrain.invisible?Y:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,m(this._beginScenePoint,this._scenePickPoint),0===this._navigationMode?this._preparePlanarPanMode(t,n.hasGeometryIntersection):this._prepareSphericalPanMode(),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navigationMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navigationMode?new O({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new x({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new R({view:this.view,momentum:e,center:this._sphere.center,axis:this._rotationAxis});if(1===this._navigationMode){const t=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new y({view:this.view,momentum:t})}else{const t=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);b(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),o=g(),a=_(this.startCamera.eye);this._adjustedSphere.radius=a<this._sphere.radius?a-100:this._sphere.radius,L(this._adjustedSphere,this.startCamera,r,o);const h=g(),S=g(),v=g();p(h,this._scenePickPoint,this.currentCamera.eye);const C=_(h);l(h,h);const M=T*Math.max(Math.abs(this.view.camera.position.z),D),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,U);let z=null!=f?f:M;i&&(z=Math.min(z,C)),m(v,u(S,this.currentCamera.eye,d(S,h,z))),this._panningPlane[3]=-P(w(this._panningPlane),v),this.startCamera.center=u(S,this.startCamera.eye,d(S,this.startCamera.viewForward,z));const j=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.startCamera,j,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),I(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_initClampValues(){this._horizonScreenY=V(this.startCamera,t=>tt(this._referenceSphere,this.startCamera,this._screenPickPoint[0],t));const t=null!=this._horizonScreenY;this._panLimitFromAbove=t&&this._screenPickPoint[1]<this._horizonScreenY,this._panLimitScreenY=t?Z(this.startCamera,this._horizonScreenY):null}_prepareSphericalPanMode(){null!=this._panLimitScreenY&&q(this._screenPickPoint[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._screenPickPoint[1]=this._panLimitScreenY,L(this._sphere,this.startCamera,this._screenPickPoint,this._beginScenePoint),m(this._scenePickPoint,this._beginScenePoint)),a(this._clampedScreenPoint,this._screenPickPoint)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray),e=this._clampScreenPointToHorizonPaddingRegion(i);L(this._sphere,this.currentCamera,e,this._tmp3d),B(this._beginScenePoint,P(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(J(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(K(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._screenPickPoint,e)),z(this.view,this.currentCamera,this._constraintOptions)}_clampScreenPointToHorizonPaddingRegion(t){if(a(this._clampedScreenPoint,t),null==this._panLimitScreenY)return this._clampedScreenPoint;const i=V(this.startCamera,i=>tt(this._referenceSphere,this.currentCamera,t[0],i));return null!=i&&(this._horizonScreenY=i,this._panLimitScreenY=this._panLimitFromAbove?Z(this.currentCamera,i):N(this.currentCamera,i)),q(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panSphericalMomentumEstimator.reset()),this._clampedScreenPoint}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+Q(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*e),z(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(X(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),$(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){m(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=Q(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const r=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*r),z(this.view,this.currentCamera,this._constraintOptions)}};t([r()],ot.prototype,"forceHorizontalPan",void 0),ot=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],ot);export{ot as PinchAndPanControllerGlobal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{distance as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as a,copy as r,dot as m,subtract as h,length as l,normalize as c,scale as p,add as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,fromValues as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as g}from"../../../../geometry/support/axisAngle.js";import{create as C,fromNormalAndOffset as v,setOffsetFromPoint as b,negate as w,getNormal as M}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as f,applyAll as P}from"../../camera/constraintUtils.js";import{ConstraintOptions as z}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as V}from"../../input/util.js";import{getVoxelWasm as S}from"../../layers/VoxelWasm.js";import{InteractiveController as j}from"./InteractiveController.js";import{PanPlanarMomentumController as E}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as H}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as y}from"./momentum/ZoomPlanarMomentumController.js";import{excludeTerrain as x,inferNavigationMode as O,getTiltScaleFactor as F,maxPanDistanceModifier as R,minPinchAndPanCameraHeight as A,pivotSearchAreaSize as T,centroid as U,applyZoomToPoint as D,applyPanPlanar as I,normalizeRotationDelta as Z,applyRotation as k,intersectPlaneFromScreenPointAtEye as G}from"../utils/navigationUtils.js";import L from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as W}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as q}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as B}from"../../../navigation/ZoomMomentumEstimator.js";const J=d(0,0,1);let K=class extends j{constructor(t){super(t),this.forceHorizontalPan=!1,this._rotationValueSmooth=new V(.05),this._scalingValueSmooth=new V(.05),this._planeHorizontal=C(),this._planeVertical=C(),this._rotationMomentumEstimator=new q,this._panMomentumEstimator=new W(300,12,.9),this._zoomMomentumEstimator=new B,this._beginRadius=0,this._beginCenter=u(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=i(),this._tmpCentroid3d=u(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._pointerCount=0,this._beginCamera=new L,this._constraintOptions=new z(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),v(J,0,this._planeHorizontal);const n=u(),o=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,n,this.view.basemapTerrain.invisible?x:{}),s=u();a(s,this.startCamera.viewForward);const d=u();r(d,J);const g=m(s,d);this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=O(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode);const C=F(d,this.startCamera.viewForward,R)*Math.max(Math.abs(this.view.camera.position.z),A);b(this._planeHorizontal,this._planeHorizontal,n),this.startCamera.aboveGround||w(this._planeHorizontal,this._planeHorizontal);const f=u(),P=u(),z=u();h(f,n,this.currentCamera.eye);const V=l(f);if(c(f,f),0===this._navigationMode){p(d,d,g),h(M(this._planeVertical),s,d),c(M(this._planeVertical),M(this._planeVertical)),b(this._planeVertical,this._planeVertical,n);const i=this.view.stage.renderView.getMinimalDepthForArea(S(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,T);let e=null!=i?i:C;o&&(e=Math.min(e,V)),r(z,_(P,this.currentCamera.eye,p(P,f,e))),this._planeVertical[3]=-m(M(this._planeVertical),z),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}else{const i=o?V:C;r(z,_(P,this.currentCamera.eye,p(P,f,i))),this._planeHorizontal[3]=-m(M(this._planeHorizontal),z),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=1===this._navigationMode?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),D(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(Math.abs(t.radius-this._beginRadius)),P(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),U(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d),I(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(s(this._beginCenterScreen,this._tmpCentroid2d)),P(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+Z(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const a=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(a,.001*t.timestamp);const r=M(this._planeHorizontal);k(this.currentCamera,i,g(r,a)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(Math.abs(t.radius*a)),P(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return new y({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new H({view:this.view,momentum:e,center:this._beginCenter,axis:M(this._planeHorizontal)});const n=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return n?new E({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach(t=>{o[0]=t.x,o[1]=t.y,void 0===n[s]&&(n[s]=u()),G(i,e,o,n[s]),s+=1}),n}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};t([n({constructOnly:!0})],K.prototype,"forceHorizontalPan",void 0),K=t([o("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],K);export{K as PinchAndPanControllerLocal};
2
+ import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as a,copy as m,dot as h,subtract as l,length as c,normalize as _,scale as p,add as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as v,fromNormalAndOffset as b,setOffsetFromPoint as S,negate as M,getNormal as w}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as P,applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as V}from"../../input/util.js";import{getVoxelWasm as H}from"../../layers/VoxelWasm.js";import{InteractiveController as E}from"./InteractiveController.js";import{PanPlanarMomentumController as j}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as F}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as y}from"./momentum/ZoomPlanarMomentumController.js";import{inferNavigationMode as L,excludeTerrain as Y,getTiltScaleFactor as x,maxPanDistanceModifier as A,minPinchAndPanCameraHeight as O,pivotSearchAreaSize as R,centroid as T,applyZoomToPoint as U,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as Z,intersectPlaneFromScreenPointAtEye as k,findHorizonScreenY as G,intersectsPlaneAtScreenPoint as W,computeHorizonDownLimitScreenY as q,computeHorizonUpLimitScreenY as B,shouldClampScreenY as J}from"../utils/navigationUtils.js";import K from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as N}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as Q}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as X}from"../../../navigation/ZoomMomentumEstimator.js";const $=g(0,0,1);let tt=class extends E{constructor(t){super(t),this.forceHorizontalPan=!1,this._rotationValueSmooth=new V(.05),this._scalingValueSmooth=new V(.05),this._planeHorizontal=v(),this._planeVertical=v(),this._rotationMomentumEstimator=new Q,this._panMomentumEstimator=new N(300,12,.9),this._zoomMomentumEstimator=new X,this._beginRadius=0,this._beginCenter=d(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=i(),this._tmpCentroid3d=d(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._clampedScreenPoint=i(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._pointerCount=0,this._beginCamera=new K,this._constraintOptions=new f(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),b($,0,this._planeHorizontal);const n=d();a(n,this.startCamera.viewForward);const o=d();m(o,$);const r=h(n,o);this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=L(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),s(this._beginCenterScreen,this._clampScreenPointToHorizonPaddingRegion(this._beginCenterScreen)));const g=d(),C=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,g,this.view.basemapTerrain.invisible?Y:{}),v=x(o,this.startCamera.viewForward,A)*Math.max(Math.abs(this.view.camera.position.z),O);S(this._planeHorizontal,this._planeHorizontal,g),this.startCamera.aboveGround||M(this._planeHorizontal,this._planeHorizontal);const P=d(),z=d(),f=d();l(P,g,this.currentCamera.eye);const V=c(P);if(_(P,P),0===this._navigationMode){p(o,o,r),l(w(this._planeVertical),n,o),_(w(this._planeVertical),w(this._planeVertical)),S(this._planeVertical,this._planeVertical,g);const i=this.view.stage.renderView.getMinimalDepthForArea(H(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,R);let e=null!=i?i:v;C&&(e=Math.min(e,V)),m(f,u(z,this.currentCamera.eye,p(z,P,e))),this._planeVertical[3]=-h(w(this._planeVertical),f),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}else{const i=C?V:v;m(f,u(z,this.currentCamera.eye,p(z,P,i))),this._planeHorizontal[3]=-h(w(this._planeHorizontal),f),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=1===this._navigationMode?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),U(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=P(Math.abs(t.radius-this._beginRadius)),z(this.view,this.currentCamera,this._constraintOptions)}this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),T(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d);const s=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(this._tmpCentroid2d):this._tmpCentroid2d;if(D(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(s,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=P(r(this._beginCenterScreen,s)),z(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const r=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp);const a=w(this._planeHorizontal);Z(this.currentCamera,i,C(a,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=P(Math.abs(t.radius*r)),z(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return new y({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new F({view:this.view,momentum:e,center:this._beginCenter,axis:w(this._planeHorizontal)});const n=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return n?new j({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach(t=>{o[0]=t.x,o[1]=t.y;const r=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(o):o;void 0===n[s]&&(n[s]=d()),k(i,e,r,n[s]),s+=1}),n}_initClampValues(){if(this._horizonScreenY=G(this.startCamera,t=>W(this._planeHorizontal,this.startCamera,this._beginCenterScreen[0],t)),null==this._horizonScreenY)return this._panLimitScreenY=null,void(this._panLimitFromAbove=!1);this._panLimitFromAbove=this._beginCenterScreen[1]<this._horizonScreenY,this._panLimitScreenY=this._panLimitFromAbove?q(this.startCamera,this._horizonScreenY):B(this.startCamera,this._horizonScreenY)}_clampScreenPointToHorizonPaddingRegion(t){if(s(this._clampedScreenPoint,t),null==this._panLimitScreenY)return this._clampedScreenPoint;const i=G(this.startCamera,i=>W(this._planeHorizontal,this.currentCamera,t[0],i));return null!=i&&(this._horizonScreenY=i,this._panLimitScreenY=this._panLimitFromAbove?q(this.currentCamera,i):B(this.currentCamera,i)),J(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panMomentumEstimator.reset()),this._clampedScreenPoint}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};t([n()],tt.prototype,"forceHorizontalPan",void 0),tt=t([o("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],tt);export{tt as PinchAndPanControllerLocal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- 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 i}from"../../../../core/screenUtils.js";import{fromRotation as a,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{distance as h,length as M,dot as g,subtract as y,transformMat4 as d,add as b,normalize as x,squaredDistance as j,copy as v,cross as P,scale as z,lerp as w,set as I}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as S,fromPoints as T,axis as U,wrapAxisAngle as G}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as R,vectorCoordinates as k}from"../../../../geometry/support/coordinateSystem.js";import{create as E,fromNormalAndOffset as H,intersectRay as q}from"../../../../geometry/support/plane.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{sm4d as F,sv3d as O}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as W,fromScreen as B}from"../../support/geometryUtils/ray.js";import{intersectScreen as D}from"../../support/geometryUtils/sphere.js";import J from"../../webgl/RenderCamera.js";import{terrainId as K}from"../../webgl-engine/lib/verticalOffsetUtils.js";const L=30,N=[1,3e8],Q=8,V=[200,1508e5],X=5,Y=50,Z=5,$=10,_=80,tt=90,et=1e-6,nt={exclude:new Set([K])};function ot(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function rt(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function it(t,e,n){const o=a(F.get(),n[3],U(n));null==o||s(o,m)||(y(ne,t.eye,e),d(ne,ne,o),t.eye=b(ne,ne,e),y(ne,t.center,e),d(ne,ne,o),t.center=b(ne,ne,e),t.up=d(ne,t.up,o))}function at(t,e,n,o){return q(t,B(e,n,ce),o)}function st(t,e,n,o){return q(t,W(e,n,ce),o)}function ct(t,e,n,o){const r=O.get();let i=1-n;y(r,e,t.eye);const a=M(r);let s=a*(1-i);i>=0&&s<o&&(s=o,i=-(s-a)/a),Math.abs(a-s)<et||(z(r,r,i),t.eye=b(ne,t.eye,r),t.center=w(ne,t.center,e,i))}function lt(t,e,n){e.getScreenCenter(mt),D(t,e,mt,ne)&&(e.center=ne);const o=e.distance,r=o*n;if(Math.abs(o-r)<et)return;const i=z(O.get(),e.viewForward,r);e.eye=y(ne,e.center,i)}const mt=i();function ut(t,e){I(e,0,0,0);for(const n of t)b(e,e,n);z(e,e,1/t.length)}function ft(t,e,n,o){return Math.sin(t/M(e))*(n+o.radius)}function pt(t,e,n,o){return ft(Math.PI/2,e,n,o)+(t-Math.PI/2)}const ht={Elevation:3e4,Angle:e(16)},Mt=e(80);function gt(t,e,n,o,r,i){const a=A(),s=new C;let c=!0,l=!0;const{eye:m}=e;return t.intersectScreen(n,a,i)&&Bt(m,a,o)?s.radius=M(a):(l=!1,e.aboveGround&&0!==r?s.radius=Math.max(M(e.center),.9*o):s.radius=M(e.eye)-e.relativeElevation,1===r?xt(s,e,n,a):c=D(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:l}}function yt(t,e,n,o){const r=t.relativeElevation;if(r>ht.Elevation&&"global"===o)return 1;W(t,e,le);const i=Math.sign(r),a=n.worldUpAtPosition(t.eye,ne);return-i*g(a,le.direction)<Math.sin(ht.Angle)*M(le.direction)?0:1}function dt(t,e,n){y(bt,n,e),t.eye=y(ne,t.eye,bt),t.center=y(ne,t.center,bt)}const bt=A();function xt(t,e,n,o){const r=W(e,n,ce);return null!=r&&(t.closestPointOnSilhouette(r,jt),t.intersectRay(r,o)?!(j(jt,r.origin)<j(o,r.origin))||(v(o,jt),!1):(y(vt,e.eye,e.center),x(vt,vt),H(vt,-g(x(vt,vt),jt),Pt),q(Pt,r,o),!1))}const jt=A(),vt=A(),Pt=E();function zt(i,a,s,c,l,m){let u=0;if(P(ie,i,a),y(oe,i,a),M(i)<=l||!c.aboveGround){P(s,oe,c.eye);const f=g(i,a)/(M(i)*M(a));if(f<.9999)u=o(f);else{const t=M(P(A(),i,a))/(M(i)*M(a));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,Mt));u=-u-Math.max(0,M(a)-l)/(p*l)}else y(wt,c.eye,c.center),P(s,oe,wt),u=-M(oe)/l;return x(s,s),z(s,s,M(ie)),u}const wt=A();function It(r,i,a,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,Mt));return c=i>a?-(i-a)/(m*a):i<-a?Math.PI-(i+a)/(m*a):o(i/a),l=r>a?-(r-a)/(m*a):r<-a?Math.PI-(r+a)/(m*a):o(r/a),(l-c)*a}function At(t,e,n,o,r,i,a,s,c,l){const m=It(t[2],e[2],i.radius,s),u=c?It(t[0],e[0],i.radius,180):e[0]-t[0],p=Math.sin(a)*u-Math.cos(a)*m,h=Math.cos(a)*u+Math.sin(a)*m;x(ne,r);const M=c?p/Math.sqrt(Math.abs(i.radius**2-g(n,ne)**2)):p/i.radius,y=h/Math.sqrt(Math.abs(i.radius**2-g(n,o)**2));f(l,M,y)}function St(t,e,n,o,r,i,a,s,c,l){P(ie,t,e),R(i.up,i.eye,Lt,Nt,Qt),R([0,0,1],i.eye,Dt,Jt,Kt),v(n,Jt),v(o,Dt),x(n,n),z(n,n,M(ie)),k(t,x(Nt,Nt),x(Qt,Qt),x(Lt,Lt),Vt),k(e,Nt,Qt,Lt,Xt),At(Vt,Xt,t,Dt,Jt,a,s,c,l,r)}function Tt(t,e,n,o,r,i,s){a($t,r,o),a(_t,s,i),l(te,$t,_t),y(e,t,n),d(e,e,te),b(e,e,n)}function Ut(t,e,n,o,r,i){a($t,o,n),a(_t,i,r),l(te,$t,_t),y(ne,t.eye,e),d(ne,ne,te),t.eye=b(ne,ne,e),y(ne,t.center,e),d(ne,ne,te),t.center=b(ne,ne,e),y(ne,t.up,e),d(ne,ne,te),t.up=b(ne,ne,e)}const Gt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let Rt=!1;function kt(t,e,n,o,r,i){const a=Math.abs(o)>Math.PI-Gt.Angle||Math.abs(o)<Gt.Angle,s=(Math.abs(t[2])<n*Gt.Pole||Math.abs(e)>n)&&i;return a&&s?!Rt&&r<Gt.Tilt-Gt.TiltHysteresisMargin?Rt=!0:Rt&&r>Gt.Tilt+Gt.TiltHysteresisMargin&&(Rt=!1):Rt=!1,Rt}function Et(t,e,n,o,r,i){if(i)T(n,o,Zt),it(e,t.center,Zt);else{const i=zt(n,o,ae,e,t.radius,r);it(e,t.center,G(ae,i))}}function Ht(t,e,n,o,r,i,a){const s=a?20:1,c=1e-12;let l,m;v(ee,o),re.copyFrom(e);for(let u=0;u<s&&j(n,ee)>c&&(l=j(n,ee),St(n,ee,Jt,Dt,Yt,re,t,r,i,a),Ut(re,t.center,Dt,Yt[1],Jt,Yt[0]),Tt(ee,ee,t.center,Dt,Yt[1],Jt,Yt[0]),m=j(n,ee),m<l||0===u);u++)e.copyFrom(re)}function qt(n,o,r,i,a,s,c){kt(r,g(o.up,r),n.radius,-t.normalize(e(a)),s,o.aboveGround)?Ht(n,o,r,i,-t.normalize(e(a)),s,c):Et(n,o,r,i,s,c)}function Ct(t,e,n,o,r,i){const{eye:a}=t;R([0,0,1],a,Dt,Jt,Kt);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-g(t.center,Dt)**2/M(t.center)**2)),.5),u=(Math.sin(i)*l+Math.cos(i)*s)/m,f=-Math.cos(i)*l+Math.sin(i)*s;switch(c(o.pan.matrix,o.pan.matrix,u,Dt),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,f,Jt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Ft(t,e,n,o,r){const{eye:i,viewRight:a}=t,s=P(O.get(),a,i),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,a),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Ot(n,o,r,i,a,s,c,l,m){kt(n.center,g(n.up,n.center),M(n.center),-t.normalize(e(s)),c,o.aboveGround)?Ct(o,r,i,l,m,-t.normalize(e(a))):Ft(o,r,i,l,m)}function Wt(t,e,n=1/0){const o=Math.abs(g(t,e));return Math.min(n,1/o)}function Bt(t,e,n){const o=h(t,e),r=M(t);return o<Math.max(r,n)}const Dt=A(),Jt=A(),Kt=A(),Lt=A(),Nt=A(),Qt=A(),Vt=A(),Xt=A(),Yt=p(),Zt=S(),$t=u(),_t=u(),te=u(),ee=A(),ne=A(),oe=A();let re=new J;const ie=A(),ae=A();function se(){re=new J}const ce={origin:A(),direction:A()},le={origin:A(),direction:A()};export{Mt as TiltThresholdPanningSpeed,ht as VerticalPanTresholds,dt as applyPanPlanar,Et as applyPanSphericalDirectRotation,Ht as applyPanSphericalPreserveHeading,it as applyRotation,Ut as applyRotationWithTwoAxes,lt as applyZoomOnSphere,ct as applyZoomToPoint,ut as centroid,se as cleanupNavigationUtils,et as distanceComparisonTolerance,nt as excludeTerrain,Wt as getTiltScaleFactor,yt as inferNavigationMode,at as intersectPlaneFromScreenPoint,st as intersectPlaneFromScreenPointAtEye,Bt as isHitOnSamePlanetSide,It as lengthFromPoints,X as maxPanDistanceModifier,Z as maxRotatePivotDistanceModifier,L as maxZoomPivotDistanceModifier,Q as maxZoomStepDistanceModifier,Y as minPinchAndPanCameraHeight,$ as minRotatePivotDistance,ot as normalizeCoordinate,rt as normalizeRotationDelta,pt as offSurfaceTiltToEyeTiltGlobal,ft as onSurfaceTiltToEyeTiltGlobal,Ot as panMotionToRotationMatrix,qt as panToPosition,gt as pickPointAndInitSphere,_ as pivotSearchAreaSize,Gt as preservingHeadingThresholds,tt as rotatePivotSearchAreaSize,Tt as rotatePointAroundTwoAxes,zt as rotationAngleAndAxisDirectRotation,St as rotationAnglesAndAxesHeadingPreserving,At as rotationAnglesHeadingPreserving,kt as shouldPreserveHeading,xt as sphereOrPlanePointFromScreenPoint,N as zoomPivotDistanceClamp,V as zoomStepDistanceClamp};
2
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as r,asinClamped as o}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as a,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as u,create as m}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{distance as h,length as M,dot as g,subtract as y,transformMat4 as d,add as b,normalize as x,squaredDistance as j,copy as v,cross as P,scale as z,lerp as w,set as I}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,fromPoints as H,axis as S,wrapAxisAngle as T}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as U,vectorCoordinates as G}from"../../../../geometry/support/coordinateSystem.js";import{create as k,fromNormalAndOffset as E,intersectRay as q}from"../../../../geometry/support/plane.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{sm4d as F,sv3d as O}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as W,fromScreen as B}from"../../support/geometryUtils/ray.js";import{intersectScreen as D}from"../../support/geometryUtils/sphere.js";import J from"../../webgl/RenderCamera.js";import{terrainId as K}from"../../webgl-engine/lib/verticalOffsetUtils.js";const L=30,N=[1,3e8],Q=8,V=[200,1508e5],X=5,Y=50,Z=5,$=10,_=80,tt=90,et=1e-6,nt={exclude:new Set([K])};function rt(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ot(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function it(t,e,n){const r=a(F.get(),n[3],S(n));null==r||s(r,u)||(y(fe,t.eye,e),d(fe,fe,r),t.eye=b(fe,fe,e),y(fe,t.center,e),d(fe,fe,r),t.center=b(fe,fe,e),t.up=d(fe,t.up,r))}function at(t,e,n,r){return q(t,B(e,n,de),r)}function st(t,e,n,r){return q(t,W(e,n,de),r)}function ct(t,e,n,r){const o=O.get();let i=1-n;y(o,e,t.eye);const a=M(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<et||(z(o,o,i),t.eye=b(fe,t.eye,o),t.center=w(fe,t.center,e,i))}function lt(t,e,n){e.getScreenCenter(ut),D(t,e,ut,fe)&&(e.center=fe);const r=e.distance,o=r*n;if(Math.abs(r-o)<et)return;const i=z(O.get(),e.viewForward,o);e.eye=y(fe,e.center,i)}const ut=i();function mt(t,e){I(e,0,0,0);for(const n of t)b(e,e,n);z(e,e,1/t.length)}function ft(t,e,n,r){return Math.sin(t/M(e))*(n+r.radius)}function pt(t,e,n,r){return ft(Math.PI/2,e,n,r)+(t-Math.PI/2)}const ht={Elevation:3e4,Angle:e(16)},Mt=.05,gt=12,yt=12,dt=e(80);function bt(t,e,n,r,o,i){const a=R(),s=new C;let c=!0,l=!0;const{eye:u}=e;return t.intersectScreen(n,a,i)&&Zt(u,a,r)?s.radius=M(a):(l=!1,e.aboveGround&&0!==o?s.radius=Math.max(M(e.center),.9*r):s.radius=M(e.eye)-e.relativeElevation,1===o?Pt(s,e,n,a):c=D(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:l}}function xt(t,e,n,r){const o=t.relativeElevation;if(o>ht.Elevation&&"global"===r)return 1;W(t,e,be);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,fe);return-i*g(a,be.direction)<Math.sin(ht.Angle)*M(be.direction)?0:1}function jt(t,e,n){y(vt,n,e),t.eye=y(fe,t.eye,vt),t.center=y(fe,t.center,vt)}const vt=R();function Pt(t,e,n,r){const o=W(e,n,de);return null!=o&&(t.closestPointOnSilhouette(o,zt),t.intersectRay(o,r)?!(j(zt,o.origin)<j(r,o.origin))||(v(r,zt),!1):(y(wt,e.eye,e.center),x(wt,wt),E(wt,-g(x(wt,wt),zt),It),q(It,o,r),!1))}const zt=R(),wt=R(),It=k();function Rt(t,e){const n=t.fullHeight/t.pixelRatio,r=e(0),o=e(n);if(r||!o)return null;let i=0,a=n;for(let s=0;s<yt;s++){const t=.5*(i+a);e(t)?a=t:i=t}return a}function At(t,e,n){return e?t>n:t<n}function Ht(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(gt,Mt*r)}function St(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+Ht(t,e))}function Tt(t,e){return Math.max(0,e-Ht(t,e))}function Ut(t,e,n,r){return xe[0]=n,xe[1]=r,t.intersectRay(W(e,xe,de),fe)}function Gt(t,e,n,r){return xe[0]=n,xe[1]=r,q(t,W(e,xe,de),fe)}function kt(i,a,s,c,l,u){let m=0;if(P(Me,i,a),y(pe,i,a),M(i)<=l||!c.aboveGround){P(s,pe,c.eye);const f=g(i,a)/(M(i)*M(a));if(f<.9999)m=r(f);else{const t=M(P(R(),i,a))/(M(i)*M(a));m=o(t)}const p=Math.cos(n(t.normalize(e(u)),0,dt));m=-m-Math.max(0,M(a)-l)/(p*l)}else y(Et,c.eye,c.center),P(s,pe,Et),m=-M(pe)/l;return x(s,s),z(s,s,M(Me)),m}const Et=R();function qt(o,i,a,s){let c,l;const u=Math.cos(n(t.normalize(e(s)),0,dt));return c=i>a?-(i-a)/(u*a):i<-a?Math.PI-(i+a)/(u*a):r(i/a),l=o>a?-(o-a)/(u*a):o<-a?Math.PI-(o+a)/(u*a):r(o/a),(l-c)*a}function Ct(t,e,n,r,o,i,a,s,c,l){const u=qt(t[2],e[2],i.radius,s),m=c?qt(t[0],e[0],i.radius,180):e[0]-t[0],p=Math.sin(a)*m-Math.cos(a)*u,h=Math.cos(a)*m+Math.sin(a)*u;x(fe,o);const M=c?p/Math.sqrt(Math.abs(i.radius**2-g(n,fe)**2)):p/i.radius,y=h/Math.sqrt(Math.abs(i.radius**2-g(n,r)**2));f(l,M,y)}function Ft(t,e,n,r,o,i,a,s,c,l){P(Me,t,e),U(i.up,i.eye,ee,ne,re),U([0,0,1],i.eye,$t,_t,te),v(n,_t),v(r,$t),x(n,n),z(n,n,M(Me)),G(t,x(ne,ne),x(re,re),x(ee,ee),oe),G(e,ne,re,ee,ie),Ct(oe,ie,t,$t,_t,a,s,c,l,o)}function Ot(t,e,n,r,o,i,s){a(ce,o,r),a(le,s,i),l(ue,ce,le),y(e,t,n),d(e,e,ue),b(e,e,n)}function Wt(t,e,n,r,o,i){a(ce,r,n),a(le,i,o),l(ue,ce,le),y(fe,t.eye,e),d(fe,fe,ue),t.eye=b(fe,fe,e),y(fe,t.center,e),d(fe,fe,ue),t.center=b(fe,fe,e),y(fe,t.up,e),d(fe,fe,ue),t.up=b(fe,fe,e)}const Bt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let Dt=!1;function Jt(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-Bt.Angle||Math.abs(r)<Bt.Angle,s=(Math.abs(t[2])<n*Bt.Pole||Math.abs(e)>n)&&i;return a&&s?!Dt&&o<Bt.Tilt-Bt.TiltHysteresisMargin?Dt=!0:Dt&&o>Bt.Tilt+Bt.TiltHysteresisMargin&&(Dt=!1):Dt=!1,Dt}function Kt(t,e,n,r,o,i){if(i)H(n,r,se),it(e,t.center,se);else{const i=kt(n,r,ge,e,t.radius,o);it(e,t.center,T(ge,i))}}function Lt(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let l,u;v(me,r),he.copyFrom(e);for(let m=0;m<s&&j(n,me)>c&&(l=j(n,me),Ft(n,me,_t,$t,ae,he,t,o,i,a),Wt(he,t.center,$t,ae[1],_t,ae[0]),Ot(me,me,t.center,$t,ae[1],_t,ae[0]),u=j(n,me),u<l||0===m);m++)e.copyFrom(he)}function Nt(n,r,o,i,a,s,c){Jt(o,g(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?Lt(n,r,o,i,-t.normalize(e(a)),s,c):Kt(n,r,o,i,s,c)}function Qt(t,e,n,r,o,i){const{eye:a}=t;U([0,0,1],a,$t,_t,te);const s=e.translation[0]*n.pan,l="zoom"===o.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-g(t.center,$t)**2/M(t.center)**2)),.5),m=(Math.sin(i)*l+Math.cos(i)*s)/u,f=-Math.cos(i)*l+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,$t),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,f,_t),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function Vt(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(O.get(),a,i),l=e.translation[0]*n.pan;switch(0!==l&&(c(r.pan.matrix,r.pan.matrix,-l,s),r.pan.enabled=!0),o.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(r.pan.matrix,r.pan.matrix,t,a),r.pan.enabled=!0);break}case"zoom":r.zoom=-e.translation[1]*n.zoom}}function Xt(n,r,o,i,a,s,c,l,u){Jt(n.center,g(n.up,n.center),M(n.center),-t.normalize(e(s)),c,r.aboveGround)?Qt(r,o,i,l,u,-t.normalize(e(a))):Vt(r,o,i,l,u)}function Yt(t,e,n=1/0){const r=Math.abs(g(t,e));return Math.min(n,1/r)}function Zt(t,e,n){const r=h(t,e),o=M(t);return r<Math.max(o,n)}const $t=R(),_t=R(),te=R(),ee=R(),ne=R(),re=R(),oe=R(),ie=R(),ae=p(),se=A(),ce=m(),le=m(),ue=m(),me=R(),fe=R(),pe=R();let he=new J;const Me=R(),ge=R();function ye(){he=new J}const de={origin:R(),direction:R()},be={origin:R(),direction:R()},xe=i();export{dt as TiltThresholdPanningSpeed,ht as VerticalPanTresholds,jt as applyPanPlanar,Kt as applyPanSphericalDirectRotation,Lt as applyPanSphericalPreserveHeading,it as applyRotation,Wt as applyRotationWithTwoAxes,lt as applyZoomOnSphere,ct as applyZoomToPoint,mt as centroid,ye as cleanupNavigationUtils,Tt as computeHorizonDownLimitScreenY,Ht as computeHorizonPadding,St as computeHorizonUpLimitScreenY,et as distanceComparisonTolerance,nt as excludeTerrain,Rt as findHorizonScreenY,Yt as getTiltScaleFactor,xt as inferNavigationMode,at as intersectPlaneFromScreenPoint,st as intersectPlaneFromScreenPointAtEye,Gt as intersectsPlaneAtScreenPoint,Ut as intersectsSphereAtScreenPoint,Zt as isHitOnSamePlanetSide,qt as lengthFromPoints,X as maxPanDistanceModifier,Z as maxRotatePivotDistanceModifier,L as maxZoomPivotDistanceModifier,Q as maxZoomStepDistanceModifier,Y as minPinchAndPanCameraHeight,$ as minRotatePivotDistance,rt as normalizeCoordinate,ot as normalizeRotationDelta,pt as offSurfaceTiltToEyeTiltGlobal,ft as onSurfaceTiltToEyeTiltGlobal,Xt as panMotionToRotationMatrix,Nt as panToPosition,bt as pickPointAndInitSphere,_ as pivotSearchAreaSize,Bt as preservingHeadingThresholds,Mt as relativeHorizonPanPadding,tt as rotatePivotSearchAreaSize,Ot as rotatePointAroundTwoAxes,kt as rotationAngleAndAxisDirectRotation,Ft as rotationAnglesAndAxesHeadingPreserving,Ct as rotationAnglesHeadingPreserving,At as shouldClampScreenY,Jt as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,N as zoomPivotDistanceClamp,V as zoomStepDistanceClamp};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function a(e){return t[e]}function i(){return has("esri-iPhone")?"low":"medium"}const o={reset(){const e=m();for(const a of Object.keys(e))t[a]=e[a]}},l={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430},t=m();function m(){const a=!!has("esri-mobile"),i=!!has("ios"),o=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:5e4,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0},heatmap:{pixelRatio:.125},sceneService:{objectLoDFactor:.2,pointLoDFactor:1,meshLoDFactor:.6,pointCloudLoDFactor:.5},gaussianSplat:{idleMinimumSplatPixelRadius:2,nonIdleMinimumSplatPixelRadius:4,idleMinimumOpacity:0,nonIdleMinimumOpacity:0,maximumNumberOfGaussians:1e6},flow:{maxTotalNumberOfStreamlines:5e3,maxTracingResolution:1024,transitionEnabled:!1},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:e(0),physicallyBasedRenderingEnabled:!1,maxTexturePixels:a?1048576:4194304,memoryLimit:200+l.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:15e4,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.25},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{idleMinimumSplatPixelRadius:1,nonIdleMinimumSplatPixelRadius:1.5,idleMinimumOpacity:1,nonIdleMinimumOpacity:2,maximumNumberOfGaussians:2e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4194304:4096**2,memoryLimit:a?600+l.GalaxyS20:750+l.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:3e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.5},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{idleMinimumSplatPixelRadius:.5,nonIdleMinimumSplatPixelRadius:1,idleMinimumOpacity:3,nonIdleMinimumOpacity:1,maximumNumberOfGaussians:4e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:2,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4096**2:1/0,memoryLimit:a?900+l.SurfacePro7:1500+l.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}export{o as QualityProfileTest,i as getDefaultQualityProfileName,a as getQualityProfileSettings};
2
+ import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function a(e){return t[e]}function i(){return has("esri-iPhone")?"low":"medium"}const o={reset(){const e=m();for(const a of Object.keys(e))t[a]=e[a]}},l={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430},t=m();function m(){const a=!!has("esri-mobile"),i=!!has("ios"),o=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:5e4,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0},heatmap:{pixelRatio:.125},sceneService:{objectLoDFactor:.2,pointLoDFactor:1,meshLoDFactor:.6,pointCloudLoDFactor:.5},gaussianSplat:{idleMinimumSplatPixelRadius:2,nonIdleMinimumSplatPixelRadius:4,idleMinimumOpacity:0,nonIdleMinimumOpacity:0,maximumNumberOfGaussians:1e6},flow:{maxTotalNumberOfStreamlines:5e3,maxTracingResolution:1024,transitionEnabled:!1},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:e(0),physicallyBasedRenderingEnabled:!1,maxTexturePixels:a?1048576:4194304,memoryLimit:200+l.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:15e4,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.25},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{idleMinimumSplatPixelRadius:1,nonIdleMinimumSplatPixelRadius:1.5,idleMinimumOpacity:1,nonIdleMinimumOpacity:0,maximumNumberOfGaussians:2e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4194304:4096**2,memoryLimit:a?600+l.GalaxyS20:750+l.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:3e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.5},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{idleMinimumSplatPixelRadius:.5,nonIdleMinimumSplatPixelRadius:1,idleMinimumOpacity:2,nonIdleMinimumOpacity:1,maximumNumberOfGaussians:4e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:2,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4096**2:1/0,memoryLimit:a?900+l.SurfacePro7:1500+l.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}export{o as QualityProfileTest,i as getDefaultQualityProfileName,a as getQualityProfileSettings};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{signal as e}from"../../../../core/signal.js";class i{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}constructor(i){this.layerView=i,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i){const t=this._getTargetOpacity(i);if(e.fadeDirection=i,0===this.fadeDuration)return void this._instantTileFading(e,t);const a=e.opacityModifier;if(a!==t){const i=1-Math.abs(t-a);this._startTileFading(e,i)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.notifyTileObbsChanged(i),0===this._numFadingTiles.value&&this.layerView.updateGaussians()),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&this._numFadingTiles.value--}get updating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(e,i){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,e.fadeProgress=null)}_updateTileFading(e,t){const{fadeProgress:a,fadeDirection:s}=e;if(null==a)return!1;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),u=Math.min(a+r,1),o=n*(1-(0===s?i.fadeInEase:i.fadeOutEase)(u)),g=1===u;if(e.opacityModifier=g?d:d-o,g){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){const i=255*e.opacityModifier;for(let t=0;t<e.pageIds.length;t++){const a=e.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(i,a)}}_instantTileFading(e,i){e.fadeProgress=null,e.opacityModifier=i,this._updateOpacityModifier(e),1===e.fadeDirection&&this._onTileFullyFadedOut(e)}_instantlyFullyFadeAllTiles(){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(i=>{if(null!=i.fadeProgress){const t=1===i.fadeDirection;this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection)),t&&e.push(i)}});e.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(e)),this._numFadingTiles.value=0}_onTileFullyFadedOut(e){e.lifecycleState=0,this.layerView.moveTileToCache(e)}_fadeDirectionToSign(e){return 0===e?1:-1}_getTargetOpacity(e){return 0===e?1:0}}export{i as GaussianSplatFadeHelper};
2
+ import{signal as e}from"../../../../core/signal.js";import{Milliseconds as i}from"../../../../core/time.js";class t{static{this.fadeInEase=e=>e*(2-e)}static{this.fadeOutEase=e=>e*e}static{this.inverseFadeInEase=e=>1-Math.sqrt(1-e)}static{this.inverseFadeOutEase=e=>Math.sqrt(1-e)}static{this.minimumFadeDuration=i(80)}static{this.resetFadeDurationInterval=i(1e3)}constructor(t){this.layerView=t,this._numFadingTiles=e(0),this._tmpFullyFadedOutTiles=new Array,this._previousNumFadingTiles=0,this._lastStoppedFading=i(0),this._currentFadeDuration=this.baseFadeDuration}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(e,i,t){const a=this._getTargetOpacity(i);if(e.fadeDirection=i,!this.fadingEnabled)return void this._instantTileFading(e,a);const s=e.opacityModifier;if(s!==a){const a=this._getFadeProgressFromOpacity(s,i);this._startTileFading(e,a,t)}else this._stopTileFading(e)}updateAllTileFading(e){const i=this._tmpFullyFadedOutTiles;i.length=0,this.layerView.tileHandles.forEach(t=>{this._updateTileFading(t,e)&&i.push(t)});i.length>0&&(this.layerView.notifyTileObbsChanged(i),0===this._numFadingTiles.value&&this.layerView.updateGaussians()),this._numFadingTiles.value>0&&this.layerView.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(e){0===e&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(e){return null!=e.fadeProgress&&1===e.fadeDirection}onTileDiscarded(e){null!=e.fadeProgress&&(this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=i(performance.now())))}updateFadeDuration(){if(this.numFadingTiles&&this.numFadingTiles>=this._previousNumFadingTiles){const e=.95*this._currentFadeDuration;this._currentFadeDuration=i(Math.max(e,t.minimumFadeDuration))}else 0===this.numFadingTiles&&performance.now()-this._lastStoppedFading>t.resetFadeDurationInterval&&(this._currentFadeDuration=this.baseFadeDuration);return this._previousNumFadingTiles=this.numFadingTiles,console.log(this._numFadingTiles,this._currentFadeDuration),this._currentFadeDuration}get updating(){return this._numFadingTiles.value>0}get baseFadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.baseFadeDuration}_startTileFading(e,i,t){null==e.fadeProgress&&this._numFadingTiles.value++,e.fadeDuration=t,e.fadeProgress=i}_stopTileFading(e){null!=e.fadeProgress&&(1===e.fadeDirection&&this._onTileFullyFadedOut(e),this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=i(performance.now())),e.fadeDuration=null,e.fadeProgress=null)}_updateTileFading(e,i){const{fadeProgress:a,fadeDirection:s}=e;if(null==a)return!1;const n=this._fadeDirectionToSign(s),r=e.fadeDuration,d=this._getTargetOpacity(s),l=i/Math.abs(r||1),u=Math.min(a+l,1),o=n*(1-(0===s?t.fadeInEase:t.fadeOutEase)(u)),h=1===u;if(e.opacityModifier=h?d:d-o,h){const i=1===s;return this._stopTileFading(e),this._updateOpacityModifier(e),i}return e.fadeProgress=u,this._updateOpacityModifier(e),!1}_updateOpacityModifier(e){const i=255*e.opacityModifier;for(let t=0;t<e.pageIds.length;t++){const a=e.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(i,a)}}_instantTileFading(e,i){e.fadeDuration=null,e.fadeProgress=null,e.opacityModifier=i,this._updateOpacityModifier(e),1===e.fadeDirection&&this._onTileFullyFadedOut(e)}_instantlyFullyFadeAllTiles(){const e=this._tmpFullyFadedOutTiles;e.length=0,this.layerView.tileHandles.forEach(i=>{if(null!=i.fadeProgress){const t=1===i.fadeDirection;this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection)),t&&e.push(i)}});e.length>0&&(this.layerView.updateGaussians(),this.layerView.notifyTileObbsChanged(e)),this._numFadingTiles.value=0}_onTileFullyFadedOut(e){e.lifecycleState=0,this.layerView.moveTileToCache(e)}_fadeDirectionToSign(e){return 0===e?1:-1}_getTargetOpacity(e){return 0===e?1:0}_getFadeProgressFromOpacity(e,i){const a=Math.max(0,Math.min(e,1));return 0===i?t.inverseFadeInEase(a):t.inverseFadeOutEase(a)}}export{t as GaussianSplatFadeHelper};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Logger.js";import{destroyMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,cast as l,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as d}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeVisualizerNode as h,getAttachmentName as a}from"./RenderNodeVisualizerNode.js";import c from"../../../../../widgets/Widget.js";import{tsx as p}from"../../../../../widgets/support/widget.js";let u=class extends c{constructor(){super(...arguments),this.clearColor=d,this.previewSize=v,this.filter=["color"],this.node=null,this.active=!0,this._previews=new Map,this._allPreviews=new Set,this._dirty=!0}castPreviewSize(e){return Math.max(e,v)}get _namedFilters(){const e=this.filter?.filter(e=>"color"!==e&&"depth"!==e);return e&&e.length>0?e:null}initialize(){this.node||(this.node=new h({view:this.view,destroyedCB:()=>{this.node=null,this.destroy()},clearColor:this.clearColor}));const e=this.node;this._updateInterval=setInterval(()=>this._updatePreviews()),this.addHandles([r(()=>this.active,i=>{this.view.stage.renderer.fboCache.debugCallback=i?(i,r)=>{if(null==i||null==r||!this.view.stage.renderView.renderingContext)return this._previews.forEach(([e])=>e.release()),void this._previews.clear();if("fbo visualizer"===i||!this._matchesFilter(i)||r&&0===r.colorAttachments.length&&null==r.depthStencilTexture)return;const{width:s,height:o}=r,l=o>this.previewSize?Math.round(s*this.previewSize/o):s,n=o>this.previewSize?this.previewSize:o;if(l/n>4)return void t.getLogger(this).warnOnce(`Skipping preview of wide ${i} FBO (${l}x${n}px)`);r.level&&(i+=` ${r.level}`);const d=e.getDownscaledFBO(r,i,this._focusedAttachment,l,n),h=null!=r.depthStencilTexture,c=this.filter?.includes("color")||!this.filter?.includes("depth"),p=this.filter?.includes("depth")||!this.filter?.includes("color");d.fbo?.colorAttachments.forEach((e,t)=>{const l=d.getAttachment(e);if(l){const n=h&&t===r.colorAttachments.length;if(n&&!p||!n&&!c)return;l.retain();const d=a(i,r,e,n),u=this._previews.get(d);u?.[0]?.release(),this._previews.set(d,[l,s,o]),this._allPreviews.add(d)}}),d.detachAllColors(),d.release(),this._dirty=!0}:null},s)])}destroy(){this.removeHandles(),this.view.stage?.renderer&&(this.view.stage.renderer.fboCache.debugCallback=null),this._removeUpdate(),this.node&&(this.node.destroyedCB=()=>{},this.node=i(this.node)),this._previews.forEach(([e])=>e.release()),this._previews.clear()}_matchesFilter(e){return this._namedFilters?.some(t=>e.includes(t))??!0}_updatePreviews(){if(!this._dirty)return;this._dirty=!1,this.renderNow();const e=this._focusedAttachment&&Array.from(this._previews.keys()).includes(this._focusedAttachment);this._focusedAttachment&&!e&&this._deselectFocusFBO(),this._allPreviews.forEach((e,t)=>{const i=this._getElement(t);if(!i)return;i.getContext("2d").clearRect(0,0,i.width,i.height)}),this._previews.forEach(([e,t,i],r)=>{const s=this._getElement(r);if(!s)return;const o=i>this.previewSize?Math.round(t*this.previewSize/i):t,l=i>this.previewSize?this.previewSize:i;s.style.width=`${o}px`,s.style.height=`${l}px`;const n=s.width,d=s.height,h=this._getElement(`label-${r}`);h&&(h.innerText=`${r} (${t}x${i})`);const a=this.node?.getPreviewContent(n,d,e,r),c=s.getContext("2d");c.clearRect(0,0,n,d),a&&c.putImageData(a,0,0)})}_getElement(e){return document.querySelector("arcgis-scene")?.shadowRoot?.getElementById(e)??document.getElementById(e)}_fboPreviewStyle(e){return{width:"1px",height:"1px",background:e?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0)",transform:"rotateX(180deg)"}}_removeUpdate(){null!=this._updateInterval&&(clearInterval(this._updateInterval),this._updateInterval=null)}_selectFocusFBO(e){this._focusedAttachment=e,this.view.stage.renderView.requestRender()}_deselectFocusFBO(){this._focusedAttachment=null,this.node?.clearFocusedFBO(),this.view.stage.renderView.requestRender()}_renderFBOPreviews(){const e=this._allPreviews.size>0?Array.from(this._allPreviews.keys()).sort().map(e=>this._renderFBOPreview(e)):p("div",null);return p("div",{styles:{display:"flex",flexFlow:"row wrap",justifyContent:"flex-end",gap:"2px"}},e)}_renderFBOPreview(e){const t=this._previews.has(e);return p("div",{key:e,onclick:()=>this._selectFocusFBO(e),styles:{display:"flex",flexFlow:"column nowrap",alignItems:"center"}},p("canvas",{id:e,styles:this._fboPreviewStyle(t)}),p("div",{id:e,styles:{display:"flex",justifyContent:"center"}},p("p",{id:`label-${e}`,styles:{fontSize:"12px",color:"white",margin:"1px",textShadow:"-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000"}})))}render(){return p("div",{class:"esri-widget debug-widget",styles:{display:"flex",flexFlow:"column nowrap",alignItems:"flex-end",background:"rgba(255, 255, 255, 0)"}},this._renderFBOPreviews(),p("button",{onclick:()=>this._deselectFocusFBO(),type:"button"},"Reset focus"))}};e([o({constructOnly:!0})],u.prototype,"view",void 0),e([o({constructOnly:!0})],u.prototype,"clearColor",void 0),e([o()],u.prototype,"previewSize",void 0),e([l("previewSize")],u.prototype,"castPreviewSize",null),e([o()],u.prototype,"filter",void 0),e([o()],u.prototype,"_namedFilters",null),e([o()],u.prototype,"node",void 0),e([o()],u.prototype,"active",void 0),u=e([n("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizer")],u);const v=140;export{u as RenderNodeVisualizer,v as minimumPreviewSize};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Logger.js";import{destroyMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,cast as l,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as d}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeVisualizerNode as h,getAttachmentName as a}from"./RenderNodeVisualizerNode.js";import c from"../../../../../widgets/Widget.js";import{tsx as p}from"../../../../../widgets/support/widget.js";let u=class extends c{constructor(){super(...arguments),this.clearColor=d,this.previewSize=v,this.filter=["color"],this.node=null,this.active=!0,this._previews=new Map,this._allPreviews=new Set,this._dirty=!0}castPreviewSize(e){return Math.max(e,v)}get _namedFilters(){const e=this.filter?.filter(e=>"color"!==e&&"depth"!==e);return e&&e.length>0?e:null}initialize(){this.node||(this.node=new h({view:this.view,destroyedCB:()=>{this.node=null,this.destroy()},clearColor:this.clearColor}));const e=this.node;this._updateInterval=setInterval(()=>this._updatePreviews()),this.addHandles([r(()=>this.active,i=>{this.view.stage.renderer.fboCache.debugCallback=i?(i,r)=>{if(null==i||null==r||!this.view.stage.renderView.renderingContext)return this._previews.forEach(([e])=>e.release()),void this._previews.clear();if("fbo visualizer"===i||!this._matchesFilter(i)||r&&0===r.colorAttachments.length&&null==r.depthStencilTexture)return;const{width:s,height:o}=r,l=o>this.previewSize?Math.round(s*this.previewSize/o):s,n=o>this.previewSize?this.previewSize:o;if(l/n>4)return void t.getLogger(this).warnOnce(`Skipping preview of wide ${i} FBO (${l}x${n}px)`);r.level&&(i+=` ${r.level}`);const d=e.getDownscaledFBO(r,i,this._focusedAttachment,l,n),h=null!=r.depthStencilTexture,c=this.filter?.includes("color")||!this.filter?.includes("depth"),p=this.filter?.includes("depth")||!this.filter?.includes("color");d.fbo?.colorAttachments.forEach((e,t)=>{const l=d.getAttachment(e);if(l){const n=h&&t===r.colorAttachments.length;if(n&&!p||!n&&!c)return;l.retain();const d=a(i,r,e,n),u=this._previews.get(d);u?.[0]?.release(),this._previews.set(d,[l,s,o]),this._allPreviews.add(d)}}),d.detachAllColors(),d.release(),this._dirty=!0}:null},s)])}destroy(){this.removeHandles(),this.view.stage?.renderer&&(this.view.stage.renderer.fboCache.debugCallback=null),this._removeUpdate(),this.node&&(this.node.destroyedCB=()=>{},this.node=i(this.node)),this._previews.forEach(([e])=>e.release()),this._previews.clear()}_matchesFilter(e){return this._namedFilters?.some(t=>e.includes(t))??!0}_updatePreviews(){if(!this._dirty)return;this._dirty=!1,this.renderNow();const e=this._focusedAttachment&&Array.from(this._previews.keys()).includes(this._focusedAttachment);this._focusedAttachment&&!e&&this._deselectFocusFBO(),this._allPreviews.forEach((e,t)=>{const i=this._getElement(t);if(!i)return;i.getContext("2d").clearRect(0,0,i.width,i.height)}),this._previews.forEach(([e,t,i],r)=>{const s=this._getElement(r);if(!s)return;const o=i>this.previewSize?Math.round(t*this.previewSize/i):t,l=i>this.previewSize?this.previewSize:i;s.style.width=`${o}px`,s.style.height=`${l}px`;const n=s.width,d=s.height,h=this._getElement(`label-${r}`);h&&(h.innerText=`${r} (${t}x${i})`);const a=this.node?.getPreviewContent(n,d,e,r),c=s.getContext("2d");c.clearRect(0,0,n,d),a&&c.putImageData(a,0,0)})}_getElement(e){return document.querySelector("arcgis-scene")?.shadowRoot?.getElementById(e)??document.getElementById(e)}_fboPreviewStyle(e){return{width:"1px",height:"1px",background:e?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0)",transform:"rotateX(180deg)"}}_removeUpdate(){null!=this._updateInterval&&(clearInterval(this._updateInterval),this._updateInterval=null)}_selectFocusFBO(e){this._focusedAttachment=e,this.view.stage.renderView.requestRender()}_deselectFocusFBO(){this._focusedAttachment=null,this.node?.clearFocusedFBO(),this.view.stage.renderView.requestRender()}_renderFBOPreviews(){const e=this._allPreviews.size>0?Array.from(this._allPreviews.keys()).sort().map(e=>this._renderFBOPreview(e)):p("div",null);return p("div",{styles:{display:"flex",flexFlow:"row wrap",justifyContent:"flex-end",gap:"2px"}},e)}_renderFBOPreview(e){const t=this._previews.has(e);return p("div",{key:e,styles:{display:"flex",flexFlow:"column nowrap",alignItems:"center"},onclick:()=>this._selectFocusFBO(e)},p("canvas",{id:e,styles:this._fboPreviewStyle(t)}),p("div",{id:e,styles:{display:"flex",justifyContent:"center"}},p("p",{id:`label-${e}`,styles:{fontSize:"12px",color:"white",margin:"1px",textShadow:"-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000"}})))}render(){return p("div",{class:"esri-widget debug-widget",styles:{display:"flex",flexFlow:"column nowrap",alignItems:"flex-end",background:"rgba(255, 255, 255, 0)"}},this._renderFBOPreviews(),p("button",{type:"button",onclick:()=>this._deselectFocusFBO()},"Reset focus"))}};e([o({constructOnly:!0})],u.prototype,"view",void 0),e([o({constructOnly:!0})],u.prototype,"clearColor",void 0),e([o()],u.prototype,"previewSize",void 0),e([l("previewSize")],u.prototype,"castPreviewSize",null),e([o()],u.prototype,"filter",void 0),e([o()],u.prototype,"_namedFilters",null),e([o()],u.prototype,"node",void 0),e([o()],u.prototype,"active",void 0),u=e([n("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizer")],u);const v=140;export{u as RenderNodeVisualizer,v as minimumPreviewSize};