@arcgis/core 4.34.0-next.24 → 4.34.0-next.26

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 (384) hide show
  1. package/Basemap.js +1 -1
  2. package/analysis/VolumeMeasurement/CutFillOptions.d.ts +4 -0
  3. package/analysis/VolumeMeasurement/CutFillOptions.js +1 -1
  4. package/analysis/VolumeMeasurementAnalysis.js +1 -1
  5. package/applications/Components/imageryUtils.d.ts +7 -0
  6. package/applications/Components/imageryUtils.js +5 -0
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{0867aa688fa8938906da.js → 03bef3f4b6b09b1e864b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/03ee4d63aa8de44958ab.js +1 -0
  10. package/assets/esri/core/workers/chunks/06cdbccc9f325dcc303d.js +1 -0
  11. package/assets/esri/core/workers/chunks/09618761df5c4fdd52a0.js +1 -0
  12. package/assets/esri/core/workers/chunks/0ae00339991f5387203e.js +1 -0
  13. package/assets/esri/core/workers/chunks/0b4b294f3ce74fde5620.js +1 -0
  14. package/assets/esri/core/workers/chunks/{146520d263b910b5bdc7.js → 0e96a3b7228f1ff8e6c5.js} +1 -1
  15. package/assets/esri/core/workers/chunks/109ef17dd4f9430bb686.js +1 -0
  16. package/assets/esri/core/workers/chunks/1597aca21334cab3b802.js +1 -0
  17. package/assets/esri/core/workers/chunks/196564ad230bef6b59cf.js +1 -0
  18. package/assets/esri/core/workers/chunks/19f8d551cbebc11db1eb.js +1 -0
  19. package/assets/esri/core/workers/chunks/1ceee047e3fa617b0600.js +1 -0
  20. package/assets/esri/core/workers/chunks/1d27701832ea139fcc20.js +1 -0
  21. package/assets/esri/core/workers/chunks/1f296f85becf1ca6714d.js +1 -0
  22. package/assets/esri/core/workers/chunks/1f8d7bd44d53c30df383.js +1 -0
  23. package/assets/esri/core/workers/chunks/1fabb5ec59da698c1618.js +1 -0
  24. package/assets/esri/core/workers/chunks/{919d2fd7ebc0c840a759.js → 219b2911668db120452b.js} +1 -1
  25. package/assets/esri/core/workers/chunks/21a8ae88cfa644a30058.js +1 -0
  26. package/assets/esri/core/workers/chunks/2b4b073254fe8b6a081c.js +1 -0
  27. package/assets/esri/core/workers/chunks/2c2128201c80a1b1aeb6.js +1 -0
  28. package/assets/esri/core/workers/chunks/2d3679289b34b7da6bf4.js +1 -0
  29. package/assets/esri/core/workers/chunks/30293b88501b5d6162fc.js +1 -0
  30. package/assets/esri/core/workers/chunks/31533f5e8b76b307f61c.js +1 -0
  31. package/assets/esri/core/workers/chunks/347117e61e1c6edd074f.js +1 -0
  32. package/assets/esri/core/workers/chunks/3616eb2607843524483f.js +1 -0
  33. package/assets/esri/core/workers/chunks/36648facd56ee91afc7c.js +1 -0
  34. package/assets/esri/core/workers/chunks/394477e88be0c6790f02.js +1 -0
  35. package/assets/esri/core/workers/chunks/3b80b01551d124534a1b.js +1 -0
  36. package/assets/esri/core/workers/chunks/{89d91ce2f566dd3f57f7.js → 3be9ec0503a669bcfce6.js} +1 -1
  37. package/assets/esri/core/workers/chunks/3c9cf06ac6aa1db6c4f6.js +1 -0
  38. package/assets/esri/core/workers/chunks/40fc7c43feaeef8b814d.js +1 -0
  39. package/assets/esri/core/workers/chunks/42cddc8f8c8d73e22ee2.js +1 -0
  40. package/assets/esri/core/workers/chunks/437a4100a837ee16df7c.js +1 -0
  41. package/assets/esri/core/workers/chunks/472c677a74d779ce62d7.js +1 -0
  42. package/assets/esri/core/workers/chunks/4ce671bc4d36387b55fa.js +1 -0
  43. package/assets/esri/core/workers/chunks/4de6c479df609398dee0.js +1 -0
  44. package/assets/esri/core/workers/chunks/51cfa2f70ec222e1582b.js +1 -0
  45. package/assets/esri/core/workers/chunks/5284d46aecd6fe0345b8.js +1 -0
  46. package/assets/esri/core/workers/chunks/567385709e18ace93b1e.js +1 -0
  47. package/assets/esri/core/workers/chunks/{4c2f3e43992a918e4c2d.js → 5ef3256c32c4b622bd11.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{55e9b02d70812f7cdac2.js → 63966066a963e9a1fb14.js} +1 -1
  49. package/assets/esri/core/workers/chunks/63f50ff2ae94f684d56b.js +1 -0
  50. package/assets/esri/core/workers/chunks/6b6ab092f578b20c8e56.js +1 -0
  51. package/assets/esri/core/workers/chunks/6deaa08e3a61a455e564.js +1 -0
  52. package/assets/esri/core/workers/chunks/6e9b4bfe2a1497c96100.js +1 -0
  53. package/assets/esri/core/workers/chunks/6efc3d120c9c2c09cb06.js +1 -0
  54. package/assets/esri/core/workers/chunks/7338ce95bceb2c7fab87.js +1 -0
  55. package/assets/esri/core/workers/chunks/7359652de3d7f969a712.js +1 -0
  56. package/assets/esri/core/workers/chunks/{c64fa94cba71ba2794e2.js → 771012f129890f9a089c.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{d1b363c418a67b087306.js → 780ff9314f26ae62f75f.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{04c17957c15234ca0321.js → 7b736885278af9676f3a.js} +1 -1
  59. package/assets/esri/core/workers/chunks/8161b0a674ef9bf536a2.js +1 -0
  60. package/assets/esri/core/workers/chunks/820cf4337b248a0cb63c.js +1 -0
  61. package/assets/esri/core/workers/chunks/{fedbf639a0788417a70f.js → 86abfce1f2ac93cc4d54.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{c94cc026c4ed330408fb.js → 8894483b91bcda845b6f.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{f050ab9d100012b77bb9.js → 8c5b1114cc2a58305a81.js} +1 -1
  64. package/assets/esri/core/workers/chunks/908ec8165d567f052155.js +1 -0
  65. package/assets/esri/core/workers/chunks/{97324f030738fc0d456b.js → 9182fe69b9863e1de714.js} +1 -1
  66. package/assets/esri/core/workers/chunks/91e6030a2845f5404e82.js +1 -0
  67. package/assets/esri/core/workers/chunks/9511e55e4fabb3235eac.js +1 -0
  68. package/assets/esri/core/workers/chunks/9d85e20a3d6ca1161c26.js +1 -0
  69. package/assets/esri/core/workers/chunks/9f8341caab3b1d02f387.js +1 -0
  70. package/assets/esri/core/workers/chunks/a08d018d8c137fc4ca17.js +1 -0
  71. package/assets/esri/core/workers/chunks/a19689f8d1ef48fd2159.js +1 -0
  72. package/assets/esri/core/workers/chunks/{7051bcc178eb512819f6.js → a55338add265d330124b.js} +1 -1
  73. package/assets/esri/core/workers/chunks/a8f37681f8f6feebbd50.js +1 -0
  74. package/assets/esri/core/workers/chunks/{6ca764b4baadef5c1515.js → aeedc543320ee307d14a.js} +1 -1
  75. package/assets/esri/core/workers/chunks/afe4fd3b1b3521712edd.js +1 -0
  76. package/assets/esri/core/workers/chunks/b3794c513a13facc98d3.js +1 -0
  77. package/assets/esri/core/workers/chunks/{9991bd3c7991bffd8260.js → b37f3c416cefc1a6ea2c.js} +1 -1
  78. package/assets/esri/core/workers/chunks/bb50b4a3af627f91d789.js +1 -0
  79. package/assets/esri/core/workers/chunks/{f42155b7a4e6c5e80757.js → bbc2a4976d044b990193.js} +1 -1
  80. package/assets/esri/core/workers/chunks/bbf2c31d217de1b8ba6e.js +1 -0
  81. package/assets/esri/core/workers/chunks/be3977f7fe0c46a1b493.js +1 -0
  82. package/assets/esri/core/workers/chunks/befba7ceeb26a38732c1.js +1 -0
  83. package/assets/esri/core/workers/chunks/bf3fc71881aa559fc931.js +1 -0
  84. package/assets/esri/core/workers/chunks/c1fb5290e0e259b74389.js +1 -0
  85. package/assets/esri/core/workers/chunks/c361bf4d41a1843d4640.js +1 -0
  86. package/assets/esri/core/workers/chunks/c51099eab5a99c88e5de.js +1 -0
  87. package/assets/esri/core/workers/chunks/{909a6218db87cba2c9ba.js → c6c0263fbcf2ca245c1b.js} +3 -3
  88. package/assets/esri/core/workers/chunks/c6c3e703b18e1bb7113a.js +1 -0
  89. package/assets/esri/core/workers/chunks/c82e78590c2fabc67609.js +1 -0
  90. package/assets/esri/core/workers/chunks/{7d7f8f2936ddee65e3da.js → c9e580867f7ac17be329.js} +1 -1
  91. package/assets/esri/core/workers/chunks/d29ae64703a947bfb83b.js +1 -0
  92. package/assets/esri/core/workers/chunks/de1457b07f4e263f1524.js +1 -0
  93. package/assets/esri/core/workers/chunks/{6bf43bc3714d7b3878fa.js → e547318638c8f496c1a0.js} +1 -1
  94. package/assets/esri/core/workers/chunks/{53781ccca16e53d4a8c3.js → f291ccf9da6aa7d7ae23.js} +1 -1
  95. package/assets/esri/core/workers/chunks/f5ee10a8afb7f70833bb.js +346 -0
  96. package/assets/esri/core/workers/chunks/f61a8cc7e2b198e521ba.js +1 -0
  97. package/assets/esri/core/workers/chunks/f9442a281cb91c64c7cd.js +1 -0
  98. package/assets/esri/core/workers/chunks/{4f14e78d0560050c1a81.js → fa7243f080bcf6444929.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{c3213b487c11076985af.js → fbf3240b36718fa5dc76.js} +1 -1
  100. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  101. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  102. package/chunks/ComponentShader.glsl.js +36 -36
  103. package/chunks/RibbonLine.glsl.js +40 -33
  104. package/chunks/persistableUrlUtils.js +1 -1
  105. package/config.js +1 -1
  106. package/core/AsyncUpdate.js +1 -1
  107. package/core/Clonable.js +1 -1
  108. package/core/Evented.js +1 -1
  109. package/core/Identifiable.js +1 -1
  110. package/core/JSONSupport.js +1 -1
  111. package/core/Loadable.js +1 -1
  112. package/core/MapUtils.js +1 -1
  113. package/core/MemCache.js +1 -1
  114. package/core/MultiOriginJSONSupport.js +1 -1
  115. package/core/ObjectPool.js +1 -1
  116. package/core/PooledArray.js +1 -1
  117. package/core/Promise.js +1 -1
  118. package/core/ReadOnlyMultiOriginJSONSupport.js +1 -1
  119. package/core/heapSort.js +5 -0
  120. package/core/mathUtils.js +1 -1
  121. package/core/quantity.d.ts +1 -0
  122. package/geometry/support/buffer/BufferPool.js +1 -1
  123. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  124. package/interfaces.d.ts +202 -12
  125. package/kernel.js +1 -1
  126. package/layers/CatalogLayer.js +1 -1
  127. package/layers/FeatureLayer.js +1 -1
  128. package/layers/GeoJSONLayer.js +1 -1
  129. package/layers/SubtypeGroupLayer.js +1 -1
  130. package/layers/knowledgeGraph/KnowledgeGraphSublayerBase.js +1 -1
  131. package/layers/mixins/APIKeyMixin.js +1 -1
  132. package/layers/mixins/ArcGISCachedService.js +1 -1
  133. package/layers/mixins/ArcGISImageService.js +1 -1
  134. package/layers/mixins/ArcGISMapService.js +1 -1
  135. package/layers/mixins/ArcGISService.js +1 -1
  136. package/layers/mixins/BlendLayer.js +1 -1
  137. package/layers/mixins/CustomParametersMixin.js +1 -1
  138. package/layers/mixins/DisplayFilteredLayer.js +1 -1
  139. package/layers/mixins/EditBusLayer.js +1 -1
  140. package/layers/mixins/FeatureEffectLayer.js +1 -1
  141. package/layers/mixins/FeatureLayerBase.js +1 -1
  142. package/layers/mixins/FeatureReductionLayer.js +1 -1
  143. package/layers/mixins/ImageryTileMixin.js +1 -1
  144. package/layers/mixins/OperationalLayer.js +1 -1
  145. package/layers/mixins/OrderedLayer.js +1 -1
  146. package/layers/mixins/PortalLayer.js +1 -1
  147. package/layers/mixins/PublishableLayer.js +1 -1
  148. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  149. package/layers/mixins/RasterPresetRendererMixin.js +1 -1
  150. package/layers/mixins/RefreshableLayer.js +1 -1
  151. package/layers/mixins/ScaleRangeLayer.js +1 -1
  152. package/layers/mixins/SceneService.js +1 -1
  153. package/layers/mixins/SublayersOwner.js +1 -1
  154. package/layers/mixins/TemporalLayer.js +1 -1
  155. package/layers/mixins/TemporalSceneLayer.js +1 -1
  156. package/layers/mixins/TrackableLayer.js +1 -1
  157. package/layers/ogc/wfsUtils.js +1 -1
  158. package/layers/support/RasterJobHandler.js +1 -1
  159. package/layers/support/RasterWorker.js +1 -1
  160. package/layers/support/Sublayer.js +1 -1
  161. package/layers/support/arcgisLayerUrl.js +1 -1
  162. package/layers/support/multiLayerServiceUtils.js +1 -1
  163. package/layers/support/rasterDatasets/pixelReader.js +5 -0
  164. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  165. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  166. package/layers/support/rasterFunctions/stretchUtils.js +1 -1
  167. package/package.json +1 -1
  168. package/renderers/mixins/VisualVariablesMixin.js +1 -1
  169. package/rest/support/CameraInfoMixin.js +1 -1
  170. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  171. package/smartMapping/renderers/color.js +1 -1
  172. package/smartMapping/renderers/heatmap.js +1 -1
  173. package/smartMapping/renderers/pieChart.js +1 -1
  174. package/smartMapping/renderers/size.js +1 -1
  175. package/smartMapping/renderers/support/regenerateUtils.js +1 -1
  176. package/smartMapping/renderers/support/rendererUtils.js +1 -1
  177. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  178. package/smartMapping/renderers/type.js +1 -1
  179. package/smartMapping/symbology/color.js +1 -1
  180. package/smartMapping/symbology/support/utils.js +1 -1
  181. package/support/LayersMixin.js +1 -1
  182. package/support/TablesMixin.js +1 -1
  183. package/support/revision.js +1 -1
  184. package/symbols/support/utils.js +1 -1
  185. package/views/2d/engine/ParentChildStage.js +1 -1
  186. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  187. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  188. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  189. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
  190. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  191. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  192. package/views/2d/engine/webgl/textureUtils.js +1 -1
  193. package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
  194. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  195. package/views/2d/layers/LayerView2D.js +1 -1
  196. package/views/2d/layers/MediaLayerView2D.js +1 -1
  197. package/views/2d/layers/TileLayerView2D.js +1 -1
  198. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  199. package/views/2d/layers/support/DebugOverlay.js +1 -1
  200. package/views/2d/tiling/FeatureTileSubscriptionManager.js +1 -1
  201. package/views/3d/analysis/AnalysisView3D.js +1 -1
  202. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +5 -0
  203. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  204. package/views/3d/glTF/DefaultLoadingContext.js +1 -1
  205. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  206. package/views/3d/layers/BuildingSublayerView3D.js +1 -1
  207. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  208. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  209. package/views/3d/layers/FlowSubView3D.js +1 -1
  210. package/views/3d/layers/I3SMeshView3D.js +1 -1
  211. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  212. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  213. package/views/3d/layers/LayerView3D.js +1 -1
  214. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  215. package/views/3d/layers/StreamLayerView3D.js +1 -1
  216. package/views/3d/layers/TiledLayerView3D.js +1 -1
  217. package/views/3d/layers/graphics/DeconflictAABR.js +1 -1
  218. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  219. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  220. package/views/3d/layers/graphics/Labeler.js +1 -1
  221. package/views/3d/layers/graphics/StreamController.js +5 -0
  222. package/views/3d/layers/graphics/StreamGraphics3DGraphicsPipeline.js +1 -1
  223. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  224. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  225. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  226. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  227. package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
  228. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  229. package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
  230. package/views/3d/layers/support/fetchTile.js +1 -1
  231. package/views/3d/support/MemoryController.js +1 -1
  232. package/views/3d/support/ResourceController.js +1 -1
  233. package/views/3d/support/StreamDataLoader.js +1 -1
  234. package/views/3d/support/StreamDataRequester.js +5 -0
  235. package/views/3d/support/StreamTextureCollection.js +1 -1
  236. package/views/3d/support/engineContent/line.js +1 -1
  237. package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
  238. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  239. package/views/3d/support/flow/StreamlinesResources3D.js +1 -1
  240. package/views/3d/support/flow/geometryUtils.js +1 -1
  241. package/views/3d/support/index.js +1 -1
  242. package/views/3d/terrain/OverlayRenderer.js +1 -1
  243. package/views/3d/terrain/TerrainRenderer.js +1 -1
  244. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  245. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  246. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
  247. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  248. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  249. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  250. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  251. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  252. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  253. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  254. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  255. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  256. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +17 -0
  257. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  258. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  259. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  260. package/views/BreakpointsOwner.js +1 -1
  261. package/views/DOMContainer.js +1 -1
  262. package/views/PopupView.js +1 -1
  263. package/views/VideoView.js +1 -1
  264. package/views/Viewport2DBaseMixin.js +1 -1
  265. package/views/Viewport2DMixin.js +1 -1
  266. package/views/draw/DrawGraphicTool.js +1 -1
  267. package/views/draw/DrawScreenTool.js +1 -1
  268. package/views/draw/DrawTool.js +1 -1
  269. package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
  270. package/views/layers/CatalogDynamicGroupLayerView.js +1 -1
  271. package/views/layers/CatalogFootprintLayerView.js +1 -1
  272. package/views/layers/CatalogLayerView.js +1 -1
  273. package/views/layers/DimensionLayerView.js +1 -1
  274. package/views/layers/FeatureLayerView.js +1 -1
  275. package/views/layers/ImageryLayerView.js +1 -1
  276. package/views/layers/ImageryTileLayerView.js +1 -1
  277. package/views/layers/LineOfSightLayerView.js +1 -1
  278. package/views/layers/MapImageLayerView.js +1 -1
  279. package/views/layers/MediaLayerView.js +1 -1
  280. package/views/layers/OGCFeatureLayerView.js +1 -1
  281. package/views/layers/PointCloudLayerView.js +1 -1
  282. package/views/layers/RefreshableLayerView.js +1 -1
  283. package/views/layers/StreamLayerView.js +1 -1
  284. package/views/layers/ViewshedLayerView.js +1 -1
  285. package/views/layers/WMSLayerView.js +1 -1
  286. package/views/support/Scheduler.js +1 -1
  287. package/views/video/VideoOperationalDataView.js +1 -1
  288. package/views/webgl/BufferObject.js +1 -1
  289. package/views/webgl/Program.js +1 -1
  290. package/views/webgl/Renderbuffer.js +1 -1
  291. package/views/webgl/Texture.js +1 -1
  292. package/views/webgl/Util.js +1 -1
  293. package/webscene/SunLighting.js +1 -1
  294. package/webscene/VirtualLighting.js +1 -1
  295. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  296. package/widgets/Directions/DirectionsSearchTool.js +1 -1
  297. package/widgets/Editor/EditorViewModel.js +1 -1
  298. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  299. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  300. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  301. package/widgets/Feature/support/FeatureContentMixin.js +1 -1
  302. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  303. package/widgets/FeatureTable/support/EditableColumnTemplateMixin.js +1 -1
  304. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  305. package/widgets/OrientedImageryViewer/mixins/ImageMeasurementMixin.js +1 -1
  306. package/widgets/OrientedImageryViewer/mixins/SketchHandlerMixin.js +1 -1
  307. package/widgets/OrientedImageryViewer/mixins/TriangulatedImageMeasurementMixin.js +1 -1
  308. package/widgets/OrientedImageryViewer/mixins/TriangulatedSketchHandlerMixin.js +1 -1
  309. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  310. package/widgets/PanoramicViewer/PanoramicZoomConditions.js +1 -1
  311. package/widgets/PanoramicViewer.js +1 -1
  312. package/widgets/Sketch/support/ResponsiveToolbar/ToolbarGroupBase.js +1 -1
  313. package/widgets/support/GoTo.js +1 -1
  314. package/assets/esri/core/workers/chunks/0202c2ac73354e3970b2.js +0 -1
  315. package/assets/esri/core/workers/chunks/02dc6e31b1244e5bb785.js +0 -1
  316. package/assets/esri/core/workers/chunks/080c79d6caca3b6a2db2.js +0 -1
  317. package/assets/esri/core/workers/chunks/084236ca316aad980192.js +0 -1
  318. package/assets/esri/core/workers/chunks/0b484224a92b52c34330.js +0 -1
  319. package/assets/esri/core/workers/chunks/0f6203ae32663b2b52db.js +0 -1
  320. package/assets/esri/core/workers/chunks/16a78f5a82f5ca163816.js +0 -1
  321. package/assets/esri/core/workers/chunks/1cc30073f8200b67cff6.js +0 -1
  322. package/assets/esri/core/workers/chunks/1d75cb1747ffb7b8b050.js +0 -1
  323. package/assets/esri/core/workers/chunks/242b216d61940aebe8e1.js +0 -1
  324. package/assets/esri/core/workers/chunks/32756905bcf11699b3f7.js +0 -1
  325. package/assets/esri/core/workers/chunks/35d238a5a6501f89bed7.js +0 -1
  326. package/assets/esri/core/workers/chunks/36a2a8b6547604bad2ab.js +0 -1
  327. package/assets/esri/core/workers/chunks/3fcd73ba832cb53d3a07.js +0 -1
  328. package/assets/esri/core/workers/chunks/40c1d65039c8f1d6afa0.js +0 -1
  329. package/assets/esri/core/workers/chunks/49dce142ad1ea4c01d00.js +0 -1
  330. package/assets/esri/core/workers/chunks/4b89d5b9e35bf79b321e.js +0 -1
  331. package/assets/esri/core/workers/chunks/4c47d327815e281c457e.js +0 -1
  332. package/assets/esri/core/workers/chunks/4ea96aff38bb301dc40d.js +0 -346
  333. package/assets/esri/core/workers/chunks/54a49a25845897a15ab1.js +0 -1
  334. package/assets/esri/core/workers/chunks/576e408fb0834f3948e8.js +0 -1
  335. package/assets/esri/core/workers/chunks/5ce62d9fff80d014d186.js +0 -1
  336. package/assets/esri/core/workers/chunks/5e805c9e9012dd39ec86.js +0 -1
  337. package/assets/esri/core/workers/chunks/6136bf09950adc46bc33.js +0 -1
  338. package/assets/esri/core/workers/chunks/666afe669866c44830bd.js +0 -1
  339. package/assets/esri/core/workers/chunks/6a0fbc54638f7de138c1.js +0 -1
  340. package/assets/esri/core/workers/chunks/7d0c4e1518a6a63a3f87.js +0 -1
  341. package/assets/esri/core/workers/chunks/843b6029d4c13115e1ac.js +0 -1
  342. package/assets/esri/core/workers/chunks/86d6007c45f2aa643ac8.js +0 -1
  343. package/assets/esri/core/workers/chunks/8bf04be4052bf148777a.js +0 -1
  344. package/assets/esri/core/workers/chunks/8ea34878a1ef24b4ded3.js +0 -1
  345. package/assets/esri/core/workers/chunks/8eea6251aa09725e654e.js +0 -1
  346. package/assets/esri/core/workers/chunks/90145d49a0cec902435c.js +0 -1
  347. package/assets/esri/core/workers/chunks/916691122d7fb38497d6.js +0 -1
  348. package/assets/esri/core/workers/chunks/92ad9098006568358550.js +0 -1
  349. package/assets/esri/core/workers/chunks/9ae18a17f62d91167202.js +0 -1
  350. package/assets/esri/core/workers/chunks/9c510df592befb9ff892.js +0 -1
  351. package/assets/esri/core/workers/chunks/a273f80298417edecc07.js +0 -1
  352. package/assets/esri/core/workers/chunks/a2ed7a3cd518dd136ec7.js +0 -1
  353. package/assets/esri/core/workers/chunks/a6a7279b09d7962147ec.js +0 -1
  354. package/assets/esri/core/workers/chunks/aba520714efc01bead36.js +0 -1
  355. package/assets/esri/core/workers/chunks/acb9c166259872828646.js +0 -1
  356. package/assets/esri/core/workers/chunks/accff253af360c34e8a8.js +0 -1
  357. package/assets/esri/core/workers/chunks/ae6eed26fc932bc08356.js +0 -1
  358. package/assets/esri/core/workers/chunks/b32c1b60896a72e0ae90.js +0 -1
  359. package/assets/esri/core/workers/chunks/b4bb461955a4c2bce072.js +0 -1
  360. package/assets/esri/core/workers/chunks/b98279213f45a0c27600.js +0 -1
  361. package/assets/esri/core/workers/chunks/ba5b24beebeb703b5919.js +0 -1
  362. package/assets/esri/core/workers/chunks/bd7d19ba0c7d9143a455.js +0 -1
  363. package/assets/esri/core/workers/chunks/bffaf1f20f18c75fad4e.js +0 -1
  364. package/assets/esri/core/workers/chunks/c4f8da6c238eb5e91f91.js +0 -1
  365. package/assets/esri/core/workers/chunks/cdabea4718a7e7d34cb8.js +0 -1
  366. package/assets/esri/core/workers/chunks/ce7155ae63e7bb74be00.js +0 -1
  367. package/assets/esri/core/workers/chunks/d45383d76ba99718b6d9.js +0 -1
  368. package/assets/esri/core/workers/chunks/d915d0a30d9beb24bd3a.js +0 -1
  369. package/assets/esri/core/workers/chunks/d9a23fb0c6c936d5e8ec.js +0 -1
  370. package/assets/esri/core/workers/chunks/dc6538a2d5a1e60d0209.js +0 -1
  371. package/assets/esri/core/workers/chunks/dca633ae3bfd4a3f9bb3.js +0 -1
  372. package/assets/esri/core/workers/chunks/dfa7976085f7408a366c.js +0 -1
  373. package/assets/esri/core/workers/chunks/e0a5b499b3ae38c21278.js +0 -1
  374. package/assets/esri/core/workers/chunks/e1a20ba7d6279f59adc0.js +0 -1
  375. package/assets/esri/core/workers/chunks/e49a135a2933306a6105.js +0 -1
  376. package/assets/esri/core/workers/chunks/e9a9174c4d1a0a9effb6.js +0 -1
  377. package/assets/esri/core/workers/chunks/edead1a123860cc74b1b.js +0 -1
  378. package/assets/esri/core/workers/chunks/f90573c9dc36e51cd588.js +0 -1
  379. package/assets/esri/core/workers/chunks/fa9658dbfb921f9c13af.js +0 -1
  380. package/assets/esri/core/workers/chunks/fb5e2b1ced03eef28e96.js +0 -1
  381. package/assets/esri/core/workers/chunks/fd8f4eabb8bbc593dd9c.js +0 -1
  382. package/assets/esri/core/workers/chunks/fe1902d63f610cebd947.js +0 -1
  383. package/core/HeapSort.js +0 -5
  384. package/layers/graphics/controllers/StreamController.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{getTimeOperator as i}from"../../../../layers/graphics/data/timeSupport.js";import s from"../../../../layers/support/FeatureFilter.js";import{combineTimeExtent as n}from"../../../../layers/support/timeSupport.js";import{getCachedAttributeValue as o}from"../i3s/I3SBinaryReader.js";import{filterInPlace as l}from"../i3s/I3SUtil.js";const u=i=>{let o=class extends i{get timeExtent(){return n(this.i3slayer,this.view?.timeExtent,this._get("timeExtent"))}get mergedFilter(){const{filter:t,timeExtent:e}=this;if(null==e)return t;const r=t?.clone()??new s;return null!=e&&(r.timeExtent=r.timeExtent?.intersection(e)??e),r}getTimeFilterDependencies(){const{timeInfo:t}=this.i3slayer;if(null==t)return[];const{startField:e,endField:r}=t;return[e,r]}addTimeFilter(t,e){if(null==e)return;const{timeInfo:r}=this.i3slayer;if(null==r)return;const{startField:i,endField:s,useTime:n}=r;if(!n||null==i&&null==s)return;const o=r.toJSON(),l=e.toJSON();t.push((t,e)=>a(t,e,o,l))}};return t([e({readOnly:!0})],o.prototype,"timeExtent",null),t([e()],o.prototype,"mergedFilter",null),o=t([r("esri.views.3d.layers.support.TemporalSceneLayerView")],o),o};function a(t,e,r,s){const n=e.attributeInfo?.attributeData;if(null==n)return;const{startTimeField:o,endTimeField:u}=r;if(!!(null!=o&&null==n[o]||null!=u&&null==n[u]))return;const a=i(r,s,new m(n));if(null==a)return;const{featureIds:p}=e;l(t,p,a)}class m{constructor(t){this.attributeData=t}getAttribute(t,e){return o(this.attributeData[e],t)}getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}}export{u as TemporalSceneLayerView};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{getTimeOperator as i}from"../../../../layers/graphics/data/timeSupport.js";import s from"../../../../layers/support/FeatureFilter.js";import{combineTimeExtent as n}from"../../../../layers/support/timeSupport.js";import{getCachedAttributeValue as o}from"../i3s/I3SBinaryReader.js";import{filterInPlace as l}from"../i3s/I3SUtil.js";const u=i=>{const o=i;let l=class extends o{get timeExtent(){return n(this.i3slayer,this.view?.timeExtent,this._get("timeExtent"))}get mergedFilter(){const{filter:t,timeExtent:e}=this;if(null==e)return t;const r=t?.clone()??new s;return null!=e&&(r.timeExtent=r.timeExtent?.intersection(e)??e),r}getTimeFilterDependencies(){const{timeInfo:t}=this.i3slayer;if(null==t)return[];const{startField:e,endField:r}=t;return[e,r]}addTimeFilter(t,e){if(null==e)return;const{timeInfo:r}=this.i3slayer;if(null==r)return;const{startField:i,endField:s,useTime:n}=r;if(!n||null==i&&null==s)return;const o=r.toJSON(),l=e.toJSON();t.push((t,e)=>a(t,e,o,l))}};return t([e({readOnly:!0})],l.prototype,"timeExtent",null),t([e()],l.prototype,"mergedFilter",null),l=t([r("esri.views.3d.layers.support.TemporalSceneLayerView")],l),l};function a(t,e,r,s){const n=e.attributeInfo?.attributeData;if(null==n)return;const{startTimeField:o,endTimeField:u}=r;if(!!(null!=o&&null==n[o]||null!=u&&null==n[u]))return;const a=i(r,s,new m(n));if(null==a)return;const{featureIds:p}=e;l(t,p,a)}class m{constructor(t){this.attributeData=t}getAttribute(t,e){return o(this.attributeData[e],t)}getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}}export{u as TemporalSceneLayerView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{isAborted as r,createAbortError as t}from"../../../../core/promiseUtils.js";import{isRefreshableLayer as s}from"../../../../layers/mixins/RefreshableLayer.js";import{useFetchTileForLayer as o}from"../../terrain/terrainUtils.js";async function i(i,a,l){const m=i.layer;if(o(m)){const s=await m.fetchTile(a[0],a[1],a[2],l);if(r(l))throw e.getLogger(i).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),t();return s}let n=i.getTileUrl(a);s(m)&&m.refreshTimestamp&&(n+=`${n.includes("?")?"&":"?"}_ts=${m.refreshTimestamp}`);const f=i.hasMixedImageFormats?"image+type":"image";return l.requester.request(n,f,l)}export{i as fetchTile};
5
+ import e from"../../../../core/Logger.js";import{isAborted as r,createAbortError as t}from"../../../../core/promiseUtils.js";import{isRefreshableLayer as s}from"../../../../layers/mixins/RefreshableLayer.js";import{DocType as o}from"../../support/index.js";import{useFetchTileForLayer as i}from"../../terrain/terrainUtils.js";async function a(a,n,l){const m=a.layer;if(i(m)){const s=await m.fetchTile(n[0],n[1],n[2],l);if(r(l))throw e.getLogger(a).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),t();return s}let f=a.getTileUrl(n);s(m)&&m.refreshTimestamp&&(f+=`${f.includes("?")?"&":"?"}_ts=${m.refreshTimestamp}`);const c=a.hasMixedImageFormats?o.IMAGE_AND_TYPE:o.IMAGE;return l.requester.request(f,c,l)}export{a as fetchTile};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{Milliseconds as o}from"../../../core/time.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedView as y}from"./MemoryManagedView.js";import{makeBudget as l}from"../../support/Scheduler.js";function m(e){return new g({view:e})}const u=.1,n=1,c=1,_=.75,p=.6,M=1.3;let g=class extends t{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._predictedMemory=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=750,this._additionalCacheMemory=0,this.addHandles(a({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){null==e||e<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<e&&this._updateQuality(n),this._maxMemory=e)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(e){null!=e&&(this._additionalCacheMemory=e)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(e,t,i){return new r(e,this._cacheStorage,t,i)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._predictedMemory<=0&&!this._updating)return;let e=this._layersUpdating();if(this._predictedMemory<p&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(n);else if(e){if(this._predictedMemory>1.1*c||this._usedMemory>c)if(this._stableQuality>0)this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality);else if(this._quality>u&&this._downscaleMemoryUsed<this._usedMemory){if(this._compactAndUpdate())return;this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1}}else if(this._downscaleMemoryUsed=0,this._usedMemory>c){if(this._compactAndUpdate())return;this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._predictedMemory}else if(this._stableQuality!==this._quality)if(this._usedMemory<_&&this._quality<n){this._stableQuality=this._quality;const t=.05;e=this._updateQuality(this._quality+t)}else this._quality<1&&(this._canFastRecover=!0);this._updating=e}_compactAndUpdate(){const e=l(o(100)),t=this.view.stage.compact(e);return this.view.basemapTerrain.overlayManager.renderer.compact(e)||t}_updateQuality(e){return(e=Math.min(Math.max(e,u),n))!==this._quality&&(this._quality=e,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some(e=>!!e.updating)}_updateMemory(){if(!this.view)return;this.view.stage?.renderer?.tick();const e=this.view.stage?.renderer?.usedMemory;let t=(this.view.basemapTerrain?.usedMemory??0)+(e?e.fbos+e.edges+e.plugins:0),s=0;this.view.allLayerViews&&this.view.allLayerViews.forEach(e=>{if(y(e)){const i=e.ignoresMemoryFactor?this._quality:1;t+=e.usedMemory*i,s+=e.unloadedMemory*i}});const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&r){this._warnMemoryUsage=t;const e=e=>(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${e(a)} Current: ${e(t)} Projected: ${e(t+s)} Quality: ${r}%`)}this._usedMemory=t/a,this._predictedMemory=(t+s)/a;const o=a-t;this._cacheStorage.maxSize=Math.max(0,o+1048576*this.additionalCacheMemory)}get test(){}};e([h({constructOnly:!0})],g.prototype,"view",void 0),e([h()],g.prototype,"maxMemory",null),e([h()],g.prototype,"additionalCacheMemory",null),e([h({readOnly:!0})],g.prototype,"memoryFactor",null),e([h({readOnly:!0})],g.prototype,"updating",null),e([h({readOnly:!0})],g.prototype,"usedMemory",null),e([h({readOnly:!0})],g.prototype,"usedCacheMemory",null),e([h()],g.prototype,"_quality",void 0),e([h()],g.prototype,"_usedMemory",void 0),e([h()],g.prototype,"_updating",void 0),e([h()],g.prototype,"_stableQuality",void 0),e([h()],g.prototype,"_maxMemory",void 0),e([h()],g.prototype,"_additionalCacheMemory",void 0),g=e([d("esri.views.3d.support.MemoryController")],g);export{u as minQuality,m as newMemoryController};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{Milliseconds as o}from"../../../core/time.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedView as y}from"./MemoryManagedView.js";import{makeBudget as l}from"../../support/Scheduler.js";function m(e){return new w({view:e})}const u=.1,n=1,c=1,_=.75,p=.6,M=1.3,g=!!has("esri-tests-disable-memory-pools");let w=class extends t{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._predictedMemory=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=g?4096:750,this._additionalCacheMemory=g?-4096:0,this.addHandles(a({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){null==e||e<=0||g||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<e&&this._updateQuality(n),this._maxMemory=e)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(e){null==e||g||(this._additionalCacheMemory=e)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(e,t,i){return new r(e,this._cacheStorage,t,i)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._predictedMemory<=0&&!this._updating)return;let e=this._layersUpdating();if(this._predictedMemory<p&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(n);else if(e){if(this._predictedMemory>1.1*c||this._usedMemory>c)if(this._stableQuality>0)this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality);else if(this._quality>u&&this._downscaleMemoryUsed<this._usedMemory){if(this._compactAndUpdate())return;this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1}}else if(this._downscaleMemoryUsed=0,this._usedMemory>c){if(this._compactAndUpdate())return;this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._predictedMemory}else if(this._stableQuality!==this._quality)if(this._usedMemory<_&&this._quality<n){this._stableQuality=this._quality;const t=.05;e=this._updateQuality(this._quality+t)}else this._quality<1&&(this._canFastRecover=!0);this._updating=e}_compactAndUpdate(){const e=l(o(100)),t=this.view.stage.compact(e);return this.view.basemapTerrain.overlayManager.renderer.compact(e)||t}_updateQuality(e){return(e=Math.min(Math.max(e,u),n))!==this._quality&&(this._quality=e,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some(e=>!!e.updating)}_updateMemory(){if(!this.view)return;this.view.stage?.renderer?.tick();const e=this.view.stage?.renderer?.usedMemory;let t=(this.view.basemapTerrain?.usedMemory??0)+(e?e.fbos+e.edges+e.plugins:0)+this.view.labeler?.usedMemory,s=0;this.view.allLayerViews&&this.view.allLayerViews.forEach(e=>{if(y(e)){const i=e.ignoresMemoryFactor?this._quality:1;t+=e.usedMemory*i,s+=e.unloadedMemory*i}});const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&r){this._warnMemoryUsage=t;const e=e=>(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${e(a)} Current: ${e(t)} Projected: ${e(t+s)} Quality: ${r}%`)}this._usedMemory=t/a,this._predictedMemory=(t+s)/a;const o=a-t;this._cacheStorage.maxSize=Math.max(0,o+1048576*this.additionalCacheMemory)}get test(){}};e([h({constructOnly:!0})],w.prototype,"view",void 0),e([h()],w.prototype,"maxMemory",null),e([h()],w.prototype,"additionalCacheMemory",null),e([h({readOnly:!0})],w.prototype,"memoryFactor",null),e([h({readOnly:!0})],w.prototype,"updating",null),e([h({readOnly:!0})],w.prototype,"usedMemory",null),e([h({readOnly:!0})],w.prototype,"usedCacheMemory",null),e([h()],w.prototype,"_quality",void 0),e([h()],w.prototype,"_usedMemory",void 0),e([h()],w.prototype,"_updating",void 0),e([h()],w.prototype,"_stableQuality",void 0),e([h()],w.prototype,"_maxMemory",void 0),e([h()],w.prototype,"_additionalCacheMemory",void 0),w=e([d("esri.views.3d.support.MemoryController")],w);export{u as minQuality,m as newMemoryController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{makeHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{removeMaybe as s,destroyMaybe as o}from"../../../core/maybe.js";import{watch as a,sync as i}from"../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../core/scheduling.js";import{signal as l}from"../../../core/signal.js";import{secondsFromMilliseconds as d}from"../../../core/time.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{maxDownloadSlots as u,downloadSlotsPerClient as p}from"./index.js";import{newMemoryController as c}from"./MemoryController.js";import{StreamDataLoader as _}from"./StreamDataLoader.js";import{ImmediateTask as g,newScheduler as y,TaskPriority as v}from"../../support/Scheduler.js";let f=class extends t{constructor(){super(...arguments),this.updating=!1}};function j(e){return new T({view:e})}e([n({readOnly:!0})],f.prototype,"updating",void 0),f=e([h("esri.views.3d.support.ResourceController.ResourceControllerMain")],f);let T=class extends f{constructor(){super(...arguments),this._immediateTask=g,this._normalTask=g,this._updatingObjects=l([]),this._frameTask=null}get immediate(){return this._immediateTask}get normal(){return this._normalTask}initialize(){this._scheduler=y(),this._memoryController=c(this.view),this._streamDataLoader=new _,this._streamDataLoader.setup(u,p,this._scheduler),this.addHandles([a(()=>this.view.state?.mode,e=>{null!=e&&(this._scheduler.state=e)},i),a(()=>this.view.stationary,()=>this._stationaryChangedHandler())]),this._frameTask=m({update:e=>this._frame(e)}),this._immediateTask=this._scheduler.registerTask(v.RESOURCE_CONTROLLER_IMMEDIATE),this._normalTask=this._scheduler.registerTask(v.RESOURCE_CONTROLLER)}destroy(){this._immediateTask.remove(),this._normalTask.remove(),this._frameTask=s(this._frameTask),this._streamDataLoader=o(this._streamDataLoader),this._memoryController=o(this._memoryController),this._scheduler=o(this._scheduler),this.view=null}get updating(){return!!(this._memoryController?.updating||this._streamDataLoader?.updating||this._immediateTask?.updating)||this._updatingObjects?.value.some(e=>e.updating)}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}createStreamDataRequester(e){const t=this._streamDataLoader;return{request:(r,s,o)=>t.request(r,s,e,o),get busy(){return!t.hasDownloadSlots(e)}}}addUpdatingObject(e){const t=this._updatingObjects;return t.value=[...t.value,e],r(()=>{t.value=t.value.filter(t=>t!==e)})}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(d(e.deltaTime)),!this._scheduler)||(this._memoryController.update(),this._scheduler.frame(e))}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}get test(){}};e([n()],T.prototype,"view",void 0),e([n()],T.prototype,"_scheduler",void 0),e([n()],T.prototype,"_memoryController",void 0),e([n()],T.prototype,"_streamDataLoader",void 0),e([n()],T.prototype,"_immediateTask",void 0),e([n()],T.prototype,"_normalTask",void 0),e([n({readOnly:!0})],T.prototype,"updating",null),T=e([h("esri.views.3d.support.ResourceController")],T);export{j as newResourceController};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{makeHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{removeMaybe as s,destroyMaybe as o}from"../../../core/maybe.js";import{watch as a,sync as i}from"../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../core/scheduling.js";import{signal as l}from"../../../core/signal.js";import{secondsFromMilliseconds as d}from"../../../core/time.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{maxDownloadSlots as p,downloadSlotsPerClient as u}from"./index.js";import{newMemoryController as c}from"./MemoryController.js";import{StreamDataLoader as _}from"./StreamDataLoader.js";import{StreamDataRequesterImpl as g}from"./StreamDataRequester.js";import{ImmediateTask as y,newScheduler as v,TaskPriority as f}from"../../support/Scheduler.js";let j=class extends t{constructor(){super(...arguments),this.updating=!1}};function T(e){return new C({view:e})}e([n({readOnly:!0})],j.prototype,"updating",void 0),j=e([h("esri.views.3d.support.ResourceController.ResourceControllerMain")],j);let C=class extends j{constructor(){super(...arguments),this._immediateTask=y,this._normalTask=y,this._updatingObjects=l([]),this._frameTask=null}get immediate(){return this._immediateTask}get normal(){return this._normalTask}initialize(){this._scheduler=v(),this._memoryController=c(this.view),this._streamDataLoader=new _,this._streamDataLoader.setup(p,u,this._scheduler),this.addHandles([a(()=>this.view.state?.mode,e=>{null!=e&&(this._scheduler.state=e)},i),a(()=>this.view.stationary,()=>this._stationaryChangedHandler())]),this._frameTask=m({update:e=>this._frame(e)}),this._immediateTask=this._scheduler.registerTask(f.RESOURCE_CONTROLLER_IMMEDIATE),this._normalTask=this._scheduler.registerTask(f.RESOURCE_CONTROLLER)}destroy(){this._immediateTask.remove(),this._normalTask.remove(),this._frameTask=s(this._frameTask),this._streamDataLoader=o(this._streamDataLoader),this._memoryController=o(this._memoryController),this._scheduler=o(this._scheduler),this.view=null}get updating(){return!!(this._memoryController?.updating||this._streamDataLoader?.updating||this._immediateTask?.updating)||this._updatingObjects?.value.some(e=>e.updating)}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}createStreamDataRequester(e){return new g(this._streamDataLoader,e)}addUpdatingObject(e){const t=this._updatingObjects;return t.value=[...t.value,e],r(()=>{t.value=t.value.filter(t=>t!==e)})}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(d(e.deltaTime)),!this._scheduler)||(this._memoryController.update(),this._scheduler.frame(e))}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}get test(){}};e([n()],C.prototype,"view",void 0),e([n()],C.prototype,"_scheduler",void 0),e([n()],C.prototype,"_memoryController",void 0),e([n()],C.prototype,"_streamDataLoader",void 0),e([n()],C.prototype,"_immediateTask",void 0),e([n()],C.prototype,"_normalTask",void 0),e([n({readOnly:!0})],C.prototype,"updating",null),C=e([h("esri.views.3d.support.ResourceController")],C);export{T as newResourceController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../request.js";import s from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import{removeMaybe as n,abortMaybe as i,destroyMaybe as u}from"../../../core/maybe.js";import{createResolver as l,createAbortError as h,onAbort as d,throwIfAborted as c,isAbortError as m}from"../../../core/promiseUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{AsyncWorkerQueue as g,BaseTask as f}from"./AsyncWorkerQueue.js";import{ImageWithType as k}from"./ImageWithType.js";import{isImageWithType as L}from"../terrain/TerrainData.js";import{assert as b}from"../webgl-engine/lib/Util.js";import{TaskPriority as D}from"../../support/Scheduler.js";let y=class extends s{constructor(){super(...arguments),this._tasks=new Map,this._onLoadQueue=new Array,this._doneQueue=new Array,this.updating=!1}setup(e,t,s){this._loadQueue=new g((e,t)=>this._startLoading(e,t),(e,t)=>this._doneLoadingCB(e,t),e,t),s&&(this._frameTask=s.registerTask(D.STREAM_DATA_LOADER,this))}destroy(){this._frameTask=n(this._frameTask),this._tasks.forEach(e=>i(e.abortController)),this._loadQueue=u(this._loadQueue),this._onLoadQueue.length=0,this._onLoadQueue=null,this._doneQueue.length=0,this._doneQueue=null,this._tasks.forEach(e=>e.destroy()),this._tasks.clear(),this._tasks=null}hasDownloadSlots(e){return this._loadQueue.hasQuota(e)}request(e,t,s,r={}){const o=l();return o.__signal=null!=r?r.signal:null,this._createOrUpdateTask(e,t,s,r,o),o.promise}_createTask(e,t,s,r,o,a){const n=new A(e,t,s,r,o);return this._updateTask(n,a),this._tasks.set(o,n),1===this._tasks.size&&this._set("updating",!0),this._loadQueue.push(n),n}_cancelRequest(e,t){const s=this._tasks.get(e);s&&(r(s.resolvers,t),t.reject(h()),0===s.resolvers.length&&(s.status===j.DOWNLOADING&&this._loadQueue.cancel(s),s.status=j.CANCELLED,this._removeTask(s)))}_updateTask(e,t){e.resolvers.push(t)}_createOrUpdateTask(e,t,s,r,o){const a=O(r?.uid||e,t,s);let n=this._tasks.get(a);return n?(this._updateTask(n,o),n):(n=this._createTask(e,r,t,s,a,o),n.abortHandle=d(r,()=>this._cancelRequest(a,o)),n)}_doneLoadingCB(e,t){this._loadQueue&&(b(e.status===j.DOWNLOADING),e.status=j.DOWNLOADED,this._frameTask?this._doneQueue.push({task:e,err:t}):this._doneLoading(e,t))}get running(){return this._doneQueue.length>0||this._onLoadQueue.length>0}runTask(e){for(;!e.done&&this._onLoadQueue.length>0;){const t=this._onLoadQueue.shift();c(t.task.abortController),t.task.abortController=null,t.callback(t.task),e.madeProgress()}for(;!e.done&&this._doneQueue.length>0;){const t=this._doneQueue.shift();t.task.status!==j.DOWNLOADED&&(t.err=t.err||h()),this._doneLoading(t.task,t.err),e.madeProgress()}}_doneLoading(e,t){if(t&&!m(t)&&e.numRetries>0)return--e.numRetries,void this._loadQueue.push(e);let s=L(e.result)||e.result instanceof HTMLImageElement?0:e.resolvers.length;for(const r of e.resolvers)if(t)m(t)?r.reject(t):r.reject(new o("stream-data-loader:request-error",`Failed to request resource at '${e.url}'. ${t}`,{url:e.url,error:t}));else{--s;const t=s>0?a(e.result):e.result;r.resolve(t)}this._removeTask(e)}_removeTask(e){this._tasks.delete(e.key),e.destroy(),0===this._tasks.size&&this._set("updating",!1)}_startLoading(e,s){if(e.status===j.CANCELLED)return!1;let r,o;switch(e.startTime=performance.now(),e.status=j.DOWNLOADING,e.docType){case"binary":o="array-buffer",r=0;break;case"image":o="image";break;case"image+type":o="array-buffer";break;default:o="json"}e.abortController=new AbortController;const a=e.abortController.signal;e.request=t(e.url,{...e.options,responseType:o,timeout:r,signal:a});const n=t=>{e.duration=performance.now()-e.startTime,e.size=t instanceof ArrayBuffer?t.byteLength:e.size||0,e.result=t,this._frameTask?this._onLoadQueue.push({callback:s,task:e}):(e.abortController=null,s(e))},i=t=>{e.status===j.DOWNLOADING&&s(e,t)};return"image+type"!==e.docType?(e.request.then(e=>n(e.data),i),!0):(e.request.then(s=>{const u=s.data,l=Q(u);if(o="image",e.size=u.byteLength,"unknown"===l)return e.request=t(e.url,{responseType:o,timeout:r,signal:a}),void e.request.then(e=>n(e.data),i);const h=new Blob([u],{type:l}),d=window.URL.createObjectURL(h);e.request=t(d,{responseType:o,timeout:r,signal:a}),e.request.then(e=>n(new k(e.data,l)),i).finally(()=>window.URL.revokeObjectURL(d))},i),!0)}get test(){}};e([p({readOnly:!0})],y.prototype,"updating",void 0),y=e([_("esri.views.3d.support.StreamDataLoader")],y);const T={numRetries:0};function Q(e){if(e.byteLength<2)return"unknown";const t=new Uint8Array(e,0,e.byteLength);return 137===t[0]&&80===t[1]?"image/png":71===t[0]&&73===t[1]?"image/gif":66===t[0]&&77===t[1]?"image/bmp":255===t[0]&&216===t[1]?"image/jpeg":"unknown"}class A extends f{constructor(e,t,s,r,o){super(r),this.url=e,this.options=t,this.docType=s,this.key=o,this.abortHandle=null,this.result=null,this.status=j.QUEUED,this.request=null,this.abortController=null,this.resolvers=new Array,this.startTime=0,this.numRetries=T.numRetries}destroy(){this.result=null,this.request=null,this.abortController?.abort(),this.abortController=null,this.resolvers.length=0,this.options=null,this.abortHandle=n(this.abortHandle)}}function O(e,t,s){return`${e}:${t}:${s}`}var j;!function(e){e[e.QUEUED=1]="QUEUED",e[e.DOWNLOADING=2]="DOWNLOADING",e[e.DOWNLOADED=3]="DOWNLOADED",e[e.CANCELLED=4]="CANCELLED"}(j||(j={}));export{y as StreamDataLoader,j as TaskStatus,T as test};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../request.js";import s from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import{removeMaybe as n,abortMaybe as i,destroyMaybe as u}from"../../../core/maybe.js";import{createResolver as l,createAbortError as h,onAbort as d,throwIfAborted as c,isAbortError as m}from"../../../core/promiseUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{AsyncWorkerQueue as g,BaseTask as f}from"./AsyncWorkerQueue.js";import{ImageWithType as k}from"./ImageWithType.js";import{DocType as L}from"./index.js";import{isImageWithType as D}from"../terrain/TerrainData.js";import{assert as b}from"../webgl-engine/lib/Util.js";import{TaskPriority as T}from"../../support/Scheduler.js";let y=class extends s{constructor(){super(...arguments),this._tasks=new Map,this._onLoadQueue=new Array,this._doneQueue=new Array,this.updating=!1}setup(e,t,s){this._loadQueue=new g((e,t)=>this._startLoading(e,t),(e,t)=>this._doneLoadingCB(e,t),e,t),s&&(this._frameTask=s.registerTask(T.STREAM_DATA_LOADER,this))}destroy(){this._frameTask=n(this._frameTask),this._tasks.forEach(e=>i(e.abortController)),this._loadQueue=u(this._loadQueue),this._onLoadQueue.length=0,this._onLoadQueue=null,this._doneQueue.length=0,this._doneQueue=null,this._tasks.forEach(e=>e.destroy()),this._tasks.clear(),this._tasks=null}hasDownloadSlots(e){return this._loadQueue.hasQuota(e)}request(e,t,s,r={}){const o=l();return o.__signal=null!=r?r.signal:null,this._createOrUpdateTask(e,t,s,r,o),o.promise}_createTask(e,t,s,r,o,a){const n=new Q(e,t,s,r,o);return this._updateTask(n,a),this._tasks.set(o,n),1===this._tasks.size&&this._set("updating",!0),this._loadQueue.push(n),n}_cancelRequest(e,t){const s=this._tasks.get(e);s&&(r(s.resolvers,t),t.reject(h()),0===s.resolvers.length&&(s.status===j.DOWNLOADING&&this._loadQueue.cancel(s),s.status=j.CANCELLED,this._removeTask(s)))}_updateTask(e,t){e.resolvers.push(t)}_createOrUpdateTask(e,t,s,r,o){const a=O(r?.uid||e,t,s);let n=this._tasks.get(a);n?this._updateTask(n,o):(n=this._createTask(e,r,t,s,a,o),n.abortHandle=d(r,()=>this._cancelRequest(a,o)))}_doneLoadingCB(e,t){this._loadQueue&&(b(e.status===j.DOWNLOADING),e.status=j.DOWNLOADED,this._frameTask?this._doneQueue.push({task:e,err:t}):this._doneLoading(e,t))}get running(){return this._doneQueue.length>0||this._onLoadQueue.length>0}runTask(e){for(;!e.done&&this._onLoadQueue.length>0;){const t=this._onLoadQueue.shift();c(t.task.abortController),t.task.abortController=null,t.callback(t.task),e.madeProgress()}for(;!e.done&&this._doneQueue.length>0;){const t=this._doneQueue.shift();t.task.status!==j.DOWNLOADED&&(t.err=t.err||h()),this._doneLoading(t.task,t.err),e.madeProgress()}}_doneLoading(e,t){if(t&&!m(t)&&e.numRetries>0)return--e.numRetries,void this._loadQueue.push(e);let s=D(e.result)||e.result instanceof HTMLImageElement?0:e.resolvers.length;for(const r of e.resolvers)if(t)m(t)?r.reject(t):r.reject(new o("stream-data-loader:request-error",`Failed to request resource at '${e.url}'. ${t}`,{url:e.url,error:t}));else{--s;const t=s>0?a(e.result):e.result;r.resolve(t)}this._removeTask(e)}_removeTask(e){this._tasks.delete(e.key),e.destroy(),0===this._tasks.size&&this._set("updating",!1)}_startLoading(e,s){if(e.status===j.CANCELLED)return!1;let r,o;switch(e.startTime=performance.now(),e.status=j.DOWNLOADING,e.docType){case L.BINARY:o="array-buffer",r=0;break;case L.IMAGE:o="image";break;case L.IMAGE_AND_TYPE:o="array-buffer";break;default:o="json"}e.abortController=new AbortController;const a=e.abortController.signal;e.request=t(e.url,{...e.options,responseType:o,timeout:r,signal:a});const n=t=>{e.duration=performance.now()-e.startTime,e.size=t instanceof ArrayBuffer?t.byteLength:e.size||0,e.result=t,this._frameTask?this._onLoadQueue.push({callback:s,task:e}):(e.abortController=null,s(e))},i=t=>{e.status===j.DOWNLOADING&&s(e,t)};return e.docType!==L.IMAGE_AND_TYPE?(e.request.then(e=>n(e.data),i),!0):(e.request.then(s=>{const u=s.data,l=E(u);if(o="image",e.size=u.byteLength,"unknown"===l)return e.request=t(e.url,{responseType:o,timeout:r,signal:a}),void e.request.then(e=>n(e.data),i);const h=new Blob([u],{type:l}),d=window.URL.createObjectURL(h);e.request=t(d,{responseType:o,timeout:r,signal:a}),e.request.then(e=>n(new k(e.data,l)),i).finally(()=>window.URL.revokeObjectURL(d))},i),!0)}get test(){}};e([p({readOnly:!0})],y.prototype,"updating",void 0),y=e([_("esri.views.3d.support.StreamDataLoader")],y);const A={numRetries:0};function E(e){if(e.byteLength<2)return"unknown";const t=new Uint8Array(e,0,e.byteLength);return 137===t[0]&&80===t[1]?"image/png":71===t[0]&&73===t[1]?"image/gif":66===t[0]&&77===t[1]?"image/bmp":255===t[0]&&216===t[1]?"image/jpeg":"unknown"}class Q extends f{constructor(e,t,s,r,o){super(r),this.url=e,this.options=t,this.docType=s,this.key=o,this.abortHandle=null,this.result=null,this.status=j.QUEUED,this.request=null,this.abortController=null,this.resolvers=new Array,this.startTime=0,this.numRetries=A.numRetries}destroy(){this.result=null,this.request=null,this.abortController?.abort(),this.abortController=null,this.resolvers.length=0,this.options=null,this.abortHandle=n(this.abortHandle)}}function O(e,t,s){return`${e}:${t}:${s}`}var j;!function(e){e[e.QUEUED=1]="QUEUED",e[e.DOWNLOADING=2]="DOWNLOADING",e[e.DOWNLOADED=3]="DOWNLOADED",e[e.CANCELLED=4]="CANCELLED"}(j||(j={}));export{y as StreamDataLoader,j as TaskStatus,A as test};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ class t{constructor(t,e){this._loader=t,this._clientType=e}request(t,e,s={}){return this._loader.request(t,e,this._clientType,s)}get busy(){return!this._loader.hasDownloadSlots(this._clientType)}}export{t as StreamDataRequesterImpl};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as e,whenOrAbort as t}from"../../../core/promiseUtils.js";import{isSVG as r}from"../../../core/urlUtils.js";import{TextureCollection as s,TextureRequest as i,TextureHandle as o}from"./TextureCollection.js";import{Texture as n}from"../webgl-engine/lib/Texture.js";import{TextureWrapMode as l}from"../../webgl/enums.js";class a extends s{constructor(e,t,r){super(t,r),this._streamDataRequester=e}async fromUrl(r,s,n){e(n);const l=n?.signal,a=this.makeUid(r,s);let h=this._textureRequests.get(a);if(!h){const e=new AbortController,t=this._streamDataRequester.request(r,"image",{uid:a,signal:e.signal});h=new i,h.abortController=e;const n=h;this._textureRequests.set(a,h),h.textureAsync=t.then(async e=>{const t=this._createTexture(r,e,s);return n.texture=t,n.abortController=null,await t.load(this._stage.renderView.renderingContext),this._stage.addTexture(t),new o(a,t,()=>this._release(a))},e=>{throw n.abortController=null,e})}h.referenceCount++;try{return await t(h.textureAsync,l)}catch(u){throw this._release(a),u}}_createTexture(e,t,s){const i={width:t.width,height:t.height,wrap:{s:l.CLAMP_TO_EDGE,t:l.CLAMP_TO_EDGE},preMultiplyAlpha:!0,reloadable:!0};if(r(e)){if(s||0===t.width&&0===t.height){const e=t.width?t.height/t.width:1;s=s||64,e>1?(t.width=Math.round(s/e),t.height=s):(t.width=s,t.height=Math.round(s*e))}this._stage.renderView?.renderingContext.driverTest.svgPremultipliesAlpha.result&&(i.preMultiplyAlpha=!1)}return new n(t,i)}}export{a as StreamTextureCollection};
5
+ import{throwIfAborted as e,whenOrAbort as t}from"../../../core/promiseUtils.js";import{isSVG as r}from"../../../core/urlUtils.js";import{DocType as s}from"./index.js";import{TextureCollection as i,TextureRequest as o,TextureHandle as n}from"./TextureCollection.js";import{Texture as l}from"../webgl-engine/lib/Texture.js";import{TextureWrapMode as h}from"../../webgl/enums.js";class a extends i{constructor(e,t,r){super(t,r),this._streamDataRequester=e}async fromUrl(r,i,l){e(l);const h=l?.signal,a=this.makeUid(r,i);let u=this._textureRequests.get(a);if(!u){const e=new AbortController,t=this._streamDataRequester.request(r,s.IMAGE,{uid:a,signal:e.signal});u=new o,u.abortController=e;const l=u;this._textureRequests.set(a,u),u.textureAsync=t.then(async e=>{const t=this._createTexture(r,e,i);return l.texture=t,l.abortController=null,await t.load(this._stage.renderView.renderingContext),this._stage.addTexture(t),new n(a,t,()=>this._release(a))},e=>{throw l.abortController=null,e})}u.referenceCount++;try{return await t(u.textureAsync,h)}catch(d){throw this._release(a),d}}_createTexture(e,t,s){const i={width:t.width,height:t.height,wrap:{s:h.CLAMP_TO_EDGE,t:h.CLAMP_TO_EDGE},preMultiplyAlpha:!0,reloadable:!0};if(r(e)){if(s||0===t.width&&0===t.height){const e=t.width?t.height/t.width:1;s=s||64,e>1?(t.width=Math.round(s/e),t.height=s):(t.width=s,t.height=Math.round(s*e))}this._stage.renderView?.renderingContext.driverTest.svgPremultipliesAlpha.result&&(i.preMultiplyAlpha=!1)}return new l(t,i)}}export{a as StreamTextureCollection};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as u}from"../../../../geometry/support/Indices.js";import{ViewingMode as s}from"../../../ViewingMode.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as m}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as p}from"../../webgl-engine/lib/VertexAttribute.js";import{GeometryType as f}from"../../webgl-engine/lib/IntersectableGeometry.js";function b(t,e,r=null){const o=[],n=e.mapPositions;g(e,o);const i=o[0][1].data,a=o[0][1].indices.length,l=u(a);return h(e,o,l),w(e,o,l),D(e,o,l),T(e,o,l),y(e,o,l),E(e,o,l),j(e,o,i),new m(t,o,n,f.Line,r)}function g(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=A(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),l=n?r.slice(0,-3):r;let u=0;for(let s=0;s<i-1;s++)a[u++]=s,a[u++]=s+1;e.push([p.POSITION,new c(l,a,3,n)])}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push([p.COLOR,new c(n??o,r,4)])}function D(t,e,r){t.attributeData.normal&&e.push([p.NORMAL,new c(t.attributeData.normal,r,3)])}function T(t,e,r){null!=t.attributeData.colorFeature&&e.push([p.COLORFEATUREATTRIBUTE,new c([t.attributeData.colorFeature],r,1,!0)])}function w(t,e,r){null==t.attributeData.sizeFeature&&e.push([p.SIZE,new c([t.attributeData.size??1],r,1,!0)])}function y(t,e,r){null!=t.attributeData.sizeFeature&&e.push([p.SIZEFEATUREATTRIBUTE,new c([t.attributeData.sizeFeature],r,1,!0)])}function E(t,e,r){null!=t.attributeData.opacityFeature&&e.push([p.OPACITYFEATUREATTRIBUTE,new c([t.attributeData.opacityFeature],r,1,!0)])}function j(r,o,u){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==s.Global||!r.overlayInfo.spatialReference.isGeographic)return;const m=a(u.length),f=n(r.overlayInfo.spatialReference);for(let t=0;t<m.length;t+=3)i(u,t,m,t,f);const b=u.length/3,g=l(b+1);let h=I,D=F,T=0,w=0;t(h,m[w++],m[w++]),w++,g[0]=0;for(let n=1;n<b+1;++n)n===b&&(w=0),t(D,m[w++],m[w++]),w++,T+=e(h,D),g[n]=T,[h,D]=[D,h];o.push([p.DISTANCETOSTART,new c(g,o[0][1].indices,1,!0)])}function A(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const I=r(),F=r();function R(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach(t=>{const o=t.length,n=a(3*o);t.forEach((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]});const i={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(i)}),r}export{b as createGeometry,R as lineStripsToParameters};
5
+ import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as u}from"../../../../geometry/support/Indices.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{Geometry as p}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";import{GeometryType as g}from"../../webgl-engine/lib/IntersectableGeometry.js";function b(t,e,r=null){const o=[],n=e.mapPositions;h(e,o);const i=o[0][1].data,a=o[0][1].indices.length,l=u(a);return T(e,o,l),w(e,o,l),y(e,o,l),D(e,o,l),A(e,o,l),E(e,o),j(e,o,l),I(e,o,i),new p(t,o,n,g.Line,r)}function h(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=F(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),l=n?r.slice(0,-3):r;let s=0;for(let u=0;u<i-1;u++)a[s++]=u,a[s++]=u+1;e.push([m.POSITION,new f(l,a,3,n)])}function T(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push([m.COLOR,new f(n??o,r,4)])}function y(t,e,r){t.attributeData.normal&&e.push([m.NORMAL,new f(t.attributeData.normal,r,3)])}function D(t,e,r){null!=t.attributeData.colorFeature&&e.push([m.COLORFEATUREATTRIBUTE,new f([t.attributeData.colorFeature],r,1,!0)])}function w(t,e,r){null==t.attributeData.sizeFeature&&e.push([m.SIZE,new f([t.attributeData.size??1],r,1,!0)])}function A(t,e,r){null!=t.attributeData.sizeFeature&&e.push([m.SIZEFEATUREATTRIBUTE,new f([t.attributeData.sizeFeature],r,1,!0)])}function E(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let l=0;l<n-1;l++)i[a++]=l,i[a++]=l+1;e.push([m.TIMESTAMPS,new f(o,i,3)])}function j(t,e,r){null!=t.attributeData.opacityFeature&&e.push([m.OPACITYFEATUREATTRIBUTE,new f([t.attributeData.opacityFeature],r,1,!0)])}function I(r,o,s){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==c.Global||!r.overlayInfo.spatialReference.isGeographic)return;const u=a(s.length),p=n(r.overlayInfo.spatialReference);for(let t=0;t<u.length;t+=3)i(s,t,u,t,p);const g=s.length/3,b=l(g+1);let h=d,T=R,y=0,D=0;t(h,u[D++],u[D++]),D++,b[0]=0;for(let n=1;n<g+1;++n)n===g&&(D=0),t(T,u[D++],u[D++]),D++,y+=e(h,T),b[n]=y,[h,T]=[T,h];o.push([m.DISTANCETOSTART,new f(b,o[0][1].indices,1,!0)])}function F(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const d=r(),R=r();function v(t,e,r){if(null==t||0===t.length)return[];const o=[];return t.forEach((t,n)=>{const i=t.length,l=a(3*i);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const s=null!=r?O(r[n]):void 0,u={attributeData:{position:l,normal:e,timeStamps:s},removeDuplicateStartEnd:!1};o.push(u)}),o}function S(t,e=0,r=.01){const o=[0];for(let i=1;i<t.length;i++){const e=t[i-1],r=t[i],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o.push(o[i-1]+n)}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function O(t){const e=s(3*t.length),r=t[0],o=t[t.length-1];for(let n=0;n<t.length;n++)e[3*n]=t[n],e[3*n+1]=r,e[3*n+2]=o;return e}export{b as createGeometry,S as getLinearTimeStamps,v as lineStripsToParameters,O as timeStampsToAttribute};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as e,createFlowFieldFromData as r,getStreamlines as o}from"../../../2d/engine/flow/dataUtils.js";import i from"../../layers/FlowSubView3D.js";import{createFlowGeometry as n}from"./geometryUtils.js";import{StreamlinesResources3D as l}from"./StreamlinesResources3D.js";let a=class extends i{constructor(t){super(t)}initialize(){this.updatingHandles.add(()=>this.renderedTiles,()=>this.triggerLoad())}async load(t,s){const{simulationSettings:i}=this,{size:a,extent:m,timeExtent:c}=t;if(null==i)return;const u=await e(this.layer,m,a[0],a[1],c,s);if(null==u)return null;const p=r(i,u),d=o(i,p,a[0],a[1]),f=n(this.view,t,d,this.elevationInfo);return new l(d,f)}};a=t([s("esri.views.3d.support.flow.FlowSubViewExtent3D")],a);export{a as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as r,createFlowFieldFromData as s,getStreamlines as o}from"../../../2d/engine/flow/dataUtils.js";import i from"../../layers/FlowSubView3D.js";import{StreamlinesResources3D as n}from"./StreamlinesResources3D.js";let a=class extends i{constructor(t){super(t)}initialize(){this.updatingHandles.add(()=>this.renderedTiles,()=>this.triggerLoad())}async load(t,e){const{simulationSettings:i}=this,{size:a,extent:l,timeExtent:c}=t;if(null==i)return;const m=await r(this.layer,l,a[0],a[1],c,e);if(null==m)return null;const u=s(i,m),p=o(i,u,a[0],a[1]),d=this.createGeometry(t,p);return new n(p,d)}};a=t([e("esri.views.3d.support.flow.FlowSubViewExtent3D")],a);export{a as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{waitTick as e}from"../../../../core/promiseUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{clone as s}from"../../../../geometry/support/aaBoundingRect.js";import{getStreamlines as a,toFlowData as r}from"../../../2d/engine/flow/dataUtils.js";import l from"../../layers/FlowSubView3D.js";import{createFlowGeometry as o}from"./geometryUtils.js";import{createFlowFieldFromDataTiled as n,FlowDataTile as d}from"./loadUtils.js";import{StreamlinesResources3D as u}from"./StreamlinesResources3D.js";import{LayerClass as h}from"../../terrain/LayerClass.js";import{isRasterTile as c}from"../../terrain/TerrainData.js";let p=class extends l{constructor(t){super(t),this._tileData=new Map}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:t,layerIndex:e,layerClass:i})=>{const{renderedTiles:s}=this;null!=s&&e===this._layerIndex&&i===h.MAP&&this._updateFlowDataTile(t)})]),this.updatingHandles.add(()=>this.renderedTiles,t=>{const e=new Map;this.abort(),t?.forEach(t=>{const i=this._tileData.get(t.lij)??this._getFlowDataCopy(t);null!=i&&e.set(t.lij,i)}),this._tileData=e,this.triggerLoad()})}get _layerIndex(){return this.surface.getLayerIndexByUID(h.MAP,this.layerView.uid)}async load(t,i){const{simulationSettings:s,_tileData:r}=this,{size:l,extent:d}=t;if(null==s)return;if(null==r)return;await e({signal:i});const h={tileData:r,width:l[0],height:l[1]},c=n(s,h,d,this.surface.tilingScheme.pixelSize),p=a(s,c,l[0],l[1]),m=o(this.view,t,p,this.elevationInfo);return new u(p,m)}_getFlowDataCopy(t){const{_layerIndex:e}=this;if(null==e)return null;const i=t.getLayerInfo(e,h.MAP);if(i.dataMissing||!t.hasLayerData(e,h.MAP))return null;const{data:a}=i;if(!c(a))return null;const l=r(this.layer.serviceRasterInfo.dataType,a.source);return new d(l.data,l.mask,l.width,l.height,t.lij,s(t.extent))}async _updateFlowDataTile(t){const{_layerIndex:e}=this;if(null==e)return;if(!this.renderedTiles?.has(t))return void(this._tileData.delete(t.lij)&&await this.triggerLoad());const i=this._tileData.get(t.lij),s=this._getFlowDataCopy(t);this._swapFlowData(t.lij,i,s)&&await this.triggerLoad()}_swapFlowData(t,e,i){return(null!=i||null!=e)&&(!(null!=i||!this._tileData.delete(t))||null!=i&&(this._tileData.set(t,i),!0))}};p=t([i("esri.views.3d.support.flow.FlowSubViewTiles3D")],p);export{p as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{waitTick as e}from"../../../../core/promiseUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{clone as a}from"../../../../geometry/support/aaBoundingRect.js";import{getStreamlines as s,toFlowData as r}from"../../../2d/engine/flow/dataUtils.js";import l from"../../layers/FlowSubView3D.js";import{createFlowFieldFromDataTiled as o,FlowDataTile as n}from"./loadUtils.js";import{StreamlinesResources3D as d}from"./StreamlinesResources3D.js";import{LayerClass as u}from"../../terrain/LayerClass.js";import{isRasterTile as h}from"../../terrain/TerrainData.js";let c=class extends l{constructor(t){super(t),this._tileData=new Map}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:t,layerIndex:e,layerClass:i})=>{const{renderedTiles:a}=this;null!=a&&e===this._layerIndex&&i===u.MAP&&this._updateFlowDataTile(t)})]),this.updatingHandles.add(()=>this.renderedTiles,t=>{const e=new Map;this.abort(),t?.forEach(t=>{const i=this._tileData.get(t.lij)??this._getFlowDataCopy(t);null!=i&&e.set(t.lij,i)}),this._tileData=e,this.triggerLoad()})}get _layerIndex(){return this.surface.getLayerIndexByUID(u.MAP,this.layerView.uid)}async load(t,i){const{simulationSettings:a,_tileData:r}=this,{size:l,extent:n}=t;if(null==a)return;if(null==r)return;await e({signal:i});const u={tileData:r,width:l[0],height:l[1]},h=o(a,u,n,this.surface.tilingScheme.pixelSize),c=s(a,h,l[0],l[1]),p=this.createGeometry(t,c);return new d(c,p)}_getFlowDataCopy(t){const{_layerIndex:e}=this;if(null==e)return null;const i=t.getLayerInfo(e,u.MAP);if(i.dataMissing||!t.hasLayerData(e,u.MAP))return null;const{data:s}=i;if(!h(s))return null;const l=r(this.layer.serviceRasterInfo.dataType,s.source);return new n(l.data,l.mask,l.width,l.height,t.lij,a(t.extent))}async _updateFlowDataTile(t){const{_layerIndex:e}=this;if(null==e)return;if(!this.renderedTiles?.has(t))return void(this._tileData.delete(t.lij)&&await this.triggerLoad());const i=this._tileData.get(t.lij),a=this._getFlowDataCopy(t);this._swapFlowData(t.lij,i,a)&&await this.triggerLoad()}_swapFlowData(t,e,i){return(null!=i||null!=e)&&(!(null!=i||!this._tileData.delete(t))||null!=i&&(this._tileData.set(t,i),!0))}};c=t([i("esri.views.3d.support.flow.FlowSubViewTiles3D")],c);export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{destroyMaybe as e,disposeMaybe as t}from"../../../../core/maybe.js";import{Object3D as i}from"../../webgl-engine/lib/Object3D.js";import{UpdatePolicy as s}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as n}from"../../webgl-engine/lib/WebGLLayer.js";class r{constructor(e,t){this.streamlines=e,this._geometries=t,this._object3D=null,this._engineLayer=null}get attached(){return null!=this._object3D&&null!=this._engineLayer}attach(e){const{_geometries:t}=this;if(null==t)return;this.detach();const r=new n(e,{pickable:!1,updatePolicy:s.SYNC}),o=new i({geometries:t});o.visible=!0,r.add(o),this._object3D=o,this._engineLayer=r}detach(){this.attached&&(this._engineLayer=e(this._engineLayer),this._object3D=t(this._object3D))}}export{r as StreamlinesResources3D};
5
+ import{destroyMaybe as e,disposeMaybe as t}from"../../../../core/maybe.js";import{Object3D as i}from"../../webgl-engine/lib/Object3D.js";import{UpdatePolicy as s}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as r}from"../../webgl-engine/lib/WebGLLayer.js";class a{constructor(e,t){this.streamlines=e,this._geometries=t,this._object3D=null,this._engineLayer=null}get attached(){return null!=this._object3D&&null!=this._engineLayer}attach(e){const{_geometries:t}=this;if(null==t)return;this.detach();const a=new r(e,{pickable:!1,updatePolicy:s.SYNC}),n=new i({geometries:t});n.visible=!0,a.add(n),this._object3D=n,this._engineLayer=a}detach(){this.attached&&(this._engineLayer=e(this._engineLayer),this._object3D=t(this._object3D))}setMaterialParameters(e){this.attached&&this._geometries.forEach(t=>t.material.setParameters(e))}}export{a as StreamlinesResources3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zValueInAbsoluteHeightMode as n}from"../../../../support/elevationInfoUtils.js";import{lineStripsToParameters as o,createGeometry as i}from"../engineContent/line.js";import{RibbonLineMaterial as t}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{CapType as s}from"../../webgl-engine/shaders/RibbonLineTechniqueConfiguration.js";function m(r,o,i,t){const{spatialReference:s}=r;return a(i.map(i=>i.map(i=>{const[m,a]=c(i,o),{absoluteZ:f}=n(m,a,0,s,r,t),l=e(m,a,f);return r.renderCoordsHelper.toRenderCoords(l,s,l),l})))}function a(e){const n=o(e),m=new t({width:2,color:r(.1,.2,1,1),innerWidth:1,innerColor:r(.2,.4,1,1),cap:s.ROUND});return n.map(e=>i(m,e))}function c({x:e,y:r},n){const{extent:o,size:[i,t]}=n;return[e/i*o.width+o.xmin,(t-r)/t*o.height+o.ymin]}export{m as createFlowGeometry};
5
+ import e from"../../../../Color.js";import n from"../../../../core/RandomLCG.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{zValueInAbsoluteHeightMode as o}from"../../../../support/elevationInfoUtils.js";import{lineStripsToParameters as r,createGeometry as i}from"../engineContent/line.js";import{RibbonLineMaterial as a}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{Animation as l}from"../../webgl-engine/shaders/AnimatedLine.glsl.js";import{CapType as m}from"../../webgl-engine/shaders/RibbonLineTechniqueConfiguration.js";function s(e,r,i,a,l){const{spatialReference:m}=e,s=i.map(n=>n.map(n=>{const[i,l]=f(n,r),{absoluteZ:s}=o(i,l,0,m,e,a),p=t(i,l,s);return e.renderCoordsHelper.toRenderCoords(p,m,p),p})),g=new n;return p(s,i.map(e=>{const n=e.map(e=>e.t),t=n[Math.floor(g.getIntRange(0,n.length))];for(let o=0;o<n.length;o++)n[o]-=t;return n}),c(l))}function p(e,n,t={}){const o=r(e,void 0,n),l=new a(t);return o.map(e=>i(l,e))}function f({x:e,y:n},t){const{extent:o,size:[r,i]}=t;return[e/r*o.width+o.xmin,(i-n)/i*o.height+o.ymin]}function c(n){return null==n?{}:{color:e.toUnitRGBA(n.color),width:n.trailWidth,cap:m.ROUND,animationSpeed:n.flowSpeed,trailLength:n.trailLength,animation:l.FadingTrail}}export{s as createFlowGeometry,c as materialParametersFromRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- var A;!function(A){A[A.ELEVATION=0]="ELEVATION",A[A.BASEMAP=1]="BASEMAP",A[A.I3S_INDEX=2]="I3S_INDEX",A[A.I3S_DATA=3]="I3S_DATA",A[A.SYMBOLOGY=4]="SYMBOLOGY"}(A||(A={}));const E=(()=>{const E=new Array;return E[A.ELEVATION]=10,E[A.BASEMAP]=10,E[A.I3S_INDEX]=10,E[A.I3S_DATA]=10,E[A.SYMBOLOGY]=5,E})(),I=30;export{A as ClientType,E as downloadSlotsPerClient,I as maxDownloadSlots};
5
+ var A,E;!function(A){A[A.ELEVATION=0]="ELEVATION",A[A.BASEMAP=1]="BASEMAP",A[A.I3S_INDEX=2]="I3S_INDEX",A[A.I3S_DATA=3]="I3S_DATA",A[A.SYMBOLOGY=4]="SYMBOLOGY"}(A||(A={})),function(A){A[A.JSON=0]="JSON",A[A.BINARY=1]="BINARY",A[A.IMAGE=2]="IMAGE",A[A.IMAGE_AND_TYPE=3]="IMAGE_AND_TYPE"}(E||(E={}));const I=(()=>{const E=new Array;return E[A.ELEVATION]=10,E[A.BASEMAP]=10,E[A.I3S_INDEX]=10,E[A.I3S_DATA]=10,E[A.SYMBOLOGY]=5,E})(),S=30;export{A as ClientType,E as DocType,I as downloadSlotsPerClient,S as maxDownloadSlots};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t}from"../../../core/MapUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{watch as n,on as o,syncAndInitial as a,initial as h}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as u,fromTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as m,DrapeSourceType as f,DrapedRenderGroup as y}from"../layers/interfaces.js";import{debugFlags as R}from"../support/debugFlags.js";import{OverlayIndex as b}from"./interfaces.js";import{Overlay as T}from"./Overlay.js";import{OverlayContent as x}from"./OverlayContent.js";import{OverlayRenderTargets as D}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{ShaderOutput as v}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as O}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as E,renderHighlightBuffer as P}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as j}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OITPass as I}from"../webgl-engine/lib/OITPass.js";import{RenderContext as N,defaultRenderOccludedMask as q}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as L}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as V}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as F}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as H}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as U}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as k}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as G}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as z}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as Y,noBudget as X}from"../../support/Scheduler.js";import{FramebufferBit as K,TextureSamplingMode as J}from"../../webgl/enums.js";import{Texture as Q}from"../../webgl/Texture.js";import{TextureDescriptor as Z}from"../../webgl/TextureDescriptor.js";let $=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new i,this._passParameters=new O,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[L.DRAPED_MATERIAL,e=>e!==v.Highlight||this.hasHighlights],[L.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new N(this._rctx,new V(t,e.state.viewingMode),i),this.addHandles([n(()=>s.updating,()=>this.events.emit("content-changed"),a),n(()=>this.spatialReference,e=>this._localOriginFactory=new M(e),a),o(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),n(()=>E(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,h),n(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},h),e.resourceController.scheduler.registerTask(Y.OVERLAY_RENDERER,this)]);const{_bindParameters:l,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,l.slot=L.DRAPED_MATERIAL,l.mainDepth=null,l.camera=d,l.oitPass=I.NONE,l.updateLighting([new G(_())],0,0,U.Immediate)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=s(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new A(this._view.stage.renderView.textures,this._techniques,()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(z)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,e=>e.drapeTargetType===m.WithoutRasterImage)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,e=>e.drapeSourceType===f.Features),this._hasDrapedRasterSource=l(e,e=>e.drapeSourceType===f.RasterImage)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new D(this._stage.renderer.fboCache),this._overlays=[new T,new T]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(j.UPDATE),this._renderTargets=null,this.events.emit("textures-disposed")}getTexture(e){return e===x.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(x.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.notifyChange("rendersOccludedDraped"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(X,e=>e.updatePolicy===k.SYNC)}get isEmpty(){return!R.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,e=>!e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=se,++this._techniques.precompiling;const r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==x.Occluded&&e!==x.Highlight)return!0;if(!this._overlays)return!1;const r=this._overlays[b.INNER];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??v.Color,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?C.Disabled:this.hasWater&&this.renders(x.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(x.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(j.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(t.content===x.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=e===v.Normal?L.DRAPED_WATER:L.DRAPED_MATERIAL,e===v.Highlight&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),t.content===x.Occluded&&(this._renderContext.renderOccludedMask=se),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{t.content===x.ColorNoRasterImage&&e.drapeSourceType===f.RasterImage||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=q,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(this._overlays&&this._renderTargets){for(const e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;for(const e of this._renderTargets.targets){if(r===j.BACKGROUND&&e.content!==x.WaterNormal||e.content===x.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const t=this._drawTarget(b.INNER,e),s=this._drawTarget(b.OUTER,e);(t||s)&&e.fbo.generateMipMap()}}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===v.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===v.Normal?L.DRAPED_WATER:L.DRAPED_MATERIAL,r.content===x.Occluded&&(h.renderOccludedMask=se),!this.renders(r.content))return h.renderOccludedMask=q,!1;const{resolution:d}=t,c=e===b.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==v.Highlight)o.setClearColor(0,0,0,0),o.clear(K.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==x.Occluded&&r.content!==x.Highlight){this._techniques.precompile(F,ie);const r=this._techniques.get(F,ie);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,re[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===v.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),P(o,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=q,!0}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(r.content===x.ColorNoRasterImage&&i.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===v.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(z);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(K.COLOR),s}get _resolution(){return this._overlays?.[b.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?y.MapLayer:y.ViewLayer),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new ee(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],u(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),p(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new Z(e);i.samplingMode=J.NEAREST,this._passParameters.texture=new Q(this._rctx,i,t)}get test(){}};e([d()],$.prototype,"hasHighlights",void 0),e([d()],$.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([d({constructOnly:!0})],$.prototype,"parent",void 0),e([d({readOnly:!0})],$.prototype,"_techniques",null),e([d({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([d()],$.prototype,"isEmpty",null),e([d({readOnly:!0})],$.prototype,"rendersOccludedDraped",null),$=e([c("esri.views.3d.terrain.OverlayRenderer")],$);class ee{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const re=[[1,.5,.5],[.5,.5,1]],te=-2,se=W.OccludeAndTransparent,ie=new H;ie.hasAlpha=!0;export{$ as OverlayRenderer,te as drapedZ,se as overlayRenderOccludedFlag};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t,everyMap as s}from"../../../core/MapUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";import{watch as o,on as a,syncAndInitial as h,initial as l}from"../../../core/reactiveUtils.js";import{someSet as d}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as _}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as f,DrapeSourceType as y,DrapedRenderGroup as R}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as T}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayContent as D}from"./OverlayContent.js";import{OverlayRenderTargets as w}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{ShaderOutput as O}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as S}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as P,renderHighlightBuffer as j}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as A}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as M}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as W}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as I}from"../webgl-engine/lib/Material.js";import{OITPass as N}from"../webgl-engine/lib/OITPass.js";import{RenderContext as q,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as F}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as H}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as U}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as k}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as B}from"../webgl-engine/lighting/Lightsources.js";import{O as z}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as K}from"../../support/Scheduler.js";import{FramebufferBit as J,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends E{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new z,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new S,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[V.DRAPED_MATERIAL,e=>e!==O.Highlight||this.hasHighlights],[V.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new q(this._rctx,new F(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this.spatialReference,e=>this._localOriginFactory=new W(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>P(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(X.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,n.slot=V.DRAPED_MATERIAL,n.mainDepth=null,n.camera=d,n.oitPass=N.NONE,n.updateLighting([new B(m())],0,0,k.Immediate)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=i(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new M(this._view.stage.renderView.textures,this._techniques,()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(Y)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(o(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&d(e,e=>e.drapeTargetType===f.WithoutRasterImage)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d(e,e=>e.drapeSourceType===y.Features),this._hasDrapedRasterSource=d(e,e=>e.drapeSourceType===y.RasterImage)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new w(this._stage.renderer.fboCache),this._overlays=[new x,new x]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(A.UPDATE),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return e===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){return this._useOverlayColorInsteadOfColorNoRasterImage(e)?this._renderTargets?.getTexture(D.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.notifyChange("rendersOccludedDraped"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(K,e=>e.updatePolicy===G.SYNC)}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&s(this._renderers,e=>e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=ie,++this._techniques.precompiling;const r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==D.Occluded&&e!==D.Highlight)return!0;if(!this._overlays)return!1;const r=this._overlays[T.INNER];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??O.Color,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?C.Disabled:this.hasWater&&this.renders(D.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(D.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(A.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(t.content===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=e===O.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL,e===O.Highlight&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),t.content===D.Occluded&&(this._renderContext.renderOccludedMask=ie),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{t.content===D.ColorNoRasterImage&&e.drapeSourceType===y.RasterImage||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=L,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(r===A.BACKGROUND&&s.content!==D.WaterNormal||s.content===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage||s.content===D.Occluded&&t)continue;const e=this._drawTarget(T.INNER,s),i=this._drawTarget(T.OUTER,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===O.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===O.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL,r.content===D.Occluded&&(h.renderOccludedMask=ie),!this.renders(r.content))return h.renderOccludedMask=L,!1;const{resolution:d}=t,c=e===T.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==O.Highlight)o.setClearColor(0,0,0,0),o.clear(J.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==D.Occluded&&r.content!==D.Highlight){this._techniques.precompile(H,ne);const r=this._techniques.get(H,ne);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,te[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===O.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),j(o,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=L,!0}get allSourcesOccluders(){const e=s(this._renderers,e=>e.hasOnlyOccluders);return this._renderers?.size>0&&e}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(r.content===D.ColorNoRasterImage&&i.drapeSourceType===y.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===O.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(Y);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(J.COLOR),s}get _resolution(){return this._overlays?.[T.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?R.MapLayer:R.ViewLayer),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new re(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t)}get test(){}};e([c()],ee.prototype,"hasHighlights",void 0),e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],ee.prototype,"parent",void 0),e([c({readOnly:!0})],ee.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),e([c({readOnly:!0})],ee.prototype,"rendersOccludedDraped",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=I.OccludeAndTransparent,ne=new U;ne.hasAlpha=!0;export{ee as OverlayRenderer,se as drapedZ,ie as overlayRenderOccludedFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{d as c,i as d,e as h}from"../../../chunks/vec32.js";import{ZEROS as u,create as g,fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as _,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as R}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlayContent as x}from"./OverlayContent.js";import{overlayRenderOccludedFlag as v}from"./OverlayRenderer.js";import{PatchRenderData as w}from"./PatchRenderData.js";import{RenderOrder as P}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{TileUpdate as E}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as A,compareTiles as N}from"./tileUtils.js";import{TransparencyMode as B}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as I,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as G}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as F}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as q,ConsumesDepth as M,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as L}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{StoreResults as V}from"../webgl-engine/lib/IntersectorInterfaces.js";import{IntersectorResult as H}from"../webgl-engine/lib/IntersectorResult.js";import{IntersectorType as Y}from"../webgl-engine/lib/IntersectorType.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as W,MeshIntersectionOptions as X,intersectTriangles as K}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as Z}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as $}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ee,getVerticalOffsetTerrain as te}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ie}from"../webgl-engine/materials/DrawParameters.js";import{T as re}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as se}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ne}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ae}from"../../webgl/enums.js";const oe=7,le=10,ce=m();let de=class extends q{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this._compressionTracker=a,this.type=Y.TERRAIN,this.isGround=!0,this._passParameters=new re,this._drawParameters=new ie,this._renderDataPool=new s(w),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=Q.Occlude,this.produces=new Map([[Z.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===B.Opaque],[Z.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===B.Transparent||this.transparency===B.InvisibleWithDraped)],[Z.OCCLUDED_GROUND,()=>this._produces()&&this.renderOccludedFlags===v]]),this._tileSize=256,this._configuration=new ne(t.viewingMode===T.Global),this._tileTextureCache=new r((e,t)=>o.newCache(e,t),"TileTexture"),this.tileGeometryCache=new D(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n(()=>this._overlayRenderer.rendersOccludedDraped,e=>{this.renderOccludedFlags=e?v:Q.Occlude,this.setNeedsRender()},a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerViewUid(){return ee}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,E.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=_(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===E.TEXTURE_FADING?R.FADING:R.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[O.ELEVATION])i.pendingUpdates&=~E.GEOMETRY;e.resetPendingUpdate(E.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=le-oe,i=Math.max(0,Math.floor((e.level-t)/oe)*oe);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=z.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=z.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=z.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==B.Opaque)return;const s=he,n=ue;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,u=e.options.store===V.MIN,g=!!e.results.ground.target,p=te(e.verticalOffset),_=e.tolerance;let f,m=u&&null!=a.distance?a.distance:1/0;const T=e.options,R=T.normalRequired||!T.backfacesTerrain,O=new X(!1,R),x=d=>{const g=d.renderData;if(!g?.vao)return;const x=g.geometry;b(ce,x.boundingBox);const v=g.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(ce));const w=ce;if(ge[0]=i[0]-v[0],ge[1]=i[1]-v[1],ge[2]=i[2]-v[2],!W(w,ge,n,_,m))return;const P=(e,t,i)=>{e.set(this.type,d,t,i),m=u&&null!=a.distance?a.distance:1/0},D=(n,c,d)=>{if((!R||null!=d)&&n>=0&&(T.backfacesTerrain||h(d,s)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(i,r,n))){if((null==l.distance||n<l.distance)&&P(l,n,d),T.isFiltered)return;T.store===V.ALL&&(null==f?(f=new H(e.ray),P(f,n,d),e.results.all.push(f)):n<f.distance&&P(f,n,d)),(null==a.distance||n<a.distance)&&P(a,n,d),T.store!==V.MIN&&(null==o.distance||n>o.distance)&&P(o,n,d)}},S=pe;c(S,r,v);const{indices:C,indexCount:E}=x,j=x.vertexAttributes,A=j.getField($.POSITION,y),N=new L(A.typedBuffer,3,j.stride/4),B=E/3;if(!p&&B>I){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new U(C,0,B,N)),e.intersectionData.intersectRay(ge,S,O,D)}else K(ge,S,0,B,C,N,p,O,D)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,_,m)||g&&this._useStencilForTile(e)?t.skipSubtree():x(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===Z.OCCLUDED_GROUND){if(0===(e.renderOccludedMask&v))return null}else{const t=this.transparency===B.Opaque?Z.OPAQUE_TERRAIN:Z.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===B.Invisible)return null;const r=this._configuration;switch(r.screenSpaceReflections=r.cloudReflections=r.receiveShadows=r.receiveAmbientOcclusion=r.renderOccluded=r.hasHighlightMixTexture=!1,r.overlayMode=this._overlayRenderer.mode,e.output){case G.Color:case G.ColorEmission:{r.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,r.cloudReflections=null!=e.bind.clouds.data,r.receiveShadows=e.bind.shadowMap.ready;const t=e.bind.slot===Z.OCCLUDED_GROUND;return r.renderOccluded=t,r.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case G.Shadow:case G.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(G.Shadow):null;case G.ViewshedShadow:return this._inViewshed?this._acquireTechnique(G.ViewshedShadow):null;case G.Depth:case G.Normal:return this._acquireTechnique(e.output);case G.ObjectAndLayerIdColor:return this._acquireTechnique(G.ObjectAndLayerIdColor);case G.Highlight:return r.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(G.Highlight):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case G.Color:case G.ColorEmission:{const i=e.bind.slot===Z.OCCLUDED_GROUND?x.Occluded:x.Color;this._renderMaterialPass(e,t,i);break}case G.Depth:case G.Normal:this._renderAuxiliaryPass(e,t,x.Color,this._visiblePatchesByOrigin);break;case G.Highlight:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(x.Highlight)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,x.Highlight,this._visiblePatchesByOrigin);break}case G.Shadow:case G.ShadowExcludeHighlight:case G.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case G.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,x.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=p(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll(e=>i.updateTileTexture(e,R.FADING)),this._configuration.tileBlendInput=i.backgroundIsGrid?F.GridComposite:null!=i.backgroundColor?F.ColorComposite:F.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==P.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)A(this.renderOrder,i,t);e.sort((e,t)=>N(e[0],t[0],this.renderOrder)),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.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){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach(r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],ae.TRIANGLES,n,i)}),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=J(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===x.Occluded;o&&(n.bindTexture("tex",r.emptyTexture),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",f));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:u;this._configuration.tileBlendInput===F.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?ae.LINES:ae.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",r.emptyTexture);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(se,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],de.prototype,"_isGlobal",null),e([o()],de.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],de.prototype,"renderingDisabled",null),e([o({value:!0})],de.prototype,"visible",null),e([o()],de.prototype,"renderPatchBorders",null),e([o()],de.prototype,"visualizeNormals",null),e([o()],de.prototype,"cullBackFaces",null),e([o({value:P.FRONT_TO_BACK})],de.prototype,"renderOrder",null),e([o()],de.prototype,"wireframe",null),de=e([l("esri.views.3d.terrain.TerrainRenderer")],de);const he=g(),ue=g(),ge=g(),pe=g();export{de as TerrainRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{d as c,i as d,e as h}from"../../../chunks/vec32.js";import{ZEROS as u,create as g,fromValues as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as _,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as R}from"./LayerClass.js";import{OverlayContent as x}from"./OverlayContent.js";import{overlayRenderOccludedFlag as v}from"./OverlayRenderer.js";import{PatchRenderData as w}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as P}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{TileUpdate as E}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as A,compareTiles as N}from"./tileUtils.js";import{TransparencyMode as B}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as I,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as G}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as F}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as q,ConsumesDepth as M,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as k}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{StoreResults as V}from"../webgl-engine/lib/IntersectorInterfaces.js";import{IntersectorResult as H}from"../webgl-engine/lib/IntersectorResult.js";import{IntersectorType as Y}from"../webgl-engine/lib/IntersectorType.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as W,MeshIntersectionOptions as X,intersectTriangles as K}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as Z}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as $}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ee,getVerticalOffsetTerrain as te}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ie}from"../webgl-engine/materials/DrawParameters.js";import{T as re}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as se}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ne}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ae}from"../../webgl/enums.js";const oe=7,le=10,ce=m();let de=class extends q{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this._compressionTracker=a,this.type=Y.TERRAIN,this.isGround=!0,this._passParameters=new re,this._drawParameters=new ie,this._renderDataPool=new s(w),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=Q.Occlude,this.produces=new Map([[Z.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===B.Opaque],[Z.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===B.Transparent||this.transparency===B.InvisibleWithDraped)],[Z.OCCLUDED_GROUND,()=>this._produces()&&this.renderOccludedFlags===v]]),this._tileSize=256,this._configuration=new ne(t.viewingMode===T.Global),this._tileTextureCache=new r((e,t)=>o.newCache(e,t),"TileTexture"),this.tileGeometryCache=new P(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n(()=>this._overlayRenderer.rendersOccludedDraped,e=>{this.renderOccludedFlags=e?v:Q.Occlude,this.setNeedsRender()},a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:L}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerViewUid(){return ee}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,E.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=_(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===E.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[R.ELEVATION])i.pendingUpdates&=~E.GEOMETRY;e.resetPendingUpdate(E.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=le-oe,i=Math.max(0,Math.floor((e.level-t)/oe)*oe);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=z.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=z.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=z.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==B.Opaque)return;const s=he,n=ue;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,u=e.options.store===V.MIN,g=!!e.results.ground.target,p=te(e.verticalOffset),_=e.tolerance;let f,m=u&&null!=a.distance?a.distance:1/0;const T=e.options,O=T.normalRequired||!T.backfacesTerrain,R=new X(!1,O),x=d=>{const g=d.renderData;if(!g?.vao)return;const x=g.geometry;b(ce,x.boundingBox);const v=g.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(ce));const w=ce;if(ge[0]=i[0]-v[0],ge[1]=i[1]-v[1],ge[2]=i[2]-v[2],!W(w,ge,n,_,m))return;const D=(e,t,i)=>{e.set(this.type,d,t,i),m=u&&null!=a.distance?a.distance:1/0},P=(n,c,d)=>{if((!O||null!=d)&&n>=0&&(T.backfacesTerrain||h(d,s)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(i,r,n))){if((null==l.distance||n<l.distance)&&D(l,n,d),T.isFiltered)return;T.store===V.ALL&&(null==f?(f=new H(e.ray),D(f,n,d),e.results.all.push(f)):n<f.distance&&D(f,n,d)),(null==a.distance||n<a.distance)&&D(a,n,d),T.store!==V.MIN&&(null==o.distance||n>o.distance)&&D(o,n,d)}},S=pe;c(S,r,v);const{indices:C,indexCount:E}=x,j=x.vertexAttributes,A=j.getField($.POSITION,y),N=new k(A.typedBuffer,3,j.stride/4),B=E/3;if(!p&&B>I){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new U(C,0,B,N)),e.intersectionData.intersectRay(ge,S,R,P)}else K(ge,S,0,B,C,N,p,R,P)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,_,m)||g&&this._useStencilForTile(e)?t.skipSubtree():x(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===Z.OCCLUDED_GROUND){if(0===(e.renderOccludedMask&v))return null}else{const t=this.transparency===B.Opaque?Z.OPAQUE_TERRAIN:Z.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===B.Invisible)return null;const r=this._configuration;switch(r.screenSpaceReflections=r.cloudReflections=r.receiveShadows=r.receiveAmbientOcclusion=r.renderOccluded=r.hasHighlightMixTexture=!1,r.overlayMode=this._overlayRenderer.mode,e.output){case G.Color:case G.ColorEmission:{r.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,r.cloudReflections=null!=e.bind.clouds.data,r.receiveShadows=e.bind.shadowMap.ready;const t=e.bind.slot===Z.OCCLUDED_GROUND;return r.renderOccluded=t,r.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case G.Shadow:case G.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(G.Shadow):null;case G.ViewshedShadow:return this._inViewshed?this._acquireTechnique(G.ViewshedShadow):null;case G.Depth:case G.Normal:return this._acquireTechnique(e.output);case G.ObjectAndLayerIdColor:return this._acquireTechnique(G.ObjectAndLayerIdColor);case G.Highlight:return r.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(G.Highlight):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case G.Color:case G.ColorEmission:{const i=e.bind.slot!==Z.OCCLUDED_GROUND||e.bind.overlay?.allSourcesOccluders?x.Color:x.Occluded;this._renderMaterialPass(e,t,i);break}case G.Depth:case G.Normal:this._renderAuxiliaryPass(e,t,x.Color,this._visiblePatchesByOrigin);break;case G.Highlight:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(x.Highlight)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,x.Highlight,this._visiblePatchesByOrigin);break}case G.Shadow:case G.ShadowExcludeHighlight:case G.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case G.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,x.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=p(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll(e=>i.updateTileTexture(e,O.FADING)),this._configuration.tileBlendInput=i.backgroundIsGrid?F.GridComposite:null!=i.backgroundColor?F.ColorComposite:F.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)A(this.renderOrder,i,t);e.sort((e,t)=>N(e[0],t[0],this.renderOrder)),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.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){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach(r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],ae.TRIANGLES,n,i)}),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=J(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=e.bind.slot===Z.OCCLUDED_GROUND;o&&(n.bindTexture("tex",r.emptyTexture),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",f));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:u;this._configuration.tileBlendInput===F.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?ae.LINES:ae.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",r.emptyTexture);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(se,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],de.prototype,"_isGlobal",null),e([o()],de.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],de.prototype,"renderingDisabled",null),e([o({value:!0})],de.prototype,"visible",null),e([o()],de.prototype,"renderPatchBorders",null),e([o()],de.prototype,"visualizeNormals",null),e([o()],de.prototype,"cullBackFaces",null),e([o({value:D.FRONT_TO_BACK})],de.prototype,"renderOrder",null),e([o()],de.prototype,"wireframe",null),de=e([l("esri.views.3d.terrain.TerrainRenderer")],de);const he=g(),ue=g(),ge=g(),pe=g();export{de as TerrainRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as s,I as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as u,fromValues as h}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as p}from"../../../../../../symbols/support/materialUtils.js";import{ColorMixModeEnum as c}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as d}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as m}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as g,IntegratedMeshMode as f}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as x}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as v}from"./shader/VertexDiscardMode.js";import{parameter as b,parameterBlock as M,MaterialBase as y,MaterialParameterBlock as T}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as O}from"../../../core/renderPasses/RenderPassIdentifier.js";import{ShaderOutput as C,isColorEmission as S}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as w}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as D}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as N}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as j}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as q}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as A,CullFaceOptions as R}from"../../../lib/basicInterfaces.js";import{OITPass as I}from"../../../lib/OITPass.js";import{RenderSlot as E}from"../../../lib/RenderSlot.js";import{advancedMRRFactors as F}from"../../../materials/pbrUtils.js";import{defaultHighlightName as B}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as W}from"../../../../../../webscene/support/AlphaCutoff.js";class L extends y{constructor(e,s){super(),this.toMapSpace=s,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=F,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=1,this.emissiveSource=p.Emissive,this.commonMaterialParameters=new V,this.componentParameters=new U,this.objectOpacity=1,this.textureAlphaCutoff=W,this.alphaDiscardMode=A.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1;const i=new q(e.position),l=o(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=i.low,this.transformWorldFromModelTH=i.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get hasEmissions(){return null!=this.emissionTexture||!s(this.emissiveBaseColor,l)}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,r,o){const s=new g(e.context.spherical);s.renderOccluded=r.slot===E.OCCLUDED_GROUND,s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.oitPass=t.identifier===O.Material&&null!=r.oitPass?r.oitPass:I.NONE,s.terrainDepthTest=t.identifier===O.Material&&r.terrainDepthTest,s.cullAboveTerrain=t.identifier===O.Material&&r.cullAboveTerrain,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?N.View:N.None,s.hasColorTexture=null!=this.baseColorTexture;const i=this._computeWhichMaterialPass();if(s.blendingEnabled=i===k.Transparent||i===k.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?J(r)?z(r)?f.ColorOverlayWithWater:f.ColorOverlay:f.NoOverlay:f.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===f.ColorOverlayWithWater?j.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.shadeNormals&&this.isIntegratedMesh?j.Disabled:j.Schematic:j.Normal:j.Disabled,s.emissionSource=this.hasEmissions?null!=this.emissionTexture?D.Texture:s.pbrMode===j.Normal?D.SymbolColor:D.None:D.None,s.shadeNormals=o.shadeNormals,s.normalType=s.hasNormals?w.Compressed:w.ScreenDerivative,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,s.receiveAmbientOcclusion=s.hasOccludees=s.receiveShadows=s.screenSpaceReflections=s.cloudReflections=s.hasHighlightMixTexture=!1,t.identifier===O.ShadowMap)s.output=C.Shadow,s.vertexDiscardMode=v.None;else if(t.identifier===O.ViewshedShadowMap)s.output=C.ViewshedShadow,s.vertexDiscardMode=v.None;else if(t.identifier===O.Highlight)s.output=C.Highlight,s.vertexDiscardMode=v.None,s.hasHighlightMixTexture=null!=r.highlightMixTexture;else{switch(i===k.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?v.Opaque:v.Transparent:s.vertexDiscardMode=v.None,s.hasBloom=S(t.output),s.output=t.output,t.output){case C.Color:case C.ColorEmission:s.receiveAmbientOcclusion=o.applySSAO&&null!=r.ssao?.getTexture(),s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.screenSpaceReflections=null!=r.ssr.lastFrameColor,s.cloudReflections=null!=r.clouds.data?.cubeMap?.colorTexture;break;case C.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=r.snowCover}const a=e.get(m,s);return this._setClean(),a}submit(e,t,r){if(this.objectOpacity<=0)return;const{componentData:o,renderable:s}=r,{geometry:i}=s,a=s.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:u}=o;switch(this._computeWhichMaterialPass()){case k.Opaque:e.opaque.submitDraw(this,i,l,a);break;case k.Transparent:e.transparent.submitDraw(this,i,l,a);break;case k.OpaqueAndTransparent:e.opaque.submitDraw(this,i,l,a),e.transparent.submitDraw(this,i,l,a);break;case k.IntegratedMesh:e.integratedMesh.submitDraw(this,i,l,a),K(t)&&e.occludedGround.submitDraw(this,i,l,a),G(t)&&e.highlightIntegratedMesh.submitDraw(this,i,l,a)}if(this.componentParameters.castShadows!==H.None){if(null!=n)for(const t of n)t[0]===B&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=u&&e.defaultShadowMap.submitDraw(this,i,u,a),e.shadowMap.submitDraw(this,i,l,a)}if(null!=n)for(const h of n)e.highlight.submitDraw(this,i,h[1],a,h[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,i,l,a)}_computeWhichMaterialPass(){if(this.isIntegratedMesh)return k.IntegratedMesh;if(this.objectOpacity<1)return k.Transparent;if(this.componentParameters.opaqueOverride===H.All)return k.Opaque;if(this.baseColor[3]<1||this.alphaDiscardMode===A.Blend||this.alphaDiscardMode===A.MaskBlend)return k.Transparent;switch(this.componentParameters.transparent){case H.None:return k.Opaque;case H.All:return k.Transparent;case H.Some:return k.OpaqueAndTransparent}}}var k,H;e([b({vectorOps:n})],L.prototype,"baseColor",void 0),e([b()],L.prototype,"usePBR",void 0),e([b()],L.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:i})],L.prototype,"mrrFactors",void 0),e([b({dispose:!0})],L.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],L.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],L.prototype,"normalTexture",void 0),e([b({dispose:!0})],L.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],L.prototype,"emissionTexture",void 0),e([b({vectorOps:i})],L.prototype,"emissiveBaseColor",void 0),e([b()],L.prototype,"emissiveStrength",void 0),e([b()],L.prototype,"emissiveSource",void 0),e([M()],L.prototype,"commonMaterialParameters",void 0),e([M()],L.prototype,"componentParameters",void 0),e([b()],L.prototype,"objectOpacity",void 0),e([b()],L.prototype,"textureAlphaCutoff",void 0),e([b()],L.prototype,"alphaDiscardMode",void 0),e([b()],L.prototype,"isIntegratedMesh",void 0),e([b()],L.prototype,"polygonOffsetEnabled",void 0),e([b()],L.prototype,"ellipsoidMode",void 0),e([b()],L.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(k||(k={}));class V extends T{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=R.Back,this.hasSlicePlane=!0}}e([b()],V.prototype,"doubleSided",void 0),e([b()],V.prototype,"cullFace",void 0),e([b()],V.prototype,"hasSlicePlane",void 0);class U extends T{constructor(){super(...arguments),this.externalColor=h(1,1,1,1),this.externalColorMixMode=c.Multiply,this.castShadows=H.All}get transparent(){return this.externalColor[3]<1?H.All:H.None}get opaqueOverride(){return this.externalColorMixMode===c.Replace&&1===this.externalColor[3]?H.All:H.None}get visible(){return this.externalColor[3]>0?H.All:H.None}get type(){return x.Uniform}}e([b({vectorOps:n})],U.prototype,"externalColor",void 0),e([b()],U.prototype,"externalColorMixMode",void 0),e([b()],U.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(H||(H={}));class _ extends T{constructor(){super(...arguments),this.texture=null,this.transparent=H.None,this.opaqueOverride=H.None,this.castShadows=H.None}get type(){return x.Varying}}function G(e){return null!=e.overlay?.getTexture(d.Highlight)}function z(e){return null!=e.overlay?.getTexture(d.WaterNormal)}function J(e){return null!=e.overlay?.getTexture(d.ColorNoRasterImage)}function K(e){return null!=e.overlay?.getTexture(d.Occluded)}e([b()],_.prototype,"texture",void 0),e([b()],_.prototype,"transparent",void 0),e([b()],_.prototype,"opaqueOverride",void 0),e([b()],_.prototype,"castShadows",void 0);export{V as CommonMaterialParameters,L as ComponentMaterial,H as ComponentParameterSummary,U as ComponentParametersUniform,_ as ComponentParametersVarying};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{invert as t,transpose as r}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as s,I as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as u,fromValues as h}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as p}from"../../../../../../symbols/support/materialUtils.js";import{ColorMixModeEnum as c}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as d}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as m}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as g,IntegratedMeshMode as f}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as x}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as v}from"./shader/VertexDiscardMode.js";import{parameter as b,parameterBlock as M,MaterialBase as y,MaterialParameterBlock as T}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as O}from"../../../core/renderPasses/RenderPassIdentifier.js";import{ShaderOutput as C,isColorEmission as S}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as w}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as N}from"../../../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as D}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as j}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as q}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as A,CullFaceOptions as R}from"../../../lib/basicInterfaces.js";import{OITPass as I}from"../../../lib/OITPass.js";import{RenderSlot as E}from"../../../lib/RenderSlot.js";import{advancedMRRFactors as F}from"../../../materials/pbrUtils.js";import{defaultHighlightName as B}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as W}from"../../../../../../webscene/support/AlphaCutoff.js";class L extends y{constructor(e,s){super(),this.toMapSpace=s,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=F,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=1,this.emissiveSource=p.Emissive,this.commonMaterialParameters=new V,this.componentParameters=new U,this.objectOpacity=1,this.textureAlphaCutoff=W,this.alphaDiscardMode=A.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1;const i=new q(e.position),l=o(e.rotationScale);t(l,l),r(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=i.low,this.transformWorldFromModelTH=i.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get hasEmissions(){return null!=this.emissionTexture||!s(this.emissiveBaseColor,l)}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,r,o){const s=new g(e.context.spherical);s.renderOccluded=r.slot===E.OCCLUDED_GROUND,s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.oitPass=t.identifier===O.Material&&null!=r.oitPass?r.oitPass:I.NONE,s.terrainDepthTest=t.identifier===O.Material&&r.terrainDepthTest,s.cullAboveTerrain=t.identifier===O.Material&&r.cullAboveTerrain,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?D.View:D.None,s.hasColorTexture=null!=this.baseColorTexture;const i=this._computeWhichMaterialPass();if(s.blendingEnabled=i===k.Transparent||i===k.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?J(r)?z(r)?f.ColorOverlayWithWater:f.ColorOverlay:f.NoOverlay:f.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===f.ColorOverlayWithWater?j.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.shadeNormals&&this.isIntegratedMesh?j.Disabled:j.Schematic:j.Normal:j.Disabled,s.emissionSource=this.hasEmissions?null!=this.emissionTexture?N.Texture:s.pbrMode===j.Normal?N.SymbolColor:N.None:N.None,s.shadeNormals=o.shadeNormals,s.normalType=s.hasNormals?w.Compressed:w.ScreenDerivative,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,s.receiveAmbientOcclusion=s.hasOccludees=s.receiveShadows=s.screenSpaceReflections=s.cloudReflections=s.hasHighlightMixTexture=!1,t.identifier===O.ShadowMap)s.output=C.Shadow,s.vertexDiscardMode=v.None;else if(t.identifier===O.ViewshedShadowMap)s.output=C.ViewshedShadow,s.vertexDiscardMode=v.None;else if(t.identifier===O.Highlight)s.output=C.Highlight,s.vertexDiscardMode=v.None,s.hasHighlightMixTexture=null!=r.highlightMixTexture;else{switch(i===k.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?v.Opaque:v.Transparent:s.vertexDiscardMode=v.None,s.hasBloom=S(t.output),s.output=t.output,t.output){case C.Color:case C.ColorEmission:s.receiveAmbientOcclusion=o.applySSAO&&null!=r.ssao?.getTexture(),s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.screenSpaceReflections=null!=r.ssr.lastFrameColor,s.cloudReflections=null!=r.clouds.data?.cubeMap?.colorTexture;break;case C.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=r.snowCover}const a=e.get(m,s);return this._setClean(),a}submit(e,t,r){if(this.objectOpacity<=0)return;const{componentData:o,renderable:s}=r,{geometry:i}=s,a=s.meta.cameraDepthSquared;o.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:u}=o;switch(this._computeWhichMaterialPass()){case k.Opaque:e.opaque.submitDraw(this,i,l,a);break;case k.Transparent:e.transparent.submitDraw(this,i,l,a);break;case k.OpaqueAndTransparent:e.opaque.submitDraw(this,i,l,a),e.transparent.submitDraw(this,i,l,a);break;case k.IntegratedMesh:e.integratedMesh.submitDraw(this,i,l,a),K(t)&&e.occludedGround.submitDraw(this,i,l,a),G(t)&&e.highlightIntegratedMesh.submitDraw(this,i,l,a)}if(this.componentParameters.castShadows!==H.None){if(null!=n)for(const t of n)t[0]===B&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=u&&e.defaultShadowMap.submitDraw(this,i,u,a),e.shadowMap.submitDraw(this,i,l,a)}if(null!=n)for(const h of n)e.highlight.submitDraw(this,i,h[1],a,h[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,i,l,a)}_computeWhichMaterialPass(){if(this.isIntegratedMesh)return k.IntegratedMesh;if(this.objectOpacity<1)return k.Transparent;if(this.componentParameters.opaqueOverride===H.All)return k.Opaque;if(this.baseColor[3]<1||this.alphaDiscardMode===A.Blend||this.alphaDiscardMode===A.MaskBlend)return k.Transparent;switch(this.componentParameters.transparent){case H.None:return k.Opaque;case H.All:return k.Transparent;case H.Some:return k.OpaqueAndTransparent}}}var k,H;e([b({vectorOps:n})],L.prototype,"baseColor",void 0),e([b()],L.prototype,"usePBR",void 0),e([b()],L.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:i})],L.prototype,"mrrFactors",void 0),e([b({dispose:!0})],L.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],L.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],L.prototype,"normalTexture",void 0),e([b({dispose:!0})],L.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],L.prototype,"emissionTexture",void 0),e([b({vectorOps:i})],L.prototype,"emissiveBaseColor",void 0),e([b()],L.prototype,"emissiveStrength",void 0),e([b()],L.prototype,"emissiveSource",void 0),e([M()],L.prototype,"commonMaterialParameters",void 0),e([M()],L.prototype,"componentParameters",void 0),e([b()],L.prototype,"objectOpacity",void 0),e([b()],L.prototype,"textureAlphaCutoff",void 0),e([b()],L.prototype,"alphaDiscardMode",void 0),e([b()],L.prototype,"isIntegratedMesh",void 0),e([b()],L.prototype,"polygonOffsetEnabled",void 0),e([b()],L.prototype,"ellipsoidMode",void 0),e([b()],L.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(k||(k={}));class V extends T{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=R.Back,this.hasSlicePlane=!0}}e([b()],V.prototype,"doubleSided",void 0),e([b()],V.prototype,"cullFace",void 0),e([b()],V.prototype,"hasSlicePlane",void 0);class U extends T{constructor(){super(...arguments),this.externalColor=h(1,1,1,1),this.externalColorMixMode=c.Multiply,this.castShadows=H.All}get transparent(){return this.externalColor[3]<1?H.All:H.None}get opaqueOverride(){return this.externalColorMixMode===c.Replace&&1===this.externalColor[3]?H.All:H.None}get visible(){return this.externalColor[3]>0?H.All:H.None}get type(){return x.Uniform}}e([b({vectorOps:n})],U.prototype,"externalColor",void 0),e([b()],U.prototype,"externalColorMixMode",void 0),e([b()],U.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(H||(H={}));class _ extends T{constructor(){super(...arguments),this.texture=null,this.transparent=H.None,this.opaqueOverride=H.None,this.castShadows=H.None}get type(){return x.Varying}}function G(e){return null!=e.overlay?.getTexture(d.Highlight)}function z(e){return null!=e.overlay?.getTexture(d.WaterNormal)}function J(e){return null!=e.overlay?.getTexture(d.ColorNoRasterImage)}function K(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?d.ColorNoRasterImage:d.Occluded)}e([b()],_.prototype,"texture",void 0),e([b()],_.prototype,"transparent",void 0),e([b()],_.prototype,"opaqueOverride",void 0),e([b()],_.prototype,"castShadows",void 0);export{V as CommonMaterialParameters,L as ComponentMaterial,H as ComponentParameterSummary,U as ComponentParametersUniform,_ as ComponentParametersVarying};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../../../geometry/support/Ellipsoid.js";import"../../../../../terrain/OverlayContent.js";import"./ComponentData.glsl.js";import"./VertexDiscardMode.js";import"../../../../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../../../../core/shaderLibrary/ShaderOutput.js";import"../../../../core/shaderLibrary/Slice.glsl.js";import"../../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../../core/shaderLibrary/util/EllipsoidMode.js";import"../../../../core/shaderModules/glsl.js";import"../../../../core/shaderModules/Texture2DBindUniform.js";import"../../../../core/shaderModules/Texture2DPassUniform.js";import"../../../../effects/weather/SnowCover.glsl.js";import"../../../../shaders/OutputColorHighlightOID.glsl.js";import"../../../../../../webgl/ShaderBuilder.js";import"../../../../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../../../../chunks/ComponentShader.glsl.js";
5
+ import"../../../../../../../geometry/support/Ellipsoid.js";import"../../../../../terrain/OverlayContent.js";import"./ComponentData.glsl.js";import"./VertexDiscardMode.js";import"../../../../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../../../../core/shaderLibrary/ShaderOutput.js";import"../../../../core/shaderLibrary/Slice.glsl.js";import"../../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../../../../core/shaderLibrary/attributes/VertexPosition.glsl.js";import"../../../../core/shaderLibrary/output/OutputDepth.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../../../../core/shaderLibrary/output/OutputHighlightOverlay.js";import"../../../../core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import"../../../../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../../../../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../../../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../../../../core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import"../../../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../../../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../../../../core/shaderLibrary/terrain/Overlay.glsl.js";import"../../../../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../../../../core/shaderLibrary/util/EllipsoidMode.js";import"../../../../core/shaderModules/glsl.js";import"../../../../core/shaderModules/Texture2DBindUniform.js";import"../../../../effects/weather/SnowCover.glsl.js";import"../../../../shaders/OutputColorHighlightOID.glsl.js";import"../../../../../../webgl/ShaderBuilder.js";import"../../../../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../../../../chunks/ComponentShader.glsl.js";
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as d}from"../ShaderOutput.js";import{addMainLightDirection as s,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as f}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as g}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",(e,o)=>V(e,o)),new x("overlayTexScale",(e,o)=>I(e,o))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",(e,o)=>b(e,o))),T(e,o)}function O(e,o){const{vertex:r,fragment:t}=e,{output:a}=o;r.uniforms.add(new M("overlayTexOffset"),new M("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",e=>e.overlayOpacity)),a!==n.Highlight&&t.uniforms.add(new p("ovColorTex",(e,o)=>o.overlay?.getTexture(e.overlayContent))),T(e,o)}function T(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(u,o);const{vertex:t,fragment:a,varyings:i}=e;i.add("vtcOverlay","vec4");const{output:d}=o,x=d===n.Highlight;t.code.add(m`void setOverlayVTC(in vec2 uv) {
5
+ import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as d}from"../ShaderOutput.js";import{addMainLightDirection as s,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as g}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as f}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",(e,o)=>I(e,o)),new x("overlayTexScale",(e,o)=>V(e,o))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",(e,o)=>O(e,o))),b(e,o)}function O(e,o){return e.identifier===i.Material&&d(e.output)?e.occludedGround?o.overlay?.allSourcesOccluders?o.overlay?.getTexture(l.ColorNoRasterImage):o.overlay?.getTexture(l.Occluded):o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===n.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function T(e,o){const{vertex:r,fragment:t}=e,{output:a}=o;r.uniforms.add(new M("overlayTexOffset"),new M("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",e=>e.overlayOpacity)),a!==n.Highlight&&t.uniforms.add(new p("ovColorTex",(e,o)=>o.overlay?.getTexture(e.overlayContent))),b(e,o)}function b(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(u,o);const{vertex:t,fragment:a,varyings:i}=e;i.add("vtcOverlay","vec4");const{output:d}=o,x=d===n.Highlight;t.code.add(m`void setOverlayVTC(in vec2 uv) {
6
6
  vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
7
7
  }`),a.code.add(m`bool isValid(vec2 uv, vec2 dxdy) {
8
8
  return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
@@ -13,7 +13,7 @@ vec4 color1 = texture(ov0Tex, vec2(texCoords.z * 0.5 + 0.5, texCoords.w));
13
13
  bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
14
14
  bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
15
15
  return mix(color1 * float(isValid1), color0, float(isValid0));
16
- }`),x?a.uniforms.add(new f("overlayHighlightTexture",(e,o)=>o.overlay?.getTexture(l.Highlight))).code.add(m`uvec2 getAllOverlayHighlightValuesEncoded() {
16
+ }`),x?a.uniforms.add(new g("overlayHighlightTexture",(e,o)=>o.overlay?.getTexture(l.Highlight))).code.add(m`uvec2 getAllOverlayHighlightValuesEncoded() {
17
17
  vec4 texCoords = vtcOverlay;
18
18
  vec2 uvInner = texCoords.xy;
19
19
  vec2 uvOuter = texCoords.zw;
@@ -44,4 +44,4 @@ vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0)));
44
44
  vec3 v = vposEyeDir;
45
45
  vec3 final = getSeaColor(n, v, mainLightDirection, colorInput.rgb, mainLightIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld);
46
46
  return vec4(final, colorInput.w);
47
- }`))}function b(e,o){return e.identifier===i.Material&&d(e.output)?e.occludedGround?o.overlay?.getTexture(l.Occluded):o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===n.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function V(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[0]/r(i)-i[0]/r(i),w[1]=e.toMapSpace[1]/t(i)-i[1]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[0]/r(n)-n[0]/r(n),w[3]=e.toMapSpace[1]/t(n)-n[1]/t(n)),w}function I(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[2]/r(i),w[1]=e.toMapSpace[3]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[2]/r(n),w[3]=e.toMapSpace[3]/t(n)),w}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(h||(h={}));const w=e();class M extends g{constructor(e){super(e,"vec4")}}export{C as OverlayIM,h as OverlayMode,O as OverlayTerrain,b as getIMColorTexture};
47
+ }`))}function I(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[0]/r(i)-i[0]/r(i),w[1]=e.toMapSpace[1]/t(i)-i[1]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[0]/r(n)-n[0]/r(n),w[3]=e.toMapSpace[1]/t(n)-n[1]/t(n)),w}function V(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[2]/r(i),w[1]=e.toMapSpace[3]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[2]/r(n),w[3]=e.toMapSpace[3]/t(n)),w}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(h||(h={}));const w=e();class M extends f{constructor(e){super(e,"vec4")}}export{C as OverlayIM,h as OverlayMode,T as OverlayTerrain,O as getIMColorTexture};