@arcgis/core 4.24.0-next.20220508 → 4.24.0-next.20220511

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 (338) hide show
  1. package/AggregateGraphic.js +1 -1
  2. package/analysis/Analysis.js +1 -1
  3. package/analysis/DimensioningAnalysis.js +1 -1
  4. package/analysis/LengthDimension.d.ts +4 -0
  5. package/analysis/LengthDimension.js +5 -0
  6. package/analysis/dimensionUtils.js +5 -0
  7. package/arcade/Dictionary.js +1 -1
  8. package/arcade/Feature.js +1 -1
  9. package/arcade/arcade.js +1 -1
  10. package/arcade/arcadeAsyncRuntime.js +1 -1
  11. package/arcade/arcadeCompiler.js +1 -1
  12. package/arcade/credentials.js +1 -1
  13. package/arcade/featureSetCollection.js +1 -1
  14. package/arcade/featureSetUtils.js +1 -1
  15. package/arcade/featureset/actions/Adapted.js +1 -1
  16. package/arcade/featureset/actions/AttributeFilter.js +1 -1
  17. package/arcade/featureset/actions/GroupBy.js +1 -1
  18. package/arcade/featureset/actions/OrderBy.js +1 -1
  19. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  20. package/arcade/featureset/actions/Top.js +1 -1
  21. package/arcade/featureset/sources/Empty.js +1 -1
  22. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  23. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  24. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  25. package/arcade/featureset/support/FeatureSet.js +1 -1
  26. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  27. package/arcade/featureset/support/shared.js +1 -1
  28. package/arcade/featureset/support/stats.js +1 -1
  29. package/arcade/functions/featuresetbase.js +1 -1
  30. package/arcade/functions/featuresetgeom.js +1 -1
  31. package/arcade/functions/featuresetstats.js +1 -1
  32. package/arcade/functions/featuresetstring.js +1 -1
  33. package/arcade/functions/geomasync.js +1 -1
  34. package/arcade/languageUtils.js +1 -1
  35. package/arcade/request.js +1 -1
  36. package/assets/esri/core/workers/RemoteClient.js +1 -1
  37. package/assets/esri/core/workers/chunks/0564f1cfa3d17ff1aad3.js +1 -0
  38. package/assets/esri/core/workers/chunks/0806d5d706a864542bfb.js +1 -0
  39. package/assets/esri/core/workers/chunks/0a6977144ea1abf96fbf.js +1 -0
  40. package/assets/esri/core/workers/chunks/13387f56acbc3291561a.js +1 -0
  41. package/assets/esri/core/workers/chunks/16c4e0a32d50d4db984d.js +1 -0
  42. package/assets/esri/core/workers/chunks/{076d1b1101b59af0d389.js → 1c010202b4c7e1d15f23.js} +1 -1
  43. package/assets/esri/core/workers/chunks/26827ec144676e6385f8.js +1 -0
  44. package/assets/esri/core/workers/chunks/287c484fd40eee643f3a.js +1 -0
  45. package/assets/esri/core/workers/chunks/5210f0b42dba27945226.js +1 -0
  46. package/assets/esri/core/workers/chunks/{db6c5b3b4efe8d804f9c.js → 52478ee2d2a1354b6900.js} +1 -1
  47. package/assets/esri/core/workers/chunks/5759af97f96f24c40105.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b85218d44c6094b7e5e6.js → 6d7e2a23a0a5dd9ded1d.js} +1 -1
  49. package/assets/esri/core/workers/chunks/70b6356357e7640c4e8b.js +1 -0
  50. package/assets/esri/core/workers/chunks/7574316b3af61c389e8f.js +1 -0
  51. package/assets/esri/core/workers/chunks/7bc828fbdd54c0b28aac.js +1 -0
  52. package/assets/esri/core/workers/chunks/7e5c22b5a32ac74b1b6e.js +1 -0
  53. package/assets/esri/core/workers/chunks/8102bb78fe96e6197e4e.js +1 -0
  54. package/assets/esri/core/workers/chunks/88384e7cafbfd2348598.js +1 -0
  55. package/assets/esri/core/workers/chunks/9d7533aaeac3b8d145c4.js +1 -0
  56. package/assets/esri/core/workers/chunks/{1eecae5227318f491263.js → 9f4d892abf55e8625bc9.js} +3 -3
  57. package/assets/esri/core/workers/chunks/{98607a0da63626cc4614.js → a054a52712a118c6d505.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{69a20e4d9e28c3e599fc.js → a3bb600bfcb0282622f1.js} +1 -1
  59. package/assets/esri/core/workers/chunks/aa49841b14c6e6df2a07.js +1 -0
  60. package/assets/esri/core/workers/chunks/b089058b64db3912478f.js +1 -0
  61. package/assets/esri/core/workers/chunks/b28539c5a6bedb71b038.js +1 -0
  62. package/assets/esri/core/workers/chunks/b4f171db73355c6f766e.js +1 -0
  63. package/assets/esri/core/workers/chunks/b7572b0921b23aef8b9d.js +1 -0
  64. package/assets/esri/core/workers/chunks/b758f3c419edc2306784.js +1 -0
  65. package/assets/esri/core/workers/chunks/c3e7290fb128d4fefd44.js +1 -0
  66. package/assets/esri/core/workers/chunks/c51c9b5da855f84b9a48.js +1 -0
  67. package/assets/esri/core/workers/chunks/c66ac36da6392b6bf331.js +1 -0
  68. package/assets/esri/core/workers/chunks/d16b328d32a6ddc2fdb9.js +1 -0
  69. package/assets/esri/core/workers/chunks/d94c5f36d52cf71f0bb9.js +1 -0
  70. package/assets/esri/core/workers/chunks/db937849b2c1af87b481.js +1 -0
  71. package/assets/esri/core/workers/chunks/{66cd99e91dad60c5274c.js → dc3ed59f450283d97a19.js} +1 -1
  72. package/assets/esri/core/workers/chunks/dcd0653191cd4a1ccaae.js +2 -0
  73. package/assets/esri/core/workers/chunks/{31df729c17470245288c.js.LICENSE.txt → dcd0653191cd4a1ccaae.js.LICENSE.txt} +2 -2
  74. package/assets/esri/core/workers/chunks/e4fdd1eaf987977d0a51.js +1 -0
  75. package/assets/esri/core/workers/chunks/e51f0e71f2a55af604d3.js +1 -0
  76. package/assets/esri/core/workers/chunks/eb3855d3753d6b8334bd.js +1 -0
  77. package/assets/esri/core/workers/chunks/{7c290763920f52a1f504.js → eeed138930a4a805691d.js} +1 -1
  78. package/assets/esri/core/workers/chunks/f435dc615fdc8917f6ca.js +1 -0
  79. package/assets/esri/core/workers/chunks/{d5c5b9f7f5401f36a3a5.js → f7f3dde4c8f9c687cc1e.js} +1 -1
  80. package/assets/esri/core/workers/chunks/fc6beaf9466ea3898549.js +1 -0
  81. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  82. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -0
  83. package/assets/esri/themes/base/widgets/_Weather.scss +1 -2
  84. package/assets/esri/themes/dark/main.css +1 -1
  85. package/assets/esri/themes/light/main.css +1 -1
  86. package/assets/esri/themes/light/view.css +1 -1
  87. package/chunks/BlendLayers.glsl.js +6 -6
  88. package/chunks/arcade.js +1 -1
  89. package/chunks/array.js +1 -1
  90. package/chunks/languageUtils.js +1 -1
  91. package/config.js +1 -1
  92. package/core/sql/StandardizedFunctions.js +1 -1
  93. package/geohash/GeohashTree.js +1 -1
  94. package/geometry/support/contains.js +1 -1
  95. package/geometry/support/heightModelInfoUtils.js +1 -1
  96. package/geometry/support/intersects.js +1 -1
  97. package/geometry/support/intersectsBase.js +1 -1
  98. package/geometry/support/normalizeUtilsCommon.js +1 -1
  99. package/geometry/support/spatialReferenceUtils.js +1 -1
  100. package/interfaces.d.ts +685 -37
  101. package/layers/MediaLayer.d.ts +4 -0
  102. package/layers/MediaLayer.js +5 -0
  103. package/layers/VoxelLayer.js +1 -1
  104. package/layers/VoxelWasmPerSceneView.js +5 -0
  105. package/layers/graphics/OptimizedGeometry.js +1 -1
  106. package/layers/graphics/data/BoundsStore.js +1 -1
  107. package/layers/support/CornersGeoreference.d.ts +4 -0
  108. package/layers/support/CornersGeoreference.js +5 -0
  109. package/layers/support/ExtentAndRotationGeoreference.d.ts +4 -0
  110. package/layers/support/ExtentAndRotationGeoreference.js +5 -0
  111. package/layers/support/FeatureReduction.js +1 -1
  112. package/layers/support/FeatureReductionBinning.js +5 -0
  113. package/layers/support/GeoreferenceBase.js +5 -0
  114. package/layers/support/ImageElement.d.ts +4 -0
  115. package/layers/support/ImageElement.js +5 -0
  116. package/layers/support/LocalMediaElementSource.d.ts +4 -0
  117. package/layers/support/LocalMediaElementSource.js +5 -0
  118. package/layers/support/MediaElementBase.d.ts +4 -0
  119. package/layers/support/MediaElementBase.js +5 -0
  120. package/layers/support/RouteStopSymbols.d.ts +4 -0
  121. package/layers/support/RouteSymbols.d.ts +4 -0
  122. package/layers/support/VoxelFormat.d.ts +4 -0
  123. package/layers/support/VoxelStyle.d.ts +4 -0
  124. package/layers/support/VoxelVariable.d.ts +4 -0
  125. package/layers/support/VoxelVolume.d.ts +4 -0
  126. package/layers/support/VoxelVolumeStyle.d.ts +4 -0
  127. package/layers/support/arcgisLayerUrl.js +1 -1
  128. package/layers/support/featureReductionUtils.js +1 -1
  129. package/layers/support/fieldUtils.js +1 -1
  130. package/layers/support/rasterFormats/Lerc.js +1 -1
  131. package/package.json +3 -3
  132. package/request.js +1 -1
  133. package/support/requestUtils.js +1 -1
  134. package/support/revision.js +1 -1
  135. package/symbols/Font.js +1 -1
  136. package/symbols/support/textUtils.js +1 -1
  137. package/views/2d/engine/brushes.js +1 -1
  138. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  139. package/views/2d/engine/webgl/Overlay.js +5 -0
  140. package/views/2d/engine/webgl/OverlayContainer.js +5 -0
  141. package/views/2d/engine/webgl/brushes/BrushOverlay.js +5 -0
  142. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  143. package/views/2d/engine/webgl/shaders/OverlayPrograms.js +5 -0
  144. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  145. package/views/2d/layerViewModuleImportUtils.js +1 -1
  146. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  147. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  148. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  149. package/views/2d/layers/MediaLayerView2D.js +5 -0
  150. package/views/2d/layers/StreamLayerView2D.js +1 -1
  151. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  152. package/views/2d/layers/features/FeatureStore2D.js +1 -1
  153. package/views/2d/layers/features/Pipeline.js +1 -1
  154. package/views/2d/layers/features/Store2D.js +1 -1
  155. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  156. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  157. package/views/2d/layers/features/schemaUtils.js +1 -1
  158. package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
  159. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  160. package/views/2d/layers/features/support/BinStore.js +5 -0
  161. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  162. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  163. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  164. package/views/2d/layers/support/clusterUtils.js +1 -1
  165. package/views/2d/magnifier/MagnifierView2D.js +1 -1
  166. package/views/2d/navigation/actions/Pinch.js +1 -1
  167. package/views/2d/viewpointUtils.js +1 -1
  168. package/views/3d/analysis/AnalysisView3D.js +1 -1
  169. package/views/3d/analysis/Dimensioning/DimensioningTool.js +5 -0
  170. package/views/3d/analysis/Dimensioning/DimensioningVisualization.js +1 -1
  171. package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +5 -0
  172. package/views/3d/analysis/Dimensioning/{LinearDimensionVisualization.js → LengthDimensionVisualization.js} +1 -1
  173. package/views/3d/analysis/Dimensioning/settings.js +5 -0
  174. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  175. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  176. package/views/3d/interactive/SegmentLabels3D.js +5 -0
  177. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  178. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  179. package/views/3d/interactive/editingTools/reshapeGraphic/GraphicReshapeTool.js +1 -1
  180. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  181. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  182. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  183. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  184. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  185. package/views/3d/layerViewModuleImportUtils.js +1 -1
  186. package/views/3d/layers/I3SMeshView3D.js +1 -1
  187. package/views/3d/layers/MediaLayerView3D.js +5 -0
  188. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  189. package/views/3d/layers/i3s/IDBCache.js +1 -1
  190. package/views/3d/state/controllers/RotateController.js +1 -1
  191. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  192. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  193. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  194. package/views/3d/support/ResourceController.js +1 -1
  195. package/views/3d/support/sunUtils.js +1 -1
  196. package/views/3d/terrain/TerrainRenderer.js +1 -1
  197. package/views/3d/terrain/TerrainSurface.js +1 -1
  198. package/views/3d/terrain/TileCompositor.js +1 -1
  199. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  200. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  201. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  202. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  203. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  204. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  206. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  207. package/views/DOMContainer.js +1 -1
  208. package/views/GroundView.js +1 -1
  209. package/views/SceneView.js +1 -1
  210. package/views/ToolViewManager.js +1 -1
  211. package/views/View.js +1 -1
  212. package/views/draw/DrawOperation.js +1 -1
  213. package/views/draw/support/Reshape.js +1 -1
  214. package/views/interactive/GraphicManipulator.js +1 -1
  215. package/views/interactive/InteractiveToolBase.js +1 -1
  216. package/views/interactive/SegmentLabels.js +5 -0
  217. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  218. package/views/interactive/snapping/LineSnapper.js +1 -1
  219. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  220. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  221. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  222. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  223. package/views/interactive/snapping/SnappingManager.js +1 -1
  224. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  225. package/views/interactive/snapping/snappingUtils.js +1 -1
  226. package/views/interactive/support/viewUtils.js +5 -0
  227. package/views/interactive/tooltip/DrawPointTooltipInfo.js +5 -0
  228. package/views/interactive/tooltip/DrawPolygonTooltipInfo.js +5 -0
  229. package/views/interactive/tooltip/DrawPolylineTooltipInfo.js +5 -0
  230. package/views/interactive/tooltip/Tooltip.js +1 -1
  231. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  232. package/views/interactive/tooltip/support/measurements.js +5 -0
  233. package/views/layers/FeatureLayerView.js +1 -1
  234. package/views/layers/GroupLayerView.js +1 -1
  235. package/views/overlay/TextOverlayItem.js +1 -1
  236. package/views/support/Scheduler.js +1 -1
  237. package/views/support/screenUtils.js +1 -1
  238. package/webscene/Slide.js +1 -1
  239. package/widgets/Attribution/AttributionViewModel.js +1 -1
  240. package/widgets/Bookmarks.js +1 -1
  241. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  242. package/widgets/Editor/EditorViewModel.js +1 -1
  243. package/widgets/Editor/UpdateWorkflow.js +1 -1
  244. package/widgets/Editor/workflowUtils.js +1 -1
  245. package/widgets/Editor.js +1 -1
  246. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  247. package/widgets/ElevationProfile.js +1 -1
  248. package/widgets/Feature/FeatureAttachments.js +1 -1
  249. package/widgets/Feature/FeatureContent/FeatureContentViewModel.js +1 -1
  250. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  251. package/widgets/Feature/FeatureExpression.js +1 -1
  252. package/widgets/Feature/FeatureFields.js +1 -1
  253. package/widgets/Feature/FeatureViewModel.js +1 -1
  254. package/widgets/Feature.js +1 -1
  255. package/widgets/FeatureForm/InputFieldGroup.js +1 -1
  256. package/widgets/FeatureForm.js +1 -1
  257. package/widgets/FeatureTable/FieldColumn.js +1 -1
  258. package/widgets/FeatureTable/Grid/Column.js +1 -1
  259. package/widgets/FeatureTable/Grid/Grid.js +11 -11
  260. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  261. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  262. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  263. package/widgets/FeatureTemplates.js +1 -1
  264. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  265. package/widgets/FloorFilter.js +1 -1
  266. package/widgets/HistogramRangeSlider.js +1 -1
  267. package/widgets/LayerList/LayerListViewModel.js +1 -1
  268. package/widgets/LayerList/ListItem.js +1 -1
  269. package/widgets/LayerList/ListItemPanel.js +1 -1
  270. package/widgets/LayerList.js +1 -1
  271. package/widgets/Legend/LegendViewModel.js +1 -1
  272. package/widgets/Legend/styles/Card.js +1 -1
  273. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  274. package/widgets/Legend.js +1 -1
  275. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  276. package/widgets/Measurement.js +1 -1
  277. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  278. package/widgets/Popup/PopupViewModel.js +1 -1
  279. package/widgets/Popup.js +1 -1
  280. package/widgets/Print/FileLink.js +1 -1
  281. package/widgets/Print.js +1 -1
  282. package/widgets/ScaleBar.js +1 -1
  283. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  284. package/widgets/ScaleRangeSlider.js +1 -1
  285. package/widgets/Search/SearchViewModel.js +1 -1
  286. package/widgets/Search.js +1 -1
  287. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  288. package/widgets/Sketch/SketchViewModel.js +1 -1
  289. package/widgets/Sketch.js +1 -1
  290. package/widgets/TableList/ListItem.js +1 -1
  291. package/widgets/Weather/LabeledSlider.js +1 -1
  292. package/widgets/Weather/VisibleElements.js +5 -0
  293. package/widgets/Weather/css.js +1 -1
  294. package/widgets/Weather.js +1 -1
  295. package/widgets/support/AnalysisViewModel.js +1 -1
  296. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  297. package/analysis/LinearDimension.d.ts +0 -4
  298. package/analysis/LinearDimension.js +0 -5
  299. package/assets/esri/core/workers/chunks/0018053ac16a09feba70.js +0 -1
  300. package/assets/esri/core/workers/chunks/042938ca73f0b9e5a7e2.js +0 -1
  301. package/assets/esri/core/workers/chunks/048645611caa28dca7cd.js +0 -1
  302. package/assets/esri/core/workers/chunks/0b72d123386dc4ec7538.js +0 -1
  303. package/assets/esri/core/workers/chunks/13b04d5bf348ab5054c2.js +0 -1
  304. package/assets/esri/core/workers/chunks/215007e7c44811d90777.js +0 -1
  305. package/assets/esri/core/workers/chunks/31df729c17470245288c.js +0 -2
  306. package/assets/esri/core/workers/chunks/36272141b3c33cb19026.js +0 -1
  307. package/assets/esri/core/workers/chunks/36c8e8de9c3f67d32572.js +0 -1
  308. package/assets/esri/core/workers/chunks/37c428489c59df4b597b.js +0 -1
  309. package/assets/esri/core/workers/chunks/493169fd978fd543ef3b.js +0 -1
  310. package/assets/esri/core/workers/chunks/4f378ad6f4299183df85.js +0 -1
  311. package/assets/esri/core/workers/chunks/58e4c6ce1580427e7b55.js +0 -1
  312. package/assets/esri/core/workers/chunks/6c5441da675a8af35be2.js +0 -1
  313. package/assets/esri/core/workers/chunks/6ea16f6a0df946de480b.js +0 -1
  314. package/assets/esri/core/workers/chunks/7dfd70f4fa1096e56641.js +0 -1
  315. package/assets/esri/core/workers/chunks/88193e61072d7bf957f5.js +0 -1
  316. package/assets/esri/core/workers/chunks/8ccbde593c86c872e525.js +0 -1
  317. package/assets/esri/core/workers/chunks/9c6be39f1f21ab8b1c2d.js +0 -1
  318. package/assets/esri/core/workers/chunks/a73795cce722ba15b3da.js +0 -1
  319. package/assets/esri/core/workers/chunks/a8ed1a938dc164b401d9.js +0 -1
  320. package/assets/esri/core/workers/chunks/a9a73bc4875a5aeaf1b9.js +0 -1
  321. package/assets/esri/core/workers/chunks/adcc5bce6c0971c1b592.js +0 -1
  322. package/assets/esri/core/workers/chunks/afddfe620e6539991e6b.js +0 -1
  323. package/assets/esri/core/workers/chunks/b340c9bdabdb37995c8f.js +0 -1
  324. package/assets/esri/core/workers/chunks/b4c23630d6c85f7b59c0.js +0 -1
  325. package/assets/esri/core/workers/chunks/c180c40838246985479d.js +0 -1
  326. package/assets/esri/core/workers/chunks/caed2365bd296fcc8a75.js +0 -1
  327. package/assets/esri/core/workers/chunks/d85b5b73a151c6fbb658.js +0 -1
  328. package/assets/esri/core/workers/chunks/da6261673c3e1537b6a6.js +0 -1
  329. package/assets/esri/core/workers/chunks/dafe120243db6648a4ab.js +0 -1
  330. package/assets/esri/core/workers/chunks/ec6d138e8183e193f977.js +0 -1
  331. package/assets/esri/core/workers/chunks/ed4519ac9533a4d340f1.js +0 -1
  332. package/assets/esri/core/workers/chunks/f206300eef4560611728.js +0 -1
  333. package/assets/esri/core/workers/chunks/f55cbaf5a1d6ee6ac171.js +0 -1
  334. package/layers/GeoreferencedImageLayer.d.ts +0 -4
  335. package/layers/GeoreferencedImageLayer.js +0 -5
  336. package/layers/VoxelWasmManager.js +0 -5
  337. package/layers/VoxelWasmPerScene.js +0 -5
  338. package/views/3d/interactive/measurementTools/support/viewUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{isSome as r,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{I as l}from"../../../chunks/mat4f64.js";import{b as d,s as h,e as c}from"../../../chunks/vec3.js";import{Z as u,c as p}from"../../../chunks/vec3f64.js";import{Z as g,c as f}from"../../../chunks/vec4f64.js";import{create as m,set as T}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as _}from"../../../geometry/support/buffer/BufferView.js";import{requestImage as b}from"../../../support/requestImageUtils.js";import{ViewingMode as R}from"../../ViewingMode.js";import{TextureUpdate as y}from"./interfaces.js";import{LayerClass as A}from"./LayerClass.js";import{OverlaySource as O}from"./Overlay.js";import{overlayRenderOccludedFlag as v}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as E}from"./PatchRenderData.js";import{RenderOrder as P}from"./RenderOrder.js";import{ScaleRangeQueries as C}from"./ScaleRangeQueries.js";import{DEFAULT_TILE_BACKGROUND as D}from"./TerrainConst.js";import"./terrainUtils.js";import{TileRenderer as q}from"./TileRenderer.js";import{TileUpdate as S}from"./TileUpdate.js";import{IteratorPreorder as I,sortTiles as N,compareTiles as w}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as L,ComponentIntersectionData as k}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as G}from"../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{OverlayMode as j}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{RenderRequestType as U}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as F}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as M}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as H,StoreResults as z}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as V}from"../webgl-engine/lib/Material.js";import{RenderPass as Q}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as W}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as Y}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as X}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Z,getVerticalOffsetTerrain as K}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as J}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as $,intersectTriangles as ee}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as te}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ie}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{ClearBufferBit as re,PrimitiveType as se}from"../../webgl/enums.js";const ne=7,ae=10,oe=m(),le=f();let de=class extends i{constructor(e){super(e),this.type=H.TERRAIN,this.isGround=!0,this.tileSize=256,this._passParameters=new B,this.rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new C,this.renderDataPool=new n(E),this._patchGroups=new Map,this.patchGroupsDirty=!0,this.tileIterator=new I,this.highestVisibleLODTile=null,this.visible=!0,this._opaque=!0,this._velvetOverground=!0,this.castShadows=!0,this._ssrEnabled=!1,this.emptyTex=null,this.tileRenderer=null,this.tileBackgroundInitialized=!1,this.tileBackgroundUpdating=!1,this.stencilEnabledLayerExtents=[],this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=V.Occlude}get isGlobal(){return this.stage.viewingMode===R.Global}initialize(){const e=[W.OPAQUE_TERRAIN,W.TRANSPARENT_TERRAIN,W.OCCLUDED_TERRAIN];this.stage.addRenderPlugin(e,this)}destroy(){this.stage.removeRenderPlugin(this),x()}get updating(){return!this.tileBackgroundInitialized||this.tileBackgroundUpdating}get canRender(){return this.visible&&!!this._rootTiles&&this.tileBackgroundInitialized&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setNeedsRender()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this._techniqueConfiguration.hasSlicePlane}get needsLinearDepth(){return this.overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this.setNeedsRender()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return Z}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setNeedsRender()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?v:V.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this.stencilEnabledLayerExtents=e,this.setNeedsRender()}setTileSize(e){this.tileSize=e,this.tileRenderer&&(this.tileRenderer.tileSize=e),this.setNeedsRender()}_prepareTileForLoading(e){e.renderData||(e.renderData=this.renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometry(e),this.updateTileTexture(e,S.TEXTURE_FADING)}queryVisibleLevelRange(e,t,i,r){this._scaleRangeQueries.queryVisibleLevelRange(e,t,i,r),this.setNeedsRender()}updateTileTexture(e,t){this.tileRenderer&&this.tileBackgroundInitialized&&(this.tileRenderer.updateTileTexture(e,t===S.TEXTURE_FADING?y.FADING:y.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){this._prepareTileForLoading(e),e.renderData.updateGeometryStateAndPrepareForGeometryGeneration(this.wireframe)}updateTileGeometry(e){for(const t of e.layerInfo[A.ELEVATION])t.pendingUpdates&=~S.GEOMETRY;e.resetPendingUpdate(S.GEOMETRY);e.renderData.updateGeometryIfChanged(this.rctx,this.wireframe)&&this.setNeedsRender()}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this.renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setNeedsRender())}_getLocalOriginOfTile(e){const t=ae-ne,i=Math.max(0,Math.floor((e.level-t)/ne)*ne);if(this.isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this.visible=e,this.setNeedsRender()}getStats(){return{numTilesRendered:this.numTilesRendered,numTilesCulled:this.numTilesCulled,numOriginsRendered:this.numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.allTiles.forAll((e=>{e.isLoaded&&(this.updateTileGeometry(e),e.updateNeighborsAfterGeometryChange())})),this.setNeedsRender())}setNeedsRender(e=U.UPDATE){this.patchGroupsDirty=!0,this._context.requestRender(e)}setTileBackground(e){this.tileBackground=e,this._updateTileBackground()}initializeRenderContext(e){this._context=e,this.rctx=e.renderContext.rctx,this._techniqueRepository=e.shaderTechniqueRepository,this._techniqueConfiguration=new ie,this.tileRenderer=new q(this.rctx,this.tileSize,this._techniqueRepository),this.tileBackground&&this._updateTileBackground(),this.emptyTex=F(this.rctx)}uninitializeRenderContext(){null!=this.emptyTex&&(this.emptyTex.dispose(),this.emptyTex=null),this.tileRenderer&&(this.tileRenderer.dispose(),this.tileRenderer=null)}intersect(e,t,i,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=ue,o=pe;d(a,n,i),h(o,1/a[0],1/a[1],1/a[2]);const u=e.results.min,p=e.results.max,g=e.results.ground,f=e.options.store===z.MIN,m=!!e.results.ground.target,b=K(e.verticalOffset),R=e.tolerance;let y,A=f&&r(u.dist)?u.dist:1/0;const O=h=>{const m=h.renderData;if(!m?.vao)return;const O=m.geometryInfo;T(oe,O.boundingBox);const v=m.localOrigin;r(b)&&(b.localOrigin=v,b.applyToAabb(oe));const x=oe;if(ge[0]=i[0]-v[0],ge[1]=i[1]-v[1],ge[2]=i[2]-v[2],!$(x,ge,o,R,A))return;const E=(e,t,i)=>{e.set(this.type,h,t,i,l),A=f&&r(u.dist)?u.dist:1/0},P=(o,l)=>{if(r(l)&&o>=0&&(e.options.backfacesTerrain||c(l,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,n,o))){if((null==g.dist||o<g.dist)&&E(g,o,l),e.options.isFiltered)return;e.options.store===z.ALL&&(s(y)?(y=M(e.ray),E(y,o,l),e.results.all.push(y)):o<y.dist&&E(y,o,l)),(null==u.dist||o<u.dist)&&E(u,o,l),e.options.store!==z.MIN&&(null==p.dist||o>p.dist)&&E(p,o,l)}},C=fe;d(C,n,v);const D=O.indices,q=O.vertexAttributes,S={data:q.getField(X.POSITION,_).typedBuffer,size:3,stride:q.stride/4},I=O.indexCount/3;if(s(b)&&I>L){const e=h.renderData;s(e.intersectionData)&&(e.intersectionData=new k(D,0,I,S)),e.intersectionData.intersectRay({r0:ge,r1:C},P)}else ee(ge,C,0,I,D,S,null,b,P)},v=this._rootTiles;if(r(v)){(()=>{const t=this.tileIterator;t.reset(v);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!r(b)&&!e.intersectsRay(i,a,R,A)||m&&this._useStencilForTile(e)?t.skipSubtree():O(e)}})()}}prepareTechnique(e){if(e.bindParameters.slot===W.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&v))return null}else{const t=this.opaque?W.OPAQUE_TERRAIN:W.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.pass){case Q.MATERIAL:{this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.ready,this._techniqueConfiguration.overlayMode=this.overlayRenderer.isEmpty()?j.Disabled:this.overlayRenderer.hasWater?j.EnabledWithWater:j.Enabled;const t=e.bindParameters.slot===W.OCCLUDED_TERRAIN?O.Occluded:O.ColorAndWater;return this._updateTechnique(G.Color,t===O.Occluded)}case Q.MATERIAL_DEPTH_SHADOWMAP_ALL:case Q.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:return this.castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(G.Shadow,!1)):null;case Q.MATERIAL_DEPTH:return this.isTransparent&&this.overlayRenderer.isEmpty()?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(G.Depth,!1));case Q.MATERIAL_NORMAL:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(G.Normal,!1);case Q.MATERIAL_HIGHLIGHT:return this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(G.Highlight,!1)):null}return null}render(e,t){const i=e.pass,r=1===e.bindParameters.lighting.globalFactor;switch(this._updatePatchGroups(),t.useStencil=!1,i){case Q.MATERIAL:{const i=e.bindParameters.slot===W.OCCLUDED_TERRAIN?O.Occluded:O.ColorAndWater;this._renderMaterialPass(e,t,i);break}case Q.MATERIAL_DEPTH_SHADOWMAP_ALL:case Q.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:this.castShadows&&r&&this._renderAuxiliaryPass(e,t,O.None);break;case Q.MATERIAL_DEPTH:this.isTransparent&&this.overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,O.None);break;case Q.MATERIAL_NORMAL:this._renderAuxiliaryPass(e,t,O.None);break;case Q.MATERIAL_HIGHLIGHT:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,O.Highlight),e.rctx.clearSafe(re.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,this._ssrEnabled=e.bindParameters.ssr.enabled,r.bindTechnique(t,this._passParameters,e.bindParameters),this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,i):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,i)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,i)}_updateTileBackground(){if(!this.tileRenderer)return;this.tileBackgroundUpdating=!0;const e=()=>{this.tileBackgroundInitialized=!0,this.tileBackgroundUpdating=!1,this._techniqueConfiguration.useGrid=this.tileRenderer.backgroundIsGrid,this._techniqueConfiguration.hasBackgroundColor=!this.tileRenderer.backgroundIsGrid&&r(this.tileRenderer.backgroundColor),this.allTiles.forAll((e=>this.tileRenderer.updateTileTexture(e,y.FADING))),this.setNeedsRender()};if("string"==typeof this.tileBackground){const t=this.tileBackground;b(t).then((i=>{t===this.tileBackground&&this.tileRenderer&&(this.tileRenderer.setBackground(i,this.tileBackground===D),e())}))}else{const i=this.tileBackground?t.toUnitRGBA(this.tileBackground):[0,0,0,0];this.tileRenderer.setBackground(i,!1),e()}}_updatePatchGroups(){if(this.patchGroupsDirty){if(this.highestVisibleLODTile=null,this._rebuildPatchGroups(),this.renderOrder!==P.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>N(this.renderOrder,e))),e.sort(((e,t)=>w(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e])))}this.patchGroupsDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(!s(e)){e[0]?.surface.checkAllTileWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this.tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i||e.visible)if(e.rendered){if(i){const r=this._patchGroups.get(i.localOrigin)||new Array;this._patchGroups.set(i.localOrigin,r),r.push(e),(!this.highestVisibleLODTile||e.vlevel>this.highestVisibleLODTile.vlevel)&&(this.highestVisibleLODTile=e),t.skipSubtree()}}else this.numTilesCulled++;else this.numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this.stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=this.stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new J(n),e.bindParameters);for(let a=0;a<s.length;a++)this._renderPatch(e,t,s[a],se.TRIANGLES,r,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const n=e.rctx,a=e.bindParameters.camera,o=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=Y(this.stage.viewingMode,this.ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY})}const l=this.stencilEnabledLayerExtents.length>0,d=i===O.Occluded;d&&(o.bindTexture("tex",this.emptyTex),o.setUniform1f("blend",1),o.setUniform4fv("texOffsetAndScale",g));const h=r(this.tileRenderer.backgroundColor)?this.tileRenderer.backgroundColor:u;this._techniqueConfiguration.hasBackgroundColor&&o.setUniform3fv("backgroundColor",h);const c=this.wireframe?se.LINES:se.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&o.bindTexture("texNext",this.emptyTex),this._patchGroups.forEach((n=>{const a=n[0].renderData.localOrigin;t.program.bindDraw(new J(a),e.bindParameters),this.numOriginsRendered++;for(let h=0;h<n.length;h++){const a=n[h],u=a.renderData.textureReference;if(!s(u)){if(!d){this._scaleRangeQueries.scaleQueriesForTile(a),ce(a.renderData.geometryInfo.uvOffsetAndScale,u.offsetAndScale,le),o.setUniform4fv("texOffsetAndScale",le),o.bindTexture("tex",u.texture.texture);const e=a.renderData.textureFadeFactor,t=e<1?a.renderData.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&r(t)&&e<1?(ce(a.renderData.geometryInfo.uvOffsetAndScale,t.offsetAndScale,le),o.setUniform1f("fadeFactor",e),o.setUniform4fv("nextTexOffsetAndScale",le),o.setUniform3fv("nextTexOpacities",t.opacities),o.bindTexture("texNext",t.texture.texture)):o.setUniform1f("fadeFactor",1),a.renderData.textureIsFading&&this.setNeedsRender(),o.setUniform3fv("textureOpacities",u.opacities)}this._renderPatch(e,t,a,c,l,i),a.renderOrder=this.numTilesRendered,this.numTilesRendered++}}})),n.bindVAO(null)}_renderPatch(e,t,i,r,n,a){const o=i.renderData,l=o.vao,d=l.indexBuffer;if(s(d))return;const h=t.program;a!==O.None&&this._bindOverlayPatchData(h,o.overlay),n&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=o.geometryInfo.indexCount;e.rctx.bindVAO(l),h.assertCompatibleVertexAttributeLocations(l),e.rctx.drawElements(r,c,d.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,e===G.Color&&(this._techniqueConfiguration.atmosphere=this.isGlobal&&this._velvetOverground,this._techniqueConfiguration.hasScreenSpaceReflections=this._ssrEnabled),this._techniqueConfiguration.renderOccluded=t,this._techniqueConfiguration.stencilEnabled=!1,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire(te,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this.tileRenderer}}};e([a()],de.prototype,"tileBackgroundInitialized",void 0),e([a()],de.prototype,"tileBackgroundUpdating",void 0),e([a({constructOnly:!0})],de.prototype,"overlayRenderer",void 0),e([a({constructOnly:!0})],de.prototype,"stage",void 0),e([a({readOnly:!0})],de.prototype,"isGlobal",null),e([a({constructOnly:!0})],de.prototype,"allTiles",void 0),e([a({constructOnly:!0})],de.prototype,"ellipsoidRadius",void 0),e([a({readOnly:!0})],de.prototype,"updating",null),e([a({value:!1})],de.prototype,"renderingDisabled",null),e([a()],de.prototype,"renderPatchBorders",null),e([a()],de.prototype,"cullBackFaces",null),e([a({value:P.FRONT_TO_BACK})],de.prototype,"renderOrder",null),e([a()],de.prototype,"wireframe",null),de=e([o("esri.views.3d.terrain.TerrainRenderer")],de);const he=de;function ce(e,t,i){i[0]=e[0]*t[2]+t[0],i[1]=e[1]*t[3]+t[1],i[2]=e[2]*t[2],i[3]=e[3]*t[3]}const ue=p(),pe=p(),ge=p(),fe=p();export{he as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{isSome as r,isNone as s}from"../../../core/maybe.js";import n from"../../../core/ObjectPool.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{I as l}from"../../../chunks/mat4f64.js";import{b as d,s as h,e as c}from"../../../chunks/vec3.js";import{Z as u,c as p}from"../../../chunks/vec3f64.js";import{Z as g,c as f}from"../../../chunks/vec4f64.js";import{create as m,set as T}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as _}from"../../../geometry/support/buffer/BufferView.js";import{requestImage as R}from"../../../support/requestImageUtils.js";import{ViewingMode as b}from"../../ViewingMode.js";import{TextureUpdate as y}from"./interfaces.js";import{LayerClass as A}from"./LayerClass.js";import{OverlaySource as O}from"./Overlay.js";import{overlayRenderOccludedFlag as v}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as C}from"./RenderOrder.js";import{ScaleRangeQueries as E}from"./ScaleRangeQueries.js";import{DEFAULT_TILE_BACKGROUND as D}from"./TerrainConst.js";import"./terrainUtils.js";import{TileRenderer as q}from"./TileRenderer.js";import{TileUpdate as S}from"./TileUpdate.js";import{IteratorPreorder as I,sortTiles as N,compareTiles as w}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as L,ComponentIntersectionData as G}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as j}from"../webgl-engine/core/shaderLibrary/ShaderOutputOptions.js";import{OverlayMode as k}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as U}from"../../../chunks/Terrain.glsl.js";import{RenderRequestType as B}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as F}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as M}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as H,StoreResults as z}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as V}from"../webgl-engine/lib/Material.js";import{RenderPass as Q}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as W}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as Y}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as X}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Z,getVerticalOffsetTerrain as K}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as J}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as $,intersectTriangles as ee}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as te}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ie}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{ClearBufferBit as re,PrimitiveType as se}from"../../webgl/enums.js";const ne=7,ae=10,oe=m(),le=f();let de=class extends i{constructor(e){super(e),this.type=H.TERRAIN,this.isGround=!0,this.tileSize=256,this._passParameters=new U,this.rctx=null,this._isTransparent=!1,this._scaleRangeQueries=new E,this.renderDataPool=new n(P),this._patchGroups=new Map,this.patchGroupsDirty=!0,this.tileIterator=new I,this.highestVisibleLODTile=null,this.visible=!0,this._opaque=!0,this._velvetOverground=!0,this.castShadows=!0,this.emptyTex=null,this.tileRenderer=null,this.tileBackgroundInitialized=!1,this.tileBackgroundUpdating=!1,this.stencilEnabledLayerExtents=[],this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=V.Occlude,this._lastBackgroundColorRequest=null}get isGlobal(){return this.stage.viewingMode===b.Global}initialize(){const e=[W.OPAQUE_TERRAIN,W.TRANSPARENT_TERRAIN,W.OCCLUDED_TERRAIN];this.stage.addRenderPlugin(e,this)}destroy(){this.stage.removeRenderPlugin(this),x()}get updating(){return!this.tileBackgroundInitialized||this.tileBackgroundUpdating}get canRender(){return this.visible&&!!this._rootTiles&&this.tileBackgroundInitialized&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setNeedsRender()}set opaque(e){this._opaque!==e&&(this._opaque=e,this.setNeedsRender())}get opaque(){return this._opaque&&!this._techniqueConfiguration.hasSlicePlane}get needsLinearDepth(){return this.overlayRenderer.hasWater}set isTransparent(e){this._isTransparent!==e&&(this._isTransparent=e,this.setNeedsRender())}get isTransparent(){return this._isTransparent}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this.setNeedsRender()}set velvetOverground(e){this._velvetOverground!==e&&(this._velvetOverground=e,this.setNeedsRender())}get layerUid(){return Z}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setNeedsRender()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?v:V.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this.stencilEnabledLayerExtents=e,this.setNeedsRender()}setTileSize(e){this.tileSize=e,this.tileRenderer&&(this.tileRenderer.tileSize=e),this.setNeedsRender()}_prepareTileForLoading(e){e.renderData||(e.renderData=this.renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometry(e),this.updateTileTexture(e,S.TEXTURE_FADING)}queryVisibleLevelRange(e,t,i,r){this._scaleRangeQueries.queryVisibleLevelRange(e,t,i,r),this.setNeedsRender()}updateTileTexture(e,t){this.tileRenderer&&this.tileBackgroundInitialized&&(this.tileRenderer.updateTileTexture(e,t===S.TEXTURE_FADING?y.FADING:y.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){this._prepareTileForLoading(e),e.renderData.updateGeometryStateAndPrepareForGeometryGeneration(this.wireframe)}updateTileGeometry(e){for(const t of e.layerInfo[A.ELEVATION])t.pendingUpdates&=~S.GEOMETRY;e.resetPendingUpdate(S.GEOMETRY);e.renderData.updateGeometryIfChanged(this.rctx,this.wireframe)&&this.setNeedsRender()}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this.renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setNeedsRender())}_getLocalOriginOfTile(e){const t=ae-ne,i=Math.max(0,Math.floor((e.level-t)/ne)*ne);if(this.isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this.visible=e,this.setNeedsRender()}getStats(){return{numTilesRendered:this.numTilesRendered,numTilesCulled:this.numTilesCulled,numOriginsRendered:this.numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.allTiles.forAll((e=>{e.isLoaded&&(this.updateTileGeometry(e),e.updateNeighborsAfterGeometryChange())})),this.setNeedsRender())}setNeedsRender(e=B.UPDATE){this.patchGroupsDirty=!0,this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this.rctx=e.renderContext.rctx,this._techniqueRepository=e.shaderTechniqueRepository,this._techniqueConfiguration=new ie,this.tileRenderer=new q(this.rctx,this.tileSize,this._techniqueRepository),this.updateTileBackground(),this.emptyTex=F(this.rctx)}uninitializeRenderContext(){null!=this.emptyTex&&(this.emptyTex.dispose(),this.emptyTex=null),this.tileRenderer&&(this.tileRenderer.dispose(),this.tileRenderer=null)}intersect(e,t,i,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&!this._opaque)return;const a=ue,o=pe;d(a,n,i),h(o,1/a[0],1/a[1],1/a[2]);const u=e.results.min,p=e.results.max,g=e.results.ground,f=e.options.store===z.MIN,m=!!e.results.ground.target,R=K(e.verticalOffset),b=e.tolerance;let y,A=f&&r(u.dist)?u.dist:1/0;const O=h=>{const m=h.renderData;if(!m?.vao)return;const O=m.geometryInfo;T(oe,O.boundingBox);const v=m.localOrigin;r(R)&&(R.localOrigin=v,R.applyToAabb(oe));const x=oe;if(ge[0]=i[0]-v[0],ge[1]=i[1]-v[1],ge[2]=i[2]-v[2],!$(x,ge,o,b,A))return;const P=(e,t,i)=>{e.set(this.type,h,t,i,l),A=f&&r(u.dist)?u.dist:1/0},C=(o,l)=>{if(r(l)&&o>=0&&(e.options.backfacesTerrain||c(l,a)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,n,o))){if((null==g.dist||o<g.dist)&&P(g,o,l),e.options.isFiltered)return;e.options.store===z.ALL&&(s(y)?(y=M(e.ray),P(y,o,l),e.results.all.push(y)):o<y.dist&&P(y,o,l)),(null==u.dist||o<u.dist)&&P(u,o,l),e.options.store!==z.MIN&&(null==p.dist||o>p.dist)&&P(p,o,l)}},E=fe;d(E,n,v);const D=O.indices,q=O.vertexAttributes,S={data:q.getField(X.POSITION,_).typedBuffer,size:3,stride:q.stride/4},I=O.indexCount/3;if(s(R)&&I>L){const e=h.renderData;s(e.intersectionData)&&(e.intersectionData=new G(D,0,I,S)),e.intersectionData.intersectRay({r0:ge,r1:E},C)}else ee(ge,E,0,I,D,S,null,R,C)},v=this._rootTiles;if(r(v)){(()=>{const t=this.tileIterator;t.reset(v);const s=e.options.invisibleTerrain;for(;!t.done;){const e=t.next();!(e.visible||s&&e.intersectsClippingArea)||!r(R)&&!e.intersectsRay(i,a,b,A)||m&&this._useStencilForTile(e)?t.skipSubtree():O(e)}})()}}prepareTechnique(e){if(e.bindParameters.slot===W.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&v))return null}else{const t=this.opaque?W.OPAQUE_TERRAIN:W.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.pass){case Q.MATERIAL:{this._techniqueConfiguration.hasScreenSpaceReflections=e.bindParameters.ssr.enabled,this._techniqueConfiguration.hasCloudsReflections=r(e.bindParameters.cloudsComposition.clouds),this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.ready,this._techniqueConfiguration.overlayMode=this.overlayRenderer.isEmpty()?k.Disabled:this.overlayRenderer.hasWater?k.EnabledWithWater:k.Enabled;const t=e.bindParameters.slot===W.OCCLUDED_TERRAIN?O.Occluded:O.ColorAndWater;return this._updateTechnique(j.Color,t===O.Occluded)}case Q.MATERIAL_DEPTH_SHADOWMAP_ALL:case Q.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:return this.castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Shadow,!1)):null;case Q.MATERIAL_DEPTH:return this.isTransparent&&this.overlayRenderer.isEmpty()?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Depth,!1));case Q.MATERIAL_NORMAL:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Normal,!1);case Q.MATERIAL_HIGHLIGHT:return this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Highlight,!1)):null}return null}render(e,t){const i=e.pass,r=1===e.bindParameters.lighting.globalFactor;switch(this._updatePatchGroups(),t.useStencil=!1,i){case Q.MATERIAL:{const i=e.bindParameters.slot===W.OCCLUDED_TERRAIN?O.Occluded:O.ColorAndWater;this._renderMaterialPass(e,t,i);break}case Q.MATERIAL_DEPTH_SHADOWMAP_ALL:case Q.MATERIAL_DEPTH_SHADOWMAP_DEFAULT:this.castShadows&&r&&this._renderAuxiliaryPass(e,t,O.None);break;case Q.MATERIAL_DEPTH:this.isTransparent&&this.overlayRenderer.isEmpty()||this._renderAuxiliaryPass(e,t,O.None);break;case Q.MATERIAL_NORMAL:this._renderAuxiliaryPass(e,t,O.None);break;case Q.MATERIAL_HIGHLIGHT:this.needsHighlight&&(this._renderAuxiliaryPass(e,t,O.Highlight),e.rctx.clearSafe(re.DEPTH_BUFFER_BIT))}this._scaleRangeQueries.hasPendingQueries()&&this.setNeedsRender()}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this.numTilesRendered=0,this.numTilesCulled=0,this.numOriginsRendered=0,this._scaleRangeQueries.prepareQueries(),this.opaque?this._renderPatchGroups(e,t,i):e.offscreenRenderingHelper.renderToTargets((()=>this._renderPatchGroups(e,t,i)),e.offscreenRenderingHelper.tmpColor,e.offscreenRenderingHelper.mainDepth,[0,0,0,0]),this._scaleRangeQueries.processQueries()}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,i)}updateTileBackground(e=null){if(!this.tileRenderer)return;this.tileBackgroundUpdating=!0;const i=()=>{this.tileBackgroundInitialized=!0,this.tileBackgroundUpdating=!1,this._techniqueConfiguration.useGrid=this.tileRenderer.backgroundIsGrid,this._techniqueConfiguration.hasBackgroundColor=!this.tileRenderer.backgroundIsGrid&&r(this.tileRenderer.backgroundColor),this.allTiles.forAll((e=>this.tileRenderer.updateTileTexture(e,y.FADING))),this.setNeedsRender()};if(this._lastBackgroundColorRequest=e,r(e)){const r=t.toUnitRGBA(e);this.tileRenderer.setBackground(r,!1),i()}else R(D).then((e=>{s(this._lastBackgroundColorRequest)&&this.tileRenderer&&(this.tileRenderer.setBackground(e,!0),i())}))}_updatePatchGroups(){if(this.patchGroupsDirty){if(this.highestVisibleLODTile=null,this._rebuildPatchGroups(),this.renderOrder!==C.NONE){const e=Array.from(this._patchGroups.values());e.forEach((e=>N(this.renderOrder,e))),e.sort(((e,t)=>w(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e])))}this.patchGroupsDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(!s(e)){e[0]?.surface.checkAllTileWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this.tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i||e.visible)if(e.rendered){if(i){const r=this._patchGroups.get(i.localOrigin)||new Array;this._patchGroups.set(i.localOrigin,r),r.push(e),(!this.highestVisibleLODTile||e.vlevel>this.highestVisibleLODTile.vlevel)&&(this.highestVisibleLODTile=e),t.skipSubtree()}}else this.numTilesCulled++;else this.numTilesCulled++,t.skipSubtree()}}_useStencilForTile(e){for(const t of this.stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=this.stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new J(n),e.bindParameters);for(let a=0;a<s.length;a++)this._renderPatch(e,t,s[a],se.TRIANGLES,r,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const n=e.rctx,a=e.bindParameters.camera,o=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=Y(this.stage.viewingMode,this.ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:a.fovY})}const l=this.stencilEnabledLayerExtents.length>0,d=i===O.Occluded;d&&(o.bindTexture("tex",this.emptyTex),o.setUniform1f("blend",1),o.setUniform4fv("texOffsetAndScale",g));const h=r(this.tileRenderer.backgroundColor)?this.tileRenderer.backgroundColor:u;this._techniqueConfiguration.hasBackgroundColor&&o.setUniform3fv("backgroundColor",h);const c=this.wireframe?se.LINES:se.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&o.bindTexture("texNext",this.emptyTex),this._patchGroups.forEach((n=>{const a=n[0].renderData.localOrigin;t.program.bindDraw(new J(a),e.bindParameters),this.numOriginsRendered++;for(let h=0;h<n.length;h++){const a=n[h],u=a.renderData.textureReference;if(!s(u)){if(!d){this._scaleRangeQueries.scaleQueriesForTile(a),ce(a.renderData.geometryInfo.uvOffsetAndScale,u.offsetAndScale,le),o.setUniform4fv("texOffsetAndScale",le),o.bindTexture("tex",u.texture.texture);const e=a.renderData.textureFadeFactor,t=e<1?a.renderData.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&r(t)&&e<1?(ce(a.renderData.geometryInfo.uvOffsetAndScale,t.offsetAndScale,le),o.setUniform1f("fadeFactor",e),o.setUniform4fv("nextTexOffsetAndScale",le),o.setUniform3fv("nextTexOpacities",t.opacities),o.bindTexture("texNext",t.texture.texture)):o.setUniform1f("fadeFactor",1),a.renderData.textureIsFading&&this.setNeedsRender(),o.setUniform3fv("textureOpacities",u.opacities)}this._renderPatch(e,t,a,c,l,i),a.renderOrder=this.numTilesRendered,this.numTilesRendered++}}})),n.bindVAO(null)}_renderPatch(e,t,i,r,n,a){const o=i.renderData,l=o.vao,d=l.indexBuffer;if(s(d))return;const h=t.program;a!==O.None&&this._bindOverlayPatchData(h,o.overlay),n&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=o.geometryInfo.indexCount;e.rctx.bindVAO(l),h.assertCompatibleVertexAttributeLocations(l),e.rctx.drawElements(r,c,d.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,e===j.Color&&(this._techniqueConfiguration.atmosphere=this.isGlobal&&this._velvetOverground),this._techniqueConfiguration.renderOccluded=t,this._techniqueConfiguration.stencilEnabled=!1,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire(te,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this.tileRenderer}}};e([a()],de.prototype,"tileBackgroundInitialized",void 0),e([a()],de.prototype,"tileBackgroundUpdating",void 0),e([a({constructOnly:!0})],de.prototype,"overlayRenderer",void 0),e([a({constructOnly:!0})],de.prototype,"stage",void 0),e([a({readOnly:!0})],de.prototype,"isGlobal",null),e([a({constructOnly:!0})],de.prototype,"allTiles",void 0),e([a({constructOnly:!0})],de.prototype,"ellipsoidRadius",void 0),e([a({readOnly:!0})],de.prototype,"updating",null),e([a({value:!1})],de.prototype,"renderingDisabled",null),e([a()],de.prototype,"renderPatchBorders",null),e([a()],de.prototype,"cullBackFaces",null),e([a({value:C.FRONT_TO_BACK})],de.prototype,"renderOrder",null),e([a()],de.prototype,"wireframe",null),de=e([o("esri.views.3d.terrain.TerrainRenderer")],de);const he=de;function ce(e,t,i){i[0]=e[0]*t[2]+t[0],i[1]=e[1]*t[3]+t[1],i[2]=e[2]*t[2],i[3]=e[3]*t[3]}const ue=p(),pe=p(),ge=p(),fe=p();export{he as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as p,isSome as u}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as g,isAborted as m,createAbortError as f}from"../../../core/promiseUtils.js";import{watch as T,syncAndInitial as y,sync as v,initial as w}from"../../../core/reactiveUtils.js";import{aliasOf as S}from"../../../core/accessorSupport/decorators/aliasOf.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{property as L}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{m as E}from"../../../chunks/mat4.js";import{c as x}from"../../../chunks/mat4f64.js";import{c as D}from"../../../chunks/vec3.js";import{c as U}from"../../../chunks/vec3f64.js";import{c as P}from"../../../chunks/vec4f64.js";import{WatchUpdatingTracking as R}from"../../../core/support/WatchUpdatingTracking.js";import{projectVectorToVector as C,projectPointToVector as j}from"../../../geometry/projection.js";import{getReferenceEllipsoid as M}from"../../../geometry/projectionEllipsoid.js";import{create as A,equals as I,intersection as V,empty as k,expand as O,intersectsSphere as N}from"../../../geometry/support/aaBoundingRect.js";import{create as q,copy as B}from"../../../geometry/support/frustum.js";import{isPlateCarree as G}from"../../../geometry/support/spatialReferenceUtils.js";import{isRefreshableLayer as W}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as H}from"../../../layers/support/layerUtils.js";import{acquireDecoder as Q}from"../../../layers/support/LercDecoder.js";import{printAllocations as X}from"../../2d/engine/vectorTiles/VectorTile.js";import{directionToHeadingTilt as z,scaleToZoom as Y}from"../support/cameraUtils.js";import $ from"../support/debugFlags.js";import{toBoundingRect as K}from"../support/extentUtils.js";import{ClientType as J}from"../support/index.js";import{updatingProgress as Z}from"../support/updatingProperties.js";import{ElevationBounds as ee}from"./ElevationBounds.js";import{sampleElevation as te,ElevationData as ie}from"./ElevationData.js";import{create as re}from"./ExtentHelper.js";import{LODSnapping as se,TextureUpdate as ae}from"./interfaces.js";import{LayerClass as ne,LayerClasses as le}from"./LayerClass.js";import{OverlayManager as oe}from"./OverlayManager.js";import{PlanarPatch as he}from"./PlanarPatch.js";import{RenderOrder as de}from"./RenderOrder.js";import{SphericalPatch as pe}from"./SphericalPatch.js";import{DEFAULT_TILE_BACKGROUND as ue,MAX_ROOT_TILES as ce,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as _e,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as ge,MAX_MEMORY_LOD_BIAS as me,ELEVATION_NODATA_VALUE as fe}from"./TerrainConst.js";import Te from"./TerrainRenderer.js";import ye from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as ve,internalAssert as we,isSurfaceLayerView as Se,isMapTileLayerView as Le,isElevationLayerView as be,isBlendableLayerView as Ee,isVectorTileLayerView as xe,useFetchTileForLayer as De,isImageryTileLayerView as Ue,isTileLayerView as Pe,releaseTileData as Re,ENABLE_WATERPROOFNESS_TESTS as Ce}from"./terrainUtils.js";import{SplitLimits as je,Tile as Me}from"./Tile.js";import{printAllocations as Ae}from"./TilePerLayerInfo.js";import{TileUpdate as Ie}from"./TileUpdate.js";import{IteratorPreorder as Ve,IteratorPostorder as ke,hasLoadableSiblings as Oe,sortTilesByPOI as Ne,sortTiles as qe}from"./tileUtils.js";import{TilingSchemeLogic as Be}from"./TilingSchemeLogic.js";import{UpsampleInfo as Ge}from"./UpsampleInfo.js";import{RenderRequestType as We}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as Fe,TaskPriority as He,noBudget as Qe}from"../../support/Scheduler.js";const Xe=l.getLogger("esri.views.3d.terrain.TerrainSurface"),ze=.25;let Ye=class extends(a.EventedMixin(i)){constructor(e){super(e),this._elevationBounds=new ee,this._iteratorPool=new c(Ve,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new ke,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visible=!1,this._usedMemory=et,this._performanceInfo=new ye,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=U(),this._eyePosSurfaceSR=U(),this._splitLimits=new je,this._snapLevel=1/0,this._frustum=q(),this._viewProjectionMatrix=x(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new R,this._frameTask=Fe,this._allTiles=new _,this._upsampleInfoPool=new c(Ge),this.isWebMercator=!1,this.isWebMercatorOnPlateeCarree=!1,this._rootTilesExtent=A(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.backgroundImage=ue,this.backgroundColor=null,this._updatingRootTiles=!1,this.deferTileNeighborUpdate=!1,this.neighborTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this._isGlobal=!e.view?.state?.isLocal}initialize(){this._lercDecoder=Q(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(he):new c(pe);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new F(e.newCache("elevation-query")),this._set("overlayManager",new oe({surface:this})),this._handles.add([T((()=>this.overlayManager.hasHighlights),(e=>this._renderer.setNeedsHighlight(e))),T((()=>this.overlayManager.rendersOccluded),(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new Te({overlayRenderer:this.overlayManager.renderer,ellipsoidRadius:M(this.view.spatialReference).radius,stage:this.view._stage,allTiles:this._allTiles}),this._handles.add([T((()=>this.baseOpacity),(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),y),T((()=>this.renderingDisabled),(()=>this._updateTransparentTerrain()),v),T((()=>this._background),(()=>{this._handleLayerViewChanges(),this._renderer.setTileBackground(this._background)}),y),T((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),T((()=>$.TERRAIN_TILE_TREE_SHOW_TILES),(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&$.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}),w)]),this._extentHelper=re(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>this.view?.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new Be({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(J.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(J.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(He.TERRAIN_SURFACE,this),this._handles.add([T((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),w),T((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),v),T((()=>this.extent),(()=>this._updateRootTiles()),w),this.view.on("resize",(()=>this._viewChangeUpdate())),T((()=>{const e=this.view,t=e.state;return[this.lodBias,this.lodSnapping,e.resourceController?.memoryController?.memoryFactor,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),y),T((()=>this.view.qualitySettings?.tiledSurface?.textureFadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),w),T((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),v)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),Me.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),X(),Ae()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){const e=this.view.pointsOfInterest?.contentCameraOnSurface?.scale;if(e){const t=this.view.state.contentCamera;let i=z(this.view,t.eye,t.viewForward,t.up).tilt;i>90&&(i=180-i);const r=2*(i/90)**2,s=Y(this.view,e)-r;Math.abs(this._snapLevel-s)>ze&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?se.ON:se.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(p(t)||p(e))return null;const i=A(),r=K(t,i,e)?i:null,s=this._get("extent");return I(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=V(this.groundExtent,this._userClippingExtent,A()),t=this._get("extent");return I(e,t)?t:e}get groundExtent(){return u(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._renderer.updating||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get viewingMode(){return this.view.state.viewingMode}get ready(){return u(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get spatialReference(){return this.tilingScheme?.spatialReference??null}get _background(){return null!=this.backgroundColor?this.backgroundColor:this.backgroundImage}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._updateTransparentTerrain()}_updateTransparentTerrain(){const e=!this.renderingDisabled&&!this.opaque;this.view?._stage?.renderView.setRenderParameters({transparentTerrain:e})}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}set visible(e){e!==this._visible&&(this._visible=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,tt);return p(s)?null:te(tt[0],tt[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=tt){const a=this.rootTiles;if(p(a)||!a.length)return null;if(0===a[0].layerInfo[ne.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!C(s,r,s,this.tilingScheme?.spatialReference))return Xe.error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let n of a){if(!n.containsPoint(s))continue;for(;n&&!n.rendered&&!n.isLeaf;){let e=0;s[0]>.5*(n.extent[0]+n.extent[2])&&(e+=1),s[1]<.5*(n.extent[1]+n.extent[3])&&(e+=2),n=n.children[e]}const e=n.renderData;return(e?e.geometryState.samplerData:null)?n:null}return null}get elevationBounds(){return this._elevationBounds}getScale(e){if(this.tilingScheme){if(!j(e,tt,this.spatialReference))return Xe.error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(u(t))for(let e of t)if(e.containsPoint(tt)){for(;null!=e.children[0];){let t=0;tt[0]>e.children[0].extent[2]&&(t+=1),tt[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!j(e,tt,this.spatialReference))return Xe.error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;tt[3]=t;let i=null;const r=e=>{if(e&&N(e.extent,tt))if(null!=e.children[0])for(const t of e.children)r(t);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}},s=this.rootTiles;if(u(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this.lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1,this._renderer.isTransparent=this._allSurfaceLayersTransparent();const i=t!==this._renderer.opaque;i&&this._updateTransparentTerrain(),this._updateTileTextures(i?ae.UNFADED:ae.IMMEDIATE)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;ve(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this.isWebMercator=this.tilingScheme?.spatialReference.isWebMercator;const t=this.view?.renderSpatialReference,i=u(t)&&G(t);this.isWebMercatorOnPlateeCarree=this.isWebMercator&&i,this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles())}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return rt[0]=e,rt[1]=t,rt[2]=i,s.init(rt,r,this),s}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=it;let s=t.rootTilesInExtent(e,i,5*ce);if(u(this.rootTiles)){if(s.length>ce)return void Xe.warn(_e);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,Ke);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>Ke(t,e.lij)))>-1)||(this._purgeTile(e,!0),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>ce&&(Xe.warn(ge),s=t.rootTilesInExtent(e,i,ce)),this._setRootTiles(s.map((e=>this._newRootTile(e))));I(i,this._rootTilesExtent)||(this._rootTilesExtent=A(i)),this.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._allTiles.forEach((e=>{e.isLoaded&&this._prepareToLoadTile(e)})),this._allTiles.forAll((e=>{e.isLoaded&&(this._updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e))})),this._updatingRootTiles=!1,this.checkAllTileWaterproofness()}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ie.SPLIT&&t.setPendingUpdate(Ie.SPLIT),this._loadTile(t),t.checkGeometryWaterproofness(),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),u(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Ie.GEOMETRY)&&this._updateTileGeometry(e)}_updateTilesVisibility(e){if(p(e))return;const t=Oe(e);let i=t?this._elevationBounds.min:1/0,r=t?this._elevationBounds.max:-1/0;const s=this.extent,a=this._viewProjectionMatrix;this.setTileTreeDirty();const n=this._iteratorPool.acquire();for(n.reset(e);!n.done;){const e=n.next();e.updateClippingStatus(s)&&e.resetPendingUpdate(Ie.GEOMETRY)&&this._updateTileGeometry(e),e.setPendingUpdate(Ie.RENDERDATA),e.computeVisibility(),e.updateScreenDepth(a),e.renderData&&(i=Math.min(e.elevationBounds[0],i),r=Math.max(e.elevationBounds[1],r))}n.remove(),this._viewChanged=!0,this._allTilesDirty=!0,isFinite(i)&&isFinite(r)&&(this._elevationBounds.min===i&&this._elevationBounds.max===r||(this._elevationBounds.min=i,this._elevationBounds.max=r,this.emit("elevation-bounds-change",null)))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this.lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(p(this._splitLimits.frustum)&&(this._splitLimits.frustum=q()),B(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,B(this._frustum,e.frustum),E(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),D(this._eyePosRenderSR,t.eye),C(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(Je(e)?(this._loadChildren(e),this._checkTileNeighborsWaterproofness(e),e.children.forEach((e=>e.checkGeometryWaterproofness()))):Ze(e)&&this._loadParent(e))}_updateTileGeometry(e){e.updateVisibility(),this._renderer.updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e),this._elevationUpdate(e),this._usedMemory=et,this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e)}_updateTileNeighborsAfterGeometryChange(e,t){if(this.deferTileNeighborUpdate){const t=this.neighborTilesToUpdate;e.forEachLoadedNeighbor((e=>{t.add(e)}))}else e.updateNeighborsAfterGeometryChange(t)}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Ie.TEXTURE_FADING)?Ie.TEXTURE_FADING:!!e.resetPendingUpdate(Ie.TEXTURE_NOFADING)&&Ie.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=et,t.madeProgress())}_elevationUpdate(e){at.spatialReference=this.spatialReference,at.tile=e,at.extent=e.extent,this.emit("elevation-change",at)}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateTileStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done&&this.requestUpdate(),this.notifyChange("updatingProgressValue")}_updateTileStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next(),i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i!==Ie.SPLIT){if(e.resetPendingUpdate(Ie.SPLIT)&&e.updateAgentSuspension(),i===Ie.VSPLITMERGE&&e.updateAgents(ne.ELEVATION),t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(Ie.MERGE),e.resetPendingUpdate(Ie.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}else e.resetPendingUpdate(Ie.MERGE),e.isLeaf&&(e.setPendingUpdate(Ie.SPLIT),t.skipSubtree())}t.remove(),this.requestUpdate(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Ne(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_prepareBatchTileGeometryUpdate(){we(0===this.neighborTilesToUpdate.size),this.deferTileNeighborUpdate=!0}_batchUpdateUpdatedTileNeighbors(){this.deferTileNeighborUpdate=!1;const e=this.neighborTilesToUpdate;(()=>{const t=()=>{for(const t of e)t.updateNeighborsWithChangedEdgeResolution()};(()=>{for(const t of e)t.updateNeighborDataAndGeometryIfNeeded()})(),t(),e.clear()})()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=0;this._prepareBatchTileGeometryUpdate();let r=!1;for(;!e.done;){let s=!1;i=0;const a=!this._allTiles.some((a=>{if(r)i+=a.usedMemory;else if(!a.loadable)return e.done;if(a.resetPendingUpdate(Ie.MERGE)){if(!t)return a.setPendingUpdate(Ie.MERGE),e.done;this._mergeTile(a),s=!0,e.madeProgress()}else a.resetPendingUpdate(Ie.SPLIT)&&(this._splitTile(a),s=!0,e.madeProgress());return!e.done&&a.resetPendingUpdate(Ie.RENDERDATA)&&(this._updateRenderData(a),e.madeProgress()),e.done}));if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),a){if(!r){r=!0;continue}if(this._usedMemory=i,!s)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}0===i&&(this._allTilesDirty=!0),this._batchUpdateUpdatedTileNeighbors(),this._sortTiles(e)}_updateElevation(e){return this._prepareBatchTileGeometryUpdate(),this._allTiles.some((t=>(t.resetPendingUpdate(Ie.GEOMETRY)&&(this._updateTileGeometry(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),this._batchUpdateUpdatedTileNeighbors(),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(We.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*me}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this.lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){u(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e,!1))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.visible=!1}_purgeDescendantTiles(e){if(e.isLeaf)return!1;let t=!1;for(let i=0;i<4;++i)t=this._purgeTile(e.children[i],!1)||t;return e.unsetChildren(),t}_purgeTile(e,t){const i=this._purgeDescendantTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),this._unloadTile(e),t&&this._updateTileNeighborsAfterGeometryChange(e),this._tilePool.release(e),i}_unloadTile(e){this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e),e.unload(this._renderer)}_splitTile(e){ve(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(Ie.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,this._emitTileScaleChange(e,t),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){nt.spatialReference=this.spatialReference,nt.extent=e.extent,nt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",nt)}_createTile(e,t,i,r){ve(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ie.SPLIT&&s.setPendingUpdate(Ie.SPLIT),s}_mergeTile(e){ve(!e.hasPendingUpdate(Ie.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(e)&&(ve(!e.renderData,"_mergeTile sanity check"),this._loadTile(e),this._updateTileNeighborsAfterGeometryChange(e),this._checkTileAndNeighborsWaterproofness(e)),this._allTilesDirty=!0,++this._performanceInfo.numMerged,this._emitTileScaleChange(e)}_checkTileAndNeighborsWaterproofness(e){e.checkGeometryWaterproofness(),this._checkTileNeighborsWaterproofness(e)}_checkTileNeighborsWaterproofness(e){Ce&&e.forallNeighbors((e=>!!e.isLoaded&&(e.checkGeometryWaterproofness(),!0)))}_loadChildren(e){this._checkTileAndNeighborsWaterproofness(e),ve(e.rendered,"parent should be rendered"),this._unloadTile(e);const t=e.children;t.forEach((e=>this._prepareToLoadTile(e))),t.forEach((e=>this._loadTilePrepared(e))),this._updateTileNeighborsAfterGeometryChange(e,e.level+1),this.deferTileNeighborUpdate||t.forEach((e=>e.updateNeighborsWithChangedEdgeResolution())),t.forEach((e=>e.checkGeometryWaterproofness())),this._checkTileNeighborsWaterproofness(e)}_loadParent(e){this._checkTileAndNeighborsWaterproofness(e);const t=e.parent;this._unloadChildren(t),this._loadTile(t),this._updateTileNeighborsAfterGeometryChange(t),this._checkTileAndNeighborsWaterproofness(t)}_unloadChildren(e){if(!e.isLeaf)for(let t=0;t<4;++t){const i=e.children[t];this._unloadChildren(i),this._unloadTile(i)}}_postLoadTile(e){e.setPendingUpdate(Ie.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e),this._elevationUpdate(e)}_loadTile(e){e.load(this._renderer),this._postLoadTile(e)}_loadTilePrepared(e){e.loadPrepared(this._renderer),this._postLoadTile(e)}_prepareToLoadTile(e){e.prepareToLoad(this._renderer)}_elevationDataArrived(e,t,i){const r=new ie(e.lij,e.extent,i);e.dataArrived(t,ne.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=Qe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),Se(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._layerIndexByUid[e].get(s.uid);i<r&&(t=!0),r=i}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allSurfaceLayersTransparent(),e.madeProgress()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(Le(t)&&!H(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_layerClassFromLayerView(e){return be(e)?ne.ELEVATION:ne.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(T((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(T((()=>e.fullOpacity),(()=>this._updateTileTextures(ae.UNFADED)))),t.push(T((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),Ee(e)&&t.push(T((()=>e.layer.blendMode),(()=>this._updateTileTextures(ae.UNFADED)))),e.on("data-changed",(()=>{const t=this._layerIndexByUid[i].get(e.uid);null!=t&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;const r=k();e.forEach((e=>{const s=e.layer;if(!s||e.suspended||!Se(e))return;const a=e.fullExtent;if(!a)return void Xe.warn("Terrain: Map or elevation layer does not have fullExtent: "+s.id);O(r,a,r);const n=this._layerClassFromLayerView(e);if(n===ne.MAP){const t=e.displayLevelRange;t.maxLevel!==1/0&&(null===i||t.maxLevel>i)&&(i=t.maxLevel)}t[n].push(e)}));for(const s of le){const e=this._layerViews[s],i=t[s];i.reverse();const r=i.length;let a=e.length!==r;const n=new Array(r),l=new Array(e.length);this._layerIndexByUid[s].clear();for(let t=0;t<r;t++){const r=i[t].uid;this._layerIndexByUid[s].set(r,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(l,n,s);this._layerViews[s]=i,this._restartAllAgents(s),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ne.ELEVATION&&i.computeElevationBounds()}}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ne.MAP),e===ae.IMMEDIATE?this.renderer.updateTileTexture(t,Ie.TEXTURE_NOFADING):t.updateRenderData(ne.MAP,e)})),this._renderer.isTransparent=this._allSurfaceLayersTransparent()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=We.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||xe(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,g(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===ne.ELEVATION?be(i)?this._requestElevationTileData(e,i,r):Promise.reject():Le(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{if(m(i))return;const s=this._layerIndexByUid[ne.ELEVATION].get(t.uid);null!=s?(this._usedMemory=et,this.requestUpdate(),this._elevationDataArrived(e,s,r)):Xe.warn("TerrainSurface: received data from unknown layer %d %s",ne.ELEVATION,e.lij.toString())},s=i=>{g(i)||(this._dataMissing(e,ne.ELEVATION,t,i),this.requestUpdate())};if(De(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:fe,signal:i.signal}).then((e=>{if(!m(i))return this._frameTask.schedule((()=>r(e)),i.signal,s);Xe.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")}),s).finally((()=>{--this._asyncWorkItems}));const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:fe},i.signal))).then((e=>{e?r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue}):s(new Error("LERC decoding failed"))}),s).finally((()=>{--this._asyncWorkItems}))}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Re(s),m(i)||(this._dataMissing(e,ne.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),m(i)?Re(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(xe(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(Ue(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(Pe(t)&&De(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(m(i))return Xe.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(f());a(e)}),n);let l=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);W(t.layer)&&t.layer.refreshTimestamp&&(l+=`${l.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const o=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(l,o,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._layerIndexByUid[ne.MAP].get(t.uid);null!=r?e.dataArrived(r,ne.MAP,i):(Re(i),Xe.warn("TerrainSurface: received data from unknown layer"))}_dataMissing(e,t,i,r){const s=this._layerIndexByUid[t].get(i.uid);null!=s?e.dataMissing(s,t,r):Xe.warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(this._usedMemory===et&&(this._usedMemory=0,this._allTiles.forAll((e=>this._usedMemory+=e.usedMemory))),this._usedMemory):0}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._layerIndexByUid[i].get(e.uid);return this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(p(e)||p(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return ve(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{u(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){st.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&st.push(e)}));const t=st.toArray();return qe(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}checkAllTileWaterproofness(){if(!Ce)return;const e=this.rootTiles;if(p(e))return;const t=e=>e?.renderData?.geometryInfo?.indices?.length>0??!1,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometryInfo&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometryInfo||(e.renderData.geometryInfo.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometryInfo),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.isLeaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.isLeaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}isEastEndWrap(e){return this.isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this.isGlobal&&0===e[2]}lijEastEnd(e){return 2**(e+(this.spatialReference.isGeographic?1:0))}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this.isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}};e([L()],Ye.prototype,"_renderer",void 0),e([L()],Ye.prototype,"_hasPendingUpdates",void 0),e([L()],Ye.prototype,"_asyncWorkItems",void 0),e([L()],Ye.prototype,"_allTilesDirty",void 0),e([L()],Ye.prototype,"_allTilesSorted",void 0),e([L()],Ye.prototype,"_viewChanged",void 0),e([L({readOnly:!0})],Ye.prototype,"_watchUpdatingTracking",void 0),e([L()],Ye.prototype,"_frameTask",void 0),e([L({readOnly:!0})],Ye.prototype,"snapLevel",null),e([L({readOnly:!0})],Ye.prototype,"lodSnapping",null),e([L({constructOnly:!0})],Ye.prototype,"view",void 0),e([L()],Ye.prototype,"_userClippingExtent",null),e([L()],Ye.prototype,"_rootTilesExtent",void 0),e([L({readOnly:!0})],Ye.prototype,"extent",null),e([L({readOnly:!0})],Ye.prototype,"groundExtent",null),e([L({readOnly:!0})],Ye.prototype,"_tilingSchemeExtent",null),e([L({readOnly:!0})],Ye.prototype,"updating",null),e([L(Z)],Ye.prototype,"updatingProgress",void 0),e([L({readOnly:!0})],Ye.prototype,"updatingProgressValue",null),e([L()],Ye.prototype,"_maxNumUpdating",void 0),e([L({aliasOf:"view.map.ground.opacity"})],Ye.prototype,"baseOpacity",void 0),e([L({readOnly:!0})],Ye.prototype,"overlayManager",void 0),e([L({readOnly:!0})],Ye.prototype,"viewingMode",null),e([L()],Ye.prototype,"maxTextureScale",void 0),e([L({readOnly:!0})],Ye.prototype,"ready",null),e([L({value:de.FRONT_TO_BACK})],Ye.prototype,"renderOrder",null),e([L({readOnly:!0})],Ye.prototype,"rootTiles",void 0),e([L({readOnly:!0})],Ye.prototype,"spatialReference",null),e([L()],Ye.prototype,"backgroundImage",void 0),e([L({type:t,aliasOf:"view.map.ground.surfaceColor"})],Ye.prototype,"backgroundColor",void 0),e([L()],Ye.prototype,"_background",null),e([L({value:!1})],Ye.prototype,"slicePlaneEnabled",null),e([L({readOnly:!0})],Ye.prototype,"tilingScheme",void 0),e([L({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeLocked"})],Ye.prototype,"tilingSchemeLocked",void 0),e([L({readOnly:!0})],Ye.prototype,"tilingSchemeLogic",void 0),e([L({value:!0})],Ye.prototype,"velvetOverground",null),e([S("_renderer.wireframe")],Ye.prototype,"wireframe",void 0),e([L({value:!1})],Ye.prototype,"suspended",null),e([L({readOnly:!0,aliasOf:"view.qualitySettings.tiledSurface.textureFadeDuration"})],Ye.prototype,"textureFadeDuration",void 0),e([L()],Ye.prototype,"_layerViewsDirty",void 0),e([S("_renderer.renderPatchBorders")],Ye.prototype,"renderPatchBorders",void 0),e([S("_renderer.renderingDisabled")],Ye.prototype,"renderingDisabled",void 0),Ye=e([b("esri.views.3d.terrain.TerrainSurface")],Ye);const $e=Ye;function Ke(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Je(e){return!e.isLeaf&&(e.children.some((e=>e.shouldLoad))||e.children.some((e=>Je(e))))}function Ze(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const et=-1,tt=P(),it=A(),rt=[0,0,0],st=new _,at={spatialReference:null,tile:null,extent:null,context:"ground"},nt={spatialReference:null,extent:null,scale:0};export{$e as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as p,isSome as u}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as g,isAborted as m,createAbortError as f}from"../../../core/promiseUtils.js";import{watch as T,syncAndInitial as y,sync as v,initial as w}from"../../../core/reactiveUtils.js";import{aliasOf as S}from"../../../core/accessorSupport/decorators/aliasOf.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{property as L}from"../../../core/accessorSupport/decorators/property.js";import{subclass as E}from"../../../core/accessorSupport/decorators/subclass.js";import{m as b}from"../../../chunks/mat4.js";import{c as x}from"../../../chunks/mat4f64.js";import{c as D}from"../../../chunks/vec3.js";import{c as U}from"../../../chunks/vec3f64.js";import{c as P}from"../../../chunks/vec4f64.js";import{WatchUpdatingTracking as R}from"../../../core/support/WatchUpdatingTracking.js";import{projectVectorToVector as C,projectPointToVector as j}from"../../../geometry/projection.js";import{getReferenceEllipsoid as M}from"../../../geometry/projectionEllipsoid.js";import{create as A,equals as I,intersection as V,empty as O,expand as k,intersectsSphere as N}from"../../../geometry/support/aaBoundingRect.js";import{create as q,copy as B}from"../../../geometry/support/frustum.js";import{isPlateCarree as G}from"../../../geometry/support/spatialReferenceUtils.js";import{isRefreshableLayer as W}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as H}from"../../../layers/support/layerUtils.js";import{acquireDecoder as Q}from"../../../layers/support/LercDecoder.js";import{printAllocations as X}from"../../2d/engine/vectorTiles/VectorTile.js";import{directionToHeadingTilt as z,scaleToZoom as Y}from"../support/cameraUtils.js";import $ from"../support/debugFlags.js";import{toBoundingRect as K}from"../support/extentUtils.js";import{ClientType as J}from"../support/index.js";import{updatingProgress as Z}from"../support/updatingProperties.js";import{ElevationBounds as ee}from"./ElevationBounds.js";import{sampleElevation as te,ElevationData as ie}from"./ElevationData.js";import{create as re}from"./ExtentHelper.js";import{LODSnapping as se,TextureUpdate as ae}from"./interfaces.js";import{LayerClass as ne,LayerClasses as le}from"./LayerClass.js";import{OverlayManager as oe}from"./OverlayManager.js";import{PlanarPatch as he}from"./PlanarPatch.js";import{RenderOrder as de}from"./RenderOrder.js";import{SphericalPatch as pe}from"./SphericalPatch.js";import{MAX_ROOT_TILES as ue,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as ce,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as _e,MAX_MEMORY_LOD_BIAS as ge,ELEVATION_NODATA_VALUE as me}from"./TerrainConst.js";import fe from"./TerrainRenderer.js";import Te from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as ye,internalAssert as ve,isSurfaceLayerView as we,isMapTileLayerView as Se,isElevationLayerView as Le,isBlendableLayerView as Ee,isVectorTileLayerView as be,useFetchTileForLayer as xe,isImageryTileLayerView as De,isTileLayerView as Ue,releaseTileData as Pe,ENABLE_WATERPROOFNESS_TESTS as Re}from"./terrainUtils.js";import{SplitLimits as Ce,Tile as je}from"./Tile.js";import{printAllocations as Me}from"./TilePerLayerInfo.js";import{TileUpdate as Ae}from"./TileUpdate.js";import{IteratorPreorder as Ie,IteratorPostorder as Ve,hasLoadableSiblings as Oe,sortTilesByPOI as ke,sortTiles as Ne}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Be}from"./UpsampleInfo.js";import{RenderRequestType as Ge}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as We,TaskPriority as Fe,noBudget as He}from"../../support/Scheduler.js";const Qe=l.getLogger("esri.views.3d.terrain.TerrainSurface"),Xe=.25;let ze=class extends(a.EventedMixin(i)){constructor(e){super(e),this._elevationBounds=new ee,this._iteratorPool=new c(Ie,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ve,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visible=!1,this._usedMemory=Ze,this._performanceInfo=new Te,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=U(),this._eyePosSurfaceSR=U(),this._splitLimits=new Ce,this._snapLevel=1/0,this._frustum=q(),this._viewProjectionMatrix=x(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new R,this._frameTask=We,this._allTiles=new _,this._upsampleInfoPool=new c(Be),this.isWebMercator=!1,this.isWebMercatorOnPlateeCarree=!1,this._rootTilesExtent=A(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.backgroundColor=null,this._updatingRootTiles=!1,this.deferTileNeighborUpdate=!1,this.neighborTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this._isGlobal=!e.view?.state?.isLocal}initialize(){this._lercDecoder=Q(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(he):new c(pe);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new F(e.newCache("elevation-query")),this._set("overlayManager",new oe({surface:this})),this._handles.add([T((()=>this.overlayManager.hasHighlights),(e=>this._renderer.setNeedsHighlight(e))),T((()=>this.overlayManager.rendersOccluded),(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new fe({overlayRenderer:this.overlayManager.renderer,ellipsoidRadius:M(this.view.spatialReference).radius,stage:this.view._stage,allTiles:this._allTiles}),this._handles.add([T((()=>this.baseOpacity),(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),y),T((()=>this.renderingDisabled),(()=>this._updateTransparentTerrain()),v),T((()=>this.backgroundColor),(()=>{this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}),y),T((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),T((()=>$.TERRAIN_TILE_TREE_SHOW_TILES),(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&$.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}),w)]),this._extentHelper=re(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>this.view?.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new qe({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(J.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(J.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(Fe.TERRAIN_SURFACE,this),this._handles.add([T((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),w),T((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),v),T((()=>this.extent),(()=>this._updateRootTiles()),w),this.view.on("resize",(()=>this._viewChangeUpdate())),T((()=>{const e=this.view,t=e.state;return[this.lodBias,this.lodSnapping,e.resourceController?.memoryController?.memoryFactor,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),y),T((()=>this.view.qualitySettings?.tiledSurface?.textureFadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),w),T((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),v)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),je.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),X(),Me()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){const e=this.view.pointsOfInterest?.contentCameraOnSurface?.scale;if(e){const t=this.view.state.contentCamera;let i=z(this.view,t.eye,t.viewForward,t.up).tilt;i>90&&(i=180-i);const r=2*(i/90)**2,s=Y(this.view,e)-r;Math.abs(this._snapLevel-s)>Xe&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?se.ON:se.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(p(t)||p(e))return null;const i=A(),r=K(t,i,e)?i:null,s=this._get("extent");return I(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=V(this.groundExtent,this._userClippingExtent,A()),t=this._get("extent");return I(e,t)?t:e}get groundExtent(){return u(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._renderer.updating||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get viewingMode(){return this.view.state.viewingMode}get ready(){return u(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get spatialReference(){return this.tilingScheme?.spatialReference??null}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._updateTransparentTerrain()}_updateTransparentTerrain(){const e=!this.renderingDisabled&&!this.opaque;this.view?._stage?.renderView.setRenderParameters({transparentTerrain:e})}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}set visible(e){e!==this._visible&&(this._visible=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,et);return p(s)?null:te(et[0],et[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=et){const a=this.rootTiles;if(p(a)||!a.length)return null;if(0===a[0].layerInfo[ne.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!C(s,r,s,this.tilingScheme?.spatialReference))return Qe.error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let n of a){if(!n.containsPoint(s))continue;for(;n&&!n.rendered&&!n.isLeaf;){let e=0;s[0]>.5*(n.extent[0]+n.extent[2])&&(e+=1),s[1]<.5*(n.extent[1]+n.extent[3])&&(e+=2),n=n.children[e]}const e=n.renderData;return(e?e.geometryState.samplerData:null)?n:null}return null}get elevationBounds(){return this._elevationBounds}getScale(e){if(this.tilingScheme){if(!j(e,et,this.spatialReference))return Qe.error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(u(t))for(let e of t)if(e.containsPoint(et)){for(;null!=e.children[0];){let t=0;et[0]>e.children[0].extent[2]&&(t+=1),et[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!j(e,et,this.spatialReference))return Qe.error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;et[3]=t;let i=null;const r=e=>{if(e&&N(e.extent,et))if(null!=e.children[0])for(const t of e.children)r(t);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}},s=this.rootTiles;if(u(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this.lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1,this._renderer.isTransparent=this._allSurfaceLayersTransparent();const i=t!==this._renderer.opaque;i&&this._updateTransparentTerrain(),this._updateTileTextures(i?ae.UNFADED:ae.IMMEDIATE)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;ye(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this.isWebMercator=this.tilingScheme?.spatialReference.isWebMercator;const t=this.view?.renderSpatialReference,i=u(t)&&G(t);this.isWebMercatorOnPlateeCarree=this.isWebMercator&&i,this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles())}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return it[0]=e,it[1]=t,it[2]=i,s.init(it,r,this),s}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=tt;let s=t.rootTilesInExtent(e,i,5*ue);if(u(this.rootTiles)){if(s.length>ue)return void Qe.warn(ce);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,$e);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>$e(t,e.lij)))>-1)||(this._purgeTile(e,!0),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>ue&&(Qe.warn(_e),s=t.rootTilesInExtent(e,i,ue)),this._setRootTiles(s.map((e=>this._newRootTile(e))));I(i,this._rootTilesExtent)||(this._rootTilesExtent=A(i)),this.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._allTiles.forEach((e=>{e.isLoaded&&this._prepareToLoadTile(e)})),this._allTiles.forAll((e=>{e.isLoaded&&(this._updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e))})),this._updatingRootTiles=!1,this.checkAllTileWaterproofness()}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ae.SPLIT&&t.setPendingUpdate(Ae.SPLIT),this._loadTile(t),t.checkGeometryWaterproofness(),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),u(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Ae.GEOMETRY)&&this._updateTileGeometry(e)}_updateTilesVisibility(e){if(p(e))return;const t=Oe(e);let i=t?this._elevationBounds.min:1/0,r=t?this._elevationBounds.max:-1/0;const s=this.extent,a=this._viewProjectionMatrix;this.setTileTreeDirty();const n=this._iteratorPool.acquire();for(n.reset(e);!n.done;){const e=n.next();e.updateClippingStatus(s)&&e.resetPendingUpdate(Ae.GEOMETRY)&&this._updateTileGeometry(e),e.setPendingUpdate(Ae.RENDERDATA),e.computeVisibility(),e.updateScreenDepth(a),e.renderData&&(i=Math.min(e.elevationBounds[0],i),r=Math.max(e.elevationBounds[1],r))}n.remove(),this._viewChanged=!0,this._allTilesDirty=!0,isFinite(i)&&isFinite(r)&&(this._elevationBounds.min===i&&this._elevationBounds.max===r||(this._elevationBounds.min=i,this._elevationBounds.max=r,this.emit("elevation-bounds-change",null)))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this.lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(p(this._splitLimits.frustum)&&(this._splitLimits.frustum=q()),B(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,B(this._frustum,e.frustum),b(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),D(this._eyePosRenderSR,t.eye),C(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(Ke(e)?(this._loadChildren(e),this._checkTileNeighborsWaterproofness(e),e.children.forEach((e=>e.checkGeometryWaterproofness()))):Je(e)&&this._loadParent(e))}_updateTileGeometry(e){e.updateVisibility(),this._renderer.updateTileGeometry(e),this._updateTileNeighborsAfterGeometryChange(e),this._elevationUpdate(e),this._usedMemory=Ze,this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e)}_updateTileNeighborsAfterGeometryChange(e,t){if(this.deferTileNeighborUpdate){const t=this.neighborTilesToUpdate;e.forEachLoadedNeighbor((e=>{t.add(e)}))}else e.updateNeighborsAfterGeometryChange(t)}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Ae.TEXTURE_FADING)?Ae.TEXTURE_FADING:!!e.resetPendingUpdate(Ae.TEXTURE_NOFADING)&&Ae.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=Ze,t.madeProgress())}_elevationUpdate(e){st.spatialReference=this.spatialReference,st.tile=e,st.extent=e.extent,this.emit("elevation-change",st)}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateTileStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done&&this.requestUpdate(),this.notifyChange("updatingProgressValue")}_updateTileStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next(),i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i!==Ae.SPLIT){if(e.resetPendingUpdate(Ae.SPLIT)&&e.updateAgentSuspension(),i===Ae.VSPLITMERGE&&e.updateAgents(ne.ELEVATION),t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(Ae.MERGE),e.resetPendingUpdate(Ae.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}else e.resetPendingUpdate(Ae.MERGE),e.isLeaf&&(e.setPendingUpdate(Ae.SPLIT),t.skipSubtree())}t.remove(),this.requestUpdate(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(ke(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_prepareBatchTileGeometryUpdate(){ve(0===this.neighborTilesToUpdate.size),this.deferTileNeighborUpdate=!0}_batchUpdateUpdatedTileNeighbors(){this.deferTileNeighborUpdate=!1;const e=this.neighborTilesToUpdate;(()=>{const t=()=>{for(const t of e)t.updateNeighborsWithChangedEdgeResolution()};(()=>{for(const t of e)t.updateNeighborDataAndGeometryIfNeeded()})(),t(),e.clear()})()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=0;this._prepareBatchTileGeometryUpdate();let r=!1;for(;!e.done;){let s=!1;i=0;const a=!this._allTiles.some((a=>{if(r)i+=a.usedMemory;else if(!a.loadable)return e.done;if(a.resetPendingUpdate(Ae.MERGE)){if(!t)return a.setPendingUpdate(Ae.MERGE),e.done;this._mergeTile(a),s=!0,e.madeProgress()}else a.resetPendingUpdate(Ae.SPLIT)&&(this._splitTile(a),s=!0,e.madeProgress());return!e.done&&a.resetPendingUpdate(Ae.RENDERDATA)&&(this._updateRenderData(a),e.madeProgress()),e.done}));if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),a){if(!r){r=!0;continue}if(this._usedMemory=i,!s)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}0===i&&(this._allTilesDirty=!0),this._batchUpdateUpdatedTileNeighbors(),this._sortTiles(e)}_updateElevation(e){return this._prepareBatchTileGeometryUpdate(),this._allTiles.some((t=>(t.resetPendingUpdate(Ae.GEOMETRY)&&(this._updateTileGeometry(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),this._batchUpdateUpdatedTileNeighbors(),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(Ge.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ge}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this.lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){u(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e,!1))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.visible=!1}_purgeDescendantTiles(e){if(e.isLeaf)return!1;let t=!1;for(let i=0;i<4;++i)t=this._purgeTile(e.children[i],!1)||t;return e.unsetChildren(),t}_purgeTile(e,t){const i=this._purgeDescendantTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),this._unloadTile(e),t&&this._updateTileNeighborsAfterGeometryChange(e),this._tilePool.release(e),i}_unloadTile(e){this.deferTileNeighborUpdate&&this.neighborTilesToUpdate.delete(e),e.unload(this._renderer)}_splitTile(e){ye(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(Ae.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,this._emitTileScaleChange(e,t),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){at.spatialReference=this.spatialReference,at.extent=e.extent,at.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",at)}_createTile(e,t,i,r){ye(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Ae.SPLIT&&s.setPendingUpdate(Ae.SPLIT),s}_mergeTile(e){ye(!e.hasPendingUpdate(Ae.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(e)&&(ye(!e.renderData,"_mergeTile sanity check"),this._loadTile(e),this._updateTileNeighborsAfterGeometryChange(e),this._checkTileAndNeighborsWaterproofness(e)),this._allTilesDirty=!0,++this._performanceInfo.numMerged,this._emitTileScaleChange(e)}_checkTileAndNeighborsWaterproofness(e){e.checkGeometryWaterproofness(),this._checkTileNeighborsWaterproofness(e)}_checkTileNeighborsWaterproofness(e){Re&&e.forallNeighbors((e=>!!e.isLoaded&&(e.checkGeometryWaterproofness(),!0)))}_loadChildren(e){this._checkTileAndNeighborsWaterproofness(e),ye(e.rendered,"parent should be rendered"),this._unloadTile(e);const t=e.children;t.forEach((e=>this._prepareToLoadTile(e))),t.forEach((e=>this._loadTilePrepared(e))),this._updateTileNeighborsAfterGeometryChange(e,e.level+1),this.deferTileNeighborUpdate||t.forEach((e=>e.updateNeighborsWithChangedEdgeResolution())),t.forEach((e=>e.checkGeometryWaterproofness())),this._checkTileNeighborsWaterproofness(e)}_loadParent(e){this._checkTileAndNeighborsWaterproofness(e);const t=e.parent;this._unloadChildren(t),this._loadTile(t),this._updateTileNeighborsAfterGeometryChange(t),this._checkTileAndNeighborsWaterproofness(t)}_unloadChildren(e){if(!e.isLeaf)for(let t=0;t<4;++t){const i=e.children[t];this._unloadChildren(i),this._unloadTile(i)}}_postLoadTile(e){e.setPendingUpdate(Ae.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e),this._elevationUpdate(e)}_loadTile(e){e.load(this._renderer),this._postLoadTile(e)}_loadTilePrepared(e){e.loadPrepared(this._renderer),this._postLoadTile(e)}_prepareToLoadTile(e){e.prepareToLoad(this._renderer)}_elevationDataArrived(e,t,i){const r=new ie(e.lij,e.extent,i);e.dataArrived(t,ne.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=He){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),we(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._layerIndexByUid[e].get(s.uid);i<r&&(t=!0),r=i}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allSurfaceLayersTransparent(),e.madeProgress()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(Se(t)&&!H(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_layerClassFromLayerView(e){return Le(e)?ne.ELEVATION:ne.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(T((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(T((()=>e.fullOpacity),(()=>this._updateTileTextures(ae.UNFADED)))),t.push(T((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),Ee(e)&&t.push(T((()=>e.layer.blendMode),(()=>this._updateTileTextures(ae.UNFADED)))),e.on("data-changed",(()=>{const t=this._layerIndexByUid[i].get(e.uid);null!=t&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;const r=O();e.forEach((e=>{const s=e.layer;if(!s||e.suspended||!we(e))return;const a=e.fullExtent;if(!a)return void Qe.warn("Terrain: Map or elevation layer does not have fullExtent: "+s.id);k(r,a,r);const n=this._layerClassFromLayerView(e);if(n===ne.MAP){const t=e.displayLevelRange;t.maxLevel!==1/0&&(null===i||t.maxLevel>i)&&(i=t.maxLevel)}t[n].push(e)}));for(const s of le){const e=this._layerViews[s],i=t[s];i.reverse();const r=i.length;let a=e.length!==r;const n=new Array(r),l=new Array(e.length);this._layerIndexByUid[s].clear();for(let t=0;t<r;t++){const r=i[t].uid;this._layerIndexByUid[s].set(r,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(l,n,s);this._layerViews[s]=i,this._restartAllAgents(s),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ne.ELEVATION&&i.computeElevationBounds()}}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ne.MAP),e===ae.IMMEDIATE?this.renderer.updateTileTexture(t,Ae.TEXTURE_NOFADING):t.updateRenderData(ne.MAP,e)})),this._renderer.isTransparent=this._allSurfaceLayersTransparent()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=Ge.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||be(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,g(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===ne.ELEVATION?Le(i)?this._requestElevationTileData(e,i,r):Promise.reject():Se(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{if(m(i))return;const s=this._layerIndexByUid[ne.ELEVATION].get(t.uid);null!=s?(this._usedMemory=Ze,this.requestUpdate(),this._elevationDataArrived(e,s,r)):Qe.warn("TerrainSurface: received data from unknown layer %d %s",ne.ELEVATION,e.lij.toString())},s=i=>{g(i)||(this._dataMissing(e,ne.ELEVATION,t,i),this.requestUpdate())};if(xe(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:me,signal:i.signal}).then((e=>{if(!m(i))return this._frameTask.schedule((()=>r(e)),i.signal,s);Qe.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")}),s).finally((()=>{--this._asyncWorkItems}));const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:me},i.signal))).then((e=>{e?r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue}):s(new Error("LERC decoding failed"))}),s).finally((()=>{--this._asyncWorkItems}))}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Pe(s),m(i)||(this._dataMissing(e,ne.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),m(i)?Pe(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(be(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(De(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(Ue(t)&&xe(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(m(i))return Qe.warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(f());a(e)}),n);let l=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);W(t.layer)&&t.layer.refreshTimestamp&&(l+=`${l.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const o=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(l,o,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._layerIndexByUid[ne.MAP].get(t.uid);null!=r?e.dataArrived(r,ne.MAP,i):(Pe(i),Qe.warn("TerrainSurface: received data from unknown layer"))}_dataMissing(e,t,i,r){const s=this._layerIndexByUid[t].get(i.uid);null!=s?e.dataMissing(s,t,r):Qe.warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(this._usedMemory===Ze&&(this._usedMemory=0,this._allTiles.forAll((e=>this._usedMemory+=e.usedMemory))),this._usedMemory):0}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._layerIndexByUid[i].get(e.uid);return this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(p(e)||p(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return ye(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{u(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){rt.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&rt.push(e)}));const t=rt.toArray();return Ne(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}checkAllTileWaterproofness(){if(!Re)return;const e=this.rootTiles;if(p(e))return;const t=e=>e?.renderData?.geometryInfo?.indices?.length>0??!1,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometryInfo&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometryInfo||(e.renderData.geometryInfo.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometryInfo),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.isLeaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.isLeaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}isEastEndWrap(e){return this.isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this.isGlobal&&0===e[2]}lijEastEnd(e){return 2**(e+(this.spatialReference.isGeographic?1:0))}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this.isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}};e([L()],ze.prototype,"_renderer",void 0),e([L()],ze.prototype,"_hasPendingUpdates",void 0),e([L()],ze.prototype,"_asyncWorkItems",void 0),e([L()],ze.prototype,"_allTilesDirty",void 0),e([L()],ze.prototype,"_allTilesSorted",void 0),e([L()],ze.prototype,"_viewChanged",void 0),e([L({readOnly:!0})],ze.prototype,"_watchUpdatingTracking",void 0),e([L()],ze.prototype,"_frameTask",void 0),e([L({readOnly:!0})],ze.prototype,"snapLevel",null),e([L({readOnly:!0})],ze.prototype,"lodSnapping",null),e([L({constructOnly:!0})],ze.prototype,"view",void 0),e([L()],ze.prototype,"_userClippingExtent",null),e([L()],ze.prototype,"_rootTilesExtent",void 0),e([L({readOnly:!0})],ze.prototype,"extent",null),e([L({readOnly:!0})],ze.prototype,"groundExtent",null),e([L({readOnly:!0})],ze.prototype,"_tilingSchemeExtent",null),e([L({readOnly:!0})],ze.prototype,"updating",null),e([L(Z)],ze.prototype,"updatingProgress",void 0),e([L({readOnly:!0})],ze.prototype,"updatingProgressValue",null),e([L()],ze.prototype,"_maxNumUpdating",void 0),e([L({aliasOf:"view.map.ground.opacity"})],ze.prototype,"baseOpacity",void 0),e([L({readOnly:!0})],ze.prototype,"overlayManager",void 0),e([L({readOnly:!0})],ze.prototype,"viewingMode",null),e([L()],ze.prototype,"maxTextureScale",void 0),e([L({readOnly:!0})],ze.prototype,"ready",null),e([L({value:de.FRONT_TO_BACK})],ze.prototype,"renderOrder",null),e([L({readOnly:!0})],ze.prototype,"rootTiles",void 0),e([L({readOnly:!0})],ze.prototype,"spatialReference",null),e([L({type:t,aliasOf:"view.map.ground.surfaceColor"})],ze.prototype,"backgroundColor",void 0),e([L({value:!1})],ze.prototype,"slicePlaneEnabled",null),e([L({readOnly:!0})],ze.prototype,"tilingScheme",void 0),e([L({readOnly:!0,aliasOf:"tilingSchemeLogic.tilingSchemeLocked"})],ze.prototype,"tilingSchemeLocked",void 0),e([L({readOnly:!0})],ze.prototype,"tilingSchemeLogic",void 0),e([L({value:!0})],ze.prototype,"velvetOverground",null),e([S("_renderer.wireframe")],ze.prototype,"wireframe",void 0),e([L({value:!1})],ze.prototype,"suspended",null),e([L({readOnly:!0,aliasOf:"view.qualitySettings.tiledSurface.textureFadeDuration"})],ze.prototype,"textureFadeDuration",void 0),e([L()],ze.prototype,"_layerViewsDirty",void 0),e([S("_renderer.renderPatchBorders")],ze.prototype,"renderPatchBorders",void 0),e([S("_renderer.renderingDisabled")],ze.prototype,"renderingDisabled",void 0),ze=e([E("esri.views.3d.terrain.TerrainSurface")],ze);const Ye=ze;function $e(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Ke(e){return!e.isLeaf&&(e.children.some((e=>e.shouldLoad))||e.children.some((e=>Ke(e))))}function Je(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const Ze=-1,et=P(),tt=A(),it=[0,0,0],rt=new _,st={spatialReference:null,tile:null,extent:null,context:"ground"},at={spatialReference:null,extent:null,scale:0};export{Ye as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e,releaseMaybe as t,isNone as r,isSome as i}from"../../../core/maybe.js";import{Z as o}from"../../../chunks/vec2f64.js";import{RasterColorizerStretchType as s}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as l}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechniqueConfiguration as a,BlendLayersTechnique as h}from"./BlendLayersTechnique.js";import{LayerClass as n}from"./LayerClass.js";import{RasterColorizerTechniqueConfiguration as c,RasterColorizerTechnique as _}from"./RasterColorizerTechnique.js";import{FBOPool as u}from"./support/FBOPool.js";import{LayerBlendMode as d,AlphaBlendMode as p}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BindParameters as f}from"../webgl-engine/lib/BindParameters.js";import{Pos2Tex as b}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as T}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as y,ClearBufferBit as m}from"../../webgl/enums.js";import{vertexCount as B}from"../../webgl/Util.js";class q{constructor(e,t){this._rctx=e,this._techniqueRepository=t,this._fboPools=[],this._doubleBufferFbo=[],this._vectorTileHelper=new l,this._bindParameters=new f(null,null,null),this._blendLayersTechniqueConfig=new a,this._lastBlendMode=d.Normal,this._poolToWrite=0,this._vaoQuad=T(this._rctx,b),this._fboPools.push(new u(this._rctx)),this._fboPools.push(new u(this._rctx))}dispose(){this._fboPools.forEach((e=>{e.clear(),e=null})),this._fboPools=null,this._doubleBufferFbo.forEach((t=>e(t))),this._vaoQuad=e(this._vaoQuad),this._vectorTileHelper=e(this._vectorTileHelper),this._applyOpacityTechnique=t(this._applyOpacityTechnique),this._blendLayersTechnique=t(this._blendLayersTechnique)}_getBlendLayersTechnique(e){return this._blendLayersTechniqueConfig.blendMode=e,this._blendLayersTechnique=this._techniqueRepository.releaseAndAcquire(h,this._blendLayersTechniqueConfig,this._blendLayersTechnique),this._blendLayersTechnique}get applyOpacityTechnique(){if(r(this._applyOpacityTechnique)){const e=new a;e.mode=p.SourceAlpha,this._applyOpacityTechnique=this._techniqueRepository.acquire(h,e)}return this._applyOpacityTechnique}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(y.TRIANGLE_STRIP,0,B(this._vaoQuad,"geometry"))}drawRasterData(e,t){if(r(t.texture))return;t.blendMode===this._lastBlendMode?t.fboTexture=null:(t.fboTexture=this.currentFBO.colorTexture,this.switchPool(this.currentFBO.width),this._lastBlendMode=t.blendMode);const i=e===p.SourceAlpha?this.applyOpacityTechnique:this._getBlendLayersTechnique(t.blendMode),o=this._rctx.bindTechnique(i,t,this._bindParameters);this._render(o)}drawImageryTileData(e,t=1){const r=e.sourceLayerInfo.data;if(!r.source)return;e.tile.surface.layerViewByIndex(e.layerIndex,n.MAP).ensureSymbolizerParameters(r);const i=this._getRasterColorizerTechnique(r),o=this._rctx.bindTechnique(i);r.bind(this._rctx)&&(r.opacity=t,r.scale=e.scale,r.offset=e.offset,i.bindPass(r.getUniforms(),null),this._render(o),this._rctx.bindVAO())}_getRasterColorizerTechnique(e){const t=e.symbolizerParameters,i=["stretch","lut","hillshade"].indexOf(t.type);return r(this._rasterColorizerConfig)&&(this._rasterColorizerConfig=new c,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.colorizerType=i,this._rasterColorizerConfig.applyColormap=!!t.colormap,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?s.Noop:s.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(_,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,t,r,s,l,a){const h=this._rctx,c=t.sourceLayerInfo.data,_=t.tile.surface.layerViewByIndex(t.layerIndex,n.MAP);let u;return this._getBlendLayersTechnique(e.blendMode).bindPipelineState(h),e.opacity<1?(u=this._acquire(l),h.bindFramebuffer(u),h.setClearColor(1,1,1,0),h.clearSafe(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT)):a&&h.clearSafe(m.DEPTH_BUFFER_BIT),this._vectorTileHelper.render(h,t.sourceLod,c,_.painter,_.layer.styleRepository,_.schemaHelper,Math.round(1/t.scale),t.offset,s,r),!i(u)||(h.bindFramebuffer(this.currentFBO),e.texture=u.colorTexture,e.offset=o,e.scale=1,this.drawRasterData(p.OneMinusSourceAlpha,e),this._release(u),a)}_initFBO(e,t){this._rctx.bindFramebuffer(e),this._rctx.setViewport(0,0,t,t),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.clearSafe(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT)}_acquire(e){return this._fboPools[this._poolToWrite].acquire(e)}bindPool(e,t){this._poolToWrite=e,this._doubleBufferFbo[this._poolToWrite]=this._acquire(t),this._initFBO(this._doubleBufferFbo[this._poolToWrite],t)}switchPool(e){this._fboPools[this._poolToWrite].release(this.currentFBO),this._poolToWrite=0===this._poolToWrite?1:0,this.bindPool(this._poolToWrite,e)}get currentFBO(){return this._doubleBufferFbo[this._poolToWrite]}_release(e){this._fboPools[this._poolToWrite].release(e)}releasePool(){this._rctx.bindFramebuffer(null),this._release(this.currentFBO)}cleanupFBOPool(e,t){e===this._lastPixelRatio&&t===this._lastNumLayers||(this._fboPools.forEach((e=>e.clear())),this._lastPixelRatio=e,this._lastNumLayers=t)}}export{q as TileCompositor};
5
+ import{disposeMaybe as e,releaseMaybe as t,isNone as r,isSome as i}from"../../../core/maybe.js";import{Z as o}from"../../../chunks/vec2f64.js";import{RasterColorizerStretchType as s}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as l}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechniqueConfiguration as a,BlendLayersTechnique as h}from"./BlendLayersTechnique.js";import{LayerClass as n}from"./LayerClass.js";import{RasterColorizerTechniqueConfiguration as c,RasterColorizerTechnique as _}from"./RasterColorizerTechnique.js";import{FBOPool as u}from"./support/FBOPool.js";import{AlphaBlendMode as p,LayerBlendMode as f}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BindParameters as d}from"../webgl-engine/lib/BindParameters.js";import{Pos2Tex as b}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as T}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as y,ClearBufferBit as m}from"../../webgl/enums.js";import{vertexCount as q}from"../../webgl/Util.js";class x{constructor(e,t){this._rctx=e,this._techniqueRepository=t,this._fboPools=[],this._doubleBufferFbo=[],this._vectorTileHelper=new l,this._bindParameters=new d(null,null,null),this._blendLayersTechniqueConfig=new a,this._poolToWrite=0,this._vaoQuad=T(this._rctx,b),this._fboPools.push(new u(this._rctx)),this._fboPools.push(new u(this._rctx))}dispose(){this._fboPools.forEach((e=>{e.clear(),e=null})),this._fboPools=null,this._doubleBufferFbo.forEach((t=>e(t))),this._vaoQuad=e(this._vaoQuad),this._vectorTileHelper=e(this._vectorTileHelper),this._applyOpacityTechnique=t(this._applyOpacityTechnique),this._blendLayersTechnique=t(this._blendLayersTechnique)}_getBlendLayersTechnique(e){return this._blendLayersTechniqueConfig.blendMode=e,this._blendLayersTechnique=this._techniqueRepository.releaseAndAcquire(h,this._blendLayersTechniqueConfig,this._blendLayersTechnique),this._blendLayersTechnique}get applyOpacityTechnique(){if(r(this._applyOpacityTechnique)){const e=new a;e.mode=p.SourceAlpha,this._applyOpacityTechnique=this._techniqueRepository.acquire(h,e)}return this._applyOpacityTechnique}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(y.TRIANGLE_STRIP,0,q(this._vaoQuad,"geometry"))}drawRasterData(e,t){if(r(t.texture))return;t.blendMode===f.Normal?t.fboTexture=null:(t.fboTexture=this.currentFBO.colorTexture,this.switchPool(this.currentFBO.width));const i=e===p.SourceAlpha?this.applyOpacityTechnique:this._getBlendLayersTechnique(t.blendMode),o=this._rctx.bindTechnique(i,t,this._bindParameters);this._render(o)}drawImageryTileData(e,t=1){const r=e.sourceLayerInfo.data;if(!r.source)return;e.tile.surface.layerViewByIndex(e.layerIndex,n.MAP).ensureSymbolizerParameters(r);const i=this._getRasterColorizerTechnique(r),o=this._rctx.bindTechnique(i);r.bind(this._rctx)&&(r.opacity=t,r.scale=e.scale,r.offset=e.offset,i.bindPass(r.getUniforms(),null),this._render(o),this._rctx.bindVAO())}_getRasterColorizerTechnique(e){const t=e.symbolizerParameters,i=["stretch","lut","hillshade"].indexOf(t.type);return r(this._rasterColorizerConfig)&&(this._rasterColorizerConfig=new c,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.colorizerType=i,this._rasterColorizerConfig.applyColormap=!!t.colormap,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?s.Noop:s.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(_,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,t,r,s,l,a){const h=this._rctx,c=t.sourceLayerInfo.data,_=t.tile.surface.layerViewByIndex(t.layerIndex,n.MAP);let u;return this._getBlendLayersTechnique(e.blendMode).bindPipelineState(h),e.opacity<1?(u=this._acquire(l),h.bindFramebuffer(u),h.setClearColor(1,1,1,0),h.clearSafe(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT)):a&&h.clearSafe(m.DEPTH_BUFFER_BIT),this._vectorTileHelper.render(h,t.sourceLod,c,_.painter,_.layer.styleRepository,_.schemaHelper,Math.round(1/t.scale),t.offset,s,r),!i(u)||(h.bindFramebuffer(this.currentFBO),e.texture=u.colorTexture,e.offset=o,e.scale=1,this.drawRasterData(p.OneMinusSourceAlpha,e),this._release(u),a)}_initFBO(e,t){this._rctx.bindFramebuffer(e),this._rctx.setViewport(0,0,t,t),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.clearSafe(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT)}_acquire(e){return this._fboPools[this._poolToWrite].acquire(e)}bindPool(e,t){this._poolToWrite=e,this._doubleBufferFbo[this._poolToWrite]=this._acquire(t),this._initFBO(this._doubleBufferFbo[this._poolToWrite],t)}switchPool(e){this._fboPools[this._poolToWrite].release(this.currentFBO),this._poolToWrite=0===this._poolToWrite?1:0,this.bindPool(this._poolToWrite,e)}get currentFBO(){return this._doubleBufferFbo[this._poolToWrite]}_release(e){this._fboPools[this._poolToWrite].release(e)}releasePool(){this._rctx.bindFramebuffer(null),this._release(this.currentFBO)}cleanupFBOPool(e,t){e===this._lastPixelRatio&&t===this._lastNumLayers||(this._fboPools.forEach((e=>e.clear())),this._lastPixelRatio=e,this._lastNumLayers=t)}}export{x as TileCompositor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{releaseMaybe as t,isSome as r,isNone as s}from"../../../../../../core/maybe.js";import{e as o,t as a}from"../../../../../../chunks/mat3.js";import{a as i}from"../../../../../../chunks/mat3f32.js";import{C as n}from"../../../../../../chunks/vec3.js";import{f as l}from"../../../../../../chunks/vec3f32.js";import{v as h}from"../../../../../../chunks/vec4.js";import{f as u}from"../../../../../../chunks/vec4f32.js";import{ColorMixModeEnum as p}from"../../../../layers/support/symbolColorUtils.js";import{OverlayIndex as c,RenderTargetType as d}from"../../../../terrain/interfaces.js";import{ComponentTechnique as m}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as g,IntegratedMeshMode as T}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as x}from"./shader/ComponentData.glsl.js";import{g as y,a as M}from"../../../../../../chunks/ComponentShader.glsl.js";import{VertexDiscardMode as f}from"./shader/VertexDiscardByOpacity.glsl.js";import{parameter as b,parameterBlock as v,MaterialBase as O,MaterialParameterBlock as C}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as P,MaterialSubPass as N}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as S}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{NormalAttributeType as w}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as A}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as D}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as q}from"../../../core/shaderLibrary/util/AlphaCutoff.js";import{EllipsoidMode as R}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as E,TransparencyPassType as I,CullFaceOptions as F}from"../../../lib/basicInterfaces.js";class _ extends O{constructor(e,t){super(),this.toMapSpace=t,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=l(1,1,.5),this.emissiveFactor=l(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new B,this.componentParameters=new L,this.textureAlphaCutoff=q,this.alphaDiscardMode=E.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=R.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new g;const r=new j(e.position),s=i(e.rotationScale);o(s,s),this.transformNormalGlobalFromModel=a(s,s),this.transformWorldFromModelTL=r.low,this.transformWorldFromModelTH=r.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return r(this.baseColorTexture)?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return r(this.metallicRoughnessTexture)?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return r(this.emissionTexture)?this.emissionTexture.glTexture:null}get textureOcclusion(){return r(this.occlusionTexture)?this.occlusionTexture.glTexture:null}get textureNormal(){return r(this.normalTexture)?this.normalTexture.glTexture:null}prepareTechnique(e,t,o,a){const i=this._techniqueConfiguration;i.hasVertexColors=a.colors,i.hasNormals=a.normals,i.textureCoordinateType=a.textureCoordinates,i.hasMetalnessAndRoughnessTexture=r(this.metallicRoughnessTexture),i.hasEmissionTexture=r(this.emissionTexture),i.hasOcclusionTexture=r(this.occlusionTexture),i.hasNormalTexture=r(this.normalTexture),i.transparencyPassType=t.identifier===P.Material&&null!=o.transparencyPassType?o.transparencyPassType:I.NONE,i.hasMultipassTerrain=t.identifier===P.Material&&null!=o.multipassTerrain&&o.multipassTerrain.enabled,i.cullAboveGround=t.identifier===P.Material&&null!=o.multipassTerrain&&o.multipassTerrain.cullAboveGround,i.ellipsoidMode=this.ellipsoidMode,i.componentData=this.componentParameters.type,i.cullFace=this.commonMaterialParameters.cullFace,i.doubleSidedMode=this.commonMaterialParameters.doubleSided?A.View:A.None,i.hasBaseColorTexture=r(this.baseColorTexture);const n=this._computeWhichMaterialPass();i.blendingEnabled=n===V.Transparent||n===V.OpaqueAndTransparent,i.alphaDiscardMode=this.alphaDiscardMode,i.integratedMeshMode=this.isIntegratedMesh?X(o)?y(o)?T.ColorOverlayWithWater:T.ColorOverlay:T.NoOverlay:T.None,i.isGround=this.isIntegratedMesh,i.hasPolygonOffset=this.polygonOffsetEnabled;const l=this.hasParametersFromSource&&s(this.baseColorTexture);return i.pbrMode=i.integratedMeshMode===T.ColorOverlayWithWater?D.WaterOnIntegratedMesh:this.usePBR?l?D.Schematic:D.Normal:D.Disabled,i.normalType=i.integratedMeshMode===T.None?i.hasNormals?w.CompressedAttribute:w.ScreenDerivative:w.Ground,i.hasSlicePlane=r(o.slicePlane)&&this.commonMaterialParameters.hasSlicePlane,t.identifier===P.ShadowMap?(i.output=S.Shadow,i.vertexDiscardMode=f.None):t.identifier===P.Highlight?(i.output=S.Highlight,i.vertexDiscardMode=f.None):(this._computeWhichMaterialPass()===V.OpaqueAndTransparent?i.vertexDiscardMode=t.transparent?f.Opaque:f.Transparent:i.vertexDiscardMode=f.None,i.output=H(t.subPass),t.subPass===N.Alpha&&(i.hasOccludees=o.hasOccludees),t.subPass===N.Color?(i.receiveAmbientOcclusion=o.ssaoHelper.ready,i.hasOccludees=o.hasOccludees,i.receiveShadows=o.shadowMap.ready,i.hasScreenSpaceReflections=o.ssr.enabled):(i.receiveAmbientOcclusion=!1,i.receiveShadows=!1)),this._technique=e.releaseAndAcquire(m,i,this._technique),this._setClean(),this._technique}submit(e,t,s){if(0===this.objectOpacity)return;const o=s.renderable.geometry,a=s.components,i=s.renderable.meta.cameraDepthSquared,n=a.geometryRanges,l=a.highlightRanges,h=a.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case V.Opaque:e.materialOpaque.submitDraw(this,o,n,i);break;case V.Transparent:e.materialTransparent.submitDraw(this,o,n,i);break;case V.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,o,n,i),e.materialTransparent.submitDraw(this,o,n,i);break;case V.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,o,n,i),U(t)&&e.highlightIntegratedMesh.submitDraw(this,o,n,i)}const u=this.componentParameters.castShadows!==W.None;u&&e.shadowMap.submitDraw(this,o,n,i),r(l)&&(e.highlight.submitDraw(this,o,l,i),u&&e.highlightShadowMap.submitDraw(this,o,l,i)),u&&r(h)&&e.defaultShadowMap.submitDraw(this,o,h,i)}get attributeLocations(){return M}_computeWhichMaterialPass(){return this.isIntegratedMesh?V.IntegratedMesh:this.objectOpacity<1?V.Transparent:this.componentParameters.opaqueOverride===W.All?V.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===E.Blend||this.alphaDiscardMode===E.MaskBlend?V.Transparent:this.componentParameters.transparent===W.None?V.Opaque:this.componentParameters.transparent===W.All?V.Transparent:V.OpaqueAndTransparent}}var k,V,W;e([b({vectorOps:h})],_.prototype,"baseColor",void 0),e([b()],_.prototype,"usePBR",void 0),e([b()],_.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:n})],_.prototype,"mrrFactors",void 0),e([b({vectorOps:n})],_.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],_.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],_.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],_.prototype,"emissionTexture",void 0),e([b({dispose:!0})],_.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],_.prototype,"normalTexture",void 0),e([b()],_.prototype,"objectOpacity",void 0),e([v()],_.prototype,"commonMaterialParameters",void 0),e([v()],_.prototype,"componentParameters",void 0),e([b()],_.prototype,"textureAlphaCutoff",void 0),e([b()],_.prototype,"alphaDiscardMode",void 0),e([b()],_.prototype,"isIntegratedMesh",void 0),e([b()],_.prototype,"polygonOffsetEnabled",void 0),e([b()],_.prototype,"ellipsoidMode",void 0),e([b()],_.prototype,"hasOccludees",void 0),function(e){e[e.VERTEX=0]="VERTEX",e[e.GROUND=1]="GROUND",e[e.SCREEN_DERIVATIVE=2]="SCREEN_DERIVATIVE"}(k||(k={})),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(V||(V={}));class B extends C{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=F.Back,this.hasSlicePlane=!0}}e([b()],B.prototype,"doubleSided",void 0),e([b()],B.prototype,"cullFace",void 0),e([b()],B.prototype,"hasSlicePlane",void 0);class L extends C{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=p.Multiply,this.castShadows=W.All}get transparent(){return this.externalColor[3]<1?W.All:W.None}get opaqueOverride(){return this.externalColorMixMode===p.Replace&&1===this.externalColor[3]?W.All:W.None}get visible(){return this.externalColor[3]>0?W.All:W.None}get type(){return x.Uniform}}e([b({vectorOps:h})],L.prototype,"externalColor",void 0),e([b()],L.prototype,"externalColorMixMode",void 0),e([b()],L.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(W||(W={}));class G extends C{constructor(){super(...arguments),this.texture=null,this.transparent=W.None,this.opaqueOverride=W.None,this.castShadows=W.None}get type(){return x.Varying}}function H(e){switch(e){case N.Color:return S.Color;case N.Alpha:return S.Alpha;case N.Depth:return S.Depth;case N.Normal:return S.Normal}}function U(e){return 0!==e.overlays.length&&r(e.overlays[c.INNER].getValidTexture(d.Highlight))}function X(e){return 0!==e.overlays.length&&r(e.overlays[c.INNER].getColorTextureNoRasterImage())}e([b()],G.prototype,"texture",void 0),e([b()],G.prototype,"transparent",void 0),e([b()],G.prototype,"opaqueOverride",void 0),e([b()],G.prototype,"castShadows",void 0);export{B as CommonMaterialParameters,_ as ComponentMaterial,W as ComponentParameterSummary,L as ComponentParametersUniform,G as ComponentParametersVarying,k as ShadingNormalSource};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{releaseMaybe as t,isSome as r,isNone as s}from"../../../../../../core/maybe.js";import{e as o,t as a}from"../../../../../../chunks/mat3.js";import{a as i}from"../../../../../../chunks/mat3f32.js";import{C as n}from"../../../../../../chunks/vec3.js";import{f as l}from"../../../../../../chunks/vec3f32.js";import{v as h}from"../../../../../../chunks/vec4.js";import{f as u}from"../../../../../../chunks/vec4f32.js";import{ColorMixModeEnum as p}from"../../../../layers/support/symbolColorUtils.js";import{OverlayIndex as c,RenderTargetType as d}from"../../../../terrain/interfaces.js";import{ComponentTechnique as m}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as g,IntegratedMeshMode as T}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as x}from"./shader/ComponentData.glsl.js";import{g as y,a as f}from"../../../../../../chunks/ComponentShader.glsl.js";import{VertexDiscardMode as M}from"./shader/VertexDiscardByOpacity.glsl.js";import{parameter as b,parameterBlock as v,MaterialBase as O,MaterialParameterBlock as C}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as P,MaterialSubPass as N}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as S}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{NormalAttributeType as w}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as A}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as D}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as q}from"../../../core/shaderLibrary/util/AlphaCutoff.js";import{EllipsoidMode as R}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as E,TransparencyPassType as I,CullFaceOptions as F}from"../../../lib/basicInterfaces.js";class _ extends O{constructor(e,t){super(),this.toMapSpace=t,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=l(1,1,.5),this.emissiveFactor=l(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new B,this.componentParameters=new L,this.textureAlphaCutoff=q,this.alphaDiscardMode=E.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=R.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new g;const r=new j(e.position),s=i(e.rotationScale);o(s,s),this.transformNormalGlobalFromModel=a(s,s),this.transformWorldFromModelTL=r.low,this.transformWorldFromModelTH=r.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return r(this.baseColorTexture)?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return r(this.metallicRoughnessTexture)?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return r(this.emissionTexture)?this.emissionTexture.glTexture:null}get textureOcclusion(){return r(this.occlusionTexture)?this.occlusionTexture.glTexture:null}get textureNormal(){return r(this.normalTexture)?this.normalTexture.glTexture:null}prepareTechnique(e,t,o,a){const i=this._techniqueConfiguration;i.hasVertexColors=a.colors,i.hasNormals=a.normals,i.textureCoordinateType=a.textureCoordinates,i.hasMetalnessAndRoughnessTexture=r(this.metallicRoughnessTexture),i.hasEmissionTexture=r(this.emissionTexture),i.hasOcclusionTexture=r(this.occlusionTexture),i.hasNormalTexture=r(this.normalTexture),i.transparencyPassType=t.identifier===P.Material&&null!=o.transparencyPassType?o.transparencyPassType:I.NONE,i.hasMultipassTerrain=t.identifier===P.Material&&null!=o.multipassTerrain&&o.multipassTerrain.enabled,i.cullAboveGround=t.identifier===P.Material&&null!=o.multipassTerrain&&o.multipassTerrain.cullAboveGround,i.ellipsoidMode=this.ellipsoidMode,i.componentData=this.componentParameters.type,i.cullFace=this.commonMaterialParameters.cullFace,i.doubleSidedMode=this.commonMaterialParameters.doubleSided?A.View:A.None,i.hasBaseColorTexture=r(this.baseColorTexture);const n=this._computeWhichMaterialPass();i.blendingEnabled=n===V.Transparent||n===V.OpaqueAndTransparent,i.alphaDiscardMode=this.alphaDiscardMode,i.integratedMeshMode=this.isIntegratedMesh?X(o)?y(o)?T.ColorOverlayWithWater:T.ColorOverlay:T.NoOverlay:T.None,i.isGround=this.isIntegratedMesh,i.hasPolygonOffset=this.polygonOffsetEnabled;const l=this.hasParametersFromSource&&s(this.baseColorTexture);return i.pbrMode=i.integratedMeshMode===T.ColorOverlayWithWater?D.WaterOnIntegratedMesh:this.usePBR?l?D.Schematic:D.Normal:D.Disabled,i.normalType=i.integratedMeshMode===T.None?i.hasNormals?w.CompressedAttribute:w.ScreenDerivative:w.Ground,i.hasSlicePlane=r(o.slicePlane)&&this.commonMaterialParameters.hasSlicePlane,t.identifier===P.ShadowMap?(i.output=S.Shadow,i.vertexDiscardMode=M.None):t.identifier===P.Highlight?(i.output=S.Highlight,i.vertexDiscardMode=M.None):(this._computeWhichMaterialPass()===V.OpaqueAndTransparent?i.vertexDiscardMode=t.transparent?M.Opaque:M.Transparent:i.vertexDiscardMode=M.None,i.output=H(t.subPass),t.subPass===N.Alpha&&(i.hasOccludees=o.hasOccludees),t.subPass===N.Color?(i.receiveAmbientOcclusion=o.ssaoHelper.ready,i.hasOccludees=o.hasOccludees,i.receiveShadows=o.shadowMap.ready,i.hasScreenSpaceReflections=o.ssr.enabled,i.hasCloudsReflections=r(o.cloudsComposition.clouds)):(i.receiveAmbientOcclusion=!1,i.receiveShadows=!1)),this._technique=e.releaseAndAcquire(m,i,this._technique),this._setClean(),this._technique}submit(e,t,s){if(0===this.objectOpacity)return;const o=s.renderable.geometry,a=s.components,i=s.renderable.meta.cameraDepthSquared,n=a.geometryRanges,l=a.highlightRanges,h=a.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case V.Opaque:e.materialOpaque.submitDraw(this,o,n,i);break;case V.Transparent:e.materialTransparent.submitDraw(this,o,n,i);break;case V.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,o,n,i),e.materialTransparent.submitDraw(this,o,n,i);break;case V.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,o,n,i),U(t)&&e.highlightIntegratedMesh.submitDraw(this,o,n,i)}const u=this.componentParameters.castShadows!==W.None;u&&e.shadowMap.submitDraw(this,o,n,i),r(l)&&(e.highlight.submitDraw(this,o,l,i),u&&e.highlightShadowMap.submitDraw(this,o,l,i)),u&&r(h)&&e.defaultShadowMap.submitDraw(this,o,h,i)}get attributeLocations(){return f}_computeWhichMaterialPass(){return this.isIntegratedMesh?V.IntegratedMesh:this.objectOpacity<1?V.Transparent:this.componentParameters.opaqueOverride===W.All?V.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===E.Blend||this.alphaDiscardMode===E.MaskBlend?V.Transparent:this.componentParameters.transparent===W.None?V.Opaque:this.componentParameters.transparent===W.All?V.Transparent:V.OpaqueAndTransparent}}var k,V,W;e([b({vectorOps:h})],_.prototype,"baseColor",void 0),e([b()],_.prototype,"usePBR",void 0),e([b()],_.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:n})],_.prototype,"mrrFactors",void 0),e([b({vectorOps:n})],_.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],_.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],_.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],_.prototype,"emissionTexture",void 0),e([b({dispose:!0})],_.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],_.prototype,"normalTexture",void 0),e([b()],_.prototype,"objectOpacity",void 0),e([v()],_.prototype,"commonMaterialParameters",void 0),e([v()],_.prototype,"componentParameters",void 0),e([b()],_.prototype,"textureAlphaCutoff",void 0),e([b()],_.prototype,"alphaDiscardMode",void 0),e([b()],_.prototype,"isIntegratedMesh",void 0),e([b()],_.prototype,"polygonOffsetEnabled",void 0),e([b()],_.prototype,"ellipsoidMode",void 0),e([b()],_.prototype,"hasOccludees",void 0),function(e){e[e.VERTEX=0]="VERTEX",e[e.GROUND=1]="GROUND",e[e.SCREEN_DERIVATIVE=2]="SCREEN_DERIVATIVE"}(k||(k={})),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(V||(V={}));class B extends C{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=F.Back,this.hasSlicePlane=!0}}e([b()],B.prototype,"doubleSided",void 0),e([b()],B.prototype,"cullFace",void 0),e([b()],B.prototype,"hasSlicePlane",void 0);class L extends C{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=p.Multiply,this.castShadows=W.All}get transparent(){return this.externalColor[3]<1?W.All:W.None}get opaqueOverride(){return this.externalColorMixMode===p.Replace&&1===this.externalColor[3]?W.All:W.None}get visible(){return this.externalColor[3]>0?W.All:W.None}get type(){return x.Uniform}}e([b({vectorOps:h})],L.prototype,"externalColor",void 0),e([b()],L.prototype,"externalColorMixMode",void 0),e([b()],L.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(W||(W={}));class G extends C{constructor(){super(...arguments),this.texture=null,this.transparent=W.None,this.opaqueOverride=W.None,this.castShadows=W.None}get type(){return x.Varying}}function H(e){switch(e){case N.Color:return S.Color;case N.Alpha:return S.Alpha;case N.Depth:return S.Depth;case N.Normal:return S.Normal}}function U(e){return 0!==e.overlays.length&&r(e.overlays[c.INNER].getValidTexture(d.Highlight))}function X(e){return 0!==e.overlays.length&&r(e.overlays[c.INNER].getColorTextureNoRasterImage())}e([b()],G.prototype,"texture",void 0),e([b()],G.prototype,"transparent",void 0),e([b()],G.prototype,"opaqueOverride",void 0),e([b()],G.prototype,"castShadows",void 0);export{B as CommonMaterialParameters,_ as ComponentMaterial,W as ComponentParameterSummary,L as ComponentParametersUniform,G as ComponentParametersVarying,k as ShadingNormalSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../../../../chunks/tslib.es6.js";import e from"../../../../../../core/has.js";import{ComponentDataType as t}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as r}from"./shader/VertexDiscardByOpacity.glsl.js";import{ShaderOutput as s}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{NormalAttributeType as i}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttributeType as a}from"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{NormalsDoubleSidedMode as p}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as n}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as d}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{BindType as l}from"../../../core/shaderTechnique/BindType.js";import{parameter as c,ShaderTechniqueConfiguration as h}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{CullFaceOptions as u,AlphaDiscardMode as y,TransparencyPassType as v}from"../../../lib/basicInterfaces.js";var T,m;!function(o){o[o.None=0]="None",o[o.Transparent=1]="Transparent",o[o.Opaque=2]="Opaque",o[o.COUNT=3]="COUNT"}(T||(T={})),function(o){o[o.None=0]="None",o[o.NoOverlay=1]="NoOverlay",o[o.ColorOverlay=2]="ColorOverlay",o[o.ColorOverlayWithWater=3]="ColorOverlayWithWater",o[o.COUNT=4]="COUNT"}(m||(m={}));class O extends h{constructor(){super(...arguments),this.output=s.Color,this.textureCoordinateType=a.None,this.componentData=t.Uniform,this.cullFace=u.Back,this.vertexDiscardMode=r.None,this.doubleSidedMode=p.WindingOrder,this.alphaDiscardMode=y.Opaque,this.integratedMeshMode=m.None,this.transparencyPassType=v.NONE,this.ellipsoidMode=d.Earth,this.pbrMode=n.Disabled,this.normalType=i.Attribute,this.spherical=!1,this.doublePrecisionRequiresObfuscation=!1,this.hasVertexColors=!1,this.hasNormals=!1,this.hasSlicePlane=!1,this.hasBaseColorTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.hasScreenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetalnessAndRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.hasMultipassTerrain=!1,this.cullAboveGround=!1,this.isGround=!1}}o([c({count:s.COUNT})],O.prototype,"output",void 0),o([c({count:a.COUNT})],O.prototype,"textureCoordinateType",void 0),o([c({count:t.COUNT})],O.prototype,"componentData",void 0),o([c({count:u.COUNT})],O.prototype,"cullFace",void 0),o([c({count:r.COUNT})],O.prototype,"vertexDiscardMode",void 0),o([c({count:p.COUNT})],O.prototype,"doubleSidedMode",void 0),o([c({count:y.COUNT})],O.prototype,"alphaDiscardMode",void 0),o([c({count:m.COUNT})],O.prototype,"integratedMeshMode",void 0),o([c({count:v.COUNT})],O.prototype,"transparencyPassType",void 0),o([c({count:d.COUNT})],O.prototype,"ellipsoidMode",void 0),o([c({count:n.COUNT})],O.prototype,"pbrMode",void 0),o([c({count:i.COUNT})],O.prototype,"normalType",void 0),o([c()],O.prototype,"spherical",void 0),o([c()],O.prototype,"doublePrecisionRequiresObfuscation",void 0),o([c()],O.prototype,"hasVertexColors",void 0),o([c()],O.prototype,"hasNormals",void 0),o([c()],O.prototype,"hasSlicePlane",void 0),o([c()],O.prototype,"hasBaseColorTexture",void 0),o([c()],O.prototype,"receiveAmbientOcclusion",void 0),o([c()],O.prototype,"receiveShadows",void 0),o([c()],O.prototype,"blendingEnabled",void 0),o([c()],O.prototype,"hasScreenSpaceReflections",void 0),o([c()],O.prototype,"hasPolygonOffset",void 0),o([c()],O.prototype,"hasMetalnessAndRoughnessTexture",void 0),o([c()],O.prototype,"hasEmissionTexture",void 0),o([c()],O.prototype,"hasOcclusionTexture",void 0),o([c()],O.prototype,"hasNormalTexture",void 0),o([c()],O.prototype,"hasOccludees",void 0),o([c()],O.prototype,"hasMultipassTerrain",void 0),o([c()],O.prototype,"cullAboveGround",void 0),o([c()],O.prototype,"isGround",void 0),o([c({constValue:l.Draw})],O.prototype,"pbrTextureBindType",void 0),o([c({constValue:!0})],O.prototype,"hasSliceHighlight",void 0),o([c({constValue:!1})],O.prototype,"hasSliceInVertexProgram",void 0),o([c({constValue:!1})],O.prototype,"useCustomDTRExponentForWater",void 0),o([c({constValue:!1})],O.prototype,"hasVertexTangents",void 0),o([c({constValue:!0})],O.prototype,"supportsTextureAtlas",void 0),o([c({constValue:!1})],O.prototype,"highStepCount",void 0),o([c({constValue:!1})],O.prototype,"instancedDoublePrecision",void 0),o([c({constValue:!0})],O.prototype,"useFillLights",void 0),o([c({constValue:e("enable-feature:clouds-reflections")})],O.prototype,"hasCloudsReflections",void 0);export{O as ComponentTechniqueConfiguration,m as IntegratedMeshMode,T as PassDiscardMode};
5
+ import{_ as o}from"../../../../../../chunks/tslib.es6.js";import{ComponentDataType as e}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as t}from"./shader/VertexDiscardByOpacity.glsl.js";import{ShaderOutput as r}from"../../../core/shaderLibrary/ShaderOutputOptions.js";import{NormalAttributeType as s}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttributeType as i}from"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{NormalsDoubleSidedMode as a}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as p}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as n}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{BindType as d}from"../../../core/shaderTechnique/BindType.js";import{parameter as l,ShaderTechniqueConfiguration as h}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{CullFaceOptions as c,AlphaDiscardMode as u,TransparencyPassType as y}from"../../../lib/basicInterfaces.js";var v,T;!function(o){o[o.None=0]="None",o[o.Transparent=1]="Transparent",o[o.Opaque=2]="Opaque",o[o.COUNT=3]="COUNT"}(v||(v={})),function(o){o[o.None=0]="None",o[o.NoOverlay=1]="NoOverlay",o[o.ColorOverlay=2]="ColorOverlay",o[o.ColorOverlayWithWater=3]="ColorOverlayWithWater",o[o.COUNT=4]="COUNT"}(T||(T={}));class m extends h{constructor(){super(...arguments),this.output=r.Color,this.textureCoordinateType=i.None,this.componentData=e.Uniform,this.cullFace=c.Back,this.vertexDiscardMode=t.None,this.doubleSidedMode=a.WindingOrder,this.alphaDiscardMode=u.Opaque,this.integratedMeshMode=T.None,this.transparencyPassType=y.NONE,this.ellipsoidMode=n.Earth,this.pbrMode=p.Disabled,this.normalType=s.Attribute,this.spherical=!1,this.doublePrecisionRequiresObfuscation=!1,this.hasVertexColors=!1,this.hasNormals=!1,this.hasSlicePlane=!1,this.hasBaseColorTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.hasScreenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetalnessAndRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.hasMultipassTerrain=!1,this.cullAboveGround=!1,this.isGround=!1,this.hasCloudsReflections=!0}}o([l({count:r.COUNT})],m.prototype,"output",void 0),o([l({count:i.COUNT})],m.prototype,"textureCoordinateType",void 0),o([l({count:e.COUNT})],m.prototype,"componentData",void 0),o([l({count:c.COUNT})],m.prototype,"cullFace",void 0),o([l({count:t.COUNT})],m.prototype,"vertexDiscardMode",void 0),o([l({count:a.COUNT})],m.prototype,"doubleSidedMode",void 0),o([l({count:u.COUNT})],m.prototype,"alphaDiscardMode",void 0),o([l({count:T.COUNT})],m.prototype,"integratedMeshMode",void 0),o([l({count:y.COUNT})],m.prototype,"transparencyPassType",void 0),o([l({count:n.COUNT})],m.prototype,"ellipsoidMode",void 0),o([l({count:p.COUNT})],m.prototype,"pbrMode",void 0),o([l({count:s.COUNT})],m.prototype,"normalType",void 0),o([l()],m.prototype,"spherical",void 0),o([l()],m.prototype,"doublePrecisionRequiresObfuscation",void 0),o([l()],m.prototype,"hasVertexColors",void 0),o([l()],m.prototype,"hasNormals",void 0),o([l()],m.prototype,"hasSlicePlane",void 0),o([l()],m.prototype,"hasBaseColorTexture",void 0),o([l()],m.prototype,"receiveAmbientOcclusion",void 0),o([l()],m.prototype,"receiveShadows",void 0),o([l()],m.prototype,"blendingEnabled",void 0),o([l()],m.prototype,"hasScreenSpaceReflections",void 0),o([l()],m.prototype,"hasPolygonOffset",void 0),o([l()],m.prototype,"hasMetalnessAndRoughnessTexture",void 0),o([l()],m.prototype,"hasEmissionTexture",void 0),o([l()],m.prototype,"hasOcclusionTexture",void 0),o([l()],m.prototype,"hasNormalTexture",void 0),o([l()],m.prototype,"hasOccludees",void 0),o([l()],m.prototype,"hasMultipassTerrain",void 0),o([l()],m.prototype,"cullAboveGround",void 0),o([l()],m.prototype,"isGround",void 0),o([l()],m.prototype,"hasCloudsReflections",void 0),o([l({constValue:d.Draw})],m.prototype,"pbrTextureBindType",void 0),o([l({constValue:!0})],m.prototype,"hasSliceHighlight",void 0),o([l({constValue:!1})],m.prototype,"hasSliceInVertexProgram",void 0),o([l({constValue:!1})],m.prototype,"useCustomDTRExponentForWater",void 0),o([l({constValue:!1})],m.prototype,"hasVertexTangents",void 0),o([l({constValue:!0})],m.prototype,"supportsTextureAtlas",void 0),o([l({constValue:!1})],m.prototype,"highStepCount",void 0),o([l({constValue:!1})],m.prototype,"instancedDoublePrecision",void 0),o([l({constValue:!0})],m.prototype,"useFillLights",void 0);export{m as ComponentTechniqueConfiguration,T as IntegratedMeshMode,v as PassDiscardMode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"../output/BlendOptions.js";import"./BlendModes.glsl.js";import"../../shaderModules/Float2PassUniform.js";import"../../shaderModules/FloatPassUniform.js";import"../../shaderModules/interfaces.js";import"../../shaderModules/ShaderBuilder.js";import"../../shaderModules/Texture2DPassUniform.js";import"../../../lib/VertexAttribute.js";export{b as build}from"../../../../../../chunks/BlendLayers.glsl.js";
5
+ import"../../../../../../core/maybe.js";import"../output/BlendOptions.js";import"./BlendModes.glsl.js";import"../../shaderModules/Float2PassUniform.js";import"../../shaderModules/FloatPassUniform.js";import"../../shaderModules/interfaces.js";import"../../shaderModules/ShaderBuilder.js";import"../../shaderModules/Texture2DPassUniform.js";import"../../../lib/VertexAttribute.js";export{b as build}from"../../../../../../chunks/BlendLayers.glsl.js";