@arcgis/core 4.33.0-next.20250326 → 4.33.0-next.20250328

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 (319) hide show
  1. package/applications/Components/viewUtils.d.ts +3 -0
  2. package/applications/Components/viewUtils.js +5 -0
  3. package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +1 -0
  4. package/applications/KnowledgeStudio/layerInternalAccessUtils.js +1 -1
  5. package/arcade/arcadeAsyncRuntime.js +1 -1
  6. package/arcade/arcadeCompiler.js +1 -1
  7. package/arcade/arcadeRuntime.js +1 -1
  8. package/arcade/functions/date.js +1 -1
  9. package/arcade/functions/feature.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/featuresetgeom.js +1 -1
  12. package/arcade/functions/featuresetstats.js +1 -1
  13. package/arcade/functions/featuresetstring.js +1 -1
  14. package/arcade/functions/geomasync.js +1 -1
  15. package/arcade/functions/geometry.js +1 -1
  16. package/arcade/functions/geomsync.js +1 -1
  17. package/arcade/functions/knowledgegraph.js +1 -1
  18. package/arcade/functions/maths.js +1 -1
  19. package/arcade/functions/stats.js +1 -1
  20. package/arcade/functions/string.js +1 -1
  21. package/arcade/geometry/functions.js +1 -1
  22. package/arcade/languageUtils.js +1 -1
  23. package/assets/esri/core/workers/RemoteClient.js +1 -1
  24. package/assets/esri/core/workers/chunks/08ea652b7896c1da022d.js +1 -0
  25. package/assets/esri/core/workers/chunks/{66cae76da0582cfa8656.js → 0943695a1dcd21c45e83.js} +1 -1
  26. package/assets/esri/core/workers/chunks/09ca64184bed6abafcd9.js +1 -0
  27. package/assets/esri/core/workers/chunks/{c6bcfa99fb222894fa0e.js → 0a0e5d699ddb7052c5c0.js} +1 -1
  28. package/assets/esri/core/workers/chunks/0a675f9f69b8b13b7443.js +1 -0
  29. package/assets/esri/core/workers/chunks/0eed612e82a279ac8d1e.js +1 -0
  30. package/assets/esri/core/workers/chunks/{cbe22c58b3230b12b31a.js → 13ad4ee2e064d13ca34d.js} +1 -1
  31. package/assets/esri/core/workers/chunks/176e7c7c2a871bcb512e.js +1 -0
  32. package/assets/esri/core/workers/chunks/18d0fe269531b951e309.js +1 -0
  33. package/assets/esri/core/workers/chunks/201db423e3c6f947b77c.js +1 -0
  34. package/assets/esri/core/workers/chunks/213e82a7e3fa5b253ec1.js +1 -0
  35. package/assets/esri/core/workers/chunks/{22618753349eb9d8b3df.js → 222446da9cb58c3c3b7e.js} +1 -1
  36. package/assets/esri/core/workers/chunks/277b61af8982092a4c81.js +1 -0
  37. package/assets/esri/core/workers/chunks/2b07bdb6c4c4a5b2f968.js +1 -0
  38. package/assets/esri/core/workers/chunks/2bda2cfc6e81818d7d33.js +1 -0
  39. package/assets/esri/core/workers/chunks/2cbab0c078d0b844934c.js +1 -0
  40. package/assets/esri/core/workers/chunks/{a68b48fd1a529f69705e.js → 2fcfc21ba38d9919730a.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{193b4fecdfee927d6200.js → 37e4f588a6896f98bce3.js} +1 -1
  42. package/assets/esri/core/workers/chunks/392e64a573f67817db02.js +1 -0
  43. package/assets/esri/core/workers/chunks/3a743653b786b010a57f.js +1 -0
  44. package/assets/esri/core/workers/chunks/3be007f32ea1e18b8b3b.js +1 -0
  45. package/assets/esri/core/workers/chunks/451555af283b32a10fef.js +1 -0
  46. package/assets/esri/core/workers/chunks/{835fa4484c58d9b31c78.js → 460afde071df9f35182d.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{26bedec014488e1fc5e4.js → 4816cf647eca2f4cecc2.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{09c9e4e94f09ba9f4c22.js → 4aa0a58ded4465ea28bd.js} +1 -1
  49. package/assets/esri/core/workers/chunks/4d02e211967384994e5e.js +1 -0
  50. package/assets/esri/core/workers/chunks/4d798da25a726f179089.js +319 -0
  51. package/assets/esri/core/workers/chunks/51339193abddfe37745d.js +1 -0
  52. package/assets/esri/core/workers/chunks/{0a98dc3ea67ce97a6e7b.js → 5269793822e41dd07fe1.js} +1 -1
  53. package/assets/esri/core/workers/chunks/52d160cb7921ae7a4f57.js +1 -0
  54. package/assets/esri/core/workers/chunks/{630a9afdf0523c27ddb6.js → 555c95b149e3a82a4460.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{eab1e3c101158675abba.js → 5660f479c005149bce8d.js} +1 -1
  56. package/assets/esri/core/workers/chunks/5a51c75a2932d9da001a.js +1 -0
  57. package/assets/esri/core/workers/chunks/{37a3533f004bf2e888da.js → 5d01f0b86566d08ba29d.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{0576b035c1654a43ad5c.js → 5de3aee547113bfd59df.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{45eee326f7a649c5a15b.js → 626db8488f9d931cf55c.js} +2 -2
  60. package/assets/esri/core/workers/chunks/{5a6f7360183693f8490d.js → 6339a24874c698594101.js} +1 -1
  61. package/assets/esri/core/workers/chunks/63dade3e1cc7f5b76846.js +1 -0
  62. package/assets/esri/core/workers/chunks/6c378e7a6ca29d530880.js +1 -0
  63. package/assets/esri/core/workers/chunks/71e46e866c23372b0b58.js +1 -0
  64. package/assets/esri/core/workers/chunks/{c591527543fd75a917d4.js → 72c7126dbd27fa48fcdb.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{d459c790a3b89ac53d2d.js → 759c12b0715279e3c0f6.js} +1 -1
  66. package/assets/esri/core/workers/chunks/75a04b073231da70c18d.js +1 -0
  67. package/assets/esri/core/workers/chunks/75fa861b5757551f8fdc.js +1 -0
  68. package/assets/esri/core/workers/chunks/7655be1470ce39f0e494.js +1 -0
  69. package/assets/esri/core/workers/chunks/796cf1c2ca9955595836.js +1 -0
  70. package/assets/esri/core/workers/chunks/79c4f10da8360ee60cd2.js +1 -0
  71. package/assets/esri/core/workers/chunks/{49c346d2fb8538990f45.js → 7d1c39c2a80e20a0595f.js} +1 -1
  72. package/assets/esri/core/workers/chunks/7f36cffc6ed984b7e467.js +1 -0
  73. package/assets/esri/core/workers/chunks/{fa3eeb40e2d732c184d8.js → 7f8c7e3e41e51ab4d612.js} +1 -1
  74. package/assets/esri/core/workers/chunks/80aaf31c8eec3cff2add.js +1 -0
  75. package/assets/esri/core/workers/chunks/82353e59ac6d909dcf41.js +1 -0
  76. package/assets/esri/core/workers/chunks/84d301e1b6b0d0b48f51.js +1 -0
  77. package/assets/esri/core/workers/chunks/86931186095c23e47c0c.js +1 -0
  78. package/assets/esri/core/workers/chunks/86ee278919038260696e.js +39 -0
  79. package/assets/esri/core/workers/chunks/{4496ef270c700078df0c.js → 8752f807c05d1ec215e8.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{59e4e780dcdfed555ca5.js → 8ef5e6f1c606e5e41002.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{55c7c51e56d72f507c22.js → 90afead317186b31b2f9.js} +1 -1
  82. package/assets/esri/core/workers/chunks/90c893959145827961ac.js +1 -0
  83. package/assets/esri/core/workers/chunks/931275cfa2c55eb0f504.js +1 -0
  84. package/assets/esri/core/workers/chunks/{7e0e9ca84490a0c67197.js → 98da74243df03e0cc70d.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{354117429b3a0a0794c9.js → 999e8dbe6f4d0665b3ab.js} +1 -1
  86. package/assets/esri/core/workers/chunks/9c59fc2df8081e65a128.js +1 -0
  87. package/assets/esri/core/workers/chunks/a348ff2dd936c6bf9399.js +1 -0
  88. package/assets/esri/core/workers/chunks/a53e9f5092de715da025.js +1 -0
  89. package/assets/esri/core/workers/chunks/a9b6377f1fef5826f28d.js +1 -0
  90. package/assets/esri/core/workers/chunks/{8063e35dacf8f99471d8.js → aa404aaec843a4f46ab6.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{21016d58428b15f7427c.js → aa712f850fd129ca5ed8.js} +1 -1
  92. package/assets/esri/core/workers/chunks/ab0113d1269675dcd520.js +1 -0
  93. package/assets/esri/core/workers/chunks/aff7c4477e1f0c31fffa.js +1 -0
  94. package/assets/esri/core/workers/chunks/{726e3f413824f02fe689.js → bd2dcc55ac3418421ee5.js} +1 -1
  95. package/assets/esri/core/workers/chunks/bf453744067267e84d1b.js +1 -0
  96. package/assets/esri/core/workers/chunks/c2f38c66fae2cdb57445.js +1 -0
  97. package/assets/esri/core/workers/chunks/c7aa4a8263e21f631004.js +1 -0
  98. package/assets/esri/core/workers/chunks/{b8a4352f83502449ff95.js → cbbbaccc0d3683e1c0fe.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{e4290719c8afc2a4ee8c.js → cc441051a52bfbda9caf.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{3be465c653236d6d8c1f.js → d2c7067bb6654c0e2793.js} +1 -1
  101. package/assets/esri/core/workers/chunks/{bc3f42401131a12fce9b.js → d2eb3802fa003c2d497e.js} +1 -1
  102. package/assets/esri/core/workers/chunks/d3912886ac2910290f43.js +1 -0
  103. package/assets/esri/core/workers/chunks/da7c14ae1a25fc7163ce.js +1 -0
  104. package/assets/esri/core/workers/chunks/daa54c8a317c27881763.js +1 -0
  105. package/assets/esri/core/workers/chunks/e08bff9f8247909776a4.js +1 -0
  106. package/assets/esri/core/workers/chunks/e15c612caadf7bac4ab9.js +1 -0
  107. package/assets/esri/core/workers/chunks/{d5d2a4e8e19898d86c6d.js → e2029267cddb8e2effab.js} +1 -1
  108. package/assets/esri/core/workers/chunks/e3ef0451dcdc2e966628.js +1 -0
  109. package/assets/esri/core/workers/chunks/e7e987558cf017c62458.js +1 -0
  110. package/assets/esri/core/workers/chunks/{042771b4e56355924140.js → e9993d4f2bfdc434fbcc.js} +1 -1
  111. package/assets/esri/core/workers/chunks/eabfab23246d4a052ea3.js +1 -0
  112. package/assets/esri/core/workers/chunks/ed3d1d0465f4a4d8df4a.js +1 -0
  113. package/assets/esri/core/workers/chunks/{4dc1e7d7ac2a4b0144c4.js → f128d3431da86e484117.js} +28 -29
  114. package/assets/esri/core/workers/chunks/{ed4afafbcb31491c2049.js → f452ca61842dbe8de9af.js} +1 -1
  115. package/assets/esri/core/workers/chunks/f54546c155fba2fd3a7e.js +1 -0
  116. package/assets/esri/core/workers/chunks/{4c8164955f8d844c09ee.js → f8d1c7df671733c3325c.js} +1 -1
  117. package/assets/esri/core/workers/chunks/{e45404a982e173459990.js → f92d521ed3df3c9f737b.js} +1 -1
  118. package/assets/esri/core/workers/chunks/{b2289c18c02c868a2939.js → f9bedb421d4e115a888f.js} +1 -1
  119. package/assets/esri/core/workers/chunks/{55f7b1de8882569861c0.js → faed301a25252c619cff.js} +1 -1
  120. package/assets/esri/core/workers/chunks/fb22b2e4988ecf4d6376.js +1 -0
  121. package/assets/esri/core/workers/chunks/fb455fd89b74b70a6a2b.js +1 -0
  122. package/assets/esri/core/workers/chunks/{6d77c7e9dec323fc4145.js → fb603edd374e24f366ff.js} +1 -1
  123. package/chunks/ComponentShader.glsl.js +25 -25
  124. package/chunks/HUDMaterial.glsl.js +2 -2
  125. package/chunks/LineMarker.glsl.js +26 -26
  126. package/chunks/Point2D.js +1 -1
  127. package/chunks/ProjectionTransformation.js +1 -1
  128. package/chunks/QuadraticBezier.js +1 -1
  129. package/chunks/RibbonLine.glsl.js +35 -33
  130. package/chunks/Terrain.glsl.js +33 -33
  131. package/chunks/aiServices.js +1 -1
  132. package/chunks/array.js +1 -1
  133. package/chunks/languageUtils.js +1 -1
  134. package/core/Accessor.js +1 -1
  135. package/core/accessorSupport/utils.js +1 -1
  136. package/core/workers/registry.js +1 -1
  137. package/geometry/operators/projectOperator.js +1 -1
  138. package/geometry/operators/shapePreservingProjectOperator.js +1 -1
  139. package/geometry/support/meshUtils/elevation.js +1 -1
  140. package/geometry/support/meshUtils.js +1 -1
  141. package/interfaces.d.ts +284 -10
  142. package/intl/locale.js +1 -1
  143. package/layers/LinkChartLayer.js +1 -1
  144. package/layers/MapImageLayer.js +1 -1
  145. package/layers/TileLayer.js +1 -1
  146. package/layers/support/RasterWorker.js +1 -1
  147. package/layers/support/VideoElement.js +1 -1
  148. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  149. package/layers/support/rasterFunctions/clipUtils.js +1 -1
  150. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  151. package/package.json +2 -2
  152. package/rest/networks/queryAssociations.js +1 -1
  153. package/support/revision.js +1 -1
  154. package/symbols/WebStyleSymbol.js +1 -1
  155. package/symbols/support/symbolUtils.js +1 -1
  156. package/views/2d/LabelManager.js +1 -1
  157. package/views/2d/engine/webgl/Overlay.js +1 -1
  158. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  159. package/views/2d/layers/TileLayerView2D.js +1 -1
  160. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  161. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  162. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  163. package/views/2d/layers/support/util.js +1 -1
  164. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  165. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  166. package/views/3d/layers/DrapedSubView3D.js +1 -1
  167. package/views/3d/layers/GraphicsView3D.js +1 -1
  168. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  169. package/views/3d/layers/MapImageLayerView3D.js +1 -1
  170. package/views/3d/layers/MediaLayerView3D.js +1 -1
  171. package/views/3d/layers/TileLayerView3D.js +1 -1
  172. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  173. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  174. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  175. package/views/3d/layers/support/ImageHighlightHelper3D.js +5 -0
  176. package/views/3d/layers/support/SublayerPopupHighlightHelper3D.js +5 -0
  177. package/views/3d/terrain/Overlay.js +1 -1
  178. package/views/3d/terrain/OverlayRenderer.js +1 -1
  179. package/views/3d/terrain/RasterTile.js +1 -1
  180. package/views/3d/terrain/TerrainRenderer.js +1 -1
  181. package/views/3d/terrain/TerrainSurface.js +1 -1
  182. package/views/3d/terrain/TileCompositor.js +1 -1
  183. package/views/3d/terrain/TileRenderer.js +1 -1
  184. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  186. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  187. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +9 -10
  188. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +11 -0
  189. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +3 -3
  190. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +3 -6
  191. package/views/3d/webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js +1 -1
  192. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +1 -1
  193. package/views/3d/webgl-engine/lib/Material.js +1 -1
  194. package/views/3d/webgl-engine/lib/Program.js +1 -1
  195. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  196. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  197. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  198. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  199. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  200. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  201. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  202. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  203. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  204. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  206. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  207. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  208. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  209. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  210. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  211. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  212. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  213. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  214. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  215. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  216. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  217. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  218. package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
  219. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  220. package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
  221. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  222. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  223. package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +1 -1
  224. package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
  225. package/views/3d/webgl-engine/shaders/PointRendererTechniqueConfiguration.js +1 -1
  226. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  227. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  228. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
  229. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  230. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  231. package/views/DOMContainer.js +1 -1
  232. package/views/FocusArea.js +1 -1
  233. package/views/GroundView.js +1 -1
  234. package/views/PopupView.js +1 -1
  235. package/views/SceneView.js +1 -1
  236. package/views/VideoView.d.ts +4 -0
  237. package/views/VideoView.js +1 -1
  238. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  239. package/views/layers/support/highlightUtils.js +5 -0
  240. package/views/support/GroundViewElevationSampler.js +1 -1
  241. package/views/support/TextureCompressionHandle.js +5 -0
  242. package/views/support/TextureCompressionHelper.js +1 -1
  243. package/views/support/TextureCompressionWorker.js +5 -0
  244. package/views/support/TextureCompressionWorkerHandle.js +5 -0
  245. package/views/support/imageReprojection.js +1 -1
  246. package/views/webgl/ShaderBuilder.js +1 -1
  247. package/views/webgl/Texture.js +1 -1
  248. package/views/webgl/TextureDescriptor.js +1 -1
  249. package/webscene/Slide.js +1 -1
  250. package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
  251. package/widgets/CatalogLayerList.js +1 -1
  252. package/widgets/Directions.js +1 -1
  253. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  254. package/widgets/Features/FeaturesViewModel.js +1 -1
  255. package/widgets/LayerList/ListItem.js +1 -1
  256. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  257. package/widgets/Legend.js +1 -1
  258. package/widgets/TableList/ListItem.js +1 -1
  259. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  260. package/widgets/UtilityNetworkTrace.js +1 -1
  261. package/widgets/ValuePicker.js +1 -1
  262. package/widgets/support/uriUtils.js +1 -1
  263. package/assets/esri/core/workers/chunks/0059295780fa4a090f30.js +0 -319
  264. package/assets/esri/core/workers/chunks/07910d16d1efae41d4bc.js +0 -1
  265. package/assets/esri/core/workers/chunks/0a3c1642cfabf9acd5c5.js +0 -1
  266. package/assets/esri/core/workers/chunks/0b7331613f91a3258352.js +0 -1
  267. package/assets/esri/core/workers/chunks/1a09dfb2c9fd7cd84cd4.js +0 -1
  268. package/assets/esri/core/workers/chunks/1dd6d68d23ba07587ae4.js +0 -1
  269. package/assets/esri/core/workers/chunks/2079f9d28e4199714f22.js +0 -1
  270. package/assets/esri/core/workers/chunks/29ba2022c2978e9bd53e.js +0 -1
  271. package/assets/esri/core/workers/chunks/29fe3e9a0ecab74bb729.js +0 -1
  272. package/assets/esri/core/workers/chunks/35f3eef81fac7924a487.js +0 -1
  273. package/assets/esri/core/workers/chunks/3fc18638f8799b85001d.js +0 -1
  274. package/assets/esri/core/workers/chunks/4539a802cba77a7a7cc7.js +0 -1
  275. package/assets/esri/core/workers/chunks/4d7bd2bbe9045a2fee7a.js +0 -1
  276. package/assets/esri/core/workers/chunks/50b6be13c270d7ac80d3.js +0 -1
  277. package/assets/esri/core/workers/chunks/54ace3e4802934f3f9f2.js +0 -1
  278. package/assets/esri/core/workers/chunks/5656cc44e3d4547668db.js +0 -1
  279. package/assets/esri/core/workers/chunks/597f450a57750637cb4d.js +0 -1
  280. package/assets/esri/core/workers/chunks/6e7577cb6378ff34e722.js +0 -1
  281. package/assets/esri/core/workers/chunks/6eb8d7edafeafeb10cae.js +0 -1
  282. package/assets/esri/core/workers/chunks/6ff981ec0c725efe5525.js +0 -1
  283. package/assets/esri/core/workers/chunks/71bd94cc789a55910f92.js +0 -1
  284. package/assets/esri/core/workers/chunks/762567124623f6d11e67.js +0 -1
  285. package/assets/esri/core/workers/chunks/77845cd5d824c1004bfa.js +0 -1
  286. package/assets/esri/core/workers/chunks/78683f1aadc1377be5fd.js +0 -1
  287. package/assets/esri/core/workers/chunks/7a4413a188a8f1affb2f.js +0 -1
  288. package/assets/esri/core/workers/chunks/7d3b2bdc75525d47389c.js +0 -1
  289. package/assets/esri/core/workers/chunks/81bf362ec0d23ffdc90c.js +0 -39
  290. package/assets/esri/core/workers/chunks/81f2f1614ea27f4c2e65.js +0 -1
  291. package/assets/esri/core/workers/chunks/901c957c049f53318e87.js +0 -1
  292. package/assets/esri/core/workers/chunks/94f41ef15f6c61562e5e.js +0 -1
  293. package/assets/esri/core/workers/chunks/95f23bd17ce9e07fc8ef.js +0 -1
  294. package/assets/esri/core/workers/chunks/96d7f47ea8fbf345101c.js +0 -1
  295. package/assets/esri/core/workers/chunks/9f312f7284e506a84ed7.js +0 -1
  296. package/assets/esri/core/workers/chunks/a59ad50d932da1e28c8f.js +0 -1
  297. package/assets/esri/core/workers/chunks/ac86d0b31f6368bd1fb1.js +0 -1
  298. package/assets/esri/core/workers/chunks/ad9b3b83aa96db7b79ea.js +0 -1
  299. package/assets/esri/core/workers/chunks/afe94e351b4a50d7bc53.js +0 -1
  300. package/assets/esri/core/workers/chunks/b02ac03503bfff1ff922.js +0 -1
  301. package/assets/esri/core/workers/chunks/b8416f2560710258c239.js +0 -1
  302. package/assets/esri/core/workers/chunks/b948fe33b4d650eea796.js +0 -1
  303. package/assets/esri/core/workers/chunks/ba47e43ef039fe4b8c5c.js +0 -1
  304. package/assets/esri/core/workers/chunks/be002f24beb832a369ce.js +0 -1
  305. package/assets/esri/core/workers/chunks/bf3c4c1bff8b71bc0b13.js +0 -1
  306. package/assets/esri/core/workers/chunks/d45ff061bf71b73e9f26.js +0 -1
  307. package/assets/esri/core/workers/chunks/d8ddff920725acb99200.js +0 -1
  308. package/assets/esri/core/workers/chunks/db4c110ab4c26c4b768c.js +0 -1
  309. package/assets/esri/core/workers/chunks/dfa4be2e07cc4c0938b0.js +0 -1
  310. package/assets/esri/core/workers/chunks/e088edb9ffbaa1ed12eb.js +0 -1
  311. package/assets/esri/core/workers/chunks/e0ac90b4ad8c36fb7d70.js +0 -1
  312. package/assets/esri/core/workers/chunks/e491daf73ab1264aa1b9.js +0 -1
  313. package/assets/esri/core/workers/chunks/f2a6287c8d28be24f71e.js +0 -1
  314. package/assets/esri/core/workers/chunks/f454e773505c0eef2f9d.js +0 -1
  315. package/assets/esri/core/workers/chunks/f4861d73c62096f73e48.js +0 -1
  316. package/assets/esri/core/workers/chunks/f70dd16f14279bb7e60d.js +0 -1
  317. package/assets/esri/core/workers/chunks/fa011ad649c05201e92a.js +0 -1
  318. package/views/3d/webgl-engine/lib/TextureCompressionWorker.js +0 -5
  319. package/views/3d/webgl-engine/lib/TextureCompressionWorkerHandle.js +0 -5
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../../core/has.js";import{ZEROS as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{LayerBlendMode as r}from"../output/BlendOptions.js";import{BackgroundGrid as e}from"./BackgroundGrid.glsl.js";import{BaseOpacityMode as a}from"./BaseOpacityMode.js";import{BlendLayersOutput as c}from"./BlendLayersOutput.js";import{PremultipliedAlphaSource as t}from"./PremultipliedAlphaSource.js";import{BlendModes as s}from"../util/BlendModes.glsl.js";import{Float3PassUniform as l}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as i}from"../../shaderModules/FloatPassUniform.js";import{glsl as p,If as d}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as m}from"../../shaderModules/Texture2DPassUniform.js";import{NoParameters as u}from"../../../../../webgl/NoParameters.js";class n extends u{constructor(){super(...arguments),this.baseOpacity=1,this.backgroundColor=o,this.fboTexture=null}}function b(o,u){const{output:n,blendMode:b,baseOpacityMode:g,premultipliedSource:f}=u,y=o.fragment,C=g===a.Required;C&&y.uniforms.add(new i("baseOpacity",(o=>o.baseOpacity)));const v=b!==r.Normal,h=f===t.On,j=n===c.Composite,k=n===c.GroupBackgroundComposite,B=!v&&!h&&(j&&!C||k);y.include(s,u);let L="";switch(n){case c.GroupBackgroundComposite:L=p`vec4(0.0)`;break;case c.ColorComposite:y.uniforms.add(new l("backgroundColor",(o=>o.backgroundColor))),L=p`vec4(backgroundColor, 1.0)`;break;case c.GridComposite:y.include(e),L=p`vec4(gridColor(uv), 1.0)`;break;case c.Composite:y.uniforms.add(new m("fboColor",(o=>o.fboTexture))),L=p`texelFetch(fboColor, ivec2(gl_FragCoord.xy), 0)`;case c.COUNT:}y.code.add(p`
5
+ import"../../../../../../core/has.js";import{ZEROS as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{LayerBlendMode as r}from"../output/BlendOptions.js";import{BackgroundGrid as e}from"./BackgroundGrid.glsl.js";import{BaseOpacityMode as a}from"./BaseOpacityMode.js";import{BlendLayersOutput as c}from"./BlendLayersOutput.js";import{PremultipliedAlphaSource as s}from"./PremultipliedAlphaSource.js";import{BlendModes as t}from"../util/BlendModes.glsl.js";import{Float3PassUniform as l}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as i}from"../../shaderModules/FloatPassUniform.js";import{glsl as p,If as d}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as m}from"../../shaderModules/Texture2DPassUniform.js";import{NoParameters as u}from"../../../../../webgl/NoParameters.js";class n extends u{constructor(){super(...arguments),this.baseOpacity=1,this.backgroundColor=o,this.fboTexture=null}}function b(o,u){const{output:n,blendMode:b,baseOpacityMode:g,premultipliedSource:f}=u,y=o.fragment,C=g===a.Required;C&&y.uniforms.add(new i("baseOpacity",(o=>o.baseOpacity)));const v=b!==r.Normal,h=f===s.On,j=n===c.Composite,k=n===c.GroupBackgroundComposite,B=!v&&!h&&(j&&!C||k);y.include(t,u);let L="";switch(n){case c.GroupBackgroundComposite:case c.Draw:L=p`vec4(0.0)`;break;case c.ColorComposite:y.uniforms.add(new l("backgroundColor",(o=>o.backgroundColor))),L=p`vec4(backgroundColor, 1.0)`;break;case c.GridComposite:y.include(e),L=p`vec4(gridColor(uv), 1.0)`;break;case c.Composite:y.uniforms.add(new m("fboColor",(o=>o.fboTexture))),L=p`texelFetch(fboColor, ivec2(gl_FragCoord.xy), 0)`;case c.COUNT:}y.code.add(p`
6
6
  vec4 getBackground(vec2 uv) {
7
7
  return ${d(C,p`baseOpacity *`)} ${L};
8
8
  }
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as t}from"./ContentObjectType.js";import{Default3D as s}from"./DefaultVertexAttributeLocations.js";import{updateParameters as i}from"../materials/internal/MaterialUtil.js";import{NoParameters as a}from"../../../webgl/NoParameters.js";class n extends r{constructor(r,a){super(),this.type=t.Material,this.supportsEdges=!1,this._renderPriority=0,this.vertexAttributeLocations=s,this._pp0=e(0,0,1),this._pp1=e(0,0,0),this._parameters=new a,i(this._parameters,r),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,r=!0){i(this._parameters,e)&&(this.validateParameters(this._parameters),r&&this._parametersChanged())}validateParameters(e){}shouldRender(e){return this.visible&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bind.decorations)&&!!(this.parameters.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}queryRenderOccludedState(e){return this.visible&&this.parameters.renderOccluded===e}get hasEmissions(){return!1}intersectDraped(e,r,t,s,i,a){return this._pp0[0]=this._pp1[0]=s[0],this._pp0[1]=this._pp1[1]=s[1],this.intersect(e,r,t,this._pp0,this._pp1,i)}}var p;!function(e){e[e.None=0]="None",e[e.Occlude=1]="Occlude",e[e.Transparent=2]="Transparent",e[e.OccludeAndTransparent=4]="OccludeAndTransparent",e[e.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",e[e.Opaque=16]="Opaque"}(p||(p={}));class o extends a{constructor(){super(...arguments),this.renderOccluded=p.Occlude,this.isDecoration=!1}}export{n as Material,o as MaterialParameters,p as RenderOccludedFlag};
5
+ import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as i}from"./ContentObjectType.js";import{Default3D as s}from"./DefaultVertexAttributeLocations.js";import{DefaultTechniqueConfiguration as a}from"../materials/DefaultTechniqueConfiguration.js";import{updateParameters as n}from"../materials/internal/MaterialUtil.js";import{NoParameters as p}from"../../../webgl/NoParameters.js";class o extends r{constructor(t,r){super(),this.type=i.Material,this.supportsEdges=!1,this._renderPriority=0,this.vertexAttributeLocations=s,this._pp0=e(0,0,1),this._pp1=e(0,0,0),this._parameters=new r,n(this._parameters,t),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){n(this._parameters,e)&&(this.validateParameters(this._parameters),t&&this._parametersChanged())}validateParameters(e){}shouldRender(e){return this.visible&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bind.decorations)&&!!(this.parameters.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}queryRenderOccludedState(e){return this.visible&&this.parameters.renderOccluded===e}get hasEmissions(){return!1}getConfiguration(e,r,i=new a){return i.output=e,i.hasHighlightMixTexture=e===t.Highlight&&null!=r.highlightMixTexture,i}intersectDraped(e,t,r,i,s,a){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this.intersect(e,t,r,this._pp0,this._pp1,s)}}var h;!function(e){e[e.None=0]="None",e[e.Occlude=1]="Occlude",e[e.Transparent=2]="Transparent",e[e.OccludeAndTransparent=4]="OccludeAndTransparent",e[e.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",e[e.Opaque=16]="Opaque"}(h||(h={}));class u extends p{constructor(){super(...arguments),this.renderOccluded=h.Occlude,this.isDecoration=!1}}export{o as Material,u as MaterialParameters,h as RenderOccludedFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../core/PooledArray.js";class r{constructor(r,e,i){this._context=r,this._locations=i,this._textures=new Map,this._freeTextureUnits=new t({deallocator:null}),this._glProgram=r.programCache.acquire(e.generate("vertex",!0),e.generate("fragment",!0),i),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=e.generateBind(this),this.bindPass=e.generateBindPass(this),this.bindDraw=e.generateBindDraw(this)}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,r){this._glProgram.setUniform1i(t,r?1:0)}setUniform1i(t,r){this._glProgram.setUniform1i(t,r)}setUniform1f(t,r){this._glProgram.setUniform1f(t,r)}setUniform2fv(t,r){this._glProgram.setUniform2fv(t,r)}setUniform3fv(t,r){this._glProgram.setUniform3fv(t,r)}setUniform4fv(t,r){this._glProgram.setUniform4fv(t,r)}setUniformMatrix3fv(t,r){this._glProgram.setUniformMatrix3fv(t,r)}setUniformMatrix4fv(t,r){this._glProgram.setUniformMatrix4fv(t,r)}setUniform1fv(t,r){this._glProgram.setUniform1fv(t,r)}setUniform1iv(t,r){this._glProgram.setUniform1iv(t,r)}setUniform2iv(t,r){this._glProgram.setUniform2iv(t,r)}setUniform3iv(t,r){this._glProgram.setUniform3iv(t,r)}setUniform4iv(t,r){this._glProgram.setUniform4iv(t,r)}assertCompatibleVertexAttributeLocations(t){t.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(t,r){let e=this._textures.get(t);null==e?(e=this._allocTextureUnit(r),this._textures.set(t,e)):e.texture=r,this._context.useProgram(this),this.setUniform1i(t,e.unit),this._context.bindTexture(r,e.unit)}_allocTextureUnit(t){return{texture:t,unit:0===this._freeTextureUnits.length?this._textures.size:this._freeTextureUnits.pop()}}}export{r as Program};
5
+ import"../../../../core/has.js";import{webglDebugEnabled as t}from"../../../webgl/checkWebGLError.js";class r{constructor(t,r,e){this._context=t,this._locations=e,this._textures=new Map,this._glProgram=t.programCache.acquire(r.generate("vertex",!0),r.generate("fragment",!0),e),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=r.generateBind(this),this.bindPass=r.generateBindPass(this),this.bindDraw=r.generateBindDraw(this)}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,r){this._glProgram.setUniform1i(t,r?1:0)}setUniform1i(t,r){this._glProgram.setUniform1i(t,r)}setUniform1f(t,r){this._glProgram.setUniform1f(t,r)}setUniform2fv(t,r){this._glProgram.setUniform2fv(t,r)}setUniform3fv(t,r){this._glProgram.setUniform3fv(t,r)}setUniform4fv(t,r){this._glProgram.setUniform4fv(t,r)}setUniformMatrix3fv(t,r){this._glProgram.setUniformMatrix3fv(t,r)}setUniformMatrix4fv(t,r){this._glProgram.setUniformMatrix4fv(t,r)}setUniform1fv(t,r){this._glProgram.setUniform1fv(t,r)}setUniform1iv(t,r){this._glProgram.setUniform1iv(t,r)}setUniform2iv(t,r){this._glProgram.setUniform2iv(t,r)}setUniform3iv(t,r){this._glProgram.setUniform3iv(t,r)}setUniform4iv(t,r){this._glProgram.setUniform4iv(t,r)}assertCompatibleVertexAttributeLocations(t){t.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear()}bindTexture(r,e){e?.glName||(t()&&console.error(`Texture sampler ${r} has no given Texture in ${(new Error).stack} `),e=this._context.emptyTexture);const i=this._ensureTextureUnit(r,e);this._context.useProgram(this),this.setUniform1i(r,i.unit),this._context.bindTexture(e,i.unit)}_ensureTextureUnit(t,r){let e=this._textures.get(t);return null==e?(e={texture:r,unit:this._textures.size},this._textures.set(t,e)):e.texture=r,e}}export{r as Program};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as b,invert as A,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as E,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as R}from"../../../../chunks/vec42.js";import{ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as I,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as w}from"../../../../geometry/support/Indices.js";import{RenderCategory as O,InternalRenderCategory as N}from"../../webgl.js";import{debugFlags as D}from"../../support/debugFlags.js";import{ColorFormat as y,DepthRenderbuffer16f as x}from"../../webgl/formats.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as L}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v,isColorOrColorEmission as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as F}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{RenderPluginManager as V}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as Q}from"../effects/highlight/Highlight.js";import{OITBlend as W}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as z}from"./AnimationTimeStep.js";import{RenderRequestType as Y}from"./basicInterfaces.js";import{BoundingInfo as X}from"./BoundingInfo.js";import{DepthRange as K}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as Z}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{RenderOccludedFlag as ee}from"./Material.js";import{OITPass as te}from"./OITPass.js";import{RenderContext as re,defaultRenderOccludedMask as ie}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as se,RendererTarget as ae}from"./rendererUtils.js";import{setupFeatureDefaults as ne,RenderFeature as he}from"./RenderFeature.js";import{RenderPluginInput as oe}from"./RenderPluginInput.js";import{RenderSlot as de}from"./RenderSlot.js";import{ShadowAccumulator as _e}from"./ShadowAccumulator.js";import{ShadowMap as le,SnapshotSlot as pe}from"./ShadowMap.js";import ue from"./SliceHelper.js";import{Transparency as me}from"./edgeRendering/interfaces.js";import{MergedRenderer as ce}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ge}from"../parts/renderUtils.js";import{RendererPerformanceInfo as fe,PerformanceCategory as be}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Ae}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as Ee,PixelType as Pe,FramebufferBit as Re,ColorAttachment1 as Se,ColorAttachment2 as Ie}from"../../../webgl/enums.js";class Ce{constructor(e,t,r,s,a,n){this._stage=e,this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._renderers=new Map,this.renderPassManager=new L,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=I(0,0,0,1),this._sliceHelper=new ue,this._blit=null,this._oitblend=null,this._state=c(Ae.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new z,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new oe,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new H(s),this._renderStateFeatures=c(ne(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new $(this.fboCache),this.performanceInfo=new fe(this._rctx),this._shadowMap=new le(this.fboCache,e.viewingMode),this._shadowAccumulator=new _e(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const i=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,i),this._renderShadowCascades(v.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new re(this._rctx,this._shadowMap,r),this._nodes=new q(this._renderContext),this._plugins=new V({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),p),l((()=>D.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(me.TRANSPARENT):()=>{},n()}),u),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?i(e):C;R(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),l((()=>this._stage.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=G),p),l((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),l((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),l((()=>this._stage.view.state.highlights),(e=>{this._bindParameters.highlights=e,this._updateHighlights(),n()}),u)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=null,this._oitblend=null,X.prune(),ce.prune(),w()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=ne(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(he.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(he.WaterReflection))}get _hasHighlights(){return this._plugins.produces(v.Highlight,de.OPAQUE_MATERIAL,de.TRANSPARENT_MATERIAL,de.DRAPED_MATERIAL,de.HUD_MATERIAL,de.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(v.Highlight,de.HUD_MATERIAL,de.LABEL_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(he.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(he.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(he.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Fe(this._stage.view.resourceController)});return this._handles.push(l((()=>r.updating),(()=>this._requestRender()),m)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&b(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slicePlane(e){this._sliceHelper.plane!==e&&(this._sliceHelper.plane=e,this._requestRender())}get plugins(){return this._plugins}getMaterialRenderer(e){return this._renderers.get(e)}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:i,updates:s}=e;if(0===r.length&&0===i.length&&0===s.length)return;se(e).forEach(((r,i)=>{if(t.done)return;let s=this._renderers.get(i);null==s&&r.adds.length>0&&(s=new ce({material:i,highlightOrderMap:this._stage.view.state.highlightOrderMap}),s.initializeRenderContext(this._plugins.context),this._plugins.add(s),this._renderers.set(i,s)),s&&(s.modify(r),s.updateHighlights(this._stage.view.state.highlightOrderMap),0===s.numGeometries&&(this._renderers.delete(s.material),this._plugins.remove(s),s.destroy())),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),this.updateHasFlags()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(v.Color,...He),has.water=this._plugins.produces(v.Normal,de.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ae.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new ge(this._pluginInput.get(O.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=Z,l=this._stage.view,p=l.stateManager.camera,u=l.qualitySettings.fadeDuration,m=e===Ae.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(_-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/u,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=ae.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===ae.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),_=this._nodes.produces(O.FINAL),l=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,O.COMPOSITE,O.FINAL)>0&&this._plugins.hasEmissions,p=l?v.ColorEmission:v.Color;this._renderContext.time=t,this._renderContext.output=p,this._bindParameters.oitPass=te.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.slicePlane=this._sliceHelper.plane,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(v.Color,...ye);this._precompilePrepasses(),this.performanceInfo.advance(be.PREPARE);const f=this._computeDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,p),this._renderContext.output=p,u.bind(),this._bindParameters.mainDepth=u.depth.attachment;const b=this.plugins.produces(v.Color,...De);b&&this._renderOpaqueGeometry(),u.update((e=>this._renderNodes(O.OPAQUE,e,b))),this.fboCache.debugCallback?.(O.OPAQUE,u.color.fbo),u.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,u.color.fbo),this._renderTerrainDepth(c),this._renderEdges(me.OPAQUE),u.bind(),this._renderPlugins(de.VOXEL,be.VOXEL),this._renderHiddenTransparentEdges(),g&&(this._oitEnabled?this._renderOIT(we.Geometry,p):this._renderTransparentGeometry()),u.update((e=>this._renderNodes(O.TRANSPARENT,e,g))),this.fboCache.debugCallback?.(O.TRANSPARENT,u.color.fbo),this._renderGeometryDepth(c),this._renderHUDVisibility(),c||this._plugins.render(this._pluginInput,de.LINE_CALLOUTS),this._renderEdges(me.TRANSPARENT);const A=this._hasTransparentTerrain?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(be.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(F.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,A.getTexture())),this._renderHUD(F.Occluded,u.color,p))),this._bindParameters.cullAboveTerrain=!1,A&&(u.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,A.getTexture()),A.release(),c&&(this._renderEdges(me.OPAQUE),g&&(this._oitEnabled?this._renderOIT(we.Geometry,p):this._renderTransparentGeometry(),this.performanceInfo.advance(be.TRANSPARENT)),this._renderEdges(me.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),c&&this._renderLineCallouts(F.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment(),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(N.VIEWSHED,e))),u.update((e=>this._renderNodes(N.LASERLINES,e))),u.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),u.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const T=r===ae.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(O.COMPOSITE,e))),this._pluginInput.release(N.FOCUSAREA);const E=!(r!==ae.Default||_||o&&!i),P=this._pluginInput.get(O.COMPOSITE),R=E?M:this.fboCache.acquire(P.fbo.width,P.fbo.height,N.ANTIALIASING),S=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,R):this._blitFBO(P,R,!1);let I;this._pluginInput.set(N.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(F.NotOccluded,S,p),I=this._renderNodes(N.HIGHLIGHTS,S)):(I=this._renderNodes(N.HIGHLIGHTS,S),this._renderHUD(F.NotOccluded,I,p));const C=this._renderNodes(N.MAGNIFIER,I);return o&&!i&&r===ae.Default&&!_&&this._blitFBO(C),_?(C.attachDepth(u.depth),this._blitFBO(this._renderNodes(O.FINAL,C)),C.detachDepth()):this._pluginInput.set(O.FINAL,C),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ae.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new ge(this._pluginInput.get(O.FINAL),T)}_precompileShaders(e,t,r){if(++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=v.Depth,this._plugins.precompile(de.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(de.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(de.OCCLUSION_PIXELS),this._plugins.precompile(de.LINE_CALLOUTS),this._precompileHUD(F.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS),this._precompileHUD(F.NotOccluded),this._hasHighlights){const e=this._bindParameters;e.highlights.forEach(((t,r)=>{e.highlightLevel=r,this._precompileAllGeometry(v.Highlight)})),e.highlightLevel=null}this._nodes.precompile(O.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_updateHighlights(){const e=this._stage.view.state;this._renderers.forEach((t=>t.updateHighlights(e.highlightOrderMap)))}_renderFocusAreaGeometry(){if(!this._nodes.produces(N.FOCUSAREA))return null;const{width:e,height:t}=this._framebufferSize;let r=this.fboCache.acquire(e,t,N.FOCUSAREA);return r=this._nodes.render(r,this._pluginInput),this.performanceInfo.advance(be.FOCUS_AREA_MASK),r}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(Te),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(be.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Y.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Ee.RGBA,Pe.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Ee.RGBA,Pe.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,C),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===me.OPAQUE?be.OPAQUE_EDGES:be.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(be.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(he.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),i.moveSnapshot(pe.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(pe.ExcludeHighlight),this._renderShadowCascades(v.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(v.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(be.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(v.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");if(e){const t=this._needsDepth?e.getAttachment(Te):null;t?.retain(),this._pluginInput.set(N.SSAO,this._renderSSAO()),this._renderGeometryWithoutNormalsDepth(t)}else this._renderAllGeometryDepth()}_renderGeometryWithoutNormalsDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=d(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth");r.attachDepth(e),e.release(),this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(Re.STENCIL),this._renderGeometryWithoutNormals(v.Depth),d(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(be.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth").acquireDepth(Te);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this.renderAllGeometry(v.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(be.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=v.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(Te);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth").acquireDepth(Te);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this._renderOpaqueAndTransparentGeometry(v.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeDepthRange(e){if(!this._needsDepthRange)return K.zero;const t=J(e,this._plugins.plugins,this._stage.layers);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}get _normalsRequired(){const e=this._nodes.require("normals",O.FINAL,O.COMPOSITE,O.OPAQUE,O.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(v.Normal),this._needsDepth&&this._precompileAllGeometry(v.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(v.ShadowHighlight),this._precompileShadowCascades(v.ShadowExcludeHighlight),this._precompileShadowCascades(v.ShadowHighlight)):this._precompileShadowCascades(v.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(v.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",y.RGBA8);r.acquireDepth(Te),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._renderGeometryWithNormals(v.Normal);const i=this._nodes.optional("normals",O.FINAL,O.COMPOSITE,O.OPAQUE,O.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(be.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName(N.SSAO);const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(be.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(de.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...xe);this._renderContext.renderOccludedMask=ie}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>ee.Occlude&&this._plugins.render(this._pluginInput,de.OCCLUDED_TERRAIN),this.renderSlots(e,...xe),this._renderContext.renderOccludedMask=ie}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,de.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(v.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(v.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Oe),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Ne)}_precompileOpaqueGeometry(){this._plugins.precompile(...De)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...De)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...ye)}get _hasTransparentTerrain(){return this._plugins.produces(v.Color,de.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,de.TRANSPARENT_TERRAIN);if(!U(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,C),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,de.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",y.RGBA4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,de.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(be.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===F.Occluded){const e=()=>this._plugins.render(this._pluginInput,de.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(x,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,de.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=v.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&U(this._renderContext.output)?(this._bindParameters.oitPass=te.ColorAlpha,this._plugins.precompile(...He),this._bindParameters.oitPass=te.FrontFace,this._plugins.precompile(...He),this._bindParameters.oitPass=te.NONE):this._plugins.precompile(...He),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(we.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===F.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(x,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(x),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===F.Occluded?be.HUD_OCCLUDED:be.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...He)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(v.ShadowHighlight,de.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?y.RG8UI:y.R8UI);a.acquireDepth(Te),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=v.Highlight,t.bindFramebuffer(a.fbo),Q(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(be.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Me),this._rctx.clear(Re.DEPTH),this._renderHUDElements(F.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(be.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&U(this._renderContext.output)?(this._bindParameters.oitPass=te.ColorAlpha,this._plugins.precompile(...ye),this._bindParameters.oitPass=te.FrontFace,this._plugins.precompile(...ye),this._bindParameters.oitPass=te.NONE):this._plugins.precompile(...ye)}_renderOIT(e,t,r=F.Both){const i=e===we.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=te.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",_=this.fboCache.acquire(s.width,s.height,d,y.RGBA16F),l=t===v.ColorEmission;l&&_.acquireColor(Se,y.RGBA16F,"emissive"),_.acquireColor(l?Ie:Se,y.R16F),a||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,S),n(),_.detachDepth(),h.oitPass=te.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return l&&p.acquireColor(Se,y.RGBA16F,"emissive"),a?p.acquireDepth(x):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(C,!!a),n(),p.detachDepth(),h.oitPass=te.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Re.COLOR)):this._framebuffer.bind(),this._oitblend??=new W(this._techniques),this._oitblend.blend(this._rctx,_,p,h,l),a?.detachDepth(),p.release(),_.release(),this._renderContext.output=o,a}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(be.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(be.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=E:(A(ve,this._bindParameters.camera.viewMatrix),A(Le,this._bindParameters.camera.projectionMatrix),T(Ue,ve,Le),T(Ue,this._renderContext.lastFrameCamera.viewMatrix,Ue),T(Ue,this._renderContext.lastFrameCamera.projectionMatrix,Ue),this._reprojectionMatrix=Ue);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=E,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(Y.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}}var we;e([f({readOnly:!0})],Ce.prototype,"fullResolutionAtmosphere",null),e([f()],Ce.prototype,"_edgeView",void 0),e([f()],Ce.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(we||(we={}));const Oe=[de.INTEGRATED_MESH,de.OPAQUE_TERRAIN,de.OPAQUE_MATERIAL,de.TRANSPARENT_MATERIAL],Ne=[de.OPAQUE_MATERIAL_WITHOUT_NORMALS,de.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],De=[de.INTEGRATED_MESH,de.OPAQUE_TERRAIN,de.OPAQUE_MATERIAL,de.OPAQUE_MATERIAL_WITHOUT_NORMALS],ye=[de.TRANSPARENT_MATERIAL,de.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],xe=[de.OPAQUE_MATERIAL,de.TRANSPARENT_MATERIAL,de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],He=[de.LINE_CALLOUTS_HUD_DEPTH,de.HUD_MATERIAL,de.LABEL_MATERIAL],Me=[de.TRANSPARENT_MATERIAL,de.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,de.OPAQUE_MATERIAL,de.OPAQUE_MATERIAL_WITHOUT_NORMALS,de.TRANSPARENT_TERRAIN,de.INTEGRATED_MESH,de.OPAQUE_TERRAIN],Le=P(),ve=P(),Ue=P();function Fe(e){return t=>e.immediate.schedule(t)}export{Ce as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as b,invert as A,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as E,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as R}from"../../../../chunks/vec42.js";import{ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as I,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as w}from"../../../../geometry/support/Indices.js";import{RenderCategory as O,InternalRenderCategory as N}from"../../webgl.js";import{debugFlags as D}from"../../support/debugFlags.js";import{ColorFormat as y,DepthRenderbuffer16f as x}from"../../webgl/formats.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as L}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v,isColorOrColorEmission as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as F}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{RenderPluginManager as V}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as Q}from"../effects/highlight/Highlight.js";import{OITBlend as W}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as z}from"./AnimationTimeStep.js";import{RenderRequestType as Y}from"./basicInterfaces.js";import{BoundingInfo as X}from"./BoundingInfo.js";import{DepthRange as K}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as Z}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{RenderOccludedFlag as ee}from"./Material.js";import{OITPass as te}from"./OITPass.js";import{RenderContext as re,defaultRenderOccludedMask as ie}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as se,RendererTarget as ae}from"./rendererUtils.js";import{setupFeatureDefaults as ne,RenderFeature as he}from"./RenderFeature.js";import{RenderPluginInput as oe}from"./RenderPluginInput.js";import{RenderSlot as de}from"./RenderSlot.js";import{ShadowAccumulator as _e}from"./ShadowAccumulator.js";import{ShadowMap as le,SnapshotSlot as pe}from"./ShadowMap.js";import ue from"./SliceHelper.js";import{Transparency as me}from"./edgeRendering/interfaces.js";import{MergedRenderer as ce}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ge}from"../parts/renderUtils.js";import{RendererPerformanceInfo as fe,PerformanceCategory as be}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Ae}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as Ee,PixelType as Pe,FramebufferBit as Re,ColorAttachment1 as Se,ColorAttachment2 as Ie}from"../../../webgl/enums.js";class Ce{constructor(e,t,r,s,a,n){this._stage=e,this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._renderers=new Map,this.renderPassManager=new L,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=I(0,0,0,1),this._sliceHelper=new ue,this._blit=null,this._oitblend=null,this._state=c(Ae.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new z,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new oe,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new H(s),this._renderStateFeatures=c(ne(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new $(this.fboCache),this.performanceInfo=new fe(this._rctx),this._shadowMap=new le(this.fboCache,e.viewingMode),this._shadowAccumulator=new _e(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const i=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,i),this._renderShadowCascades(v.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new re(this._rctx,this._shadowMap,r),this._nodes=new q(this._renderContext),this._plugins=new V({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),p),l((()=>D.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(me.TRANSPARENT):()=>{},n()}),u),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?i(e):C;R(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),l((()=>this._stage.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=G),p),l((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),l((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),l((()=>this._stage.view.state.highlights),(e=>{this._bindParameters.highlights=e,this._updateHighlights(),n()}),u)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=null,this._oitblend=null,X.prune(),ce.prune(),w()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=ne(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(he.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(he.WaterReflection))}get _hasHighlights(){return this._plugins.produces(v.Highlight,de.OPAQUE_MATERIAL,de.TRANSPARENT_MATERIAL,de.DRAPED_MATERIAL,de.HUD_MATERIAL,de.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(v.Highlight,de.HUD_MATERIAL,de.LABEL_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(he.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(he.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(he.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Fe(this._stage.view.resourceController)});return this._handles.push(l((()=>r.updating),(()=>this._requestRender()),m)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&b(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slicePlane(e){this._sliceHelper.plane!==e&&(this._sliceHelper.plane=e,this._requestRender())}get plugins(){return this._plugins}getMaterialRenderer(e){return this._renderers.get(e)}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:i,updates:s}=e;if(0===r.length&&0===i.length&&0===s.length)return;se(e).forEach(((r,i)=>{if(t.done)return;let s=this._renderers.get(i);null==s&&r.adds.length>0&&(s=new ce({material:i,highlightOrderMap:this._stage.view.state.highlightOrderMap}),s.initializeRenderContext(this._plugins.context),this._plugins.add(s),this._renderers.set(i,s)),s&&(s.modify(r),s.updateHighlights(this._stage.view.state.highlightOrderMap),0===s.numGeometries&&(this._renderers.delete(s.material),this._plugins.remove(s),s.destroy())),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),this.updateHasFlags()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(v.Color,...He),has.water=this._plugins.produces(v.Normal,de.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ae.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new ge(this._pluginInput.get(O.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=Z,l=this._stage.view,p=l.stateManager.camera,u=l.qualitySettings.fadeDuration,m=e===Ae.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(_-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/u,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=ae.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===ae.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),_=this._nodes.produces(O.FINAL),l=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,O.COMPOSITE,O.FINAL)>0&&this._plugins.hasEmissions,p=l?v.ColorEmission:v.Color;this._renderContext.time=t,this._renderContext.output=p,this._bindParameters.oitPass=te.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.slicePlane=this._sliceHelper.plane,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(v.Color,...ye);this._precompilePrepasses(),this.performanceInfo.advance(be.PREPARE);const f=this._computeDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,p),this._renderContext.output=p,u.bind(),this._bindParameters.mainDepth=u.depth.attachment;const b=this.plugins.produces(v.Color,...De);b&&this._renderOpaqueGeometry(),u.update((e=>this._renderNodes(O.OPAQUE,e,b))),this.fboCache.debugCallback?.(O.OPAQUE,u.color.fbo),u.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,u.color.fbo),this._renderTerrainDepth(c),this._renderEdges(me.OPAQUE),u.bind(),this._renderPlugins(de.VOXEL,be.VOXEL),this._renderHiddenTransparentEdges(),g&&(this._oitEnabled?this._renderOIT(we.Geometry,p):this._renderTransparentGeometry()),u.update((e=>this._renderNodes(O.TRANSPARENT,e,g))),this.fboCache.debugCallback?.(O.TRANSPARENT,u.color.fbo),this._renderGeometryDepth(c),this._renderHUDVisibility(),c||this._plugins.render(this._pluginInput,de.LINE_CALLOUTS),this._renderEdges(me.TRANSPARENT);const A=this._hasTransparentTerrain?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(be.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(F.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,A.getTexture())),this._renderHUD(F.Occluded,u.color,p))),this._bindParameters.cullAboveTerrain=!1,A&&(u.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,A.getTexture()),A.release(),c&&(this._renderEdges(me.OPAQUE),g&&(this._oitEnabled?this._renderOIT(we.Geometry,p):this._renderTransparentGeometry(),this.performanceInfo.advance(be.TRANSPARENT)),this._renderEdges(me.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),c&&this._renderLineCallouts(F.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment(),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(N.VIEWSHED,e))),u.update((e=>this._renderNodes(N.LASERLINES,e))),u.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),u.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const T=r===ae.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(O.COMPOSITE,e))),this._pluginInput.release(N.FOCUSAREA);const E=!(r!==ae.Default||_||o&&!i),P=this._pluginInput.get(O.COMPOSITE),R=E?M:this.fboCache.acquire(P.fbo.width,P.fbo.height,N.ANTIALIASING),S=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,R):this._blitFBO(P,R,!1);let I;this._pluginInput.set(N.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(F.NotOccluded,S,p),I=this._renderNodes(N.HIGHLIGHTS,S)):(I=this._renderNodes(N.HIGHLIGHTS,S),this._renderHUD(F.NotOccluded,I,p));const C=this._renderNodes(N.MAGNIFIER,I);return o&&!i&&r===ae.Default&&!_&&this._blitFBO(C),_?(C.attachDepth(u.depth),this._blitFBO(this._renderNodes(O.FINAL,C)),C.detachDepth()):this._pluginInput.set(O.FINAL,C),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ae.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new ge(this._pluginInput.get(O.FINAL),T)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=v.Depth,this._plugins.precompile(de.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(de.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(de.OCCLUSION_PIXELS),this._plugins.precompile(de.LINE_CALLOUTS),this._precompileHUD(F.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(F.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(v.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(O.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_updateHighlights(){const e=this._stage.view.state;this._renderers.forEach((t=>t.updateHighlights(e.highlightOrderMap)))}_renderFocusAreaGeometry(){if(!this._nodes.produces(N.FOCUSAREA))return null;const{width:e,height:t}=this._framebufferSize;let r=this.fboCache.acquire(e,t,N.FOCUSAREA);return r=this._nodes.render(r,this._pluginInput),this.performanceInfo.advance(be.FOCUS_AREA_MASK),r}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(Te),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(be.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Y.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Ee.RGBA,Pe.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Ee.RGBA,Pe.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,C),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===me.OPAQUE?be.OPAQUE_EDGES:be.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(be.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(he.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),i.moveSnapshot(pe.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(pe.ExcludeHighlight),this._renderShadowCascades(v.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(v.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(be.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(v.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");if(e){const t=this._needsDepth?e.getAttachment(Te):null;t?.retain(),this._pluginInput.set(N.SSAO,this._renderSSAO()),this._renderGeometryWithoutNormalsDepth(t)}else this._renderAllGeometryDepth()}_renderGeometryWithoutNormalsDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=d(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth");r.attachDepth(e),e.release(),this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(Re.STENCIL),this._renderGeometryWithoutNormals(v.Depth),d(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(be.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth").acquireDepth(Te);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this.renderAllGeometry(v.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(be.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=v.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(Te);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth").acquireDepth(Te);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this._renderOpaqueAndTransparentGeometry(v.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeDepthRange(e){if(!this._needsDepthRange)return K.zero;const t=J(e,this._plugins.plugins,this._stage.layers);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}get _normalsRequired(){const e=this._nodes.require("normals",O.FINAL,O.COMPOSITE,O.OPAQUE,O.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(v.Normal),this._needsDepth&&this._precompileAllGeometry(v.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(v.ShadowHighlight),this._precompileShadowCascades(v.ShadowExcludeHighlight),this._precompileShadowCascades(v.ShadowHighlight)):this._precompileShadowCascades(v.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(v.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",y.RGBA8);r.acquireDepth(Te),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._renderGeometryWithNormals(v.Normal);const i=this._nodes.optional("normals",O.FINAL,O.COMPOSITE,O.OPAQUE,O.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(be.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName(N.SSAO);const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(be.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(de.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...xe);this._renderContext.renderOccludedMask=ie}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>ee.Occlude&&this._plugins.render(this._pluginInput,de.OCCLUDED_TERRAIN),this.renderSlots(e,...xe),this._renderContext.renderOccludedMask=ie}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,de.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(v.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(v.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Oe),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Ne)}_precompileOpaqueGeometry(){this._plugins.precompile(...De)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...De)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...ye)}get _hasTransparentTerrain(){return this._plugins.produces(v.Color,de.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,de.TRANSPARENT_TERRAIN);if(!U(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,C),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,de.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",y.RGBA4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,de.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(be.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===F.Occluded){const e=()=>this._plugins.render(this._pluginInput,de.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(x,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,de.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=v.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&U(this._renderContext.output)?(this._bindParameters.oitPass=te.ColorAlpha,this._plugins.precompile(...He),this._bindParameters.oitPass=te.FrontFace,this._plugins.precompile(...He),this._bindParameters.oitPass=te.NONE):this._plugins.precompile(...He),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(we.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===F.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(x,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(x),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===F.Occluded?be.HUD_OCCLUDED:be.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...He)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(v.ShadowHighlight,de.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?y.RG8UI:y.R8UI);a.acquireDepth(Te),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=v.Highlight,t.bindFramebuffer(a.fbo),Q(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(be.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Me),this._rctx.clear(Re.DEPTH),this._renderHUDElements(F.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(be.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&U(this._renderContext.output)?(this._bindParameters.oitPass=te.ColorAlpha,this._plugins.precompile(...ye),this._bindParameters.oitPass=te.FrontFace,this._plugins.precompile(...ye),this._bindParameters.oitPass=te.NONE):this._plugins.precompile(...ye)}_renderOIT(e,t,r=F.Both){const i=e===we.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=te.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",_=this.fboCache.acquire(s.width,s.height,d,y.RGBA16F),l=t===v.ColorEmission;l&&_.acquireColor(Se,y.RGBA16F,"emissive"),_.acquireColor(l?Ie:Se,y.R16F),a||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,S),n(),_.detachDepth(),h.oitPass=te.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return l&&p.acquireColor(Se,y.RGBA16F,"emissive"),a?p.acquireDepth(x):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(C,!!a),n(),p.detachDepth(),h.oitPass=te.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Re.COLOR)):this._framebuffer.bind(),this._oitblend??=new W(this._techniques),this._oitblend.blend(this._rctx,_,p,h,l),a?.detachDepth(),p.release(),_.release(),this._renderContext.output=o,a}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(be.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(be.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=E:(A(ve,this._bindParameters.camera.viewMatrix),A(Le,this._bindParameters.camera.projectionMatrix),T(Ue,ve,Le),T(Ue,this._renderContext.lastFrameCamera.viewMatrix,Ue),T(Ue,this._renderContext.lastFrameCamera.projectionMatrix,Ue),this._reprojectionMatrix=Ue);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=E,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(Y.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}}var we;e([f({readOnly:!0})],Ce.prototype,"fullResolutionAtmosphere",null),e([f()],Ce.prototype,"_edgeView",void 0),e([f()],Ce.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(we||(we={}));const Oe=[de.INTEGRATED_MESH,de.OPAQUE_TERRAIN,de.OPAQUE_MATERIAL,de.TRANSPARENT_MATERIAL],Ne=[de.OPAQUE_MATERIAL_WITHOUT_NORMALS,de.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],De=[de.INTEGRATED_MESH,de.OPAQUE_TERRAIN,de.OPAQUE_MATERIAL,de.OPAQUE_MATERIAL_WITHOUT_NORMALS],ye=[de.TRANSPARENT_MATERIAL,de.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],xe=[de.OPAQUE_MATERIAL,de.TRANSPARENT_MATERIAL,de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],He=[de.LINE_CALLOUTS_HUD_DEPTH,de.HUD_MATERIAL,de.LABEL_MATERIAL],Me=[de.TRANSPARENT_MATERIAL,de.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,de.OPAQUE_MATERIAL,de.OPAQUE_MATERIAL_WITHOUT_NORMALS,de.TRANSPARENT_TERRAIN,de.INTEGRATED_MESH,de.OPAQUE_TERRAIN],Le=P(),ve=P(),Ue=P();function Fe(e){return t=>e.immediate.schedule(t)}export{Ce 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.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as a,onAbort as i,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as m,isDataProtocol as h}from"../../../../core/urlUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as p}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as d}from"./basicInterfaces.js";import{createTextureKTX2 as u,createTextureBasis as c,estimateMemoryKTX2 as g,estimateMemoryBasis as T}from"./BasisUtil.js";import{ContentObject as A}from"./ContentObject.js";import{ContentObjectType as E}from"./ContentObjectType.js";import{createDDSTexture as f}from"./DDSUtil.js";import{ensureImageMaxSize as D}from"./textureUtils.js";import{assert as x}from"./Util.js";import{TextureWrapMode as y,TextureSamplingMode as I,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as U}from"../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../webgl/TextureDescriptor.js";class N extends A{constructor(e,r){super(),this._data=e,this.type=E.Texture,this.events=new t,this._parameters={...R,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.frameUpdate=t=>this._frameUpdate(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(m(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){h(e.src)||m(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new C;return t.wrapMode=this._parameters.wrap??y.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?I.LINEAR_MIPMAP_LINEAR:I.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||w(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new U(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===d.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===d.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_frameUpdate(e,t){return null==this._glTexture||e.readyState<M.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=f(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>u(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>c(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){x(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?F.LUMINANCE:3===this._parameters.components?F.RGB:F.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new U(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return a(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await p(t,t.src,!1,r);return a(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=M.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((a=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",_),s(p)},h=()=>{r.readyState>=M.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},_=t=>{m(),l(t||new e("Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",_);const p=i(a,(()=>_(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=D(r,e.parameters));const s=H(r);this._parameters.width=s.width,this._parameters.height=s.height;const a=this._createDescriptor(e);return a.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,a.width=s.width,a.height=s.height,a.shouldCompress=this._parameters.shouldCompress,this._glTexture=new U(e,a,r),this._emptyTexture=null,this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function w(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===d.KTX2_ENCODING?g(e,!!t.mipmap):t.encoding===d.BASIS_ENCODING?T(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?H(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function H(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}var M;!function(e){e[e.HAVE_NOTHING=0]="HAVE_NOTHING",e[e.HAVE_METADATA=1]="HAVE_METADATA",e[e.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",e[e.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",e[e.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(M||(M={}));const R={wrap:{s:y.REPEAT,t:y.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1,shouldCompress:!1};export{N as Texture};
5
+ import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as a,onAbort as i,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as m,isDataProtocol as h}from"../../../../core/urlUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as p}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as d}from"./basicInterfaces.js";import{createTextureKTX2 as c,createTextureBasis as u,estimateMemoryKTX2 as g,estimateMemoryBasis as T}from"./BasisUtil.js";import{ContentObject as A}from"./ContentObject.js";import{ContentObjectType as E}from"./ContentObjectType.js";import{createDDSTexture as f}from"./DDSUtil.js";import{ensureImageMaxSize as D}from"./textureUtils.js";import{assert as x}from"./Util.js";import{TextureWrapMode as y,TextureSamplingMode as I,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as U}from"../../../webgl/Texture.js";import{TextureDescriptor as H}from"../../../webgl/TextureDescriptor.js";class N extends A{constructor(e,r){super(),this._data=e,this.type=E.Texture,this.events=new t,this._parameters={...R,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.frameUpdate=t=>this._frameUpdate(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(m(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){h(e.src)||m(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new H;return t.wrapMode=this._parameters.wrap??y.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?I.LINEAR_MIPMAP_LINEAR:I.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||w(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new U(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===d.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===d.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_frameUpdate(e,t){return null==this._glTexture||e.readyState<M.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=f(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>c(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>u(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){x(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?F.LUMINANCE:3===this._parameters.components?F.RGB:F.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new U(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return a(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await p(t,t.src,!1,r);return a(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=M.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((a=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",_),s(p)},h=()=>{r.readyState>=M.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},_=t=>{m(),l(t||new e("Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",_);const p=i(a,(()=>_(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=D(r,e.parameters));const s=C(r);this._parameters.width=s.width,this._parameters.height=s.height;const a=this._createDescriptor(e);return a.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,a.width=s.width,a.height=s.height,a.compressionHandle=this._parameters.compressionHandle,this._glTexture=new U(e,a,r),this._emptyTexture=null,this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function w(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===d.KTX2_ENCODING?g(e,!!t.mipmap):t.encoding===d.BASIS_ENCODING?T(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?C(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function C(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}var M;!function(e){e[e.HAVE_NOTHING=0]="HAVE_NOTHING",e[e.HAVE_METADATA=1]="HAVE_METADATA",e[e.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",e[e.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",e[e.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(M||(M={}));const R={wrap:{s:y.REPEAT,t:y.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{N as Texture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- var e;function E(E){return E===e.POSITION}!function(e){e.POSITION="position",e.NORMAL="normal",e.NORMALCOMPRESSED="normalCompressed",e.UV0="uv0",e.UVI="uvi",e.COLOR="color",e.SYMBOLCOLOR="symbolColor",e.SIZE="size",e.ROTATION="rotation",e.TANGENT="tangent",e.OFFSET="offset",e.PERSPECTIVEDIVIDE="perspectiveDivide",e.CENTEROFFSETANDDISTANCE="centerOffsetAndDistance",e.LENGTH="length",e.PREVPOSITION="prevPosition",e.NEXTPOSITION="nextPosition",e.U0="u0",e.LINEPARAMETERS="lineParameters",e.COLORFEATUREATTRIBUTE="colorFeatureAttribute",e.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",e.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",e.DISTANCETOSTART="distanceToStart",e.UVMAPSPACE="uvMapSpace",e.BOUNDINGRECT="boundingRect",e.UVREGION="uvRegion",e.PROFILERIGHT="profileRight",e.PROFILEUP="profileUp",e.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",e.PROFILEAUXDATA="profileAuxData",e.FEATUREVALUE="featureValue",e.INSTANCEMODELORIGINHI="instanceModelOriginHi",e.INSTANCEMODELORIGINLO="instanceModelOriginLo",e.INSTANCEMODEL="instanceModel",e.INSTANCEMODELNORMAL="instanceModelNormal",e.INSTANCECOLOR="instanceColor",e.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",e.LOCALTRANSFORM="localTransform",e.GLOBALTRANSFORM="globalTransform",e.BOUNDINGSPHERE="boundingSphere",e.MODELORIGIN="modelOrigin",e.MODELSCALEFACTORS="modelScaleFactors",e.FEATUREATTRIBUTE="featureAttribute",e.STATE="state",e.LODLEVEL="lodLevel",e.POSITION0="position0",e.POSITION1="position1",e.NORMAL2COMPRESSED="normal2Compressed",e.COMPONENTINDEX="componentIndex",e.VARIANTOFFSET="variantOffset",e.VARIANTSTROKE="variantStroke",e.VARIANTEXTENSION="variantExtension",e.SIDENESS="sideness",e.START="start",e.END="end",e.UP="up",e.START_UP="startUp",e.END_UP="endUp",e.EXTRUDE="extrude",e.OLIDCOLOR="objectAndLayerIdColor",e.INSTANCEOBJECTANDLAYERIDCOLOR="instanceObjectAndLayerIdColor"}(e||(e={}));export{e as VertexAttribute,E as affectsGeometry};
5
+ var e;function E(E){return E===e.POSITION}!function(e){e.POSITION="position",e.NORMAL="normal",e.NORMALCOMPRESSED="normalCompressed",e.UV0="uv0",e.UVI="uvi",e.COLOR="color",e.SYMBOLCOLOR="symbolColor",e.SIZE="size",e.ROTATION="rotation",e.TANGENT="tangent",e.OFFSET="offset",e.PERSPECTIVEDIVIDE="perspectiveDivide",e.CENTEROFFSETANDDISTANCE="centerOffsetAndDistance",e.LENGTH="length",e.NEXTDELTA="nextDelta",e.PREVIOUSDELTA="previousDelta",e.U0="u0",e.LINEPARAMETERS="lineParameters",e.COLORFEATUREATTRIBUTE="colorFeatureAttribute",e.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",e.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",e.DISTANCETOSTART="distanceToStart",e.UVMAPSPACE="uvMapSpace",e.BOUNDINGRECT="boundingRect",e.UVREGION="uvRegion",e.PROFILERIGHT="profileRight",e.PROFILEUP="profileUp",e.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",e.PROFILEAUXDATA="profileAuxData",e.FEATUREVALUE="featureValue",e.INSTANCEMODELORIGINHI="instanceModelOriginHi",e.INSTANCEMODELORIGINLO="instanceModelOriginLo",e.INSTANCEMODEL="instanceModel",e.INSTANCEMODELNORMAL="instanceModelNormal",e.INSTANCECOLOR="instanceColor",e.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",e.LOCALTRANSFORM="localTransform",e.GLOBALTRANSFORM="globalTransform",e.BOUNDINGSPHERE="boundingSphere",e.MODELORIGIN="modelOrigin",e.MODELSCALEFACTORS="modelScaleFactors",e.FEATUREATTRIBUTE="featureAttribute",e.STATE="state",e.LODLEVEL="lodLevel",e.POSITION0="position0",e.POSITION1="position1",e.NORMAL2COMPRESSED="normal2Compressed",e.COMPONENTINDEX="componentIndex",e.VARIANTOFFSET="variantOffset",e.VARIANTSTROKE="variantStroke",e.VARIANTEXTENSION="variantExtension",e.SIDENESS="sideness",e.START="start",e.END="end",e.UP="up",e.START_UP="startUp",e.END_UP="endUp",e.EXTRUDE="extrude",e.OLIDCOLOR="objectAndLayerIdColor",e.INSTANCEOBJECTANDLAYERIDCOLOR="instanceObjectAndLayerIdColor"}(e||(e={}));export{e as VertexAttribute,E as affectsGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{MaterialParameters as s}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as a}from"./DefaultBufferWriter.js";import{PositionUvLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as f}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as c}from"../../../../webscene/support/AlphaCutoff.js";class u extends p{constructor(r){super(r,m),this._configuration=new f,this.produces=new Map([[o.OPAQUE_MATERIAL,r=>e(r)&&!this.transparent],[o.TRANSPARENT_MATERIAL,r=>e(r)&&this.transparent&&this.parameters.writeDepth],[o.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,r=>e(r)&&this.transparent&&!this.parameters.writeDepth]])}getConfiguration(r,t){return this._configuration.transparent=this.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color1[3]>=c||this.parameters.color2[3]>=c}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new l(r)}createBufferWriter(){return new a(n)}}class l extends i{beginSlot(r){return this.getTechnique(h,r)}}class m extends s{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.writeDepth=!0,this.polygonOffset=!1}}export{u as CheckerBoardMaterial,m as Parameters};
5
+ import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{MaterialParameters as s}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as a}from"./DefaultBufferWriter.js";import{PositionUvLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as f}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as c}from"../../../../webscene/support/AlphaCutoff.js";class u extends p{constructor(r){super(r,m),this._configuration=new f,this.produces=new Map([[o.OPAQUE_MATERIAL,r=>e(r)&&!this.transparent],[o.TRANSPARENT_MATERIAL,r=>e(r)&&this.transparent&&this.parameters.writeDepth],[o.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,r=>e(r)&&this.transparent&&!this.parameters.writeDepth]])}getConfiguration(r,t){return super.getConfiguration(r,t,this._configuration),this._configuration.transparent=this.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}get visible(){return this.parameters.color1[3]>=c||this.parameters.color2[3]>=c}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new l(r)}createBufferWriter(){return new a(n)}}class l extends i{beginSlot(r){return this.getTechnique(h,r)}}class m extends s{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.writeDepth=!0,this.polygonOffset=!1}}export{u as CheckerBoardMaterial,m as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmissionOrOID as e,isDepth as s,is2DGeometryOutput as i,isColorOrColorEmission as a,ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as l}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as f}from"./DefaultBufferWriter.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{VisualVariablePassParameters as _}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as g}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as O}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";class A extends m{constructor(t){super(t,P),this._configuration=new O,this.supportsEdges=!0,this.produces=new Map([[u.OPAQUE_MATERIAL,t=>this._isOpaqueMaterialPass(t)],[u.OPAQUE_MATERIAL_WITHOUT_NORMALS,t=>this._isOpaqueNoSSAODepthPass(t)],[u.TRANSPARENT_MATERIAL,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,t=>s(t)&&this._transparent&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,t=>e(t)&&this._transparent&&!this.parameters.writeDepth],[u.DRAPED_MATERIAL,t=>i(t)]])}getConfiguration(t,r){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=r.hasOccludees,this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.camera.relativeElevation<l,this._configuration.terrainDepthTest=r.terrainDepthTest&&a(t),this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}get visible(){return this.parameters.color[3]>=T}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}_isOpaquePass(t){return this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return t===o.Highlight||e(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return s(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new d(t)}createBufferWriter(){const t=r().vec3f(c.POSITION);return n()&&t.vec4u8(c.OLIDCOLOR),this.parameters.vvColor?t.f32(c.COLORFEATUREATTRIBUTE):t.vec4u8(c.COLOR),new f(t)}}class d extends p{beginSlot(t){return this.getTechnique(g,t)}}class P extends _{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=h.None,this.draped=!1,this.discardInvisibleFragments=!1}}export{A as ColorMaterial,P as Parameters};
5
+ import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmissionOrOID as e,isDepth as s,is2DGeometryOutput as i,isColorOrColorEmission as a,ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as l}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as f}from"./DefaultBufferWriter.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{VisualVariablePassParameters as _}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as g}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as O}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";class A extends m{constructor(t){super(t,P),this._configuration=new O,this.supportsEdges=!0,this.produces=new Map([[u.OPAQUE_MATERIAL,t=>this._isOpaqueMaterialPass(t)],[u.OPAQUE_MATERIAL_WITHOUT_NORMALS,t=>this._isOpaqueNoSSAODepthPass(t)],[u.TRANSPARENT_MATERIAL,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,t=>s(t)&&this._transparent&&this.parameters.writeDepth],[u.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,t=>e(t)&&this._transparent&&!this.parameters.writeDepth],[u.DRAPED_MATERIAL,t=>i(t)]])}getConfiguration(t,r){return super.getConfiguration(t,r,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=r.hasOccludees,this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.camera.relativeElevation<l,this._configuration.terrainDepthTest=r.terrainDepthTest&&a(t),this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}get visible(){return this.parameters.color[3]>=T}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}_isOpaquePass(t){return this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return t===o.Highlight||e(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return s(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new d(t)}createBufferWriter(){const t=r().vec3f(c.POSITION);return n()&&t.vec4u8(c.OLIDCOLOR),this.parameters.vvColor?t.f32(c.COLORFEATUREATTRIBUTE):t.vec4u8(c.COLOR),new f(t)}}class d extends p{beginSlot(t){return this.getTechnique(g,t)}}class P extends _{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=h.None,this.draped=!1,this.discardInvisibleFragments=!1}}export{A as ColorMaterial,P as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{p as e,i as r,c as t,n as s,d as a,l as i,h as o,f as n,q as l}from"../../../../chunks/vec32.js";import{ZEROS as c,create as u,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as h}from"../../../ViewingMode.js";import{newLayout as p}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as d,isShadowRelatedOutput as f,is3DGeometryOutput as T,ShaderOutput as x,isColorOrColorEmission as v}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as b}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as g}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as O}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as M}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as S}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as w,AlphaDiscardMode as y}from"../lib/basicInterfaces.js";import{GLTextureMaterial as R}from"../lib/GLTextureMaterial.js";import{Material as A}from"../lib/Material.js";import{OITPolygonOffsetLimit as I}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as P}from"../lib/RayIntersections.js";import{RenderSlot as j}from"../lib/RenderSlot.js";import{VertexAttribute as C}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as L}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as D}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as N}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as E,DefaultMaterialPassParameters as V}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as _}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as B}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as z}from"../../../../webscene/support/AlphaCutoff.js";class q extends A{constructor(e,r){super(e,k),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[j.OPAQUE_MATERIAL,e=>(d(e)||f(e))&&!this.transparent],[j.TRANSPARENT_MATERIAL,e=>(d(e)||f(e))&&this.transparent&&this.parameters.writeDepth],[j.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(T(e)||f(e))&&this.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=F(this.parameters),this._configuration=new _(r.spherical)}isVisibleForOutput(e){return e!==x.Shadow&&e!==x.ShadowExcludeHighlight&&e!==x.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r?1:s[3])>=z}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,c)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return s.output=e,s.hasNormalTexture=!a&&!!t.normalTextureId,s.hasColorTexture=!!t.textureId,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.isInstanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.vvSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?b.Attribute:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,null!=t.customDepthTest&&(s.customDepthTest=t.customDepthTest),s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?w.None:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?O.WindingOrder:i&&"normal"===o?O.View:i&&"winding-order"===o?O.WindingOrder:O.None,s.instancedColor=t.hasInstancedColor,v(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.vvColor=!!t.vvColor,s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?M.Schematic:M.Normal:M.Disabled,s.hasMetallicRoughnessTexture=!a&&!!t.metallicRoughnessTextureId,s.emissionSource=a?g.None:null!=t.emissiveTextureId?g.Texture:t.usePBR?g.Value:g.None,s.hasOcclusionTexture=!a&&!!t.occlusionTextureId,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.camera.relativeElevation<I,s.snowCover=W(r),s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,c,u,m,p,d){if(null!=this.parameters.verticalOffset){const e=u.camera;r(K,c[12],c[13],c[14]);let d=null;switch(u.viewingMode){case h.Global:d=s(Y,K);break;case h.Local:d=t(Y,Q)}let f=0;const T=a(X,K,e.eye),x=i(T),v=o(T,T,1/x);let b=null;this.parameters.screenSizePerspective&&(b=n(d,v)),f+=N(e,x,this.parameters.verticalOffset,b??0,this.parameters.screenSizePerspective),o(d,d,f),l(J,d,u.transform.inverseRotation),m=a(G,m,J),p=a(H,p,J)}P(e,u,m,p,L(u.verticalOffset),d)}createGLMaterial(e){return new U(e)}createBufferWriter(){return new D(this._vertexBufferLayout)}get transparent(){const{parameters:{drivenOpacity:e,opacity:r,externalColor:[t,s,a,i],layerOpacity:o,texture:n,textureId:l,textureAlphaMode:c,colorMixMode:u}}=this;return e||r<1&&"replace"!==u||i<1&&"ignore"!==u||o<1||(null!=n||null!=l)&&c!==y.Opaque&&c!==y.Mask&&"replace"!==u}}class U extends R{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?B:E,e)}}class k extends V{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function W(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}function F(e){const r=p().vec3f(C.POSITION);e.normalType===b.Compressed?r.vec2i16(C.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(C.NORMAL),e.hasVertexTangents&&r.vec4f(C.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f16(C.UV0),e.hasVertexColors&&r.vec4u8(C.COLOR),e.hasSymbolColors&&r.vec4u8(C.SYMBOLCOLOR),S()&&r.vec4u8(C.OLIDCOLOR),r}const G=u(),H=u(),Q=m(0,0,1),Y=u(),J=u(),K=u(),X=u();export{U as DefaultGLMaterial,q as DefaultMaterial,k as DefaultMaterialParameters};
5
+ import{p as e,i as r,c as t,n as s,d as a,l as i,h as o,f as n,q as l}from"../../../../chunks/vec32.js";import{ZEROS as c,create as u,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as h}from"../../../ViewingMode.js";import{newLayout as p}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as d,isShadowRelatedOutput as f,is3DGeometryOutput as T,ShaderOutput as x,isColorOrColorEmission as v}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as g}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as b}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as O}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as M}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as S}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as w,AlphaDiscardMode as y}from"../lib/basicInterfaces.js";import{GLTextureMaterial as R}from"../lib/GLTextureMaterial.js";import{Material as A}from"../lib/Material.js";import{OITPolygonOffsetLimit as I}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as P}from"../lib/RayIntersections.js";import{RenderSlot as C}from"../lib/RenderSlot.js";import{VertexAttribute as j}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as L}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as D}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as N}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as E,DefaultMaterialPassParameters as V}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as _}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as B}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as z}from"../../../../webscene/support/AlphaCutoff.js";class q extends A{constructor(e,r){super(e,k),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[C.OPAQUE_MATERIAL,e=>(d(e)||f(e))&&!this.transparent],[C.TRANSPARENT_MATERIAL,e=>(d(e)||f(e))&&this.transparent&&this.parameters.writeDepth],[C.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(T(e)||f(e))&&this.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=F(this.parameters),this._configuration=new _(r.spherical)}isVisibleForOutput(e){return e!==x.Shadow&&e!==x.ShadowExcludeHighlight&&e!==x.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r?1:s[3])>=z}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,c)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=!a&&!!t.normalTextureId,s.hasColorTexture=!!t.textureId,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.isInstanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.vvSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?g.Attribute:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,null!=t.customDepthTest&&(s.customDepthTest=t.customDepthTest),s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?w.None:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?O.WindingOrder:i&&"normal"===o?O.View:i&&"winding-order"===o?O.WindingOrder:O.None,s.instancedColor=t.hasInstancedColor,v(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.vvColor=!!t.vvColor,s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?M.Schematic:M.Normal:M.Disabled,s.hasMetallicRoughnessTexture=!a&&!!t.metallicRoughnessTextureId,s.emissionSource=a?b.None:null!=t.emissiveTextureId?b.Texture:t.usePBR?b.Value:b.None,s.hasOcclusionTexture=!a&&!!t.occlusionTextureId,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.camera.relativeElevation<I,s.snowCover=W(r),s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,c,u,m,p,d){if(null!=this.parameters.verticalOffset){const e=u.camera;r(K,c[12],c[13],c[14]);let d=null;switch(u.viewingMode){case h.Global:d=s(Y,K);break;case h.Local:d=t(Y,Q)}let f=0;const T=a(X,K,e.eye),x=i(T),v=o(T,T,1/x);let g=null;this.parameters.screenSizePerspective&&(g=n(d,v)),f+=N(e,x,this.parameters.verticalOffset,g??0,this.parameters.screenSizePerspective),o(d,d,f),l(J,d,u.transform.inverseRotation),m=a(G,m,J),p=a(H,p,J)}P(e,u,m,p,L(u.verticalOffset),d)}createGLMaterial(e){return new U(e)}createBufferWriter(){return new D(this._vertexBufferLayout)}get transparent(){const{parameters:{drivenOpacity:e,opacity:r,externalColor:[t,s,a,i],layerOpacity:o,texture:n,textureId:l,textureAlphaMode:c,colorMixMode:u}}=this;return e||r<1&&"replace"!==u||i<1&&"ignore"!==u||o<1||(null!=n||null!=l)&&c!==y.Opaque&&c!==y.Mask&&"replace"!==u}}class U extends R{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?B:E,e)}}class k extends V{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function W(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}function F(e){const r=p().vec3f(j.POSITION);e.normalType===g.Compressed?r.vec2i16(j.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(j.NORMAL),e.hasVertexTangents&&r.vec4f(j.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f16(j.UV0),e.hasVertexColors&&r.vec4u8(j.COLOR),e.hasSymbolColors&&r.vec4u8(j.SYMBOLCOLOR),S()&&r.vec4u8(j.OLIDCOLOR),r}const G=u(),H=u(),Q=m(0,0,1),Y=u(),J=u(),K=u(),X=u();export{U as DefaultGLMaterial,q as DefaultMaterial,k as DefaultMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../../chunks/tslib.es6.js";import{ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{InstancedDoubleConfiguration as r}from"../core/shaderLibrary/attributes/InstancedDoubleConfiguration.js";import{parameter as s}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{OITPass as e}from"../lib/OITPass.js";import{BindType as i}from"../../../webgl/BindType.js";class a extends r{constructor(){super(...arguments),this.output=t.Color,this.oitPass=e.NONE,this.hasSlicePlane=!1,this.bindType=i.Pass,this.writeDepth=!0}}o([s({count:t.COUNT})],a.prototype,"output",void 0),o([s({count:e.COUNT})],a.prototype,"oitPass",void 0),o([s()],a.prototype,"hasSlicePlane",void 0);export{a as DefaultTechniqueConfiguration};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{InstancedDoubleConfiguration as i}from"../core/shaderLibrary/attributes/InstancedDoubleConfiguration.js";import{parameter as r}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{OITPass as s}from"../lib/OITPass.js";import{BindType as e}from"../../../webgl/BindType.js";class a extends i{constructor(){super(...arguments),this.output=o.Color,this.oitPass=s.NONE,this.hasSlicePlane=!1,this.hasHighlightMixTexture=!1,this.bindType=e.Pass,this.writeDepth=!0}}t([r({count:o.COUNT})],a.prototype,"output",void 0),t([r({count:s.COUNT})],a.prototype,"oitPass",void 0),t([r()],a.prototype,"hasSlicePlane",void 0),t([r()],a.prototype,"hasHighlightMixTexture",void 0);export{a as DefaultTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as o,rotate as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as f,t as u,n as p,d as h,h as m,c as d,l as g,j as O,g as T,q as S,f as b}from"../../../../chunks/vec32.js";import{create as v,fromValues as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as E,create as R,freeze as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as F}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as P,BufferViewVec3f as _,BufferViewFloat as C,BufferViewVec2f as y,BufferViewVec4f as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as L}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as N}from"../../support/debugFlags.js";import{newLayout as j}from"../../support/buffer/InterleavedLayout.js";import{isColorEmissionHighlightOrOID as U,isColorOrColorEmission as z}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as M}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as w}from"../effects/geometry/olidUtils.js";import{GLTextureMaterial as B,GLTextureMaterialBindParameters as V}from"../lib/GLTextureMaterial.js";import{Material as q,RenderOccludedFlag as X}from"../lib/Material.js";import{RenderSlot as G}from"../lib/RenderSlot.js";import{applyScaleFactor as H,applyPrecomputedScaleFactor as W,precomputeScaleFactor as Y}from"../lib/screenSizePerspectiveUtils.js";import{assert as Z}from"../lib/Util.js";import{VertexAttribute as k}from"../lib/VertexAttribute.js";import{ScaleInfo as J}from"./ScaleInfo.js";import{writePosition as K,writeNormal as Q,writeColor as $,writeBufferFloat as ee,writeBufferVec4 as te,writeBufferVec4Zeros as ie,writeOlidColor as se}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as re}from"./internal/MaterialUtil.js";import{c as ae,f as oe}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as ne}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as le}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ce}from"../../../../webscene/support/AlphaCutoff.js";class fe extends q{constructor(e,t){super(e,ze),this.produces=new Map([[G.HUD_MATERIAL,e=>U(e)&&!this.parameters.drawAsLabel],[G.LABEL_MATERIAL,e=>U(e)&&this.parameters.drawAsLabel],[G.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[G.DRAPED_MATERIAL,e=>this.parameters.draped&&U(e)]]),this._visible=!0,this._configuration=new le(t)}getConfiguration(e,t){const i=this.parameters.draped;return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===G.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||t.slot===G.OCCLUSION_PIXELS,z(e)&&(this._configuration.debugDrawLabelBorder=!!N.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,o,n){const{options:{selectionMode:l,hud:c,excludeLabels:T},point:S,camera:b}=s,{parameters:A}=this;if(!l||!c||T&&A.isLabel||!e.visible||!S)return;const R=e.attributes.get(k.FEATUREATTRIBUTE),I=null==R?null:E(R.data,Ce),{scaleX:x,scaleY:F}=Ve(I,A,b.pixelRatio);i(Re,t),e.attributes.has(k.FEATUREATTRIBUTE)&&me(Re);const P=e.attributes.get(k.POSITION),_=e.attributes.get(k.SIZE),C=e.attributes.get(k.NORMAL),y=e.attributes.get(k.ROTATION),D=e.attributes.get(k.CENTEROFFSETANDDISTANCE);Z(P.size>=3);const L=ae(A),N="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<P.data.length/P.size;i++){const e=i*P.size;f(Oe,P.data[e],P.data[e+1],P.data[e+2]),u(Oe,Oe,t),u(Oe,Oe,b.viewMatrix);const a=i*D.size;if(f(Pe,D.data[a],D.data[a+1],D.data[a+2]),!N&&(Oe[0]+=Pe[0],Oe[1]+=Pe[1],0!==Pe[2])){const e=Pe[2];p(Pe,Oe),h(Oe,Oe,m(Pe,Pe,e))}const o=i*C.size;if(f(Te,C.data[o],C.data[o+1],C.data[o+2]),he(Te,Re,b,ye),qe(this.parameters,Oe,ye,b,ge),b.applyProjection(Oe,Se),Se[0]>-1){N&&(Pe[0]||Pe[1])&&(Se[0]+=Pe[0]*b.pixelRatio,0!==Pe[1]&&(Se[1]+=H(Pe[1],ge.factorAlignment)*b.pixelRatio),b.unapplyProjection(Se,Oe)),Se[0]+=this.parameters.screenOffset[0]*b.pixelRatio,Se[1]+=this.parameters.screenOffset[1]*b.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]);const e=i*_.size;Ne[0]=_.data[e],Ne[1]=_.data[e+1],W(Ne,ge.factor,Ne);const t=De*b.pixelRatio;let a=0;if(A.textureIsSignedDistanceField){a=Math.min(A.outlineSize,.5*Ne[0])*b.pixelRatio/2}Ne[0]*=x,Ne[1]*=F;const o=i*y.size,l=A.rotation+y.data[o];if(de(S,Se[0],Se[1],Ne,t,a,l,A,L)){const e=s.ray;if(u(ve,Oe,r(xe,b.viewMatrix)),Se[0]=S[0],Se[1]=S[1],b.unprojectFromRenderScreen(Se,Oe)){const t=v();d(t,e.direction);const i=1/g(t);m(t,t,i);n(O(e.origin,Oe)*i,t,-1,!0,1,ve)}}}}}intersectDraped(e,t,i,s,r,a){const o=e.attributes.get(k.POSITION),n=e.attributes.get(k.SIZE),l=e.attributes.get(k.ROTATION),c=this.parameters,f=ae(c),u=e.attributes.get(k.FEATUREATTRIBUTE),p=null==u?null:E(u.data,Ce),{scaleX:h,scaleY:m}=Ve(p,c,e.screenToWorldRatio),d=Le*e.screenToWorldRatio;for(let g=0;g<o.data.length/o.size;g++){const t=g*o.size,i=o.data[t],u=o.data[t+1],p=g*n.size;Ne[0]=n.data[p],Ne[1]=n.data[p+1];let O=0;if(c.textureIsSignedDistanceField){O=Math.min(c.outlineSize,.5*Ne[0])*e.screenToWorldRatio/2}Ne[0]*=h,Ne[1]*=m;const T=g*l.size,S=c.rotation+l.data[T];de(s,i,u,Ne,d,O,S,c,f)&&r(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new Be}applyShaderOffsetsView(e,t,i,s,r,a,o){const n=he(t,i,r,ye);return this._applyVerticalGroundOffsetView(e,n,r,o),qe(this.parameters,o,n,r,a),this._applyPolygonOffsetView(o,n,s[3],r,o),this._applyCenterOffsetView(o,s,o),o}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const o=r.aboveGround?1:-1;let n=Math.sign(s);0===n&&(n=o);const l=o*n;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,o=i.computeRenderPixelSizeAtDist(r)*M,n=m(Oe,t.normal,a*o);return T(s,e,n),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(Te,i),T(i,i,m(Te,Te,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=ce||t>=ce&&i[3]>=ce;return this._visible&&s}createGLMaterial(e){return new ue(e)}calculateRelativeScreenBounds(e,t,i=F()){return pe(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class ue extends B{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ne,e)}}function pe(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function he(e,t,s,r){return x(t)&&(t=i(Ie,t)),S(r.normal,e,t),u(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=b(be,Ue),r}function me(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],n=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+i*i+s*s),u=1/Math.sqrt(r*r+a*a+o*o),p=1/Math.sqrt(n*n+l*l+c*c);return e[0]=t*f,e[1]=i*f,e[2]=s*f,e[3]=r*u,e[4]=a*u,e[5]=o*u,e[6]=n*p,e[7]=l*p,e[8]=c*p,e}function de(e,i,s,r,a,l,c,f,u){let p=i-a-r[0]*u[0],h=p+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=f.distanceFieldBoundingBox;return f.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),o(Ee,i,s),n(Ae,e,Ee,t(c)),Ae[0]>p&&Ae[0]<h&&Ae[1]>m&&Ae[1]<d}const ge=new J,Oe=v(),Te=v(),Se=R(),be=v(),ve=v(),Ae=l(),Ee=l(),Re=s(),Ie=s(),xe=a(),Fe=R(),Pe=v(),_e=v(),Ce=R(),ye={normal:be,cosAngle:0},De=1,Le=2,Ne=c(0,0),je=6,Ue=A(0,0,1);class ze extends V{constructor(){super(...arguments),this.renderOccluded=X.Occlude,this.isDecoration=!1,this.color=I(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=I(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=R(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusEffect="none",this.draped=!1,this.isLabel=!1}}const Me=j().vec3f(k.POSITION).vec3f(k.NORMAL).vec2i16(k.UVI).vec4u8(k.COLOR).vec2f(k.SIZE).f32(k.ROTATION).vec4f(k.CENTEROFFSETANDDISTANCE).vec4f(k.FEATUREATTRIBUTE),we=Me.clone().vec4u8(k.OLIDCOLOR);class Be{constructor(){this.vertexBufferLayout=w()?we:Me}elementCount(e){return e.get(k.POSITION).indices.length*je}write(e,t,i,s,r,a){const{position:o,normal:n,uvi:l,color:c,size:f,rotation:u,centerOffsetAndDistance:p,featureAttribute:h}=r;K(i.get(k.POSITION),e,o,a,je),Q(i.get(k.NORMAL),t,n,a,je);const m=i.get(k.UVI)?.data;let d=0,g=0,O=-1-oe,T=-1-oe;m&&m.length>=4&&(d=m[0],g=m[1],O=-1-m[2],T=-1-m[3]);let S=i.get(k.POSITION).indices.length,b=a;for(let E=0;E<S;++E)l.set(b,0,d),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,T),b++,l.set(b,0,O),l.set(b,1,T),b++,l.set(b,0,d),l.set(b,1,T),b++,l.set(b,0,d),l.set(b,1,g),b++;$(i.get(k.COLOR),4,c,a,je);const{data:v,indices:A}=i.get(k.SIZE);S=A.length,b=a;for(let E=0;E<S;++E){const e=v[2*A[E]],t=v[2*A[E]+1];for(let i=0;i<je;++i)f.set(b,0,e),f.set(b,1,t),b++}if(ee(i.get(k.ROTATION),u,a,je),i.get(k.CENTEROFFSETANDDISTANCE)?te(i.get(k.CENTEROFFSETANDDISTANCE),p,a,je):ie(p,a,S*je),i.get(k.FEATUREATTRIBUTE)?te(i.get(k.FEATUREATTRIBUTE),h,a,je):ie(h,a,S*je),null!=s){const e=i.get(k.POSITION)?.indices;if(e){const t=e.length,i=r.getField(k.OLIDCOLOR,P);se(s,i,t,a,je)}}return{numVerticesPerItem:je,numItems:S}}intersect(e,t,i,s,a,o,n){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:b,camera:A}=s;if(!l||!c||S&&t.isLabel||!b)return;const E=this.vertexBufferLayout.createView(e),R=E.getField(k.POSITION,_),I=E.getField(k.NORMAL,_),x=E.getField(k.ROTATION,C),F=E.getField(k.SIZE,y),P=E.getField(k.FEATUREATTRIBUTE,D),L=E.getField(k.CENTEROFFSETANDDISTANCE,D),N="screen"===t.centerOffsetUnits,j=ae(t);if(null==R||null==I||null==x||null==F||null==L)return;const U=null==P?null:P.getVec(0,Ce),{scaleX:z,scaleY:M}=Ve(U,t,A.pixelRatio),w=R.count/je;for(let _=0;_<w;_++){const e=_*je;if(R.getVec(e,Oe),null!=i&&T(Oe,Oe,i),u(Oe,Oe,A.viewMatrix),L.getVec(e,Fe),f(Pe,Fe[0],Fe[1],Fe[2]),!N&&(Oe[0]+=Pe[0],Oe[1]+=Pe[1],0!==Pe[2])){const e=Pe[2];p(Pe,Oe),h(Oe,Oe,m(Pe,Pe,e))}if(I.getVec(e,Te),he(Te,Re,A,ye),qe(t,Oe,ye,A,ge),A.applyProjection(Oe,Se),Se[0]>-1){N&&(Pe[0]||Pe[1])&&(Se[0]+=Pe[0]*A.pixelRatio,0!==Pe[1]&&(Se[1]+=H(Pe[1],ge.factorAlignment)*A.pixelRatio),A.unapplyProjection(Se,Oe)),Se[0]+=t.screenOffset[0]*A.pixelRatio,Se[1]+=t.screenOffset[1]*A.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]),F.getVec(e,Ne),W(Ne,ge.factor,Ne);const i=De*A.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*Ne[0])*A.pixelRatio/2}Ne[0]*=z,Ne[1]*=M;const o=x.get(e),l=t.rotation+o;if(de(b,Se[0],Se[1],Ne,i,a,l,t,j)){const e=s.ray;if(u(ve,Oe,r(xe,A.viewMatrix)),Se[0]=b[0],Se[1]=b[1],A.unprojectFromRenderScreen(Se,Oe)){const t=v();d(t,e.direction);const i=1/g(t);m(t,t,i);n(O(e.origin,Oe)*i,t,_,!0,1,ve)}}}}}}function Ve(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(L(_e,t,e),{scaleX:_e[0]*i,scaleY:_e[1]*i})}function qe(e,t,i,s,r){if(!e.verticalOffset?.screenLength){if(e.screenSizePerspective||e.screenSizePerspectiveAlignment){Xe(e,r,g(t),i.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return t}const a=g(t),o=e.screenSizePerspectiveAlignment??e.screenSizePerspective,n=re(s,a,e.verticalOffset,i.cosAngle,o);return Xe(e,r,a,i.cosAngle),m(i.normal,i.normal,n),T(t,t,i.normal)}function Xe(e,t,i,s){null!=e.screenSizePerspective?Y(s,i,e.screenSizePerspective,t.factor):(t.factor.scale=1,t.factor.factor=0,t.factor.minScaleFactor=0),null!=e.screenSizePerspectiveAlignment?Y(s,i,e.screenSizePerspectiveAlignment,t.factorAlignment):(t.factorAlignment.factor=t.factor.factor,t.factorAlignment.scale=t.factor.scale,t.factorAlignment.minScaleFactor=t.factor.minScaleFactor)}export{fe as HUDMaterial,ze as Parameters};
5
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as f,t as u,n as p,d as h,h as m,c as d,l as g,j as O,g as T,q as S,f as b}from"../../../../chunks/vec32.js";import{create as v,fromValues as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as E,create as R,freeze as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as F}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as P,BufferViewVec3f as _,BufferViewFloat as C,BufferViewVec2f as y,BufferViewVec4f as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as L}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as N}from"../../support/debugFlags.js";import{newLayout as j}from"../../support/buffer/InterleavedLayout.js";import{isColorEmissionHighlightOrOID as U,isColorOrColorEmission as z}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as M}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as w}from"../effects/geometry/olidUtils.js";import{GLTextureMaterial as B,GLTextureMaterialBindParameters as V}from"../lib/GLTextureMaterial.js";import{Material as q,RenderOccludedFlag as X}from"../lib/Material.js";import{RenderSlot as G}from"../lib/RenderSlot.js";import{applyScaleFactor as H,applyPrecomputedScaleFactor as W,precomputeScaleFactor as Y}from"../lib/screenSizePerspectiveUtils.js";import{assert as Z}from"../lib/Util.js";import{VertexAttribute as k}from"../lib/VertexAttribute.js";import{ScaleInfo as J}from"./ScaleInfo.js";import{writePosition as K,writeNormal as Q,writeColor as $,writeBufferFloat as ee,writeBufferVec4 as te,writeBufferVec4Zeros as ie,writeOlidColor as se}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as re}from"./internal/MaterialUtil.js";import{c as ae,f as ne}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as oe}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as le}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ce}from"../../../../webscene/support/AlphaCutoff.js";class fe extends q{constructor(e,t){super(e,ze),this.produces=new Map([[G.HUD_MATERIAL,e=>U(e)&&!this.parameters.drawAsLabel],[G.LABEL_MATERIAL,e=>U(e)&&this.parameters.drawAsLabel],[G.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[G.DRAPED_MATERIAL,e=>this.parameters.draped&&U(e)]]),this._visible=!0,this._configuration=new le(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===G.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||t.slot===G.OCCLUSION_PIXELS,z(e)&&(this._configuration.debugDrawLabelBorder=!!N.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:T},point:S,camera:b}=s,{parameters:A}=this;if(!l||!c||T&&A.isLabel||!e.visible||!S)return;const R=e.attributes.get(k.FEATUREATTRIBUTE),I=null==R?null:E(R.data,Ce),{scaleX:x,scaleY:F}=Ve(I,A,b.pixelRatio);i(Re,t),e.attributes.has(k.FEATUREATTRIBUTE)&&me(Re);const P=e.attributes.get(k.POSITION),_=e.attributes.get(k.SIZE),C=e.attributes.get(k.NORMAL),y=e.attributes.get(k.ROTATION),D=e.attributes.get(k.CENTEROFFSETANDDISTANCE);Z(P.size>=3);const L=ae(A),N="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<P.data.length/P.size;i++){const e=i*P.size;f(Oe,P.data[e],P.data[e+1],P.data[e+2]),u(Oe,Oe,t),u(Oe,Oe,b.viewMatrix);const a=i*D.size;if(f(Pe,D.data[a],D.data[a+1],D.data[a+2]),!N&&(Oe[0]+=Pe[0],Oe[1]+=Pe[1],0!==Pe[2])){const e=Pe[2];p(Pe,Oe),h(Oe,Oe,m(Pe,Pe,e))}const n=i*C.size;if(f(Te,C.data[n],C.data[n+1],C.data[n+2]),he(Te,Re,b,ye),qe(this.parameters,Oe,ye,b,ge),b.applyProjection(Oe,Se),Se[0]>-1){N&&(Pe[0]||Pe[1])&&(Se[0]+=Pe[0]*b.pixelRatio,0!==Pe[1]&&(Se[1]+=H(Pe[1],ge.factorAlignment)*b.pixelRatio),b.unapplyProjection(Se,Oe)),Se[0]+=this.parameters.screenOffset[0]*b.pixelRatio,Se[1]+=this.parameters.screenOffset[1]*b.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]);const e=i*_.size;Ne[0]=_.data[e],Ne[1]=_.data[e+1],W(Ne,ge.factor,Ne);const t=De*b.pixelRatio;let a=0;if(A.textureIsSignedDistanceField){a=Math.min(A.outlineSize,.5*Ne[0])*b.pixelRatio/2}Ne[0]*=x,Ne[1]*=F;const n=i*y.size,l=A.rotation+y.data[n];if(de(S,Se[0],Se[1],Ne,t,a,l,A,L)){const e=s.ray;if(u(ve,Oe,r(xe,b.viewMatrix)),Se[0]=S[0],Se[1]=S[1],b.unprojectFromRenderScreen(Se,Oe)){const t=v();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Oe)*i,t,-1,!0,1,ve)}}}}}intersectDraped(e,t,i,s,r,a){const n=e.attributes.get(k.POSITION),o=e.attributes.get(k.SIZE),l=e.attributes.get(k.ROTATION),c=this.parameters,f=ae(c),u=e.attributes.get(k.FEATUREATTRIBUTE),p=null==u?null:E(u.data,Ce),{scaleX:h,scaleY:m}=Ve(p,c,e.screenToWorldRatio),d=Le*e.screenToWorldRatio;for(let g=0;g<n.data.length/n.size;g++){const t=g*n.size,i=n.data[t],u=n.data[t+1],p=g*o.size;Ne[0]=o.data[p],Ne[1]=o.data[p+1];let O=0;if(c.textureIsSignedDistanceField){O=Math.min(c.outlineSize,.5*Ne[0])*e.screenToWorldRatio/2}Ne[0]*=h,Ne[1]*=m;const T=g*l.size,S=c.rotation+l.data[T];de(s,i,u,Ne,d,O,S,c,f)&&r(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new Be}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=he(t,i,r,ye);return this._applyVerticalGroundOffsetView(e,o,r,n),qe(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*M,o=m(Oe,t.normal,a*n);return T(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(Te,i),T(i,i,m(Te,Te,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=ce||t>=ce&&i[3]>=ce;return this._visible&&s}createGLMaterial(e){return new ue(e)}calculateRelativeScreenBounds(e,t,i=F()){return pe(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class ue extends B{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(oe,e)}}function pe(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function he(e,t,s,r){return x(t)&&(t=i(Ie,t)),S(r.normal,e,t),u(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=b(be,Ue),r}function me(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+i*i+s*s),u=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=i*f,e[2]=s*f,e[3]=r*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function de(e,i,s,r,a,l,c,f,u){let p=i-a-r[0]*u[0],h=p+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=f.distanceFieldBoundingBox;return f.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(Ee,i,s),o(Ae,e,Ee,t(c)),Ae[0]>p&&Ae[0]<h&&Ae[1]>m&&Ae[1]<d}const ge=new J,Oe=v(),Te=v(),Se=R(),be=v(),ve=v(),Ae=l(),Ee=l(),Re=s(),Ie=s(),xe=a(),Fe=R(),Pe=v(),_e=v(),Ce=R(),ye={normal:be,cosAngle:0},De=1,Le=2,Ne=c(0,0),je=6,Ue=A(0,0,1);class ze extends V{constructor(){super(...arguments),this.renderOccluded=X.Occlude,this.isDecoration=!1,this.color=I(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=I(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=R(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusEffect="none",this.draped=!1,this.isLabel=!1}}const Me=j().vec3f(k.POSITION).vec3f(k.NORMAL).vec2i16(k.UVI).vec4u8(k.COLOR).vec2f(k.SIZE).f32(k.ROTATION).vec4f(k.CENTEROFFSETANDDISTANCE).vec4f(k.FEATUREATTRIBUTE),we=Me.clone().vec4u8(k.OLIDCOLOR);class Be{constructor(){this.vertexBufferLayout=w()?we:Me}elementCount(e){return e.get(k.POSITION).indices.length*je}write(e,t,i,s,r,a){const{position:n,normal:o,uvi:l,color:c,size:f,rotation:u,centerOffsetAndDistance:p,featureAttribute:h}=r;K(i.get(k.POSITION),e,n,a,je),Q(i.get(k.NORMAL),t,o,a,je);const m=i.get(k.UVI)?.data;let d=0,g=0,O=-1-ne,T=-1-ne;m&&m.length>=4&&(d=m[0],g=m[1],O=-1-m[2],T=-1-m[3]);let S=i.get(k.POSITION).indices.length,b=a;for(let E=0;E<S;++E)l.set(b,0,d),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,T),b++,l.set(b,0,O),l.set(b,1,T),b++,l.set(b,0,d),l.set(b,1,T),b++,l.set(b,0,d),l.set(b,1,g),b++;$(i.get(k.COLOR),4,c,a,je);const{data:v,indices:A}=i.get(k.SIZE);S=A.length,b=a;for(let E=0;E<S;++E){const e=v[2*A[E]],t=v[2*A[E]+1];for(let i=0;i<je;++i)f.set(b,0,e),f.set(b,1,t),b++}if(ee(i.get(k.ROTATION),u,a,je),i.get(k.CENTEROFFSETANDDISTANCE)?te(i.get(k.CENTEROFFSETANDDISTANCE),p,a,je):ie(p,a,S*je),i.get(k.FEATUREATTRIBUTE)?te(i.get(k.FEATUREATTRIBUTE),h,a,je):ie(h,a,S*je),null!=s){const e=i.get(k.POSITION)?.indices;if(e){const t=e.length,i=r.getField(k.OLIDCOLOR,P);se(s,i,t,a,je)}}return{numVerticesPerItem:je,numItems:S}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:b,camera:A}=s;if(!l||!c||S&&t.isLabel||!b)return;const E=this.vertexBufferLayout.createView(e),R=E.getField(k.POSITION,_),I=E.getField(k.NORMAL,_),x=E.getField(k.ROTATION,C),F=E.getField(k.SIZE,y),P=E.getField(k.FEATUREATTRIBUTE,D),L=E.getField(k.CENTEROFFSETANDDISTANCE,D),N="screen"===t.centerOffsetUnits,j=ae(t);if(null==R||null==I||null==x||null==F||null==L)return;const U=null==P?null:P.getVec(0,Ce),{scaleX:z,scaleY:M}=Ve(U,t,A.pixelRatio),w=R.count/je;for(let _=0;_<w;_++){const e=_*je;if(R.getVec(e,Oe),null!=i&&T(Oe,Oe,i),u(Oe,Oe,A.viewMatrix),L.getVec(e,Fe),f(Pe,Fe[0],Fe[1],Fe[2]),!N&&(Oe[0]+=Pe[0],Oe[1]+=Pe[1],0!==Pe[2])){const e=Pe[2];p(Pe,Oe),h(Oe,Oe,m(Pe,Pe,e))}if(I.getVec(e,Te),he(Te,Re,A,ye),qe(t,Oe,ye,A,ge),A.applyProjection(Oe,Se),Se[0]>-1){N&&(Pe[0]||Pe[1])&&(Se[0]+=Pe[0]*A.pixelRatio,0!==Pe[1]&&(Se[1]+=H(Pe[1],ge.factorAlignment)*A.pixelRatio),A.unapplyProjection(Se,Oe)),Se[0]+=t.screenOffset[0]*A.pixelRatio,Se[1]+=t.screenOffset[1]*A.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]),F.getVec(e,Ne),W(Ne,ge.factor,Ne);const i=De*A.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*Ne[0])*A.pixelRatio/2}Ne[0]*=z,Ne[1]*=M;const n=x.get(e),l=t.rotation+n;if(de(b,Se[0],Se[1],Ne,i,a,l,t,j)){const e=s.ray;if(u(ve,Oe,r(xe,A.viewMatrix)),Se[0]=b[0],Se[1]=b[1],A.unprojectFromRenderScreen(Se,Oe)){const t=v();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Oe)*i,t,_,!0,1,ve)}}}}}}function Ve(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(L(_e,t,e),{scaleX:_e[0]*i,scaleY:_e[1]*i})}function qe(e,t,i,s,r){if(!e.verticalOffset?.screenLength){if(e.screenSizePerspective||e.screenSizePerspectiveAlignment){Xe(e,r,g(t),i.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=re(s,a,e.verticalOffset,i.cosAngle,n);return Xe(e,r,a,i.cosAngle),m(i.normal,i.normal,o),T(t,t,i.normal)}function Xe(e,t,i,s){null!=e.screenSizePerspective?Y(s,i,e.screenSizePerspective,t.factor):(t.factor.scale=1,t.factor.factor=0,t.factor.minScaleFactor=0),null!=e.screenSizePerspectiveAlignment?Y(s,i,e.screenSizePerspectiveAlignment,t.factorAlignment):(t.factorAlignment.factor=t.factor.factor,t.factorAlignment.scale=t.factor.scale,t.factorAlignment.minScaleFactor=t.factor.minScaleFactor)}export{fe as HUDMaterial,ze as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import o from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechnique as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class T extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class g extends a{constructor(t){super(t,T),this.produces=new Map([[n.DRAPED_MATERIAL,t=>t===i.Color]]),this._configuration=new p}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}get visible(){return!0}createGLMaterial(t){return new d(t)}intersect(){}intersectDraped(r,s,i,o,a,n){const l=r.attributes.get(u.POSITION),{parameters:c}=this,{searchRadius:f}=c,{screenToWorldRatio:m}=r,p=f*m+h*m,T=p*p,g=l.data.length/l.size;for(let u=0;u<g;u++){const r=u*l.size,s=t(j,l.data[r],l.data[r+1]);e(s,o)<T&&a(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new b(this.parameters.isAttributeDriven?I:A)}}class d extends o{beginSlot(t){return this.getTechnique(m,t)}}class b{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.get(u.POSITION).indices.length*v}write(t,e,r,s,i,o){l(r.get(u.POSITION),t,i.position,o,v);const a=r.get(u.POSITION).indices.length,n=i.uv0;let f=o;for(let u=0;u<a;++u)n.setValues(f++,-1,-1),n.setValues(f++,1,-1),n.setValues(f++,1,1),n.setValues(f++,1,1),n.setValues(f++,-1,1),n.setValues(f++,-1,-1);const m=u.FEATUREATTRIBUTE in i?i.featureAttribute:null;return m?(c(r.get(u.FEATUREATTRIBUTE),m,o,v),null):null}}const A=s().vec3f(u.POSITION).vec2f16(u.UV0),I=A.clone().f32(u.FEATUREATTRIBUTE),v=6,j=r();export{g as HeatmapDensityMaterial,T as Parameters};
5
+ import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import o from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechnique as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class g extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class T extends a{constructor(t){super(t,g),this.produces=new Map([[n.DRAPED_MATERIAL,t=>t===i.Color]]),this._configuration=new p}getConfiguration(t,e){return super.getConfiguration(t,e,this._configuration),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}get visible(){return!0}createGLMaterial(t){return new d(t)}intersect(){}intersectDraped(r,s,i,o,a,n){const l=r.attributes.get(u.POSITION),{parameters:c}=this,{searchRadius:f}=c,{screenToWorldRatio:m}=r,p=f*m+h*m,g=p*p,T=l.data.length/l.size;for(let u=0;u<T;u++){const r=u*l.size,s=t(j,l.data[r],l.data[r+1]);e(s,o)<g&&a(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new b(this.parameters.isAttributeDriven?I:A)}}class d extends o{beginSlot(t){return this.getTechnique(m,t)}}class b{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.get(u.POSITION).indices.length*v}write(t,e,r,s,i,o){l(r.get(u.POSITION),t,i.position,o,v);const a=r.get(u.POSITION).indices.length,n=i.uv0;let f=o;for(let u=0;u<a;++u)n.setValues(f++,-1,-1),n.setValues(f++,1,-1),n.setValues(f++,1,1),n.setValues(f++,1,1),n.setValues(f++,-1,1),n.setValues(f++,-1,-1);const m=u.FEATUREATTRIBUTE in i?i.featureAttribute:null;return m?(c(r.get(u.FEATUREATTRIBUTE),m,o,v),null):null}}const A=s().vec3f(u.POSITION).vec2f16(u.UV0),I=A.clone().f32(u.FEATUREATTRIBUTE),v=6,j=r();export{T as HeatmapDensityMaterial,g as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as i}from"../lib/basicInterfaces.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as o}from"../lib/Material.js";import{OITPolygonOffsetLimit as a}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{PositionUvLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{writeBufferFloat as h,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as g,ImageMaterialTechnique as T}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as d}from"../shaders/ImageMaterialTechniqueConfiguration.js";class E extends f{constructor(e){super(e,A),this._configuration=new d,this.vertexAttributeLocations=g,this.supportsEdges=!0,this.produces=new Map([[n.OPAQUE_MATERIAL,e=>t(e)],[n.TRANSPARENT_MATERIAL,e=>r(e)&&this.parameters.writeDepth],[n.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>r(e)&&!this.parameters.writeDepth],[n.DRAPED_MATERIAL,e=>r(e)||t(e)]])}dispose(){this.setParameters({texture:void 0})}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<a,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}get visible(){return!0}createGLMaterial(e){return new I(e)}createBufferWriter(){let e=p;return this.parameters.perspectiveInterpolation&&(e=e.clone().f32(l.PERSPECTIVEDIVIDE)),new b(e)}}class I extends s{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.getTechnique(T,e)}}class b extends c{write(t,r,i,s,o,a){for(const n of this.vertexBufferLayout.fields.keys()){const s=i.get(n);if(s)if(n===l.PERSPECTIVEDIVIDE){u(1===s.size);const t=o.getField(n,e);t&&h(s,t,a)}else m(n,s,t,r,o,a)}return null}}class A extends o{constructor(e){super(),this.texture=e,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=i.None,this.opacity=1,this.perspectiveInterpolation=!1}get glTexture(){return this.texture.glTexture}}export{E as ImageMaterial,A as Parameters};
5
+ import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as i}from"../lib/basicInterfaces.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as p}from"./DefaultBufferWriter.js";import{PositionUvLayout as c}from"./DefaultLayouts.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{writeBufferFloat as h,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as g,ImageMaterialTechnique as d}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as T}from"../shaders/ImageMaterialTechniqueConfiguration.js";class E extends f{constructor(e){super(e,A),this.vertexAttributeLocations=g,this.supportsEdges=!0,this.produces=new Map([[n.OPAQUE_MATERIAL,e=>t(e)],[n.TRANSPARENT_MATERIAL,e=>r(e)&&this.parameters.writeDepth],[n.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>r(e)&&!this.parameters.writeDepth],[n.DRAPED_MATERIAL,e=>r(e)||t(e)]]),this._configuration=new T(e.draped)}dispose(){this.setParameters({texture:void 0})}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}get visible(){return!0}createGLMaterial(e){return new I(e)}createBufferWriter(){let e=c;return this.parameters.perspectiveInterpolation&&(e=e.clone().f32(l.PERSPECTIVEDIVIDE)),new b(e)}}class I extends s{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.getTechnique(d,e)}}class b extends p{write(t,r,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const s=i.get(n);if(s)if(n===l.PERSPECTIVEDIVIDE){u(1===s.size);const t=a.getField(n,e);t&&h(s,t,o)}else m(n,s,t,r,a,o)}return null}}class A extends a{constructor(e,t){super(),this.texture=e,this.draped=t,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=i.None,this.opacity=1,this.perspectiveInterpolation=!1}get glTexture(){return this.texture.glTexture}}export{E as ImageMaterial,A as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmission as s}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as o,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as u,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class d extends o{constructor(e,t){super(e,T),this.produces=new Map([[c.LINE_CALLOUTS,e=>s(e)],[c.LINE_CALLOUTS_HUD_DEPTH,e=>s(e)]]),this._configuration=new m(t),this._uniqueMaterialIdentifier=O(this.parameters)}passParameters(){return this.parameters}getConfiguration(e,t){return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=t.slot===c.LINE_CALLOUTS_HUD_DEPTH,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new S(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=O(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function O({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,occlusionTest:o,shaderPolygonOffset:a,hudDepthAlignStart:c,centerOffsetUnits:l,hasSlicePlane:f,screenSizePerspective:u,verticalOffset:h,borderColor:p}){return e`${t}:${r}:${i}:[${s}]:${n}:${o}:${a}:${c}:${l}:${f}:${null!=u}:{${h.screenLength}:${h.minWorldLength}:${h.maxWorldLength}}:[${p}]`}class S extends n{beginSlot(e){return this.getTechnique(p,e)}}class T extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=r(0,0,0,1),this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const L=i().vec3f(l.POSITION).vec3f(l.NORMAL).vec2f16(l.UV0).vec4f(l.CENTEROFFSETANDDISTANCE),_=[t(0,0),t(1,0),t(0,1),t(1,0),t(1,1),t(0,1)];class b{constructor(){this.vertexBufferLayout=L}elementCount(e){return 6*e.get(l.POSITION).indices.length}write(e,t,r,i,s,n){f(r.get(l.POSITION),e,s.position,n,6),u(r.get(l.NORMAL),t,s.normal,n,6),h(r.get(l.CENTEROFFSETANDDISTANCE),s.centerOffsetAndDistance,n,6);for(let o=0;o<_.length;++o)s.uv0.setVec(n+o,_[o]);return null}}export{d as LineCalloutMaterial,T as Parameters,O as uniqueMaterialIdentifier};
5
+ import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmission as s}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as o,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as u,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class d extends o{constructor(e,t){super(e,T),this.produces=new Map([[c.LINE_CALLOUTS,e=>s(e)],[c.LINE_CALLOUTS_HUD_DEPTH,e=>s(e)]]),this._configuration=new m(t),this._uniqueMaterialIdentifier=O(this.parameters)}passParameters(){return this.parameters}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=t.slot===c.LINE_CALLOUTS_HUD_DEPTH,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new S(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=O(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function O({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,occlusionTest:o,shaderPolygonOffset:a,hudDepthAlignStart:c,centerOffsetUnits:l,hasSlicePlane:f,screenSizePerspective:u,verticalOffset:h,borderColor:p}){return e`${t}:${r}:${i}:[${s}]:${n}:${o}:${a}:${c}:${l}:${f}:${null!=u}:{${h.screenLength}:${h.minWorldLength}:${h.maxWorldLength}}:[${p}]`}class S extends n{beginSlot(e){return this.getTechnique(p,e)}}class T extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=r(0,0,0,1),this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const L=i().vec3f(l.POSITION).vec3f(l.NORMAL).vec2f16(l.UV0).vec4f(l.CENTEROFFSETANDDISTANCE),_=[t(0,0),t(1,0),t(0,1),t(1,0),t(1,1),t(0,1)];class b{constructor(){this.vertexBufferLayout=L}elementCount(e){return 6*e.get(l.POSITION).indices.length}write(e,t,r,i,s,n){f(r.get(l.POSITION),e,s.position,n,6),u(r.get(l.NORMAL),t,s.normal,n,6),h(r.get(l.CENTEROFFSETANDDISTANCE),s.centerOffsetAndDistance,n,6);for(let o=0;o<_.length;++o)s.uv0.setVec(n+o,_[o]);return null}}export{d as LineCalloutMaterial,T as Parameters,O as uniqueMaterialIdentifier};