@arcgis/core 4.23.0-next.20220118 → 4.23.0-next.20220126

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 (359) hide show
  1. package/Graphic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/00c5bb5eecb0e89266df.js +1 -0
  4. package/assets/esri/core/workers/chunks/021a37e2b191298e80b7.js +1 -0
  5. package/assets/esri/core/workers/chunks/1370c92c40fd6271553c.js +1 -0
  6. package/assets/esri/core/workers/chunks/199670a3a564ebe3bd79.js +1 -0
  7. package/assets/esri/core/workers/chunks/1e4d37c2b9dc83d20a11.js +1 -0
  8. package/assets/esri/core/workers/chunks/1fbcc8424452d0256bd6.js +1 -0
  9. package/assets/esri/core/workers/chunks/{7c9d2638693d5f798b23.js → 23b15e7c2f96d260e16c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{b2ae5fc4f787ea568b88.js → 2460f3b6ada6ae900dec.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{99f0d896c17dd09cd285.js → 2629adf79e7fd9f25f07.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2792ca40f1e92849247c.js +1 -0
  13. package/assets/esri/core/workers/chunks/2a96f1bba9ce6883e5e0.js +1 -0
  14. package/assets/esri/core/workers/chunks/2e899ef5881b4ec6fa55.js +1 -0
  15. package/assets/esri/core/workers/chunks/3231ee3e090bb4cac3fc.js +1 -0
  16. package/assets/esri/core/workers/chunks/{0c3e3a5baf54bd5e210c.js → 36e250278b5622ccf068.js} +1 -1
  17. package/assets/esri/core/workers/chunks/395ba088d4864588ff66.js +1 -0
  18. package/assets/esri/core/workers/chunks/3cc77692b2eee27b9c9e.js +1 -0
  19. package/assets/esri/core/workers/chunks/3f343f792fd9f44d6f25.js +1 -0
  20. package/assets/esri/core/workers/chunks/{8a250ec51097f16feb66.js → 40a1e713f63ec77110c0.js} +1 -1
  21. package/assets/esri/core/workers/chunks/422537fc3df707bb62c9.js +1 -0
  22. package/assets/esri/core/workers/chunks/{ba6fdaed6c315dc13981.js → 434b16731c6a81f868ef.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4385a268c2a64281d1c1.js +1 -0
  24. package/assets/esri/core/workers/chunks/{44b01d42d4ec72913229.js → 438f0b5ae5c53ae4f06a.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{4d539878bfbd7c549e60.js → 46b4bb66a54bbd8e2e57.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4c76146014dc15143ba3.js +1 -0
  27. package/assets/esri/core/workers/chunks/5a4a5585ec8027079f32.js +1 -0
  28. package/assets/esri/core/workers/chunks/5d991b74d958005c26c4.js +1 -0
  29. package/assets/esri/core/workers/chunks/5dfe1f8d520025e2118b.js +1 -0
  30. package/assets/esri/core/workers/chunks/601e697dc7414bda128a.js +1 -0
  31. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +1 -0
  32. package/assets/esri/core/workers/chunks/68a59ce98177d8513337.js +1 -0
  33. package/assets/esri/core/workers/chunks/{9cdaba126ac7fa5f33f0.js → 6cd5e4380d29b9a3c344.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{a7b1b75643ed31489495.js → 6f50a9647f026a8d4729.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{47395d225229d237f0ac.js → 7bc5cc5dbf1b7b70ddac.js} +1 -1
  36. package/assets/esri/core/workers/chunks/7d661129a0d8c466eeec.js +1 -0
  37. package/assets/esri/core/workers/chunks/{64276aacaafa4c8a15bd.js → 7dcf52d3db3903c8eb9f.js} +1 -1
  38. package/assets/esri/core/workers/chunks/8070972c0efb78523b68.js +1 -0
  39. package/assets/esri/core/workers/chunks/8fa0a14165d43ffe87a5.js +1 -0
  40. package/assets/esri/core/workers/chunks/94515fb3ef38067eeadd.js +1 -0
  41. package/assets/esri/core/workers/chunks/94b8dbf859df71858d1c.js +1 -0
  42. package/assets/esri/core/workers/chunks/97a28641b3b2fd31bea2.js +1 -0
  43. package/assets/esri/core/workers/chunks/{d1454155ee1b8a421cbb.js → 97ec9eef0048760fa260.js} +1 -1
  44. package/assets/esri/core/workers/chunks/98986e6601b0366376b4.js +1 -0
  45. package/assets/esri/core/workers/chunks/9cdcf9309d6feda70185.js +1 -0
  46. package/assets/esri/core/workers/chunks/a78757b9c7e8cbea08fa.js +1 -0
  47. package/assets/esri/core/workers/chunks/aa04b90b82bf70caaae4.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b10fcbe1393c812fc219.js → aa861b8eae6c85f3dad4.js} +1 -1
  49. package/assets/esri/core/workers/chunks/aace7e1fef256bb961c9.js +1 -0
  50. package/assets/esri/core/workers/chunks/{ed0297fc61014e848c18.js → af5694b4d278cf1db2d9.js} +1 -1
  51. package/assets/esri/core/workers/chunks/afbb4f802ca5774f0326.js +1 -0
  52. package/assets/esri/core/workers/chunks/b0b036ad3ad3cd956747.js +1 -0
  53. package/assets/esri/core/workers/chunks/b2c5f92e3d7606297ca9.js +1 -0
  54. package/assets/esri/core/workers/chunks/b2d2de935487257c568b.js +1 -0
  55. package/assets/esri/core/workers/chunks/b2ebe4f6d100e15b512d.js +1 -0
  56. package/assets/esri/core/workers/chunks/b8316c6469a543029bc6.js +1 -0
  57. package/assets/esri/core/workers/chunks/{4b69129c0557852d9b3d.js → ba5eb394f098968c22d2.js} +1 -1
  58. package/assets/esri/core/workers/chunks/bf0a65b4be31959f921d.js +1 -0
  59. package/assets/esri/core/workers/chunks/bf6dda4a2af14c4b7716.js +1 -0
  60. package/assets/esri/core/workers/chunks/c890c7fca27170e3341f.js +1 -0
  61. package/assets/esri/core/workers/chunks/{573dc3064e84ca86844d.js → c959e0d1cf7dce0421b9.js} +1 -1
  62. package/assets/esri/core/workers/chunks/c976785f2391c77d8a30.js +1 -0
  63. package/assets/esri/core/workers/chunks/{1fd48459afb58a6cf14f.js → ca2f5faa01d99c21ec14.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{7aa543a97f055cddea99.js → cc146c57bbdac8029fd8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{d39b7983b68d6e5b404d.js → cdbc005eebec1503b99d.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{7e596478507466953e65.js → cef4af64860ebbfc1c47.js} +1 -1
  67. package/assets/esri/core/workers/chunks/d72488db62fcf39447b6.js +1 -0
  68. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +981 -0
  69. package/assets/esri/core/workers/chunks/e4b84ca8ddfd48dd79b1.js +1 -0
  70. package/assets/esri/core/workers/chunks/e4e2036373166c1d5cf5.js +1 -0
  71. package/assets/esri/core/workers/chunks/e4f93c55eaefab4192b5.js +1 -0
  72. package/assets/esri/core/workers/chunks/e6165e17fbb07bfc40a1.js +1 -0
  73. package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +1 -0
  74. package/assets/esri/core/workers/chunks/{f678293de9a6d8f5b5db.js → ec89466f76d0ba22525e.js} +1 -1
  75. package/assets/esri/core/workers/chunks/ee45618c45806ab654cb.js +1 -0
  76. package/assets/esri/core/workers/chunks/f4baa5ea2e42b1317941.js +1 -0
  77. package/assets/esri/core/workers/chunks/f760a3e030b0f358a92a.js +1 -0
  78. package/assets/esri/core/workers/chunks/face43cf5abcd2f5bd9d.js +1 -0
  79. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  80. package/assets/esri/themes/base/_mixins.scss +4 -1
  81. package/assets/esri/themes/base/icons/style.scss +11 -2
  82. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +13 -10
  83. package/assets/esri/themes/base/widgets/_CoordinateConversion.scss +4 -2
  84. package/assets/esri/themes/base/widgets/_Directions.scss +5 -3
  85. package/assets/esri/themes/base/widgets/_Editor.scss +5 -2
  86. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +6 -4
  87. package/assets/esri/themes/base/widgets/_FeatureTable.scss +6 -0
  88. package/assets/esri/themes/base/widgets/_ItemList.scss +1 -1
  89. package/assets/esri/themes/base/widgets/_LayerList.scss +13 -9
  90. package/assets/esri/themes/base/widgets/_Popup.scss +4 -2
  91. package/assets/esri/themes/base/widgets/_Print.scss +24 -11
  92. package/assets/esri/themes/base/widgets/_Search.scss +4 -2
  93. package/assets/esri/themes/base/widgets/_TableList.scss +9 -7
  94. package/assets/esri/themes/base/widgets/_Weather.scss +12 -0
  95. package/assets/esri/themes/base/widgets/_Widget.scss +18 -9
  96. package/assets/esri/themes/dark/main.css +1 -1
  97. package/assets/esri/themes/dark-blue/main.css +1 -1
  98. package/assets/esri/themes/dark-green/main.css +1 -1
  99. package/assets/esri/themes/dark-purple/main.css +1 -1
  100. package/assets/esri/themes/dark-red/main.css +1 -1
  101. package/assets/esri/themes/light/main.css +1 -1
  102. package/assets/esri/themes/light/view.css +1 -1
  103. package/assets/esri/themes/light-blue/main.css +1 -1
  104. package/assets/esri/themes/light-green/main.css +1 -1
  105. package/assets/esri/themes/light-purple/main.css +1 -1
  106. package/assets/esri/themes/light-red/main.css +1 -1
  107. package/assets/esri/widgets/Weather/t9n/Weather.json +1 -1
  108. package/assets/esri/widgets/Weather/t9n/Weather_en.json +1 -1
  109. package/chunks/CloudsComposition.glsl.js +4 -4
  110. package/chunks/ComponentShader.glsl.js +19 -19
  111. package/chunks/DefaultMaterial.glsl.js +2 -2
  112. package/chunks/Terrain.glsl.js +11 -11
  113. package/chunks/WaterSurface.glsl.js +21 -21
  114. package/chunks/pe.js +1 -1
  115. package/chunks/vec3.js +1 -1
  116. package/chunks/vxlLayer.js +1 -1
  117. package/core/accessorSupport/ensureType.js +1 -1
  118. package/core/accessorSupport/get.js +1 -1
  119. package/core/accessorSupport/read.js +1 -1
  120. package/core/accessorSupport/set.js +1 -1
  121. package/core/accessorSupport/write.js +1 -1
  122. package/core/has.js +1 -1
  123. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  124. package/core/typedArrayUtil.js +1 -1
  125. package/core/workers/workerFactory.js +1 -1
  126. package/geometry/pe.js +1 -1
  127. package/geometry/support/axisAngleDegrees.js +1 -1
  128. package/geometry/support/heightModelInfoUtils.js +1 -1
  129. package/interfaces.d.ts +315 -78
  130. package/layers/RouteLayer.js +1 -1
  131. package/layers/VoxelLayer.js +1 -1
  132. package/layers/VoxelWasmPerScene.js +1 -1
  133. package/layers/mixins/OperationalLayer.js +1 -1
  134. package/layers/support/RasterWorker.js +1 -1
  135. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  136. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  137. package/libs/vxl/enums.js +1 -1
  138. package/package.json +2 -2
  139. package/popup/content/AttachmentsContent.js +1 -1
  140. package/popup/content/support/mediaInfoTypes.js +1 -1
  141. package/portal/schemas/buildingSceneLayerItem.js +1 -1
  142. package/portal/schemas/definitions.js +1 -1
  143. package/portal/schemas/integratedMeshLayerItem.js +1 -1
  144. package/portal/schemas/pointCloudLayerItem.js +1 -1
  145. package/portal/schemas/sceneLayerItem.js +1 -1
  146. package/portal/schemas/webScene.js +1 -1
  147. package/rasterRenderers.js +1 -1
  148. package/rest/find.js +1 -1
  149. package/rest/geometryService/generalize.js +1 -1
  150. package/rest/geometryService/lengths.js +1 -1
  151. package/rest/geometryService/offset.js +1 -1
  152. package/rest/geometryService/relation.js +1 -1
  153. package/rest/geometryService/trimExtend.js +1 -1
  154. package/rest/identify.js +1 -1
  155. package/{tasks → rest}/operations/find.js +0 -0
  156. package/{tasks → rest}/operations/generalize.js +0 -0
  157. package/rest/operations/identify.js +5 -0
  158. package/{tasks → rest}/operations/lengths.js +0 -0
  159. package/{tasks → rest}/operations/offset.js +0 -0
  160. package/{tasks → rest}/operations/relation.js +0 -0
  161. package/{tasks → rest}/operations/trimExtend.js +0 -0
  162. package/{tasks → rest}/operations/urlUtils.js +0 -0
  163. package/rest/print.js +1 -1
  164. package/rest/query/operations/query.js +1 -1
  165. package/rest/query/operations/queryAttachments.js +1 -1
  166. package/rest/query/operations/queryRelatedRecords.js +1 -1
  167. package/rest/query/operations/queryTopFeatures.js +1 -1
  168. package/rest/route/utils.js +1 -1
  169. package/rest/support/NetworkServiceDescription.js +1 -1
  170. package/rest/support/RouteInfo.js +1 -1
  171. package/rest/support/RouteParameters.js +1 -1
  172. package/rest/support/RouteSettings.js +5 -0
  173. package/rest/support/Stop.js +1 -1
  174. package/rest/support/networkEnums.js +1 -1
  175. package/support/revision.js +1 -1
  176. package/symbols/Font.js +1 -1
  177. package/symbols/LabelSymbol3D.js +1 -1
  178. package/symbols/PointSymbol3D.js +1 -1
  179. package/symbols/TextSymbol.js +1 -1
  180. package/symbols/TextSymbol3DLayer.js +1 -1
  181. package/symbols/cim/CIMSymbolHelper.js +1 -1
  182. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  183. package/symbols/cim/cimAnalyzer.js +1 -1
  184. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  185. package/symbols/support/Symbol3DVerticalOffset.js +1 -1
  186. package/symbols/support/cimSymbolUtils.js +1 -1
  187. package/symbols/support/previewCIMSymbol.js +1 -1
  188. package/symbols/support/previewSymbol2D.js +1 -1
  189. package/symbols/support/previewSymbol3D.js +1 -1
  190. package/symbols/support/previewWebStyleSymbol.js +1 -1
  191. package/symbols/support/svgUtils.js +1 -1
  192. package/symbols/support/textUtils.js +5 -0
  193. package/symbols.js +1 -1
  194. package/views/2d/engine/vectorTiles/style/VectorTilesRequestManager.js +1 -1
  195. package/views/2d/engine/webgl/brushes/raster/BrushRasterBitmap.js +1 -1
  196. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  197. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  198. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  199. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  200. package/views/2d/support/engineHelpers.js +1 -1
  201. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  202. package/views/3d/environment/CloudsComposition.js +1 -1
  203. package/views/3d/environment/CloudsGenerator.js +1 -1
  204. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  205. package/views/3d/environment/Fog.js +1 -1
  206. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  207. package/views/3d/environment/weather.js +1 -1
  208. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
  209. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  210. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  211. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  212. package/views/3d/layers/GraphicsView3D.js +1 -1
  213. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  214. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  215. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  216. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  217. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  218. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +5 -0
  219. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  220. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  221. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  222. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  223. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  226. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  227. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  228. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  229. package/views/3d/layers/graphics/{Graphics3DGraphicLikeLayerView.js → GraphicsProcessor.js} +1 -1
  230. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  231. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  232. package/views/3d/terrain/OverlayRenderer.js +1 -1
  233. package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +7 -1
  234. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +28 -24
  235. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +21 -13
  236. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
  237. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +12 -14
  238. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  239. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  240. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  241. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  242. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  243. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  244. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  245. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  246. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  247. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  248. package/views/3d/webgl-engine/parts/Model.js +1 -1
  249. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  250. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  251. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  252. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  253. package/views/SceneView.js +1 -1
  254. package/views/interactive/dragEventPipeline.js +1 -1
  255. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  256. package/views/support/DefaultsFromMap.js +1 -1
  257. package/views/webgl/ContextState.js +1 -1
  258. package/views/webgl/FramebufferObject.js +1 -1
  259. package/views/webgl/Renderbuffer.js +1 -1
  260. package/views/webgl/RenderingContext.js +1 -1
  261. package/views/webgl/Texture.js +1 -1
  262. package/views/webgl/Util.js +1 -1
  263. package/views/webgl/enums.js +1 -1
  264. package/views/webgl/rasterUtils.js +1 -1
  265. package/views/webgl/testFloatBufferBlend.js +1 -1
  266. package/widgets/Attachments.js +1 -1
  267. package/widgets/Editor/workflowUtils.js +1 -1
  268. package/widgets/Feature/FeatureExpression.js +1 -1
  269. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  270. package/widgets/Feature/FeatureMedia.js +1 -1
  271. package/widgets/Feature/FeatureViewModel.js +1 -1
  272. package/widgets/FeatureForm/InputField.js +1 -1
  273. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  274. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  275. package/widgets/FeatureTable.js +1 -1
  276. package/widgets/LayerList/LayerListViewModel.js +1 -1
  277. package/widgets/Popup/PopupViewModel.js +1 -1
  278. package/widgets/Popup/actionUtils.js +1 -1
  279. package/widgets/Slice/SliceViewModel.js +1 -1
  280. package/widgets/Slider/SliderViewModel.js +1 -1
  281. package/widgets/Slider.js +1 -1
  282. package/widgets/Weather/WeatherViewModel.js +1 -1
  283. package/widgets/Weather/css.js +1 -1
  284. package/widgets/Weather.js +1 -1
  285. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  286. package/widgets/support/InteractiveToolViewModel.js +1 -1
  287. package/widgets/support/geolocationUtils.js +1 -1
  288. package/assets/components/assets/calcite-icon/checkSquareF16.json +0 -1
  289. package/assets/components/assets/calcite-icon/checkSquareF24.json +0 -1
  290. package/assets/components/assets/calcite-icon/checkSquareF32.json +0 -1
  291. package/assets/components/assets/calcite-icon/lineSolid4.json +0 -1
  292. package/assets/components/assets/calcite-icon/squareF16.json +0 -1
  293. package/assets/components/assets/calcite-icon/squareF24.json +0 -1
  294. package/assets/components/assets/calcite-icon/squareF32.json +0 -1
  295. package/assets/components/assets/calcite-icon/xHexagon16.json +0 -1
  296. package/assets/components/assets/calcite-icon/xHexagon24.json +0 -1
  297. package/assets/components/assets/calcite-icon/xHexagon32.json +0 -1
  298. package/assets/components/assets/calcite-icon/xHexagonF16.json +0 -1
  299. package/assets/components/assets/calcite-icon/xHexagonF24.json +0 -1
  300. package/assets/components/assets/calcite-icon/xHexagonF32.json +0 -1
  301. package/assets/components/assets/calcite-icon/xOctagonF16.json +0 -1
  302. package/assets/components/assets/calcite-icon/xOctagonF24.json +0 -1
  303. package/assets/components/assets/calcite-icon/xOctagonF32.json +0 -1
  304. package/assets/esri/core/workers/chunks/01ef8de7f76a8c61b464.js +0 -1
  305. package/assets/esri/core/workers/chunks/09da224052976e290828.js +0 -1
  306. package/assets/esri/core/workers/chunks/0f254c3e91e8fee55f28.js +0 -1
  307. package/assets/esri/core/workers/chunks/20411bb8e04703962ce6.js +0 -1
  308. package/assets/esri/core/workers/chunks/21a77eed1a4ef5b0ff08.js +0 -1
  309. package/assets/esri/core/workers/chunks/23745a5ab47c840dc452.js +0 -1
  310. package/assets/esri/core/workers/chunks/2416f8bf8bbd2ec786ab.js +0 -1
  311. package/assets/esri/core/workers/chunks/2d947080a27db6ce0d75.js +0 -1
  312. package/assets/esri/core/workers/chunks/2e445a8735ea2adb641a.js +0 -1
  313. package/assets/esri/core/workers/chunks/32f8c4af7e70ebdcb19e.js +0 -1
  314. package/assets/esri/core/workers/chunks/3564e14010953def6df9.js +0 -1
  315. package/assets/esri/core/workers/chunks/390d9021169e65c10eb8.js +0 -1
  316. package/assets/esri/core/workers/chunks/3a9740dccda6a733313c.js +0 -1
  317. package/assets/esri/core/workers/chunks/403c7d64f12f00330d88.js +0 -1
  318. package/assets/esri/core/workers/chunks/4409d77c9734de4e82a7.js +0 -1
  319. package/assets/esri/core/workers/chunks/4c301ca9c493b96df746.js +0 -1
  320. package/assets/esri/core/workers/chunks/60371c0f750cde87656d.js +0 -1
  321. package/assets/esri/core/workers/chunks/615aa2d3ecafe30c80c0.js +0 -1
  322. package/assets/esri/core/workers/chunks/631c5b514bb73782c570.js +0 -1
  323. package/assets/esri/core/workers/chunks/6c1e92ff4c732dfda756.js +0 -1
  324. package/assets/esri/core/workers/chunks/722a10c65456844d72b9.js +0 -1
  325. package/assets/esri/core/workers/chunks/75d53b28afe732c459b2.js +0 -1
  326. package/assets/esri/core/workers/chunks/85b34d91cf07567d6873.js +0 -1
  327. package/assets/esri/core/workers/chunks/8967288145f8fbd20e7d.js +0 -1
  328. package/assets/esri/core/workers/chunks/89de05207744149fb58b.js +0 -1
  329. package/assets/esri/core/workers/chunks/8fdd5bca3716816d359b.js +0 -1
  330. package/assets/esri/core/workers/chunks/987182b3a578fc7de251.js +0 -1
  331. package/assets/esri/core/workers/chunks/99a777693e4539f0b03b.js +0 -1
  332. package/assets/esri/core/workers/chunks/9d9dffc8884d66a258e4.js +0 -1
  333. package/assets/esri/core/workers/chunks/a28b53c61bddefb6616e.js +0 -1
  334. package/assets/esri/core/workers/chunks/a6ff3db3493543df81bc.js +0 -1
  335. package/assets/esri/core/workers/chunks/a8c13529367c037cdd94.js +0 -1
  336. package/assets/esri/core/workers/chunks/a960074644c3722be71e.js +0 -1
  337. package/assets/esri/core/workers/chunks/ac8dca61ade28c542ae2.js +0 -1
  338. package/assets/esri/core/workers/chunks/b99e69302ea701fff0ea.js +0 -971
  339. package/assets/esri/core/workers/chunks/b9de831ac379cf1d2969.js +0 -1
  340. package/assets/esri/core/workers/chunks/bc790b2f964144d10abe.js +0 -1
  341. package/assets/esri/core/workers/chunks/be2b7cce79fd41627931.js +0 -1
  342. package/assets/esri/core/workers/chunks/c13dfdd548dcb1bdb294.js +0 -1
  343. package/assets/esri/core/workers/chunks/c3eca92d02958732e141.js +0 -1
  344. package/assets/esri/core/workers/chunks/c6bd943fe8fd13bb4806.js +0 -1
  345. package/assets/esri/core/workers/chunks/c6f94b92e866b881d9b9.js +0 -1
  346. package/assets/esri/core/workers/chunks/cb68db7169b9dfd1c3ff.js +0 -1
  347. package/assets/esri/core/workers/chunks/cc96608b2802fbfe7a08.js +0 -1
  348. package/assets/esri/core/workers/chunks/cd02fe27eb07681cb366.js +0 -1
  349. package/assets/esri/core/workers/chunks/d52108864136c5a8a618.js +0 -1
  350. package/assets/esri/core/workers/chunks/da1c2873bdbc0956dca0.js +0 -1
  351. package/assets/esri/core/workers/chunks/dd433c160f7a0c120b82.js +0 -1
  352. package/assets/esri/core/workers/chunks/de03439ca2c9782bf325.js +0 -1
  353. package/assets/esri/core/workers/chunks/e2d68bcd2f99a65387bf.js +0 -1
  354. package/assets/esri/core/workers/chunks/ef8b75b92cf549e0507e.js +0 -1
  355. package/assets/esri/core/workers/chunks/f7fc4c993536e62f7f3e.js +0 -1
  356. package/assets/esri/core/workers/chunks/fd3e5d823dc7917f4b8f.js +0 -1
  357. package/symbols/support/constants.js +0 -5
  358. package/tasks/operations/identify.js +0 -5
  359. package/views/3d/layers/graphics/Graphics3DFeatureLikeLayerView.js +0 -5
@@ -2,55 +2,59 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as o}from"../ShaderOutputOptions.js";import{Slice as r}from"../Slice.glsl.js";import{Transform as e}from"../Transform.glsl.js";import{NormalAttribute as t}from"../attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttribute as i}from"../attributes/TextureCoordinateAttribute.glsl.js";import{VertexNormal as a}from"../attributes/VertexNormal.glsl.js";import{OutputDepth as l}from"../output/OutputDepth.glsl.js";import{OutputHighlight as s}from"../output/OutputHighlight.glsl.js";import{VisualVariables as d}from"../shading/VisualVariables.glsl.js";import{DiscardOrAdjustAlpha as u}from"../util/AlphaDiscard.glsl.js";import{glsl as n}from"../../shaderModules/interfaces.js";function p(p,c){const m=p.vertex.code,v=p.fragment.code;c.output!==o.Depth&&c.output!==o.Shadow||(p.include(e,{linearDepth:!0}),p.include(i,c),p.include(d,c),p.include(l,c),p.include(r,c),p.vertex.uniforms.add("cameraNearFar","vec2"),p.varyings.add("depth","float"),c.hasColorTexture&&p.fragment.uniforms.add("tex","sampler2D"),m.add(n`void main(void) {
6
- vpos = calculateVPos();
7
- vpos = subtractOrigin(vpos);
8
- vpos = addVerticalOffset(vpos, localOrigin);
9
- gl_Position = transformPositionWithDepth(proj, view, vpos, cameraNearFar, depth);
10
- forwardTextureCoordinates();
11
- }`),p.include(u,c),v.add(n`
5
+ import{ShaderOutput as o}from"../ShaderOutputOptions.js";import{Slice as r}from"../Slice.glsl.js";import{Transform as e}from"../Transform.glsl.js";import{NormalAttribute as t}from"../attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttribute as i}from"../attributes/TextureCoordinateAttribute.glsl.js";import{VertexNormal as a}from"../attributes/VertexNormal.glsl.js";import{OutputDepth as l}from"../output/OutputDepth.glsl.js";import{OutputHighlight as s}from"../output/OutputHighlight.glsl.js";import{VisualVariables as d}from"../shading/VisualVariables.glsl.js";import{DiscardOrAdjustAlpha as n}from"../util/AlphaDiscard.glsl.js";import{glsl as u}from"../../shaderModules/interfaces.js";function m(m,p){const c=m.vertex.code,v=m.fragment.code,f=p.hasModelTransformation;p.output!==o.Depth&&p.output!==o.Shadow||(m.include(e,{linearDepth:!0,hasModelTransformation:f}),m.include(i,p),m.include(d,p),m.include(l,p),m.include(r,p),m.vertex.uniforms.add("cameraNearFar","vec2"),m.varyings.add("depth","float"),p.hasColorTexture&&m.fragment.uniforms.add("tex","sampler2D"),c.add(u`
6
+ void main(void) {
7
+ vpos = calculateVPos();
8
+ vpos = subtractOrigin(vpos);
9
+ vpos = addVerticalOffset(vpos, localOrigin);
10
+ gl_Position = transformPositionWithDepth(proj, view, ${f?"model,":""} vpos, cameraNearFar, depth);
11
+ forwardTextureCoordinates();
12
+ }
13
+ `),m.include(n,p),v.add(u`
12
14
  void main(void) {
13
15
  discardBySlice(vpos);
14
- ${c.hasColorTexture?n`
16
+ ${p.hasColorTexture?u`
15
17
  vec4 texColor = texture2D(tex, vuv0);
16
18
  discardOrAdjustAlpha(texColor);`:""}
17
19
  outputDepth(depth);
18
20
  }
19
- `)),c.output===o.Normal&&(p.include(e,{linearDepth:!1}),p.include(t,c),p.include(a,c),p.include(i,c),p.include(d,c),c.hasColorTexture&&p.fragment.uniforms.add("tex","sampler2D"),p.vertex.uniforms.add("viewNormal","mat4"),p.varyings.add("vPositionView","vec3"),m.add(n`
21
+ `)),p.output===o.Normal&&(m.include(e,{linearDepth:!1,hasModelTransformation:f}),m.include(t,p),m.include(a,p),m.include(i,p),m.include(d,p),p.hasColorTexture&&m.fragment.uniforms.add("tex","sampler2D"),m.vertex.uniforms.add("viewNormal","mat4"),m.varyings.add("vPositionView","vec3"),c.add(u`
20
22
  void main(void) {
21
23
  vpos = calculateVPos();
22
24
  vpos = subtractOrigin(vpos);
23
- ${c.normalType===t.Type.Attribute?n`
25
+ ${p.normalType===t.Type.Attribute?u`
24
26
  vNormalWorld = dpNormalView(vvLocalNormal(normalModel()));`:""}
25
27
  vpos = addVerticalOffset(vpos, localOrigin);
26
- gl_Position = transformPosition(proj, view, vpos);
28
+ gl_Position = transformPosition(proj, view, ${f?"model,":""} vpos);
27
29
  forwardTextureCoordinates();
28
30
  }
29
- `),p.include(r,c),p.include(u,c),v.add(n`
31
+ `),m.include(r,p),m.include(n,p),v.add(u`
30
32
  void main() {
31
33
  discardBySlice(vpos);
32
- ${c.hasColorTexture?n`
34
+ ${p.hasColorTexture?u`
33
35
  vec4 texColor = texture2D(tex, vuv0);
34
36
  discardOrAdjustAlpha(texColor);`:""}
35
37
 
36
- ${c.normalType===t.Type.ScreenDerivative?n`
37
- vec3 normal = screenDerivativeNormal(vPositionView);`:n`
38
+ ${p.normalType===t.Type.ScreenDerivative?u`
39
+ vec3 normal = screenDerivativeNormal(vPositionView);`:u`
38
40
  vec3 normal = normalize(vNormalWorld);
39
41
  if (gl_FrontFacing == false) normal = -normal;`}
40
42
  gl_FragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);
41
43
  }
42
- `)),c.output===o.Highlight&&(p.include(e,{linearDepth:!1}),p.include(i,c),p.include(d,c),c.hasColorTexture&&p.fragment.uniforms.add("tex","sampler2D"),m.add(n`void main(void) {
43
- vpos = calculateVPos();
44
- vpos = subtractOrigin(vpos);
45
- vpos = addVerticalOffset(vpos, localOrigin);
46
- gl_Position = transformPosition(proj, view, vpos);
47
- forwardTextureCoordinates();
48
- }`),p.include(r,c),p.include(u,c),p.include(s),v.add(n`
44
+ `)),p.output===o.Highlight&&(m.include(e,{linearDepth:!1,hasModelTransformation:f}),m.include(i,p),m.include(d,p),p.hasColorTexture&&m.fragment.uniforms.add("tex","sampler2D"),c.add(u`
45
+ void main(void) {
46
+ vpos = calculateVPos();
47
+ vpos = subtractOrigin(vpos);
48
+ vpos = addVerticalOffset(vpos, localOrigin);
49
+ gl_Position = transformPosition(proj, view, ${f?"model,":""} vpos);
50
+ forwardTextureCoordinates();
51
+ }
52
+ `),m.include(r,p),m.include(n,p),m.include(s),v.add(u`
49
53
  void main() {
50
54
  discardBySlice(vpos);
51
- ${c.hasColorTexture?n`
55
+ ${p.hasColorTexture?u`
52
56
  vec4 texColor = texture2D(tex, vuv0);
53
57
  discardOrAdjustAlpha(texColor);`:""}
54
58
  outputHighlight();
55
59
  }
56
- `))}export{p as DefaultMaterialAuxiliaryPasses};
60
+ `))}export{m as DefaultMaterialAuxiliaryPasses};
@@ -2,12 +2,13 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{FoamColor as e}from"./FoamRendering.glsl.js";import{Gamma as o}from"./Gamma.glsl.js";import{PhysicallyBasedRendering as t}from"./PhysicallyBasedRendering.glsl.js";import{ScreenSpaceReflections as i}from"./ScreenSpaceReflections.glsl.js";import{glsl as r}from"../../shaderModules/interfaces.js";function a(a,n){a.include(t,n),a.include(o),a.include(e),n.ssrEnabled&&a.include(i,n),a.fragment.constants.add("fresnelSky","vec3",[.02,1,15]).add("fresnelMaterial","vec2",[.02,.1]).add("roughness","float",.015).add("foamIntensityExternal","float",1.7).add("ssrIntensity","float",.65).add("ssrHeightFadeStart","float",3e5).add("ssrHeightFadeEnd","float",5e5).add("waterDiffusion","float",.775).add("waterSeeColorMod","float",.8).add("correctionViewingPowerFactor","float",.4).add("skyZenitColor","vec3",[.52,.68,.9]).add("skyColor","vec3",[.67,.79,.9]),a.fragment.code.add(r`PBRShadingWater shadingInfo;
5
+ import{FoamColor as e}from"./FoamRendering.glsl.js";import{Gamma as o}from"./Gamma.glsl.js";import{PhysicallyBasedRendering as r}from"./PhysicallyBasedRendering.glsl.js";import{ScreenSpaceReflections as t}from"./ScreenSpaceReflections.glsl.js";import{CloudsParallaxShading as i}from"../util/CloudsParallaxShading.glsl.js";import{glsl as a}from"../../shaderModules/interfaces.js";function l(l,n){l.include(r,n),l.include(o),l.include(e),n.cloudsReflectionsEnable&&l.include(i),n.ssrEnabled&&l.include(t,n),l.fragment.constants.add("fresnelSky","vec3",[.02,1,15]).add("fresnelMaterial","vec2",[.02,.1]).add("roughness","float",.015).add("foamIntensityExternal","float",1.7).add("ssrIntensity","float",.65).add("ssrHeightFadeStart","float",3e5).add("ssrHeightFadeEnd","float",5e5).add("waterDiffusion","float",.92).add("waterSeeColorMod","float",.8).add("correctionViewingPowerFactor","float",.4).add("skyZenitColor","vec3",[.52,.68,.9]).add("skyColor","vec3",[.67,.79,.9]).add("cloudFresnelModifier","vec2",[1.2,.01]),l.fragment.code.add(a`PBRShadingWater shadingInfo;
6
6
  vec3 getSkyGradientColor(in float cosTheta, in vec3 horizon, in vec3 zenit) {
7
7
  float exponent = pow((1.0 - cosTheta), fresnelSky[2]);
8
8
  return mix(zenit, horizon, exponent);
9
- }`),a.fragment.code.add(r`vec3 getSeaColor(in vec3 n, in vec3 v, in vec3 l, vec3 color, in vec3 lightIntensity, in vec3 localUp, in float shadow, float foamIntensity, vec3 positionView) {
10
- float reflectionHit = 0.;
9
+ }`),l.fragment.code.add(a`vec3 getSeaColor(in vec3 n, in vec3 v, in vec3 l, vec3 color, in vec3 lightIntensity, in vec3 localUp, in float shadow, float foamIntensity, vec3 positionView, vec3 position) {
10
+ float reflectionHit = 0.0;
11
+ float reflectionHitDiffused = 0.0;
11
12
  vec3 seaWaterColor = linearizeGamma(color);
12
13
  vec3 h = normalize(l + v);
13
14
  shadingInfo.NdotL = clamp(dot(n, l), 0.0, 1.0);
@@ -36,14 +37,19 @@ specular = shadingInfo.NdotL * incidentLight * specularSun;
36
37
  vec3 foam = vec3(0.0);
37
38
  if(upDotV > 0.0) {
38
39
  foam = foamIntensity2FoamColor(foamIntensityExternal, foamIntensity, skyZenitColor, daytimeMod);
39
- }`),n.ssrEnabled?a.fragment.code.add(r`vec4 viewPosition = vec4(positionView.xyz, 1.0);
40
+ }
41
+ float correctionViewingFactor = pow(max(dot(v, localUp), 0.0), correctionViewingPowerFactor);
42
+ vec3 normalCorrectedClouds = mix(localUp, n, correctionViewingFactor);
43
+ vec3 reflectedWorld = normalize(reflect(-v, normalCorrectedClouds));`),n.cloudsReflectionsEnable&&l.fragment.code.add(a`vec4 cloudsColor = crossFade == 0 ? renderCloud(reflectedWorld, position) : renderCloudCrossFade(reflectedWorld, position);
44
+ cloudsColor.a = 1.0 - cloudsColor.a;
45
+ cloudsColor = pow(cloudsColor, vec4(GAMMA));
46
+ cloudsColor *= clamp(fresnelModifier.y*cloudFresnelModifier[0] - cloudFresnelModifier[1], 0.0, 1.0) * (1.0 - totalFadeInOut);`),n.ssrEnabled?l.fragment.code.add(a`vec4 viewPosition = vec4(positionView.xyz, 1.0);
40
47
  vec3 viewDir = normalize(viewPosition.xyz);
41
48
  vec4 viewNormalVectorCoordinate = ssrViewMat *vec4(n, 0.0);
42
49
  vec3 viewNormal = normalize(viewNormalVectorCoordinate.xyz);
43
50
  vec4 viewUp = ssrViewMat *vec4(localUp, 0.0);
44
- float correctionViewingFactor = pow(max(dot(-viewDir, viewUp.xyz), 0.0), correctionViewingPowerFactor);
45
- vec3 viewNormalCorrected = mix(viewUp.xyz, viewNormal, correctionViewingFactor);
46
- vec3 reflected = normalize(reflect(viewDir, viewNormalCorrected));
51
+ vec3 viewNormalCorrectedSSR = mix(viewUp.xyz, viewNormal, correctionViewingFactor);
52
+ vec3 reflected = normalize(reflect(viewDir, viewNormalCorrectedSSR));
47
53
  vec3 hitCoordinate = screenSpaceIntersection( normalize(reflected), viewPosition.xyz, viewDir, viewUp.xyz);
48
54
  vec3 reflectedColor = vec3(0.0);
49
55
  if (hitCoordinate.z > 0.0)
@@ -51,10 +57,12 @@ if (hitCoordinate.z > 0.0)
51
57
  vec2 reprojectedCoordinate = reprojectionCoordinate(hitCoordinate);
52
58
  vec2 dCoords = smoothstep(0.3, 0.6, abs(vec2(0.5, 0.5) - hitCoordinate.xy));
53
59
  float heightMod = smoothstep(ssrHeightFadeEnd, ssrHeightFadeStart, -positionView.z);
54
- reflectionHit = waterDiffusion * clamp(1.0 - (1.3*dCoords.y), 0.0, 1.0) * heightMod;
55
- reflectedColor = linearizeGamma(texture2D(lastFrameColorMap, reprojectedCoordinate).xyz)* reflectionHit * fresnelModifier.y * ssrIntensity;
60
+ reflectionHit = clamp(1.0 - (1.3*dCoords.y), 0.0, 1.0) * heightMod;
61
+ reflectionHitDiffused = waterDiffusion * reflectionHit;
62
+ reflectedColor = linearizeGamma(texture2D(lastFrameColorMap, reprojectedCoordinate).xyz)* reflectionHitDiffused * fresnelModifier.y * ssrIntensity;
56
63
  }
57
- float seeColorMod = mix(waterSeeColorMod, waterSeeColorMod*0.5, reflectionHit);
58
- return tonemapACES((1. - reflectionHit) * reflSky + reflectedColor + reflSea * seeColorMod + specular + foam);
59
- }`):a.fragment.code.add(r`return tonemapACES(reflSky + reflSea * waterSeeColorMod + specular + foam);
60
- }`)}export{a as Water};
64
+ float seeColorMod = mix(waterSeeColorMod, waterSeeColorMod*0.5, reflectionHitDiffused);
65
+ vec3 waterRenderedColor = tonemapACES((1.0 - reflectionHitDiffused) * reflSky + reflectedColor + reflSea * seeColorMod + specular + foam);`):l.fragment.code.add(a`vec3 waterRenderedColor = tonemapACES(reflSky + reflSea * waterSeeColorMod + specular + foam);`),n.cloudsReflectionsEnable?n.ssrEnabled?l.fragment.code.add(a`return waterRenderedColor * (1.0 - (1.0 - reflectionHit) * cloudsColor.a) + (1.0 - reflectionHit) * cloudsColor.xyz;
66
+ }`):l.fragment.code.add(a`return waterRenderedColor * (1.0 - cloudsColor.a) + cloudsColor.xyz;
67
+ }`):l.fragment.code.add(a`return waterRenderedColor;
68
+ }`)}export{l as Water};
@@ -16,9 +16,9 @@ return mix(color1 * float(isValid1), color0, float(isValid0));
16
16
  }`),t.fragment.code.add(a`vec4 getCombinedOverlayColor() {
17
17
  return overlayOpacity * getOverlayColor(ovColorTex, vtcOverlay);
18
18
  }`),d.pbrMode!==o.Water&&d.pbrMode!==o.WaterOnIntegratedMesh||(t.include(e),t.fragment.code.add(a`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
19
- float shadow, vec3 localUp, mat3 tbn, vec3 position) {
19
+ float shadow, vec3 localUp, mat3 tbn, vec3 position, vec3 positionWorld) {
20
20
  vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0)));
21
21
  vec3 v = vposEyeDir;
22
- vec3 final = getSeaColor(n, v, lightingMainDirection, colorInput.rgb, lightingMainIntensity, localUp, 1.0 - shadow, maskInput.w, position);
22
+ vec3 final = getSeaColor(n, v, lightingMainDirection, colorInput.rgb, lightingMainIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld);
23
23
  return vec4(final, colorInput.w);
24
24
  }`))}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(t||(t={}));export{d as Overlay,t as OverlayMode};
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{PiUtils as o}from"../shading/PiUtils.glsl.js";import{glsl as t}from"../../shaderModules/interfaces.js";function a(a){a.fragment.uniforms.add("anchorPosition","vec3").add("anchorPositionCrossFade","vec3").add("fadeInOutFactor","float").add("cloudsHeight","float").add("rotationMatrixClouds","mat4").add("rotationMatrixCloudsCrossFade","mat4").add("radiusCurvatureCorrectionFactor","float").add("radius","float").add("cameraPosition","vec3").add("totalFadeInOut","float").add("crossFade","int").add("crossFadeAnchorFactor","float").add("cloudVariables","vec2"),a.include(o),a.fragment.code.add(t`vec3 intersectWithCloudLayer(vec3 dir, vec3 camPos, vec3 spherePos, float radiusReduction)
5
+ import{glsl as o}from"../../shaderModules/interfaces.js";function t(t){t.fragment.uniforms.add("anchorPosition","vec3").add("anchorPositionCrossFade","vec3").add("fadeInOutFactor","float").add("cloudsHeight","float").add("rotationMatrixClouds","mat4").add("rotationMatrixCloudsCrossFade","mat4").add("radiusCurvatureCorrectionFactor","float").add("radius","float").add("cameraPosition","vec3").add("totalFadeInOut","float").add("crossFade","int").add("crossFadeAnchorFactor","float").add("cloudVariables","vec2").add("cubeMap","samplerCube"),t.fragment.code.add(o`vec3 intersectWithCloudLayer(vec3 dir, vec3 camPos, vec3 spherePos, float radiusReduction)
6
6
  {
7
7
  vec3 dirAnchor = normalize(spherePos);
8
8
  vec3 sphereOriginOffset = dirAnchor * radiusReduction;
@@ -14,21 +14,19 @@ float pointIntDist = max(0.0, 0.5 *(-B + sqrt(det)));
14
14
  vec3 intersectionPont = camPos + dir * pointIntDist;
15
15
  intersectionPont = intersectionPont - spherePos;
16
16
  return intersectionPont;
17
- }`),a.fragment.code.add(t`vec3 correctForPlanetCurvature(vec3 dir)
17
+ }`),t.fragment.code.add(o`vec3 correctForPlanetCurvature(vec3 dir)
18
18
  {
19
19
  dir.z = dir.z*(1.-radiusCurvatureCorrectionFactor) + radiusCurvatureCorrectionFactor;
20
20
  return dir;
21
- }`),a.fragment.code.add(t`vec3 rotateDirectionToAnchorPoint(mat4 rotMat, vec3 inVec)
21
+ }`),t.fragment.code.add(o`vec3 rotateDirectionToAnchorPoint(mat4 rotMat, vec3 inVec)
22
22
  {
23
23
  return (rotMat * vec4(inVec, 0.0)).xyz;
24
- }`),a.fragment.code.add(t`const float SUNSET_TRANSITION_FACTOR = 0.3;
24
+ }`),t.fragment.code.add(o`const float SUNSET_TRANSITION_FACTOR = 0.3;
25
25
  const vec3 RIM_COLOR = vec3(0.28, 0.175, 0.035);
26
26
  const float RIM_SCATTERING_FACTOR = 140.0;
27
27
  const float BACKLIGHT_FACTOR = 0.2;
28
28
  const float BACKLIGHT_SCATTERING_FACTOR = 10.0;
29
29
  const float BACKLIGHT_TRANSITION_FACTOR = 0.3;
30
- const float GAMMA_SRGB = 2.1;
31
- const float INV_GAMMA_SRGB = 0.4761904;
32
30
  vec3 calculateCloudColor(vec3 worldSpaceRay, vec4 clouds)
33
31
  {
34
32
  float upDotLight = dot(normalize(cameraPosition), normalize(lightingMainDirection));
@@ -37,20 +35,20 @@ float sunsetTransition = clamp(pow(max(upDotLight, 0.0), SUNSET_TRANSITION_FACTO
37
35
  vec3 ambientLight = calculateAmbientIrradiance(normalize(cameraPosition), 0.0);
38
36
  vec3 mainLight = evaluateMainLighting(normalize(cameraPosition), 0.0);
39
37
  vec3 combinedLight = clamp((lightingMainIntensity + ambientLight )/PI, vec3(0.0), vec3(1.0));
40
- vec3 baseCloudColor = pow(combinedLight * pow(clouds.xyz, vec3(GAMMA_SRGB)), vec3(INV_GAMMA_SRGB));
38
+ vec3 baseCloudColor = pow(combinedLight * pow(clouds.xyz, vec3(GAMMA)), vec3(INV_GAMMA));
41
39
  float scatteringMod = max(clouds.a < 0.5 ? clouds.a / 0.5 : - clouds.a / 0.5 + 2.0, 0.0);
42
40
  float rimLightIntensity = 0.5 + 0.5 *pow(max(upDotLight, 0.0), 0.35);
43
41
  vec3 directSunScattering = RIM_COLOR * rimLightIntensity * pow(dirDotLight, RIM_SCATTERING_FACTOR) * scatteringMod;
44
42
  float additionalLight = BACKLIGHT_FACTOR * pow(dirDotLight, BACKLIGHT_SCATTERING_FACTOR) * (1. - pow(sunsetTransition, BACKLIGHT_TRANSITION_FACTOR)) ;
45
43
  return vec3(baseCloudColor * (1. + additionalLight) + directSunScattering);
46
- }`),a.fragment.code.add(t`vec4 getCloudData(vec3 rayDir)
44
+ }`),t.fragment.code.add(o`vec4 getCloudData(vec3 rayDir)
47
45
  {
48
46
  vec4 cloudData = textureCube(cubeMap, rayDir);
49
47
  float mu = dot(rayDir, vec3(0, 0, 1));
50
48
  return mix(vec4(vec3(clamp(1.0 - cloudVariables.y, 0.6, 1.0)), 0.0), cloudData, smoothstep(-0.01, mix(0.0, 0.075, cloudVariables.x), abs(mu)));
51
- }`),a.fragment.code.add(t`vec4 renderCloud(vec3 worldRay)
49
+ }`),t.fragment.code.add(o`vec4 renderCloud(vec3 worldRay, vec3 position)
52
50
  {
53
- vec3 intersectionPoint = intersectWithCloudLayer(normalize(worldRay), cameraPosition, anchorPosition, 0.0);
51
+ vec3 intersectionPoint = intersectWithCloudLayer(normalize(worldRay), position, anchorPosition, 0.0);
54
52
  vec3 worldRayRotated = rotateDirectionToAnchorPoint(rotationMatrixClouds, normalize(intersectionPoint));
55
53
  vec3 worldRayRotatedCorrected = correctForPlanetCurvature(worldRayRotated);
56
54
  vec4 cloudData = getCloudData(worldRayRotatedCorrected);
@@ -59,14 +57,14 @@ if (length(cloudData.rgb) == 0.0) {
59
57
  totalTransmittance = 1.0;
60
58
  }
61
59
  return vec4(calculateCloudColor(normalize(-worldRay), cloudData), totalTransmittance);
62
- }`),a.fragment.code.add(t`vec4 renderCloudCrossFade(vec3 worldRay)
60
+ }`),t.fragment.code.add(o`vec4 renderCloudCrossFade(vec3 worldRay, vec3 position)
63
61
  {
64
- vec3 intersectionPoint = intersectWithCloudLayer(normalize(worldRay), cameraPosition, anchorPosition, 0.0);
62
+ vec3 intersectionPoint = intersectWithCloudLayer(normalize(worldRay), position, anchorPosition, 0.0);
65
63
  vec3 worldRayRotated = rotateDirectionToAnchorPoint(rotationMatrixClouds, normalize(intersectionPoint));
66
64
  vec3 worldRayRotatedCorrected = correctForPlanetCurvature(worldRayRotated);
67
65
  vec4 cloudData = getCloudData(worldRayRotatedCorrected);
68
66
  vec4 cloudColor = vec4(calculateCloudColor(normalize(-worldRay), cloudData), cloudData.a);
69
- intersectionPoint = intersectWithCloudLayer(normalize(worldRay), cameraPosition, anchorPositionCrossFade, 0.0);
67
+ intersectionPoint = intersectWithCloudLayer(normalize(worldRay), position, anchorPositionCrossFade, 0.0);
70
68
  worldRayRotated = rotateDirectionToAnchorPoint(rotationMatrixCloudsCrossFade, normalize(intersectionPoint));
71
69
  worldRayRotatedCorrected = correctForPlanetCurvature(worldRayRotated);
72
70
  cloudData = getCloudData(worldRayRotatedCorrected);
@@ -77,4 +75,4 @@ if (length(cloudColor.rgb) == 0.0) {
77
75
  totalTransmittance = 1.0;
78
76
  }
79
77
  return vec4(cloudColor.rgb, totalTransmittance);
80
- }`)}export{a as CloudsParallaxShading};
78
+ }`)}export{t as CloudsParallaxShading};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/maybe.js";import{TransparencyPassType as t}from"./basicInterfaces.js";import{RenderTargetHelper as r}from"./RenderTargetHelper.js";import{C as i}from"../../../../chunks/Compositing.glsl.js";import{AlphaMode as o}from"../shaders/CompositingTechnique.js";import{ContextType as s}from"../../../webgl/context-util.js";import{PixelType as a,PixelFormat as h,TextureSamplingMode as n,ClearBufferBit as l}from"../../../webgl/enums.js";class g{constructor(e,t){this._rctx=e,this._compositingHelper=t,this._mainColorTarget=0,this._dimensions={width:4,height:4},this._needLastFrameColorTexture=!1,this._background={type:"color",color:[0,0,0,1]};const i=e.type===s.WEBGL2;this._renderTargetHelper=new r(e);const o=this._renderTargetHelper;this.mainColorTargets=[o.registerColorTarget({name:"mainColorTarget0"}),o.registerColorTarget({name:"mainColorTarget1"})],this.frontFaceTarget=o.registerColorTarget({name:"frontFaceTarget"});const l=e=>o.registerColorTarget({name:e,dataType:a.FLOAT,internalFormat:i?h.RGBA32F:h.RGBA,samplingMode:n.NEAREST});this.colorFloatTarget=l("colorFloatTarget"),this.alphaFloatTarget=l("alphaFloatTarget"),this.mainDepth=o.registerDepthTarget({name:"mainDepth"}),this.linearDepth=o.registerColorTarget({name:"linearDepth",samplingMode:n.NEAREST}),this.terrainLinearDepth=o.registerColorTarget({name:"terrainLinearDepth"}),this.geometryLinearDepth=o.registerColorTarget({name:"geometryLinearDepth"}),this.normal=o.registerColorTarget({name:"normal"}),this.highlight=o.registerColorTarget({name:"highlight",internalFormat:i?h.RGBA4:h.RGBA,dataType:a.UNSIGNED_SHORT_4_4_4_4}),this.hudVisibility=o.registerColorTarget({name:"hudVisibility",internalFormat:i?h.RGBA4:h.RGBA,dataType:a.UNSIGNED_SHORT_4_4_4_4}),this.tmpColor=o.registerColorTarget({name:"tmpColor"}),this.tmpDepth=o.registerDepthTarget({name:"tmpDepth"}),this.hudColor=o.registerColorTarget({name:"hudColor"})}dispose(){this._renderTargetHelper.dispose()}get width(){return this._dimensions.width}get height(){return this._dimensions.height}set background(e){this._background=e}get background(){return this._background}get currentColorTarget(){return this.mainColorTargets[this._mainColorTarget]}get previousColorTarget(){return this.mainColorTargets[1-this._mainColorTarget]}get framebuffer(){return this.getFramebuffer(this.currentColorTarget,this.mainDepth)}getFramebuffer(e,t){return this._renderTargetHelper.getFramebuffer(this._dimensions,e,t)}get colorTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.currentColorTarget)}get depthTexture(){return this._renderTargetHelper.getAllocatedDepthTexture(this.mainDepth)}get linearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.linearDepth)}get terrainLinearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.terrainLinearDepth)}get geometryLinearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.geometryLinearDepth)}get lastFrameColorTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.previousColorTarget)}get normalTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.normal)}get highlightTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.highlight)}get hudVisibilityTexture(){return this._getColorTexture(this.hudVisibility)}get tmpColorTexture(){return this._getColorTexture(this.tmpColor)}get hudColorTexture(){return this._getColorTexture(this.hudColor)}get mainColorTexture(){return this._getColorTexture(this.currentColorTarget)}advanceCurrentRenderTarget(){this._mainColorTarget=0===this._mainColorTarget&&this._needLastFrameColorTexture?1:0}initializeFrame(e){const t=this._rctx;this._dimensions.width=e.fullWidth,this._dimensions.height=e.fullHeight,this.bindTarget(this.currentColorTarget,this.mainDepth),t.setClearStencil(0);const r=this._background.color;t.setClearColor(r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]),t.clearSafe(l.COLOR_BUFFER_BIT|l.DEPTH_BUFFER_BIT|l.STENCIL_BUFFER_BIT)}composite(){e(this.colorTexture)&&this._compositingHelper.composite(this.colorTexture,o.None)}renderTmpAndCompositeToMain(e,t,r=!1){this.renderToTargets(e,this.tmpColor,r?this.tmpDepth:this.mainDepth,T),this._compositingHelper.composite(this._getColorTexture(this.tmpColor),t)}renderHUDVisibility(e,t=!1){this.renderToTargets(e,this.hudVisibility,t?this.tmpDepth:this.mainDepth,m)}compositeTransparentTerrainOntoHUDVisibility(){this.renderToTargets((()=>this._compositingHelper.composite(this._getColorTexture(this.tmpColor),o.None,1,i.TransparentToHUDVisibility)),this.hudVisibility,this.tmpDepth)}renderOITPass(e,r,i){let o,s;switch(r){case t.Color:o=this.colorFloatTarget,s=[0,0,0,0];break;case t.Alpha:o=this.alphaFloatTarget,s=[1,1,1,1];break;case t.FrontFace:o=this.frontFaceTarget,s=[0,0,0,0]}i?this.renderToTargets(e,o,this.tmpDepth,s,!0,!0):this.renderToTargets(e,o,this.mainDepth,s,!1)}compositeTransparentTerrainOntoMain(){this.bindFramebuffer(),this._compositingHelper.composite(this._getColorTexture(this.tmpColor),o.PremultipliedAlpha)}compositeOccludedOntoMain(e){this.bindFramebuffer(),this._compositingHelper.composite(this._getColorTexture(this.tmpColor),o.PremultipliedAlpha,e)}compositeTransparentOntoOpaque(e){e?(this.bindTarget(this.hudColor,this.tmpDepth),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clearSafe(l.COLOR_BUFFER_BIT)):this.bindFramebuffer(),this._compositingHelper.compositeTransparent(this._getColorTexture(this.colorFloatTarget),this._getColorTexture(this.alphaFloatTarget),this._getColorTexture(this.frontFaceTarget))}bindFramebuffer(){this._rctx.bindFramebuffer(this.framebuffer)}renderDepthDetached(e){this.bindTarget(this.currentColorTarget),e(),this.bindTarget(this.currentColorTarget,this.mainDepth)}disposeTarget(e){this._renderTargetHelper.disposeTargetResource(e)}set needLastFrameColorTexture(e){!e&&this._needLastFrameColorTexture&&(this._mainColorTarget=0,this.disposeTarget(this.mainColorTargets[1])),this._needLastFrameColorTexture=e}get needLastFrameColorTexture(){return this._needLastFrameColorTexture}renderToTargets(e,t,r,i,o=!1,s=!1){const a=this._rctx,h=this.bindTarget(t,r);let n=0;if(i){const e=1e-13,t=Math.max(e,i[3]);a.setClearColor(i[0],i[1],i[2],t),n|=l.COLOR_BUFFER_BIT}return o&&(n|=l.DEPTH_BUFFER_BIT),!1===s?s=0:(!0===s&&(s=255),n|=l.STENCIL_BUFFER_BIT),n&&a.clearSafe(n,s),e(),a.gl.flush(),this.bindTarget(this.currentColorTarget,this.mainDepth),h}bindTarget(e,t){const r=this._renderTargetHelper.getFramebuffer(this._dimensions,e,t);return this._rctx.bindFramebuffer(r),r}_getColorTexture(e){return this._renderTargetHelper.getColorTexture(e,this._dimensions)}get gpuMemoryUsage(){let e=0;return this._renderTargetHelper&&(e+=this._renderTargetHelper.gpuMemoryUsage),e}}const T=[0,0,0,0],m=[0,1,0,1];export{g as OffscreenRendering};
5
+ import{isSome as e}from"../../../../core/maybe.js";import{TransparencyPassType as t}from"./basicInterfaces.js";import{RenderTargetHelper as r}from"./RenderTargetHelper.js";import{C as i}from"../../../../chunks/Compositing.glsl.js";import{AlphaMode as o}from"../shaders/CompositingTechnique.js";import{ContextType as s}from"../../../webgl/context-util.js";import{PixelType as a,SizedPixelFormat as h,PixelFormat as n,TextureSamplingMode as l,ClearBufferBit as g}from"../../../webgl/enums.js";class T{constructor(e,t){this._rctx=e,this._compositingHelper=t,this._mainColorTarget=0,this._dimensions={width:4,height:4},this._needLastFrameColorTexture=!1,this._background={type:"color",color:[0,0,0,1]};const i=e.type===s.WEBGL2;this._renderTargetHelper=new r(e);const o=this._renderTargetHelper;this.mainColorTargets=[o.registerColorTarget({name:"mainColorTarget0"}),o.registerColorTarget({name:"mainColorTarget1"})],this.frontFaceTarget=o.registerColorTarget({name:"frontFaceTarget"});const g=e=>o.registerColorTarget({name:e,dataType:a.FLOAT,internalFormat:i?h.RGBA32F:n.RGBA,samplingMode:l.NEAREST});this.colorFloatTarget=g("colorFloatTarget"),this.alphaFloatTarget=g("alphaFloatTarget"),this.mainDepth=o.registerDepthTarget({name:"mainDepth"}),this.linearDepth=o.registerColorTarget({name:"linearDepth",samplingMode:l.NEAREST}),this.terrainLinearDepth=o.registerColorTarget({name:"terrainLinearDepth"}),this.geometryLinearDepth=o.registerColorTarget({name:"geometryLinearDepth"}),this.normal=o.registerColorTarget({name:"normal"}),this.highlight=o.registerColorTarget({name:"highlight",internalFormat:i?h.RGBA4:n.RGBA,dataType:a.UNSIGNED_SHORT_4_4_4_4}),this.hudVisibility=o.registerColorTarget({name:"hudVisibility",internalFormat:i?h.RGBA4:n.RGBA,dataType:a.UNSIGNED_SHORT_4_4_4_4}),this.tmpColor=o.registerColorTarget({name:"tmpColor"}),this.tmpDepth=o.registerDepthTarget({name:"tmpDepth"}),this.hudColor=o.registerColorTarget({name:"hudColor"})}dispose(){this._renderTargetHelper.dispose()}get width(){return this._dimensions.width}get height(){return this._dimensions.height}set background(e){this._background=e}get background(){return this._background}get currentColorTarget(){return this.mainColorTargets[this._mainColorTarget]}get previousColorTarget(){return this.mainColorTargets[1-this._mainColorTarget]}get framebuffer(){return this.getFramebuffer(this.currentColorTarget,this.mainDepth)}getFramebuffer(e,t){return this._renderTargetHelper.getFramebuffer(this._dimensions,e,t)}get colorTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.currentColorTarget)}get depthTexture(){return this._renderTargetHelper.getAllocatedDepthTexture(this.mainDepth)}get linearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.linearDepth)}get terrainLinearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.terrainLinearDepth)}get geometryLinearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.geometryLinearDepth)}get lastFrameColorTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.previousColorTarget)}get normalTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.normal)}get highlightTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.highlight)}get hudVisibilityTexture(){return this._getColorTexture(this.hudVisibility)}get tmpColorTexture(){return this._getColorTexture(this.tmpColor)}get hudColorTexture(){return this._getColorTexture(this.hudColor)}get mainColorTexture(){return this._getColorTexture(this.currentColorTarget)}advanceCurrentRenderTarget(){this._mainColorTarget=0===this._mainColorTarget&&this._needLastFrameColorTexture?1:0}initializeFrame(e){const t=this._rctx;this._dimensions.width=e.fullWidth,this._dimensions.height=e.fullHeight,this.bindTarget(this.currentColorTarget,this.mainDepth),t.setClearStencil(0);const r=this._background.color;t.setClearColor(r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]),t.clearSafe(g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT|g.STENCIL_BUFFER_BIT)}composite(){e(this.colorTexture)&&this._compositingHelper.composite(this.colorTexture,o.None)}renderTmpAndCompositeToMain(e,t,r=!1){this.renderToTargets(e,this.tmpColor,r?this.tmpDepth:this.mainDepth,m),this._compositingHelper.composite(this._getColorTexture(this.tmpColor),t)}renderHUDVisibility(e,t=!1){this.renderToTargets(e,this.hudVisibility,t?this.tmpDepth:this.mainDepth,p)}compositeTransparentTerrainOntoHUDVisibility(){this.renderToTargets((()=>this._compositingHelper.composite(this._getColorTexture(this.tmpColor),o.None,1,i.TransparentToHUDVisibility)),this.hudVisibility,this.tmpDepth)}renderOITPass(e,r,i){let o,s;switch(r){case t.Color:o=this.colorFloatTarget,s=[0,0,0,0];break;case t.Alpha:o=this.alphaFloatTarget,s=[1,1,1,1];break;case t.FrontFace:o=this.frontFaceTarget,s=[0,0,0,0]}i?this.renderToTargets(e,o,this.tmpDepth,s,!0,!0):this.renderToTargets(e,o,this.mainDepth,s,!1)}compositeTransparentTerrainOntoMain(){this.bindFramebuffer(),this._compositingHelper.composite(this._getColorTexture(this.tmpColor),o.PremultipliedAlpha)}compositeOccludedOntoMain(e){this.bindFramebuffer(),this._compositingHelper.composite(this._getColorTexture(this.tmpColor),o.PremultipliedAlpha,e)}compositeTransparentOntoOpaque(e){e?(this.bindTarget(this.hudColor,this.tmpDepth),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clearSafe(g.COLOR_BUFFER_BIT)):this.bindFramebuffer(),this._compositingHelper.compositeTransparent(this._getColorTexture(this.colorFloatTarget),this._getColorTexture(this.alphaFloatTarget),this._getColorTexture(this.frontFaceTarget))}bindFramebuffer(){this._rctx.bindFramebuffer(this.framebuffer)}renderDepthDetached(e){this.bindTarget(this.currentColorTarget),e(),this.bindTarget(this.currentColorTarget,this.mainDepth)}disposeTarget(e){this._renderTargetHelper.disposeTargetResource(e)}set needLastFrameColorTexture(e){!e&&this._needLastFrameColorTexture&&(this._mainColorTarget=0,this.disposeTarget(this.mainColorTargets[1])),this._needLastFrameColorTexture=e}get needLastFrameColorTexture(){return this._needLastFrameColorTexture}renderToTargets(e,t,r,i,o=!1,s=!1){const a=this._rctx,h=this.bindTarget(t,r);let n=0;if(i){const e=1e-13,t=Math.max(e,i[3]);a.setClearColor(i[0],i[1],i[2],t),n|=g.COLOR_BUFFER_BIT}return o&&(n|=g.DEPTH_BUFFER_BIT),!1===s?s=0:(!0===s&&(s=255),n|=g.STENCIL_BUFFER_BIT),n&&a.clearSafe(n,s),e(),a.gl.flush(),this.bindTarget(this.currentColorTarget,this.mainDepth),h}bindTarget(e,t){const r=this._renderTargetHelper.getFramebuffer(this._dimensions,e,t);return this._rctx.bindFramebuffer(r),r}_getColorTexture(e){return this._renderTargetHelper.getColorTexture(e,this._dimensions)}get gpuMemoryUsage(){let e=0;return this._renderTargetHelper&&(e+=this._renderTargetHelper.gpuMemoryUsage),e}}const m=[0,0,0,0],p=[0,1,0,1];export{T as OffscreenRendering};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as t,isSome as r,unwrapOr as i}from"../../../../core/maybe.js";import{generateUID as s}from"../../../../core/uid.js";import{c as a}from"../../../../chunks/mat4.js";import{c as n,I as e}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec4f64.js";import{maxScale as m}from"../../support/mathUtils.js";import{VertexAttribute as f,Object3DState as c}from"./basicInterfaces.js";import{computeAttachmentOriginTriangles as d}from"./geometryDataUtils.js";import{InstanceParameters as u}from"./InstanceParameters.js";import{Object3DStateID as g}from"./Object3DStateID.js";import{addObject3DStateID as l,removeObject3DStateID as p}from"../materials/renderers/utils.js";class T{constructor(t,r,i=null,a=null,e=s(),o=null,m=null,f=!1){this.data=t,this.material=r,this.layerUid=i,this.graphicUid=a,this.id=e,this.boundingInfo=o,this.calculateShaderTransformation=m,this.castShadow=f,this.boundingSphere=h(),this.instanceParameters=new u,this._transformation=n(),this._shaderTransformationDirty=!0}get transformation(){return this._transformation}updateTransformation(t){t(this._transformation),this._shaderTransformationDirty=!0,this.computeBoundingSphere(this._transformation,this.boundingSphere)}shaderTransformationChanged(){this._shaderTransformationDirty=!0}computeBoundingSphere(r,i,s=m(r)){t(this.boundingInfo)||(o(i,this.boundingInfo.getCenter(),r),i[3]=this.boundingInfo.getBSRadius()*s)}get hasShaderTransformation(){return r(this.calculateShaderTransformation)}get primitiveType(){return this.data.primitiveType}getShaderTransformation(){return t(this.calculateShaderTransformation)?i(this.transformation,e):(this._shaderTransformationDirty&&(this._shaderTransformation||(this._shaderTransformation=n()),a(this._shaderTransformation,this.calculateShaderTransformation(i(this.transformation,e))),this._shaderTransformationDirty=!1),this._shaderTransformation)}computeAttachmentOrigin(t){if(this.material.computeAttachmentOrigin)return!!this.material.computeAttachmentOrigin(this,t)&&(r(this._transformation)&&o(t,t,this._transformation),!0);const i=this.indices.get(f.POSITION),s=this.vertexAttributes.get(f.POSITION);return!!d(s,i,t)&&(r(this._transformation)&&o(t,t,this._transformation),!0)}get indices(){return this.data.indices}get vertexAttributes(){return this.data.vertexAttributes}addHighlight(){const t=new g(c.Highlight),r=this.instanceParameters;return r.highlights=l(r.highlights,t),t}removeHighlight(t){const r=this.instanceParameters;r.highlights=p(r.highlights,t)}}class _ extends T{}export{T as RenderGeometry,_ as ValidatedRenderGeometry};
5
+ import{unwrapOr as t,isNone as r,isSome as i}from"../../../../core/maybe.js";import{generateUID as s}from"../../../../core/uid.js";import{c as a}from"../../../../chunks/mat4.js";import{c as n,I as e}from"../../../../chunks/mat4f64.js";import{m as o}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec4f64.js";import{maxScale as m}from"../../support/mathUtils.js";import{VertexAttribute as c,Object3DState as d}from"./basicInterfaces.js";import{computeAttachmentOriginTriangles as f}from"./geometryDataUtils.js";import{InstanceParameters as u}from"./InstanceParameters.js";import{Object3DStateID as g}from"./Object3DStateID.js";import{addObject3DStateID as l,removeObject3DStateID as p}from"../materials/renderers/utils.js";class T{constructor(r,i,a={}){this.data=r,this.material=i,this.boundingSphere=h(),this.instanceParameters=new u,this._transformation=n(),this._shaderTransformationDirty=!0,this.layerUid=t(a.layerUid,null),this.graphicUid=t(a.graphicUid,null),this.id=a.id?a.id:s(),this.boundingInfo=t(a.boundingInfo,null),this.calculateShaderTransformation=t(this.calculateShaderTransformation,null),this.castShadow=!!a.castShadow&&a.castShadow}get transformation(){return this._transformation}updateTransformation(t){t(this._transformation),this._shaderTransformationDirty=!0,this.computeBoundingSphere(this._transformation,this.boundingSphere)}shaderTransformationChanged(){this._shaderTransformationDirty=!0}computeBoundingSphere(t,i,s=m(t)){r(this.boundingInfo)||(o(i,this.boundingInfo.getCenter(),t),i[3]=this.boundingInfo.getBSRadius()*s)}get hasShaderTransformation(){return i(this.calculateShaderTransformation)}get primitiveType(){return this.data.primitiveType}getShaderTransformation(){return r(this.calculateShaderTransformation)?t(this.transformation,e):(this._shaderTransformationDirty&&(this._shaderTransformation||(this._shaderTransformation=n()),a(this._shaderTransformation,this.calculateShaderTransformation(t(this.transformation,e))),this._shaderTransformationDirty=!1),this._shaderTransformation)}computeAttachmentOrigin(t){if(this.material.computeAttachmentOrigin)return!!this.material.computeAttachmentOrigin(this,t)&&(i(this._transformation)&&o(t,t,this._transformation),!0);const r=this.indices.get(c.POSITION),s=this.vertexAttributes.get(c.POSITION);return!!f(s,r,t)&&(i(this._transformation)&&o(t,t,this._transformation),!0)}get indices(){return this.data.indices}get vertexAttributes(){return this.data.vertexAttributes}addHighlight(){const t=new g(d.Highlight),r=this.instanceParameters;return r.highlights=l(r.highlights,t),t}removeHighlight(t){const r=this.instanceParameters;r.highlights=p(r.highlights,t)}}class S extends T{}export{T as RenderGeometry,S as ValidatedRenderGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{someMap as s}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as i,isSome as a,isNone as h,unwrap as o}from"../../../../core/maybe.js";import{Milliseconds as d}from"../../../../core/time.js";import{init as l}from"../../../../core/watchUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{v as c,j as m,a as u,m as g}from"../../../../chunks/mat4.js";import{I as f,c as T}from"../../../../chunks/mat4f64.js";import{a as R}from"../../../../chunks/vec2f64.js";import{MAXIMUM_ANIMATION_LOAD as E,MINIMUM_IDLE_ANIMATION_MS as A}from"../../support/animationUtils.js";import x from"../../support/debugFlags.js";import{RenderPassManager as C}from"../core/renderPasses/RenderPassManager.js";import{HUDTransparentRenderStyle as P}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AntiAliasingMode as b,TransparencyPassType as w,Decorations as S,RenderRequestType as H,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as O,union as L}from"./depthRange.js";import{depthRangeFromScene as I}from"./depthRangeUtils.js";import{createEmptyDepthTexture as y}from"./glUtil3D.js";import N from"./HighlightHelper.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as j}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as q}from"./rendererUtils.js";import{RenderPass as G}from"./RenderPass.js";import{RenderPluginManager as F}from"./RenderPluginManager.js";import{RenderSlot as V}from"./RenderSlot.js";import{ShadowAccumulator as B}from"./ShadowAccumulator.js";import{ShadowHighlightHelper as k}from"./ShadowHighlightHelper.js";import W from"./ShadowMap.js";import Q from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as X}from"./SSAOHelper.js";import{EdgeView as K}from"./edgeRendering/EdgeView.js";import{Transparency as Y}from"./edgeRendering/interfaces.js";import{SceneLighting as J}from"../lighting/SceneLighting.js";import{MergedRenderer as Z}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as $}from"../shaders/CompositingTechnique.js";import{HighlightShadowMapSlot as ee,DefaultSnapshotSlot as re}from"../shaders/ShadowHighlightTechnique.js";import{RendererPerformanceInfo as te,Statistics as se}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ie,PixelType as ae}from"../../../webgl/enums.js";import{startMeasurement as he}from"../../../webgl/Measurement.js";const oe=.9;let de=class extends r{constructor(e,r,s,n,i,a,h,o,_){super({}),this._materialRepository=e,this._shaderTechniqueRepository=s,this._rctx=n,this._compositingHelper=i,this._magnifierHelper=a,this._requestRender=h,this._stage=_,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasOccludees=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new te,this._antialiasing=b.SMAA,this._oitEnabled=!1,this._multipassTerrain=!0,this._opaqueTerrain=!0,this._lighting=new J,this._hasAnimations=!1,this._animationTimestep=d(0),this._handles=new t,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,s),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new U(this._rctx,this._compositingHelper),this._sliceHelper=new Q,this._shadowMap=new W(this._rctx,_.viewingMode,2),this._ssaoHelper=new X(s,this._rctx,(()=>this._requestRender())),this._highlightHelper=new N(s,this._rctx),this._shadowHighlightHelper=new k(this._rctx,_.viewingMode),this._shadowAccumulator=new B(this._rctx,s,_,((e,r)=>{this.renderPassManager.shadowCastingEnabled=!0,this._renderPlugins.prepareRender(e,r),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled}),((e,r,t,s)=>{e.start(t,r,s),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL,e),t.setGLViewport(this._rctx),this._ensureCameraBindParameters(t)}),(()=>this._requestRender())),this._bindParameters={slot:null,camera:null,inverseViewport:R(),shadowMap:this._shadowMap,shadowMappingEnabled:this._shadowMap.enabled,ssaoHelper:this._ssaoHelper,ssaoEnabled:this._ssaoHelper.enabled,origin:null,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:this._sliceHelper.plane,highlightDepthTexture:null,hasOccludees:!1,linearDepthTexture:null,terrainLinearDepthTexture:null,geometryLinearDepthTexture:null,multipassTerrainEnabled:!1,multipassGeometryEnabled:!1,cullAboveGround:!1,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1,lighting:this._lighting,highlightColorTexture:null},this._renderContext=new j(this._rctx,this._offscreenRendering,this._lighting,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderContext.multipassTerrainParams={camera:null,multipassTerrainEnabled:!1,cullAboveGround:!1,terrainLinearDepthTexture:null},this._renderContext.multipassGeometryParams={multipassGeometryEnabled:!1,geometryLinearDepthTexture:null},this._renderContext.ssrParams={camera:null,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1},this._renderPlugins=new F({renderContext:this._renderContext,shaderTechniqueRep:s,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:o}),this.renderPassManager=new C(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l(x,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Y.TRANSPARENT):()=>{},this._requestRender()})),l(this._stage,"camera",(()=>this._requestRender()),!0)])}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=i(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlightHelper.dispose(),this._shadowHighlightHelper.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing===b.SMAA&&this._smaaPass.updating||a(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return h(this._edgeView)&&(this._edgeView=new K({rctx:this._rctx,renderSR:this._stage.renderSR,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(this._edgeView.watch("updating",(()=>this._requestRender()),!0)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return null===this._bindParameters.reprojectionMatrix||c(this._bindParameters.reprojectionMatrix,f)}set _reprojectionMatrix(e){c(this._bindParameters.reprojectionMatrix,e)||(this._bindParameters.reprojectionMatrix=e,this.notifyChange("isCameraFinal"))}get hasShadowsEnabled(){var e;return!(null==(e=this._shadowMap)||!e.enabled)}setRenderParameters(e){const{renderPassManager:r,_shadowMap:t,_ssaoHelper:s}=this;void 0!==e.screenSpaceReflectionsEnabled&&r.screenSpaceReflectionsEnabled!==e.screenSpaceReflectionsEnabled&&(r.screenSpaceReflectionsEnabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0===e.shadowMap||t.enabled===e.shadowMap&&r.shadowCastingEnabled===e.shadowMap||(t.enabled=e.shadowMap,r.shadowCastingEnabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),void 0!==e.ssao&&s.enabled!==e.ssao&&(s.enabled=e.ssao,this._requestRender()),e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender());const n=e.antialiasingEnabled?b.SMAA:b.NONE;void 0!==e.antialiasingEnabled&&this._antialiasing!==n&&(this._antialiasing=n,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=o(e.slicePlane),this._requestRender()),void 0!==e.waterReflectionEnabled&&this._waterReflectionEnabled!==e.waterReflectionEnabled&&(this._waterReflectionEnabled=e.waterReflectionEnabled,this._requestRender()),void 0!==e.opaqueTerrain&&this._opaqueTerrain!==e.opaqueTerrain&&(this._opaqueTerrain=e.opaqueTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:n}=e;if(0===r.length&&0===t.length&&0===n.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const i=q(e);let a=!1;i.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new Z(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=s(this._materialRenderers,(e=>e.hasHighlights)),this._hasOccludees=s(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=s(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=s(this._materialRenderers,(e=>e.requiresSlot(V.TRANSPARENT_MATERIAL,G.MATERIAL))),this._hasHUDElements=s(this._materialRenderers,(e=>e.requiresSlot(V.LINE_CALLOUTS_HUD_DEPTH,G.MATERIAL)||e.requiresSlot(V.HUD_MATERIAL,G.MATERIAL)||e.requiresSlot(V.LABEL_MATERIAL,G.MATERIAL))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._lighting.groundLightingFactor=r,this._lighting.globalFactor=t,this._lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.lighting=this._lighting,this._renderContext.hasOccludees=this._hasOccludees,this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=w.NONE;const n=this._offscreenRendering;n.needLastFrameColorTexture=this.hasWaterReflection,n.advanceCurrentRenderTarget();const i=this._sliceHelper.plane;s===S.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this.needsShadowCast&&(this.renderPassManager.shadowCastingEnabled=!0),this._renderPlugins.prepareRender(r,t),this.performanceInfo.advance(se.Prepare);const o=this._computeDepthRange(r);this._renderShadowMap(e,r,this._lighting.lightingMainDirection,o),this.performanceInfo.advance(se.Shadowmap),n.initializeFrame(r),this._ensureBindParameters(r),this._renderLinearDepth(),this.performanceInfo.advance(se.Lineardepth),this._accumulateShadows(o,r,t),this._renderNormal(),this.performanceInfo.advance(se.Normals),this._ensureBindParametersSSR(),this._ssaoHelper.computeSSAO(r,n.linearDepthTexture,n.normalTexture),this.performanceInfo.advance(se.SSAO),this._renderContext.pass=G.MATERIAL,n.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.Opaque);const d=this._multipassTerrain&&!this._opaqueTerrain;this._renderTerrainLinearDepth(d),this._setMultipassFlags(d),this._setTerrainCulling(d),this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),this._renderHiddenTransparentEdges();const l=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderGeometryLinearDepth(d);const _=this._renderHUDVisibility();d||this._renderInternalSlot(V.LINE_CALLOUTS),this.performanceInfo.advance(se.Hudvisibility),this._renderEdges(Y.TRANSPARENT,d),this.performanceInfo.advance(se.TransparentEdges),this._renderSlot(V.VOXEL),this._renderTransparentTerrain(),!this._opaqueTerrain&&_&&(d?this._renderLineCallouts(P.OCCLUDED):n.compositeTransparentTerrainOntoHUDVisibility(),this._renderHUD(P.OCCLUDED,n.framebuffer),this.performanceInfo.advance(se.HudOccluded)),this.performanceInfo.advance(se.TransparentTerrain),this._setTerrainCulling(!1),this._opaqueTerrain||(n.compositeTransparentTerrainOntoMain(),d&&(this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderEdges(Y.TRANSPARENT),this.performanceInfo.advance(se.TransparentEdges))),d&&this._renderLineCallouts(P.NOTOCCLUDED),this._setMultipassFlags(!1),this._shadowAccumulator.render(),n.renderToTargets((()=>{this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(V.LASERLINES)}),n.currentColorTarget,n.mainDepth),this.performanceInfo.advance(se.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&n.renderTmpAndCompositeToMain((()=>this._renderSlot(V.LASERLINES_CONTRAST_CONTROL)),$.PremultipliedAlpha),this.performanceInfo.advance(se.Laserline),this._renderOccluded(),this.performanceInfo.advance(se.Occluded);const p=s===S.ON&&this._magnifierHelper.enabled,c=p&&h(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(c);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(this._antialiasing,m)&&a(m)&&this._compositingHelper.composite(m,$.None),this.performanceInfo.advance(se.Antialiasing),this._renderHUD(P.NOTOCCLUDED,c),this.performanceInfo.advance(se.HudNotoccluded),this._renderHighlights(c,this._bindParameters),this.performanceInfo.advance(se.Highlights),p&&this._magnifierHelper.render(this._rctx,this._bindParameters),c!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._offscreenRendering.tmpColorTexture,$.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._renderContext.camera),this._sliceHelper.plane=i,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=d(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/E;this._animationTimestep=d(Math.max(this._animationTimestep*oe+e*(1-oe),A))}}readDepthPixels(e,r,t,s,n,i){const a=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e),this._renderContext.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)}a.readPixels(r,t,s,n,ie.RGBA,ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassFlags(e){this._renderContext.multipassTerrainParams.multipassTerrainEnabled=this._bindParameters.multipassTerrainEnabled=e,this._renderContext.multipassGeometryParams.multipassGeometryEnabled=this._bindParameters.multipassGeometryEnabled=e}_setTerrainCulling(e){this._renderContext.multipassTerrainParams.cullAboveGround=this._bindParameters.cullAboveGround=e}_renderSlot(e){this._renderContext.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;a(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),$.Alpha,r)}_renderShadowMap(e,r,t,s){const n=this._shadowMap;n.enabled&&(n.start(r,t,s),this.needsShadowHighlight?(this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,this._shadowMap,(e=>n.takeCascadeSnapshotTo(e,ee))),n.clear(),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_DEFAULT,this._shadowMap,(e=>{n.takeCascadeSnapshotTo(e,re),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT)}))):this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL),n.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this.needsShadowHighlight||this.needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._renderContext.ssrParams.linearDepthTexture=this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_DEPTH,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._renderContext.multipassTerrainParams.terrainLinearDepthTexture=this._bindParameters.terrainLinearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.pass;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(G.MATERIAL_DEPTH)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._renderContext.multipassGeometryParams.geometryLinearDepthTexture=this._bindParameters.geometryLinearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this.needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_NORMAL)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get needsDepthRange(){return this._shadowMap.enabled||this.needsShadowCast}_computeDepthRange(e){if(!this.needsDepthRange)return O;const r=I(e,this._content,this._stage.layers);return L(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.pass=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.pass=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(V.INTEGRATED_MESH),this._renderSlot(V.OPAQUE_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL),this._renderSlot(V.OPAQUE_PLUGIN),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(V.TRANSPARENT_MATERIAL),this._renderSlot(V.TRANSPARENT_PLUGIN)}_renderTransparentTerrain(){this._renderSlot(V.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(V.OCCLUSION_PIXELS)}),this._multipassTerrain&&!this._opaqueTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===P.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(V.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(V.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._offscreenRendering.hudColorTexture,$.PremultipliedAlpha)):e===P.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(P.OCCLUDED)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(V.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(V.HUD_MATERIAL),this._renderInternalSlot(V.LABEL_MATERIAL)}get needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlightHelper.isVisible&&this.needsHighlight}_renderHighlights(e,r){if(!this.needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlightHelper,s=t.profilingCallback&&he(this._renderContext.rctx);this._renderContext.highlightDepthTexture=r.highlightDepthTexture;const n=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_HIGHLIGHT),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(P.BOTH)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=n.colorTexture,this.needsShadowHighlight&&this._shadowHighlightHelper.render(r,e),t.render(this._renderContext.camera,n,e),a(s)&&t.profilingCallback&&s.stop((e=>{t.profilingCallback&&t.profilingCallback(e)}))}get needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this.needsShadowCast&&(this._shadowAccumulator.setAccumulationDependencies(this._offscreenRendering.linearDepthTexture,e,r,t),this._shadowAccumulator.accumulateFixedSamples(),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._renderContext.transparencyPassType=t,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_ALPHA,t(w.Alpha),this._renderContext.pass=G.MATERIAL,t(w.Color),t(w.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(r),this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._renderContext.pass=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===v.OccludeAndTransparentStencil&&(e|=t.renderOccluded,pe.push(t))}));const r=this._offscreenRendering,t=(t,s,n,i,a)=>{0!=(e&s)&&(r.renderToTargets(n,r.tmpColor,r.mainDepth,[0,0,0,0],i,a),r.compositeOccludedOntoMain(t))};0!==pe.length&&(this._renderInternalSlot(V.OCCLUDER_MATERIAL,pe),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(V.TRANSPARENT_OCCLUDER_MATERIAL,pe)),!1,!1),pe.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===v.OccludeAndTransparent||t.renderOccluded===v.Transparent||t.renderOccluded===v.Opaque)&&(e|=t.renderOccluded,_e.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,s>v.Occlude&&this._renderSlot(V.OCCLUDED_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,_e),this._renderContext.resetRenderOccludedMask()};this._renderContext.pass=G.MATERIAL,t(.5,v.OccludeAndTransparent,(()=>n(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>n(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>n(v.Opaque)),!0,D.OutlineVisualElementMask),_e.length=0}_renderAntiAliasing(e,r){if(e===b.SMAA){if(this._smaaPass.enable((()=>this._requestRender()))&&a(r))return this._smaaPass.render(r),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e){this._renderContext.camera=e,this._bindParameters.camera=this._renderContext.camera,this._bindParameters.inverseViewport[0]=1/this._renderContext.camera.fullViewport[2],this._bindParameters.inverseViewport[1]=1/this._renderContext.camera.fullViewport[3]}_ensureBindParameters(e){var r;this._ensureCameraBindParameters(e);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.shadowMap=this._renderContext.shadowMap,this._bindParameters.shadowMappingEnabled=this._renderContext.shadowMap.enabled,this._bindParameters.ssaoHelper=this._renderContext.ssaoHelper,this._bindParameters.ssaoEnabled=this._renderContext.ssaoHelper.enabled,this._bindParameters.slicePlane=this._renderContext.sliceHelper.plane,this._bindParameters.hasOccludees=this._renderContext.hasOccludees,this._renderContext.multipassTerrainParams.camera=this._renderContext.camera,this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.highlightDepthTexture=null!=(r=t.depthTexture)?r:this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._renderContext.camera)?this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=f:(m(ce,this._renderContext.lastFrameCamera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),m(ue,this._renderContext.camera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),u(ue,ue),u(me,this._renderContext.camera.projectionMatrix),g(ge,ue,me),g(ge,ce,ge),g(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=ge),this._renderContext.ssrParams.camera=this._renderContext.camera,this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=null,this._renderContext.ssrParams.ssrEnabled=this._bindParameters.ssrEnabled=this.hasWaterReflection}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,a(r)?r.forEach((r=>{if(!r.shouldRender(this._renderContext))return;const s=this._materialRenderers.get(r);a(s)&&(t=s.render(e,this._renderContext.pass,this._bindParameters)||t)})):this._materialRenderers.forEach(((r,s)=>{s.shouldRender(this._renderContext)&&(t=r.render(e,this._renderContext.pass,this._bindParameters)||t)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=y(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){var e,r,t,s,n,i,a,h,o,d;return{offscreen:null!=(e=null==(r=this._offscreenRendering)?void 0:r.gpuMemoryUsage)?e:0,highlights:(null!=(t=null==(s=this._highlightHelper)?void 0:s.gpuMemoryUsage)?t:0)+(null!=(n=null==(i=this._shadowHighlightHelper)?void 0:i.gpuMemoryUsage)?n:0),shadows:null!=(a=null==(h=this._shadowMap)?void 0:h.gpuMemoryUsage)?a:0,ssao:null!=(o=null==(d=this._ssaoHelper)?void 0:d.gpuMemoryUsage)?o:0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlightHelper,lighting:this._lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{var t;switch(r){case le.Color:return e._offscreenRendering.colorTexture;case le.LinearDepth:return e._offscreenRendering.linearDepthTexture;case le.Normals:return e._offscreenRendering.normalTexture;case le.ShadowMap:return null==(t=e._shadowMap)?void 0:t.test.depthTexture;case le.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case le.Highlight:return e._offscreenRendering.highlightTexture}}}}};var le;e([_()],de.prototype,"_shadowAccumulator",void 0),e([_()],de.prototype,"_smaaPass",void 0),e([_()],de.prototype,"_antialiasing",void 0),e([_()],de.prototype,"_edgeView",void 0),e([_()],de.prototype,"updating",null),e([_()],de.prototype,"isCameraFinal",null),de=e([p("esri.views.3d.webgl-engine.lib.Renderer")],de),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(le||(le={}));const _e=[],pe=[],ce=T(),me=T(),ue=T(),ge=T();export{le as FramebufferId,de as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{someMap as s}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as i,isSome as a,isNone as h,unwrap as o}from"../../../../core/maybe.js";import{Milliseconds as d}from"../../../../core/time.js";import{init as l}from"../../../../core/watchUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{v as c,j as m,a as u,m as g}from"../../../../chunks/mat4.js";import{I as f,c as T}from"../../../../chunks/mat4f64.js";import{a as R}from"../../../../chunks/vec2f64.js";import{MAXIMUM_ANIMATION_LOAD as E,MINIMUM_IDLE_ANIMATION_MS as A}from"../../support/animationUtils.js";import C from"../../support/debugFlags.js";import{RenderPassManager as P}from"../core/renderPasses/RenderPassManager.js";import{HUDTransparentRenderStyle as x}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AntiAliasingMode as b,TransparencyPassType as w,Decorations as S,RenderRequestType as H,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as O,union as L}from"./depthRange.js";import{depthRangeFromScene as I}from"./depthRangeUtils.js";import{createEmptyDepthTexture as y}from"./glUtil3D.js";import N from"./HighlightHelper.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as j}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as q}from"./rendererUtils.js";import{RenderPass as G}from"./RenderPass.js";import{RenderPluginManager as F}from"./RenderPluginManager.js";import{RenderSlot as V}from"./RenderSlot.js";import{ShadowAccumulator as B}from"./ShadowAccumulator.js";import{ShadowHighlightHelper as k}from"./ShadowHighlightHelper.js";import W from"./ShadowMap.js";import Q from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as X}from"./SSAOHelper.js";import{EdgeView as K}from"./edgeRendering/EdgeView.js";import{Transparency as Y}from"./edgeRendering/interfaces.js";import{SceneLighting as J}from"../lighting/SceneLighting.js";import{MergedRenderer as Z}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as $}from"../shaders/CompositingTechnique.js";import{HighlightShadowMapSlot as ee,DefaultSnapshotSlot as re}from"../shaders/ShadowHighlightTechnique.js";import{RendererPerformanceInfo as te,Statistics as se}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ie,PixelType as ae}from"../../../webgl/enums.js";import{startMeasurement as he}from"../../../webgl/Measurement.js";const oe=.9;let de=class extends r{constructor(e,r,s,n,i,a,h,o,_){super({}),this._materialRepository=e,this._shaderTechniqueRepository=s,this._rctx=n,this._compositingHelper=i,this._magnifierHelper=a,this._requestRender=h,this._stage=_,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasOccludees=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new te,this._antialiasing=b.SMAA,this._oitEnabled=!1,this._multipassTerrain=!0,this._opaqueTerrain=!0,this._lighting=new J,this._hasAnimations=!1,this._animationTimestep=d(0),this._handles=new t,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,s),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new U(this._rctx,this._compositingHelper),this._sliceHelper=new Q,this._shadowMap=new W(this._rctx,_.viewingMode,2),this._ssaoHelper=new X(s,this._rctx,(()=>this._requestRender())),this._highlightHelper=new N(s,this._rctx),this._shadowHighlightHelper=new k(this._rctx,_.viewingMode),this._shadowAccumulator=new B(this._rctx,s,_,((e,r)=>{this.renderPassManager.shadowCastingEnabled=!0,this._renderPlugins.prepareRender(e,r),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled}),((e,r,t,s)=>{e.start(t,r,s),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL,e),t.setGLViewport(this._rctx),this._ensureCameraBindParameters(t)}),(()=>this._requestRender())),this._bindParameters={slot:null,camera:null,inverseViewport:R(),shadowMap:this._shadowMap,shadowMappingEnabled:this._shadowMap.enabled,ssaoHelper:this._ssaoHelper,ssaoEnabled:this._ssaoHelper.enabled,origin:null,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:this._sliceHelper.plane,highlightDepthTexture:null,hasOccludees:!1,linearDepthTexture:null,terrainLinearDepthTexture:null,geometryLinearDepthTexture:null,multipassTerrainEnabled:!1,multipassGeometryEnabled:!1,cullAboveGround:!1,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1,lighting:this._lighting,highlightColorTexture:null,cloudsCompositionParams:null},this._renderContext=new j(this._rctx,this._offscreenRendering,this._lighting,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderContext.multipassTerrainParams={camera:null,multipassTerrainEnabled:!1,cullAboveGround:!1,terrainLinearDepthTexture:null},this._renderContext.multipassGeometryParams={multipassGeometryEnabled:!1,geometryLinearDepthTexture:null},this._renderContext.ssrParams={camera:null,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1},this._renderPlugins=new F({renderContext:this._renderContext,shaderTechniqueRep:s,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:o}),this.renderPassManager=new P(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l(C,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Y.TRANSPARENT):()=>{},this._requestRender()})),l(this._stage,"camera",(()=>this._requestRender()),!0)])}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=i(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlightHelper.dispose(),this._shadowHighlightHelper.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing===b.SMAA&&this._smaaPass.updating||a(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return h(this._edgeView)&&(this._edgeView=new K({rctx:this._rctx,renderSR:this._stage.renderSR,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(this._edgeView.watch("updating",(()=>this._requestRender()),!0)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return null===this._bindParameters.reprojectionMatrix||c(this._bindParameters.reprojectionMatrix,f)}set _reprojectionMatrix(e){c(this._bindParameters.reprojectionMatrix,e)||(this._bindParameters.reprojectionMatrix=e,this.notifyChange("isCameraFinal"))}get hasShadowsEnabled(){var e;return!(null==(e=this._shadowMap)||!e.enabled)}setRenderParameters(e){const{renderPassManager:r,_shadowMap:t,_ssaoHelper:s}=this;void 0!==e.screenSpaceReflectionsEnabled&&r.screenSpaceReflectionsEnabled!==e.screenSpaceReflectionsEnabled&&(r.screenSpaceReflectionsEnabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0===e.shadowMap||t.enabled===e.shadowMap&&r.shadowCastingEnabled===e.shadowMap||(t.enabled=e.shadowMap,r.shadowCastingEnabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),void 0!==e.ssao&&s.enabled!==e.ssao&&(s.enabled=e.ssao,this._requestRender()),e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender());const n=e.antialiasingEnabled?b.SMAA:b.NONE;void 0!==e.antialiasingEnabled&&this._antialiasing!==n&&(this._antialiasing=n,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=o(e.slicePlane),this._requestRender()),void 0!==e.waterReflectionEnabled&&this._waterReflectionEnabled!==e.waterReflectionEnabled&&(this._waterReflectionEnabled=e.waterReflectionEnabled,this._requestRender()),void 0!==e.opaqueTerrain&&this._opaqueTerrain!==e.opaqueTerrain&&(this._opaqueTerrain=e.opaqueTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:n}=e;if(0===r.length&&0===t.length&&0===n.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const i=q(e);let a=!1;i.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new Z(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=s(this._materialRenderers,(e=>e.hasHighlights)),this._hasOccludees=s(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=s(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=s(this._materialRenderers,(e=>e.requiresSlot(V.TRANSPARENT_MATERIAL,G.MATERIAL))),this._hasHUDElements=s(this._materialRenderers,(e=>e.requiresSlot(V.LINE_CALLOUTS_HUD_DEPTH,G.MATERIAL)||e.requiresSlot(V.HUD_MATERIAL,G.MATERIAL)||e.requiresSlot(V.LABEL_MATERIAL,G.MATERIAL))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._lighting.groundLightingFactor=r,this._lighting.globalFactor=t,this._lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.lighting=this._lighting,this._renderContext.hasOccludees=this._hasOccludees,this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=w.NONE;const n=this._offscreenRendering;n.needLastFrameColorTexture=this.hasWaterReflection,n.advanceCurrentRenderTarget();const i=this._sliceHelper.plane;s===S.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this.needsShadowCast&&(this.renderPassManager.shadowCastingEnabled=!0),this._renderPlugins.prepareRender(r,t),this.performanceInfo.advance(se.Prepare);const o=this._computeDepthRange(r);this._renderShadowMap(e,r,this._lighting.lightingMainDirection,o),this.performanceInfo.advance(se.Shadowmap),n.initializeFrame(r),this._ensureBindParameters(r),this._renderLinearDepth(),this.performanceInfo.advance(se.Lineardepth),this._accumulateShadows(o,r,t),this._renderNormal(),this.performanceInfo.advance(se.Normals),this._ensureBindParametersSSR(),this._ensureBindParametersCloudsReflections(),this._ssaoHelper.computeSSAO(r,n.linearDepthTexture,n.normalTexture),this.performanceInfo.advance(se.SSAO),this._renderContext.pass=G.MATERIAL,n.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.Opaque);const d=this._multipassTerrain&&!this._opaqueTerrain;this._renderTerrainLinearDepth(d),this._setMultipassFlags(d),this._setTerrainCulling(d),this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),this._renderHiddenTransparentEdges();const l=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderGeometryLinearDepth(d);const _=this._renderHUDVisibility();d||this._renderInternalSlot(V.LINE_CALLOUTS),this.performanceInfo.advance(se.Hudvisibility),this._renderEdges(Y.TRANSPARENT,d),this.performanceInfo.advance(se.TransparentEdges),this._renderSlot(V.VOXEL),this._renderTransparentTerrain(),!this._opaqueTerrain&&_&&(d?this._renderLineCallouts(x.OCCLUDED):n.compositeTransparentTerrainOntoHUDVisibility(),this._renderHUD(x.OCCLUDED,n.framebuffer),this.performanceInfo.advance(se.HudOccluded)),this.performanceInfo.advance(se.TransparentTerrain),this._setTerrainCulling(!1),this._opaqueTerrain||(n.compositeTransparentTerrainOntoMain(),d&&(this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderEdges(Y.TRANSPARENT),this.performanceInfo.advance(se.TransparentEdges))),d&&this._renderLineCallouts(x.NOTOCCLUDED),this._setMultipassFlags(!1),this._shadowAccumulator.render(),n.renderToTargets((()=>{this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(V.LASERLINES)}),n.currentColorTarget,n.mainDepth),this.performanceInfo.advance(se.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&n.renderTmpAndCompositeToMain((()=>this._renderSlot(V.LASERLINES_CONTRAST_CONTROL)),$.PremultipliedAlpha),this.performanceInfo.advance(se.Laserline),this._renderOccluded(),this.performanceInfo.advance(se.Occluded);const p=s===S.ON&&this._magnifierHelper.enabled,c=p&&h(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(c);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(this._antialiasing,m)&&a(m)&&this._compositingHelper.composite(m,$.None),this.performanceInfo.advance(se.Antialiasing),this._renderHUD(x.NOTOCCLUDED,c),this.performanceInfo.advance(se.HudNotoccluded),this._renderHighlights(c,this._bindParameters),this.performanceInfo.advance(se.Highlights),p&&this._magnifierHelper.render(this._rctx,this._bindParameters),c!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._offscreenRendering.tmpColorTexture,$.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._renderContext.camera),this._sliceHelper.plane=i,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=d(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/E;this._animationTimestep=d(Math.max(this._animationTimestep*oe+e*(1-oe),A))}}readDepthPixels(e,r,t,s,n,i){const a=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e),this._renderContext.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)}a.readPixels(r,t,s,n,ie.RGBA,ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassFlags(e){this._renderContext.multipassTerrainParams.multipassTerrainEnabled=this._bindParameters.multipassTerrainEnabled=e,this._renderContext.multipassGeometryParams.multipassGeometryEnabled=this._bindParameters.multipassGeometryEnabled=e}_setTerrainCulling(e){this._renderContext.multipassTerrainParams.cullAboveGround=this._bindParameters.cullAboveGround=e}_renderSlot(e){this._renderContext.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;a(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),$.Alpha,r)}_renderShadowMap(e,r,t,s){const n=this._shadowMap;n.enabled&&(n.start(r,t,s),this.needsShadowHighlight?(this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,this._shadowMap,(e=>n.takeCascadeSnapshotTo(e,ee))),n.clear(),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_DEFAULT,this._shadowMap,(e=>{n.takeCascadeSnapshotTo(e,re),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT)}))):this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL),n.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this.needsShadowHighlight||this.needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._renderContext.ssrParams.linearDepthTexture=this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_DEPTH,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._renderContext.multipassTerrainParams.terrainLinearDepthTexture=this._bindParameters.terrainLinearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.pass;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(G.MATERIAL_DEPTH)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._renderContext.multipassGeometryParams.geometryLinearDepthTexture=this._bindParameters.geometryLinearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this.needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_NORMAL)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get needsDepthRange(){return this._shadowMap.enabled||this.needsShadowCast}_computeDepthRange(e){if(!this.needsDepthRange)return O;const r=I(e,this._content,this._stage.layers);return L(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.pass=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.pass=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(V.INTEGRATED_MESH),this._renderSlot(V.OPAQUE_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL),this._renderSlot(V.OPAQUE_PLUGIN),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(V.TRANSPARENT_MATERIAL),this._renderSlot(V.TRANSPARENT_PLUGIN)}_renderTransparentTerrain(){this._renderSlot(V.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(V.OCCLUSION_PIXELS)}),this._multipassTerrain&&!this._opaqueTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===x.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(V.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(V.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._offscreenRendering.hudColorTexture,$.PremultipliedAlpha)):e===x.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(x.OCCLUDED)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(V.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(V.HUD_MATERIAL),this._renderInternalSlot(V.LABEL_MATERIAL)}get needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlightHelper.isVisible&&this.needsHighlight}_renderHighlights(e,r){if(!this.needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlightHelper,s=t.profilingCallback&&he(this._renderContext.rctx);this._renderContext.highlightDepthTexture=r.highlightDepthTexture;const n=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_HIGHLIGHT),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(x.BOTH)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=n.colorTexture,this.needsShadowHighlight&&this._shadowHighlightHelper.render(r,e),t.render(this._renderContext.camera,n,e),a(s)&&t.profilingCallback&&s.stop((e=>{t.profilingCallback&&t.profilingCallback(e)}))}get needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this.needsShadowCast&&(this._shadowAccumulator.setAccumulationDependencies(this._offscreenRendering.linearDepthTexture,e,r,t),this._shadowAccumulator.accumulateFixedSamples(),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._renderContext.transparencyPassType=t,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_ALPHA,t(w.Alpha),this._renderContext.pass=G.MATERIAL,t(w.Color),t(w.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(r),this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._renderContext.pass=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===v.OccludeAndTransparentStencil&&(e|=t.renderOccluded,pe.push(t))}));const r=this._offscreenRendering,t=(t,s,n,i,a)=>{0!=(e&s)&&(r.renderToTargets(n,r.tmpColor,r.mainDepth,[0,0,0,0],i,a),r.compositeOccludedOntoMain(t))};0!==pe.length&&(this._renderInternalSlot(V.OCCLUDER_MATERIAL,pe),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(V.TRANSPARENT_OCCLUDER_MATERIAL,pe)),!1,!1),pe.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===v.OccludeAndTransparent||t.renderOccluded===v.Transparent||t.renderOccluded===v.Opaque)&&(e|=t.renderOccluded,_e.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,s>v.Occlude&&this._renderSlot(V.OCCLUDED_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,_e),this._renderContext.resetRenderOccludedMask()};this._renderContext.pass=G.MATERIAL,t(.5,v.OccludeAndTransparent,(()=>n(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>n(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>n(v.Opaque)),!0,D.OutlineVisualElementMask),_e.length=0}_renderAntiAliasing(e,r){if(e===b.SMAA){if(this._smaaPass.enable((()=>this._requestRender()))&&a(r))return this._smaaPass.render(r),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e){this._renderContext.camera=e,this._bindParameters.camera=this._renderContext.camera,this._bindParameters.inverseViewport[0]=1/this._renderContext.camera.fullViewport[2],this._bindParameters.inverseViewport[1]=1/this._renderContext.camera.fullViewport[3]}_ensureBindParameters(e){var r;this._ensureCameraBindParameters(e);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.shadowMap=this._renderContext.shadowMap,this._bindParameters.shadowMappingEnabled=this._renderContext.shadowMap.enabled,this._bindParameters.ssaoHelper=this._renderContext.ssaoHelper,this._bindParameters.ssaoEnabled=this._renderContext.ssaoHelper.enabled,this._bindParameters.slicePlane=this._renderContext.sliceHelper.plane,this._bindParameters.hasOccludees=this._renderContext.hasOccludees,this._renderContext.multipassTerrainParams.camera=this._renderContext.camera,this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.highlightDepthTexture=null!=(r=t.depthTexture)?r:this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._renderContext.camera)?this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=f:(m(ce,this._renderContext.lastFrameCamera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),m(ue,this._renderContext.camera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),u(ue,ue),u(me,this._renderContext.camera.projectionMatrix),g(ge,ue,me),g(ge,ce,ge),g(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=ge),this._renderContext.ssrParams.camera=this._renderContext.camera,this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=null,this._renderContext.ssrParams.ssrEnabled=this._bindParameters.ssrEnabled=this.hasWaterReflection}_ensureBindParametersCloudsReflections(){this._bindParameters.cloudsCompositionParams=this._renderContext.cloudsCompositionParams}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,a(r)?r.forEach((r=>{if(!r.shouldRender(this._renderContext))return;const s=this._materialRenderers.get(r);a(s)&&(t=s.render(e,this._renderContext.pass,this._bindParameters)||t)})):this._materialRenderers.forEach(((r,s)=>{s.shouldRender(this._renderContext)&&(t=r.render(e,this._renderContext.pass,this._bindParameters)||t)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=y(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){var e,r,t,s,n,i,a,h,o,d;return{offscreen:null!=(e=null==(r=this._offscreenRendering)?void 0:r.gpuMemoryUsage)?e:0,highlights:(null!=(t=null==(s=this._highlightHelper)?void 0:s.gpuMemoryUsage)?t:0)+(null!=(n=null==(i=this._shadowHighlightHelper)?void 0:i.gpuMemoryUsage)?n:0),shadows:null!=(a=null==(h=this._shadowMap)?void 0:h.gpuMemoryUsage)?a:0,ssao:null!=(o=null==(d=this._ssaoHelper)?void 0:d.gpuMemoryUsage)?o:0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlightHelper,lighting:this._lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{var t;switch(r){case le.Color:return e._offscreenRendering.colorTexture;case le.LinearDepth:return e._offscreenRendering.linearDepthTexture;case le.Normals:return e._offscreenRendering.normalTexture;case le.ShadowMap:return null==(t=e._shadowMap)?void 0:t.test.depthTexture;case le.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case le.Highlight:return e._offscreenRendering.highlightTexture}}}}};var le;e([_()],de.prototype,"_shadowAccumulator",void 0),e([_()],de.prototype,"_smaaPass",void 0),e([_()],de.prototype,"_antialiasing",void 0),e([_()],de.prototype,"_edgeView",void 0),e([_()],de.prototype,"updating",null),e([_()],de.prototype,"isCameraFinal",null),de=e([p("esri.views.3d.webgl-engine.lib.Renderer")],de),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(le||(le={}));const _e=[],pe=[],ce=T(),me=T(),ue=T(),ge=T();export{le as FramebufferId,de as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as u,a as l}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as p}from"../../../../chunks/vec2f64.js";import{z as d,g}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{c as w}from"../../../../chunks/vec4f64.js";import v from"./Camera.js";import{ZERO as b}from"./depthRange.js";import{createQuadVAO as S}from"./glUtil3D.js";import{ShadowCastRenderer as j,shadowCastDisabledElevationThreshold as A,shadowCastDisableElevationMax as y,shadowCastDisableElevationMin as C}from"./ShadowCastRenderer.js";import R from"./ShadowMap.js";import{inverseProjectionInfo as T}from"./Util.js";import{S as D,s as F}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as E,ShadowCastTechnique as x}from"../shaders/ShadowCastTechnique.js";import{TaskPriority as M}from"../../../support/Scheduler.js";import{TargetType as P,DepthStencilTargetType as q,TextureType as U,PixelFormat as V,PixelType as I,TextureSamplingMode as k,TextureWrapMode as L,ClearBufferBit as O}from"../../../webgl/enums.js";import{FramebufferObject as z}from"../../../webgl/FramebufferObject.js";import{vertexCount as N}from"../../../webgl/Util.js";var B;let H=B=class extends t{constructor(e,t,i,r,o,c){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=c,this._progress=0,this._sampleCount=0,this._cachedCamera=new v,this._contentCamera=new v,this._enabled=!1,this._cachedLightDirections=[],this._depthRange=b,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._shadowMap=new R(e,i.viewingMode),this._shadowMap.enabled=!0,this._vao=S(e);const _={colorTarget:P.TEXTURE,depthStencilTarget:q.NONE,width:0,height:0},u={target:U.TEXTURE_2D,pixelFormat:V.RGBA,dataType:I.UNSIGNED_BYTE,samplingMode:k.LINEAR,wrapMode:L.CLAMP_TO_EDGE,width:0,height:0};this._fbo=new z(e,_,u),this._accumulationParams={camera:this._cachedCamera,linearDepthTexture:null,shadowMap:this._shadowMap,inverseView:m(),projInfo:w(),zScale:p()},this._accumulationRenderer=new j(t,e,this,c);const l=this._stage.resourceController.scheduler;this._handles.add(l.registerTask(M.SHADOW_ACCUMULATOR,this)),this._handles.add(n((()=>i.renderView),(e=>{this._handles.remove(B.renderViewHandleKey),a(e)||this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),B.renderViewHandleKey)}),h))}normalizeCtorArgs(){return{}}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get accumulationTechnique(){if(a(this._accumulationTechnique)){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode},t=new E;t.pass=D.Accumulate,this._accumulationTechnique=new x(e,t)}return this._accumulationTechnique}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._enabled&&this._sampleCount>0}get _canAccumulate(){return null!==this._accumulationParams.linearDepthTexture&&this._depthRange!==b&&this._opacityFromElevation>A}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,d))return;const s=e.length;t.length=s,this._sampleCount=Math.min(F,s);for(let i=0;i<s;++i){const s=e[i],r=t[i]||f();g(r,s),t[i]=r}this._invalidate()}get _projInfo(){return this._accumulationParams.projInfo}get _zScale(){return this._accumulationParams.zScale}get _inverseView(){return this._accumulationParams.inverseView}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this._canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._cachedCamera,this._contentCamera);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}accumulateFixedSamples(){if(!this.isAccumulating||!this._canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const e=this._cameraForcedForScreenshot?this._sampleCount:Math.min(B.previewSamples,this._sampleCount-this._progress);for(let t=0;t<e;++t)this._accumulateShadow();this._cameraForcedForScreenshot=!1}render(){this._accumulationRenderer.render()}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._shadowMap=o(this._shadowMap),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechnique=o(this._accumulationTechnique),this._cachedLightDirections.length=0,this._sampleCount=0}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.previewing&&this.setPreviewing(e.previewing),void 0!==e.lightDirections&&this.setLightDirections(e.lightDirections),this._accumulationRenderer.setOptions(e)}setPreviewing(e){this._previewing!==e&&(this._previewing=e,this._requestRenderIfEnabled())}setLightDirections(e){this._lightDirections=e}setAccumulationDependencies(e,t,i,s){this._accumulationParams.linearDepthTexture=e,this._depthRange=t,this._updateCamera(i),this._contentCamera=s,this.notifyChange("_canAccumulate")}readAccumulatedShadow(e,t){if(!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height)return 0;const i=G;return this._fbo.readPixels(e,t,1,1,V.RGBA,I.UNSIGNED_BYTE,i),i[0]/this._progress}_start(){this._progress=0,this._enabled=!0}_stop(){this._enabled=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(O.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){const e=this._lightDirections[this._progress],t=this._cachedCamera;this._renderToShadowMap(this._shadowMap,e,t,this._depthRange),this._rctx.bindFramebuffer(this._fbo);const i=this.accumulationTechnique;this._rctx.useProgram(i.program),i.bindPipelineState(this._rctx),i.bindPass(this._accumulationParams),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,N(this._vao,"geometry")),this._progress++}_updateCamera(e){if(e.equals(this._cachedCamera))return;const{fullWidth:t,fullHeight:i,projectionMatrix:s,viewMatrix:a,center:o}=e;this._cachedCamera.copyFrom(e),this._fbo.resize(t,i),T(s,t,i,this._projInfo,this._zScale),u(this._inverseView,a,o),l(this._inverseView,this._inverseView),this._opacityFromElevation=1-r(C,y,e.relativeElevation)}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get test(){return{lightDirections:this._lightDirections,isDone:()=>this._isDoneAccumulating,isActive:()=>this._isActive}}};H.previewSamples=6,H.renderViewHandleKey="renderView",e([c()],H.prototype,"_progress",void 0),e([c()],H.prototype,"_sampleCount",void 0),e([c()],H.prototype,"_enabled",void 0),e([c()],H.prototype,"_depthRange",void 0),e([c()],H.prototype,"_previewing",void 0),e([c()],H.prototype,"_accumulationRenderer",void 0),e([c()],H.prototype,"_isRefining",null),e([c()],H.prototype,"_isActive",null),e([c()],H.prototype,"_canAccumulate",null),e([c()],H.prototype,"_isDoneAccumulating",null),e([c()],H.prototype,"_opacityFromElevation",null),e([c()],H.prototype,"running",null),H=B=e([_("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const G=new Uint8Array(4);export{H as ShadowAccumulator};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as u,a as l}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as p}from"../../../../chunks/vec2f64.js";import{y as d,g}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{c as w}from"../../../../chunks/vec4f64.js";import v from"./Camera.js";import{ZERO as b}from"./depthRange.js";import{createQuadVAO as S}from"./glUtil3D.js";import{ShadowCastRenderer as j,shadowCastDisabledElevationThreshold as y,shadowCastDisableElevationMax as A,shadowCastDisableElevationMin as C}from"./ShadowCastRenderer.js";import R from"./ShadowMap.js";import{inverseProjectionInfo as T}from"./Util.js";import{S as D,s as F}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as E,ShadowCastTechnique as x}from"../shaders/ShadowCastTechnique.js";import{TaskPriority as M}from"../../../support/Scheduler.js";import{TargetType as P,DepthStencilTargetType as q,TextureType as U,PixelFormat as V,PixelType as I,TextureSamplingMode as k,TextureWrapMode as L,ClearBufferBit as O}from"../../../webgl/enums.js";import{FramebufferObject as N}from"../../../webgl/FramebufferObject.js";import{vertexCount as z}from"../../../webgl/Util.js";var B;let H=B=class extends t{constructor(e,t,i,r,o,c){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=c,this._progress=0,this._sampleCount=0,this._cachedCamera=new v,this._contentCamera=new v,this._enabled=!1,this._cachedLightDirections=[],this._depthRange=b,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._shadowMap=new R(e,i.viewingMode),this._shadowMap.enabled=!0,this._vao=S(e);const _={colorTarget:P.TEXTURE,depthStencilTarget:q.NONE,width:0,height:0},u={target:U.TEXTURE_2D,pixelFormat:V.RGBA,dataType:I.UNSIGNED_BYTE,samplingMode:k.LINEAR,wrapMode:L.CLAMP_TO_EDGE,width:0,height:0};this._fbo=new N(e,_,u),this._accumulationParams={camera:this._cachedCamera,linearDepthTexture:null,shadowMap:this._shadowMap,inverseView:m(),projInfo:w(),zScale:p()},this._accumulationRenderer=new j(t,e,this,c);const l=this._stage.resourceController.scheduler;this._handles.add(l.registerTask(M.SHADOW_ACCUMULATOR,this)),this._handles.add(n((()=>i.renderView),(e=>{this._handles.remove(B.renderViewHandleKey),a(e)||this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),B.renderViewHandleKey)}),h))}normalizeCtorArgs(){return{}}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get accumulationTechnique(){if(a(this._accumulationTechnique)){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode},t=new E;t.pass=D.Accumulate,this._accumulationTechnique=new x(e,t)}return this._accumulationTechnique}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._enabled&&this._sampleCount>0}get _canAccumulate(){return null!==this._accumulationParams.linearDepthTexture&&this._depthRange!==b&&this._opacityFromElevation>y}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,d))return;const s=e.length;t.length=s,this._sampleCount=Math.min(F,s);for(let i=0;i<s;++i){const s=e[i],r=t[i]||f();g(r,s),t[i]=r}this._invalidate()}get _projInfo(){return this._accumulationParams.projInfo}get _zScale(){return this._accumulationParams.zScale}get _inverseView(){return this._accumulationParams.inverseView}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this._canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._cachedCamera,this._contentCamera);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}accumulateFixedSamples(){if(!this.isAccumulating||!this._canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const e=this._cameraForcedForScreenshot?this._sampleCount:Math.min(B.previewSamples,this._sampleCount-this._progress);for(let t=0;t<e;++t)this._accumulateShadow();this._cameraForcedForScreenshot=!1}render(){this._accumulationRenderer.render()}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._shadowMap=o(this._shadowMap),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechnique=o(this._accumulationTechnique),this._cachedLightDirections.length=0,this._sampleCount=0}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.previewing&&this.setPreviewing(e.previewing),void 0!==e.lightDirections&&this.setLightDirections(e.lightDirections),this._accumulationRenderer.setOptions(e)}setPreviewing(e){this._previewing!==e&&(this._previewing=e,this._requestRenderIfEnabled())}setLightDirections(e){this._lightDirections=e}setAccumulationDependencies(e,t,i,s){this._accumulationParams.linearDepthTexture=e,this._depthRange=t,this._updateCamera(i),this._contentCamera=s,this.notifyChange("_canAccumulate")}readAccumulatedShadow(e,t){if(!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height)return 0;const i=G;return this._fbo.readPixels(e,t,1,1,V.RGBA,I.UNSIGNED_BYTE,i),i[0]/this._progress}_start(){this._progress=0,this._enabled=!0}_stop(){this._enabled=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(O.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){const e=this._lightDirections[this._progress],t=this._cachedCamera;this._renderToShadowMap(this._shadowMap,e,t,this._depthRange),this._rctx.bindFramebuffer(this._fbo);const i=this.accumulationTechnique;this._rctx.useProgram(i.program),i.bindPipelineState(this._rctx),i.bindPass(this._accumulationParams),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,z(this._vao,"geometry")),this._progress++}_updateCamera(e){if(e.equals(this._cachedCamera))return;const{fullWidth:t,fullHeight:i,projectionMatrix:s,viewMatrix:a,center:o}=e;this._cachedCamera.copyFrom(e),this._fbo.resize(t,i),T(s,t,i,this._projInfo,this._zScale),u(this._inverseView,a,o),l(this._inverseView,this._inverseView),this._opacityFromElevation=1-r(C,A,e.relativeElevation)}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get test(){return{lightDirections:this._lightDirections,isDone:()=>this._isDoneAccumulating,isActive:()=>this._isActive}}};H.previewSamples=6,H.renderViewHandleKey="renderView",e([c()],H.prototype,"_progress",void 0),e([c()],H.prototype,"_sampleCount",void 0),e([c()],H.prototype,"_enabled",void 0),e([c()],H.prototype,"_depthRange",void 0),e([c()],H.prototype,"_previewing",void 0),e([c()],H.prototype,"_accumulationRenderer",void 0),e([c()],H.prototype,"_isRefining",null),e([c()],H.prototype,"_isActive",null),e([c()],H.prototype,"_canAccumulate",null),e([c()],H.prototype,"_isDoneAccumulating",null),e([c()],H.prototype,"_opacityFromElevation",null),e([c()],H.prototype,"running",null),H=B=e([_("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const G=new Uint8Array(4);export{H as ShadowAccumulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import o from"../../../../Color.js";import t from"../../../../core/Logger.js";import{get as r,mapOr as e,isSome as i}from"../../../../core/maybe.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{Z as l}from"../../../../chunks/vec4f64.js";const n=t.getLogger("esri.views.3d.webgl-engine.lib.TextRenderParameters");class a{constructor(o){this.definition=o,this.key=JSON.stringify(o),this.haloSize=Math.round(o.halo.size),this.fillStyle=this._colorToRGBA(o.color),this.haloStyle=this._colorToRGB(o.halo.color)}fontString(o){const t=this.definition.font;return`${t.style} ${t.weight} ${o}px ${t.family}, sans-serif`}_colorToRGB(o){return`rgb(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()})`}_colorToRGBA(o){return`rgba(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()},${o[3]})`}static async fromSymbol(t,c=1){const f=r(t,"material","color"),m=e(f,l,o.toUnitRGBA),h=t.halo,g=e(t.size,12,s),y={family:e(t.font,"sans-serif",(o=>o.family)),weight:e(t.font,"normal",(o=>o.weight)),style:e(t.font,"normal",(o=>o.style))},d=i(h)&&i(h.color)&&h.size>0?{size:s(h.size),color:o.toUnitRGBA(h.color)}:{size:0,color:l},p=new a({size:g,color:m,font:y,halo:d,pixelRatio:c}),u=p.fontString(g);try{await document.fonts.load(u)}catch(S){n.warnOnce(`Failed to preload font '${u}'. Some text symbology may be rendered using the default browser font.`)}return p}}export{a as TextRenderParameters};
5
+ import o from"../../../../Color.js";import t from"../../../../core/Logger.js";import{get as r,mapOr as e,isSome as i}from"../../../../core/maybe.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{Z as l}from"../../../../chunks/vec4f64.js";const n=t.getLogger("esri.views.3d.webgl-engine.lib.TextRenderParameters");class a{constructor(o){this.definition=o,this.key=JSON.stringify(o),this.haloSize=Math.round(o.halo.size),this.fillStyle=this._colorToRGBA(o.color),this.haloStyle=this._colorToRGB(o.halo.color)}fontString(o){const t=this.definition.font;return`${t.style} ${t.weight} ${o}px ${t.family}, sans-serif`}_colorToRGB(o){return`rgb(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()})`}_colorToRGBA(o){return`rgba(${o.slice(0,3).map((o=>Math.floor(255*o))).toString()},${o[3]})`}static async fromSymbol(t,c=1){const f=r(t,"material","color"),m=e(f,l,o.toUnitRGBA),h=e(t.size,12,s),g=t.lineHeight,y={family:e(t.font,"sans-serif",(o=>o.family)),weight:e(t.font,"normal",(o=>o.weight)),style:e(t.font,"normal",(o=>o.style))},d=t.halo,p=i(d)&&i(d.color)&&d.size>0?{size:s(d.size),color:o.toUnitRGBA(d.color)}:{size:0,color:l},S=new a({color:m,size:h,lineSpacingFactor:g,font:y,halo:p,pixelRatio:c}),u=S.fontString(h);try{await document.fonts.load(u)}catch(b){n.warnOnce(`Failed to preload font '${u}'. Some text symbology may be rendered using the default browser font.`)}return S}}export{a as TextRenderParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e,isSome as t}from"../../../../core/maybe.js";import i from"../../support/debugFlags.js";class s{constructor(e,t,i=2048){this.text=e,this._parameters=t,this.maxSize=i,this._lineWidths=new Array,this._renderPixelRatio=null,this._displayWidth=null,this._lineHeight=null,this._baselinePosition=null,this.key=`${this._parameters.key}--${e}`,this._lines=e.split(/\r?\n/)}get displayWidth(){return this._ensureTextWidth()}get displayHeight(){const e=this.linePadding*(this._lines.length-1);return Math.ceil(this.lineHeight*this._lines.length+e)}get renderedWidth(){return Math.ceil(this.displayWidth*this.renderPixelRatio)}get renderedHeight(){return Math.ceil(this.displayHeight*this.renderPixelRatio)}get renderedLineSpacing(){return(this.lineHeight+this.linePadding)*this.renderPixelRatio}get lineHeight(){return this._ensureHeightMetrics().lineHeight}get linePadding(){return this.lineHeight*d}get renderedBaselinePosition(){return this.baselinePosition*this.renderPixelRatio}get baselinePosition(){return this._ensureHeightMetrics().baselinePosition}get renderedFontSize(){return this._parameters.definition.size*this.renderPixelRatio}get renderedHaloSize(){return this._parameters.haloSize*this.renderPixelRatio}get renderPixelRatio(){if(e(this._renderPixelRatio)){const e=this._parameters.definition.pixelRatio;this.maxSize>0?this._renderPixelRatio=Math.min(e,Math.min(this.maxSize/(this.displayWidth*e),this.maxSize/(this.displayHeight*e))):this._renderPixelRatio=e}return this._renderPixelRatio}_getLineXOffset(e){return Math.round((this.renderedWidth-this._lineWidths[e]*this.renderPixelRatio)/2)}render(e,t=0,s=0){const r=this.renderedLineSpacing,o=this.renderedHaloSize,l=t,a=s,d=n(e.textAlign,this.renderedWidth)+o,g=o;e.save(),o>0&&this._renderHalo(e,d,g,t,s),this._setFontProperties(e,this.renderedFontSize),s+=g+this.renderedBaselinePosition,t+=d;for(let i=0;i<this._lines.length;++i){e.globalCompositeOperation="destination-out",e.fillStyle="rgb(0, 0, 0)";const n=this._lines[i];h(e,n,t+this._getLineXOffset(i),s),e.globalCompositeOperation="source-over",e.fillStyle=this._parameters.fillStyle,h(e,n,t+this._getLineXOffset(i),s),s+=r}if(i.TEXT_SHOW_BASELINE){e.strokeStyle=_,e.setLineDash([2,2]),e.lineWidth=1;let t=a+g;const i=this.renderedBaselinePosition;for(let s=0;s<this._lines.length;++s){const s=Math.round(t+i)+.5;e.beginPath(),e.moveTo(l,s),e.lineTo(l+this.renderedWidth,s),e.stroke(),t+=r}}i.TEXT_SHOW_BORDER&&(e.strokeStyle=_,e.setLineDash([]),e.lineWidth=1,e.beginPath(),e.moveTo(l+.5,a+.5),e.lineTo(l+this.renderedWidth-.5,a+.5),e.lineTo(l+this.renderedWidth-.5,a+this.renderedHeight-.5),e.lineTo(l+.5,a+this.renderedHeight-.5),e.lineTo(l+.5,a+.5),e.stroke()),e.restore()}_renderHalo(e,t,i,s,n){const r=this.renderedWidth,h=this.renderedHeight,o=l(a,Math.max(r,g),Math.max(h,g)),d=o.getContext("2d");d.clearRect(0,0,r,h),this._setFontProperties(d,this.renderedFontSize),d.fillStyle=this._parameters.haloStyle,d.strokeStyle=this._parameters.haloStyle;const _=this.renderedHaloSize<3;d.lineJoin=_?"miter":"round",_?this._renderHaloEmulated(d,t,i):this._renderHaloNative(d,t,i),e.globalAlpha=this._parameters.definition.halo.color[3],e.drawImage(o,0,0,r,h,s,n,r,h),e.globalAlpha=1}_renderHaloEmulated(e,t,i){const s=this.renderedLineSpacing,n=this.renderedHaloSize,o=this.renderedBaselinePosition;for(let l=0;l<this._lines.length;++l){const a=this._lines[l],d=this._getLineXOffset(l);for(const[s,l]of r)h(e,a,t+d+n*s,i+o+n*l);i+=s}}_renderHaloNative(e,t,i){const s=this.renderedLineSpacing,n=this.renderedHaloSize,r=this.renderedBaselinePosition;for(let h=0;h<this._lines.length;++h){const l=2*n,a=this._lines[h],d=this._getLineXOffset(h),g=5,_=.1;for(let s=0;s<g;s++){const n=1-(g-1)*_+s*_;e.lineWidth=n*l,o(e,a,t+d,i+r)}i+=s}}_setFontProperties(e,t){e.font=this._parameters.fontString(t),e.textAlign="left",e.textBaseline="alphabetic"}_ensureTextWidth(){if(t(this._displayWidth))return this._displayWidth;const e=l(a,g,g).getContext("2d");this._setFontProperties(e,this._parameters.definition.size);let i=0,s=2*this._parameters.haloSize;this._lineWidths.length=0;const n=this._parameters.definition.font;("italic"===n.style||"oblique"===n.style||"string"==typeof n.weight&&("bold"===n.weight||"bolder"===n.weight)||"number"==typeof n.weight&&n.weight>600)&&(s+=.3*e.measureText("A").width);for(const t of this._lines){const n=Math.ceil(e.measureText(t).width+s);this._lineWidths.push(n),i=Math.max(i,n)}return this._displayWidth=i,this._displayWidth}_ensureHeightMetrics(){if(e(this._lineHeight)||e(this._baselinePosition)){const e=this.text+c,t=l(a,g,g).getContext("2d");this._setFontProperties(t,this._parameters.definition.size);const i=t.measureText(e),s=i.actualBoundingBoxAscent+i.actualBoundingBoxDescent;this._lineHeight=Math.ceil(s+2*this._parameters.haloSize),this._baselinePosition=i.actualBoundingBoxAscent}return{lineHeight:this._lineHeight,baselinePosition:this._baselinePosition}}}function n(e,t){return"center"===e?.5*t:"right"===e?t:0}const r=[];{const e=16;for(let t=0;t<360;t+=360/e)r.push([Math.cos(Math.PI*t/180),Math.sin(Math.PI*t/180)])}function h(e,t,i,s){e.fillText(t,Math.round(i),Math.round(s))}function o(e,t,i,s){e.strokeText(t,Math.round(i),Math.round(s))}function l(e,t,i){return e.canvas||(e.canvas=document.createElement("canvas")),e.canvas.width=t,e.canvas.height=i,e.canvas}const a={canvas:null},d=.25,g=512,_="rgb(255, 0, 255, 0.5)",c=(()=>{let e="";for(let t=32;t<127;t++)e+=String.fromCharCode(t);return e})();export{s as TextRenderer,s as default,l as getTextHelperCanvas};
5
+ import{isNone as t,isSome as e}from"../../../../core/maybe.js";import i from"../../support/debugFlags.js";class s{constructor(t,e,i=2048){this.text=t,this._parameters=e,this.maxSize=i,this._lineWidths=new Array,this._renderPixelRatio=null,this._displayWidth=null,this._textHeight=null,this._baselinePosition=null,this.key=`${this._parameters.key}--${t}`,this._lines=t.split(/\r?\n/)}get displayWidth(){return Math.ceil(this._ensureTextWidth())}get displayHeight(){const t=this.lineSpacing*(this._lines.length-1),e=this.textHeight;return Math.ceil(t+e+2*this.haloSize)}get renderedWidth(){return Math.ceil(this._toRenderUnit(this.displayWidth))}get renderedHeight(){return Math.ceil(this._toRenderUnit(this.displayHeight))}get lineSpacing(){return(this.textHeight+this.linePadding)*this._parameters.definition.lineSpacingFactor}get textHeight(){return this._ensureHeightMetrics().textHeight}get linePadding(){return this.textHeight*l}get baselinePosition(){return this._ensureHeightMetrics().baselinePosition}get renderedFontSize(){return this._toRenderUnit(this.fontSize)}get fontSize(){return this._parameters.definition.size}get renderedHaloSize(){return this._toRenderUnit(this.haloSize)}get haloSize(){return this._parameters.haloSize}get renderPixelRatio(){if(t(this._renderPixelRatio)){const t=this._parameters.definition.pixelRatio;this.maxSize>0?this._renderPixelRatio=Math.min(t,Math.min(this.maxSize/(this.displayWidth*t),this.maxSize/(this.displayHeight*t))):this._renderPixelRatio=t}return this._renderPixelRatio}_getLineXOffset(t){return(this.displayWidth-this._lineWidths[t])/2}render(t,e=0,s=0){t.save();const h=e/=this.renderPixelRatio,r=s/=this.renderPixelRatio,o=n(t.textAlign,this.displayWidth)+this.haloSize,l=this.haloSize;s+=l+this.baselinePosition,e+=o,this.haloSize>0&&this._renderHalo(t,h,r,o,l),this._setFontProperties(t,this.renderedFontSize);for(let i=0;i<this._lines.length;++i){t.globalCompositeOperation="destination-out",t.fillStyle="rgb(0, 0, 0)";const n=this._lines[i],h=this._getLineXOffset(i);this._fillText(t,n,e+h,s),t.globalCompositeOperation="source-over",t.fillStyle=this._parameters.fillStyle,this._fillText(t,n,e+this._getLineXOffset(i),s),s+=this.lineSpacing}if(i.TEXT_SHOW_BASELINE){t.strokeStyle=d,t.setLineDash([2,2]),t.lineWidth=1;let e=r+l;for(let i=0;i<this._lines.length;++i){const i=e+this.baselinePosition;this._drawLine(t,[h,i],[h+this.displayWidth,i]),e+=this.lineSpacing}}i.TEXT_SHOW_BORDER&&(t.strokeStyle=d,t.setLineDash([]),t.lineWidth=1,this._drawBox(t,[h,r],[this.displayWidth,this.displayHeight])),t.restore()}_renderHalo(t,e,i,s,n){const h=this.renderedWidth,l=this.renderedHeight,d=r(o,Math.max(h,a),Math.max(l,a)),_=d.getContext("2d");_.clearRect(0,0,h,l),this._setFontProperties(_,this.renderedFontSize),_.fillStyle=this._parameters.haloStyle,_.strokeStyle=this._parameters.haloStyle;const g=this.renderedHaloSize<3;_.lineJoin=g?"miter":"round",g?this._renderHaloEmulated(_,s,n):this._renderHaloNative(_,s,n),t.globalAlpha=this._parameters.definition.halo.color[3],t.drawImage(d,0,0,h,l,this._toRenderUnit(e),this._toRenderUnit(i),h,l),t.globalAlpha=1}_renderHaloEmulated(t,e,i){i+=this.baselinePosition;for(let s=0;s<this._lines.length;++s){const n=this._lines[s],r=this._getLineXOffset(s);for(const[s,o]of h)this._fillText(t,n,e+r+this.haloSize*s,i+this.haloSize*o);i+=this.lineSpacing}}_renderHaloNative(t,e,i){const s=2*this.haloSize;i+=this.baselinePosition;for(let n=0;n<this._lines.length;++n){const h=this._lines[n],r=this._getLineXOffset(n),o=5,l=.1;for(let n=0;n<o;n++){const a=1-(o-1)*l+n*l;t.lineWidth=this._toRenderUnit(a*s),this._strokeText(t,h,e+r,i)}i+=this.lineSpacing}}_setFontProperties(t,e){t.font=this._parameters.fontString(e),t.textAlign="left",t.textBaseline="alphabetic"}_ensureTextWidth(){if(e(this._displayWidth))return this._displayWidth;const t=r(o,a,a).getContext("2d");this._setFontProperties(t,this.fontSize);let i=0,s=2*this.haloSize;this._lineWidths.length=0;const n=this._parameters.definition.font;("italic"===n.style||"oblique"===n.style||"string"==typeof n.weight&&("bold"===n.weight||"bolder"===n.weight)||"number"==typeof n.weight&&n.weight>600)&&(s+=.3*t.measureText("A").width);for(const e of this._lines){const n=t.measureText(e).width+s;this._lineWidths.push(n),i=Math.max(i,n)}return this._displayWidth=i,this._displayWidth}_ensureHeightMetrics(){if(t(this._textHeight)||t(this._baselinePosition)){const t=this.text+_,e=r(o,a,a).getContext("2d");this._setFontProperties(e,this.fontSize);const i=e.measureText(t),s=i.actualBoundingBoxAscent+i.actualBoundingBoxDescent;this._textHeight=s,this._baselinePosition=i.actualBoundingBoxAscent}return{textHeight:this._textHeight,baselinePosition:this._baselinePosition}}_toRenderUnit(t){return t*this.renderPixelRatio}_toRoundedRenderUnit(t){return Math.round(t*this.renderPixelRatio)}_fillText(t,e,i,s){t.fillText(e,this._toRenderUnit(i),this._toRenderUnit(s))}_strokeText(t,e,i,s){t.strokeText(e,this._toRenderUnit(i),this._toRenderUnit(s))}_drawLine(t,e,i){t.beginPath(),t.moveTo(this._toRoundedRenderUnit(e[0])+.5,this._toRoundedRenderUnit(e[1])+.5),t.lineTo(this._toRoundedRenderUnit(i[0])+.5,this._toRoundedRenderUnit(i[1])+.5),t.stroke()}_drawBox(t,e,i){const s=this._toRenderUnit(e[0]),n=this._toRenderUnit(e[1]),h=this._toRenderUnit(i[0]),r=this._toRenderUnit(i[1]),o=Math.floor(s)+.5,l=Math.ceil(s+h)-.5,a=Math.floor(n)+.5,d=Math.ceil(n+r)-.5;t.beginPath(),t.moveTo(o,a),t.lineTo(l,a),t.lineTo(l,d),t.lineTo(o,d),t.lineTo(o,a),t.stroke()}}function n(t,e){return"center"===t?.5*e:"right"===t?e:0}const h=[];{const t=16;for(let e=0;e<360;e+=360/t)h.push([Math.cos(Math.PI*e/180),Math.sin(Math.PI*e/180)])}function r(t,e,i){return t.canvas||(t.canvas=document.createElement("canvas")),t.canvas.width=e,t.canvas.height=i,t.canvas}const o={canvas:null},l=.2,a=512,d="rgb(255, 0, 255, 0.5)",_=(()=>{let t="";for(let e=32;e<127;e++)t+=String.fromCharCode(e);return t})();export{s as TextRenderer,s as default,r as getTextHelperCanvas};