@arcgis/core 5.1.0-next.80 → 5.1.0-next.82

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 (277) hide show
  1. package/analysis/ShadowCast/DiscreteOptions.d.ts +12 -0
  2. package/analysis/ShadowCast/TotalDurationOptions.d.ts +12 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/040884cec4b84dd1bb17.js +1 -0
  5. package/assets/esri/core/workers/chunks/05c5f68e117fc58ae801.js +1 -0
  6. package/assets/esri/core/workers/chunks/074f5e6aaeafca13bf72.js +1 -0
  7. package/assets/esri/core/workers/chunks/{7bd1d624f4f4a11a31e8.js → 086d7cdfa92a649c9f7b.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{0eed2b1b06355ab89013.js → 0c074c46d106ca4d3bad.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d7324a00ed576e7a37b1.js → 1768f1a7e3caa6074d91.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{85d3475667c503ec4fc6.js → 186bfde8c552e3b42302.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1a35121a0c2595a41fdb.js +1 -0
  12. package/assets/esri/core/workers/chunks/1ab66600579fa4232d7b.js +1 -0
  13. package/assets/esri/core/workers/chunks/{d5fd99ee40bba9b48a54.js → 1e2c0c6d724f7639d4c1.js} +27 -27
  14. package/assets/esri/core/workers/chunks/1e3fe89970c57a883fe5.js +1 -0
  15. package/assets/esri/core/workers/chunks/{824051af00e7a1f05ed0.js → 230e0e43f8e771950397.js} +1 -1
  16. package/assets/esri/core/workers/chunks/26f804c92077c11c626d.js +1 -0
  17. package/assets/esri/core/workers/chunks/28a45bd26eb5c9b3ec7c.js +1 -0
  18. package/assets/esri/core/workers/chunks/38f1a86b8dd9ee684ee5.js +596 -0
  19. package/assets/esri/core/workers/chunks/{c1d4110aa494a1dba3c4.js → 455d08294e0f5c5509ff.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{71fe127734f33d020a44.js → 475394218caaa4cd3e86.js} +1 -1
  21. package/assets/esri/core/workers/chunks/475409026288f0981ce2.js +1 -0
  22. package/assets/esri/core/workers/chunks/4e206957b28253ddc1a3.js +1 -0
  23. package/assets/esri/core/workers/chunks/{87d2021e91d025a2a142.js → 5c7ba4b8a9ec2e2e02b5.js} +1 -1
  24. package/assets/esri/core/workers/chunks/5cc38ac051d3d0557920.js +1 -0
  25. package/assets/esri/core/workers/chunks/{992cd87ba0ab6346f692.js → 64e268ebac0b62076f81.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{003fd7745966fe03510c.js → 65ac73de5bb133c6bf89.js} +1 -1
  27. package/assets/esri/core/workers/chunks/6675d56f49d07a97dc40.js +1 -0
  28. package/assets/esri/core/workers/chunks/{1f82a0f134ea912fc686.js → 66fe1634c6e8f72fc653.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{96b13b6042cdf5833d39.js → 67abbe81c16de26f61d8.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{484d6c1b0fe1633515b7.js → 72f8f4cfa0842d325fb0.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{283d39dfb1625b5a74db.js → 747e258f57f0543c836e.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{dd4f431511edd975a53b.js → 7acf82763aeba44049d0.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{5d8e944b192aad4cf986.js → 7b505112c7e6d9b7a239.js} +1 -1
  34. package/assets/esri/core/workers/chunks/7b8466f892a38a53c600.js +1 -0
  35. package/assets/esri/core/workers/chunks/{6a0352d20596ca3f4b64.js → 88eb1e4320c4ada01711.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{77dd719516138afb1a2a.js → 8af9a78cf316581ea482.js} +1 -1
  37. package/assets/esri/core/workers/chunks/97719271a3e4c9f2b2c9.js +1 -0
  38. package/assets/esri/core/workers/chunks/988e91cc6cf88c34c2de.js +1 -0
  39. package/assets/esri/core/workers/chunks/9c402657f63a4d5668d0.js +1 -0
  40. package/assets/esri/core/workers/chunks/9cac70164d8528c283af.js +1 -0
  41. package/assets/esri/core/workers/chunks/9ea23cd4b2664c08b670.js +1 -0
  42. package/assets/esri/core/workers/chunks/9f51a69b8f1937a8794a.js +1 -0
  43. package/assets/esri/core/workers/chunks/a28124bba6b43efd74cc.js +1 -0
  44. package/assets/esri/core/workers/chunks/ac5999c88c27b49cd760.js +1 -0
  45. package/assets/esri/core/workers/chunks/af762422a65c551dcd54.js +1 -0
  46. package/assets/esri/core/workers/chunks/{056fd7847caaff2c9514.js → af8bc56cf1404afc3028.js} +1 -1
  47. package/assets/esri/core/workers/chunks/b811d62284be95f4beb6.js +1 -0
  48. package/assets/esri/core/workers/chunks/b9e163f4a898e50cc854.js +1 -0
  49. package/assets/esri/core/workers/chunks/{444f0f51b3ee0b9845a5.js → bb2f6b0fcdfb8b158e26.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{3b9100c59a8050f4834e.js → bbc27d9285162696d089.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{5da2051f548c2942e01a.js → bc8a74da48b08309875f.js} +1 -1
  52. package/assets/esri/core/workers/chunks/bd8cb64b6e08839398f3.js +1 -0
  53. package/assets/esri/core/workers/chunks/{026d3fa331caec1ea3d2.js → bf4dd8e50704e4040966.js} +1 -1
  54. package/assets/esri/core/workers/chunks/c19e3f6027b6526de359.js +1 -0
  55. package/assets/esri/core/workers/chunks/c8ef80a7c46d7d2c5172.js +1 -0
  56. package/assets/esri/core/workers/chunks/cbf1a03f54bd8d2a2b47.js +1 -0
  57. package/assets/esri/core/workers/chunks/ce4dfc3a470230ddc9e4.js +1 -0
  58. package/assets/esri/core/workers/chunks/{8ea4584e07ccc85caabd.js → d11de13537b623739e14.js} +1 -1
  59. package/assets/esri/core/workers/chunks/d897412b99b9fba44bb4.js +1 -0
  60. package/assets/esri/core/workers/chunks/d9c3f14eee4db7a7137b.js +1 -0
  61. package/assets/esri/core/workers/chunks/{035dbb0217f83108fa89.js → db86a1119e4e58ecfbda.js} +1 -1
  62. package/assets/esri/core/workers/chunks/dcb7a3ff59677b1cf0f1.js +1 -0
  63. package/assets/esri/core/workers/chunks/{5fe97253f80c797fad7f.js → df8a3d3cac454d42e14d.js} +1 -1
  64. package/assets/esri/core/workers/chunks/dfe1139124fda0d6c059.js +1 -0
  65. package/assets/esri/core/workers/chunks/{8b8f391f27774aec6db9.js → e0b27bceb397482bd0e8.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{fb9e3e7cd532ac4353f1.js → e89dc473f46a5584d2ef.js} +32 -32
  67. package/assets/esri/core/workers/chunks/{01ee18782a50279f907e.js → f4220b6eab0865318033.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{42336e0d1ef88737b078.js → f468c6ea2818a1f97e19.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{3f242f8d092f601c3abf.js → f77d23ee60c876b01e4b.js} +1 -1
  70. package/assets/esri/core/workers/chunks/fce2306a1b31c6680f90.js +1 -0
  71. package/assets/esri/core/workers/chunks/fcf51697c361e0075cc2.js +1 -0
  72. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  73. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  74. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +15 -0
  75. package/assets/esri/themes/dark/main.css +1 -1
  76. package/assets/esri/themes/light/main.css +1 -1
  77. package/assets/esri/themes/light/view.css +1 -1
  78. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  79. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  80. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  81. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  82. package/chunks/ShadowCastVisualize.glsl.js +33 -15
  83. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  84. package/chunks/arcgis-knowledge-client-core.js +1 -1
  85. package/config.js +1 -1
  86. package/core/workers/registry.js +1 -1
  87. package/form/elements/inputs/MultipleChoiceInput.d.ts +6 -6
  88. package/form/elements/inputs/MultipleChoiceInput.js +1 -1
  89. package/form/elements/inputs.js +1 -1
  90. package/geometry/SpatialReference.js +1 -1
  91. package/geometry/support/coordsUtils.js +1 -1
  92. package/kernel.js +1 -1
  93. package/layers/BaseDynamicLayer.js +1 -1
  94. package/layers/BaseTileLayer.js +1 -1
  95. package/layers/ElevationLayer.js +1 -1
  96. package/layers/FeatureLayer.d.ts +2 -2
  97. package/layers/FeatureLayer.js +1 -1
  98. package/layers/MapImageLayer.js +1 -1
  99. package/layers/TileLayer.js +1 -1
  100. package/layers/WMSLayer.js +1 -1
  101. package/layers/WMTSLayer.js +1 -1
  102. package/layers/WebTileLayer.js +1 -1
  103. package/layers/graphics/data/QueryEngine.js +1 -1
  104. package/layers/graphics/data/QueryEngineResult.js +1 -1
  105. package/layers/graphics/sources/MemorySource.js +1 -1
  106. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  107. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  108. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  109. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  110. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  111. package/layers/mixins/ArcGISImageService.js +1 -1
  112. package/layers/mixins/FeatureLayerBase.js +1 -1
  113. package/layers/mixins/TiledImagery.js +1 -1
  114. package/layers/support/imageBitmapUtils.js +1 -1
  115. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  116. package/package.json +1 -1
  117. package/request/process.js +1 -1
  118. package/rest/knowledgeGraph/CreateReplicaResponse.d.ts +37 -0
  119. package/rest/knowledgeGraph/CreateReplicaResponse.js +2 -0
  120. package/rest/knowledgeGraph/ReplicaDefinition.d.ts +91 -0
  121. package/rest/knowledgeGraph/ReplicaDefinition.js +2 -0
  122. package/rest/knowledgeGraph/ReplicasInformationResponse.d.ts +24 -0
  123. package/rest/knowledgeGraph/ReplicasInformationResponse.js +2 -0
  124. package/rest/knowledgeGraph/UnregisterReplicaResponse.d.ts +44 -0
  125. package/rest/knowledgeGraph/UnregisterReplicaResponse.js +2 -0
  126. package/rest/knowledgeGraph/wasmInterface/replicaToWasmEncodedFactories.js +2 -0
  127. package/rest/knowledgeGraph/wasmInterface/wasmToReplicaFactories.js +2 -0
  128. package/rest/knowledgeGraphService.d.ts +50 -1
  129. package/rest/knowledgeGraphService.js +1 -1
  130. package/support/revision.js +1 -1
  131. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  132. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  133. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  134. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  136. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
  138. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
  140. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  144. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  146. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  147. package/views/2d/input/MapViewInputManager.js +1 -1
  148. package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
  149. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  150. package/views/2d/layers/MediaLayerView2D.js +1 -1
  151. package/views/2d/layers/TileLayerView2D.js +1 -1
  152. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  153. package/views/2d/layers/WMSLayerView2D.js +1 -1
  154. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  155. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  156. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  157. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  158. package/views/3d/input/SceneInputManager.js +1 -1
  159. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  160. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  161. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  162. package/views/3d/layers/IntegratedMesh3DTilesLayerWorker.js +2 -0
  163. package/views/3d/layers/IntegratedMesh3DTilesLayerWorkerHandle.js +2 -0
  164. package/views/3d/layers/TileLayerView3D.js +1 -1
  165. package/views/3d/layers/WMTSLayerView3D.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  167. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  168. package/views/3d/layers/support/IntegratedMesh3DTilesVertexProcessing.js +2 -0
  169. package/views/3d/layers/support/makeScheduleFunction.js +1 -1
  170. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  171. package/views/3d/terrain/TerrainData.js +1 -1
  172. package/views/3d/terrain/TerrainSurface.js +1 -1
  173. package/views/3d/terrain/Tile.js +1 -1
  174. package/views/3d/terrain/TileRenderer.js +1 -1
  175. package/views/3d/terrain/terrainUtils.js +1 -1
  176. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  177. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  178. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  179. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialInitParameters.js +2 -0
  180. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  181. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  182. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
  183. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  184. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  185. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
  186. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
  187. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  188. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  189. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  190. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  191. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  192. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  193. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  194. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  195. package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
  196. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  197. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
  198. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  199. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  200. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  201. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  202. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  203. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  204. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  205. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  206. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  207. package/views/3d/webgl-engine/lib/StencilUtils.js +1 -1
  208. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  209. package/views/3d/webgl-engine/materials/VisualVariablePassParameters.js +1 -1
  210. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  211. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +1 -1
  212. package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +2 -0
  213. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  214. package/views/3d/webgl-engine/shaders/colorRampParameters.js +2 -0
  215. package/views/VideoView.js +1 -1
  216. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  217. package/views/draw/support/createUtils.js +1 -1
  218. package/views/input/BrowserEventSource.js +1 -1
  219. package/views/input/InputManager.js +1 -1
  220. package/views/input/handlers/LatestPen.js +2 -0
  221. package/views/input/handlers/LatestPointer.js +1 -1
  222. package/views/input/types.d.ts +1 -1
  223. package/views/interactive/Tooltip.js +1 -1
  224. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  225. package/views/support/TextureCompressionWorker.js +1 -1
  226. package/views/support/TextureCompressionWorkerHandle.js +1 -1
  227. package/views/support/unnormalizationUtils.js +2 -0
  228. package/views/webgl/RenderingContext.js +1 -1
  229. package/views/webgl/Texture.js +1 -1
  230. package/views/webgl/renderState.js +1 -1
  231. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  232. package/widgets/ElevationProfile/support/profileUtils.js +1 -1
  233. package/widgets/FeatureTable.js +1 -1
  234. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  235. package/widgets/OrientedImageryViewer/css.js +1 -1
  236. package/widgets/OrientedImageryViewer.js +1 -1
  237. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  238. package/assets/esri/core/workers/chunks/05c3146d87d917606193.js +0 -1
  239. package/assets/esri/core/workers/chunks/0b77c124b743067e4155.js +0 -1
  240. package/assets/esri/core/workers/chunks/11241781baaed346af52.js +0 -1
  241. package/assets/esri/core/workers/chunks/1d9560eb8b21b9e76616.js +0 -1
  242. package/assets/esri/core/workers/chunks/2c87c3112a43db8624f6.js +0 -1
  243. package/assets/esri/core/workers/chunks/2da62687ff678b690839.js +0 -1
  244. package/assets/esri/core/workers/chunks/3a58708217a9c11836ab.js +0 -1
  245. package/assets/esri/core/workers/chunks/3bbf684ee2484eb44c9f.js +0 -1
  246. package/assets/esri/core/workers/chunks/49fb9c47070641bce9a9.js +0 -1
  247. package/assets/esri/core/workers/chunks/4eed175277eb0df3c821.js +0 -1
  248. package/assets/esri/core/workers/chunks/4f9d027055f3a616173c.js +0 -1
  249. package/assets/esri/core/workers/chunks/5417308eba30e668b1ee.js +0 -1
  250. package/assets/esri/core/workers/chunks/62b3e933f548ce354b99.js +0 -1
  251. package/assets/esri/core/workers/chunks/63381d81adce0a0d2089.js +0 -1
  252. package/assets/esri/core/workers/chunks/6dbddf5ab1867ac2ac80.js +0 -1
  253. package/assets/esri/core/workers/chunks/6e70e922331704b92a08.js +0 -1
  254. package/assets/esri/core/workers/chunks/7c7c11c0fde8b63e330b.js +0 -1
  255. package/assets/esri/core/workers/chunks/7f55eef696e9ed717bfc.js +0 -1
  256. package/assets/esri/core/workers/chunks/89dbea6f436d45a3b185.js +0 -1
  257. package/assets/esri/core/workers/chunks/8f6f5dad52747d252aac.js +0 -596
  258. package/assets/esri/core/workers/chunks/99c189e1de2b1f14799b.js +0 -1
  259. package/assets/esri/core/workers/chunks/9aa6b32cb65fbaa93218.js +0 -1
  260. package/assets/esri/core/workers/chunks/9d216e30d04ea21fc8a2.js +0 -1
  261. package/assets/esri/core/workers/chunks/9d434360dfce1e49b7b9.js +0 -1
  262. package/assets/esri/core/workers/chunks/a5d8d6f3c0c8de474efd.js +0 -1
  263. package/assets/esri/core/workers/chunks/a809b811121099a87a98.js +0 -1
  264. package/assets/esri/core/workers/chunks/c02ba921c0a32d2021e3.js +0 -1
  265. package/assets/esri/core/workers/chunks/c3c19b62d948d53118a8.js +0 -1
  266. package/assets/esri/core/workers/chunks/c46a4adea39636a96d03.js +0 -1
  267. package/assets/esri/core/workers/chunks/c5507480344176fad241.js +0 -1
  268. package/assets/esri/core/workers/chunks/c6030271bd6d39b6e1db.js +0 -1
  269. package/assets/esri/core/workers/chunks/d1a7d13e1d48abcd7bf1.js +0 -1
  270. package/assets/esri/core/workers/chunks/dcbc4072c18278c2b67d.js +0 -1
  271. package/assets/esri/core/workers/chunks/e610d24539a675fb054b.js +0 -1
  272. package/assets/esri/core/workers/chunks/ecb7ede6a8e6c05e4c6c.js +0 -1
  273. package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +0 -1
  274. package/assets/esri/core/workers/chunks/fb5a2205f05afc396119.js +0 -1
  275. package/request/ImageWithType.js +0 -2
  276. package/views/3d/layers/support/fetchTile.js +0 -2
  277. package/views/interactive/editGeometry/unnormalizationHelper.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as c}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{OpaqueEnvironment as u}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as f,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as b,ChapmanAtmosphereTechnique as g}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as _}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{createQuadVAO as w}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as P}from"../../lib/textureUtils.js";import{A as j}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as v}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as A,ColorAttachment0 as C,PrimitiveType as q}from"../../../../webgl/enums.js";import x from"../../../../../webscene/background/ColorBackground.js";let T=class extends u{constructor(){super(...arguments),this._compositingPassParameters=new j,this._vao=null,this._passParameters=new b,this._configuration=new _}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof x?e.color.toUnitRGBA():p;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._configuration.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??p,this.requestRender(1)},o),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}render(e){const r=e.find(({name:e})=>e===d.OPAQUE_ENVIRONMENT);if(!this.bindParameters.mainDepth)return r;const s=this.renderingContext;this._vao??=w(s,1);const i=r.getAttachment(A);this._update();const o=this.techniques.getCompiled(g,this._configuration);if(!o)return this.requestRender(1),r;if(!this._configuration.reduced)return r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(o,this.bindParameters,this._passParameters),s.setDrawBuffers([C]),s.bindVAO(this._vao),s.drawArrays(q.TRIANGLE_STRIP,0,4),r.attachDepth(i),r;const a=this.techniques.getCompiled(v);if(!a)return this.requestRender(1),r;const n=s.getViewport(),m=this.bindParameters.camera,p=h(m.eye)-c.radius;let u;const f=c.atmosphereHeight;if(p<f){const e=Math.min(1,Math.max(0,p/f));u=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(p-f)/(15*f)));u=t(.3,.6,e)}const l=this.renderingContext.parameters.maxTextureSize,b=P(Math.round(u*m.fullViewport[2]),l),_=P(Math.round(u*m.fullViewport[3]),l);s.setViewport(0,0,b,_);const j=this.fboCache.acquire(b,_,"chapman",5);return s.bindFramebuffer(j.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(o,this.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(q.TRIANGLE_STRIP,0,4),s.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=j.getTexture(),r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(a,this.bindParameters,this._compositingPassParameters),s.setDrawBuffers([C]),s.screen.draw(),r.attachDepth(i),j.release(),r}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+c.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=f(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};T=e([a("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],T);export{T as ChapmanAtmosphere};
2
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as c}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as p}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{OpaqueEnvironment as u}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as f,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as g,ChapmanAtmosphereTechnique as b}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as _}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{createQuadVAO as w}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as P}from"../../lib/textureUtils.js";import{A as j}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as v}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as A,ColorAttachment0 as q,PrimitiveType as x}from"../../../../webgl/enums.js";import C from"../../../../../webscene/background/ColorBackground.js";let T=class extends u{constructor(){super(...arguments),this._compositingPassParameters=new j,this._vao=null,this._passParameters=new g,this._configuration=new _}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof C?e.color.toUnitRGBA():c;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._configuration.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??c,this.requestRender(1)},o),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}precompile(){this.techniques.precompile(b,this._configuration),this.techniques.precompile(v)}render(e){const r=e.find(({name:e})=>e===d.OPAQUE_ENVIRONMENT);if(!this.bindParameters.mainDepth)return r;const s=this.renderingContext;this._vao??=w(s,1);const i=r.getAttachment(A);this._update();const o=this.techniques.getCompiled(b,this._configuration);if(!o)return this.requestRender(1),r;if(!this._configuration.reduced)return r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(o,this.bindParameters,this._passParameters),s.setDrawBuffers([q]),s.bindVAO(this._vao),s.drawArrays(x.TRIANGLE_STRIP,0,4),r.attachDepth(i),r;const a=this.techniques.get(v);if(!a.compiled)return this.requestRender(1),r;const n=s.getViewport(),m=this.bindParameters.camera,c=h(m.eye)-p.radius;let u;const f=p.atmosphereHeight;if(c<f){const e=Math.min(1,Math.max(0,c/f));u=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(c-f)/(15*f)));u=t(.3,.6,e)}const l=this.renderingContext.parameters.maxTextureSize,g=P(Math.round(u*m.fullViewport[2]),l),_=P(Math.round(u*m.fullViewport[3]),l);s.setViewport(0,0,g,_);const j=this.fboCache.acquire(g,_,"chapman",5);return s.bindFramebuffer(j.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(o,this.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(x.TRIANGLE_STRIP,0,4),s.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=j.getTexture(),r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(a,this.bindParameters,this._compositingPassParameters),s.setDrawBuffers([q]),s.screen.draw(),r.attachDepth(i),j.release(),r}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+p.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=f(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};T=e([a("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],T);export{T as ChapmanAtmosphere};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as m}from"../../../webgl.js";import{glLayout as n}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as p}from"../OpaqueEnvironment.js";import{S as f}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as h,layout as l}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as u}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as c}from"./SimpleAtmosphereTexture.js";import{createPolySphereData as b}from"../../lib/GeometryUtil.js";import{VertexArrayObject as d}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as _,PrimitiveType as g}from"../../../../webgl/enums.js";import v from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as w}from"../../../../webgl/VertexBuffer.js";let x=class extends p{constructor(){super(...arguments),this._configuration=new u,this._passParameters=new f,this._vao=null,this._vaoCount=0}initialize(){this._configuration.geometry=1,this.addHandles([r(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._passParameters.texture=t(this._passParameters.texture),this._vao=t(this._vao)}render(e){const t=e.find(({name:e})=>e===m.OPAQUE_ENVIRONMENT),r=this.techniques.getCompiled(h,this._configuration);if(!r)return this.requestRender(1),t;const s=this.renderingContext;if(this._vao||(this._vao=A(s),this._vaoCount=this._vao.vertexCount("geometry")),!this._passParameters.texture){const e=new j(1,512);e.wrapMode=33071,e.flipped=!0,this._passParameters.texture=new v(s,e,c)}const i=s.bindTechnique(r,this.bindParameters,this._passParameters);return s.setDrawBuffers([_]),P(C,this.bindParameters.camera.viewMatrix),i.setUniformMatrix4fv("view",C),s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(g.TRIANGLES,0,this._vaoCount),t}};function A(e){const t=b(1,2,!1),{data:r,indices:s}=t[0][1],i=l.createBuffer(s.length),o=i.position;for(let a=0;a<s.length;++a){const e=3*s[a%3==0?a+2:a%3==2?a-2:a];o.set(a,0,r[e]),o.set(a,1,r[e+1]),o.set(a,2,r[e+2])}return new d(e,new w(e,n(l),i.buffer))}function P(e,t){o(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}x=e([i("esri.views.3d.webgl-engine.effects.atmosphere.LocalAtmosphere")],x);const C=a();export{x as LocalAtmosphere};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as m}from"../../../webgl.js";import{glLayout as n}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as p}from"../OpaqueEnvironment.js";import{S as f}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as h,layout as c}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as l}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as u}from"./SimpleAtmosphereTexture.js";import{createPolySphereData as b}from"../../lib/GeometryUtil.js";import{VertexArrayObject as _}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as d,PrimitiveType as g}from"../../../../webgl/enums.js";import v from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as w}from"../../../../webgl/VertexBuffer.js";let x=class extends p{constructor(){super(...arguments),this._configuration=new l,this._passParameters=new f,this._vao=null,this._vaoCount=0}initialize(){this._configuration.geometry=1,this.addHandles([r(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._passParameters.texture=t(this._passParameters.texture),this._vao=t(this._vao)}precompile(){this.techniques.precompile(h,this._configuration)}render(e){const t=e.find(({name:e})=>e===m.OPAQUE_ENVIRONMENT),r=this.techniques.getCompiled(h,this._configuration);if(!r)return this.requestRender(1),t;const s=this.renderingContext;if(this._vao||(this._vao=A(s),this._vaoCount=this._vao.vertexCount("geometry")),!this._passParameters.texture){const e=new j(1,512);e.wrapMode=33071,e.flipped=!0,this._passParameters.texture=new v(s,e,u)}const i=s.bindTechnique(r,this.bindParameters,this._passParameters);return s.setDrawBuffers([d]),P(C,this.bindParameters.camera.viewMatrix),i.setUniformMatrix4fv("view",C),s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(g.TRIANGLES,0,this._vaoCount),t}};function A(e){const t=b(1,2,!1),{data:r,indices:s}=t[0][1],i=c.createBuffer(s.length),o=i.position;for(let a=0;a<s.length;++a){const e=3*s[a%3==0?a+2:a%3==2?a-2:a];o.set(a,0,r[e]),o.set(a,1,r[e+1]),o.set(a,2,r[e+2])}return new _(e,new w(e,n(c),i.buffer))}function P(e,t){o(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}x=e([i("esri.views.3d.webgl-engine.effects.atmosphere.LocalAtmosphere")],x);const C=a();export{x as LocalAtmosphere};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{lerp as e,clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{lookAt as m}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as p,scale as c,add as l,distance as u,cross as _,squaredLength as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../../../geometry/ellipsoidUtils.js";import{newFloatArray as x}from"../../../../../geometry/support/FloatArray.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{makePiecewiseLinearFunction as j}from"../../../support/mathUtils.js";import{glLayout as V}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as P}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as v,innerAtmosphereDepth as R}from"./atmosphereUtils.js";import{marsAtmosphereTextureSimple as w}from"./MarsAtmosphereTexture.js";import{S as A}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as y,layout as S}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as q}from"./SimpleAtmosphereTechniqueConfiguration.js";import{createQuadVAO as F}from"../../lib/glUtil3D.js";import{project as M}from"../../lib/Util.js";import{VertexArrayObject as T}from"../../lib/VertexArrayObject.js";import{PrimitiveType as U}from"../../../../webgl/enums.js";import E from"../../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as O}from"../../../../webgl/VertexBuffer.js";const N=128,I=-R,W=0,B=50,D=()=>1-511/512,G=j([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let L=class extends P{constructor(t){super(t),this._passParameters=new A,this._configuration=new q,this._vao=null,this._fadeVao=null,this._texV1=1;const e=t.view,r=g(e.spatialReference),{outerAtmosphereRimWidth:s,radius:i}=r;this._planetRadius=i,this._innerRimFactor=1+I/i,this._middleRimFactor=1+W/i,this._outerRimFactor=1+s/i,this._texV0=W/s,this._texVScale=this._texV1-this._texV0}initialize(){this.addHandles(i(()=>this.view.environment.atmosphereEnabled,t=>t?this._enable():this._disable(),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(t){const e=t.find(({name:t})=>t===b.OPAQUE_ENVIRONMENT);this._update();const r=this.renderingContext;if(!this._passParameters.texture){const t=new C(1,512);t.wrapMode=33071,t.flipped=!0,this._passParameters.texture=new E(r,t,w)}if(this._passParameters.undergroundFadeAlpha<1){this._vao??=this._createRibbon(r),this._configuration.geometry=0;const t=this.techniques.getCompiled(y,this._configuration);if(!t)return this.requestRender(1),e;r.bindTechnique(t,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(U.TRIANGLES,0,this._vao.vertexCount("geometry"))}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao??=F(r),this._configuration.geometry=2;const t=this.techniques.getCompiled(y,this._configuration);if(!t)return this.requestRender(1),e;r.bindTechnique(t,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(U.TRIANGLE_STRIP,0,this._fadeVao.vertexCount("geometry"))}return e}_update(){const t=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(t.eye),a=o-i;if(a<0){const t=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=t}else this._passParameters.undergroundFadeAlpha=0;const m=Math.max(B,a),n=i+I;this._passParameters.innerScale=J(i+m,i,n)-1,this._passParameters.altitudeFade=v(a),c(s,t.eye,(i+B)/o),k(s,t.center,t.up,i,this._passParameters.silhouette);const l=this._computeScreenRimWidth(t,s,t.up,this._passParameters.silhouette),u=D(),_=G(a);let f=this._texV0+u*this._texVScale,g=this._texV0+l*_*this._texVScale;if(a>B){k(t.eye,t.center,t.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(t,t.eye,t.up,this._passParameters.silhouette),o=r((s-1.5)/(l-1.5),0,1);f=this._texV0+o*u*this._texVScale,g=this._texV0+e(this._texV1,l*_,o)*this._texVScale}h(this._passParameters.texV,f,g)}_createRibbon(t){const e=x(3+3*N*3),r=new Uint32Array(3*N*5);e[0]=0,e[1]=0,e[2]=-1;for(let o=0;o<N;o++){const t=9*o+3;e[t]=o,e[t+1]=this._innerRimFactor,e[t+2]=-1,e[t+3]=o,e[t+4]=this._middleRimFactor,e[t+5]=0,e[t+6]=o,e[t+7]=this._outerRimFactor,e[t+8]=1;const s=3*o+1,i=o===N-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=S.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const t=3*r[o];i.set(o,0,e[t]),i.set(o,1,e[t+1]),i.set(o,2,e[t+2])}return new T(t,new O(t,V(S),s.buffer))}_computeScreenRimWidth(t,e,r,s){return l(H,s.center,s.v2),c(Q,H,this._outerRimFactor),m(z,e,H,r),M(H,z,t.projectionMatrix,t.viewport,H),M(Q,z,t.projectionMatrix,t.viewport,Q),u(H,Q)/t.height}};function k(t,e,r,s,i){const o=p(t),a=s*Math.sqrt(o*o-s*s)/o,m=Math.sqrt(s*s-a*a),n=i.v1,h=i.v2;return c(i.center,t,m/o),_(n,t,e),f(n)<1&&_(n,t,r),c(n,n,a/p(n)),_(h,n,t),c(h,h,a/p(h)),a}L=t([a("esri.views.3d.webgl-engine.effects.atmosphere.MarsAtmosphere")],L);const z=n(),H=d(),Q=d();function J(t,e,r){return t*t/(Math.sqrt(t*t-e*e)*Math.sqrt(t*t-r*r)+e*r)}export{L as MarsAtmosphere};
2
+ import{__decorate as t}from"tslib";import{lerp as e,clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{lookAt as m}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as p,scale as c,add as l,distance as u,cross as _,squaredLength as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../../../geometry/ellipsoidUtils.js";import{newFloatArray as x}from"../../../../../geometry/support/FloatArray.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{makePiecewiseLinearFunction as j}from"../../../support/mathUtils.js";import{glLayout as V}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as P}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as v,innerAtmosphereDepth as w}from"./atmosphereUtils.js";import{marsAtmosphereTextureSimple as R}from"./MarsAtmosphereTexture.js";import{S as A}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as y,layout as S}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as q}from"./SimpleAtmosphereTechniqueConfiguration.js";import{createQuadVAO as F}from"../../lib/glUtil3D.js";import{project as M}from"../../lib/Util.js";import{VertexArrayObject as T}from"../../lib/VertexArrayObject.js";import{PrimitiveType as U}from"../../../../webgl/enums.js";import E from"../../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as O}from"../../../../webgl/VertexBuffer.js";const N=128,I=-w,W=0,B=50,D=()=>1-511/512,G=j([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let L=class extends P{constructor(t){super(t),this._passParameters=new A,this._configuration=new q,this._vao=null,this._fadeVao=null,this._texV1=1;const e=t.view,r=g(e.spatialReference),{outerAtmosphereRimWidth:s,radius:i}=r;this._planetRadius=i,this._innerRimFactor=1+I/i,this._middleRimFactor=1+W/i,this._outerRimFactor=1+s/i,this._texV0=W/s,this._texVScale=this._texV1-this._texV0;const o=e.stage.renderView.techniques;o.precompile(y,this._configuration),this._configuration.geometry=2,o.precompile(y,this._configuration)}initialize(){this.addHandles(i(()=>this.view.environment.atmosphereEnabled,t=>t?this._enable():this._disable(),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(t){const e=t.find(({name:t})=>t===b.OPAQUE_ENVIRONMENT);this._update();const r=this.renderingContext;if(!this._passParameters.texture){const t=new C(1,512);t.wrapMode=33071,t.flipped=!0,this._passParameters.texture=new E(r,t,R)}if(this._passParameters.undergroundFadeAlpha<1){this._vao??=this._createRibbon(r),this._configuration.geometry=0;const t=this.techniques.getCompiled(y,this._configuration);if(!t)return this.requestRender(1),e;r.bindTechnique(t,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(U.TRIANGLES,0,this._vao.vertexCount("geometry"))}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao??=F(r),this._configuration.geometry=2;const t=this.techniques.getCompiled(y,this._configuration);if(!t)return this.requestRender(1),e;r.bindTechnique(t,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(U.TRIANGLE_STRIP,0,this._fadeVao.vertexCount("geometry"))}return e}_update(){const t=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(t.eye),a=o-i;if(a<0){const t=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=t}else this._passParameters.undergroundFadeAlpha=0;const m=Math.max(B,a),n=i+I;this._passParameters.innerScale=J(i+m,i,n)-1,this._passParameters.altitudeFade=v(a),c(s,t.eye,(i+B)/o),k(s,t.center,t.up,i,this._passParameters.silhouette);const l=this._computeScreenRimWidth(t,s,t.up,this._passParameters.silhouette),u=D(),_=G(a);let f=this._texV0+u*this._texVScale,g=this._texV0+l*_*this._texVScale;if(a>B){k(t.eye,t.center,t.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(t,t.eye,t.up,this._passParameters.silhouette),o=r((s-1.5)/(l-1.5),0,1);f=this._texV0+o*u*this._texVScale,g=this._texV0+e(this._texV1,l*_,o)*this._texVScale}h(this._passParameters.texV,f,g)}_createRibbon(t){const e=x(3+3*N*3),r=new Uint32Array(3*N*5);e[0]=0,e[1]=0,e[2]=-1;for(let o=0;o<N;o++){const t=9*o+3;e[t]=o,e[t+1]=this._innerRimFactor,e[t+2]=-1,e[t+3]=o,e[t+4]=this._middleRimFactor,e[t+5]=0,e[t+6]=o,e[t+7]=this._outerRimFactor,e[t+8]=1;const s=3*o+1,i=o===N-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=S.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const t=3*r[o];i.set(o,0,e[t]),i.set(o,1,e[t+1]),i.set(o,2,e[t+2])}return new T(t,new O(t,V(S),s.buffer))}_computeScreenRimWidth(t,e,r,s){return l(H,s.center,s.v2),c(Q,H,this._outerRimFactor),m(z,e,H,r),M(H,z,t.projectionMatrix,t.viewport,H),M(Q,z,t.projectionMatrix,t.viewport,Q),u(H,Q)/t.height}};function k(t,e,r,s,i){const o=p(t),a=s*Math.sqrt(o*o-s*s)/o,m=Math.sqrt(s*s-a*a),n=i.v1,h=i.v2;return c(i.center,t,m/o),_(n,t,e),f(n)<1&&_(n,t,r),c(n,n,a/p(n)),_(h,n,t),c(h,h,a/p(h)),a}L=t([a("esri.views.3d.webgl-engine.effects.atmosphere.MarsAtmosphere")],L);const z=n(),H=d(),Q=d();function J(t,e,r){return t*t/(Math.sqrt(t*t-e*e)*Math.sqrt(t*t-r*r)+e*r)}export{L as MarsAtmosphere};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{OpaqueEnvironment as o}from"../OpaqueEnvironment.js";import{CloudsCompositionTechnique as n}from"./CloudsCompositionTechnique.js";import{createQuadVAO as a}from"../../lib/glUtil3D.js";import{ColorAttachment0 as m,PrimitiveType as d}from"../../../../webgl/enums.js";let h=class extends o{initialize(){this.addHandles([i(()=>null!=this.view.environment.weather&&this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._vao=t(this._vao)}render(e){const t=e.find(({name:e})=>e===this.produces),i=this.bindParameters.clouds;if(!i.data)return t;const s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.renderingContext;this._vao??=a(r);const o=r.bindTechnique(s,this.bindParameters);return r.setDrawBuffers([m]),r.bindVAO(this._vao),o.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(d.TRIANGLE_STRIP,0,4),i.isFading&&this.requestRender(2),t}};h=e([r("esri.views.3d.webgl-engine.effects.clouds.CloudsComposition")],h);export{h as CloudsComposition};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{OpaqueEnvironment as o}from"../OpaqueEnvironment.js";import{CloudsCompositionTechnique as n}from"./CloudsCompositionTechnique.js";import{createQuadVAO as a}from"../../lib/glUtil3D.js";import{ColorAttachment0 as m,PrimitiveType as d}from"../../../../webgl/enums.js";let h=class extends o{initialize(){this.addHandles([i(()=>null!=this.view.environment.weather&&this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._vao=t(this._vao)}precompile(){this.bindParameters.clouds.data&&this.techniques.precompile(n)}render(e){const t=e.find(({name:e})=>e===this.produces),i=this.bindParameters.clouds;if(!i.data)return t;const s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.renderingContext;this._vao??=a(r);const o=r.bindTechnique(s,this.bindParameters);return r.setDrawBuffers([m]),r.bindVAO(this._vao),o.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(d.TRIANGLE_STRIP,0,4),i.isFading&&this.requestRender(2),t}};h=e([r("esri.views.3d.webgl-engine.effects.clouds.CloudsComposition")],h);export{h as CloudsComposition};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{lerp as s}from"../../../../../core/mathUtils.js";import{destroyMaybe as i,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as o,initial as a}from"../../../../../core/reactiveUtils.js";import{signal as h}from"../../../../../core/signal.js";import{property as n,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as c}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{targetTo as u}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{equals as m,copy as p,set as f}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{clone as _,ZEROS as g,zeros as x}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as y}from"../../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{zeros as b}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as T}from"../../../../../geometry/ellipsoidUtils.js";import{C as v,c as S}from"../../../../../chunks/Clouds.glsl.js";import{cloudPresets as w}from"./CloudsPresets.js";import{CloudsTechnique as C}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as P}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as j}from"./NoiseTextureAtlas.js";import{TaskPriority as z}from"../../../../support/Scheduler.js";import{Yield as I}from"../../../../support/Yield.js";import{ColorAttachment0 as M}from"../../../../webgl/enums.js";import{DisposableFramebufferObject as H}from"../../../../webgl/FramebufferObject.js";import{TextureDescriptor as R}from"../../../../webgl/TextureDescriptor.js";let q=class extends e{constructor(t){super(t),this._state=h(0),this._passParameters=new v,this._weatherTileCount=128,this._sliceIndex=0,this._tileIndex=0,this._tilesPerSlice=1,this.coverage=s(w.default.coverage[0],w.default.coverage[1],.5),this.density=s(w.default.density[0],w.default.density[1],.5),this.absorption=s(w.default.absorption[0],w.default.absorption[1],.5),this.cloudSize=s(w.default.cloudSize[0],w.default.cloudSize[1],.5),this.detailSize=s(w.default.detailSize[0],w.default.detailSize[1],.5),this.smoothness=s(w.default.smoothness[0],w.default.smoothness[1],.5),this.cloudHeight=s(w.default.cloudHeight[0],w.default.cloudHeight[1],.5),this.raymarchingSteps=w.default.raymarchingSteps,this._viewMatrix=d(),this._dirty=!0,this.readyToRun=!0,this._configuration=new P}initialize(){const t=T(this.view.spatialReference);this._passParameters.cloudRadius=.5*t.radius;const e=()=>this.setDirty();this.addHandles([this.view.resourceController.scheduler.registerTask(z.CLOUDS_GENERATOR,this),o(()=>this.coverage,e,a),o(()=>this.density,e,a),o(()=>this.absorption,e,a),o(()=>this.cloudSize,e,a),o(()=>this.detailSize,e,a),o(()=>this.smoothness,e,a),o(()=>this.cloudHeight,e,a),o(()=>this.raymarchingSteps,e,a)]);const s=_(this._computeWeatherTile());let i=0;this.addHandles(o(()=>{const t=this._computeWeatherTile();return m(s,t)||(++i,p(s,t)),i},e))}destroy(){this.destroyCubeMap(),this._passParameters.noiseTexture=i(this._passParameters.noiseTexture)}_acquireTechnique(){switch(this.raymarchingSteps){case 0:this._tilesPerSlice=1;break;case 1:this._tilesPerSlice=4;break;case 3:case 2:this._tilesPerSlice=8;break;default:this.raymarchingSteps}return this._configuration.steps=this.raymarchingSteps,this._configuration.writeTextureChannels=1-this.parameters.readChannels,this.context.techniques.getCompiled(C,this._configuration)}_computeWeatherTile(){const{camera:t,environment:e}=this.view,{latitude:s,longitude:i}=t.position;if(null==s||null==i)return g;f(D,(s+90)/180,(i+180)/360);const r=Math.floor(this._weatherTileCount*Math.abs(2*D[0]-1));D[0]=Math.floor(2*this._weatherTileCount*D[0]),D[1]=Math.floor(4*(this._weatherTileCount-r)*D[1]);let o=0,a=0;if("virtual"!==e?.lighting?.type&&null!=e?.lighting?.date){const t=new Date(e.lighting.date);t.setUTCHours(e.lighting.date.getUTCHours()+(e.lighting.displayUTCOffset??0)),o=31*t.getUTCMonth()+t.getUTCDate(),a=t.getUTCFullYear()}return D[0]=(D[0]+o)%(2*this._weatherTileCount),D[1]=(D[1]+a%100)%(4*this._weatherTileCount),D}get state(){return this._state.value}set state(t){this._state.value=t}get usedMemory(){return(this._fbo?.usedMemory??0)+(this._passParameters.noiseTexture?.textureAtlas?.usedMemory??0)}_ensureNoiseTexture(){return this._passParameters.noiseTexture??=new j({context:this.context}),this._passParameters.noiseTexture}_ensureFrameBufferCube(t){const e=this.context.rctx;if(null==this._fbo){const s=new R(t,t/2);s.target=35866,s.depth=6,s.wrapMode=33071,this._fbo=new H(e,s),this.parameters.data=this,this.parameters.absorption=this.absorption,this.parameters.coverage=this.coverage}return e.unbindTexture(this._fbo.colorTexture),this._fbo}get cubeMap(){return this._fbo}get parameters(){return this.context.bind.clouds}destroyCubeMap(){this._fbo=r(this._fbo),this.parameters.data=null}applyPreset(t,e){const i=t.median,r=t=>{const r=s(t[0],t[1],i);return e<.5?s(t[0],r,2*e):s(r,t[1],2*(e-.5))};this.coverage=r(t.coverage),this.density=r(t.density),this.absorption=r(t.absorption),this.cloudSize=r(t.cloudSize),this.detailSize=r(t.detailSize),this.smoothness=r(t.smoothness),this.cloudHeight=r(t.cloudHeight),this.raymarchingSteps=t.raymarchingSteps}setDirty(){this._dirty=this.readyToRun=!0}runTask(t){if(3===this.state)return I;this._dirty&&(this._sliceIndex=this._tileIndex=0,this.state=1,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage,this._ensureNoiseTexture().updateWeatherMap(this._computeWeatherTile()),this._dirty=!1);const e=this._acquireTechnique();if(!this._ensureNoiseTexture().textureAtlas||!e)return I;const s=U[this._sliceIndex],i=O[this._sliceIndex];u(this._viewMatrix,k,s,i),c(this._passParameters.viewMatrix,this._viewMatrix);const r=this.context.rctx,o=r.getViewport(),a=S/this._tilesPerSlice,h=this._tileIndex*a;r.setViewport(0,h,S,a);const n=this._ensureFrameBufferCube(S);r.bindFramebuffer(n),this._passParameters.lastSlice=5===this._sliceIndex,r.bindTechnique(e,this.context.bind,this._passParameters);const l=35866;return n.setColorTextureTarget(l,M,this._sliceIndex),r.screen.draw(),r.gl.flush(),r.setViewport(o.x,o.y,o.width,o.height),this.requestRender(),++this._tileIndex,5===this._sliceIndex&&this._tileIndex===this._tilesPerSlice?(this._sliceIndex=this._tileIndex=0,this.state=2,this.readyToRun=!1):this._tileIndex===this._tilesPerSlice&&(++this._sliceIndex,this._tileIndex=0),t.madeProgress(),I}};t([n({constructOnly:!0})],q.prototype,"context",void 0),t([n({constructOnly:!0})],q.prototype,"view",void 0),t([n({constructOnly:!0})],q.prototype,"requestRender",void 0),t([n()],q.prototype,"coverage",void 0),t([n()],q.prototype,"density",void 0),t([n()],q.prototype,"absorption",void 0),t([n()],q.prototype,"cloudSize",void 0),t([n()],q.prototype,"detailSize",void 0),t([n()],q.prototype,"smoothness",void 0),t([n()],q.prototype,"cloudHeight",void 0),t([n()],q.prototype,"raymarchingSteps",void 0),t([n()],q.prototype,"readyToRun",void 0),q=t([l("esri.views.3d.webgl-engine.effects.clouds.CloudsRenderer")],q);const U=[y(1,0,0),y(-1,0,0),y(0,1,0),y(0,-1,0),y(0,0,1),y(0,0,1)],O=[y(0,0,-1),y(0,0,-1),y(0,0,-1),y(0,0,-1),y(0,1,0),y(0,1,0)],k=b(),D=x();export{q as CloudsRenderer};
2
+ import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{lerp as s}from"../../../../../core/mathUtils.js";import{destroyMaybe as i,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as o,initial as a}from"../../../../../core/reactiveUtils.js";import{signal as h}from"../../../../../core/signal.js";import{property as n,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as c}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{targetTo as u}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{equals as p,copy as m,set as f}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{clone as _,ZEROS as g,zeros as x}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as y}from"../../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{zeros as b}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as T}from"../../../../../geometry/ellipsoidUtils.js";import{C as v,c as S}from"../../../../../chunks/Clouds.glsl.js";import{cloudPresets as w}from"./CloudsPresets.js";import{CloudsTechnique as C}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as P}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as j}from"./NoiseTextureAtlas.js";import{TaskPriority as z}from"../../../../support/Scheduler.js";import{Yield as I}from"../../../../support/Yield.js";import{ColorAttachment0 as M}from"../../../../webgl/enums.js";import{DisposableFramebufferObject as H}from"../../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../../webgl/TextureDescriptor.js";let R=class extends e{constructor(t){super(t),this._state=h(0),this._passParameters=new v,this._weatherTileCount=128,this._sliceIndex=0,this._tileIndex=0,this._tilesPerSlice=1,this.coverage=s(w.default.coverage[0],w.default.coverage[1],.5),this.density=s(w.default.density[0],w.default.density[1],.5),this.absorption=s(w.default.absorption[0],w.default.absorption[1],.5),this.cloudSize=s(w.default.cloudSize[0],w.default.cloudSize[1],.5),this.detailSize=s(w.default.detailSize[0],w.default.detailSize[1],.5),this.smoothness=s(w.default.smoothness[0],w.default.smoothness[1],.5),this.cloudHeight=s(w.default.cloudHeight[0],w.default.cloudHeight[1],.5),this.raymarchingSteps=w.default.raymarchingSteps,this._viewMatrix=d(),this._dirty=!0,this.readyToRun=!0,this._configuration=new P}initialize(){const t=T(this.view.spatialReference);this._passParameters.cloudRadius=.5*t.radius;const e=()=>this.setDirty();this.addHandles([this.view.resourceController.scheduler.registerTask(z.CLOUDS_GENERATOR,this),o(()=>this.coverage,e,a),o(()=>this.density,e,a),o(()=>this.absorption,e,a),o(()=>this.cloudSize,e,a),o(()=>this.detailSize,e,a),o(()=>this.smoothness,e,a),o(()=>this.cloudHeight,e,a),o(()=>this.raymarchingSteps,e,a)]);const s=_(this._computeWeatherTile());let i=0;this.addHandles(o(()=>{const t=this._computeWeatherTile();return p(s,t)||(++i,m(s,t)),i},e))}destroy(){this.destroyCubeMap(),this._passParameters.noiseTexture=i(this._passParameters.noiseTexture)}_precompile(){this._configuration.steps=this.raymarchingSteps,this._configuration.writeTextureChannels=1-this.parameters.readChannels,this.context.techniques.getCompiled(C,this._configuration)}_acquireTechnique(){switch(this.raymarchingSteps){case 0:this._tilesPerSlice=1;break;case 1:this._tilesPerSlice=4;break;case 3:case 2:this._tilesPerSlice=8;break;default:this.raymarchingSteps}return this._configuration.steps=this.raymarchingSteps,this._configuration.writeTextureChannels=1-this.parameters.readChannels,this.context.techniques.getCompiled(C,this._configuration)}_computeWeatherTile(){const{camera:t,environment:e}=this.view,{latitude:s,longitude:i}=t.position;if(null==s||null==i)return g;f(D,(s+90)/180,(i+180)/360);const r=Math.floor(this._weatherTileCount*Math.abs(2*D[0]-1));D[0]=Math.floor(2*this._weatherTileCount*D[0]),D[1]=Math.floor(4*(this._weatherTileCount-r)*D[1]);let o=0,a=0;if("virtual"!==e?.lighting?.type&&null!=e?.lighting?.date){const t=new Date(e.lighting.date);t.setUTCHours(e.lighting.date.getUTCHours()+(e.lighting.displayUTCOffset??0)),o=31*t.getUTCMonth()+t.getUTCDate(),a=t.getUTCFullYear()}return D[0]=(D[0]+o)%(2*this._weatherTileCount),D[1]=(D[1]+a%100)%(4*this._weatherTileCount),D}get state(){return this._state.value}set state(t){this._state.value=t}get usedMemory(){return(this._fbo?.usedMemory??0)+(this._passParameters.noiseTexture?.textureAtlas?.usedMemory??0)}_ensureNoiseTexture(){return this._passParameters.noiseTexture??=new j({context:this.context}),this._passParameters.noiseTexture}_ensureFrameBufferCube(t){const e=this.context.rctx;if(null==this._fbo){const s=new q(t,t/2);s.target=35866,s.depth=6,s.wrapMode=33071,this._fbo=new H(e,s),this.parameters.data=this,this.parameters.absorption=this.absorption,this.parameters.coverage=this.coverage}return e.unbindTexture(this._fbo.colorTexture),this._fbo}get cubeMap(){return this._fbo}get parameters(){return this.context.bind.clouds}destroyCubeMap(){this._fbo=r(this._fbo),this.parameters.data=null}applyPreset(t,e){const i=t.median,r=t=>{const r=s(t[0],t[1],i);return e<.5?s(t[0],r,2*e):s(r,t[1],2*(e-.5))};this.coverage=r(t.coverage),this.density=r(t.density),this.absorption=r(t.absorption),this.cloudSize=r(t.cloudSize),this.detailSize=r(t.detailSize),this.smoothness=r(t.smoothness),this.cloudHeight=r(t.cloudHeight),this.raymarchingSteps=t.raymarchingSteps}setDirty(){this._dirty=this.readyToRun=!0,this._precompile()}runTask(t){if(3===this.state)return I;this._dirty&&(this._sliceIndex=this._tileIndex=0,this.state=1,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage,this._ensureNoiseTexture().updateWeatherMap(this._computeWeatherTile()),this._dirty=!1);const e=this._acquireTechnique();if(!this._ensureNoiseTexture().textureAtlas||!e)return I;const s=U[this._sliceIndex],i=O[this._sliceIndex];u(this._viewMatrix,k,s,i),c(this._passParameters.viewMatrix,this._viewMatrix);const r=this.context.rctx,o=r.getViewport(),a=S/this._tilesPerSlice,h=this._tileIndex*a;r.setViewport(0,h,S,a);const n=this._ensureFrameBufferCube(S);r.bindFramebuffer(n),this._passParameters.lastSlice=5===this._sliceIndex,r.bindTechnique(e,this.context.bind,this._passParameters);const l=35866;return n.setColorTextureTarget(l,M,this._sliceIndex),r.screen.draw(),r.gl.flush(),r.setViewport(o.x,o.y,o.width,o.height),this.requestRender(),++this._tileIndex,5===this._sliceIndex&&this._tileIndex===this._tilesPerSlice?(this._sliceIndex=this._tileIndex=0,this.state=2,this.readyToRun=!1):this._tileIndex===this._tilesPerSlice&&(++this._sliceIndex,this._tileIndex=0),t.madeProgress(),I}};t([n({constructOnly:!0})],R.prototype,"context",void 0),t([n({constructOnly:!0})],R.prototype,"view",void 0),t([n({constructOnly:!0})],R.prototype,"requestRender",void 0),t([n()],R.prototype,"coverage",void 0),t([n()],R.prototype,"density",void 0),t([n()],R.prototype,"absorption",void 0),t([n()],R.prototype,"cloudSize",void 0),t([n()],R.prototype,"detailSize",void 0),t([n()],R.prototype,"smoothness",void 0),t([n()],R.prototype,"cloudHeight",void 0),t([n()],R.prototype,"raymarchingSteps",void 0),t([n()],R.prototype,"readyToRun",void 0),R=t([l("esri.views.3d.webgl-engine.effects.clouds.CloudsRenderer")],R);const U=[y(1,0,0),y(-1,0,0),y(0,1,0),y(0,-1,0),y(0,0,1),y(0,0,1)],O=[y(0,0,-1),y(0,0,-1),y(0,0,-1),y(0,0,-1),y(0,1,0),y(0,1,0)],k=b(),D=x();export{R as CloudsRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import{equals as i,copy as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{N as c}from"../../../../../chunks/NoiseTextureAtlas.glsl.js";import{NoiseTextureAtlasTechniqueConfiguration as a}from"./NoiseTextureAtlasConfiguration.js";import{atlasSize as u}from"./NoiseTextureAtlasDimensions.js";import{NoiseTextureAtlasTechnique as m}from"./NoiseTextureAtlasTechnique.js";import{DisposableFramebufferObject as h}from"../../../../webgl/FramebufferObject.js";import{TextureDescriptor as p}from"../../../../webgl/TextureDescriptor.js";let f=class extends e{constructor(t){super(t),this._passParameters=new c,this._configuration=new a,this._fbo=new h(t.context.rctx,new p(u))}get textureAtlas(){if(this._texture)return this._texture;const t=this.context.techniques.getCompiled(m,this._configuration);return t&&(this._texture=this._render(t)),this._texture}updateWeatherMap(t){i(this._passParameters.weatherTile,t)||(n(this._passParameters.weatherTile,t),this._configuration.mode=this._texture?1:0,this._texture=null)}destroy(){this._fbo=r(this._fbo)}_render(t){if(!this._fbo)return null;const e=this.context.rctx,r=e.getViewport();return e.setViewport(0,0,u,u),e.bindFramebuffer(this._fbo),e.bindTechnique(t,this.context.bind,this._passParameters),e.screen.draw(),e.setViewport(r.x,r.y,r.width,r.height),this._fbo.colorTexture}};t([o({constructOnly:!0})],f.prototype,"context",void 0),f=t([s("esri.views.3d.webgl-engine.effects.clouds.NoiseTextureAtlas")],f);export{f as NoiseTextureAtlas};
2
+ import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import{equals as i,copy as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{N as c}from"../../../../../chunks/NoiseTextureAtlas.glsl.js";import{NoiseTextureAtlasTechniqueConfiguration as a}from"./NoiseTextureAtlasConfiguration.js";import{atlasSize as u}from"./NoiseTextureAtlasDimensions.js";import{NoiseTextureAtlasTechnique as h}from"./NoiseTextureAtlasTechnique.js";import{DisposableFramebufferObject as m}from"../../../../webgl/FramebufferObject.js";import{TextureDescriptor as p}from"../../../../webgl/TextureDescriptor.js";let f=class extends e{constructor(t){super(t),this._passParameters=new c,this._configuration=new a,this._fbo=new m(t.context.rctx,new p(u)),t.context.techniques.precompile(h,this._configuration)}get textureAtlas(){if(this._texture)return this._texture;const t=this.context.techniques.getCompiled(h,this._configuration);return t&&(this._texture=this._render(t)),this._texture}updateWeatherMap(t){i(this._passParameters.weatherTile,t)||(n(this._passParameters.weatherTile,t),this._configuration.mode=this._texture?1:0,this._texture=null,this.context.techniques.precompile(h,this._configuration))}destroy(){this._fbo=r(this._fbo)}_render(t){if(!this._fbo)return null;const e=this.context.rctx,r=e.getViewport();return e.setViewport(0,0,u,u),e.bindFramebuffer(this._fbo),e.bindTechnique(t,this.context.bind,this._passParameters),e.screen.draw(),e.setViewport(r.x,r.y,r.width,r.height),this._fbo.colorTexture}};t([o({constructOnly:!0})],f.prototype,"context",void 0),f=t([s("esri.views.3d.webgl-engine.effects.clouds.NoiseTextureAtlas")],f);export{f as NoiseTextureAtlas};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{F as a}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as n}from"./FocusAreaColorTechnique.js";import{DepthStencilAttachment as c}from"../../../../webgl/enums.js";let d=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[i.FOCUSAREA_COLOR,i.FOCUSAREA]},this.produces=i.FOCUSAREA_COLOR,this._fadeDirection=0,this._passParameters=new a}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(t(()=>this._passParameters.fadeFactor.value,t=>{0===t&&(this.removeAllHandles(),e())})),this.requestRender(2)}render(e){const t=e.find(({name:e})=>e===this.produces),s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.focusAreasView.style,o=this.bindParameters,a=o.camera,d=a.fullViewport[2],m=a.fullViewport[3];this._startTime??=this.view.stage?.renderer.renderContext.time;const u=this.view.qualitySettings.fadeDuration,f=u>0?Math.min(u,this.view.stage?.renderer.renderContext.time-this._startTime)/u:1,l=e.find(({name:e})=>e===i.FOCUSAREA),p=this.fboCache.acquire(d,m,this.produces),A=this.renderingContext;return A.bindFramebuffer(p.fbo),this._passParameters.color=t.getTexture(),this._passParameters.focusArea=l.getTexture(),this._passParameters.effect=h[r],this._passParameters.fadeFactor.value=0===this._fadeDirection?f:1-f,A.bindTechnique(s,o,this._passParameters),A.screen.draw(),p.attachDepth(t.getAttachment(c)),f<1&&this.requestRender(2),p}};e([s()],d.prototype,"consumes",void 0),e([s()],d.prototype,"produces",void 0),e([s({constructOnly:!0})],d.prototype,"focusAreasView",void 0),d=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],d);const h={bright:0,dark:1};export{d as FocusAreaColorNode,h as styleToEffect};
2
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{F as a}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as n}from"./FocusAreaColorTechnique.js";import{DepthStencilAttachment as c}from"../../../../webgl/enums.js";let d=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[i.FOCUSAREA_COLOR,i.FOCUSAREA]},this.produces=i.FOCUSAREA_COLOR,this._fadeDirection=0,this._passParameters=new a}precompile(){this.techniques.precompile(n)}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(t(()=>this._passParameters.fadeFactor.value,t=>{0===t&&(this.removeAllHandles(),e())})),this.requestRender(2)}render(e){const t=e.find(({name:e})=>e===this.produces),s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.focusAreasView.style,o=this.bindParameters,a=o.camera,d=a.fullViewport[2],m=a.fullViewport[3];this._startTime??=this.view.stage?.renderer.renderContext.time;const u=this.view.qualitySettings.fadeDuration,p=u>0?Math.min(u,this.view.stage?.renderer.renderContext.time-this._startTime)/u:1,l=e.find(({name:e})=>e===i.FOCUSAREA),f=this.fboCache.acquire(d,m,this.produces),A=this.renderingContext;return A.bindFramebuffer(f.fbo),this._passParameters.color=t.getTexture(),this._passParameters.focusArea=l.getTexture(),this._passParameters.effect=h[r],this._passParameters.fadeFactor.value=0===this._fadeDirection?p:1-p,A.bindTechnique(s,o,this._passParameters),A.screen.draw(),f.attachDepth(t.getAttachment(c)),p<1&&this.requestRender(2),f}};e([s()],d.prototype,"consumes",void 0),e([s()],d.prototype,"produces",void 0),e([s({constructOnly:!0})],d.prototype,"focusAreasView",void 0),d=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],d);const h={bright:0,dark:1};export{d as FocusAreaColorNode,h as styleToEffect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{RenderNodeOutput as r,InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaMask.glsl.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{volumeToVao as h}from"./focusAreaMaskUtils.js";import{DepthStencilAttachment as c,PrimitiveType as u}from"../../../../webgl/enums.js";import{noParameters as l}from"../../../../webgl/NoParameters.js";let p=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.TRANSPARENT]},this.produces=i.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new n}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}render(e){const s=this.techniques.getCompiled(a);if(!s||!this._vaos)return void this.requestRender(1);const t=e.find(({name:e})=>e===r.TRANSPARENT),o=this.renderingContext,n=this.bindParameters,h=n.camera,p=h.fullViewport[2],d=h.fullViewport[3],m=this.fboCache.acquire(p,d,i.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(m.acquireDepth(13),o.blitFramebuffer(t.fbo,m.fbo,256)):m.attachDepth(t.getAttachment(c)),o.bindFramebuffer(m.fbo),o.setClearColor(0,0,0,1),o.clear(17408),o.setViewport(0,0,p,d);const f=o.bindTechnique(s,n);o.setFaceCullingEnabled(!1),o.setStencilTestEnabled(!0),o.setStencilOpSeparate(1028,7680,34055,7680),o.setStencilOpSeparate(1029,7680,34056,7680),o.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],f.bindDraw(n,l,this._maskParameters),o.bindVAO(e),o.setDepthTestEnabled(!0),o.setStencilWriteMask(255),o.setStencilFunction(519,0,255),o.setColorMask(!1,!1,!1,!1),o.drawArrays(u.TRIANGLES,0,s),o.setDepthTestEnabled(!1),o.setStencilWriteMask(0),o.setStencilFunction(517,0,255),o.setColorMask(!0,!0,!0,!0),o.drawArrays(u.TRIANGLES,0,s)}return m}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=e.geometryVolume,{vao:t,vertexCount:r}=h(this.renderingContext,s);this._vaos.push(t),this._counts.push(r),this._origins.push(e.origin)}),this.requestRender(1)}};e([s()],p.prototype,"consumes",void 0),e([s()],p.prototype,"produces",void 0),e([s({constructOnly:!0})],p.prototype,"focusAreasView",void 0),p=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],p);export{p as FocusAreaMaskNode};
2
+ import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{RenderNodeOutput as r,InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaMask.glsl.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{volumeToVao as c}from"./focusAreaMaskUtils.js";import{DepthStencilAttachment as h,PrimitiveType as l}from"../../../../webgl/enums.js";import{noParameters as u}from"../../../../webgl/NoParameters.js";let p=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.TRANSPARENT]},this.produces=i.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new n}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const s=this.techniques.getCompiled(a);if(!s||!this._vaos)return void this.requestRender(1);const t=e.find(({name:e})=>e===r.TRANSPARENT),o=this.renderingContext,n=this.bindParameters,c=n.camera,p=c.fullViewport[2],m=c.fullViewport[3],d=this.fboCache.acquire(p,m,i.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(d.acquireDepth(13),o.blitFramebuffer(t.fbo,d.fbo,256)):d.attachDepth(t.getAttachment(h)),o.bindFramebuffer(d.fbo),o.setClearColor(0,0,0,1),o.clear(17408),o.setViewport(0,0,p,m);const f=o.bindTechnique(s,n);o.setFaceCullingEnabled(!1),o.setStencilTestEnabled(!0),o.setStencilOpSeparate(1028,7680,34055,7680),o.setStencilOpSeparate(1029,7680,34056,7680),o.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],f.bindDraw(n,u,this._maskParameters),o.bindVAO(e),o.setDepthTestEnabled(!0),o.setStencilWriteMask(255),o.setStencilFunction(519,0,255),o.setColorMask(!1,!1,!1,!1),o.drawArrays(l.TRIANGLES,0,s),o.setDepthTestEnabled(!1),o.setStencilWriteMask(0),o.setStencilFunction(517,0,255),o.setColorMask(!0,!0,!0,!0),o.drawArrays(l.TRIANGLES,0,s)}return d}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=e.geometryVolume,{vao:t,vertexCount:r}=c(this.renderingContext,s);this._vaos.push(t),this._counts.push(r),this._origins.push(e.origin)}),this.requestRender(1)}};e([s()],p.prototype,"consumes",void 0),e([s()],p.prototype,"produces",void 0),e([s({constructOnly:!0})],p.prototype,"focusAreasView",void 0),p=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],p);export{p as FocusAreaMaskNode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t,smoothstep as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{copy as n,normalize as h,dot as m,scale as p,lerp as l,length as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as f}from"../../../webgl.js";import{heightLimit as g}from"../../../environment/weather.js";import{TransparentEnvironment as P}from"../TransparentEnvironment.js";import{Blit as w}from"../blit/Blit.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as y}from"./FogTechnique.js";import{FogTechniqueConfiguration as v}from"./FogTechniqueConfiguration.js";import{ColorAttachment1 as F,DepthStencilAttachment as j,ColorAttachment0 as E}from"../../../../webgl/enums.js";const R=.95,q=1;let x=class extends P{constructor(e){super(e),this._configuration=new v,this._newParameters=new T,this._oldParameters=new T,this._fadedParameters=new T,this._parameters=this._newParameters,this._passParameters=new b,this._blit=null;const t=_(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(a(()=>this._fadeFactor,e=>this._fade(e),i))}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copyFrom(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const e=this.view.environment.weather,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):"snowy"===e.type||"rainy"===e.type?t(4e-6,2e-4,(e.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||n(this._newParameters.color,A),"rainy"===e.type&&n(this._newParameters.color,N),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(2)}precompile(){this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value}render(e){const t=e.find(({name:e})=>e===f.TRANSPARENT_ENVIRONMENT);if(0===this._parameters.amount)return t;if(this._update(),this._passParameters.amount<=0)return t;const s=t.getAttachment(F);this._configuration.hasEmissive=null!=s;const a=this.techniques.getCompiled(y,this._configuration);if(!a)return this.requestRender(1),t;const i=t.getAttachment(j),o=this.renderingContext,{fullWidth:n,fullHeight:h}=this.bindParameters.camera,m=n,p=h;if(s){const e=this.bindParameters.useFloatBlend.value?8:5;this._passParameters.emission=this.fboCache.acquire(m,p,"glow horizontal",e),this._blit??=new w(this.techniques),this._blit.blitTexture(o,s?.attachment,this.bindParameters,this._passParameters.emission)}return t.attachDepth(null),o.bindFramebuffer(t.fbo),o.bindTechnique(a,this.bindParameters,this._passParameters),o.setDrawBuffers([E]),o.screen.draw(),t.attachDepth(i),this._passParameters.emission=r(this._passParameters.emission),t}_update(){const e=this.bindParameters.camera;h(C,e.eye);const t=Math.max(0,m(C,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;p(B,r,.1),l(this._passParameters.color,B,r,t);const a=c(e.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(R*g,q*g,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}get test(){return{parameters:this._passParameters}}};x=e([o("esri.views.3d.webgl-engine.effects.fog.Fog")],x);class T{constructor(){this.color=d(),this.strength=0,this.amount=0}copyFrom(e){this.amount=e.amount,this.strength=e.strength,n(this.color,e.color)}lerp(e,s,r){this.amount=t(e.amount,s.amount,r),this.strength=t(e.strength,s.strength,r),l(this.color,e.color,s.color,r)}}const C=d(),B=d(),N=u(.5,.5,.5),A=u(1.5,1.5,1.5);export{x as Fog,T as FogParameters};
2
+ import{__decorate as e}from"tslib";import{lerp as t,smoothstep as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{copy as n,normalize as h,dot as m,scale as p,lerp as c,length as l}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as f}from"../../../webgl.js";import{heightLimit as g}from"../../../environment/weather.js";import{TransparentEnvironment as P}from"../TransparentEnvironment.js";import{Blit as w}from"../blit/Blit.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as y}from"./FogTechnique.js";import{FogTechniqueConfiguration as v}from"./FogTechniqueConfiguration.js";import{ColorAttachment1 as F,DepthStencilAttachment as j,ColorAttachment0 as E}from"../../../../webgl/enums.js";const R=.95,q=1;let x=class extends P{constructor(e){super(e),this._configuration=new v,this._newParameters=new T,this._oldParameters=new T,this._fadedParameters=new T,this._parameters=this._newParameters,this._passParameters=new b,this._blit=null;const t=_(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(a(()=>this._fadeFactor,e=>this._fade(e),i))}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copyFrom(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const e=this.view.environment.weather,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):"snowy"===e.type||"rainy"===e.type?t(4e-6,2e-4,(e.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||n(this._newParameters.color,A),"rainy"===e.type&&n(this._newParameters.color,N),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(2)}precompile(){this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._parameters.amount>0&&(this._configuration.hasEmissive=this.bindParameters.hasEmission,this.techniques.precompile(y,this._configuration))}render(e){const t=e.find(({name:e})=>e===f.TRANSPARENT_ENVIRONMENT);if(0===this._parameters.amount)return t;if(this._update(),this._passParameters.amount<=0)return t;const s=t.getAttachment(F);this._configuration.hasEmissive=null!=s;const a=this.techniques.getCompiled(y,this._configuration);if(!a)return this.requestRender(1),t;const i=t.getAttachment(j),o=this.renderingContext,{fullWidth:n,fullHeight:h}=this.bindParameters.camera,m=n,p=h;if(s){const e=this.bindParameters.useFloatBlend.value?8:5;this._passParameters.emission=this.fboCache.acquire(m,p,"glow horizontal",e),this._blit??=new w(this.techniques),this._blit.blitTexture(o,s?.attachment,this.bindParameters,this._passParameters.emission)}return t.attachDepth(null),o.bindFramebuffer(t.fbo),o.bindTechnique(a,this.bindParameters,this._passParameters),o.setDrawBuffers([E]),o.screen.draw(),t.attachDepth(i),this._passParameters.emission=r(this._passParameters.emission),t}_update(){const e=this.bindParameters.camera;h(C,e.eye);const t=Math.max(0,m(C,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;p(B,r,.1),c(this._passParameters.color,B,r,t);const a=l(e.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(R*g,q*g,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}get test(){return{parameters:this._passParameters}}};x=e([o("esri.views.3d.webgl-engine.effects.fog.Fog")],x);class T{constructor(){this.color=d(),this.strength=0,this.amount=0}copyFrom(e){this.amount=e.amount,this.strength=e.strength,n(this.color,e.color)}lerp(e,s,r){this.amount=t(e.amount,s.amount,r),this.strength=t(e.strength,s.strength,r),c(this.color,e.color,s.color,r)}}const C=d(),B=d(),N=u(.5,.5,.5),A=u(1.5,1.5,1.5);export{x as Fog,T as FogParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{abortMaybe as r,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as i}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as m}from"../../../../../core/accessorSupport/decorators.js";import{set as u}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{requestImage as h}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as b}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as _}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as g}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as w}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as P}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as x,ColorAttachment1 as T,SizedPixelFormat as I}from"../../../../webgl/enums.js";import C from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";const q=1,M=.25;let B=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=c.AMBIENT_ILLUMINATION,this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new w,this._maxFrames=255,this._configuration=new g,this._resetBuffer=!1}async initialize(){this._abortController=new AbortController;const e=this._abortController.signal;try{const t=(await import("./BlueNoise.js")).data;a(e),await this._loadBlueNoiseTexture(t,e),a(e)}catch(r){i(r)||t.getLogger(this).errorOnce("Failed to load blue noise texture:",r)}this.addHandles(o(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this.resetAccumulation(),this.requestRender(1)},n))}destroy(){this._abortController=r(this._abortController),this._passParameters.noiseTexture=s(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(x),a=this._mode;if(!r||!s)return this._emptyOutput;if(this.view.stage.renderView.updating&&this.resetAccumulation(),0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this.requestRender(1),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=i.hasEmission;const o=this.techniques.getCompiled(_,this._configuration),n=this.techniques.getCompiled(b),l=this._needsUpscalePass(a),m=l?M:1,h=l?this.techniques.getCompiled(P):null;if(!o||!n||l&&!h)return this.requestRender(1),this._emptyOutput;const p=this.renderingContext,{camera:d}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.projScale=1/d.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=m;const{fullWidth:f,fullHeight:g}=d,w=Math.max(1,Math.floor(f*m)),I=Math.max(1,Math.floor(g*m)),C=this.fboCache.acquire(w,I,"global illumination input").acquireColor(T,0);p.bindFramebuffer(C.fbo),p.setViewport(0,0,w,I),p.bindTechnique(o,i,this._passParameters,this._drawParameters),p.screen.draw();const j=C.obtainAttachment(T),B=Math.max(1,Math.round(w/q)),G=Math.max(1,Math.round(I/q)),N=this.fboCache.acquire(B,G,"global illumination blur horizontal");p.bindFramebuffer(N.fbo),this._drawParameters.texture=C.getTexture(),this._drawParameters.weightTexture=j.attachment,u(this._drawParameters.blurSize,0,q/I),p.bindTechnique(n,i,this._passParameters,this._drawParameters),p.setViewport(0,0,B,G),p.screen.draw(),C.release();const A=l?"global illumination blur vertical":c.AMBIENT_ILLUMINATION,F=this.fboCache.acquire(B,G,A);p.bindFramebuffer(F.fbo),p.setViewport(0,0,B,G),p.setClearColor(1,1,1,0),p.clear(16384),this._drawParameters.texture=N.getTexture(),this._drawParameters.weightTexture=j.attachment,u(this._drawParameters.blurSize,q/B,0),p.bindTechnique(n,i,this._passParameters,this._drawParameters),p.setViewport(0,0,B,G),p.screen.draw(),N.release(),F.attachColor(j,T),j.release();let y=F;return h&&(y=this.fboCache.acquire(f,g,c.AMBIENT_ILLUMINATION).acquireColor(T,0),p.bindFramebuffer(y.fbo),p.setViewport(0,0,f,g),p.setClearColor(1,1,1,0),p.clear(16384),this._drawParametersUpscale.colorTexture=F.getTexture(),this._drawParametersUpscale.weightTexture=F.getTexture(T),p.bindTechnique(h,i,this._passParameters,this._drawParametersUpscale),p.screen.draw(),F.release()),p.setViewport4fv(d.fullViewport),this._passParameters.frameCount=(this._passParameters.frameCount+1)%64,++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this.requestRender(1),y}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,c.AMBIENT_ILLUMINATION).acquireColor(T,0);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),s}async _loadBlueNoiseTexture(e,t){a(t);const r=await h(e,{signal:t});if(a(t),!r)return;const s=new j;s.internalFormat=I.RGBA8,s.wrapMode=10497,s.isImmutable=!0,this._passParameters.noiseTexture=new C(this.renderingContext,s,r)}get _canRender(){const e=this.bindParameters;return!(!this._passParameters.noiseTexture||!e.reprojection.lastFrameColor||e.hasEmission&&!e.reprojection.lastFrameEmission||!e.reprojection.lastFrameDepth||!e.globalIllumination||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}resetAccumulation(){this._passParameters.accumulatedFrames=0}_needsUpscalePass(e){return 1===e}get test(){}};e([l()],B.prototype,"consumes",void 0),e([l()],B.prototype,"produces",void 0),e([l()],B.prototype,"_abortController",void 0),B=e([m("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],B);export{B as GlobalIllumination,q as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{abortMaybe as r,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as i}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as m}from"../../../../../core/accessorSupport/decorators.js";import{set as u}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{requestImage as h}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{G as d}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as f}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as _}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as b}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as g}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as w}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as P}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as x,ColorAttachment1 as T,SizedPixelFormat as I}from"../../../../webgl/enums.js";import C from"../../../../webgl/Texture.js";import{TextureDescriptor as q}from"../../../../webgl/TextureDescriptor.js";const j=1,M=.25;let B=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=c.AMBIENT_ILLUMINATION,this._passParameters=new d,this._drawParameters=new f,this._drawParametersUpscale=new w,this._maxFrames=255,this._configuration=new g,this._resetBuffer=!1}async initialize(){this._abortController=new AbortController;const e=this._abortController.signal;try{const t=(await import("./BlueNoise.js")).data;a(e),await this._loadBlueNoiseTexture(t,e),a(e)}catch(r){i(r)||t.getLogger(this).errorOnce("Failed to load blue noise texture:",r)}this.addHandles(o(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this.resetAccumulation(),this.requestRender(1)},n))}precompile(){this._canRender&&(this._configuration.hasEmission=this.bindParameters.hasEmission,this.techniques.precompile(b,this._configuration),this.techniques.precompile(_),this._needsUpscalePass(this._mode)&&this.techniques.precompile(P))}destroy(){this._abortController=r(this._abortController),this._passParameters.noiseTexture=s(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(x),a=this._mode;if(!r||!s)return this._emptyOutput;if(this.view.stage.renderView.updating&&this.resetAccumulation(),0===a)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this.requestRender(1),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=i.hasEmission;const o=this.techniques.getCompiled(b,this._configuration),n=this.techniques.getCompiled(_),l=this._needsUpscalePass(a),m=l?M:1,h=l?this.techniques.getCompiled(P):null;if(!o||!n||l&&!h)return this.requestRender(1),this._emptyOutput;const p=this.renderingContext,{camera:d}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.projScale=1/d.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=m;const{fullWidth:f,fullHeight:g}=d,w=Math.max(1,Math.floor(f*m)),I=Math.max(1,Math.floor(g*m)),C=this.fboCache.acquire(w,I,"global illumination input").acquireColor(T,0);p.bindFramebuffer(C.fbo),p.setViewport(0,0,w,I),p.bindTechnique(o,i,this._passParameters,this._drawParameters),p.screen.draw();const q=C.obtainAttachment(T),B=Math.max(1,Math.round(w/j)),G=Math.max(1,Math.round(I/j)),N=this.fboCache.acquire(B,G,"global illumination blur horizontal");p.bindFramebuffer(N.fbo),this._drawParameters.texture=C.getTexture(),this._drawParameters.weightTexture=q.attachment,u(this._drawParameters.blurSize,0,j/I),p.bindTechnique(n,i,this._passParameters,this._drawParameters),p.setViewport(0,0,B,G),p.screen.draw(),C.release();const A=l?"global illumination blur vertical":c.AMBIENT_ILLUMINATION,F=this.fboCache.acquire(B,G,A);p.bindFramebuffer(F.fbo),p.setViewport(0,0,B,G),p.setClearColor(1,1,1,0),p.clear(16384),this._drawParameters.texture=N.getTexture(),this._drawParameters.weightTexture=q.attachment,u(this._drawParameters.blurSize,j/B,0),p.bindTechnique(n,i,this._passParameters,this._drawParameters),p.setViewport(0,0,B,G),p.screen.draw(),N.release(),F.attachColor(q,T),q.release();let U=F;return h&&(U=this.fboCache.acquire(f,g,c.AMBIENT_ILLUMINATION).acquireColor(T,0),p.bindFramebuffer(U.fbo),p.setViewport(0,0,f,g),p.setClearColor(1,1,1,0),p.clear(16384),this._drawParametersUpscale.colorTexture=F.getTexture(),this._drawParametersUpscale.weightTexture=F.getTexture(T),p.bindTechnique(h,i,this._passParameters,this._drawParametersUpscale),p.screen.draw(),F.release()),p.setViewport4fv(d.fullViewport),this._passParameters.frameCount=(this._passParameters.frameCount+1)%64,++this._passParameters.accumulatedFrames,this._passParameters.accumulatedFrames<this._maxFrames&&this.requestRender(1),U}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,c.AMBIENT_ILLUMINATION).acquireColor(T,0);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),s}async _loadBlueNoiseTexture(e,t){a(t);const r=await h(e,{signal:t});if(a(t),!r)return;const s=new q;s.internalFormat=I.RGBA8,s.wrapMode=10497,s.isImmutable=!0,this._passParameters.noiseTexture=new C(this.renderingContext,s,r)}get _canRender(){const e=this.bindParameters;return!(!this._passParameters.noiseTexture||!e.reprojection.lastFrameColor||e.hasEmission&&!e.reprojection.lastFrameEmission||!e.reprojection.lastFrameDepth||!e.globalIllumination||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}resetAccumulation(){this._passParameters.accumulatedFrames=0}_needsUpscalePass(e){return 1===e}get test(){}};e([l()],B.prototype,"consumes",void 0),e([l()],B.prototype,"produces",void 0),e([l()],B.prototype,"_abortController",void 0),B=e([m("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],B);export{B as GlobalIllumination,j as blurSizePixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{lerp as e}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{length as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as l}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as u}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as p}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as _}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as b}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as P}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as w,DepthStencilAttachment as T}from"../../../../webgl/enums.js";let C=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new p,this._blurVerticalConfiguration=new p,this._compositionConfiguration=new b,this._compositionParameters=new g,this._blurParameters=new l,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037,this._mode=0,this._intensity=.5,this._scatteringFactors={realistic:new d([.8,.12,.05,.02,.01,0]),maximumFog:new d([0,.27,.6,1.05,1.58,2.1],!1),cartographicMin:new d([.4,.18,.25,.12,.05,0],!1),cartographicDefault:new d([1.17,1.08,.78,.4,.26,.11],!1),cartographicMax:new d([3.59,3.9,2.46,1.4,.93,.44],!1)},this._glowResults=new Array;const e=h(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},s),i(()=>this._updateParameters(),()=>{},s)])}_updateParameters(){const t=this.view.environment.lighting.glow;this._mode=null==t?this.view.environment.atmosphereEnabled?0:2:1,t&&(this._intensity=t.intensity),this._compositionParameters.minDisperse.presets=this.getPreset(this._mode),this.requestRender(1)}_updateFogParameters(){const t=this.view.environment.weatherAvailable,i=this.view.environment.weather;t&&"sunny"!==i.type&&"cloudy"!==i.type?this._compositionParameters.distanceModifier="foggy"===i.type?e(3e-5,.005,i.fogStrength**3):e(4e-6,2e-4,(i.precipitation??0)**3):this._compositionParameters.distanceModifier=0,this._compositionParameters.maxDisperse=this._scatteringFactors.maximumFog,this.requestRender(1)}render(t){const e=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),i=e.getAttachment(w);if(!i?.attachment)return e;const s=e.getTexture(),r=e.getAttachment(T);if(this._compositionConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,2===this._mode){this._compositionConfiguration.blurEnabled=!1;const t=this.techniques.getCompiled(f,this._compositionConfiguration);if(!t)return this.requestRender(1),e;const o=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,h=this.renderingContext,c=o.acquire(s.descriptor.width,s.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=s,this._compositionParameters.emission=i.attachment,h.bindTechnique(t,this.bindParameters,this._compositionParameters),h.screen.draw(),c.attachDepth(r),c.attachColor(i,w),c}this._compositionConfiguration.blurEnabled=!0;const o=this.techniques.getCompiled(u,this._blurHorizontalConfiguration),n=this.techniques.getCompiled(u,this._blurVerticalConfiguration),h=this.techniques.getCompiled(f,this._compositionConfiguration);if(!o||!n||!h)return this.requestRender(1),e;const m=this.fboCache,{fullWidth:l,fullHeight:p}=this.bindParameters.camera,g=this.renderingContext;let d=Math.ceil(l/2),_=Math.ceil(p/2);const b=5;this._blurParameters.emissionsToDownsample=i.attachment,this._blurParameters.inputScale=P,this._blurParameters.blurRadius=this._logicalBlurRadius;for(let a=0;a<b;a++){const t=m.acquire(d,_,"glow horizontal",8);this._prepareFBO(t,d,_),g.bindTechnique(o,this.bindParameters,this._blurParameters),g.screen.draw();const e=m.acquire(d,_,"glow vertical",8);this._blurParameters.inputScale=1,this._blurParameters.emissionsToDownsample=t.getTexture(),this._prepareFBO(e,d,_),g.bindTechnique(n,this.bindParameters,this._blurParameters),g.screen.draw(),t.release(),this._glowResults[a]=e,d=Math.ceil(d/2),_=Math.ceil(_/2),this._blurParameters.emissionsToDownsample=e.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod}const C=this.bindParameters.camera,R=a(C.eye);this._compositionParameters.atmosphereC=R**2-this._atmosphereRadius**2,this._compositionParameters.color=s,this._compositionParameters.emission=i.attachment,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const x=m.acquire(s.descriptor.width,s.descriptor.height,this.produces);return x.acquireColor(w,this.bindParameters.useFloatBlend?8:5,"emissive glow"),this._prepareFBO(x,l,p,!0),g.bindTechnique(h,this.bindParameters,this._compositionParameters),g.screen.draw(),this._glowResults.forEach(t=>t.release()),x.attachDepth(r),x}getPreset(t){return 0===t?this._scatteringFactors.realistic.presets:this._intensity<=.5?_(this._scatteringFactors.cartographicMin.presets,this._scatteringFactors.cartographicDefault.presets,2*this._intensity):_(this._scatteringFactors.cartographicDefault.presets,this._scatteringFactors.cartographicMax.presets,2*(this._intensity-.5))}_prepareFBO(t,e,i,s=!1){const r=this.renderingContext;r.bindFramebuffer(t.fbo),r.setViewport(0,0,e,i),r.setClearColor(0,0,0,0),r.clear(16384),s&&r.clearBuffer(1,n)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:t=>{this._compositionParameters.dispersionWeight=t},getPresets:this.getPreset(this._mode),setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.presets[t]=e:(this._scatteringFactors.cartographicMin.presets[t]=e,this._scatteringFactors.cartographicMax.presets[t]=e)},toggleTonemapping:t=>{this._compositionConfiguration.tonemappingEnabled=t,this.requestRender(1)}}}};t([r()],C.prototype,"consumes",void 0),t([r()],C.prototype,"produces",void 0),C=t([o("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],C);export{C as GlowRenderNode};
2
+ import{__decorate as t}from"tslib";import{lerp as e}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{length as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{G as m}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as u}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as p}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as _}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as b}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as P}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as w,DepthStencilAttachment as C}from"../../../../webgl/enums.js";let T=class extends l{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new p,this._blurVerticalConfiguration=new p,this._compositionConfiguration=new b,this._compositionParameters=new g,this._blurParameters=new m,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037,this._mode=0,this._intensity=.5,this._scatteringFactors={realistic:new d([.8,.12,.05,.02,.01,0]),maximumFog:new d([0,.27,.6,1.05,1.58,2.1],!1),cartographicMin:new d([.4,.18,.25,.12,.05,0],!1),cartographicDefault:new d([1.17,1.08,.78,.4,.26,.11],!1),cartographicMax:new d([3.59,3.9,2.46,1.4,.93,.44],!1)},this._glowResults=new Array;const e=h(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},s),i(()=>this._updateParameters(),()=>{},s)])}_updateParameters(){const t=this.view.environment.lighting.glow;this._mode=null==t?this.view.environment.atmosphereEnabled?0:2:1,t&&(this._intensity=t.intensity),this._compositionParameters.minDisperse.presets=this.getPreset(this._mode),this.requestRender(1)}_updateFogParameters(){const t=this.view.environment.weatherAvailable,i=this.view.environment.weather;t&&"sunny"!==i.type&&"cloudy"!==i.type?this._compositionParameters.distanceModifier="foggy"===i.type?e(3e-5,.005,i.fogStrength**3):e(4e-6,2e-4,(i.precipitation??0)**3):this._compositionParameters.distanceModifier=0,this._compositionParameters.maxDisperse=this._scatteringFactors.maximumFog,this.requestRender(1)}precompile(){this._compositionConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.blurEnabled=2!==this._mode,this._compositionConfiguration.blurEnabled&&(this.techniques.precompile(u,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(u,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositionConfiguration)}render(t){const e=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),i=e.getAttachment(w);if(!i?.attachment)return e;const s=e.getTexture(),r=e.getAttachment(C);if(2===this._mode){this._compositionConfiguration.blurEnabled=!1;const t=this.techniques.getCompiled(f,this._compositionConfiguration);if(!t)return this.requestRender(1),e;const o=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,h=this.renderingContext,c=o.acquire(s.descriptor.width,s.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=s,this._compositionParameters.emission=i.attachment,h.bindTechnique(t,this.bindParameters,this._compositionParameters),h.screen.draw(),c.attachDepth(r),c.attachColor(i,w),c}this._compositionConfiguration.blurEnabled=!0;const o=this.techniques.getCompiled(u,this._blurHorizontalConfiguration),n=this.techniques.getCompiled(u,this._blurVerticalConfiguration),h=this.techniques.getCompiled(f,this._compositionConfiguration);if(!o||!n||!h)return this.requestRender(1),e;const l=this.fboCache,{fullWidth:m,fullHeight:p}=this.bindParameters.camera,g=this.renderingContext;let d=Math.ceil(m/2),_=Math.ceil(p/2);const b=5;this._blurParameters.emissionsToDownsample=i.attachment,this._blurParameters.inputScale=P,this._blurParameters.blurRadius=this._logicalBlurRadius;for(let a=0;a<b;a++){const t=l.acquire(d,_,"glow horizontal",8);this._prepareFBO(t,d,_),g.bindTechnique(o,this.bindParameters,this._blurParameters),g.screen.draw();const e=l.acquire(d,_,"glow vertical",8);this._blurParameters.inputScale=1,this._blurParameters.emissionsToDownsample=t.getTexture(),this._prepareFBO(e,d,_),g.bindTechnique(n,this.bindParameters,this._blurParameters),g.screen.draw(),t.release(),this._glowResults[a]=e,d=Math.ceil(d/2),_=Math.ceil(_/2),this._blurParameters.emissionsToDownsample=e.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod}const T=this.bindParameters.camera,R=a(T.eye);this._compositionParameters.atmosphereC=R**2-this._atmosphereRadius**2,this._compositionParameters.color=s,this._compositionParameters.emission=i.attachment,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const q=l.acquire(s.descriptor.width,s.descriptor.height,this.produces);return q.acquireColor(w,this.bindParameters.useFloatBlend?8:5,"emissive glow"),this._prepareFBO(q,m,p,!0),g.bindTechnique(h,this.bindParameters,this._compositionParameters),g.screen.draw(),this._glowResults.forEach(t=>t.release()),q.attachDepth(r),q}getPreset(t){return 0===t?this._scatteringFactors.realistic.presets:this._intensity<=.5?_(this._scatteringFactors.cartographicMin.presets,this._scatteringFactors.cartographicDefault.presets,2*this._intensity):_(this._scatteringFactors.cartographicDefault.presets,this._scatteringFactors.cartographicMax.presets,2*(this._intensity-.5))}_prepareFBO(t,e,i,s=!1){const r=this.renderingContext;r.bindFramebuffer(t.fbo),r.setViewport(0,0,e,i),r.setClearColor(0,0,0,0),r.clear(16384),s&&r.clearBuffer(1,n)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:t=>{this._compositionParameters.dispersionWeight=t},getPresets:this.getPreset(this._mode),setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.presets[t]=e:(this._scatteringFactors.cartographicMin.presets[t]=e,this._scatteringFactors.cartographicMax.presets[t]=e)},toggleTonemapping:t=>{this._compositionConfiguration.tonemappingEnabled=t,this.requestRender(1)}}}};t([r()],T.prototype,"consumes",void 0),t([r()],T.prototype,"produces",void 0),T=t([o("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],T);export{T as GlowRenderNode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{TransparentEnvironment as u}from"../TransparentEnvironment.js";import{H as d}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as c}from"./HazeCompositingTechnique.js";import{HazePassParameters as p,HazeTechnique as f}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as l}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as _}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as b}from"../../lib/textureUtils.js";import{DepthStencilAttachment as g,ColorAttachment0 as w,PrimitiveType as P}from"../../../../webgl/enums.js";let v=class extends u{constructor(e){super(e),this._compositingPassParameters=new d,this._passParameters=new p,this._hazeConfiguration=new l,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount}initialize(){this.addHandles([s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),s(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),s(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),s(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}render(e){const i=e.find(({name:e})=>e===this.produces);if(!this.bindParameters.mainDepth)return i;const r=this.techniques.getCompiled(f,this._hazeConfiguration),s=!!this._hazeConfiguration.reduced&&this.techniques.getCompiled(c);if(null==r||null==s)return i;const o=this.renderingContext,a=i.getAttachment(g);if(this._update(),!s)return i.detachDepth(),o.bindFramebuffer(i.fbo),o.bindTechnique(r,this.bindParameters,this._passParameters),o.setDrawBuffers([w]),this._renderCommon(o),i.attachDepth(a),i;const n=o.getViewport(),u=this.camera,d=h(u.eye)-m.radius;let p;const l=m.atmosphereHeight;if(d<l){const e=Math.min(1,Math.max(0,d/l));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(d-l)/(15*l)));p=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,P=b(Math.round(p*u.fullViewport[2]),_),v=b(Math.round(p*u.fullViewport[3]),_);o.setViewport(0,0,P,v);const C=this.fboCache.acquire(P,v,"haze",5);return o.bindFramebuffer(C.fbo),o.clearFramebuffer([0,0,0,1],!0,!0),o.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(o),o.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=C.getTexture(),i.detachDepth(),o.bindFramebuffer(i.fbo),o.bindTechnique(s,this.bindParameters,this._compositingPassParameters),o.setDrawBuffers([w]),o.screen.draw(),i.attachDepth(a),C.release(),i}_renderCommon(e){this._vao??=_(e,1),e.bindVAO(this._vao),e.drawArrays(P.TRIANGLE_STRIP,0,4)}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+m.atmosphereHeight);const r=h(this.bindParameters.camera.eye);this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,r-m.radius)),1,this._amount)}};v=e([a("esri.views.3d.webgl-engine.effects.haze.Haze")],v);export{v as Haze};
2
+ import{__decorate as e}from"tslib";import{lerp as t,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{TransparentEnvironment as u}from"../TransparentEnvironment.js";import{H as d}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as c}from"./HazeCompositingTechnique.js";import{HazePassParameters as p,HazeTechnique as f}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as l}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as _}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as g}from"../../lib/textureUtils.js";import{DepthStencilAttachment as b,ColorAttachment0 as w,PrimitiveType as C}from"../../../../webgl/enums.js";let P=class extends u{constructor(e){super(e),this._compositingPassParameters=new d,this._passParameters=new p,this._hazeConfiguration=new l,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount}initialize(){this.addHandles([s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),s(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),s(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),s(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}precompile(){this.techniques.precompile(f,this._hazeConfiguration),this._hazeConfiguration.reduced&&this.techniques.precompile(c)}render(e){const i=e.find(({name:e})=>e===this.produces);if(!this.bindParameters.mainDepth)return i;const r=this.techniques.getCompiled(f,this._hazeConfiguration),s=!!this._hazeConfiguration.reduced&&this.techniques.getCompiled(c);if(null==r||null==s)return i;const o=this.renderingContext,a=i.getAttachment(b);if(this._update(),!s)return i.detachDepth(),o.bindFramebuffer(i.fbo),o.bindTechnique(r,this.bindParameters,this._passParameters),o.setDrawBuffers([w]),this._renderCommon(o),i.attachDepth(a),i;const n=o.getViewport(),u=this.camera,d=h(u.eye)-m.radius;let p;const l=m.atmosphereHeight;if(d<l){const e=Math.min(1,Math.max(0,d/l));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(d-l)/(15*l)));p=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,C=g(Math.round(p*u.fullViewport[2]),_),P=g(Math.round(p*u.fullViewport[3]),_);o.setViewport(0,0,C,P);const v=this.fboCache.acquire(C,P,"haze",5);return o.bindFramebuffer(v.fbo),o.clearFramebuffer([0,0,0,1],!0,!0),o.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(o),o.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=v.getTexture(),i.detachDepth(),o.bindFramebuffer(i.fbo),o.bindTechnique(s,this.bindParameters,this._compositingPassParameters),o.setDrawBuffers([w]),o.screen.draw(),i.attachDepth(a),v.release(),i}_renderCommon(e){this._vao??=_(e,1),e.bindVAO(this._vao),e.drawArrays(C.TRIANGLE_STRIP,0,4)}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+m.atmosphereHeight);const r=h(this.bindParameters.camera.eye);this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,r-m.radius)),1,this._amount)}};P=e([a("esri.views.3d.webgl-engine.effects.haze.Haze")],P);export{P as Haze};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{H as u}from"../../../../../chunks/HighlightBlur.glsl.js";import{HighlightBlurTechnique as c}from"./HighlightBlurTechnique.js";import{H as m,g as d}from"../../../../../chunks/HighlightDownsample.glsl.js";import{HighlightDownsampleTechnique as p}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as b}from"./HighlightToSingleTechnique.js";import{NoVertex as w}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as x}from"../../lib/VertexArrayObject.js";import{BufferObject as T}from"../../../../webgl/BufferObject.js";import{ColorAttachment0 as C,PrimitiveType as _,DataType as v}from"../../../../webgl/enums.js";import O from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as H}from"../../../../webgl/VertexBuffer.js";let P=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHT_COLOR,this.consumes={required:[l.HIGHLIGHT_COLOR,"highlights"]},this._downsampleDrawParameters=new m,this._passParameters=new f,this._highlightBlurDrawParameters=new u,this._grid=new q}initialize(){this.addHandles([i(()=>this._updateOptionsTexture(),()=>{},s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new j(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new O(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(D(this.view.state.highlights)),this.requestRender(1)}render(e){const t=e.find(({name:e})=>e===l.HIGHLIGHT_COLOR),{techniques:r,bindParameters:i,fboCache:s,_passParameters:o,renderingContext:h}=this;if(!i.decorations)return t;const a=r.getCompiled(p),u=r.getCompiled(b),m=r.getCompiled(c),d=r.getCompiled(g);if(!(a&&d&&m&&u))return this.requestRender(1),t;const f=e.find(({name:e})=>"highlights"===e).getTexture();o.highlightTexture=f;const w=this._prepareAndDownSample(f),{width:x,height:T}=f.descriptor;o.highlightTexture=f;const{camera:_}=i,{fullWidth:v,fullHeight:O,pixelRatio:j,fullViewport:H}=_,P=Math.ceil(v/j),q=Math.ceil(O/j),{_highlightBlurDrawParameters:D}=this,y=this.view.stage.renderView.renderer,{highlights:I}=i;for(let l=0;l<I.length;++l){const{name:e}=I[l];if(!y.hasHighlight(e))continue;o.highlightLevel=l,h.setClearColor(0,0,0,0);const r=s.acquire(x,T,"single highlight",2);h.bindFramebuffer(r.fbo),h.setViewport(0,0,x,T),h.clear(16384),h.bindTechnique(u,i,o),this._renderGrid(w),D.blurInput=r.getTexture(),n(D.blurSize,1/P,0);const a=s.acquire(P,q,"single highlight blur",2);h.unbindTexture(a.fbo?.colorTexture),h.bindFramebuffer(a.fbo),h.setViewport(0,0,P,q),h.clear(16384),h.bindTechnique(m,i,o,D),this._renderGrid(w),r.release(),n(D.blurSize,0,1/q),o.highlightBlurTexture=a.getTexture(),h.bindFramebuffer(t.fbo),h.setDrawBuffers([C]),h.setViewport4fv(H),h.bindTechnique(d,i,o,D),this._renderGrid(w),a.release()}return o.coverageTexture=o.highlightTexture=null,t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(p),r=this._gridComputeCoverage(t,e),{horizontalCellCount:i,verticalCellCount:s}=r,o=this._passParameters;return o.horizontalCellCount=i,o.verticalCellCount=s,o.coverageTexture=r.coverage?.getTexture(),r}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(_.TRIANGLES,6,v.UNSIGNED_BYTE,0,t)}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/d),t.verticalCellCount=Math.ceil(i/d),t.vao)return;const s=this.renderingContext,o=T.createIndex(s,35044,R);t.vao=new x(s,new H(s,w),o)}_gridComputeCoverage(e,t){const r=this.renderingContext,i=this._grid,s=t.descriptor,o=Math.ceil(s.width/d),h=Math.ceil(s.height/d);this._downsampleDrawParameters.input=t;const{highlights:n}=this.bindParameters;i.coverage?.release();const l=this.fboCache.acquire(o,h,"highlight coverage",n.length>L?3:1);return i.coverage=l,r.bindFramebuffer(l.fbo),r.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,o,h),r.screen.draw(),i}get test(){}};e([o()],P.prototype,"produces",void 0),e([o()],P.prototype,"consumes",void 0),P=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],P);class q{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function D(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let y=0;function I(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return y+++(t>=0?0:1)}const R=new Uint8Array([0,1,2,2,1,3]);function G(e,t,r,i,s,o,h=0){const{highlights:l}=s,a=l.length>1?t.acquire(r,i,"highlight mix",l.length>L?3:1):null,{gl:g}=e;if(a){const t=e.boundFramebuffer;e.bindFramebuffer(a.fbo),g.clearBufferuiv(g.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const u=a?.getTexture();s.highlightMixTexture=u,n(s.highlightMixOrigin,h,0),l.forEach((t,n)=>{if(n>0){const t=O.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(u,t),e.setActiveTexture(t),g.copyTexSubImage2D(3553,0,0,0,h,0,r,i),e.bindTexture(null,t)}e.clear(256),s.highlightLevel=n,o()}),s.highlightLevel=null,s.highlightMixTexture=null,a?.release()}const L=4;export{P as Highlight,L as maxHighlightsPerChannel,G as renderHighlightBuffer,I as trackHighlightOptions};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{H as c}from"../../../../../chunks/HighlightBlur.glsl.js";import{HighlightBlurTechnique as u}from"./HighlightBlurTechnique.js";import{H as m,g as p}from"../../../../../chunks/HighlightDownsample.glsl.js";import{HighlightDownsampleTechnique as d}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as b}from"./HighlightToSingleTechnique.js";import{NoVertex as w}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as x}from"../../lib/VertexArrayObject.js";import{BufferObject as T}from"../../../../webgl/BufferObject.js";import{ColorAttachment0 as C,PrimitiveType as _,DataType as v}from"../../../../webgl/enums.js";import O from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as H}from"../../../../webgl/VertexBuffer.js";let q=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHT_COLOR,this.consumes={required:[l.HIGHLIGHT_COLOR,"highlights"]},this._downsampleDrawParameters=new m,this._passParameters=new f,this._highlightBlurDrawParameters=new c,this._grid=new P}initialize(){this.addHandles([i(()=>this._updateOptionsTexture(),()=>{},s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new j(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new O(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(D(this.view.state.highlights)),this.requestRender(1)}precompile(){this.bindParameters.decorations&&(this.techniques.precompile(d),this.techniques.precompile(b),this.techniques.precompile(u),this.techniques.precompile(g))}render(e){const t=e.find(({name:e})=>e===l.HIGHLIGHT_COLOR),{techniques:r,bindParameters:i,fboCache:s,_passParameters:o,renderingContext:h}=this;if(!i.decorations)return t;const a=r.getCompiled(d),c=r.getCompiled(b),m=r.getCompiled(u),p=r.getCompiled(g);if(!(a&&p&&m&&c))return this.requestRender(1),t;const f=e.find(({name:e})=>"highlights"===e).getTexture();o.highlightTexture=f;const w=this._prepareAndDownSample(f),{width:x,height:T}=f.descriptor;o.highlightTexture=f;const{camera:_}=i,{fullWidth:v,fullHeight:O,pixelRatio:j,fullViewport:H}=_,q=Math.ceil(v/j),P=Math.ceil(O/j),{_highlightBlurDrawParameters:D}=this,y=this.view.stage.renderView.renderer,{highlights:I}=i;for(let l=0;l<I.length;++l){const{name:e}=I[l];if(!y.hasHighlight(e))continue;o.highlightLevel=l,h.setClearColor(0,0,0,0);const r=s.acquire(x,T,"single highlight",2);h.bindFramebuffer(r.fbo),h.setViewport(0,0,x,T),h.clear(16384),h.bindTechnique(c,i,o),this._renderGrid(w),D.blurInput=r.getTexture(),n(D.blurSize,1/q,0);const a=s.acquire(q,P,"single highlight blur",2);h.unbindTexture(a.fbo?.colorTexture),h.bindFramebuffer(a.fbo),h.setViewport(0,0,q,P),h.clear(16384),h.bindTechnique(m,i,o,D),this._renderGrid(w),r.release(),n(D.blurSize,0,1/P),o.highlightBlurTexture=a.getTexture(),h.bindFramebuffer(t.fbo),h.setDrawBuffers([C]),h.setViewport4fv(H),h.bindTechnique(p,i,o,D),this._renderGrid(w),a.release()}return o.coverageTexture=o.highlightTexture=null,t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(d),r=this._gridComputeCoverage(t,e),{horizontalCellCount:i,verticalCellCount:s}=r,o=this._passParameters;return o.horizontalCellCount=i,o.verticalCellCount=s,o.coverageTexture=r.coverage?.getTexture(),r}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(_.TRIANGLES,6,v.UNSIGNED_BYTE,0,t)}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/p),t.verticalCellCount=Math.ceil(i/p),t.vao)return;const s=this.renderingContext,o=T.createIndex(s,35044,R);t.vao=new x(s,new H(s,w),o)}_gridComputeCoverage(e,t){const r=this.renderingContext,i=this._grid,s=t.descriptor,o=Math.ceil(s.width/p),h=Math.ceil(s.height/p);this._downsampleDrawParameters.input=t;const{highlights:n}=this.bindParameters;i.coverage?.release();const l=this.fboCache.acquire(o,h,"highlight coverage",n.length>L?3:1);return i.coverage=l,r.bindFramebuffer(l.fbo),r.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,o,h),r.screen.draw(),i}get test(){}};e([o()],q.prototype,"produces",void 0),e([o()],q.prototype,"consumes",void 0),q=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],q);class P{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function D(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let y=0;function I(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return y+++(t>=0?0:1)}const R=new Uint8Array([0,1,2,2,1,3]);function G(e,t,r,i,s,o,h=0){const{highlights:l}=s,a=l.length>1?t.acquire(r,i,"highlight mix",l.length>L?3:1):null,{gl:g}=e;if(a){const t=e.boundFramebuffer;e.bindFramebuffer(a.fbo),g.clearBufferuiv(g.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const c=a?.getTexture();s.highlightMixTexture=c,n(s.highlightMixOrigin,h,0),l.forEach((t,n)=>{if(n>0){const t=O.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(c,t),e.setActiveTexture(t),g.copyTexSubImage2D(3553,0,0,0,h,0,r,i),e.bindTexture(null,t)}e.clear(256),s.highlightLevel=n,o()}),s.highlightLevel=null,s.highlightMixTexture=null,a?.release()}const L=4;export{q as Highlight,L as maxHighlightsPerChannel,G as renderHighlightBuffer,I as trackHighlightOptions};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{smoothstep as t,clamp as s}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{normalize as h,set as c,dot as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderNodeOutput as p}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as l,ShadowHighlightTechnique as u}from"./ShadowHighlightTechnique.js";import{defaultShadowOpacity as g,defaultShadowDifference as f,defaultShadowColor as w}from"../../../../support/HighlightDefaults.js";import{ColorAttachment0 as _}from"../../../../webgl/enums.js";const O=1/512,y=4e4,P=5e4;let x=class extends m{constructor(e){super(e),this.produces=p.COMPOSITE,this.consumes={required:[p.COMPOSITE,"highlights"]},this._passParameters=new l,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([i(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??g,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),i(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),i(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??w).toUnitRGBA(),this._ensureMaxOpacity()},a)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}render(e){const t=e.find(({name:e})=>e===p.COMPOSITE),s=this.bindParameters;if(!this._ensureIfVisible())return t;const i=this.techniques.getCompiled(u);if(!i)return this.requestRender(1),t;this._passParameters.highlightTexture=e.find(({name:e})=>"highlights"===e)?.getTexture(),this._passParameters.origin=s.camera.center;const a=this.renderingContext,r=t.obtainDepthTexture();return a.bindFramebuffer(t.fbo),a.setDrawBuffers([_]),a.bindTechnique(i,s,this._passParameters),a.screen.draw(),t.attachDepth(r),r?.release(),t}_ensureIfVisible(){const e=this.bindParameters;if(!e.hasShadowHighlights||!e.mainDepth||!e.shadowHighlight?.getTexture())return!1;const{camera:i,lighting:a}=e;this._passParameters.opacityElevation=1-t(y,P,i.relativeElevation);const r=1===this.viewingMode?h(b,i.center):c(b,0,0,1),o=n(r,a.mainLight.direction);return this._passParameters.dayNightTerminator=t(0,1,s(30*o,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=O}};e([r()],x.prototype,"produces",void 0),e([r()],x.prototype,"consumes",void 0),e([r({constructOnly:!0})],x.prototype,"viewingMode",void 0),x=e([o("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],x);const b=d();export{x as ShadowHighlight};
2
+ import{__decorate as e}from"tslib";import{smoothstep as t,clamp as s}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as a,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{normalize as o,set as c,dot as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderNodeOutput as d}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as l,ShadowHighlightTechnique as u}from"./ShadowHighlightTechnique.js";import{defaultShadowOpacity as g,defaultShadowDifference as f,defaultShadowColor as w}from"../../../../support/HighlightDefaults.js";import{ColorAttachment0 as _}from"../../../../webgl/enums.js";const O=1/512,y=4e4,P=5e4;let b=class extends m{constructor(e){super(e),this.produces=d.COMPOSITE,this.consumes={required:[d.COMPOSITE,"highlights"]},this._passParameters=new l,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([i(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??g,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},r),i(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},r),i(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??w).toUnitRGBA(),this._ensureMaxOpacity()},r)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>e===d.COMPOSITE),s=this.bindParameters;if(!this._ensureIfVisible())return t;const i=this.techniques.getCompiled(u);if(!i)return this.requestRender(1),t;this._passParameters.highlightTexture=e.find(({name:e})=>"highlights"===e)?.getTexture(),this._passParameters.origin=s.camera.center;const r=this.renderingContext,a=t.obtainDepthTexture();return r.bindFramebuffer(t.fbo),r.setDrawBuffers([_]),r.bindTechnique(i,s,this._passParameters),r.screen.draw(),t.attachDepth(a),a?.release(),t}_ensureIfVisible(){const e=this.bindParameters;if(!e.hasShadowHighlights||!e.mainDepth||!e.shadowHighlight?.getTexture())return!1;const{camera:i,lighting:r}=e;this._passParameters.opacityElevation=1-t(y,P,i.relativeElevation);const a=1===this.viewingMode?o(x,i.center):c(x,0,0,1),h=n(a,r.mainLight.direction);return this._passParameters.dayNightTerminator=t(0,1,s(30*h,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=O}};e([a()],b.prototype,"produces",void 0),e([a()],b.prototype,"consumes",void 0),e([a({constructOnly:!0})],b.prototype,"viewingMode",void 0),b=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],b);const x=p();export{b as ShadowHighlight};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as r,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{ReadShadowMapOrigin as a}from"../../core/shaderLibrary/shading/calculateUVZShadow.glsl.js";import{ShadowHighlightBufferTechnique as h}from"./ShadowHighlightBufferTechnique.js";let n=class extends o{get requireGeometryDepth(){return this.bindParameters.hasShadowHighlights}constructor(e){super(e),this.produces=i.SHADOW_HIGHLIGHT,this._passParameters=new a}render(){const e=this.bindParameters,r=null!=e.depth,t=null!=e.shadowMap.getOutput(6);if(!e.hasShadowHighlights||!r&&!t)return;const o=this.techniques.getCompiled(h);if(!o)return void this.requestRender(1);const{fullWidth:a,fullHeight:n}=e.camera,c=this.fboCache.acquire(a,n,i.SHADOW_HIGHLIGHT,0);this._passParameters.origin=e.camera.center;const d=this.renderingContext;return d.bindFramebuffer(c.fbo),d.clearFramebuffer(s),d.bindTechnique(o,e,this._passParameters),d.screen.draw(),c}};e([r()],n.prototype,"produces",void 0),n=e([t("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlightBuffer")],n);export{n as ShadowHighlightBuffer};
2
+ import{__decorate as e}from"tslib";import{property as r,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{ReadShadowMapOrigin as a}from"../../core/shaderLibrary/shading/calculateUVZShadow.glsl.js";import{ShadowHighlightBufferTechnique as h}from"./ShadowHighlightBufferTechnique.js";let n=class extends o{get requireGeometryDepth(){return this.bindParameters.hasShadowHighlights}constructor(e){super(e),this.produces=i.SHADOW_HIGHLIGHT,this._passParameters=new a}precompile(){this.bindParameters.hasShadowHighlights&&this.techniques.precompile(h)}render(){const e=this.bindParameters,r=null!=e.depth,t=null!=e.shadowMap.getOutput(6);if(!e.hasShadowHighlights||!r&&!t)return;const o=this.techniques.getCompiled(h);if(!o)return void this.requestRender(1);const{fullWidth:a,fullHeight:n}=e.camera,c=this.fboCache.acquire(a,n,i.SHADOW_HIGHLIGHT,0);this._passParameters.origin=e.camera.center;const d=this.renderingContext;return d.bindFramebuffer(c.fbo),d.clearFramebuffer(s),d.bindTechnique(o,e,this._passParameters),d.screen.draw(),c}};e([r()],n.prototype,"produces",void 0),n=e([t("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlightBuffer")],n);export{n as ShadowHighlightBuffer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{createTask as s}from"../../../../../core/asyncUtils.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as t,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{createScreenPointArray as o,createRenderScreenPointArray as m,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{isSVG as h}from"../../../../../core/urlUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{requestImage as p}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import _ from"../../../webgl/RenderNode.js";import{M as g}from"../../../../../chunks/Magnifier.glsl.js";import{MagnifierTechnique as d}from"./MagnifierTechnique.js";import{createQuadVAO as f}from"../../lib/glUtil3D.js";import{loadMagnifierResources as v}from"../../../../magnifier/resources.js";import{ColorAttachment0 as T,PrimitiveType as k}from"../../../../webgl/enums.js";import P from"../../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../../webgl/TextureDescriptor.js";let x=class extends _{constructor(){super(...arguments),this.produces=c.MAGNIFIER,this.consumes={required:[c.MAGNIFIER]},this._imageSources=null,this._imageLoadTask=null,this._passParameters=new g,this._magnifier=null,this._tmpScreenPoint=o(),this._tmpRenderPoint=m()}initialize(){this.addHandles([t(()=>this.view.magnifier,e=>this._update(e),a)])}_update(e){if(e===this._magnifier)return;this.removeAllHandles(),this._magnifier=e;const s=()=>{const e=this._validMagnifier;e?(this._loadResources(e),this.produces=c.MAGNIFIER):this.produces="disabled",this.requestRender()};this._magnifier&&this.addHandles(t(()=>this._magnifier?.version,s)),s()}get _validMagnifier(){return this._magnifier?.visible&&this._magnifier?.position&&this._magnifier?.size>0?this._magnifier:null}get _factor(){return this._magnifier?.factor||1}destroy(){this._magnifier=null,null!=this._imageLoadTask&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeTextures(),this._vao=r(this._vao)}_disposeTextures(){this._passParameters.mask=r(this._passParameters.mask),this._passParameters.overlay=r(this._passParameters.overlay),this._passParameters.input=r(this._passParameters.input)}render(e){const s=this._validMagnifier,r=e.find(({name:e})=>e===c.MAGNIFIER);if(null==s)return r;if(null==this._imageSources)return this.requestRender(1),r;const t=this.renderingContext,a=this.camera.pixelRatio,o=Math.ceil(a*s.size);this._vao??=f(t,0,0,1);const m=this.techniques.getCompiled(d);if(this._ensureTextureResources(t,o),!m||!this._passParameters.input)return this.requestRender(1),r;const h=Math.ceil(1/this._factor*o),l=this._passParameters.input;l.resize(h,h),n(s.position,this._tmpScreenPoint);const u=this.camera.screenToRender(this._tmpScreenPoint,this._tmpRenderPoint),p=this.camera.fullWidth,_=this.camera.fullHeight,g=.5*h,v=.5*h;u[0]=i(u[0],g,p-g-1),u[1]=i(u[1],v,_-v-1);const P=Math.floor(u[0]-g),y=Math.floor(u[1]-v);t.bindFramebuffer(r.fbo);return m.program.bindTexture("textureInput",l),t.gl.copyTexImage2D(l.descriptor.target,0,l.descriptor.pixelFormat,P,y,h,h,0),this._passParameters.magnifier=s,t.bindTechnique(m,this.bindParameters,this._passParameters),t.setDrawBuffers([T]),t.bindVAO(this._vao),t.drawArrays(k.TRIANGLE_STRIP,0,4),r}_loadResources(e){const{maskUrl:i,overlayUrl:r}=e;this._imageLoadTask?.maskUrl===i&&this._imageLoadTask?.overlayUrl===r||(this._imageLoadTask?.task.abort(),this._imageLoadTask=this._imageSources=null),this._imageSources||this._imageLoadTask||(this._imageLoadTask={maskUrl:i,overlayUrl:r,task:s(async e=>{const s=null==i||null==r?v(e):null,t=null!=i?p(i,{signal:e}):s.then(e=>e.mask),a=null!=r?p(r,{signal:e}):s.then(e=>e.overlay);this._imageSources={mask:await t,overlay:await a}})})}_ensureTextureResources(e,s){null==this._imageSources||this._passParameters.size===s&&this._passParameters.input&&this._passParameters.mask&&this._passParameters.overlay||(this._disposeTextures(),this._imageSources.overlay.width=this._imageSources.mask.width=s,this._imageSources.overlay.height=this._imageSources.mask.height=s,this._passParameters.overlay=new P(e,this._createTextureDescriptor(s,6408,this._imageSources.overlay),this._imageSources.overlay),this._passParameters.mask=new P(e,this._createTextureDescriptor(s,6406,this._imageSources.mask),this._imageSources.mask),this._passParameters.input=new P(e,this._createTextureDescriptor(s,6408,null)))}_createTextureDescriptor(e,s,i){const r=this.renderingContext,t=new y(e);return t.pixelFormat=t.internalFormat=s,t.wrapMode=33071,t.flipped=!!i,t.preMultiplyAlpha=!(6408!==s||!i||h(i.src)&&r.driverTest.svgPremultipliesAlpha.result),t}};e([l()],x.prototype,"produces",void 0),e([l()],x.prototype,"consumes",void 0),e([l()],x.prototype,"_imageSources",void 0),e([l()],x.prototype,"_imageLoadTask",void 0),x=e([u("esri.views.3d.webgl-engine.effects.magnifier.Magnifier")],x);export{x as Magnifier};
2
+ import{__decorate as e}from"tslib";import{createTask as s}from"../../../../../core/asyncUtils.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as t,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{createScreenPointArray as o,createRenderScreenPointArray as m,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{isSVG as h}from"../../../../../core/urlUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{requestImage as p}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import _ from"../../../webgl/RenderNode.js";import{M as g}from"../../../../../chunks/Magnifier.glsl.js";import{MagnifierTechnique as d}from"./MagnifierTechnique.js";import{createQuadVAO as f}from"../../lib/glUtil3D.js";import{loadMagnifierResources as v}from"../../../../magnifier/resources.js";import{ColorAttachment0 as T,PrimitiveType as k}from"../../../../webgl/enums.js";import P from"../../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../../webgl/TextureDescriptor.js";let x=class extends _{constructor(){super(...arguments),this.produces=c.MAGNIFIER,this.consumes={required:[c.MAGNIFIER]},this._imageSources=null,this._imageLoadTask=null,this._passParameters=new g,this._magnifier=null,this._tmpScreenPoint=o(),this._tmpRenderPoint=m()}initialize(){this.addHandles([t(()=>this.view.magnifier,e=>this._update(e),a)])}_update(e){if(e===this._magnifier)return;this.removeAllHandles(),this._magnifier=e;const s=()=>{const e=this._validMagnifier;e?(this._loadResources(e),this.produces=c.MAGNIFIER):this.produces="disabled",this.requestRender()};this._magnifier&&this.addHandles(t(()=>this._magnifier?.version,s)),s()}get _validMagnifier(){return this._magnifier?.visible&&this._magnifier?.position&&this._magnifier?.size>0?this._magnifier:null}get _factor(){return this._magnifier?.factor||1}destroy(){this._magnifier=null,null!=this._imageLoadTask&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeTextures(),this._vao=r(this._vao)}_disposeTextures(){this._passParameters.mask=r(this._passParameters.mask),this._passParameters.overlay=r(this._passParameters.overlay),this._passParameters.input=r(this._passParameters.input)}precompile(){this._imageSources&&this.techniques.precompile(d)}render(e){const s=this._validMagnifier,r=e.find(({name:e})=>e===c.MAGNIFIER);if(null==s)return r;if(null==this._imageSources)return this.requestRender(1),r;const t=this.renderingContext,a=this.camera.pixelRatio,o=Math.ceil(a*s.size);this._vao??=f(t,0,0,1);const m=this.techniques.getCompiled(d);if(this._ensureTextureResources(t,o),!m||!this._passParameters.input)return this.requestRender(1),r;const h=Math.ceil(1/this._factor*o),l=this._passParameters.input;l.resize(h,h),n(s.position,this._tmpScreenPoint);const u=this.camera.screenToRender(this._tmpScreenPoint,this._tmpRenderPoint),p=this.camera.fullWidth,_=this.camera.fullHeight,g=.5*h,v=.5*h;u[0]=i(u[0],g,p-g-1),u[1]=i(u[1],v,_-v-1);const P=Math.floor(u[0]-g),y=Math.floor(u[1]-v);t.bindFramebuffer(r.fbo);return m.program.bindTexture("textureInput",l),t.gl.copyTexImage2D(l.descriptor.target,0,l.descriptor.pixelFormat,P,y,h,h,0),this._passParameters.magnifier=s,t.bindTechnique(m,this.bindParameters,this._passParameters),t.setDrawBuffers([T]),t.bindVAO(this._vao),t.drawArrays(k.TRIANGLE_STRIP,0,4),r}_loadResources(e){const{maskUrl:i,overlayUrl:r}=e;this._imageLoadTask?.maskUrl===i&&this._imageLoadTask?.overlayUrl===r||(this._imageLoadTask?.task.abort(),this._imageLoadTask=this._imageSources=null),this._imageSources||this._imageLoadTask||(this._imageLoadTask={maskUrl:i,overlayUrl:r,task:s(async e=>{const s=null==i||null==r?v(e):null,t=null!=i?p(i,{signal:e}):s.then(e=>e.mask),a=null!=r?p(r,{signal:e}):s.then(e=>e.overlay);this._imageSources={mask:await t,overlay:await a}})})}_ensureTextureResources(e,s){null==this._imageSources||this._passParameters.size===s&&this._passParameters.input&&this._passParameters.mask&&this._passParameters.overlay||(this._disposeTextures(),this._imageSources.overlay.width=this._imageSources.mask.width=s,this._imageSources.overlay.height=this._imageSources.mask.height=s,this._passParameters.overlay=new P(e,this._createTextureDescriptor(s,6408,this._imageSources.overlay),this._imageSources.overlay),this._passParameters.mask=new P(e,this._createTextureDescriptor(s,6406,this._imageSources.mask),this._imageSources.mask),this._passParameters.input=new P(e,this._createTextureDescriptor(s,6408,null)))}_createTextureDescriptor(e,s,i){const r=this.renderingContext,t=new y(e);return t.pixelFormat=t.internalFormat=s,t.wrapMode=33071,t.flipped=!!i,t.preMultiplyAlpha=!(6408!==s||!i||h(i.src)&&r.driverTest.svgPremultipliesAlpha.result),t}};e([l()],x.prototype,"produces",void 0),e([l()],x.prototype,"consumes",void 0),e([l()],x.prototype,"_imageSources",void 0),e([l()],x.prototype,"_imageLoadTask",void 0),x=e([u("esri.views.3d.webgl-engine.effects.magnifier.Magnifier")],x);export{x as Magnifier};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r,sync as n}from"../../../../../core/reactiveUtils.js";import{secondsFromMilliseconds as o}from"../../../../../core/time.js";import{property as a,subclass as d}from"../../../../../core/accessorSupport/decorators.js";import{getReferenceEllipsoid as c}from"../../../../../geometry/ellipsoidUtils.js";import{getContinuousIndexArray as m}from"../../../../../geometry/support/Indices.js";import{InternalRenderCategory as p}from"../../../webgl.js";import{glLayout as h}from"../../../support/buffer/glUtil.js";import{newLayout as f}from"../../../support/buffer/InterleavedLayout.js";import{TransparentEnvironment as u}from"../TransparentEnvironment.js";import{PrecipitationPassParameters as l,PrecipitationTechnique as _}from"./PrecipitationTechnique.js";import{PrecipitationTechniqueConfiguration as b}from"./PrecipitationTechniqueConfiguration.js";import{VertexArrayObject as y}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as w,PrimitiveType as v}from"../../../../webgl/enums.js";import{bindVertexBufferLayout as j}from"../../../../webgl/Util.js";import{fromLayout as P}from"../../../../webgl/VertexAttributeLocations.js";import{VertexBuffer as g}from"../../../../webgl/VertexBuffer.js";let I=class extends u{constructor(e){super(e),this._hasSnowCover=!1,this._rainSpeed=.1,this._snowSpeed=.01,this._numParticles=0,this._passParameters=new l,this._configuration=new b,this._forcedTime=null;const{view:t,type:s}=e;this._configuration.type="rainy"===s?0:1,this._passParameters.time=0,this._passParameters.radius=c(t.spatialReference).radius,this.addHandles([i(()=>t.environment.weather,e=>{e.type===s&&this.addHandles([i(()=>e.precipitation,e=>this._adjustParticles(e),r),i(()=>"snowy"===e.type&&"enabled"===e.snowCover,e=>this._hasSnowCover=e,r)])},r)]),this.addHandles(i(()=>t.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>{this._passParameters.opacity=e,1===e&&(this.removeHandles("opacity"),this.addHandles(i(()=>t.stage?.renderer.renderContext.bind.clouds.opacity??1,e=>this._passParameters.opacity=e,r),"opacity"))},n),"opacity")}initialize(){this.addHandles([i(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),r)])}_adjustParticles(e){const s=.35,i=e<.5?t(0,s,2*e):t(s,1,2*(e-.5));this._numParticles=C*i}destroy(){this._numParticles=0,this._vao=s(this._vao),this._instanceIdBuffer=s(this._instanceIdBuffer)}fadeOut(e){this.removeAllHandles(),this.addHandles(i(()=>this.renderContext?.bind.clouds.fadeFactor??1,t=>{this._passParameters.opacity=1-t,1===t&&(this.removeAllHandles(),e())}),"opacity")}get snowCover(){return this._hasSnowCover?this._passParameters.opacity:null}updateAnimation(e){const t=("rainy"===this.type?this._rainSpeed:this._snowSpeed)*o(this._forcedTime??e.time)%1e5;return this._passParameters.time!==t&&(this._passParameters.time=t,!0)}render(e){const t=e.find(({name:e})=>e===p.TRANSPARENT_ENVIRONMENT),s=this.techniques.getCompiled(_,this._configuration);if(!s)return this.requestRender(1),t;const i=Math.round(this._numParticles*this._passParameters.opacity);if(i<1)return t;const r=this.renderingContext,n=r.bindTechnique(s,this.bindParameters,this._passParameters);return r.setDrawBuffers([w]),this._vao??=A(r),r.bindVAO(this._vao),this._bindInstanceIdBuffer(n.locations),n.assertCompatibleVertexAttributeLocations(this._vao,P(x)),r.drawArraysInstanced(v.TRIANGLES,0,3,i),r.unbindBuffer(34962),t}_bindInstanceIdBuffer(e){const t=this.renderingContext;if(this._instanceIdBuffer)return void t.bindBuffer(this._instanceIdBuffer);const s=m(C);this._instanceIdBuffer=new g(t,x,new Float32Array(s)),j(t,e,this._instanceIdBuffer,0)}get test(){}};function A(e){const t=new Float32Array([-1,0,1,1,0,-1,1,0,1]);return new y(e,new g(e,h(B),t))}e([a({constructOnly:!0})],I.prototype,"type",void 0),I=e([d("esri.views.3d.webgl-engine.effects.precipitation.Precipitation")],I);const C=25e4,B=f().vec3f("position").freeze(),x=h(f().f32("instanceFeatureAttribute"),1);export{I as Precipitation};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r,sync as n}from"../../../../../core/reactiveUtils.js";import{secondsFromMilliseconds as o}from"../../../../../core/time.js";import{property as a,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{getReferenceEllipsoid as d}from"../../../../../geometry/ellipsoidUtils.js";import{getContinuousIndexArray as p}from"../../../../../geometry/support/Indices.js";import{InternalRenderCategory as m}from"../../../webgl.js";import{glLayout as h}from"../../../support/buffer/glUtil.js";import{newLayout as f}from"../../../support/buffer/InterleavedLayout.js";import{TransparentEnvironment as u}from"../TransparentEnvironment.js";import{PrecipitationPassParameters as l,PrecipitationTechnique as _}from"./PrecipitationTechnique.js";import{PrecipitationTechniqueConfiguration as b}from"./PrecipitationTechniqueConfiguration.js";import{VertexArrayObject as y}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as w,PrimitiveType as v}from"../../../../webgl/enums.js";import{bindVertexBufferLayout as g}from"../../../../webgl/Util.js";import{fromLayout as j}from"../../../../webgl/VertexAttributeLocations.js";import{VertexBuffer as P}from"../../../../webgl/VertexBuffer.js";let I=class extends u{constructor(e){super(e),this._hasSnowCover=!1,this._rainSpeed=.1,this._snowSpeed=.01,this._numParticles=0,this._passParameters=new l,this._configuration=new b,this._forcedTime=null;const{view:t,type:s}=e;this._configuration.type="rainy"===s?0:1,this._passParameters.time=0,this._passParameters.radius=d(t.spatialReference).radius,this.addHandles([i(()=>t.environment.weather,e=>{e.type===s&&this.addHandles([i(()=>e.precipitation,e=>this._adjustParticles(e),r),i(()=>"snowy"===e.type&&"enabled"===e.snowCover,e=>this._hasSnowCover=e,r)])},r)]),this.addHandles(i(()=>t.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>{this._passParameters.opacity=e,1===e&&(this.removeHandles("opacity"),this.addHandles(i(()=>t.stage?.renderer.renderContext.bind.clouds.opacity??1,e=>this._passParameters.opacity=e,r),"opacity"))},n),"opacity")}initialize(){this.addHandles([i(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),r)])}_adjustParticles(e){const s=.35,i=e<.5?t(0,s,2*e):t(s,1,2*(e-.5));this._numParticles=C*i}destroy(){this._numParticles=0,this._vao=s(this._vao),this._instanceIdBuffer=s(this._instanceIdBuffer)}fadeOut(e){this.removeAllHandles(),this.addHandles(i(()=>this.renderContext?.bind.clouds.fadeFactor??1,t=>{this._passParameters.opacity=1-t,1===t&&(this.removeAllHandles(),e())}),"opacity")}get snowCover(){return this._hasSnowCover?this._passParameters.opacity:null}updateAnimation(e){const t=("rainy"===this.type?this._rainSpeed:this._snowSpeed)*o(this._forcedTime??e.time)%1e5;return this._passParameters.time!==t&&(this._passParameters.time=t,!0)}precompile(){this.view.stage.renderView.techniques.precompile(_,this._configuration)}render(e){const t=e.find(({name:e})=>e===m.TRANSPARENT_ENVIRONMENT),s=this.techniques.getCompiled(_,this._configuration);if(!s)return this.requestRender(1),t;const i=Math.round(this._numParticles*this._passParameters.opacity);if(i<1)return t;const r=this.renderingContext,n=r.bindTechnique(s,this.bindParameters,this._passParameters);return r.setDrawBuffers([w]),this._vao??=A(r),r.bindVAO(this._vao),this._bindInstanceIdBuffer(n.locations),n.assertCompatibleVertexAttributeLocations(this._vao,j(x)),r.drawArraysInstanced(v.TRIANGLES,0,3,i),r.unbindBuffer(34962),t}_bindInstanceIdBuffer(e){const t=this.renderingContext;if(this._instanceIdBuffer)return void t.bindBuffer(this._instanceIdBuffer);const s=p(C);this._instanceIdBuffer=new P(t,x,new Float32Array(s)),g(t,e,this._instanceIdBuffer,0)}get test(){}};function A(e){const t=new Float32Array([-1,0,1,1,0,-1,1,0,1]);return new y(e,new P(e,h(B),t))}e([a({constructOnly:!0})],I.prototype,"type",void 0),I=e([c("esri.views.3d.webgl-engine.effects.precipitation.Precipitation")],I);const C=25e4,B=f().vec3f("position").freeze(),x=h(f().f32("instanceFeatureAttribute"),1);export{I as Precipitation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../../../../core/Logger.js";import{abortMaybe as t,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as i,isAbortError as a}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as h,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{requestImage as u}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{SMAABlendWeightsTechnique as d}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as p}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as b}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as f}from"./SMAAPassParameters.js";import T from"../../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../../webgl/TextureDescriptor.js";let _=class extends m{constructor(e){super(e),this.produces="disabled",this.consumes={required:[c.ANTIALIASING]},this._areaTexture=null,this._searchTexture=null,this._smaaParameters=new f}initialize(){this.addHandles([o(()=>this.isEnabled(),e=>e?this.view.addUpdatingPromise(this.enable()):this.disable(),n)])}async enable(){if(this.destroyed)return;if(this.produces=c.ANTIALIASING,this.requestRender(1),this._abortController||this._areaTexture&&this._searchTexture)return;this._abortController=new AbortController;const e=this._abortController.signal;try{const r=await import("./SMAAData.js");i(e),await this._loadTextures(r,e),i(e),this.requestRender(1)}catch(t){a(t)||r.getLogger(this).errorOnce(t)}this._abortController=null}async _loadTextures(e,r){i(r);const[t,s]=await Promise.allSettled([u(e.areaTexture,{signal:r}),u(e.searchTexure,{signal:r})]);if(i(r),"fulfilled"!==t.status||"fulfilled"!==s.status)return;const a=this.renderingContext;this._areaTexture=g(a,9729,6407,t.value),this._searchTexture=g(a,9728,6409,s.value)}disable(){this.produces="disabled",this.requestRender(1)}destroy(){this._abortController=t(this._abortController),this._searchTexture=s(this._searchTexture),this._areaTexture=s(this._areaTexture)}render(e){const r=e.find(({name:e})=>e===c.ANTIALIASING),t=this.techniques.getCompiled(b),s=this.techniques.getCompiled(d),i=this.techniques.getCompiled(p);if(!(this._areaTexture&&this._searchTexture&&t&&s&&i))return this.requestRender(1),r;const{width:a,height:o}=r.fbo,n=this.renderingContext;n.setViewport(0,0,a,o);const h=this.fboCache.acquire(a,o,"smaa edges",2);n.bindFramebuffer(h.fbo),n.setClearColor(0,0,0,1),n.clear(16384),this._smaaParameters.color=r.getTexture();const l=this.bindParameters;n.bindTechnique(t,l,this._smaaParameters),n.screen.draw();const u=this.fboCache.acquire(a,o,"smaa blend");n.bindFramebuffer(u.fbo),n.setClearColor(0,0,1,1),n.clear(16384),this._smaaParameters.inputTexture=h.getTexture(),this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,n.bindTechnique(s,l,this._smaaParameters),n.screen.draw(),h.release();const m=this.fboCache.acquire(a,o,c.ANTIALIASING);return n.bindFramebuffer(m.fbo),n.setClearColor(0,1,0,1),n.clear(16384),this._smaaParameters.inputTexture=u.getTexture(),n.bindTechnique(i,l,this._smaaParameters),n.screen.draw(),u.release(),m}};function g(e,r,t,s){const i=new x(s.width,s.height);return i.pixelFormat=t,i.wrapMode=33071,i.samplingMode=r,new T(e,i,s)}e([h()],_.prototype,"produces",void 0),e([h()],_.prototype,"consumes",void 0),e([h({constructOnly:!0})],_.prototype,"isEnabled",void 0),e([h()],_.prototype,"_abortController",void 0),_=e([l("esri.views.3d.webgl-engine.effects.smaa.SMAA")],_);export{_ as SMAA};
2
+ import{__decorate as e}from"tslib";import r from"../../../../../core/Logger.js";import{abortMaybe as t,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as i,isAbortError as a}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as h,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{requestImage as u}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{SMAABlendWeightsTechnique as d}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as p}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as b}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as f}from"./SMAAPassParameters.js";import T from"../../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../../webgl/TextureDescriptor.js";let _=class extends m{constructor(e){super(e),this.produces="disabled",this.consumes={required:[c.ANTIALIASING]},this._areaTexture=null,this._searchTexture=null,this._smaaParameters=new f}initialize(){this.addHandles([o(()=>this.isEnabled(),e=>e?this.view.addUpdatingPromise(this.enable()):this.disable(),n)])}async enable(){if(this.destroyed)return;if(this.produces=c.ANTIALIASING,this.requestRender(1),this._abortController||this._areaTexture&&this._searchTexture)return;this._abortController=new AbortController;const e=this._abortController.signal;try{const r=await import("./SMAAData.js");i(e),await this._loadTextures(r,e),i(e),this.requestRender(1)}catch(t){a(t)||r.getLogger(this).errorOnce(t)}this._abortController=null}async _loadTextures(e,r){i(r);const[t,s]=await Promise.allSettled([u(e.areaTexture,{signal:r}),u(e.searchTexure,{signal:r})]);if(i(r),"fulfilled"!==t.status||"fulfilled"!==s.status)return;const a=this.renderingContext;this._areaTexture=g(a,9729,6407,t.value),this._searchTexture=g(a,9728,6409,s.value)}disable(){this.produces="disabled",this.requestRender(1)}destroy(){this._abortController=t(this._abortController),this._searchTexture=s(this._searchTexture),this._areaTexture=s(this._areaTexture)}precompile(){this.techniques.precompile(b),this.techniques.precompile(d),this.techniques.precompile(p)}render(e){const r=e.find(({name:e})=>e===c.ANTIALIASING),t=this.techniques.getCompiled(b),s=this.techniques.getCompiled(d),i=this.techniques.getCompiled(p);if(!(this._areaTexture&&this._searchTexture&&t&&s&&i))return this.requestRender(1),r;const{width:a,height:o}=r.fbo,n=this.renderingContext;n.setViewport(0,0,a,o);const h=this.fboCache.acquire(a,o,"smaa edges",2);n.bindFramebuffer(h.fbo),n.setClearColor(0,0,0,1),n.clear(16384),this._smaaParameters.color=r.getTexture();const l=this.bindParameters;n.bindTechnique(t,l,this._smaaParameters),n.screen.draw();const u=this.fboCache.acquire(a,o,"smaa blend");n.bindFramebuffer(u.fbo),n.setClearColor(0,0,1,1),n.clear(16384),this._smaaParameters.inputTexture=h.getTexture(),this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,n.bindTechnique(s,l,this._smaaParameters),n.screen.draw(),h.release();const m=this.fboCache.acquire(a,o,c.ANTIALIASING);return n.bindFramebuffer(m.fbo),n.setClearColor(0,1,0,1),n.clear(16384),this._smaaParameters.inputTexture=u.getTexture(),n.bindTechnique(i,l,this._smaaParameters),n.screen.draw(),u.release(),m}};function g(e,r,t,s){const i=new x(s.width,s.height);return i.pixelFormat=t,i.wrapMode=33071,i.samplingMode=r,new T(e,i,s)}e([h()],_.prototype,"produces",void 0),e([h()],_.prototype,"consumes",void 0),e([h({constructOnly:!0})],_.prototype,"isEnabled",void 0),e([h()],_.prototype,"_abortController",void 0),_=e([l("esri.views.3d.webgl-engine.effects.smaa.SMAA")],_);export{_ as SMAA};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as a,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as m}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{distanceFadeEnd as h,distanceFadeStart as c}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{g as u}from"../../../../../chunks/SSAO.glsl.js";import{SSAOBlurTechnique as l}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{DepthStencilAttachment as T}from"../../../../webgl/enums.js";import _ from"../../../../webgl/Texture.js";import{TextureDescriptor as P}from"../../../../webgl/TextureDescriptor.js";const g=2;let S=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=m.AMBIENT_ILLUMINATION,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),e=>e.charCodeAt(0)),r=new P(32);r.wrapMode=33071,r.pixelFormat=6407,r.wrapMode=10497,r.hasMipmap=!0,this._passParameters.noiseTexture=new _(this.renderingContext,r,e),this.addHandles(s(()=>this.view.stage.renderer.hasAmbientIllumination,()=>this._enableTime=i(0)))}destroy(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),a=t?.getTexture(T);if(!s||!a)return;const o=this.techniques.getCompiled(w),p=this.techniques.getCompiled(l);if(!o||!p)return this._enableTime=i(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=i(performance.now()));const d=this.renderingContext,f=this.view.qualitySettings.fadeDuration,b=this.bindParameters,_=b.camera,P=_.relativeElevation,S=r((h-P)/(h-c),0,1),j=f>0?Math.min(f,performance.now()-this._enableTime)/f:1,q=j*S;this._passParameters.normalTexture=s,this._passParameters.depthTexture=a,this._passParameters.projScale=1/_.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*x/u(_)**6*q;const A=_.fullViewport[2],v=_.fullViewport[3],C=this.fboCache.acquire(A,v,"ssao input",2);d.bindFramebuffer(C.fbo),d.setViewport(0,0,A,v),d.bindTechnique(o,b,this._passParameters,this._drawParameters),d.screen.draw();const M=Math.round(A/g),I=Math.round(v/g),y=this.fboCache.acquire(M,I,"ssao blur",0);d.bindFramebuffer(y.fbo),this._drawParameters.colorTexture=C.getTexture(),n(this._drawParameters.blurSize,0,g/v),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,M,I),d.screen.draw(),C.release();const N=this.fboCache.acquire(M,I,m.AMBIENT_ILLUMINATION,0);return d.bindFramebuffer(N.fbo),d.setViewport(0,0,A,v),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.colorTexture=y.getTexture(),n(this._drawParameters.blurSize,g/A,0),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,M,I),d.screen.draw(),d.setViewport4fv(_.fullViewport),y.release(),j<1&&this.requestRender(2),N}};e([a()],S.prototype,"consumes",void 0),e([a()],S.prototype,"produces",void 0),S=e([o("esri.views.3d.webgl-engine.effects.ssao.SSAO")],S);const x=.5;export{S as SSAO,g as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as a,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as n}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{distanceFadeEnd as h,distanceFadeStart as c}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{g as u}from"../../../../../chunks/SSAO.glsl.js";import{SSAOBlurTechnique as l}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{DepthStencilAttachment as T}from"../../../../webgl/enums.js";import _ from"../../../../webgl/Texture.js";import{TextureDescriptor as P}from"../../../../webgl/TextureDescriptor.js";const g=2;let S=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=n.AMBIENT_ILLUMINATION,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),e=>e.charCodeAt(0)),r=new P(32);r.wrapMode=33071,r.pixelFormat=6407,r.wrapMode=10497,r.hasMipmap=!0,this._passParameters.noiseTexture=new _(this.renderingContext,r,e),this.addHandles(s(()=>this.view.stage.renderer.hasAmbientIllumination,()=>this._enableTime=i(0)))}destroy(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture)}precompile(){this.techniques.precompile(w),this.techniques.precompile(l)}render(e){const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),a=t?.getTexture(T);if(!s||!a)return;const o=this.techniques.getCompiled(w),p=this.techniques.getCompiled(l);if(!o||!p)return this._enableTime=i(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=i(performance.now()));const d=this.renderingContext,f=this.view.qualitySettings.fadeDuration,b=this.bindParameters,_=b.camera,P=_.relativeElevation,S=r((h-P)/(h-c),0,1),j=f>0?Math.min(f,performance.now()-this._enableTime)/f:1,q=j*S;this._passParameters.normalTexture=s,this._passParameters.depthTexture=a,this._passParameters.projScale=1/_.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*x/u(_)**6*q;const A=_.fullViewport[2],v=_.fullViewport[3],C=this.fboCache.acquire(A,v,"ssao input",2);d.bindFramebuffer(C.fbo),d.setViewport(0,0,A,v),d.bindTechnique(o,b,this._passParameters,this._drawParameters),d.screen.draw();const M=Math.round(A/g),I=Math.round(v/g),y=this.fboCache.acquire(M,I,"ssao blur",0);d.bindFramebuffer(y.fbo),this._drawParameters.colorTexture=C.getTexture(),m(this._drawParameters.blurSize,0,g/v),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,M,I),d.screen.draw(),C.release();const N=this.fboCache.acquire(M,I,n.AMBIENT_ILLUMINATION,0);return d.bindFramebuffer(N.fbo),d.setViewport(0,0,A,v),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.colorTexture=y.getTexture(),m(this._drawParameters.blurSize,g/A,0),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,M,I),d.screen.draw(),d.setViewport4fv(_.fullViewport),y.release(),j<1&&this.requestRender(2),N}};e([a()],S.prototype,"consumes",void 0),e([a()],S.prototype,"produces",void 0),S=e([o("esri.views.3d.webgl-engine.effects.ssao.SSAO")],S);const x=.5;export{S as SSAO,g as blurSizePixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{fetchAsset as e}from"../../../../../assets.js";import{createTask as s}from"../../../../../core/asyncUtils.js";import r from"../../../../../core/Error.js";import a from"../../../../../core/Logger.js";import{abortMaybe as i,disposeMaybe as n}from"../../../../../core/maybe.js";import{isAbortError as o}from"../../../../../core/promiseUtils.js";import{watch as f,initial as c,syncAndInitial as m}from"../../../../../core/reactiveUtils.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{copy as u,rotateZ as d,multiply as l}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{fromValues as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as g}from"../OpaqueEnvironment.js";import{StarPassParameters as w,StarsTechnique as v,layout as j}from"./StarsTechnique.js";import{VertexArrayObject as P}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as D,PrimitiveType as y}from"../../../../webgl/enums.js";import{VertexBuffer as T}from"../../../../webgl/VertexBuffer.js";let M=class extends g{constructor(){super(...arguments),this._numPoints=0,this._passParameters=new w}initialize(){this.addHandles([f(()=>this.view.environment.starsEnabled,t=>t?this._enable():this._disable(),c),f(()=>"virtual"===this.view.environment.lighting.type?null:this.view.environment.lighting.date,t=>this._update(t),m)])}_enable(){super._enable(),this._loadDataTask=this._createLoadDataTask()}get loading(){return!!this._loadDataTask&&!this._loadDataTask.finished}destroy(){this._loadDataTask=i(this._loadDataTask),this._numPoints=0,this._vao=n(this._vao),this._starData=null}render(t){const e=t.find(({name:t})=>t===b.OPAQUE_ENVIRONMENT),s=this.techniques.getCompiled(v);if(this.loading||!s)return this.requestRender(1),e;if(!this._starData)return e;this._vao??=this._ensureResources(this._starData);const r=this.renderingContext;return r.bindTechnique(s,this.bindParameters,this._passParameters),r.setDrawBuffers([D]),r.bindVAO(this._vao),r.drawArrays(y.POINTS,0,this._numPoints),e}_ensureResources(t){this._numPoints=t.byteLength/R;const e=new Float32Array(t,0,2*this._numPoints),s=new Uint8Array(t,2*this._numPoints*4,this._numPoints);return x(this.renderingContext,e,s,this._numPoints)}_update(t){if(!t)return;const e=(t.getHours()/12+t.getMinutes()/60*(2/24)+t.getSeconds()/60*(2/1440)-.9972222)%2,s=2*k(t),r=u(this._passParameters.modelMatrix,O);d(r,r,-s*Math.PI),l(r,L,r),d(r,r,-e*Math.PI),this.requestRender(1)}_createLoadDataTask(){if(this._starData)return null;const t=s(async t=>{const{data:s}=await e("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:t});q(s),this._starData=s});return t.promise.catch(t=>{o(t)||a.getLogger(this).error(t)}).then(()=>{this.destroyed||this.requestRender(1)}),t}};function x(t,e,s,r){const a=j.createBuffer(r),i=a.position,n=a.color,o=a.size;for(let f=0;f<r;f++){const t=e[2*f],r=e[2*f+1];i.set(f,0,-Math.cos(t)*Math.sin(r)),i.set(f,1,-Math.sin(t)*Math.sin(r)),i.set(f,2,-Math.cos(r));const a=A(s[f]),c=I(E[a[1]]);n.set(f,0,255*c[0]),n.set(f,1,255*c[1]),n.set(f,2,255*c[2]),n.set(f,3,255),o.set(f,a[0])}return new P(t,new T(t,_(j),a.buffer))}function k(t){const e=t,s=new Date(t.getFullYear(),0,1,11,58,56);return(+e-+s)/(+new Date(t.getFullYear()+1,0,1,11,58,55)-+s)}function q(t){if(!t)throw new r("stars:no-data-received","Failed to create stars because star catalogue is missing");const e=t.byteLength/R;if(e%1!=0||e>5e4||e<5e3)throw new r("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}function I(t){return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function A(t){return t>=192?[2.9,t-192]:t>=160?[2.5,t-160]:t>=128?[2,t-128]:t>=96?[1.5,t-96]:t>=64?[1,t-64]:t>=32?[.7,t-32]:[.4,t]}M=t([h("esri.views.3d.webgl-engine.effects.stars.Stars")],M);const E=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],L=p(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),O=p(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),R=9;export{M as Stars};
2
+ import{__decorate as t}from"tslib";import{fetchAsset as e}from"../../../../../assets.js";import{createTask as s}from"../../../../../core/asyncUtils.js";import r from"../../../../../core/Error.js";import i from"../../../../../core/Logger.js";import{abortMaybe as a,disposeMaybe as n}from"../../../../../core/maybe.js";import{isAbortError as o}from"../../../../../core/promiseUtils.js";import{watch as f,initial as c,syncAndInitial as m}from"../../../../../core/reactiveUtils.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{copy as u,rotateZ as l,multiply as d}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{fromValues as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{InternalRenderCategory as b}from"../../../webgl.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{OpaqueEnvironment as g}from"../OpaqueEnvironment.js";import{StarPassParameters as w,StarsTechnique as v,layout as j}from"./StarsTechnique.js";import{VertexArrayObject as P}from"../../lib/VertexArrayObject.js";import{ColorAttachment0 as D,PrimitiveType as y}from"../../../../webgl/enums.js";import{VertexBuffer as T}from"../../../../webgl/VertexBuffer.js";let M=class extends g{constructor(){super(...arguments),this._numPoints=0,this._passParameters=new w}initialize(){this.addHandles([f(()=>this.view.environment.starsEnabled,t=>t?this._enable():this._disable(),c),f(()=>"virtual"===this.view.environment.lighting.type?null:this.view.environment.lighting.date,t=>this._update(t),m)])}_enable(){super._enable(),this._loadDataTask=this._createLoadDataTask()}get loading(){return!!this._loadDataTask&&!this._loadDataTask.finished}destroy(){this._loadDataTask=a(this._loadDataTask),this._numPoints=0,this._vao=n(this._vao),this._starData=null}precompile(){this.techniques.precompile(v)}render(t){const e=t.find(({name:t})=>t===b.OPAQUE_ENVIRONMENT),s=this.techniques.getCompiled(v);if(this.loading||!s)return this.requestRender(1),e;if(!this._starData)return e;this._vao??=this._ensureResources(this._starData);const r=this.renderingContext;return r.bindTechnique(s,this.bindParameters,this._passParameters),r.setDrawBuffers([D]),r.bindVAO(this._vao),r.drawArrays(y.POINTS,0,this._numPoints),e}_ensureResources(t){this._numPoints=t.byteLength/R;const e=new Float32Array(t,0,2*this._numPoints),s=new Uint8Array(t,2*this._numPoints*4,this._numPoints);return x(this.renderingContext,e,s,this._numPoints)}_update(t){if(!t)return;const e=(t.getHours()/12+t.getMinutes()/60*(2/24)+t.getSeconds()/60*(2/1440)-.9972222)%2,s=2*q(t),r=u(this._passParameters.modelMatrix,O);l(r,r,-s*Math.PI),d(r,L,r),l(r,r,-e*Math.PI),this.requestRender(1)}_createLoadDataTask(){if(this._starData)return null;const t=s(async t=>{const{data:s}=await e("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:t});k(s),this._starData=s});return t.promise.catch(t=>{o(t)||i.getLogger(this).error(t)}).then(()=>{this.destroyed||this.requestRender(1)}),t}};function x(t,e,s,r){const i=j.createBuffer(r),a=i.position,n=i.color,o=i.size;for(let f=0;f<r;f++){const t=e[2*f],r=e[2*f+1];a.set(f,0,-Math.cos(t)*Math.sin(r)),a.set(f,1,-Math.sin(t)*Math.sin(r)),a.set(f,2,-Math.cos(r));const i=A(s[f]),c=I(E[i[1]]);n.set(f,0,255*c[0]),n.set(f,1,255*c[1]),n.set(f,2,255*c[2]),n.set(f,3,255),o.set(f,i[0])}return new P(t,new T(t,_(j),i.buffer))}function q(t){const e=t,s=new Date(t.getFullYear(),0,1,11,58,56);return(+e-+s)/(+new Date(t.getFullYear()+1,0,1,11,58,55)-+s)}function k(t){if(!t)throw new r("stars:no-data-received","Failed to create stars because star catalogue is missing");const e=t.byteLength/R;if(e%1!=0||e>5e4||e<5e3)throw new r("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}function I(t){return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function A(t){return t>=192?[2.9,t-192]:t>=160?[2.5,t-160]:t>=128?[2,t-128]:t>=96?[1.5,t-96]:t>=64?[1,t-64]:t>=32?[.7,t-32]:[.4,t]}M=t([h("esri.views.3d.webgl-engine.effects.stars.Stars")],M);const E=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],L=p(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),O=p(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),R=9;export{M as Stars};