@arcgis/core 4.34.0-next.85 → 4.34.0-next.87

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 (286) hide show
  1. package/Basemap.js +1 -1
  2. package/Ground.js +1 -1
  3. package/Map.js +1 -1
  4. package/analysis/ElevationProfile/ElevationProfileLineGround.d.ts +4 -0
  5. package/analysis/ElevationProfile/{ElevationProfileGroundLine.js → ElevationProfileLineGround.js} +1 -1
  6. package/analysis/ElevationProfile/ElevationProfileLineInput.d.ts +4 -0
  7. package/analysis/ElevationProfile/{ElevationProfileInputLine.js → ElevationProfileLineInput.js} +1 -1
  8. package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +4 -0
  9. package/analysis/ElevationProfile/{ElevationProfileQueryLine.js → ElevationProfileLineQuery.js} +1 -1
  10. package/analysis/ElevationProfile/ElevationProfileLineScene.d.ts +4 -0
  11. package/analysis/ElevationProfile/{ElevationProfileSceneLine.js → ElevationProfileLineScene.js} +1 -1
  12. package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
  13. package/analysis/ElevationProfileAnalysis.js +1 -1
  14. package/arcade/functions/measures.js +1 -1
  15. package/assets/esri/core/workers/RemoteClient.js +1 -1
  16. package/assets/esri/core/workers/chunks/0074f1836d7ff69ff6ec.js +1 -0
  17. package/assets/esri/core/workers/chunks/03ef19f0753d68770444.js +1 -0
  18. package/assets/esri/core/workers/chunks/06c389283ee5b60573f2.js +1 -0
  19. package/assets/esri/core/workers/chunks/09c2004126f4a5242b85.js +1 -0
  20. package/assets/esri/core/workers/chunks/0b679d5a1bfdbd006d6e.js +1 -0
  21. package/assets/esri/core/workers/chunks/0f05425954578ac796ec.js +1 -0
  22. package/assets/esri/core/workers/chunks/109149c378aa4c5f8526.js +1 -0
  23. package/assets/esri/core/workers/chunks/143503f6eb270c4683f8.js +1 -0
  24. package/assets/esri/core/workers/chunks/177840d5f0076c0de46b.js +316 -0
  25. package/assets/esri/core/workers/chunks/1c1b0cc91fe9cb3fec61.js +1 -0
  26. package/assets/esri/core/workers/chunks/{9eb1bfcb9b05f2a36748.js → 1f2d13466c60a6b57717.js} +1 -1
  27. package/assets/esri/core/workers/chunks/1fc6311d4f0d27e88737.js +1 -0
  28. package/assets/esri/core/workers/chunks/257fd65786feb5951b90.js +1 -0
  29. package/assets/esri/core/workers/chunks/{7a23b127f551bf13ef54.js → 268f5b233640a9dbbf89.js} +2 -2
  30. package/assets/esri/core/workers/chunks/2896ada406074f754b00.js +1 -0
  31. package/assets/esri/core/workers/chunks/28d30be414e59eabd963.js +1 -0
  32. package/assets/esri/core/workers/chunks/29471e0b3f7296dee096.js +1 -0
  33. package/assets/esri/core/workers/chunks/{3192b68675ff2afcb1d6.js → 2d3ae187f8aa3495d4ae.js} +1 -1
  34. package/assets/esri/core/workers/chunks/2dc88379ee94fabdaf52.js +1 -0
  35. package/assets/esri/core/workers/chunks/336b54144afec0c7d396.js +2 -0
  36. package/assets/esri/core/workers/chunks/366db86914a63e6d0c68.js +1 -0
  37. package/assets/esri/core/workers/chunks/{d66cdb9bb494da19696b.js → 47e4f66c33bb697fbe6b.js} +2 -2
  38. package/assets/esri/core/workers/chunks/481c2b01e2fe92249698.js +1 -0
  39. package/assets/esri/core/workers/chunks/4840bd93d8fe15c7aefd.js +1 -0
  40. package/assets/esri/core/workers/chunks/4d4db6854aff7656f6e1.js +1 -0
  41. package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +1 -0
  42. package/assets/esri/core/workers/chunks/639d856cd217914dfe1f.js +1 -0
  43. package/assets/esri/core/workers/chunks/68f5a2d2666636c3f807.js +1 -0
  44. package/assets/esri/core/workers/chunks/7540b34e743a23e67729.js +1 -0
  45. package/assets/esri/core/workers/chunks/7be11a3ef1f49245089f.js +1 -0
  46. package/assets/esri/core/workers/chunks/819a8bc1f0a694017ee6.js +1 -0
  47. package/assets/esri/core/workers/chunks/{afb76f9d6abedef771df.js → 8380a092ffc8e92ede7a.js} +1 -1
  48. package/assets/esri/core/workers/chunks/8d63b42aea32ce2e5d09.js +1 -0
  49. package/assets/esri/core/workers/chunks/8de11aab65d91e7f1a4d.js +1 -0
  50. package/assets/esri/core/workers/chunks/9386a0ebff78b6303ed2.js +1 -0
  51. package/assets/esri/core/workers/chunks/{4d47187bc0821413492d.js → 95bae3c275f1483eb7ed.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{f8f85207b382c1ea038c.js → 97489bf16a1d327992b2.js} +3 -3
  53. package/assets/esri/core/workers/chunks/a2652d10bb0bc41c9a8d.js +1 -0
  54. package/assets/esri/core/workers/chunks/a845c68e76382a73da5e.js +1 -0
  55. package/assets/esri/core/workers/chunks/{9c64b78c5c9b35b31d98.js → aa78b69219d9a0ef1c54.js} +2 -2
  56. package/assets/esri/core/workers/chunks/b09b34f64a6bc2b49e0a.js +1 -0
  57. package/assets/esri/core/workers/chunks/b0a03b6edbcf6e933431.js +1 -0
  58. package/assets/esri/core/workers/chunks/{1859a11df9f579b993d7.js → b2fbb44e219232e61cbd.js} +1 -1
  59. package/assets/esri/core/workers/chunks/b4349db7155673329432.js +1 -0
  60. package/assets/esri/core/workers/chunks/b8997ae5893afa0298d1.js +1 -0
  61. package/assets/esri/core/workers/chunks/c0ae186620b68d43b338.js +1 -0
  62. package/assets/esri/core/workers/chunks/{d153b29c542c37ae1636.js → c50e8d5f554cf151865c.js} +2 -2
  63. package/assets/esri/core/workers/chunks/c5cc0fc652432a9264cc.js +1 -0
  64. package/assets/esri/core/workers/chunks/c6cae8471c5d4ae40c65.js +1 -0
  65. package/assets/esri/core/workers/chunks/cab2a1382bdd32bb34d8.js +1 -0
  66. package/assets/esri/core/workers/chunks/ce937ff0dd1147ea297e.js +1 -0
  67. package/assets/esri/core/workers/chunks/d142a42755a78bb157ed.js +1 -0
  68. package/assets/esri/core/workers/chunks/{280af3640f8e93c1024e.js → d6e0528eacee7ea4c1ce.js} +2 -2
  69. package/assets/esri/core/workers/chunks/d9d86cf0500fa29d1d43.js +1 -0
  70. package/assets/esri/core/workers/chunks/db5a985ccc6b7d0ad855.js +1 -0
  71. package/assets/esri/core/workers/chunks/f3ee035fa7bf638c8e60.js +1 -0
  72. package/assets/esri/core/workers/chunks/{b15ff6c9ef2de8a49853.js → f651c05604eab83aef5f.js} +2 -2
  73. package/assets/esri/core/workers/chunks/{ed773dab5965e42a2879.js → f6e18668f728dfd8ba5e.js} +2 -2
  74. package/assets/esri/core/workers/chunks/fc5ac54aab66562c8463.js +1 -0
  75. package/assets/esri/core/workers/chunks/ff8e2f998169ca3a7a68.js +1 -0
  76. package/assets/esri/libs/dracoMeshDecoder/draco_mesh_decoder.wasm +0 -0
  77. package/assets/esri/libs/i3s/i3s.wasm +0 -0
  78. package/assets/esri/themes/dark/main.css +1 -1
  79. package/assets/esri/themes/light/main.css +1 -1
  80. package/assets/esri/themes/light/view.css +1 -1
  81. package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis.json +1 -0
  82. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  84. package/chunks/CloudsComposition.glsl.js +2 -2
  85. package/chunks/HUDMaterial.glsl.js +49 -50
  86. package/chunks/LineMarker.glsl.js +34 -34
  87. package/chunks/PointRenderer.glsl.js +4 -4
  88. package/chunks/ShadowHighlight.glsl.js +3 -3
  89. package/chunks/draco_mesh_decoder.js +1 -1
  90. package/config.js +1 -1
  91. package/core/NestedMap.js +1 -1
  92. package/core/iteratorUtils.js +1 -1
  93. package/editing/geometry/lineUtils.js +1 -1
  94. package/identity/IdentityManagerBase.js +1 -1
  95. package/interfaces.d.ts +188 -134
  96. package/kernel.js +1 -1
  97. package/layers/GaussianSplatLayer.js +1 -1
  98. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  99. package/layers/IntegratedMeshLayer.js +1 -1
  100. package/layers/ParquetLayer.js +1 -1
  101. package/layers/SceneLayer.js +1 -1
  102. package/layers/VectorTileLayer.js +1 -1
  103. package/layers/graphics/sources/ParquetSource.js +1 -1
  104. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  105. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  106. package/layers/knowledgeGraph/cypherUtils.js +1 -1
  107. package/layers/support/FieldConfiguration.js +1 -1
  108. package/layers/support/fieldConfigUtils.js +1 -1
  109. package/layers/support/layerUtils.js +1 -1
  110. package/layers/support/vectorTileLayerLoader.js +1 -1
  111. package/package.json +5 -5
  112. package/portal/schemas/definitions.js +1 -1
  113. package/support/basemapEnsureType.js +1 -1
  114. package/support/revision.js +1 -1
  115. package/support/userTypeGuards/isBasemap.js +5 -0
  116. package/symbols/support/previewSymbol2D.js +1 -1
  117. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  118. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  119. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  120. package/views/2d/layers/features/Processor.js +1 -1
  121. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  122. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  123. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  124. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  125. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  126. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  127. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  128. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  129. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  130. package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
  131. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  132. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  133. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  134. package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +5 -0
  135. package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +5 -0
  136. package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
  137. package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +5 -0
  138. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +5 -0
  139. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +5 -0
  140. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  141. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  142. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  143. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  144. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  145. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  146. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  147. package/views/3d/FocusAreasView.js +1 -1
  148. package/views/3d/GroundView3D.js +5 -0
  149. package/views/3d/analysis/ElevationProfile/{ElevationProfileSceneLineComputation.js → ElevationProfileLineSceneComputation.js} +1 -1
  150. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  151. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementConfiguration.js +1 -1
  152. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  153. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  154. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  155. package/views/3d/glTF/internal/Resource.js +1 -1
  156. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  157. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  158. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  159. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  160. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  161. package/views/3d/layers/DrapedSubView3D.js +1 -1
  162. package/views/3d/layers/FlowSubView3D.js +1 -1
  163. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  164. package/views/3d/layers/I3SMeshView3D.js +1 -1
  165. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  166. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  167. package/views/3d/layers/MediaLayerView3D.js +1 -1
  168. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  169. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  170. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  171. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  172. package/views/3d/support/MemoryController.js +1 -1
  173. package/views/3d/support/engineContent/marker.js +1 -1
  174. package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
  175. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  176. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  177. package/views/3d/support/popupHitTest.js +1 -1
  178. package/views/3d/terrain/OverlayManager.js +1 -1
  179. package/views/3d/terrain/OverlayRenderer.js +1 -1
  180. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +11 -11
  181. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  182. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  183. package/views/3d/webgl-engine/materials/renderers/InstancedCommandVAO.js +5 -0
  184. package/views/3d/webgl-engine/materials/renderers/InstancedCommandVAOs.js +5 -0
  185. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  186. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  187. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  188. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  189. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  190. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +14 -9
  191. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  192. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  193. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  194. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  195. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +8 -8
  196. package/views/BasemapView.js +1 -1
  197. package/views/GroundView.js +1 -1
  198. package/views/SceneView.js +1 -1
  199. package/views/View.js +1 -1
  200. package/views/View2D.js +1 -1
  201. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  202. package/views/analysis/ElevationProfile/{ElevationProfileGroundLineComputation.js → ElevationProfileLineGroundComputation.js} +1 -1
  203. package/views/analysis/ElevationProfile/{ElevationProfileInputLineComputation.js → ElevationProfileLineInputComputation.js} +1 -1
  204. package/views/analysis/ElevationProfile/{ElevationProfileQueryLineComputation.js → ElevationProfileLineQueryComputation.js} +1 -1
  205. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  206. package/views/support/LayerViewManager.js +1 -1
  207. package/views/webgl/RenderbufferDescriptor.js +1 -1
  208. package/views/webgl/TextureDescriptor.js +1 -1
  209. package/views/webgl/Util.js +1 -1
  210. package/views/webgl/VertexArrayObject.js +1 -1
  211. package/webscene/Slide.js +1 -1
  212. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  213. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  214. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  215. package/widgets/Editor/Upload.js +1 -1
  216. package/widgets/Editor/components/Notices.js +1 -1
  217. package/widgets/Editor/modelUploadUtils.js +1 -1
  218. package/widgets/Editor/support/SketchController.js +1 -1
  219. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  220. package/widgets/Editor/workflowUtils.js +1 -1
  221. package/widgets/ElevationProfile/ElevationProfileLineGround.d.ts +2 -2
  222. package/widgets/ElevationProfile/ElevationProfileLineInput.d.ts +2 -2
  223. package/widgets/ElevationProfile/ElevationProfileLineQuery.d.ts +2 -2
  224. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  225. package/widgets/Sketch/SketchViewModel.js +1 -1
  226. package/widgets/Sketch/adapters/layer/GraphicsLayerAdapter.js +5 -0
  227. package/widgets/Sketch/adapters/layer/MapNotesLayerAdapter.js +5 -0
  228. package/analysis/ElevationProfile/ElevationProfileGroundLine.d.ts +0 -4
  229. package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +0 -4
  230. package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +0 -4
  231. package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +0 -4
  232. package/assets/esri/core/workers/chunks/03e5d1a00d85e4d16bff.js +0 -1
  233. package/assets/esri/core/workers/chunks/0914a52fb33af5d77fab.js +0 -1
  234. package/assets/esri/core/workers/chunks/1d491447b13f2f2b4399.js +0 -1
  235. package/assets/esri/core/workers/chunks/20850b0fdb55fb17bc90.js +0 -1
  236. package/assets/esri/core/workers/chunks/25ea02dd7d45a90cbb3b.js +0 -1
  237. package/assets/esri/core/workers/chunks/264a9a916e1e972b69d7.js +0 -1
  238. package/assets/esri/core/workers/chunks/30c85a1a4f118cc45a25.js +0 -1
  239. package/assets/esri/core/workers/chunks/3ef8a7468d7e3b2f0b69.js +0 -351
  240. package/assets/esri/core/workers/chunks/486ea51306c619238e41.js +0 -1
  241. package/assets/esri/core/workers/chunks/49cb78c85de0102e5f02.js +0 -1
  242. package/assets/esri/core/workers/chunks/5610dfde4e636e2333a9.js +0 -1
  243. package/assets/esri/core/workers/chunks/5c1cdc2ec06c4c6bd0b3.js +0 -1
  244. package/assets/esri/core/workers/chunks/609abf071c4ea24955c2.js +0 -1
  245. package/assets/esri/core/workers/chunks/71c2a8e5a17803d3e949.js +0 -1
  246. package/assets/esri/core/workers/chunks/7402c2853f6aed8d1bc7.js +0 -1
  247. package/assets/esri/core/workers/chunks/7889a909394c61a9d3e0.js +0 -1
  248. package/assets/esri/core/workers/chunks/79a9f47dfa9ebabb5dbd.js +0 -1
  249. package/assets/esri/core/workers/chunks/86378d4f4d7f9a370c22.js +0 -1
  250. package/assets/esri/core/workers/chunks/99ac292a858bbedc6a89.js +0 -1
  251. package/assets/esri/core/workers/chunks/9a6fa91dd204f64d2590.js +0 -1
  252. package/assets/esri/core/workers/chunks/9cdeead9d444e8d95477.js +0 -1
  253. package/assets/esri/core/workers/chunks/aa1eb7b4d9ccda725da5.js +0 -1
  254. package/assets/esri/core/workers/chunks/b19d723d09f5bea9ca27.js +0 -1
  255. package/assets/esri/core/workers/chunks/b4a053063e6022080d31.js +0 -1
  256. package/assets/esri/core/workers/chunks/b4b26cc2ba3ff30e1d03.js +0 -1
  257. package/assets/esri/core/workers/chunks/b78ea9cc4d5f2fd3d871.js +0 -1
  258. package/assets/esri/core/workers/chunks/bbb585f0b484ab5eabb3.js +0 -1
  259. package/assets/esri/core/workers/chunks/bd4125d163f372a7e978.js +0 -1
  260. package/assets/esri/core/workers/chunks/c2bc70b65f5c2a2c9671.js +0 -1
  261. package/assets/esri/core/workers/chunks/cd1869e183001266c4c1.js +0 -2
  262. package/assets/esri/core/workers/chunks/d0a149050f7f1c1ada09.js +0 -1
  263. package/assets/esri/core/workers/chunks/d2fe403d6ab237bc89c2.js +0 -1
  264. package/assets/esri/core/workers/chunks/d51e8eeb1e1eb0605cc9.js +0 -1
  265. package/assets/esri/core/workers/chunks/da42cc4f6142846cb745.js +0 -1
  266. package/assets/esri/core/workers/chunks/dd84f630466a26722d57.js +0 -1
  267. package/assets/esri/core/workers/chunks/e080628ac6e1cf25dc72.js +0 -1
  268. package/assets/esri/core/workers/chunks/e17df11c98dbd869302b.js +0 -1
  269. package/assets/esri/core/workers/chunks/e1b3ae6426886e2fab07.js +0 -1
  270. package/assets/esri/core/workers/chunks/e8e0f73fb94e63e2abc3.js +0 -1
  271. package/assets/esri/core/workers/chunks/f45c343527709f6f91c2.js +0 -1
  272. package/assets/esri/core/workers/chunks/f6513ec888a7d927d948.js +0 -1
  273. package/assets/esri/core/workers/chunks/fcac475e4e82911b3126.js +0 -1
  274. package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +0 -5
  275. package/views/2d/layers/features/sources/strategies/ATileLoadStrategy.js +0 -5
  276. package/views/2d/layers/features/sources/strategies/DrillDownTileLoadStrategy.js +0 -5
  277. package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +0 -5
  278. package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.js +0 -5
  279. /package/assets/esri/core/workers/chunks/{7a23b127f551bf13ef54.js.LICENSE.txt → 268f5b233640a9dbbf89.js.LICENSE.txt} +0 -0
  280. /package/assets/esri/core/workers/chunks/{cd1869e183001266c4c1.js.LICENSE.txt → 336b54144afec0c7d396.js.LICENSE.txt} +0 -0
  281. /package/assets/esri/core/workers/chunks/{280af3640f8e93c1024e.js.LICENSE.txt → 47e4f66c33bb697fbe6b.js.LICENSE.txt} +0 -0
  282. /package/assets/esri/core/workers/chunks/{9c64b78c5c9b35b31d98.js.LICENSE.txt → aa78b69219d9a0ef1c54.js.LICENSE.txt} +0 -0
  283. /package/assets/esri/core/workers/chunks/{d153b29c542c37ae1636.js.LICENSE.txt → c50e8d5f554cf151865c.js.LICENSE.txt} +0 -0
  284. /package/assets/esri/core/workers/chunks/{b15ff6c9ef2de8a49853.js.LICENSE.txt → d6e0528eacee7ea4c1ce.js.LICENSE.txt} +0 -0
  285. /package/assets/esri/core/workers/chunks/{d66cdb9bb494da19696b.js.LICENSE.txt → f651c05604eab83aef5f.js.LICENSE.txt} +0 -0
  286. /package/assets/esri/core/workers/chunks/{ed773dab5965e42a2879.js.LICENSE.txt → f6e18668f728dfd8ba5e.js.LICENSE.txt} +0 -0
@@ -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{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{watch as r,when as s,on as n,sync as i,initial as o}from"../../../../core/reactiveUtils.js";import{property as a}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{f as u,q as d,c as h}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{create as l}from"../../../../geometry/support/ray.js";import{debugFlags as _}from"../debugFlags.js";import{DebugPoint as m}from"../debugUtils.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as g}from"./CameraOnSurface.js";import{CenterOnSurface as y}from"./CenterOnSurface.js";import{ContentGeometryUpdates as O}from"./ContentGeometryUpdates.js";import{Focus as A}from"./Focus.js";import{StableSurfaceCenter as w}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as S}from"./SurfaceGeometryUpdates.js";import{Intersector as v}from"../../webgl-engine/lib/Intersector.js";import{terrainId as I}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{PropertiesPool as b}from"../../../support/PropertiesPool.js";import{TaskPriority as R}from"../../../support/Scheduler.js";let P=class extends t{constructor(e){super(e),this.renderPointOfView=p(),this._pois=new Array,this._updatingHandles=new f,this._debugCenters=null,this._tmpRay=l(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._propertiesPool=new b({renderPointOfView:()=>p()},this),this._contentIntersector=new v(e.view.state.viewingMode),this._surfaceIntersector=new v(e.view.state.viewingMode),this._surfaceIntersector.options.invisibleTerrain=!1,this._surfaceIntersector.options.store=0}initialize(){const{state:e,basemapTerrain:t,groundView:a,renderCoordsHelper:c,map:u}=this.view,d=()=>this._estimateSurfaceAltitudeAtCenter(),h=this.view.resourceController.scheduler,p=t?.elevationQueryCache,f={state:e,scheduler:h,surface:t,renderCoordsHelper:c};this._set("centerOnSurfaceInfrequent",new y({...f,task:R.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:d})),this._set("centerOnSurfaceFrequent",new y({...f,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:d})),this._set("centerOnContent",new y({...f,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:()=>this._estimateContentAltitudeAtCenter()}));const l=a.integratedMeshElevationSampler;this._set("cameraOnSurface",new g({...f,cache:p,integratedMeshElevationSampler:l,task:R.POINT_OF_INTEREST_INFREQUENT,map:u})),this._set("surfaceGeometryUpdates",new S({...f,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set("contentGeometryUpdates",new O(this.view.allLayerViews,()=>this.view.graphicsView)),this._set("surfaceOrigin",new w({cache:p,view:this.view})),this._set("focus",new A({state:e,scheduler:h,surface:t,renderCoordsHelper:c,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(e,t)=>this._estimateSurfaceIntersectionAtRenderPoint(e,this.view.state.contentCamera,t)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus),this.addHandles([r(()=>e.contentCamera,e=>this._cameraChanged(e),i),this._updatingHandles.add(()=>t.extent,()=>this._updateCenterPointsOfInterest()),this._updatingHandles.add(()=>this.view.map?.ground?.navigationConstraint?.type,e=>{this._surfaceIntersector.options.backfacesTerrain="none"===e},o),s(()=>!t.updating,()=>this._updateCenterPointsOfInterest(),i),n(()=>this.surfaceGeometryUpdates.events,"request-update",()=>this._updateCenterPointsOfInterest()),n(()=>this.contentGeometryUpdates.events,"request-update",()=>this._updateCenterOnContent()),this._updatingHandles.add(()=>_.SHOW_POI,e=>this._setDebug(e),o)]),this._cameraChanged(this.view.state.contentCamera);for(const r of this._pois)r.runTask()}destroy(){this._setDebug(!1),this._propertiesPool.destroy();for(const e of this._pois)e.destroy();this._pois.length=0,this.surfaceOrigin.destroy(),this._updatingHandles.destroy(),this._set("centerOnSurfaceInfrequent",null),this._set("centerOnSurfaceFrequent",null),this._set("centerOnContent",null),this._set("cameraOnSurface",null),this._set("surfaceGeometryUpdates",null),this._set("contentGeometryUpdates",null),this._set("surfaceOrigin",null),this._set("focus",null)}get updating(){return!(!this.surfaceGeometryUpdates?.updating&&!this._pois.some(e=>e.updating))||this._updatingHandles.updating}get _centerRay(){return this._centerRayDirty&&(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),this._centerRayDirty=!1),this._centerRayCached}_estimateContentAltitudeAtCenter(){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;this._contentAltitudeAtCenterDirty=!1;const e=this._centerRay;return null==e||(this.view.sceneIntersectionHelper.intersectRay(e,this._contentIntersector,j,H)?this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j):this._contentAltitudeAtCenter=this._estimateSurfaceAltitudeAtCenter()),this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(){if(!this.view.basemapTerrain)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;this._surfaceAltitudeAtCenterDirty=!1;const e=this._centerRay;if(null==e)return this._surfaceAltitudeAtCenter;const t=e.origin,r=u(j,e.origin,e.direction);return this._surfaceIntersector.resetWithRay(e,this.view.state.contentCamera),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,t,r),this._surfaceIntersector.results.min.getIntersectionPoint(j)&&(this._surfaceAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j)),this._surfaceAltitudeAtCenter}_estimateSurfaceIntersectionAtRenderPoint(e,t,r){const s=C(t,e,T);if(null==s)return null;const n=s.origin,i=u(j,s.origin,s.direction);return this._surfaceIntersector.resetWithRay(s,t),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,n,i),this._surfaceIntersector.results.min.getIntersectionPoint(r)?r:null}_cameraChanged(e){this._updateCenterPointsOfInterest();const t=e.eye;d(this.renderPointOfView,t)||this._set("renderPointOfView",h(this._propertiesPool.get("renderPointOfView"),t))}_updateCenterPointsOfInterest(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0;for(const e of this._pois)e.updateRenderLocation()}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)return this._debugCenters?.forEach(e=>e.hide()),void this.removeHandles("debug");if(!this._debugCenters){this._debugCenters=new Map;const e=this.view.graphics;this._debugCenters.set(this.centerOnContent,new m(e,"red","CenterOnContent")),this._debugCenters.set(this.centerOnSurfaceFrequent,new m(e,"red","CenterOnSurface")),this._debugCenters.set(this.centerOnSurfaceInfrequent,new m(e,"red","CenterOnSurface")),this._debugCenters.set(this.cameraOnSurface,new m(e,"blue","CameraOnSurface")),this._debugCenters.set(this.focus,new m(e,"green","Focus"))}for(const t of this._pois)this.addHandles(this._updatingHandles.add(()=>t.renderLocation,e=>this._debugCenters?.get(t)?.show(e,t.renderCoordsHelper.spatialReference),o),"debug")}get test(){}};e([a()],P.prototype,"centerOnContent",void 0),e([a()],P.prototype,"centerOnSurfaceFrequent",void 0),e([a()],P.prototype,"centerOnSurfaceInfrequent",void 0),e([a()],P.prototype,"cameraOnSurface",void 0),e([a()],P.prototype,"focus",void 0),e([a()],P.prototype,"renderPointOfView",void 0),e([a()],P.prototype,"surfaceOrigin",void 0),e([a()],P.prototype,"contentGeometryUpdates",void 0),e([a()],P.prototype,"surfaceGeometryUpdates",void 0),e([a({constructOnly:!0})],P.prototype,"view",void 0),e([a()],P.prototype,"updating",null),P=e([c("esri.views.3d.support.pointsOfInterest.PointsOfInterest")],P);const j=p(),T=l(),H={exclude:new Set([I])};export{P as PointsOfInterest};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{watch as r,when as s,on as n,sync as i,initial as o}from"../../../../core/reactiveUtils.js";import{property as a}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{f as u,q as d,c as h}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{create as l}from"../../../../geometry/support/ray.js";import{debugFlags as _}from"../debugFlags.js";import{DebugPoint as m}from"../debugUtils.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as g}from"./CameraOnSurface.js";import{CenterOnSurface as y}from"./CenterOnSurface.js";import{ContentGeometryUpdates as O}from"./ContentGeometryUpdates.js";import{Focus as A}from"./Focus.js";import{StableSurfaceCenter as w}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as S}from"./SurfaceGeometryUpdates.js";import{Intersector as v}from"../../webgl-engine/lib/Intersector.js";import{terrainId as I}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{PropertiesPool as R}from"../../../support/PropertiesPool.js";import{TaskPriority as b}from"../../../support/Scheduler.js";let P=class extends t{constructor(e){super(e),this.renderPointOfView=p(),this._pois=new Array,this._updatingHandles=new f,this._debugCenters=null,this._tmpRay=l(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._propertiesPool=new R({renderPointOfView:()=>p()},this),this._contentIntersector=new v(e.view.state.viewingMode),this._surfaceIntersector=new v(e.view.state.viewingMode),this._surfaceIntersector.options.invisibleTerrain=!1,this._surfaceIntersector.options.store=0}initialize(){const{state:e,groundView:t,renderCoordsHelper:a,map:c}=this.view,u=()=>this._estimateSurfaceAltitudeAtCenter(),d=this.view.resourceController.scheduler,h=t?.elevationQueryCache,p={state:e,scheduler:d,surface:t,renderCoordsHelper:a};this._set("centerOnSurfaceInfrequent",new y({...p,task:b.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnSurfaceFrequent",new y({...p,task:b.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnContent",new y({...p,task:b.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:()=>this._estimateContentAltitudeAtCenter()}));const f=t.integratedMeshElevationSampler;this._set("cameraOnSurface",new g({...p,cache:h,integratedMeshElevationSampler:f,task:b.POINT_OF_INTEREST_INFREQUENT,map:c})),this._set("surfaceGeometryUpdates",new S({...p,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set("contentGeometryUpdates",new O(this.view.allLayerViews,()=>this.view.graphicsView)),this._set("surfaceOrigin",new w({cache:h,view:this.view})),this._set("focus",new A({state:e,scheduler:d,surface:t,renderCoordsHelper:a,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(e,t)=>this._estimateSurfaceIntersectionAtRenderPoint(e,this.view.state.contentCamera,t)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus),this.addHandles([r(()=>e.contentCamera,e=>this._cameraChanged(e),i),this._updatingHandles.add(()=>t.extentAABR,()=>this._updateCenterPointsOfInterest()),this._updatingHandles.add(()=>this.view.map?.ground?.navigationConstraint?.type,e=>{this._surfaceIntersector.options.backfacesTerrain="none"===e},o),s(()=>!t.updating,()=>this._updateCenterPointsOfInterest(),i),n(()=>this.surfaceGeometryUpdates.events,"request-update",()=>this._updateCenterPointsOfInterest()),n(()=>this.contentGeometryUpdates.events,"request-update",()=>this._updateCenterOnContent()),this._updatingHandles.add(()=>_.SHOW_POI,e=>this._setDebug(e),o)]),this._cameraChanged(this.view.state.contentCamera);for(const r of this._pois)r.runTask()}destroy(){this._setDebug(!1),this._propertiesPool.destroy();for(const e of this._pois)e.destroy();this._pois.length=0,this.surfaceOrigin.destroy(),this._updatingHandles.destroy(),this._set("centerOnSurfaceInfrequent",null),this._set("centerOnSurfaceFrequent",null),this._set("centerOnContent",null),this._set("cameraOnSurface",null),this._set("surfaceGeometryUpdates",null),this._set("contentGeometryUpdates",null),this._set("surfaceOrigin",null),this._set("focus",null)}get updating(){return!(!this.surfaceGeometryUpdates?.updating&&!this._pois.some(e=>e.updating))||this._updatingHandles.updating}get _centerRay(){return this._centerRayDirty&&(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),this._centerRayDirty=!1),this._centerRayCached}_estimateContentAltitudeAtCenter(){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;this._contentAltitudeAtCenterDirty=!1;const e=this._centerRay;return null==e||(this.view.sceneIntersectionHelper.intersectRay(e,this._contentIntersector,j,U)?this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j):this._contentAltitudeAtCenter=this._estimateSurfaceAltitudeAtCenter()),this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(){const{view:e}=this,{groundView:t}=e;if(!t)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;this._surfaceAltitudeAtCenterDirty=!1;const r=this._centerRay;if(null==r)return this._surfaceAltitudeAtCenter;const s=r.origin,n=u(j,r.origin,r.direction);return this._surfaceIntersector.resetWithRay(r,e.state.contentCamera),t.intersect(this._surfaceIntersector,null,s,n),this._surfaceIntersector.results.min.getIntersectionPoint(j)&&(this._surfaceAltitudeAtCenter=e.renderCoordsHelper.getAltitude(j)),this._surfaceAltitudeAtCenter}_estimateSurfaceIntersectionAtRenderPoint(e,t,r){const s=C(t,e,H);if(null==s)return null;const n=s.origin,i=u(j,s.origin,s.direction);return this._surfaceIntersector.resetWithRay(s,t),this.view.groundView.intersect(this._surfaceIntersector,null,n,i),this._surfaceIntersector.results.min.getIntersectionPoint(r)?r:null}_cameraChanged(e){this._updateCenterPointsOfInterest();const t=e.eye;d(this.renderPointOfView,t)||this._set("renderPointOfView",h(this._propertiesPool.get("renderPointOfView"),t))}_updateCenterPointsOfInterest(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0;for(const e of this._pois)e.updateRenderLocation()}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)return this._debugCenters?.forEach(e=>e.hide()),void this.removeHandles("debug");if(!this._debugCenters){this._debugCenters=new Map;const e=this.view.graphics;this._debugCenters.set(this.centerOnContent,new m(e,"red","CenterOnContent")),this._debugCenters.set(this.centerOnSurfaceFrequent,new m(e,"red","CenterOnSurface")),this._debugCenters.set(this.centerOnSurfaceInfrequent,new m(e,"red","CenterOnSurface")),this._debugCenters.set(this.cameraOnSurface,new m(e,"blue","CameraOnSurface")),this._debugCenters.set(this.focus,new m(e,"green","Focus"))}for(const t of this._pois)this.addHandles(this._updatingHandles.add(()=>t.renderLocation,e=>this._debugCenters?.get(t)?.show(e,t.renderCoordsHelper.spatialReference),o),"debug")}get test(){}};e([a()],P.prototype,"centerOnContent",void 0),e([a()],P.prototype,"centerOnSurfaceFrequent",void 0),e([a()],P.prototype,"centerOnSurfaceInfrequent",void 0),e([a()],P.prototype,"cameraOnSurface",void 0),e([a()],P.prototype,"focus",void 0),e([a()],P.prototype,"renderPointOfView",void 0),e([a()],P.prototype,"surfaceOrigin",void 0),e([a()],P.prototype,"contentGeometryUpdates",void 0),e([a()],P.prototype,"surfaceGeometryUpdates",void 0),e([a({constructOnly:!0})],P.prototype,"view",void 0),e([a()],P.prototype,"updating",null),P=e([c("esri.views.3d.support.pointsOfInterest.PointsOfInterest")],P);const j=p(),H=l(),U={exclude:new Set([I])};export{P as PointsOfInterest};
@@ -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{isIntegratedMeshLayer as e}from"../../../layers/support/layerUtils.js";import{hitTestSelectSimilarDistance as a}from"../../support/hitTestSelectUtils.js";async function r(r,i){const{results:o,ground:l}=await a(r,i),y=(!l.layer||!e(l.layer.type))&&l.mapPoint,c=[],p=s(r),d=y?t(r,p):n;let u=0,f=0;const m=()=>{const e=d.layerViews[f];y&&e&&"fetchPopupFeaturesAtLocation"in e&&c.push({mapPoint:l.mapPoint,layerView:e}),++f};let w=null;for(;u<o.length||f<d.layerViews.length;){const e=o[u];if(e&&"graphic"!==e.type)++u;else if("scene"!==e?.layer?.type||e?.layer?.parent!==r?.map?.basemap)if(e){const a=e.layer?.uid,r=d.layerUids.has(a)&&e.distance===l.distance,t=p.get(e.layer?.uid);if(w??=e.mapPoint,f<d.layerViews.length&&(r||(e.distance??0)>l.distance)&&d.layerViews[f]!==t){m();continue}c.push({graphic:e.graphic,layerView:t}),++u}else m();else++u}return w??=l.mapPoint,{hits:c,location:w}}function t(e,a){const r=new Set,t=new Set;for(let s=e.basemapTerrain.numLayers(1)-1;s>=0;s--){const a=e.basemapTerrain.layerViewByIndex(s,1);r.add(a.layer.uid),t.add(a)}const n=e.basemapTerrain.overlayManager.renderer.layers;for(const{uid:s}of n){const e=a.get(s);e&&(r.add(s),t.add(e))}return{layerUids:r,layerViews:Array.from(t).reverse()}}const n={layerUids:new Set,layerViews:[]};function s(e){const a=new Map;for(const r of e.allLayerViews){const e=r.layer.uid;a.set(e,r)}return a}export{r as popupHitTest};
5
+ import{isIntegratedMeshLayer as e}from"../../../layers/support/layerUtils.js";import{hitTestSelectSimilarDistance as a}from"../../support/hitTestSelectUtils.js";async function t(t,i){const{results:o,ground:l}=await a(t,i),y=(!l.layer||!e(l.layer.type))&&l.mapPoint,c=[],p=s(t),d=y?r(t,p):n;let u=0,f=0;const m=()=>{const e=d.layerViews[f];y&&e&&"fetchPopupFeaturesAtLocation"in e&&c.push({mapPoint:l.mapPoint,layerView:e}),++f};let w=null;for(;u<o.length||f<d.layerViews.length;){const e=o[u];if(e&&"graphic"!==e.type)++u;else if("scene"!==e?.layer?.type||e?.layer?.parent!==t?.map?.basemap)if(e){const a=e.layer?.uid,t=d.layerUids.has(a)&&e.distance===l.distance,r=p.get(e.layer?.uid);if(w??=e.mapPoint,f<d.layerViews.length&&(t||(e.distance??0)>l.distance)&&d.layerViews[f]!==r){m();continue}c.push({graphic:e.graphic,layerView:r}),++u}else m();else++u}return w??=l.mapPoint,{hits:c,location:w}}function r(e,a){const t=new Set,r=new Set;for(let s=e.basemapTerrain.numLayers(1)-1;s>=0;s--){const a=e.basemapTerrain.layerViewByIndex(s,1);t.add(a.layer.uid),r.add(a)}const n=e.overlayManager.renderer.layers;for(const{uid:s}of n){const e=a.get(s);e&&(t.add(s),r.add(e))}return{layerUids:t,layerViews:Array.from(r).reverse()}}const n={layerUids:new Set,layerViews:[]};function s(e){const a=new Map;for(const t of e.allLayerViews){const e=t.layer.uid;a.set(e,t)}return a}export{t as popupHitTest};
@@ -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{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{cyclicalPI as r}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as s,deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as a,sync as o}from"../../../core/reactiveUtils.js";import{property as l}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{subtract as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{f as d,d as u,c as p,j as m}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as y,c as f,h as _}from"../../../chunks/vec42.js";import{fromValues as v,create as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as S}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as w}from"../../../geometry/projection/projectVectorToVector.js";import{create as R,width as P,center as T,copy as D,intersection as O,contains as M,offset as j}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as b}from"../../../geometry/support/normalizeUtils.js";import{create as I,wrap as U}from"../../../geometry/support/ray.js";import{l as E,b as C,t as q}from"../../../chunks/sphere.js";import{angleAroundAxis as A}from"../../../geometry/support/vector.js";import{y2lat as V}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as F}from"../state/utils/viewUtils.js";import{debugFlags as G}from"../support/debugFlags.js";import{DebugPoint as H}from"../support/debugUtils.js";import{OverlayRenderer as z}from"./OverlayRenderer.js";import{Intersector as L}from"../webgl-engine/lib/Intersector.js";import{fromValues as k}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as B}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as W,ensureTextureSize as Y}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as N}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as X,noBudget as Z}from"../../support/Scheduler.js";import{Yield as J}from"../../support/Yield.js";const K=1.3,Q=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let $,ee=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0}initialize(){const{view:e}=this;this.renderer=new z({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new L(e.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([a(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),a(()=>e.state.camera.pixelRatio,t),a(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.terrainSurface.requestRender()),a(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),a(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),o),this.terrainSurface.on("elevation-change",()=>this.setPlacementDirty()),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(X.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),$&&($.hide(),$=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=b(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||G.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&(this.terrainSurface.ready||!this.terrainSurface.enabled)}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?S(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return K/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.terrainSurface.enabled&&this.terrainSurface.suspended}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(){return this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new B({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return J;const s=this._computeOverlayHeight(t);this._computeOverlayExtents(t,s,ne),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,ne.stretch);const i=this._updateOverlay(0,ne.inner,s,1*ne.pixelRatioAdjustment,ne.mapUnitsPerPixel),n=P(ne.inner)/P(ne.outer),a=this._updateOverlay(1,ne.outer,s,n*ne.pixelRatioAdjustment,ne.mapUnitsPerPixel);1!==i&&1!==a||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.terrainSurface.updateOverlayParameters(),this.terrainSurface.requestRender(r)),0===i&&0===a||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s)),{maxPreferredTexturePixels:n,maxTextureSize:a}=this.view.stage.renderView.renderingContext.parameters,o=.5*a;return W(Y({width:i,height:i},{maxPreferredTexturePixels:2*n,maxTextureSize:o})[1],o)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return 0;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=i,n.pixelRatio=s,te(t,n.extent)&&r===n.resolution)return a===i?0:2;n.setExtent(t),n.resolution=r;const o=T(n.extent);return n.renderLocalOrigin=k(o[0],o[1],0,"OV_"+this._latestOriginId++),1}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],s=this.renderer.overlays[1],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}reloadShaders(){N(),this.requestRender(),this.runTask(Z)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const n=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,le,t,r);if(null==n)return!1;const a=n.origin,o=d(ie,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let i=.5;const n=.55,a=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=s(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:a+l,e.aboveGround?a-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=ie;E(C(q,S(this.view.spatialReference).radius+h),U(e.eye,e.viewForward),t),u(t,t,e.eye);const s=r.normalize(A(e.viewForward,t,e.viewRight))/e.fovY+.5,a=s<=0||s>=1?.5:n;i=c?a*s:s+a*(1-s)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),r=Math.tan(t),a=v(0,r,1,0),o=y(a,a,e.projectionMatrix)[1],l=s(.5+.5*o,0,1);i=1===l||0===l?.5:c?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,i,o.distance,t)}_computeOverlayExtents(e,t,r){const{view:s}=this,n=s.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,a=g();this._findHorizonBasedPointOfInterest(e,a)||p(a,n);const o=this._renderSR;G.OVERLAY_SHOW_CENTER?(null==$&&($=new H(s.graphics,"red")),$.show(a,o)):null!=$&&$.hide();const l=Math.max(.1,m(e.eye,a)),h=F(s.renderCoordsHelper,n,e.eye),d=this._spatialReference;this._overlaySREqualsRenderSR||w(a,o,a,d);const u=this._isSpherical,y=this.terrainSurface.extent,v=!u&&d?.isGeographic,x=v&&d?1/S(d).metersPerDegree:1,R=s.state.contentPixelRatio,T=e.perScreenPixelRatio/R*l*x;r.mapUnitsPerPixel=T/this.worldToPCSRatio,r.stretch=this._overlayStretch;let j=t*T/2*r.stretch,b=!1,I=v?90:1/0;u&&y&&d&&(d.isWebMercator?(j/=Math.cos(V(a[1])),I=y[3]):(b=!0,j/=S(d).metersPerDegree,I=90),j>=I&&(j=I,a[1]=0,d.isWebMercator&&(a[0]=0)));let U=1;b&&(U=1/Math.max(.2,Math.cos(Math.abs(i(a[1])))),j*U>180&&(U=180/j),r.mapUnitsPerPixel*=U);const E=Math.log(2)/12;j=Math.exp(Math.round(Math.log(j)/E)*E);const C=j*U,q=32,A=.5*t/(q*C),z=.5*t/(q*j);a[0]=Math.round(a[0]*A)/A,a[1]=Math.round(a[1]*z)/z;const L=r.inner;L[0]=a[0]-C,L[1]=a[1]-j,L[2]=a[0]+C,L[3]=a[1]+j,u&&this._shiftExtentToFitBounds(L,1/0,I);const k=r.outer;if(6*C>P(y))D(k,y);else{if(Math.PI/2-Math.abs(h-Math.PI/2)<=.25*Math.PI)k[0]=L[0]-C,k[1]=L[1]-j,k[2]=L[2]+C,k[3]=L[3]+j;else{w(e.eye,o,ie,d),c(se,a,ie);let t=-Math.atan2(se[1],se[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(se,Q[r],2*j),se[0]*=U,se[2]*=U,_(k,L,se)}}if(u)k[0]=this.longitudeCyclical.clamp(k[0]),k[2]=this.longitudeCyclical.clamp(k[2]),k[1]=Math.max(k[1],-I),k[3]=Math.min(k[3],I);else{const e=O(L,y,ae),t=O(k,y,oe);M(e,t)&&(k[2]=k[0],k[3]=k[1])}const B=Math.abs(L[2]-L[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,B),r.pixelRatioAdjustment=r.mapUnitsPerPixel/B}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&(this.terrainSurface.updateOverlayParameters(),this.terrainSurface.requestRender(1)),this.terrainSurface.requestRender(t),1===t&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),j(e,s,i)}get test(){}};function te(e,t){const r=1e-5,s=G.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([l()],ee.prototype,"_spatialReference",void 0),e([l({readOnly:!0})],ee.prototype,"readyToRun",null),e([l()],ee.prototype,"_placementDirty",void 0),e([l()],ee.prototype,"_contentUpdated",void 0),e([l()],ee.prototype,"_isSpherical",null),e([l()],ee.prototype,"worldToPCSRatio",null),e([l()],ee.prototype,"renderer",void 0),e([l({constructOnly:!0})],ee.prototype,"view",void 0),e([l({constructOnly:!0})],ee.prototype,"terrainSurface",void 0),e([l()],ee.prototype,"suspended",null),e([l()],ee.prototype,"updating",null),ee=e([h("esri.views.3d.terrain.OverlayManager")],ee);class re{constructor(){this.inner=R(),this.outer=R(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=K}}const se=x(),ie=g(),ne=new re,ae=R(),oe=R(),le=I();export{ee as OverlayManager};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{cyclicalPI as r}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as s,deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as a,when as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{f as u,d as p,c as m,j as g}from"../../../chunks/vec32.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as _,c as v,h as f}from"../../../chunks/vec42.js";import{fromValues as w,create as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as R}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as P,width as O,center as D,copy as T,intersection as M,contains as j,offset as b}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as I}from"../../../geometry/support/normalizeUtils.js";import{create as U,wrap as E}from"../../../geometry/support/ray.js";import{l as C,b as V,t as A}from"../../../chunks/sphere.js";import{angleAroundAxis as q}from"../../../geometry/support/vector.js";import{y2lat as F}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as G}from"../state/utils/viewUtils.js";import{debugFlags as H}from"../support/debugFlags.js";import{DebugPoint as z}from"../support/debugUtils.js";import{OverlayRenderer as L}from"./OverlayRenderer.js";import{Intersector as B}from"../webgl-engine/lib/Intersector.js";import{fromValues as k}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as W}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as Y,ensureTextureSize as N}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as X}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as Z,noBudget as J}from"../../support/Scheduler.js";import{Yield as K}from"../../support/Yield.js";const Q=1.3,$=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let ee,te=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){const{view:e}=this;this.renderer=new L({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new B(e.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([a(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),a(()=>e.state.camera.pixelRatio,t),a(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.groundView.requestRender(1)),a(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),a(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),l),o(()=>this.groundView,e=>e.on("elevation-change",()=>this.setPlacementDirty())),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(Z.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),ee&&(ee.hide(),ee=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=I(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||H.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&(this.terrainSurface.ready||!this.terrainSurface.enabled)}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?R(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return Q/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.terrainSurface.enabled&&this.terrainSurface.suspended}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(){return this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new W({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return K;const s=this._computeOverlayHeight(t);this._computeOverlayExtents(t,s,ae),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,ae.stretch);const i=this._updateOverlay(0,ae.inner,s,1*ae.pixelRatioAdjustment,ae.mapUnitsPerPixel),n=O(ae.inner)/O(ae.outer),a=this._updateOverlay(1,ae.outer,s,n*ae.pixelRatioAdjustment,ae.mapUnitsPerPixel);1!==i&&1!==a||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(r)),0===i&&0===a||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s)),{maxPreferredTexturePixels:n,maxTextureSize:a}=this.view.stage.renderView.renderingContext.parameters,o=.5*a;return Y(N({width:i,height:i},{maxPreferredTexturePixels:2*n,maxTextureSize:o})[1],o)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return 0;const n=this.renderer.overlays[e],a=n.mapUnitsPerPixel;if(n.mapUnitsPerPixel=i,n.pixelRatio=s,re(t,n.extent)&&r===n.resolution)return a===i?0:2;n.setExtent(t),n.resolution=r;const o=D(n.extent);return n.renderLocalOrigin=k(o[0],o[1],0,"OV_"+this._latestOriginId++),1}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],s=this.renderer.overlays[1],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}reloadShaders(){X(),this.requestRender(),this.runTask(J)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const n=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,he,t,r);if(null==n)return!1;const a=n.origin,o=u(ne,n.origin,n.direction);this._groundIntersector.reset(a,o,e),this._groundIntersector.intersect([]),this.view.groundView.intersect(this._groundIntersector,null,a,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let i=.5;const n=.55,a=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=s(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:a+l,e.aboveGround?a-l:1/0),d=e.aboveGround;if("global"===this.view.viewingMode){const t=ne;C(V(A,R(this.view.spatialReference).radius+h),E(e.eye,e.viewForward),t),p(t,t,e.eye);const s=r.normalize(q(e.viewForward,t,e.viewRight))/e.fovY+.5,a=s<=0||s>=1?.5:n;i=d?a*s:s+a*(1-s)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),r=Math.tan(t),a=w(0,r,1,0),o=_(a,a,e.projectionMatrix)[1],l=s(.5+.5*o,0,1);i=1===l||0===l?.5:d?l*n:1-(1-l)*n}return this._intersectGroundFromView(e,.5,i,o.distance,t)}_computeOverlayExtents(e,t,r){const{view:s}=this,n=s.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,a=y();this._findHorizonBasedPointOfInterest(e,a)||m(a,n);const o=this._renderSR;H.OVERLAY_SHOW_CENTER?(null==ee&&(ee=new z(s.graphics,"red")),ee.show(a,o)):null!=ee&&ee.hide();const l=Math.max(.1,g(e.eye,a)),h=G(s.renderCoordsHelper,n,e.eye),d=this._spatialReference;this._overlaySREqualsRenderSR||S(a,o,a,d);const u=this._isSpherical,p=this.groundView.extentAABR,_=!u&&d?.isGeographic,w=_&&d?1/R(d).metersPerDegree:1,x=s.state.contentPixelRatio,P=e.perScreenPixelRatio/x*l*w;r.mapUnitsPerPixel=P/this.worldToPCSRatio,r.stretch=this._overlayStretch;let D=t*P/2*r.stretch,b=!1,I=_?90:1/0;u&&p&&d&&(d.isWebMercator?(D/=Math.cos(F(a[1])),I=p[3]):(b=!0,D/=R(d).metersPerDegree,I=90),D>=I&&(D=I,a[1]=0,d.isWebMercator&&(a[0]=0)));let U=1;b&&(U=1/Math.max(.2,Math.cos(Math.abs(i(a[1])))),D*U>180&&(U=180/D),r.mapUnitsPerPixel*=U);const E=Math.log(2)/12;D=Math.exp(Math.round(Math.log(D)/E)*E);const C=D*U,V=32,A=.5*t/(V*C),q=.5*t/(V*D);a[0]=Math.round(a[0]*A)/A,a[1]=Math.round(a[1]*q)/q;const L=r.inner;L[0]=a[0]-C,L[1]=a[1]-D,L[2]=a[0]+C,L[3]=a[1]+D,u&&this._shiftExtentToFitBounds(L,1/0,I);const B=r.outer;if(6*C>O(p))T(B,p);else{if(Math.PI/2-Math.abs(h-Math.PI/2)<=.25*Math.PI)B[0]=L[0]-C,B[1]=L[1]-D,B[2]=L[2]+C,B[3]=L[3]+D;else{S(e.eye,o,ne,d),c(ie,a,ne);let t=-Math.atan2(ie[1],ie[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));v(ie,$[r],2*D),ie[0]*=U,ie[2]*=U,f(B,L,ie)}}if(u)B[0]=this.longitudeCyclical.clamp(B[0]),B[2]=this.longitudeCyclical.clamp(B[2]),B[1]=Math.max(B[1],-I),B[3]=Math.min(B[3],I);else{const e=M(L,p,oe),t=M(B,p,le);j(e,t)&&(B[2]=B[0],B[3]=B[1])}const k=Math.abs(L[2]-L[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,k),r.pixelRatioAdjustment=r.mapUnitsPerPixel/k}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),1===t&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),b(e,s,i)}get test(){}};function re(e,t){const r=1e-5,s=H.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],te.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],te.prototype,"readyToRun",null),e([h()],te.prototype,"_placementDirty",void 0),e([h()],te.prototype,"_contentUpdated",void 0),e([h()],te.prototype,"_isSpherical",null),e([h()],te.prototype,"worldToPCSRatio",null),e([h()],te.prototype,"renderer",void 0),e([h({constructOnly:!0})],te.prototype,"view",void 0),e([h({constructOnly:!0})],te.prototype,"groundView",void 0),e([h({constructOnly:!0})],te.prototype,"terrainSurface",void 0),e([h()],te.prototype,"suspended",null),e([h()],te.prototype,"updating",null),te=e([d("esri.views.3d.terrain.OverlayManager")],te);class se{constructor(){this.inner=P(),this.outer=P(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=Q}}const ie=x(),ne=y(),ae=new se,oe=P(),le=P(),he=U();export{te as OverlayManager};
@@ -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{__decorate as e}from"tslib";import{EventEmitter as 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 d}from"../../../core/reactiveUtils.js";import{someSet as l}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 _}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as y}from"../support/debugFlags.js";import{Overlay as f}from"./Overlay.js";import{OverlayRenderTargets as R}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{T as x}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as T}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as w,renderHighlightBuffer as S}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as O}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as D}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as j}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as E}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as F}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as W}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q,noBudget as V}from"../../support/Scheduler.js";import{Texture as A}from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends T{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new F,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new x,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([[18,e=>9!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new P(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this.spatialReference,e=>this._localOriginFactory=new O(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>w(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,d),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},d),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:l}=this;l.near=1,l.far=1e4,l.relativeElevation=null,n.slot=18,n.mainDepth=null,n.camera=l,n.oitPass=0,n.updateLighting([new M(m())],0,0,0)}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 b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(W)}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&&l(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=l(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=l(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new R(this._stage.renderer.fboCache),this._overlays=[new f,new f]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=t(this._renderers,e=>e.hasOccluders)?H:1}_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._onMaterialOrContentChanged(),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(V,e=>1===e.updatePolicy)}get isEmpty(){return!y.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}renders(e){if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??0,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._renderContext.output=e,r.slot=3===e?19:18,9===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||3===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:d}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,d.screenToWorldRatio=this._screenToWorldRatio,d.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,d.slot=3===n?19:18,4===r.content&&(h.renderOccludedMask=H),!this.renders(r.content))return h.renderOccludedMask=D,!1;const{resolution:l}=t,c=0===e,u=c?0:l;if(o.setViewport(u,0,l,l),this._bindTargetFBO(r),c)if(9!==r.output)o.setClearColor(0,0,0,0),o.clear(16384);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==r.content&&2!==r.content){this._techniques.precompile(j,U);const r=this._techniques.get(j,U);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,I[e]),o.bindTechnique(r,d,this._passParameters),o.screen.draw()}if(9===r.output){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),S(o,t,{width:s,height:s},d,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=D,!0}get allSourcesOccluders(){return s(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(W);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}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?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new L(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),_(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 G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([c()],k.prototype,"hasHighlights",void 0),e([c()],k.prototype,"renderOccludedFlags",void 0),e([c()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],k.prototype,"parent",void 0),e([c({readOnly:!0})],k.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([c()],k.prototype,"isEmpty",null),k=e([u("esri.views.3d.terrain.OverlayRenderer")],k);class L{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const I=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,U=new E;U.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
5
+ import{__decorate as e}from"tslib";import{EventEmitter as 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 d}from"../../../core/reactiveUtils.js";import{someSet as l}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 _}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as y}from"../support/debugFlags.js";import{Overlay as f}from"./Overlay.js";import{OverlayRenderTargets as R}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{T as x}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as T}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as w,renderHighlightBuffer as S}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as O}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as D}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as j}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as E}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as F}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as W}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q,noBudget as V}from"../../support/Scheduler.js";import{Texture as A}from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends T{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new F,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new x,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([[18,e=>9!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new P(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this._spatialReference,e=>this._localOriginFactory=new O(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>w(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,d),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},d),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:l}=this;l.near=1,l.far=1e4,l.relativeElevation=null,n.slot=18,n.mainDepth=null,n.camera=l,n.oitPass=0,n.updateLighting([new M(m())],0,0,0)}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 b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(W)}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&&l(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=l(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=l(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new R(this._stage.renderer.fboCache),this._overlays=[new f,new f]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=t(this._renderers,e=>e.hasOccluders)?H:1}_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._onMaterialOrContentChanged(),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(V,e=>1===e.updatePolicy)}get isEmpty(){return!y.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}renders(e){if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??0,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._renderContext.output=e,r.slot=3===e?19:18,9===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||3===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:d}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,d.screenToWorldRatio=this._screenToWorldRatio,d.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,d.slot=3===n?19:18,4===r.content&&(h.renderOccludedMask=H),!this.renders(r.content))return h.renderOccludedMask=D,!1;const{resolution:l}=t,c=0===e,u=c?0:l;if(o.setViewport(u,0,l,l),this._bindTargetFBO(r),c)if(9!==r.output)o.setClearColor(0,0,0,0),o.clear(16384);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==r.content&&2!==r.content){this._techniques.precompile(j,U);const r=this._techniques.get(j,U);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,I[e]),o.bindTechnique(r,d,this._passParameters),o.screen.draw()}if(9===r.output){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),S(o,t,{width:s,height:s},d,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=D,!0}get allSourcesOccluders(){return s(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(W);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}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?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new L(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),_(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 G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([c()],k.prototype,"hasHighlights",void 0),e([c()],k.prototype,"renderOccludedFlags",void 0),e([c()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],k.prototype,"parent",void 0),e([c({readOnly:!0})],k.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([c()],k.prototype,"isEmpty",null),k=e([u("esri.views.3d.terrain.OverlayRenderer")],k);class L{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const I=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,U=new E;U.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
@@ -2,27 +2,27 @@
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{NoPerspectiveRead as e}from"../util/NoPerspective.glsl.js";import{RgbaFloatEncoding as t}from"../util/RgbaFloatEncoding.glsl.js";import{addCameraPosition as o,addPixelRatio as i}from"../util/View.glsl.js";import{Float4PassUniform as r}from"../../shaderModules/Float4PassUniform.js";import{FloatBindUniform as l}from"../../shaderModules/FloatBindUniform.js";import{FloatPassUniform as a}from"../../shaderModules/FloatPassUniform.js";import{glsl as s,If as n}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{computeTextureSize as d}from"../../../materials/stippleTextureRepository.js";import{ensureColor4 as c}from"../../../shaders/ensureColor4.js";function f(d,f){if(!f.stippleEnabled)return void d.fragment.code.add(s`float getStippleAlpha(float lineWidth) { return 1.0; }
5
+ import{NoPerspectiveRead as e}from"../util/NoPerspective.glsl.js";import{addCameraPosition as t,addPixelRatio as o}from"../util/View.glsl.js";import{Float4PassUniform as r}from"../../shaderModules/Float4PassUniform.js";import{FloatBindUniform as i}from"../../shaderModules/FloatBindUniform.js";import{FloatPassUniform as l}from"../../shaderModules/FloatPassUniform.js";import{glsl as a,If as s}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as n}from"../../shaderModules/Texture2DPassUniform.js";import{computeTextureSize as p}from"../../../materials/stippleTextureRepository.js";import{ensureColor4 as d}from"../../../shaders/ensureColor4.js";function c(p,c){if(!c.stippleEnabled)return void p.fragment.code.add(a`float getStippleAlpha(float lineWidth) { return 1.0; }
6
6
  void discardByStippleAlpha(float stippleAlpha, float threshold) {}
7
- vec4 blendStipple(vec4 color, float stippleAlpha) { return color; }`);const g=!(f.draped&&f.stipplePreferContinuous),{vertex:S,fragment:h}=d;h.include(t),f.draped||(o(S,f),S.uniforms.add(new l("worldToScreenPerDistanceRatio",({camera:e})=>1/e.perScreenPixelRatio)).code.add(s`float computeWorldToScreenRatio(vec3 segmentCenter) {
7
+ vec4 blendStipple(vec4 color, float stippleAlpha) { return color; }`);const u=!(c.draped&&c.stipplePreferContinuous),{vertex:S,fragment:h}=p;c.draped||(t(S,c),S.uniforms.add(new i("worldToScreenPerDistanceRatio",({camera:e})=>1/e.perScreenPixelRatio)).code.add(a`float computeWorldToScreenRatio(vec3 segmentCenter) {
8
8
  float segmentDistanceToCamera = length(segmentCenter - cameraPosition);
9
9
  return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
10
- }`)),d.varyings.add("vStippleDistance","float"),d.varyings.add("vStippleDistanceLimits","vec2"),d.varyings.add("vStipplePatternStretch","float"),S.code.add(s`
10
+ }`)),p.varyings.add("vStippleDistance","float"),p.varyings.add("vStippleDistanceLimits","vec2"),p.varyings.add("vStipplePatternStretch","float"),S.code.add(a`
11
11
  float discretizeWorldToScreenRatio(float worldToScreenRatio) {
12
- float step = ${s.float(u)};
12
+ float step = ${a.float(m)};
13
13
 
14
14
  float discreteWorldToScreenRatio = log(worldToScreenRatio);
15
15
  discreteWorldToScreenRatio = ceil(discreteWorldToScreenRatio / step) * step;
16
16
  discreteWorldToScreenRatio = exp(discreteWorldToScreenRatio);
17
17
  return discreteWorldToScreenRatio;
18
18
  }
19
- `),i(S),S.code.add(s`
19
+ `),o(S),S.code.add(a`
20
20
  vec2 computeStippleDistanceLimits(float startPseudoScreen, float segmentLengthPseudoScreen, float segmentLengthScreen, float patternLength) {
21
21
 
22
22
  // First check if the segment is long enough to support fully screen space patterns.
23
23
  // Force sparse mode for segments that are very large in screen space even if it is not allowed,
24
24
  // to avoid imprecision from calculating with large floats.
25
- if (segmentLengthPseudoScreen >= ${g?"patternLength":"1e4"}) {
25
+ if (segmentLengthPseudoScreen >= ${u?"patternLength":"1e4"}) {
26
26
  // Round the screen length to get an integer number of pattern repetitions (minimum 1).
27
27
  float repetitions = segmentLengthScreen / (patternLength * pixelRatio);
28
28
  float flooredRepetitions = max(1.0, floor(repetitions + 0.5));
@@ -38,7 +38,7 @@ return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
38
38
  }
39
39
  return vec2(startPseudoScreen, startPseudoScreen + segmentLengthPseudoScreen);
40
40
  }
41
- `),h.uniforms.add(new p("stipplePatternTexture",e=>e.stippleTexture),new a("stipplePatternPixelSizeInv",e=>1/m(e))),f.stippleOffColorEnabled&&h.uniforms.add(new r("stippleOffColor",e=>c(e.stippleOffColor))),d.include(e),h.code.add(s`float getStippleSDF(out bool isClamped) {
41
+ `),h.uniforms.add(new n("stipplePatternTexture",e=>e.stippleTexture),new l("stipplePatternPixelSizeInv",e=>1/f(e))),c.stippleOffColorEnabled&&h.uniforms.add(new r("stippleOffColor",e=>d(e.stippleOffColor))),p.include(e),h.code.add(a`float getStippleSDF(out bool isClamped) {
42
42
  float stippleDistanceClamped = noPerspectiveRead(clamp(vStippleDistance, vStippleDistanceLimits.x, vStippleDistanceLimits.y));
43
43
  float lineSizeInv = noPerspectiveRead(vLineSizeInv);
44
44
  vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
@@ -57,12 +57,12 @@ bool isClamped;
57
57
  float stippleSDF = getStippleSDF(isClamped);
58
58
  float antiAliasedResult = clamp(stippleSDF * lineWidth + 0.5, 0.0, 1.0);
59
59
  return isClamped ? floor(antiAliasedResult + 0.5) : antiAliasedResult;
60
- }`),h.code.add(s`
60
+ }`),h.code.add(a`
61
61
  void discardByStippleAlpha(float stippleAlpha, float threshold) {
62
- ${n(!f.stippleOffColorEnabled,"if (stippleAlpha < threshold) { discard; }")}
62
+ ${s(!c.stippleOffColorEnabled,"if (stippleAlpha < threshold) { discard; }")}
63
63
  }
64
64
 
65
65
  vec4 blendStipple(vec4 color, float stippleAlpha) {
66
- return ${f.stippleOffColorEnabled?"mix(color, stippleOffColor, stippleAlpha)":"vec4(color.rgb, color.a * stippleAlpha)"};
66
+ return ${c.stippleOffColorEnabled?"mix(color, stippleOffColor, stippleAlpha)":"vec4(color.rgb, color.a * stippleAlpha)"};
67
67
  }
68
- `)}function m(e){const t=e.stipplePattern;return t?d(e.stipplePattern)/t.pixelRatio:1}const u=.4;export{f as LineStipple,m as computePixelSize};
68
+ `)}function f(e){const t=e.stipplePattern;return t?p(e.stipplePattern)/t.pixelRatio:1}const m=.4;export{c as LineStipple,f as computePixelSize};
@@ -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{getBasisTranscoder as e}from"../../../../libs/basisu/BasisUTranscoder.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import{Texture as n}from"../../../webgl/Texture.js";import{getBytesPerElementFormat as s}from"../../../webgl/Util.js";let r=null,i=null;async function a(){return null==i&&(i=e(),r=await i),i}function l(e,t){if(null==r)return e.byteLength;const n=new r.BasisFile(new Uint8Array(e)),s=u(n)?o(n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),t):0;return n.close(),n.delete(),s}function g(e,t){if(null==r)return e.byteLength;const n=new r.KTX2File(new Uint8Array(e)),s=c(n)?o(n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),t):0;return n.close(),n.delete(),s}function o(e,n,r,i,a){const l=s(n?t.COMPRESSED_RGBA8_ETC2_EAC:t.COMPRESSED_RGB8_ETC2),g=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*l*g)}function u(e){return e.getNumImages()>=1&&!e.isUASTC()}function c(e){return e.getFaces()>=1&&e.isETC1S()}async function m(e,t,n){null==r&&(r=await a());const s=new r.BasisFile(new Uint8Array(n));if(!u(s))return null;s.startTranscoding();const i=h(e,t,s.getNumLevels(0),s.getHasAlpha(),s.getImageWidth(0,0),s.getImageHeight(0,0),(e,t)=>s.getImageTranscodedSizeInBytes(0,e,t),(e,t,n)=>s.transcodeImage(n,0,e,t,0,0));return s.close(),s.delete(),i}async function T(e,t,n){null==r&&(r=await a());const s=new r.KTX2File(new Uint8Array(n));if(!c(s))return null;s.startTranscoding();const i=h(e,t,s.getLevels(),s.getHasAlpha(),s.getWidth(),s.getHeight(),(e,t)=>s.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,n)=>s.transcodeImage(n,e,0,0,t,0,-1,-1));return s.close(),s.delete(),i}function h(e,s,r,i,a,l,g,o){const{compressedTextureETC:u,compressedTextureS3TC:c}=e.capabilities,[m,T]=u?i?[1,t.COMPRESSED_RGBA8_ETC2_EAC]:[0,t.COMPRESSED_RGB8_ETC2]:c?i?[3,t.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,t.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=s.hasMipmap?r:Math.min(1,r),d=[];for(let t=0;t<h;t++)d.push(new Uint8Array(g(t,m))),o(t,m,d[t]);return s.internalFormat=T,s.hasMipmap=d.length>1,s.samplingMode=s.hasMipmap?9987:9729,s.width=a,s.height=l,new n(e,s,{type:"compressed",levels:d})}export{c as checkKTX2,m as createTextureBasis,T as createTextureKTX2,l as estimateMemoryBasis,g as estimateMemoryKTX2,a as loadBasisTranscoder};
5
+ import{getBasisTranscoder as e}from"../../../../libs/basisu/BasisUTranscoder.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import{Texture as n}from"../../../webgl/Texture.js";import{getFormatBytesPerElement as s}from"../../../webgl/Util.js";let r=null,i=null;async function a(){return null==i&&(i=e(),r=await i),i}function l(e,t){if(null==r)return e.byteLength;const n=new r.BasisFile(new Uint8Array(e)),s=u(n)?o(n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),t):0;return n.close(),n.delete(),s}function g(e,t){if(null==r)return e.byteLength;const n=new r.KTX2File(new Uint8Array(e)),s=c(n)?o(n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),t):0;return n.close(),n.delete(),s}function o(e,n,r,i,a){const l=s(n?t.COMPRESSED_RGBA8_ETC2_EAC:t.COMPRESSED_RGB8_ETC2),g=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*l*g)}function u(e){return e.getNumImages()>=1&&!e.isUASTC()}function c(e){return e.getFaces()>=1&&e.isETC1S()}async function m(e,t,n){null==r&&(r=await a());const s=new r.BasisFile(new Uint8Array(n));if(!u(s))return null;s.startTranscoding();const i=h(e,t,s.getNumLevels(0),s.getHasAlpha(),s.getImageWidth(0,0),s.getImageHeight(0,0),(e,t)=>s.getImageTranscodedSizeInBytes(0,e,t),(e,t,n)=>s.transcodeImage(n,0,e,t,0,0));return s.close(),s.delete(),i}async function T(e,t,n){null==r&&(r=await a());const s=new r.KTX2File(new Uint8Array(n));if(!c(s))return null;s.startTranscoding();const i=h(e,t,s.getLevels(),s.getHasAlpha(),s.getWidth(),s.getHeight(),(e,t)=>s.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,n)=>s.transcodeImage(n,e,0,0,t,0,-1,-1));return s.close(),s.delete(),i}function h(e,s,r,i,a,l,g,o){const{compressedTextureETC:u,compressedTextureS3TC:c}=e.capabilities,[m,T]=u?i?[1,t.COMPRESSED_RGBA8_ETC2_EAC]:[0,t.COMPRESSED_RGB8_ETC2]:c?i?[3,t.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,t.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=s.hasMipmap?r:Math.min(1,r),d=[];for(let t=0;t<h;t++)d.push(new Uint8Array(g(t,m))),o(t,m,d[t]);return s.internalFormat=T,s.hasMipmap=d.length>1,s.samplingMode=s.hasMipmap?9987:9729,s.width=a,s.height=l,new n(e,s,{type:"compressed",levels:d})}export{c as checkKTX2,m as createTextureBasis,T as createTextureKTX2,l as estimateMemoryBasis,g as estimateMemoryKTX2,a as loadBasisTranscoder};
@@ -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"../../../../core/has.js";import e from"../../../../core/Error.js";import{EventEmitter as t}from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{generateUID as m}from"../../../../core/uid.js";import{isBlobProtocol as h,isDataProtocol as p}from"../../../../core/urlUtils.js";import{whenVideoPlayable as d}from"../../../../layers/support/videoUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as u}from"../../../../support/requestUtils.js";import{createTextureKTX2 as c,createTextureBasis as g,estimateMemoryKTX2 as T,estimateMemoryBasis as x}from"./BasisUtil.js";import{createDDSTexture as y}from"./DDSUtil.js";import{ensureImageMaxSize as f}from"./textureUtils.js";import{assert as E}from"./Util.js";import{Texture as F}from"../../../webgl/Texture.js";import{TextureDescriptor as D}from"../../../webgl/TextureDescriptor.js";class A{constructor(e,r){this._data=e,this.id=m(),this.events=new t,this._parameters={...v,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(h(e.src)||"auto"===e.preload&&e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){const t=[];d(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){p(e.src)||h(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new D;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||w(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new F(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):l(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):(l(t)||n(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=y(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync(()=>c(e,this._createDescriptor(e),t).then(e=>(this._glTexture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>g(e,this._createDescriptor(e),t).then(e=>(this._glTexture=e,e)))}_loadFromPixelData(e,t){E(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?6409:3===this._parameters.components?6407:6408,6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new F(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync(async r=>{const s=await _(t,{signal:r});return i(r),this._loadFromImage(e,s)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{const s=await u(t,t.src,!1,r);return i(r),this._loadFromImage(e,s)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync(i=>new Promise((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",p),s(d)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},p=t=>{m(),l(t||new e("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",p);const d=a(i,()=>p(o()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=f(r,e.parameters));const s=M(r);this._parameters.width=s.width,this._parameters.height=s.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this._parameters.components?6407:6408,i.width=s.width,i.height=s.height,i.compress=this._parameters.compressionOptions,this._glTexture=new F(e,i,r),this._emptyTexture=null,this.events.emit("loaded"),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function w(e,t){if(null==e)return 0;if(l(e)||n(e))return"image/ktx2"===t.encoding?T(e,!!t.mipmap):"image/x.basis"===t.encoding?x(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?M(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function M(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const v={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{A as Texture};
5
+ import"../../../../core/has.js";import e from"../../../../core/Error.js";import{EventEmitter as t}from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as i}from"../../../../core/maybe.js";import{throwIfAborted as a,onAbort as s,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l,isTypedArray as m}from"../../../../core/typedArrayUtil.js";import{generateUID as h}from"../../../../core/uid.js";import{isBlobProtocol as p,isDataProtocol as d}from"../../../../core/urlUtils.js";import{whenVideoPlayable as _}from"../../../../layers/support/videoUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as c}from"../../../../support/requestUtils.js";import{createTextureKTX2 as g,createTextureBasis as T,estimateMemoryKTX2 as x,estimateMemoryBasis as y}from"./BasisUtil.js";import{createDDSTexture as f}from"./DDSUtil.js";import{ensureImageMaxSize as F}from"./textureUtils.js";import{assert as E}from"./Util.js";import{Texture as D}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";import{getFormatComponents as A}from"../../../webgl/Util.js";class M{constructor(e,r){this._data=e,this.id=h(),this.events=new t,this._parameters={...j,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(p(e.src)||"auto"===e.preload&&e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){const t=[];_(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){d(e.src)||p(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new w;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||v(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new D(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):l(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):(l(t)||n(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):m(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=f(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync(()=>g(e,this._createDescriptor(e),t).then(e=>(this._glTexture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>T(e,this._createDescriptor(e),t).then(e=>(this._glTexture=e,e)))}_loadFromPixelData(e,t){E(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return 6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new D(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync(async r=>{const i=await u(t,{signal:r});return a(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{const i=await c(t,t.src,!1,r);return a(r),this._loadFromImage(e,i)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync(a=>new Promise((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",p),i(d)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},p=t=>{m(),l(t||new e("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",p);const d=s(a,()=>p(o()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=F(r,e.parameters));const i=U(r);this._parameters.width=i.width,this._parameters.height=i.height;const a=this._createDescriptor(e);return a.width=i.width,a.height=i.height,a.compress=this._parameters.compressionOptions,this._glTexture=new D(e,a,r),this._emptyTexture=null,this.events.emit("loaded"),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(i,i),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function v(e,t){if(null==e)return 0;if(l(e)||n(e))return"image/ktx2"===t.encoding?x(e,!!t.mipmap):"image/x.basis"===t.encoding?y(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?U(e):t,a=t.pixelFormat??6408,s=A(a);return(t.mipmap?4/3:1)*r*i*s||0}function U(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const j={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{M as Texture};
@@ -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 s{constructor(s,o){this.vao=s,this.instanceCount=o}dispose(){this.vao.disposeVAOOnly()}}export{s as InstancedCommandVAO};
@@ -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
+ import{NestedMap as s}from"../../../../../core/NestedMap.js";class a{constructor(){this.commandVAOs=new s,this.drawCommandsDefault=new Array,this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=new Array,this.drawCommandsShadowHighlightRest=new Array}clear(){this.commandVAOs.clear(),this.drawCommandsDefault.length=0,this.drawCommandsHighlights.clear(),this.drawCommandsOccludees.length=0,this.drawCommandsShadowHighlightRest.length=0}dispose(){for(const s of this.commandVAOs.values())s.dispose();this.clear()}}export{a as InstancedCommandVAOs};
@@ -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{getOrCreateMapValue as t}from"../../../../../core/MapUtils.js";import s from"../../../../../core/PooledArray.js";import{BufferRange as e}from"./BufferRange.js";import{DrawCommand as i}from"./DrawCommand.js";import{defaultHighlightName as n}from"../../../../support/HighlightDefaults.js";class a{constructor(t){this.targetBuffer=t,this.vaoEndElement=0,this._numElements=0,this._instances=new Map,this.holes=new s({allocator:t=>t||new e,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=m(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=m(),this.drawCommandsShadowHighlightRest=m()}get numElements(){return this._numElements}get instances(){return this._instances}get writeableInstances(){return this._instances}get hasHighlights(){return this.highlightNames.size>0}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateIfDrawCommandsDirty(t){if(this.drawCommandsDirty){this.resetInstanceSummary();for(const t of this.instances.values())this.updateDrawState(t);this.updateDrawCommands(t)}}addInstance(t,s){this.deleteInstance(t),this._instances.set(t,s),this._numElements+=s.numElements}deleteInstance(t){const s=this._instances.get(t);s&&(this._numElements-=s.numElements,this._instances.delete(t))}updateInstances(){let t=0;for(const s of this._instances.values())t+=s.numElements,this.updateDrawState(s);this._numElements=t}updateDrawState(t){if(t.isVisible){const{highlightName:s}=t;s&&this.highlightNames.add(s),t.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(t){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,0===this._instances.size)return;const{sortedInstances:s}=this;if(this._updateHighlightDrawCommands(t,s),!this.needsMultipleCommands){const t=this.drawCommandsDefault.pushNew(),s=this.holes.front();return this.vao&&1===this.holes.length&&s.to===this.vaoEndElement?(t.first=0,void(t.count=s.from)):(t.first=1/0,t.count=0,this._instances.forEach(s=>{t.first=Math.min(t.first,s.from),t.count=Math.max(t.count,s.to)}),void(t.count-=t.first))}for(const e of s)e.isVisible&&l(e.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,e)}get sortedInstances(){return Array.from(this._instances.values()).sort((t,s)=>t.from===s.from?t.to-s.to:t.from-s.from)}updateHighlights(t){this.highlightNames.clear();const s=this.sortedInstances;for(const e of s)e.updateHighlightOptions(t),e.isVisible&&e.highlightName&&this.highlightNames.add(e.highlightName);this._updateHighlightDrawCommands(t)}_updateHighlightDrawCommands(s,e=this.sortedInstances){const{drawCommandsHighlights:i,drawCommandsShadowHighlightRest:a}=this;i.clear(),a.clear();for(const h of e){if(h.updateHighlightOptions(s),!h.isVisible)continue;const{highlightName:e}=h;if(e){this.highlightNames.add(e);l(t(i,e,m),h)}e&&e===n||l(a,h)}}get needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}}class h extends a{}function o(t){return null!=t.vao}function r(t){return t?"instances":"geometry"}function m(){return new s({allocator:t=>t||new i,deallocator:t=>t})}function l(t,s){const e=t.back();if(null==e){const e=t.pushNew();return e.first=s.from,void(e.count=s.numElements)}if(c(e,s)){const t=s.from-e.first+s.numElements;e.count=t}else{const e=t.pushNew();e.first=s.from,e.count=s.numElements}}function c(t,s){return t.first+t.count>=s.from}export{a as PerBufferData,h as PerVaoData,r as getTargetBuffer,o as hasVao};
5
+ import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import t from"../../../../../core/PooledArray.js";import{BufferRange as e}from"./BufferRange.js";import{DrawCommand as n}from"./DrawCommand.js";import{InstancedCommandVAO as a}from"./InstancedCommandVAO.js";import{InstancedCommandVAOs as i}from"./InstancedCommandVAOs.js";import{defaultHighlightName as o}from"../../../../support/HighlightDefaults.js";class h{constructor(s){this.targetBuffer=s,this.vaoEndElement=0,this._numElements=0,this._instances=new Map,this.holes=new t({allocator:s=>s||new e,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=d(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=d(),this.drawCommandsShadowHighlightRest=d(),this._instancedCommandVAOs=null}get numElements(){return this._numElements}get instances(){return this._instances}get writeableInstances(){return this._instances}get hasHighlights(){return this.highlightNames.size>0}get instancedCommandVAOs(){return this._instancedCommandVAOs}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateIfDrawCommandsDirty(s){if(this.drawCommandsDirty){this.resetInstanceSummary();for(const s of this.instances.values())this.updateDrawState(s);this.updateDrawCommands(s)}}addInstance(s,t){this.deleteInstance(s),this._instances.set(s,t),this._numElements+=t.numElements}deleteInstance(s){const t=this._instances.get(s);t&&(this._numElements-=t.numElements,this._instances.delete(s))}updateInstances(){let s=0;for(const t of this._instances.values())s+=t.numElements,this.updateDrawState(t);this._numElements=s}updateDrawState(s){if(s.isVisible){const{highlightName:t}=s;t&&this.highlightNames.add(t),s.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(s){this._updateDrawCommands(s),this._updateInstancedCommandVAOs()}_updateDrawCommands(s){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,0===this._instances.size)return;const{sortedInstances:t}=this;if(this._updateHighlightDrawCommands(s,t),!this.needsMultipleCommands){const s=this.drawCommandsDefault.pushNew(),t=this.holes.front();return this.vao&&1===this.holes.length&&t.to===this.vaoEndElement?(s.first=0,void(s.count=t.from)):(s.first=1/0,s.count=0,this._instances.forEach(t=>{s.first=Math.min(s.first,t.from),s.count=Math.max(s.count,t.to)}),void(s.count-=s.first))}for(const e of t)e.isVisible&&c(e.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,e)}get sortedInstances(){return Array.from(this._instances.values()).sort((s,t)=>s.from===t.from?s.to-t.to:s.from-t.from)}updateHighlights(s){this.highlightNames.clear();const t=this.sortedInstances;for(const e of t)e.updateHighlightOptions(s),e.isVisible&&e.highlightName&&this.highlightNames.add(e.highlightName);this._updateHighlightDrawCommands(s),this._updateInstancedCommandVAOs()}_updateHighlightDrawCommands(t,e=this.sortedInstances){const{drawCommandsHighlights:n,drawCommandsShadowHighlightRest:a}=this;n.clear(),a.clear();for(const i of e){if(i.updateHighlightOptions(t),!i.isVisible)continue;const{highlightName:e}=i;if(e){this.highlightNames.add(e);c(s(n,e,d),i)}e&&e===o||c(a,i)}}_updateInstancedCommandVAOs(){const s=this.vao;if("geometry"===this.targetBuffer||null==s)return;this._instancedCommandVAOs??=new i;const t=this._instancedCommandVAOs,e=t.commandVAOs.copy();t.clear();const n=t.commandVAOs,o=(t,i)=>{for(const o of t){const{first:t,count:h}=o,m=n.get(t,h)??e.pop(t,h)??new a(s.shallowCloneWithBaseInstances(new Map([["instances",o.first]])),o.count);n.set(t,h,m),i.push(m)}};o(this.drawCommandsDefault,t.drawCommandsDefault);for(const[a,i]of this.drawCommandsHighlights){const s=new Array;o(i,s),t.drawCommandsHighlights.set(a,s)}o(this.drawCommandsOccludees,t.drawCommandsOccludees),o(this.drawCommandsShadowHighlightRest,t.drawCommandsShadowHighlightRest);for(const a of e.values())a.dispose();e.clear()}get needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}}function m(s){return null!=s.vao}function r(s){return s?"instances":"geometry"}function d(){return new t({allocator:s=>s||new n,deallocator:s=>s})}function c(s,t){const e=s.back();if(null==e){const e=s.pushNew();return e.first=t.from,void(e.count=t.numElements)}if(l(e,t)){const s=t.from-e.first+t.numElements;e.count=s}else{const e=s.pushNew();e.first=t.from,e.count=t.numElements}}function l(s,t){return s.first+s.count>=t.from}export{h as PerBufferData,r as getTargetBuffer,m as hasVao};
@@ -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
- class s{constructor(s,e){this.origin=s,this.isInstanced=e,this.buffers=new Array}dispose(){if(this.isInstanced)for(const s of this.buffers)s.vao.buffer("instances")?.dispose(),s.vao.disposeVAOOnly();else for(const s of this.buffers)s.vao.dispose();this.buffers.length=0}findBuffer(s){return this.buffers.find(e=>e.instances.has(s))}}export{s as PerOriginData};
5
+ class s{constructor(s,e){this.origin=s,this.isInstanced=e,this.buffers=new Array}dispose(){if(this.isInstanced)for(const s of this.buffers)s.vao.buffer("instances")?.dispose(),s.vao.disposeVAOOnly(),s.instancedCommandVAOs?.dispose();else for(const s of this.buffers)s.vao.dispose();this.buffers.length=0}findBuffer(s){return this.buffers.find(e=>e.instances.has(s))}}export{s as PerOriginData};
@@ -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{__decorate as t}from"tslib";import s from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import{disposeMaybe as e}from"../../../../../core/maybe.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{GLMaterials as a}from"../../lib/GLMaterials.js";import{DrawParameters as o}from"../DrawParameters.js";import{defaultHighlightName as n}from"../../../../support/HighlightDefaults.js";import{bindVertexBufferLayout as l}from"../../../../webgl/Util.js";let h=class extends s{constructor(t){super(t),this._glMaterials=null,this._drawParameters=new o,this._highlightNames=new Set,this._produces=new Map}initialize(){this._updateProduces()}destroy(){this.uninitializeRenderContext()}get _hasHighlights(){return this._highlightNames.size>0}hasHighlight(t){return this._highlightNames.has(t)}get produces(){return this._produces}_updateProduces(){this.material.produces.forEach((t,s)=>{this._produces.set(s,s=>!(0===this.dataByBaseInstance.size||!(9!==s&&5!==s||this._hasHighlights))&&t(s))})}initializeRenderContext(t){this._glMaterials=new a(this.material,t.materials)}uninitializeRenderContext(){this._glMaterials=e(this._glMaterials)}acquireTechniques(t){if(!this.material.shouldRender(t))return null;const{output:s,bind:e}=t,i=this.material.produces.get(e.slot);if(!i?.(s))return null;const{highlight:r,slot:a}=e,o=5===s,l=9===s,h=l||o,d=r?.name;if(h&&(0===this._highlightNames.size||l&&d&&!this._highlightNames.has(d)))return null;const c=t=>l&&!!d&&!t.has(d),g=6===s,m=!(h||g);for(const u of this.dataByBaseInstance.values())for(const i of u.dataByOrigin.values())for(const r of i.buffers){if(c(r.highlightNames))continue;const i=o?r.drawCommandsHighlights.get(n):h?d?r.drawCommandsHighlights.get(d):r.drawCommandsHighlights.size>0:((g&&r.needsMultipleCommands?r.drawCommandsShadowHighlightRest:r.drawCommandsDefault)||null)?.length??!1,l=m&&r.drawCommandsOccludees||null;if(i||l?.length){const i=this._glMaterials.load(t.rctx,a,s),r=i?.beginSlot(e);if(r)return r}}return null}render(t,s){const{output:e,bind:i}=t,{slot:r,highlight:a}=i,o=9===e,l=a?.name??"";if(o&&!a)return;const h=5===e,g=o||h,m=6===e,u=!(g||m),f=10===r||11===r?r:null,{rctx:p}=t;p.runAppleAmdDriverHelper();const w=p.bindTechnique(s,i,this.material.parameters);for(const _ of this.dataByBaseInstance.values()){const{baseInstanceData:t}=_,e=null==t?d:c;for(const r of _.dataByOrigin.values())for(const a of r.buffers){if(o&&(!a.hasHighlights||!a.drawCommandsHighlights.has(l)))continue;if(h&&(!a.hasHighlights||!a.drawCommandsHighlights.has(n)))continue;const d=g&&!h?a.drawCommandsHighlights.get(l)??null:null,c=h?a.drawCommandsHighlights.get(n):g?d:m&&a.needsMultipleCommands?a.drawCommandsShadowHighlightRest:a.drawCommandsDefault,_=u&&a.drawCommandsOccludees||null;if(c?.length||_?.length){const{vao:o}=a;this._drawParameters.origin=r.origin,w.bindDraw(i,this.material.parameters,this._drawParameters),s.ensureAttributeLocations(o),p.bindVAO(o),e(p,s,t,o,c,f,!1),e(p,s,t,o,_,f,!0)}}}}updateHighlights(){const{_highlightNames:t}=this;t.clear();for(const s of this.dataByBaseInstance.values())for(const e of s.dataByOrigin.values())for(const s of e.buffers)for(const e of s.highlightNames)t.add(e);this._updateProduces()}get test(){}};t([i({constructOnly:!0})],h.prototype,"material",void 0),t([i({constructOnly:!0})],h.prototype,"dataByBaseInstance",void 0),h=t([r("esri.views.3d.webgl-engine.materials.renderers.VaoRenderer")],h);const d=(t,s,e,i,r,a,o)=>{if(r?.length){t.setPipelineState(s.getPipeline(o,a));for(const e of r)t.drawArrays(s.primitiveType,e.first,e.count)}},c=(t,s,e,i,r,a,o)=>{if(!r?.length)return;const n=e.baseCommand;t.setPipelineState(s.getPipeline(o,a));for(const h of r)l(t,i.locations,i.buffer("instances"),h.first),t.drawArraysInstanced(s.primitiveType,n.first,n.count,h.count)};export{h as VaoRenderer};
5
+ import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{GLMaterials as a}from"../../lib/GLMaterials.js";import{DrawParameters as n}from"../DrawParameters.js";import{defaultHighlightName as o}from"../../../../support/HighlightDefaults.js";let h=class extends e{constructor(t){super(t),this._glMaterials=null,this._drawParameters=new n,this._highlightNames=new Set,this._produces=new Map}initialize(){this._updateProduces()}destroy(){this.uninitializeRenderContext()}get _hasHighlights(){return this._highlightNames.size>0}hasHighlight(t){return this._highlightNames.has(t)}get produces(){return this._produces}_updateProduces(){this.material.produces.forEach((t,e)=>{this._produces.set(e,e=>!(0===this.dataByBaseInstance.size||!(9!==e&&5!==e||this._hasHighlights))&&t(e))})}initializeRenderContext(t){this._glMaterials=new a(this.material,t.materials)}uninitializeRenderContext(){this._glMaterials=s(this._glMaterials)}acquireTechniques(t){if(!this.material.shouldRender(t))return null;const{output:e,bind:s}=t,i=this.material.produces.get(s.slot);if(!i?.(e))return null;const{highlight:r,slot:a}=s,n=5===e,h=9===e,l=h||n,d=r?.name;if(l&&(0===this._highlightNames.size||h&&d&&!this._highlightNames.has(d)))return null;const c=t=>h&&!!d&&!t.has(d),u=6===e,g=!(l||u);for(const m of this.dataByBaseInstance.values())for(const i of m.dataByOrigin.values())for(const r of i.buffers){if(c(r.highlightNames))continue;const i=n?r.drawCommandsHighlights.get(o):l?d?r.drawCommandsHighlights.get(d):r.drawCommandsHighlights.size>0:((u&&r.needsMultipleCommands?r.drawCommandsShadowHighlightRest:r.drawCommandsDefault)||null)?.length??!1,h=g&&r.drawCommandsOccludees||null;if(i||h?.length){const i=this._glMaterials.load(t.rctx,a,e),r=i?.beginSlot(s);if(r)return r}}return null}render(t,e){const{output:s,bind:i}=t,{slot:r,highlight:a}=i,n=9===s,h=a?.name??"";if(n&&!a)return;const g=5===s,m=n||g,w=6===s,C=!(m||w),_=10===r||11===r?r:null,{rctx:b}=t;b.runAppleAmdDriverHelper();const y=b.bindTechnique(e,i,this.material.parameters);for(const H of this.dataByBaseInstance.values()){const{baseInstanceData:t}=H,s=null!=t,r=s?u:c,a=s?d:l;for(const l of H.dataByOrigin.values()){this._drawParameters.origin=l.origin;for(const s of l.buffers){if(n&&(!s.hasHighlights||!s.drawCommandsHighlights.has(h)))continue;if(g&&(!s.hasHighlights||!s.drawCommandsHighlights.has(o)))continue;const l=a(s),d=f(l,s.needsMultipleCommands,h,g,m,w),c=p(l,C);(d?.length||c?.length)&&(y.bindDraw(i,this.material.parameters,this._drawParameters),r(b,s,t,e,d,c,_))}}}}updateHighlights(){const{_highlightNames:t}=this;t.clear();for(const e of this.dataByBaseInstance.values())for(const s of e.dataByOrigin.values())for(const e of s.buffers)for(const s of e.highlightNames)t.add(s);this._updateProduces()}get test(){}};t([i({constructOnly:!0})],h.prototype,"material",void 0),t([i({constructOnly:!0})],h.prototype,"dataByBaseInstance",void 0),h=t([r("esri.views.3d.webgl-engine.materials.renderers.VaoRenderer")],h);const l=t=>t,d=t=>t.instancedCommandVAOs,c=(t,{vao:e},s,i,r,a,n)=>{i.ensureAttributeLocations(e),t.bindVAO(e),g(t,i,r,n,!1),g(t,i,a,n,!0)},u=(t,e,{baseCommand:s},i,r,a,n)=>{m(t,i,s,r,n,!1),m(t,i,s,a,n,!0)};function g(t,e,s,i,r){if(s?.length){t.setPipelineState(e.getPipeline(r,i));for(const i of s)t.drawArrays(e.primitiveType,i.first,i.count)}}function m(t,e,{first:s,count:i},r,a,n){if(r?.length){t.setPipelineState(e.getPipeline(n,a));for(const{vao:a,instanceCount:n}of r)e.ensureAttributeLocations(a),t.bindVAO(a),t.drawArraysInstanced(e.primitiveType,s,i,n)}}function f(t,e,s,i,r,a){const n=r&&!i?t.drawCommandsHighlights.get(s)??null:null;return i?t.drawCommandsHighlights.get(o):r?n:a&&e?t.drawCommandsShadowHighlightRest:t.drawCommandsDefault}function p(t,e){return e&&t.drawCommandsOccludees||null}export{h as VaoRenderer};
@@ -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{nextHighestPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{copy as e,invert as r,transpose as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as s}from"../../../support/buffer/glUtil.js";import{assert as n}from"../../lib/Util.js";import{VertexArrayObject as i}from"../../lib/VertexArrayObject.js";import{DrawCommand as f}from"./DrawCommand.js";import{BaseInstanceData as u}from"./PerBaseInstanceData.js";import{VertexBuffer as l}from"../../../../webgl/VertexBuffer.js";class c{constructor(t,e){this._rctx=e,this._bufferWriter=t.createBufferWriter(),this._vaoCache=e.getVaoCache(s(this._bufferWriter.layout))}maxElements(t){return Math.floor(d/this._targetStrideFloats(t))}_targetStrideFloats(t){return this._targetStrideBytes(t)/4}_targetStrideBytes(t){return this._targetLayout(t)?.stride??0}_targetLayout(t){return"geometry"===t?this._bufferWriter.layout:this._bufferWriter.instanceLayout}endElement(t){return Math.floor((t.vao?.getByteLength(t.targetBuffer)??0)/this._targetStrideBytes(t.targetBuffer))}evaluateBufferAllocation(t,e,r,a){const o=this._targetStrideFloats(a.targetBuffer),s=e.reduce((t,{geometry:e})=>t+this.elementCount(e),0),n=r.reduce((t,{geometry:e})=>t+this.elementCount(e),0),i=Math.min((t+s-n)*o,d),f=a.vao?.buffer(a.targetBuffer),u=(f?.sizeBytes??0)/4;return i>h&&i<u/2?0:i>u?1:2}deleteBuffer(t){if("instances"===t.targetBuffer)return t.vao?.buffer("instances")?.dispose(),t.vao?.disposeVAOOnly(),void(t.vao=null);this._vaoCache.deleteVao(t.vao)}createBaseInstanceData(t){const{_bufferWriter:e}=this;if(null==t||null==e.writeBaseInstance||null==e.elementCountBaseInstance)return null;const r=e.layout,a=e.elementCountBaseInstance(t.attributes),o=a*this._targetStrideFloats("geometry"),n=new l(this._rctx,s(r));n.setSize(Math.ceil(4*o));const i=w(o),c=r.createView(i.buffer);e.writeBaseInstance(t.attributes,c),n.setSubData(i,0,0,o);const m=new f;return m.first=0,m.count=a,new u(t,n,m)}_allocateInstanceBuffer(t){const e=this._bufferWriter.instanceLayout;n(null!=e,"Trying to allocate an instance buffer, but the BufferWriter does not support instancing");const r=t*this._targetStrideFloats("instances"),a=new l(this._rctx,s(e,1));return a.setSize(S(r)),a}_createInstancedVao(t,e){return new i(this._rctx,new Map([["geometry",t],["instances",e]]))}reallocateBuffer(t,e,r){if(this.deleteBuffer(e),null!=t){const e=t.baseInstanceBuffer,a=this._allocateInstanceBuffer(r);return this._createInstancedVao(e,a)}const a=r*this._targetStrideFloats("geometry");return this._vaoCache.newVao(S(a))}elementCount(t){return this._bufferWriter.elementCount(t.attributes)}canGrow(t,e){const{targetBuffer:r,vao:a}=t;if(null==a)return!0;const o=4*(e*this._targetStrideFloats(r));return a.getByteLength(r)<S(d-h)&&o>a.getByteLength(r)}clearHoles(t,{vao:e,targetBuffer:r}){const a=this._targetStrideFloats(r),o=t.reduce((t,e)=>Math.max(t,e.numElements),0)*a,s=w(o);s.fill(0,0,o);const n=e.buffer(r);for(const i of t)n?.setSubData(s,i.from*a,0,i.numElements*a)}clearHolesMetal(t,e,r,{vao:a,targetBuffer:o}){const s=this._targetStrideFloats(o),n=(r-e)*s,i=w(n),f=this._targetLayout(o).createView(i.buffer);i.fill(0,0,n);for(const u of t){if(!(u.from>=e&&u.to<=r))continue;const t=u.from-e;this._writeGeometry(u.geometry,f,t)}a.buffer(o)?.setSubData(i,e*s,0,n)}writeRandomInstances(t,e,{vao:r,targetBuffer:a}){const o=this._targetStrideFloats(a),s=w(t*o),n=this._targetLayout(a).createView(s.buffer);let i=0,f=0,u=0;const l=r.buffer(a);for(const m of e){if(!(u===m.from)){const t=u-f;t>0&&l?.setSubData(s,f*o,0,t*o),f=m.from,i=0}this._writeGeometry(m.geometry,n,i),i+=m.numElements,u=m.to}const c=u-f;c>0&&l?.setSubData(s,f*o,0,c*o)}writeInstanceRangeMetal(t,e,r,{vao:a,targetBuffer:o}){const s=this._targetStrideFloats(o),n=t-e,i=n*s,f=w(i),u=this._targetLayout(o).createView(f.buffer);f.fill(0,0,i);for(const l of r){if(!(l.from>=e&&l.to<=t))continue;const r=l.from-e;this._writeGeometry(l.geometry,u,r)}n>0&&a.buffer(o)?.setSubData(f,e*s,0,i)}rebuildInstances(t,e,{vao:r,targetBuffer:a}){const o=this._targetStrideFloats(a),s=w(t*o),n=this._targetLayout(a).createView(s.buffer);let i=0;for(const f of e){this._writeGeometry(f.geometry,n,i);const t=i;i+=this.elementCount(f.geometry.geometry),f.from=t,f.to=i}return r?.buffer(a)?.setSubData(s,0,0,i*o),i}updateInstance(t,{vao:e,targetBuffer:r}){const{_bufferWriter:a}=this,o=this._targetStrideFloats(r),s=w(a.elementCount(t.geometry.geometry.attributes)*o),n=this._targetLayout(r).createView(s.buffer);this._writeGeometry(t.geometry,n,0),e.buffer(r)?.setSubData(s,t.from*o,0,t.numElements*o)}_writeGeometry(t,o,s){const{_bufferWriter:n}=this;null!=n&&(e(m,t.transformation),m[12]-=t.localOrigin.vec3[0],m[13]-=t.localOrigin.vec3[1],m[14]-=t.localOrigin.vec3[2],r(g,m),a(g,g),n.write(m,g,t.geometry.attributes,t.geometry.olidColor,o,s))}static prune(){B=new Float32Array(h)}}const m=o(),g=o(),h=65536,_=4*h,y=1024,b=16777216,d=b/4;let B=new Float32Array(h);function w(t){return B.length<t&&(B=new Float32Array(t)),B}function S(e){const r=4*e;return r<=y?y:r<_?t(r):Math.max(Math.min(Math.ceil(1.5*r/_)*_,b),r)}export{c as VaoWriter};
5
+ import{nextHighestPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{copy as e,invert as r,transpose as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as s}from"../../../support/buffer/glUtil.js";import{assert as n}from"../../lib/Util.js";import{VertexArrayObject as i}from"../../lib/VertexArrayObject.js";import{DrawCommand as f}from"./DrawCommand.js";import{BaseInstanceData as u}from"./PerBaseInstanceData.js";import{VertexBuffer as c}from"../../../../webgl/VertexBuffer.js";class l{constructor(t,e){this._rctx=e,this._bufferWriter=t.createBufferWriter(),this._vaoCache=e.getVaoCache(s(this._bufferWriter.layout))}maxElements(t){return Math.floor(d/this._targetStrideFloats(t))}_targetStrideFloats(t){return this._targetStrideBytes(t)/4}_targetStrideBytes(t){return this._targetLayout(t)?.stride??0}_targetLayout(t){return"geometry"===t?this._bufferWriter.layout:this._bufferWriter.instanceLayout}endElement(t){return Math.floor((t.vao?.getByteLength(t.targetBuffer)??0)/this._targetStrideBytes(t.targetBuffer))}evaluateBufferAllocation(t,e,r,a){const o=this._targetStrideFloats(a.targetBuffer),s=e.reduce((t,{geometry:e})=>t+this.elementCount(e),0),n=r.reduce((t,{geometry:e})=>t+this.elementCount(e),0),i=Math.min((t+s-n)*o,d),f=a.vao?.buffer(a.targetBuffer),u=(f?.sizeBytes??0)/4;return i>h&&i<u/2?0:i>u?1:2}deleteBuffer(t){if("instances"===t.targetBuffer)return t.instancedCommandVAOs?.dispose(),t.vao?.buffer("instances")?.dispose(),t.vao?.disposeVAOOnly(),void(t.vao=null);this._vaoCache.deleteVao(t.vao)}createBaseInstanceData(t){const{_bufferWriter:e}=this;if(null==t||null==e.writeBaseInstance||null==e.elementCountBaseInstance)return null;const r=e.layout,a=e.elementCountBaseInstance(t.attributes),o=a*this._targetStrideFloats("geometry"),n=new c(this._rctx,s(r));n.setSize(Math.ceil(4*o));const i=w(o),l=r.createView(i.buffer);e.writeBaseInstance(t.attributes,l),n.setSubData(i,0,0,o);const m=new f;return m.first=0,m.count=a,new u(t,n,m)}_allocateInstanceBuffer(t){const e=this._bufferWriter.instanceLayout;n(null!=e,"Trying to allocate an instance buffer, but the BufferWriter does not support instancing");const r=t*this._targetStrideFloats("instances"),a=new c(this._rctx,s(e,1));return a.setSize(S(r)),a}_createInstancedVao(t,e){return new i(this._rctx,new Map([["geometry",t],["instances",e]]))}reallocateBuffer(t,e,r){if(this.deleteBuffer(e),null!=t){const e=t.baseInstanceBuffer,a=this._allocateInstanceBuffer(r);return this._createInstancedVao(e,a)}const a=r*this._targetStrideFloats("geometry");return this._vaoCache.newVao(S(a))}elementCount(t){return this._bufferWriter.elementCount(t.attributes)}canGrow(t,e){const{targetBuffer:r,vao:a}=t;if(null==a)return!0;const o=4*(e*this._targetStrideFloats(r));return a.getByteLength(r)<S(d-h)&&o>a.getByteLength(r)}clearHoles(t,{vao:e,targetBuffer:r}){const a=this._targetStrideFloats(r),o=t.reduce((t,e)=>Math.max(t,e.numElements),0)*a,s=w(o);s.fill(0,0,o);const n=e.buffer(r);for(const i of t)n?.setSubData(s,i.from*a,0,i.numElements*a)}clearHolesMetal(t,e,r,{vao:a,targetBuffer:o}){const s=this._targetStrideFloats(o),n=(r-e)*s,i=w(n),f=this._targetLayout(o).createView(i.buffer);i.fill(0,0,n);for(const u of t){if(!(u.from>=e&&u.to<=r))continue;const t=u.from-e;this._writeGeometry(u.geometry,f,t)}a.buffer(o)?.setSubData(i,e*s,0,n)}writeRandomInstances(t,e,{vao:r,targetBuffer:a}){const o=this._targetStrideFloats(a),s=w(t*o),n=this._targetLayout(a).createView(s.buffer);let i=0,f=0,u=0;const c=r.buffer(a);for(const m of e){if(!(u===m.from)){const t=u-f;t>0&&c?.setSubData(s,f*o,0,t*o),f=m.from,i=0}this._writeGeometry(m.geometry,n,i),i+=m.numElements,u=m.to}const l=u-f;l>0&&c?.setSubData(s,f*o,0,l*o)}writeInstanceRangeMetal(t,e,r,{vao:a,targetBuffer:o}){const s=this._targetStrideFloats(o),n=t-e,i=n*s,f=w(i),u=this._targetLayout(o).createView(f.buffer);f.fill(0,0,i);for(const c of r){if(!(c.from>=e&&c.to<=t))continue;const r=c.from-e;this._writeGeometry(c.geometry,u,r)}n>0&&a.buffer(o)?.setSubData(f,e*s,0,i)}rebuildInstances(t,e,{vao:r,targetBuffer:a}){const o=this._targetStrideFloats(a),s=w(t*o),n=this._targetLayout(a).createView(s.buffer);let i=0;for(const f of e){this._writeGeometry(f.geometry,n,i);const t=i;i+=this.elementCount(f.geometry.geometry),f.from=t,f.to=i}return r?.buffer(a)?.setSubData(s,0,0,i*o),i}updateInstance(t,{vao:e,targetBuffer:r}){const{_bufferWriter:a}=this,o=this._targetStrideFloats(r),s=w(a.elementCount(t.geometry.geometry.attributes)*o),n=this._targetLayout(r).createView(s.buffer);this._writeGeometry(t.geometry,n,0),e.buffer(r)?.setSubData(s,t.from*o,0,t.numElements*o)}_writeGeometry(t,o,s){const{_bufferWriter:n}=this;null!=n&&(e(m,t.transformation),m[12]-=t.localOrigin.vec3[0],m[13]-=t.localOrigin.vec3[1],m[14]-=t.localOrigin.vec3[2],r(g,m),a(g,g),n.write(m,g,t.geometry.attributes,t.geometry.olidColor,o,s))}static prune(){B=new Float32Array(h)}}const m=o(),g=o(),h=65536,_=4*h,y=1024,b=16777216,d=b/4;let B=new Float32Array(h);function w(t){return B.length<t&&(B=new Float32Array(t)),B}function S(e){const r=4*e;return r<=y?y:r<_?t(r):Math.max(Math.min(Math.ceil(1.5*r/_)*_,b),r)}export{l as VaoWriter};
@@ -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{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{toConst as r}from"../../../../core/compilerUtils.js";import{unpackFloatRGBA as s}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{watch as a,initial as h,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as u,isMars as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{ChapmanAtmosphere as _}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as g}from"../../environment/CloudsComposition.js";import{Fog as w}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import{MarsAtmosphere as v}from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as j}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as R}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ObjectAndLayerIDRenderNode as b}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{GlowRenderNode as A}from"../effects/glow/GlowRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as S}from"../effects/highlight/Highlight.js";import{ShadowHighlight as q}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as U}from"../effects/magnifier/Magnifier.js";import{SMAA as M}from"../effects/smaa/SMAA.js";import{SSAO as k}from"../effects/ssao/SSAO.js";import{Stars as L}from"../effects/stars/Stars.js";import D from"../lib/CompositingHelper.js";import{GLMaterialRepository as H}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as F}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as B}from"../lib/RenderingContext.js";import{RenderingContextOptions as E}from"../lib/RenderingContextOptions.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as N}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as z}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as I}from"./contextCache.js";import{removeLoadedShaderModules as V}from"./renderUtils.js";import{ScreenshotManager as X,ScreenshotContext as Q}from"./ScreenshotManager.js";import{contextCache as J}from"./testUtils.js";import{noBudget as K}from"../../../support/Scheduler.js";import{checkWebGLError as Y}from"../../../webgl/checkWebGLError.js";let Z=class extends t{constructor(e){super(e),this._waterTextures=new P,this.olidRenderHelper=C()?new F:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.glow=null,this.fog=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:r}=t.view.resourceController;this._stippleTextures=z(this._rctx,r),this.notifyChange("stippleTextures"),this._markerTextures=N(this._rctx,r),this.notifyChange("markerTextures"),this._techniques=new R(new j(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t),this.addHandles(this._textures.events.on("changed",e=>this.requestRender(e)));const s=new H(this._textures,this._techniques,()=>this.requestRender(),()=>this.requestRender());this._compositingHelper=new D(this._rctx,this._techniques),this._renderer=new W(t,s,this._techniques,this._rctx,this._compositingHelper,e=>this.requestRender(e)),this.notifyChange("renderer"),this.addHandles([a(()=>t.view.ready,e=>{e&&this._createRenderNodes()},h),a(()=>this.waterTextures?.updating,()=>this.requestRender(),h),a(()=>t.view.qualityProfile,e=>this.renderer?.updateRenderFeatures(e),l)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new X(this._rctx,i,e=>t.view.basemapTerrain.overlayManager.updateOverlays(K,e.camera,0)),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this._techniques=o(this._techniques),this._componentObjectCollection=o(this._componentObjectCollection),this._set("componentObjectCollection",null),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._waterTextures=null,this._markerTextures=null,this._stippleTextures=null,this._canvas=null,this._rctx=o(this._rctx),this._compositingHelper=null,this._renderer=null,this._set("renderer",null),this.test?.destroy()}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new L({view:e}),u(e.spatialReference)||(2===t?(new x({view:e}),this.glow=new A({view:e})):f(e.spatialReference)?(new v({view:e}),this.glow=new A({view:e})):(new _({view:e}),new g({view:e}),this.glow=new A({view:e}),new O({view:e}),this.fog=new w({view:e}))),new k({view:e,isEnabled:()=>this.renderer.hasSSAO}),new M({view:e,isEnabled:()=>this.renderer.hasSMAA}),new U({view:e}),new S({view:e}),new q({view:e,viewingMode:t}),new T({view:e}),C()&&new b({view:e})}requestRender(e=1){this._needsRender=!0,1===e&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(r(e))}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,n,o=n){const a=i.constrainWindowSize(t,r,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const l=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let p=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=l(4*s,h,i.nearFar);p>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(p=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&p>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(p=s)}return p===Number.MAX_VALUE?void 0:p}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){V(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=0,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?1:0,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(0),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e,0),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(0),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new Q(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(2===t.mode?s:1),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const s={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",s);if(null==n)return void i.getLogger(this).error("A WebGL2 context could not be created.");Y(n,!0),this._rctx=$(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}get stippleTextures(){return this._stippleTextures}get markerTextures(){return this._markerTextures}get waterTextures(){return this._waterTextures}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get renderer(){return this._renderer}get componentObjectCollection(){return null==this._componentObjectCollection&&(this._componentObjectCollection=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}updateQualitySettings(e){null!=this.test?.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=d(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.stage.view.qualitySettings.maxTexturePixels})}};function $(e,t){const r=new E(t);if(J.enabled){let t=ee.get(e);return t&&1===t.refCount?(t.configure(r),t.ref(),t):(t=new B(e,r),ee.set(e,t),t.ref(),t)}return new B(e,r)}e([c({type:Boolean,readOnly:!0})],Z.prototype,"updating",null),e([c({constructOnly:!0})],Z.prototype,"stage",void 0),e([c({readOnly:!0})],Z.prototype,"stippleTextures",null),e([c({readOnly:!0})],Z.prototype,"markerTextures",null),e([c({readOnly:!0})],Z.prototype,"waterTextures",null),e([c({readOnly:!0})],Z.prototype,"olidRenderHelper",void 0),e([c()],Z.prototype,"_textures",void 0),e([c({readOnly:!0})],Z.prototype,"renderer",null),e([c()],Z.prototype,"_screenshotManager",void 0),e([c()],Z.prototype,"componentObjectCollection",null),e([c()],Z.prototype,"_componentObjectCollection",void 0),e([c()],Z.prototype,"_needsUpdate",void 0),e([c()],Z.prototype,"_needsWaterReflectionUpdate",void 0),Z=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Z);const ee=I();export{Z as RenderView};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{toConst as r}from"../../../../core/compilerUtils.js";import{unpackFloatRGBA as s}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{watch as a,initial as h,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as u,isMars as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{ChapmanAtmosphere as _}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as g}from"../../environment/CloudsComposition.js";import{Fog as w}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import{MarsAtmosphere as v}from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as j}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as R}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ObjectAndLayerIDRenderNode as b}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{GlowRenderNode as A}from"../effects/glow/GlowRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as S}from"../effects/highlight/Highlight.js";import{ShadowHighlight as q}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as U}from"../effects/magnifier/Magnifier.js";import{SMAA as M}from"../effects/smaa/SMAA.js";import{SSAO as k}from"../effects/ssao/SSAO.js";import{Stars as L}from"../effects/stars/Stars.js";import D from"../lib/CompositingHelper.js";import{GLMaterialRepository as H}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as F}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as B}from"../lib/RenderingContext.js";import{RenderingContextOptions as E}from"../lib/RenderingContextOptions.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as N}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as z}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as I}from"./contextCache.js";import{removeLoadedShaderModules as V}from"./renderUtils.js";import{ScreenshotManager as X,ScreenshotContext as Q}from"./ScreenshotManager.js";import{contextCache as J}from"./testUtils.js";import{noBudget as K}from"../../../support/Scheduler.js";import{checkWebGLError as Y}from"../../../webgl/checkWebGLError.js";let Z=class extends t{constructor(e){super(e),this._waterTextures=new P,this.olidRenderHelper=C()?new F:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.glow=null,this.fog=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:r}=t.view.resourceController;this._stippleTextures=z(this._rctx,r),this.notifyChange("stippleTextures"),this._markerTextures=N(this._rctx,r),this.notifyChange("markerTextures"),this._techniques=new R(new j(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t),this.addHandles(this._textures.events.on("changed",e=>this.requestRender(e)));const s=new H(this._textures,this._techniques,()=>this.requestRender(),()=>this.requestRender());this._compositingHelper=new D(this._rctx,this._techniques),this._renderer=new W(t,s,this._techniques,this._rctx,this._compositingHelper,e=>this.requestRender(e)),this.notifyChange("renderer"),this.addHandles([a(()=>t.view.ready,e=>{e&&this._createRenderNodes()},h),a(()=>this.waterTextures?.updating,()=>this.requestRender(),h),a(()=>t.view.qualityProfile,e=>this.renderer?.updateRenderFeatures(e),l)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new X(this._rctx,i,e=>t.view.overlayManager.updateOverlays(K,e.camera,0)),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this._techniques=o(this._techniques),this._componentObjectCollection=o(this._componentObjectCollection),this._set("componentObjectCollection",null),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._waterTextures=null,this._markerTextures=null,this._stippleTextures=null,this._canvas=null,this._rctx=o(this._rctx),this._compositingHelper=null,this._renderer=null,this._set("renderer",null),this.test?.destroy()}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new L({view:e}),u(e.spatialReference)||(2===t?(new x({view:e}),this.glow=new A({view:e})):f(e.spatialReference)?(new v({view:e}),this.glow=new A({view:e})):(new _({view:e}),new g({view:e}),this.glow=new A({view:e}),new O({view:e}),this.fog=new w({view:e}))),new k({view:e,isEnabled:()=>this.renderer.hasSSAO}),new M({view:e,isEnabled:()=>this.renderer.hasSMAA}),new U({view:e}),new S({view:e}),new q({view:e,viewingMode:t}),new T({view:e}),C()&&new b({view:e})}requestRender(e=1){this._needsRender=!0,1===e&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(r(e))}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,n,o=n){const a=i.constrainWindowSize(t,r,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const l=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let p=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=l(4*s,h,i.nearFar);p>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(p=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&p>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(p=s)}return p===Number.MAX_VALUE?void 0:p}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){V(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=0,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?1:0,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(0),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e,0),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(0),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new Q(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(2===t.mode?s:1),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const s={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",s);if(null==n)return void i.getLogger(this).error("A WebGL2 context could not be created.");Y(n,!0),this._rctx=$(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}get stippleTextures(){return this._stippleTextures}get markerTextures(){return this._markerTextures}get waterTextures(){return this._waterTextures}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get renderer(){return this._renderer}get componentObjectCollection(){return null==this._componentObjectCollection&&(this._componentObjectCollection=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}updateQualitySettings(e){null!=this.test?.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=d(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.stage.view.qualitySettings.maxTexturePixels})}};function $(e,t){const r=new E(t);if(J.enabled){let t=ee.get(e);return t&&1===t.refCount?(t.configure(r),t.ref(),t):(t=new B(e,r),ee.set(e,t),t.ref(),t)}return new B(e,r)}e([c({type:Boolean,readOnly:!0})],Z.prototype,"updating",null),e([c({constructOnly:!0})],Z.prototype,"stage",void 0),e([c({readOnly:!0})],Z.prototype,"stippleTextures",null),e([c({readOnly:!0})],Z.prototype,"markerTextures",null),e([c({readOnly:!0})],Z.prototype,"waterTextures",null),e([c({readOnly:!0})],Z.prototype,"olidRenderHelper",void 0),e([c()],Z.prototype,"_textures",void 0),e([c({readOnly:!0})],Z.prototype,"renderer",null),e([c()],Z.prototype,"_screenshotManager",void 0),e([c()],Z.prototype,"componentObjectCollection",null),e([c()],Z.prototype,"_componentObjectCollection",void 0),e([c()],Z.prototype,"_needsUpdate",void 0),e([c()],Z.prototype,"_needsWaterReflectionUpdate",void 0),Z=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Z);const ee=I();export{Z as RenderView};