@arcgis/core 4.26.0-next.20230111 → 4.26.0-next.20230113

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 (296) hide show
  1. package/arcade/ArcadeDate.js +5 -0
  2. package/arcade/Dictionary.js +1 -1
  3. package/arcade/Feature.js +1 -1
  4. package/arcade/arcadeAsyncRuntime.js +1 -1
  5. package/arcade/arcadeCompiler.js +1 -1
  6. package/arcade/arcadeRuntime.js +1 -1
  7. package/arcade/arcadeTimeUtils.js +5 -0
  8. package/arcade/executionError.js +1 -1
  9. package/arcade/featureset/actions/Adapted.js +1 -1
  10. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  11. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  12. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  13. package/arcade/featureset/support/FeatureSet.js +1 -1
  14. package/arcade/featureset/support/shared.js +1 -1
  15. package/arcade/featureset/support/sqlUtils.js +1 -1
  16. package/arcade/functions/date.js +1 -1
  17. package/arcade/functions/featuresetbase.js +1 -1
  18. package/arcade/functions/featuresetstring.js +1 -1
  19. package/arcade/functions/geomasync.js +1 -1
  20. package/arcade/functions/geometry.js +1 -1
  21. package/arcade/functions/geomsync.js +1 -1
  22. package/arcade/functions/maths.js +1 -1
  23. package/arcade/functions/string.js +1 -1
  24. package/arcade/languageUtils.js +1 -1
  25. package/arcade/treeAnalysis.js +1 -1
  26. package/arcade.js +1 -1
  27. package/assets/esri/core/workers/RemoteClient.js +1 -1
  28. package/assets/esri/core/workers/chunks/{c9477250a5d5ebdef00c.js → 01cd5a9cd4cb1f13691c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/028f9a133104e78e60d2.js +1 -0
  30. package/assets/esri/core/workers/chunks/033e6ae5da6afebd993c.js +1 -0
  31. package/assets/esri/core/workers/chunks/05ab092987251d4a1242.js +1 -0
  32. package/assets/esri/core/workers/chunks/1186a56dacaf269d5271.js +1 -0
  33. package/assets/esri/core/workers/chunks/264e1c00936bcafb9a36.js +1 -0
  34. package/assets/esri/core/workers/chunks/2680392cef77d98ad097.js +1 -0
  35. package/assets/esri/core/workers/chunks/27ba1889fe9f1812389a.js +1165 -0
  36. package/assets/esri/core/workers/chunks/2dfb17fa5b6a5d239942.js +1 -0
  37. package/assets/esri/core/workers/chunks/2e3962506c353b562a88.js +1 -0
  38. package/assets/esri/core/workers/chunks/30ae4c22f6b8aab9f841.js +1 -0
  39. package/assets/esri/core/workers/chunks/329e512f210cb3e904f1.js +1 -0
  40. package/assets/esri/core/workers/chunks/3878efe67f43962b46f8.js +1 -0
  41. package/assets/esri/core/workers/chunks/3b6748f414437cc6cfde.js +1 -0
  42. package/assets/esri/core/workers/chunks/41d25407888326c91566.js +1 -0
  43. package/assets/esri/core/workers/chunks/493e2b00133682748e62.js +1 -0
  44. package/assets/esri/core/workers/chunks/4b2edcb8ef7fae4f7d28.js +1 -0
  45. package/assets/esri/core/workers/chunks/{c11d857dca43de2229fc.js → 4c085cee22ff64ce6d1f.js} +1 -1
  46. package/assets/esri/core/workers/chunks/4d8c53e961275b6a4ee1.js +1 -0
  47. package/assets/esri/core/workers/chunks/5049771eeffe208a9cb8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{58d219ffd9dcc45bb0d1.js → 5191f80f2413ee92c875.js} +1 -1
  49. package/assets/esri/core/workers/chunks/5dfed65b615b33588488.js +1 -0
  50. package/assets/esri/core/workers/chunks/5e9869849d999aac5756.js +1 -0
  51. package/assets/esri/core/workers/chunks/6216cd8134703fd9d9b4.js +1 -0
  52. package/assets/esri/core/workers/chunks/62c8e43741f2d6141f00.js +1 -0
  53. package/assets/esri/core/workers/chunks/64f137358100a1c818f0.js +1 -0
  54. package/assets/esri/core/workers/chunks/6f5f81855985db7c1936.js +1 -0
  55. package/assets/esri/core/workers/chunks/6fba07833345b2d8d373.js +1 -0
  56. package/assets/esri/core/workers/chunks/{80c7726743baf9f54079.js → 7747ee359d357f6e5858.js} +1 -1
  57. package/assets/esri/core/workers/chunks/78fd609f334a29ef39dc.js +1 -0
  58. package/assets/esri/core/workers/chunks/798cd875d64182741364.js +1 -0
  59. package/assets/esri/core/workers/chunks/{9d247a46e0cfdad26273.js → 8176286f8dd055c8ae05.js} +1 -1
  60. package/assets/esri/core/workers/chunks/8530ac02c840c89cc1df.js +1 -0
  61. package/assets/esri/core/workers/chunks/8a69a9b5a04e7321740d.js +1 -0
  62. package/assets/esri/core/workers/chunks/8bd26c71e78698c16778.js +1 -0
  63. package/assets/esri/core/workers/chunks/8c12b82612f050492fef.js +1 -0
  64. package/assets/esri/core/workers/chunks/90653ef5e718bafd6960.js +1 -0
  65. package/assets/esri/core/workers/chunks/{418922fd99e733df023f.js → 9070aa0a94a9204ded1c.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{2ac0d2164a1b49e6f057.js → 94633a9bb5fa4f4ba4de.js} +1 -1
  67. package/assets/esri/core/workers/chunks/969bb94d5bdc9da114e2.js +1 -0
  68. package/assets/esri/core/workers/chunks/9785dba81a6af339e35a.js +1 -0
  69. package/assets/esri/core/workers/chunks/99e16173584702577b80.js +1 -0
  70. package/assets/esri/core/workers/chunks/9aee6f171d4fbac941d9.js +1 -0
  71. package/assets/esri/core/workers/chunks/a194f90ffe13b3d448b0.js +1 -0
  72. package/assets/esri/core/workers/chunks/a53d194e3eede703a6df.js +1 -0
  73. package/assets/esri/core/workers/chunks/a605bf8bc29099ae1b1a.js +1 -0
  74. package/assets/esri/core/workers/chunks/ba7239089a04098e3619.js +1 -0
  75. package/assets/esri/core/workers/chunks/bd2fe663a2b090b134e9.js +1 -0
  76. package/assets/esri/core/workers/chunks/c16003307aad2f84ac51.js +1 -0
  77. package/assets/esri/core/workers/chunks/c6eb6a97ecc6ed9ce713.js +1 -0
  78. package/assets/esri/core/workers/chunks/c81d898f4aef6ecacdb5.js +1 -0
  79. package/assets/esri/core/workers/chunks/cb83480d7074f6185e21.js +1 -0
  80. package/assets/esri/core/workers/chunks/cd0fa942d57a278b0a44.js +1 -0
  81. package/assets/esri/core/workers/chunks/d55332e4d7b8184fd718.js +1 -0
  82. package/assets/esri/core/workers/chunks/d6842acbfa7a39f3ca30.js +1 -0
  83. package/assets/esri/core/workers/chunks/d798bd544433e932f772.js +1 -0
  84. package/assets/esri/core/workers/chunks/e18851e915cb69f53032.js +1 -0
  85. package/assets/esri/core/workers/chunks/{54899827baea77776fc7.js → ea1054116ec842a4f813.js} +1 -1
  86. package/assets/esri/core/workers/chunks/ed1312c2627c0d7e654d.js +1 -0
  87. package/assets/esri/core/workers/chunks/f2750a7b44e8bc8b1e4c.js +1 -0
  88. package/assets/esri/themes/base/widgets/_Editor.scss +1 -11
  89. package/assets/esri/themes/base/widgets/_ItemList.scss +0 -13
  90. package/assets/esri/themes/dark/main.css +1 -1
  91. package/assets/esri/themes/light/main.css +1 -1
  92. package/assets/esri/themes/light/view.css +1 -1
  93. package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
  94. package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
  95. package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
  96. package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
  97. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  98. package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
  99. package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
  100. package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
  101. package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
  102. package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
  103. package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
  104. package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
  105. package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
  106. package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
  107. package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
  108. package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
  109. package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
  110. package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
  111. package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
  112. package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
  113. package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
  114. package/assets/esri/widgets/Sketch/t9n/Sketch_nb.json +1 -1
  115. package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
  116. package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
  117. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
  118. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
  119. package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
  120. package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
  121. package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
  122. package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
  123. package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
  124. package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
  125. package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
  126. package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
  127. package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
  128. package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
  129. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
  130. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
  131. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
  132. package/chunks/ComponentShader.glsl.js +1 -1
  133. package/chunks/Path.glsl.js +1 -1
  134. package/chunks/Terrain.glsl.js +1 -1
  135. package/chunks/languageUtils.js +1 -1
  136. package/geometry/support/MeshTexture.js +1 -1
  137. package/geometry/support/aaBoundingBox.js +1 -1
  138. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  139. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  140. package/interfaces.d.ts +1400 -1314
  141. package/layers/ImageryTileLayer.js +1 -1
  142. package/layers/VoxelWasmPerSceneView.js +1 -1
  143. package/layers/graphics/data/FeatureStore.js +1 -1
  144. package/layers/graphics/data/QueryEngine.js +1 -1
  145. package/layers/graphics/data/timeSupport.js +1 -1
  146. package/layers/graphics/featureConversionUtils.js +1 -1
  147. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  148. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  149. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  150. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  151. package/layers/mixins/ArcGISImageService.js +1 -1
  152. package/layers/mixins/ImageryTileMixin.js +1 -1
  153. package/layers/support/layerOriginUtils.js +1 -1
  154. package/layers/support/rasterFormats/JpgPlus.js +1 -1
  155. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  156. package/layers/support/rasterFunctions/ConvolutionFunction.js +1 -1
  157. package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +1 -1
  158. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  159. package/layers/support/rasterFunctions/ExtractBandFunctionArguments.js +1 -1
  160. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  161. package/layers/support/rasterFunctions/NDVIFunctionArguments.js +1 -1
  162. package/layers/support/rasterFunctions/SlopeFunctionArguments.js +1 -1
  163. package/layers/support/rasterFunctions/StatisticsHistogramFunction.js +5 -0
  164. package/layers/support/rasterFunctions/{StatisticsHistogramsFunctionArguments.js → StatisticsHistogramFunctionArguments.js} +1 -1
  165. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  166. package/package.json +1 -1
  167. package/rest/imageService.js +1 -1
  168. package/rest/support/BaseImageMeasureResult.d.ts +4 -0
  169. package/rest/support/ImageAreaParameters.d.ts +4 -0
  170. package/rest/support/{ImageMeasureAreaAndPerimeterParameters.js → ImageAreaParameters.js} +1 -1
  171. package/rest/support/ImageAreaResult.d.ts +4 -0
  172. package/rest/support/{ImageMeasureAreaAndPerimeterResult.js → ImageAreaResult.js} +1 -1
  173. package/rest/support/ImageDistanceParameters.d.ts +4 -0
  174. package/rest/support/{ImageMeasureDistanceAndAngleParameters.js → ImageDistanceParameters.js} +1 -1
  175. package/rest/support/ImageDistanceResult.d.ts +4 -0
  176. package/rest/support/ImageDistanceResult.js +5 -0
  177. package/rest/support/ImageHeightParameters.d.ts +4 -0
  178. package/rest/support/{ImageMeasureHeightParameters.js → ImageHeightParameters.js} +1 -1
  179. package/rest/support/ImageHeightResult.d.ts +4 -0
  180. package/rest/support/{ImageMeasureHeightResult.js → ImageHeightResult.js} +1 -1
  181. package/rest/support/ImagePointParameters.d.ts +4 -0
  182. package/rest/support/{ImageMeasurePointParameters.js → ImagePointParameters.js} +1 -1
  183. package/rest/support/ImagePointResult.d.ts +4 -0
  184. package/rest/support/{ImageMeasurePointResult.js → ImagePointResult.js} +1 -1
  185. package/support/arcadeUtils.js +1 -1
  186. package/support/revision.js +1 -1
  187. package/time/timeReferenceUtils.js +1 -1
  188. package/views/2d/engine/webgl/Overlay.js +1 -1
  189. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  190. package/views/2d/layers/features/FeatureStore2D.js +1 -1
  191. package/views/2d/layers/features/Pipeline.js +1 -1
  192. package/views/2d/layers/features/support/BinStore.js +1 -1
  193. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  194. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  195. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  196. package/views/3d/glTF/internal/Resource.js +1 -1
  197. package/views/3d/glTF/internal/resourceUtils.js +5 -0
  198. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  199. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  200. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  202. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  203. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  204. package/views/3d/layers/graphics/Labeler.js +1 -1
  205. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  206. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  207. package/views/3d/layers/i3s/I3SQueryFeatureStore.js +1 -1
  208. package/views/3d/state/ViewState.js +1 -1
  209. package/views/3d/state/ViewStateManager.js +1 -1
  210. package/views/3d/terrain/Overlay.js +1 -1
  211. package/views/3d/terrain/OverlayManager.js +1 -1
  212. package/views/3d/terrain/TerrainRenderer.js +1 -1
  213. package/views/3d/terrain/TerrainSurface.js +1 -1
  214. package/views/3d/terrain/TileRenderer.js +1 -1
  215. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  216. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +1 -1
  217. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  218. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
  219. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +1 -1
  220. package/views/3d/webgl-engine/lib/AnimationTimeStep.js +5 -0
  221. package/views/3d/webgl-engine/lib/AnimationTimer.js +1 -1
  222. package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
  223. package/views/3d/webgl-engine/lib/Material.js +1 -1
  224. package/views/3d/webgl-engine/lib/RenderFeature.js +5 -0
  225. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  226. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  227. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  228. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  229. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  230. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  231. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  232. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  233. package/views/draw/support/layerUtils.js +1 -1
  234. package/views/webgl/RenderingContext.js +1 -1
  235. package/views/webgl/Texture.js +1 -1
  236. package/widgets/Editor/EditorViewModel.js +1 -1
  237. package/widgets/Editor.js +1 -1
  238. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  239. package/widgets/FeatureTemplates/ItemList.js +1 -1
  240. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  241. package/widgets/FeatureTemplates/TemplateItemGroup.js +1 -1
  242. package/widgets/FeatureTemplates.js +1 -1
  243. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  244. package/widgets/support/decorators/accessibleHandler.js +1 -1
  245. package/assets/esri/core/workers/chunks/038dc3f9ef06ef3c960c.js +0 -1
  246. package/assets/esri/core/workers/chunks/078a0b134210167b629d.js +0 -1
  247. package/assets/esri/core/workers/chunks/080a4be417be4943f6a0.js +0 -1
  248. package/assets/esri/core/workers/chunks/0877bab7c03a1de2e713.js +0 -1
  249. package/assets/esri/core/workers/chunks/0c9200ab19fd2f56f87f.js +0 -1
  250. package/assets/esri/core/workers/chunks/1cbffa96ea6683e5f3ec.js +0 -1
  251. package/assets/esri/core/workers/chunks/1f742c3b11c76814fa4d.js +0 -1
  252. package/assets/esri/core/workers/chunks/2eb2d49c549e53934b8b.js +0 -1
  253. package/assets/esri/core/workers/chunks/332494b96a47b378f4e0.js +0 -1
  254. package/assets/esri/core/workers/chunks/3326536d183a858a2a4d.js +0 -1
  255. package/assets/esri/core/workers/chunks/3f4fc8379fc11bc293cc.js +0 -1
  256. package/assets/esri/core/workers/chunks/43fecd621cd043f64828.js +0 -1165
  257. package/assets/esri/core/workers/chunks/47b0b660f5412097fe26.js +0 -1
  258. package/assets/esri/core/workers/chunks/4c0d7a074083aa9614bb.js +0 -1
  259. package/assets/esri/core/workers/chunks/594d7e871b648d5c9662.js +0 -1
  260. package/assets/esri/core/workers/chunks/680b90ac98e8d1ac0e33.js +0 -1
  261. package/assets/esri/core/workers/chunks/6b589f47cb4731df1639.js +0 -1
  262. package/assets/esri/core/workers/chunks/72557c4b1582aa18ad4d.js +0 -1
  263. package/assets/esri/core/workers/chunks/72b490ad371e0c2264f6.js +0 -1
  264. package/assets/esri/core/workers/chunks/75ce17cf13aab0440572.js +0 -1
  265. package/assets/esri/core/workers/chunks/75f4e884a1a0aedc0afd.js +0 -1
  266. package/assets/esri/core/workers/chunks/7b9ab3fb378172831c14.js +0 -1
  267. package/assets/esri/core/workers/chunks/7bef95b168303bdc4bf1.js +0 -1
  268. package/assets/esri/core/workers/chunks/803492088780e18de801.js +0 -1
  269. package/assets/esri/core/workers/chunks/89003e387684af5ebeac.js +0 -1
  270. package/assets/esri/core/workers/chunks/8f93026764a0cce0901b.js +0 -1
  271. package/assets/esri/core/workers/chunks/98350b6b95da62ef5f12.js +0 -1
  272. package/assets/esri/core/workers/chunks/a9cae0d386aa9c00f744.js +0 -1
  273. package/assets/esri/core/workers/chunks/ad65c24558098f21bbf3.js +0 -1
  274. package/assets/esri/core/workers/chunks/aef90ee3f0979a7acb38.js +0 -1
  275. package/assets/esri/core/workers/chunks/b68c7754b0220b194ecf.js +0 -1
  276. package/assets/esri/core/workers/chunks/c012317f045a74fdd79d.js +0 -1
  277. package/assets/esri/core/workers/chunks/cb42675e5b1c41634c63.js +0 -1
  278. package/assets/esri/core/workers/chunks/cb901033dd15b3b72025.js +0 -1
  279. package/assets/esri/core/workers/chunks/d398b6b8a6b0a95247de.js +0 -1
  280. package/assets/esri/core/workers/chunks/d447ebc944a9867f5a99.js +0 -1
  281. package/assets/esri/core/workers/chunks/daaabed988b6ea866350.js +0 -1
  282. package/assets/esri/core/workers/chunks/e048641971aef9dd4da9.js +0 -1
  283. package/assets/esri/core/workers/chunks/e3fd383aee378cbb0dae.js +0 -1
  284. package/assets/esri/core/workers/chunks/e967ffca641947212992.js +0 -1
  285. package/assets/esri/core/workers/chunks/e9c81eee503c1b112bad.js +0 -1
  286. package/assets/esri/core/workers/chunks/ea6cf948fe2de0242308.js +0 -1
  287. package/assets/esri/core/workers/chunks/ed5e71b45dfefcbb2da4.js +0 -1
  288. package/assets/esri/core/workers/chunks/ee50d5d0afe9bdccc84d.js +0 -1
  289. package/assets/esri/core/workers/chunks/ee91401507833875facc.js +0 -1
  290. package/assets/esri/core/workers/chunks/f7d40dd78ef116f5793b.js +0 -1
  291. package/assets/esri/core/workers/chunks/f8ab6e354834b9c0e857.js +0 -1
  292. package/assets/esri/core/workers/chunks/faea681c279486b7a5e7.js +0 -1
  293. package/layers/support/rasterFunctions/StatisticsHistogramsFunction.js +0 -5
  294. package/rest/support/ImageMeasureDistanceAndAngleResult.js +0 -5
  295. package/views/3d/support/animationUtils.js +0 -5
  296. package/views/3d/webgl-engine/lib/RenderStateFeature.js +0 -5
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
+ */
5
+ import{clamp as t}from"../../../../core/mathUtils.js";import{Milliseconds as i}from"../../../../core/time.js";class e{constructor(){this._step=m,this._dilation=1,this._firstIdleTime=0}frame(e,n){n?0===this._firstIdleTime&&(this._firstIdleTime=performance.now()):this._firstIdleTime=0;const p=n?performance.now()-this._firstIdleTime:0;if(p>=r+o)return this._step=i(1/0),void(this._dilation=1);const a=t(e/s,m,l);this._step===1/0?this._step=i(a):this._step=i(this._step*_+a*(1-_)),this._dilation=p>=r?h:1}get value(){return this._step}get timeDilation(){return this._dilation}clear(){this._step=i(0)}}const s=.5,r=i(6e4),o=i(5e3),h=10,_=.9,n=30,m=i(1e3/1),l=i(1e3/n);export{e as AnimationTimeStep};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{Milliseconds as t}from"../../../../core/time.js";class e{constructor(){this.enabled=!0,this._time=t(0)}get time(){return this._time}advance(t){return this._time!==t.time&&(this._time=t.time,!0)}}export{e as AnimationTimer};
5
+ import{isSome as t}from"../../../../core/maybe.js";import{Milliseconds as e}from"../../../../core/time.js";class i{constructor(){this.enabled=!0,this._time=e(0)}get time(){return this._time}advance({deltaTime:i,fixedTime:m}){return t(m)?this._time!==m&&(this._time=m,!0):(this._time=e(this._time+i),0!==i)}}class m{constructor(t,e){this.deltaTime=t,this.fixedTime=e}}export{i as AnimationTimer,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.26/esri/copyright.txt for details.
4
4
  */
5
- import{ResourceState as e}from"./basicInterfaces.js";class t{constructor(e){this._material=e.material,this._techniqueRepository=e.techniqueRep,this._output=e.output}dispose(){this._techniqueRepository.release(this._technique)}get technique(){return this._technique}get _stippleTextureRepository(){return this._techniqueRepository.constructionContext.stippleTextureRepository}ensureTechnique(e,t,i=this._output){return this._technique=this._techniqueRepository.releaseAndAcquire(e,this._material.getConfiguration(i,t),this._technique),this._technique}ensureResources(t){return e.LOADED}}export{t as default};
5
+ import{ResourceState as e}from"./basicInterfaces.js";class t{constructor(e){this._material=e.material,this._techniqueRepository=e.techniqueRep,this._output=e.output}dispose(){this._techniqueRepository.release(this._technique)}get technique(){return this._technique}get _stippleTextureRepository(){return this._techniqueRepository.constructionContext.stippleTextureRepository}ensureTechnique(e,t){return this._technique=this._techniqueRepository.releaseAndAcquire(e,this._material.getConfiguration(this._output,t),this._technique),this._technique}ensureResources(t){return e.LOADED}}export{t as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/maybe.js";import{f as t}from"../../../../chunks/vec3f64.js";import{NoParameters as r}from"../core/shaderModules/interfaces.js";import{ContentObject as s}from"./ContentObject.js";import{ContentObjectType as i}from"./ContentObjectType.js";import{Default3D as a}from"./DefaultVertexAttributeLocations.js";import{copyParameters as n,updateParameters as p}from"../materials/internal/MaterialUtil.js";class d extends s{constructor(e,r){super(),this.type=i.Material,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._insertOrder=0,this._vertexAttributeLocations=a,this._pp0=t(0,0,1),this._pp1=t(0,0,0),this._parameters=n(e,r),this.validateParameters(this._parameters)}dispose(){}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){p(this._parameters,e)&&(this.validateParameters(this._parameters),t&&this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleForOutput(e.output)&&0!=(this.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderOccluded(){return this.parameters.renderOccluded}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get insertOrder(){return this._insertOrder}set insertOrder(e){e!==this._insertOrder&&(this._insertOrder=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){e(this.repository)&&this.repository.materialChanged(this)}intersectDraped(e,t,r,s,i,a){return this._pp0[0]=this._pp1[0]=s[0],this._pp0[1]=this._pp1[1]=s[1],this.intersect(e,t,r,this._pp0,this._pp1,i)}}var h;!function(e){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 o extends r{constructor(){super(...arguments),this.renderOccluded=h.Occlude}}export{d as Material,o as MaterialParameters,h as RenderOccludedFlag};
5
+ import{isSome as e}from"../../../../core/maybe.js";import{f as r}from"../../../../chunks/vec3f64.js";import{NoParameters as t}from"../core/shaderModules/interfaces.js";import{Parameters as s}from"./AnimationTimer.js";import{ContentObject as i}from"./ContentObject.js";import{ContentObjectType as a}from"./ContentObjectType.js";import{Default3D as n}from"./DefaultVertexAttributeLocations.js";import{copyParameters as p,updateParameters as d}from"../materials/internal/MaterialUtil.js";class h extends i{constructor(e,t){super(),this.type=a.Material,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._insertOrder=0,this._vertexAttributeLocations=n,this._pp0=r(0,0,1),this._pp1=r(0,0,0),this._parameters=p(e,t),this.validateParameters(this._parameters)}dispose(){}get parameters(){return this._parameters}update(e){return!1}setParameters(e,r=!0){d(this._parameters,e)&&(this.validateParameters(this._parameters),r&&this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleForOutput(e.output)&&0!=(this.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderOccluded(){return this.parameters.renderOccluded}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get insertOrder(){return this._insertOrder}set insertOrder(e){e!==this._insertOrder&&(this._insertOrder=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){e(this.repository)&&this.repository.materialChanged(this)}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)}}class o extends s{constructor(e,r,t){super(r,t),this.camera=e}}var c;!function(e){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"}(c||(c={}));class u extends t{constructor(){super(...arguments),this.renderOccluded=c.Occlude}}export{h as Material,u as MaterialParameters,c as RenderOccludedFlag,o as UpdateParameters};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
+ */
5
+ import has from"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{RenderState as a}from"../../../support/RenderState.js";var t;function i(i=has("enable-feature:high-quality-idle")){const s=new e;return i&&(s.set(a.INTERACTING,t.Antialiasing,!0),s.set(a.IDLE,t.Antialiasing,!0),s.set(a.INTERACTING,t.HighQualityTransparency,!0),s.set(a.IDLE,t.HighQualityTransparency,!0),s.set(a.INTERACTING,t.RealisticAtmosphere,!0),s.set(a.IDLE,t.RealisticAtmosphere,!0),s.set(a.IDLE,t.SSAO,!0),s.set(a.IDLE,t.WaterReflection,!0),s.set(a.IDLE,t.PhysicalPixelRendering,!0)),s.set(a.ANIMATING,t.ShadowMapUpdate,!0),s.set(a.INTERACTING,t.ShadowMapUpdate,!0),s.set(a.IDLE,t.ShadowMapUpdate,!0),s.set(a.IDLE,t.HighQualityVoxel,!0),s}!function(e){e[e.Antialiasing=0]="Antialiasing",e[e.HighQualityTransparency=1]="HighQualityTransparency",e[e.HighQualityVoxel=2]="HighQualityVoxel",e[e.RealisticAtmosphere=3]="RealisticAtmosphere",e[e.SSAO=4]="SSAO",e[e.WaterReflection=5]="WaterReflection",e[e.ShadowMapUpdate=6]="ShadowMapUpdate",e[e.PhysicalPixelRendering=7]="PhysicalPixelRendering"}(t||(t={})),has.add("enable-feature:high-quality-idle",!0);export{t as RenderFeature,i as setupFeatureDefaults};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import has from"../../../../core/has.js";import{clamp as n}from"../../../../core/mathUtils.js";import{unwrapOr as i,removeMaybe as a,disposeMaybe as h,isSome as o,isNone as d,applySome as l,unwrap as _}from"../../../../core/maybe.js";import c from"../../../../core/PooledArray.js";import{watch as p,syncAndInitial as m,initial as g,sync as u}from"../../../../core/reactiveUtils.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as T}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as R}from"../../../../core/accessorSupport/decorators/subclass.js";import{h as b,a as E,m as A}from"../../../../chunks/mat4.js";import{I as P,c as S}from"../../../../chunks/mat4f64.js";import{a as y}from"../../../../chunks/boundedPlane.js";import{MINIMUM_IDLE_ANIMATION_FPS_TIME as O,MAXIMUM_IDLE_ANIMATION_FPS_TIME as w,MAXIMUM_ANIMATION_LOAD as C}from"../../support/animationUtils.js";import D from"../../support/debugFlags.js";import{TransparencyMode as x}from"../../terrain/TerrainRenderer.js";import{RenderPassManager as I}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as H}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparentRenderStyle as L}from"../core/shaderLibrary/hud/HUDUniforms.js";import{Decorations as v,RenderRequestType as M,StencilBits as N}from"./basicInterfaces.js";import{BoundingInfo as U}from"./BoundingInfo.js";import{ZERO as F,union as j}from"./depthRange.js";import{depthRangeFromScene as q}from"./depthRangeUtils.js";import{createEmptyDepthTexture as G}from"./glUtil3D.js";import{Highlight as V}from"./Highlight.js";import{RenderOccludedFlag as B}from"./Material.js";import{OffscreenRendering as W}from"./OffscreenRendering.js";import{RenderContext as k}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as Q}from"./rendererUtils.js";import{RenderPluginManager as Y}from"./RenderPluginManager.js";import{RenderSlot as X}from"./RenderSlot.js";import{RenderStateFeature as z,setupFeatureDefaults as J}from"./RenderStateFeature.js";import{ShadowAccumulator as K}from"./ShadowAccumulator.js";import{ShadowHighlight as Z}from"./ShadowHighlight.js";import{ShadowMap as $,SnapshotSlot as ee}from"./ShadowMap.js";import re from"./SliceHelper.js";import{SmaaRenderPass as te}from"./SmaaRenderPass.js";import{SSAOHelper as se}from"./SSAOHelper.js";import{TransparencyPassType as ne}from"./TransparencyPassType.js";import{EdgeView as ie}from"./edgeRendering/EdgeView.js";import{Transparency as ae}from"./edgeRendering/interfaces.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as oe}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{RenderState as _e}from"../../../support/RenderState.js";import{ClearBufferBit as ce,PixelFormat as pe,PixelType as me}from"../../../webgl/enums.js";const ge=.9;let ue=class extends r{get _bindParameters(){return this._renderContext.bindParameters}isFeatureEnabled(e,r=this._state){return i(this._qualityLevelFeatures.get(r,e),!1)}setFeatureEnabled(e,r,t){this._qualityLevelFeatures.set(r,e,t),this.notifyChange("_qualityLevelFeatures"),this._requestRender()}get _antialiasing(){return this._antialiasingEnabled||this.isFeatureEnabled(z.Antialiasing)}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(z.HighQualityTransparency)}get hasWaterReflection(){return this.hasWater&&(this._waterReflectionEnabled||this.isFeatureEnabled(z.WaterReflection))}get hasWater(){return this._hasWater||this._hasOverlayWater}constructor(e,r,t,n,i,a,h,o){super({}),this._materialRepository=e,this._shaderTechniqueRepository=t,this._rctx=n,this._compositingHelper=i,this._magnifierHelper=a,this._requestRender=h,this._stage=o,this._materialRenderers=new c,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._renderOverlay=e=>{},this._isRendering=!1,this._fallbackDepthStencilTexture=null,this._sliceHelper=new re,this._state=_e.IDLE,this._qualityLevelFeatures=J(),this._antialiasingEnabled=!0,this._highQualityTransparencyEnabled=!0,this._terrainRenderingEnabled=!0,this._terrainTransparency=x.Opaque,this._waterReflectionEnabled=!1,this._ssaoEnabled=!1,this._hasAnimations=!1,this._animationTimestep=O,this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new te(this._rctx,t),h(),this._offscreenRendering=new W(this._rctx,this._compositingHelper),this.performanceInfo=new de(this._rctx),this._shadowMap=new $(this._rctx,o.viewingMode),this._ssaoHelper=new se(t,this._rctx,h),this._highlight=new V(t,this._rctx),this._shadowHighlight=new Z(this._rctx,o.viewingMode),this._shadowAccumulator=new K(this._rctx,t,o,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t),this._renderShadowCascades(H.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),h),this._renderContext=new k(this._rctx,this._offscreenRendering,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new Y({renderContext:this._renderContext,techniqueRepository:t,textureRepository:r,materialRepository:this._materialRepository,requestRender:h,controller:o}),this.renderPassManager=new I(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([p((()=>this._stage.state.camera),(()=>h()),m),p((()=>D.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ae.TRANSPARENT):()=>{},h()}),g),p((()=>this._ssaoEnabled||this.isFeatureEnabled(z.SSAO)),(e=>this._ssaoHelper.enabled=e),m)])}normalizeCtorArgs(){return{}}destroy(){this._handles.destroy(),this._smaaPass.dispose(),this._gpuTimerHandle=a(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=h(this._fallbackDepthStencilTexture),this._shadowMap.dispose(),this._ssaoHelper.dispose(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),U.prune()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||o(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return d(this._edgeView)&&(this._edgeView=new ie({rctx:this._rctx,renderSR:this._stage.renderSR,viewingMode:this._stage.viewingMode,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.immediate.schedule(e)}),this._handles.add(p((()=>l(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),u)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return b(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.screenSpaceReflectionsEnabled&&t.ssr.enabled!==e.screenSpaceReflectionsEnabled&&(t.ssr.enabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),o(e.environment)){o(e.environment.weather)&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible),void 0!==e.environment.lighting.ambientOcclusionEnabled&&this._ssaoEnabled!==e.environment.lighting.ambientOcclusionEnabled&&(this._ssaoEnabled=e.environment.lighting.ambientOcclusionEnabled,this._requestRender()),void 0!==e.environment.lighting.waterReflectionEnabled&&this._waterReflectionEnabled!==e.environment.lighting.waterReflectionEnabled&&(this._waterReflectionEnabled=e.environment.lighting.waterReflectionEnabled,this._requestRender());const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasingEnabled!==e.antialiasingEnabled&&(this._antialiasingEnabled=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.renderOverlay&&this._renderOverlay!==e.renderOverlay&&(this._renderOverlay=e.renderOverlay,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=_(e.slicePlane),this._requestRender()),void 0!==e.terrainRenderingEnabled&&this._terrainRenderingEnabled!==e.terrainRenderingEnabled&&(this._terrainRenderingEnabled=e.terrainRenderingEnabled,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:n}=e;if(0===t.length&&0===s.length&&0===n.length)return;const i=Q(e);let a=!1;i.forEach(((t,s)=>{if(r.done)return;let n=this._materialRenderers.find((e=>e.material===s));d(n)&&t.adds.length>0&&(n=new he(this._rctx,this._materialRepository,s),this._materialRenderers.push(n)),n&&(n.modify(t),n.isEmpty&&(a=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),a&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._hasHighlights=this._materialRenderers.some((e=>e.hasHighlights)),this._bindParameters.hasOccludees=this._materialRenderers.some((e=>e.hasOccludees)),this._hasWater=this._materialRenderers.some((e=>e.hasWater)),this._hasHUDElements=this._materialRenderers.some((e=>e.requiresSlot(X.LINE_CALLOUTS_HUD_DEPTH,H.Color)||e.requiresSlot(X.HUD_MATERIAL,H.Color)||e.requiresSlot(X.LABEL_MATERIAL,H.Color))),this._requestRender()}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?a(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep}render(e,r,t,s,n){this._isRendering=!0,this.performanceInfo.startFrame();const{camera:i,contentCamera:a,mode:h}=t;this._state=h,this._renderOverlay(n),this.performanceInfo.advance(le.OVERLAY),this._renderContext.time=n,this._bindParameters.transparencyPassType=ne.NONE;const l=this._offscreenRendering;l.setupRenderTarget(this.hasWaterReflection);const _=y(this._sliceHelper.plane);s===v.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),i.setGLViewport(this._rctx),this._prepare(i,a),this._renderPlugins.prepareRender(),this.performanceInfo.advance(le.PREPARE);const c=this._computeDepthRange(i);this._renderShadowMap(e,i,this._bindParameters.lighting.mainLight.direction,c),this.performanceInfo.advance(le.SHADOW_MAP),l.initializeFrame(i),this._ensureBindParameters(i,a),this._renderLinearDepth(),this.performanceInfo.advance(le.LINEAR_DEPTH),this._accumulateShadows(c,i,a),this.performanceInfo.advance(le.ACCUMULATED_SHADOWS),this._renderNormal(),this.performanceInfo.advance(le.NORMALS),this._ensureBindParametersSSR(),this._renderSSAO(),this.performanceInfo.advance(le.SSAO),this._renderContext.output=H.Color,l.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(le.OPAQUE);const p=this._terrainRenderingEnabled&&(this._terrainTransparency===x.Semitransparent||this._terrainTransparency===x.TransparentWithDraped),m=this._highQualityTransparency&&p;this._renderTerrainLinearDepth(m),this._setMultipassEnabled(m),this._setTerrainCulling(m),this._renderEdges(ae.OPAQUE),this.performanceInfo.advance(le.OPAQUE_EDGES),this._offscreenRendering.bindTarget(this._offscreenRendering.currentColorTarget,this._offscreenRendering.mainDepth),this._renderSlot(X.VOXEL),this.performanceInfo.advance(le.VOXEL),this._renderHiddenTransparentEdges();const g=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;g&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(le.TRANSPARENT),this._renderGeometryLinearDepth(m);const u=this._renderHUDVisibility(m);m||this._renderInternalSlot(X.LINE_CALLOUTS),this.performanceInfo.advance(le.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(ae.TRANSPARENT,m),this.performanceInfo.advance(le.TRANSPARENT_EDGES),this._renderTransparentTerrain(),p&&u&&(m?this._renderLineCallouts(L.Occluded):l.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(L.Occluded,l.framebuffer),this.performanceInfo.advance(le.HUD_OCCLUDED)),this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),p&&(l.compositeTransparentTerrainOntoMain(this._bindParameters),m&&(this._renderEdges(ae.OPAQUE),this.performanceInfo.advance(le.OPAQUE_EDGES),g&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(le.TRANSPARENT),this._renderEdges(ae.TRANSPARENT),this.performanceInfo.advance(le.TRANSPARENT_EDGES))),m&&this._renderLineCallouts(L.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),l.renderToTargets((()=>{this._renderInternalSlot(X.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(X.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(X.LASERLINES)}),l.currentColorTarget,l.mainDepth),this.performanceInfo.advance(le.ENVIRONMENT),this._renderPlugins.needsLaserlineWithContrastControl&&l.renderTmpAndCompositeToMain((()=>this._renderSlot(X.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,oe.PremultipliedAlpha),this.performanceInfo.advance(le.LASER_LINE),this._renderOccluded(),this.performanceInfo.advance(le.OCCLUDED);const f=s===v.ON&&this._magnifierHelper.enabled,T=f&&d(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(T);const R=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(R)&&o(R)&&this._compositingHelper.composite(this._bindParameters,R,oe.None),this.performanceInfo.advance(le.ANTIALIASING),this._renderHUD(L.NotOccluded,T),this.performanceInfo.advance(le.HUD),this._renderHighlights(T,this._bindParameters),this.performanceInfo.advance(le.HIGHLIGHTS),f&&this._magnifierHelper.render(this._rctx,this._bindParameters),T!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.tmpColorTexture,oe.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=_,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.finishFrame()}_renderObjectAndLayerIdColor(e){o(e)&&has("enable-feature:objectAndLayerId-rendering")&&(this._rctx.bindFramebuffer(e),this._offscreenRendering.renderToFBO((()=>this._renderGeometryAndTransparentTerrainPass(H.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e),this._offscreenRendering.renderToFBO((()=>{this._bindParameters.renderTransparentlyOccludedHUD=L.NotOccluded,this._renderInternalSlot(X.HUD_MATERIAL)}),void 0,!0,!0))}finish(e){this._hasAnimations||(this._animationTimestep=f(0));const r=this.performanceInfo.gpuSamplingEnabled,t=e===M.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s),a=n(i/C,w,O);this._animationTimestep=f(this._animationTimestep*ge+a*(1-ge))}}readDepthPixels(e,r,t){const s=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ce.COLOR_BUFFER_BIT|ce.DEPTH_BUFFER_BIT|ce.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(H.Depth)}s.readPixels(r[0],r[1],r[2],r[3],pe.RGBA,me.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,n){this._offscreenRendering.bindTarget(this._offscreenRendering.hudVisibility).readPixels(e,r,t,s,pe.RGBA,me.UNSIGNED_BYTE,n)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;o(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,oe.Alpha,r)}_renderShadowMap(e,r,t,s){const n=this._shadowMap;n.enabled&&this.isFeatureEnabled(z.ShadowMapUpdate)&&(n.start(r,t,s),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(H.ShadowHighlight,this._shadowMap,(e=>n.takeCascadeSnapshotTo(e,ee.Highlight))),n.clear(),this._renderShadowCascades(H.ShadowExludeHighlight,this._shadowMap,(e=>{n.takeCascadeSnapshotTo(e,ee.Default),this._renderGeometryAndTransparentTerrainPass(H.ShadowHighlight)}))):this._renderShadowCascades(H.Shadow),n.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.cascades)s.camera.setGLViewport(this._rctx),this._prepare(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this.hasWaterReflection||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(H.Depth)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=H.Depth,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(H.Depth)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this._needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(H.Normal)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return F;const r=q(e,this._materialRenderers,this._stage.layers);return j(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderSSAO(){this._ssaoHelper.computeSSAO(this._bindParameters,this._offscreenRendering.linearDepthTexture,this._offscreenRendering.normalTexture)}_renderOpaqueGeometry(){this._renderSlot(X.INTEGRATED_MESH),this._renderSlot(X.OPAQUE_TERRAIN),this._renderInternalSlot(X.OPAQUE_MATERIAL),this._renderSlot(X.OPAQUE_MATERIAL),this._renderSlot(X.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(X.TRANSPARENT_MATERIAL),this._renderSlot(X.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(X.TRANSPARENT_TERRAIN)}_renderHUDVisibility(e){let r=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,r=this._renderInternalSlot(X.OCCLUSION_PIXELS)}),e),r}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===L.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(X.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(X.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.hudColorTexture,oe.PremultipliedAlpha)):e===L.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(L.Occluded)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(X.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(X.HUD_MATERIAL),this._renderInternalSlot(X.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlight,s=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(H.Highlight),this._rctx.clearSafe(ce.DEPTH_BUFFER_BIT),this._renderHUDElements(L.Both)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&o(this._offscreenRendering.linearDepthTexture)&&this._shadowAccumulator.renderAccumulation(this._offscreenRendering.linearDepthTexture,e,r,t)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._bindParameters.transparencyPassType=t,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.output;this._renderContext.output=H.Alpha,t(ne.Alpha),this._renderContext.output=H.Color,t(ne.Color),t(ne.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(this._bindParameters,r),this._bindParameters.transparencyPassType=ne.NONE,this._renderContext.output=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forAll((({material:r})=>{r&&r.isVisible()&&r.renderOccluded===B.OccludeAndTransparentStencil&&(e|=r.renderOccluded,Re.push(r))}));const r=this._offscreenRendering,t=(t,s,n,i,a)=>{0!=(e&s)&&(r.renderToTargets(n,r.tmpColor,r.mainDepth,[0,0,0,0],i,a),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==Re.length&&(this._renderInternalSlot(X.OCCLUDER_MATERIAL,Re),t(.5,B.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(X.TRANSPARENT_OCCLUDER_MATERIAL,Re)),!1,!1),Re.length=0),this._materialRenderers.forAll((({material:r})=>{r&&r.isVisible()&&(r.renderOccluded===B.OccludeAndTransparent||r.renderOccluded===B.Transparent||r.renderOccluded===B.Opaque)&&(e|=r.renderOccluded,Te.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,s>B.Occlude&&this._renderSlot(X.OCCLUDED_TERRAIN),this._renderInternalSlot(X.OPAQUE_MATERIAL,Te),this._renderInternalSlot(X.TRANSPARENT_MATERIAL,Te),this._renderInternalSlot(X.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Te),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=H.Color,t(.5,B.OccludeAndTransparent,(()=>n(B.OccludeAndTransparent)),!0,N.OutlineVisualElementMask),t(.5,B.Transparent,(()=>n(B.Transparent)),!0,N.OutlineVisualElementMask),t(1,B.Opaque,(()=>n(B.Opaque)),!0,N.OutlineVisualElementMask),Te.length=0}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&o(e))return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.requiresSlot(X.TRANSPARENT_MATERIAL,H.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(E(Ee,this._bindParameters.camera.viewMatrix),E(be,this._bindParameters.camera.projectionMatrix),A(Ae,Ee,be),A(Ae,this._renderContext.lastFrameCamera.viewMatrix,Ae),A(Ae,this._renderContext.lastFrameCamera.projectionMatrix,Ae),this._reprojectionMatrix=Ae),this._bindParameters.ssr.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._bindParameters.ssr.lastFrameColorTexture=null,this._bindParameters.ssr.enabled=this.hasWaterReflection}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,o(r)?r.forEach((e=>{if(!e.shouldRender(this._renderContext))return;const r=this._materialRenderers.find((r=>r.material===e));o(r)&&(t=r.render(this._renderContext.output,this._bindParameters)||t)})):this._materialRenderers.forAll((e=>{e.material.shouldRender(this._renderContext)&&e.render(this._renderContext.output,this._bindParameters)&&(t=!0)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=G(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreenRendering?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,getFramebufferTexture:r=>{switch(r){case fe.Color:return e._offscreenRendering.colorTexture;case fe.LinearDepth:return e._offscreenRendering.linearDepthTexture;case fe.Normals:return e._offscreenRendering.normalTexture;case fe.ShadowMap:return e._shadowMap.depthTexture;case fe.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case fe.Highlight:return e._offscreenRendering.highlightTexture}}}}};var fe;e([T()],ue.prototype,"_shadowAccumulator",void 0),e([T()],ue.prototype,"_state",void 0),e([T({readOnly:!0})],ue.prototype,"_qualityLevelFeatures",void 0),e([T()],ue.prototype,"_antialiasingEnabled",void 0),e([T({readOnly:!0})],ue.prototype,"_antialiasing",null),e([T()],ue.prototype,"_ssaoEnabled",void 0),e([T()],ue.prototype,"_smaaPass",void 0),e([T({autoDestroy:!0})],ue.prototype,"_edgeView",void 0),e([T()],ue.prototype,"updating",null),e([T()],ue.prototype,"isCameraFinal",null),ue=e([R("esri.views.3d.webgl-engine.lib.Renderer")],ue),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(fe||(fe={}));const Te=[],Re=[],be=S(),Ee=S(),Ae=S();export{fe as FramebufferId,ue as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import has from"../../../../core/has.js";import{unwrapOr as n,removeMaybe as i,disposeMaybe as a,isSome as h,isNone as d,applySome as o,unwrap as l}from"../../../../core/maybe.js";import _ from"../../../../core/PooledArray.js";import{watch as c,syncAndInitial as p,initial as m,sync as g}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{h as T,a as R,m as b}from"../../../../chunks/mat4.js";import{I as E,c as A}from"../../../../chunks/mat4f64.js";import{a as P}from"../../../../chunks/boundedPlane.js";import S from"../../support/debugFlags.js";import{TransparencyMode as y}from"../../terrain/TerrainRenderer.js";import{RenderPassManager as O}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparentRenderStyle as C}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AnimationTimeStep as D}from"./AnimationTimeStep.js";import{Decorations as x,RenderRequestType as I,StencilBits as H}from"./basicInterfaces.js";import{BoundingInfo as L}from"./BoundingInfo.js";import{ZERO as M,union as v}from"./depthRange.js";import{depthRangeFromScene as N}from"./depthRangeUtils.js";import{createEmptyDepthTexture as U}from"./glUtil3D.js";import{Highlight as F}from"./Highlight.js";import{RenderOccludedFlag as j}from"./Material.js";import{OffscreenRendering as G}from"./OffscreenRendering.js";import{RenderContext as V}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as q}from"./rendererUtils.js";import{RenderFeature as B,setupFeatureDefaults as W}from"./RenderFeature.js";import{RenderPluginManager as k}from"./RenderPluginManager.js";import{RenderSlot as Q}from"./RenderSlot.js";import{ShadowAccumulator as Y}from"./ShadowAccumulator.js";import{ShadowHighlight as X}from"./ShadowHighlight.js";import{ShadowMap as z,SnapshotSlot as J}from"./ShadowMap.js";import K from"./SliceHelper.js";import{SmaaRenderPass as Z}from"./SmaaRenderPass.js";import{SSAOHelper as $}from"./SSAOHelper.js";import{TransparencyPassType as ee}from"./TransparencyPassType.js";import{EdgeView as re}from"./edgeRendering/EdgeView.js";import{Transparency as te}from"./edgeRendering/interfaces.js";import{MergedRenderer as se}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ne}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as ie,PerformanceCategory as ae}from"../statistics/RendererPerformanceInfo.js";import{RenderState as he}from"../../../support/RenderState.js";import{ClearBufferBit as de,PixelFormat as oe,PixelType as le}from"../../../webgl/enums.js";let _e=class extends r{get _bindParameters(){return this._renderContext.bindParameters}isFeatureEnabled(e,r=this._state){return n(this._renderStateFeatures.get(r,e),!1)}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _antialiasing(){return this._antialiasingEnabled||this.isFeatureEnabled(B.Antialiasing)}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(B.HighQualityTransparency)}get hasWaterReflection(){return this.hasWater&&(this._waterReflectionEnabled||this.isFeatureEnabled(B.WaterReflection))}get hasWater(){return this._hasWater||this._hasOverlayWater}constructor(e,r,t,n,i,a,h,d){super({}),this._materialRepository=e,this._shaderTechniqueRepository=t,this._rctx=n,this._compositingHelper=i,this._magnifierHelper=a,this._requestRender=h,this._stage=d,this._materialRenderers=new _,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._renderOverlay=e=>{},this._isRendering=!1,this._fallbackDepthStencilTexture=null,this._sliceHelper=new K,this._state=he.IDLE,this._renderStateFeatures=W(),this._antialiasingEnabled=!0,this._highQualityTransparencyEnabled=!0,this._terrainRenderingEnabled=!0,this._terrainTransparency=y.Opaque,this._waterReflectionEnabled=!1,this._ssaoEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new D,this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new Z(this._rctx,t),h(),this._offscreenRendering=new G(this._rctx,this._compositingHelper),this.performanceInfo=new ie(this._rctx),this._shadowMap=new z(this._rctx,d.viewingMode),this._ssaoHelper=new $(t,this._rctx,h),this._highlight=new F(t,this._rctx),this._shadowHighlight=new X(this._rctx,d.viewingMode),this._shadowAccumulator=new Y(this._rctx,t,d,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t),this._renderShadowCascades(w.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),h),this._renderContext=new V(this._rctx,this._offscreenRendering,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new k({renderContext:this._renderContext,techniqueRepository:t,textureRepository:r,materialRepository:this._materialRepository,requestRender:h,controller:d}),this.renderPassManager=new O(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([c((()=>this._stage.state.camera),(()=>h()),p),c((()=>S.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(te.TRANSPARENT):()=>{},h()}),m),c((()=>this._ssaoEnabled||this.isFeatureEnabled(B.SSAO)),(e=>this._ssaoHelper.enabled=e),p)])}normalizeCtorArgs(){return{}}destroy(){this._handles.destroy(),this._smaaPass.dispose(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.dispose(),this._ssaoHelper.dispose(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),L.prune()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||h(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return d(this._edgeView)&&(this._edgeView=new re({rctx:this._rctx,renderSR:this._stage.renderSR,viewingMode:this._stage.viewingMode,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.immediate.schedule(e)}),this._handles.add(c((()=>o(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),g)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return T(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.screenSpaceReflectionsEnabled&&t.ssr.enabled!==e.screenSpaceReflectionsEnabled&&(t.ssr.enabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),h(e.environment)){h(e.environment.weather)&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible),void 0!==e.environment.lighting.ambientOcclusionEnabled&&this._ssaoEnabled!==e.environment.lighting.ambientOcclusionEnabled&&(this._ssaoEnabled=e.environment.lighting.ambientOcclusionEnabled,this._requestRender()),void 0!==e.environment.lighting.waterReflectionEnabled&&this._waterReflectionEnabled!==e.environment.lighting.waterReflectionEnabled&&(this._waterReflectionEnabled=e.environment.lighting.waterReflectionEnabled,this._requestRender());const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasingEnabled!==e.antialiasingEnabled&&(this._antialiasingEnabled=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.renderOverlay&&this._renderOverlay!==e.renderOverlay&&(this._renderOverlay=e.renderOverlay,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=l(e.slicePlane),this._requestRender()),void 0!==e.terrainRenderingEnabled&&this._terrainRenderingEnabled!==e.terrainRenderingEnabled&&(this._terrainRenderingEnabled=e.terrainRenderingEnabled,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:n}=e;if(0===t.length&&0===s.length&&0===n.length)return;const i=q(e);let a=!1;i.forEach(((t,s)=>{if(r.done)return;let n=this._materialRenderers.find((e=>e.material===s));d(n)&&t.adds.length>0&&(n=new se(this._rctx,this._materialRepository,s),this._materialRenderers.push(n)),n&&(n.modify(t),n.isEmpty&&(a=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),a&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._hasHighlights=this._materialRenderers.some((e=>e.hasHighlights)),this._bindParameters.hasOccludees=this._materialRenderers.some((e=>e.hasOccludees)),this._hasWater=this._materialRenderers.some((e=>e.hasWater)),this._hasHUDElements=this._materialRenderers.some((e=>e.requiresSlot(Q.LINE_CALLOUTS_HUD_DEPTH,w.Color)||e.requiresSlot(Q.HUD_MATERIAL,w.Color)||e.requiresSlot(Q.LABEL_MATERIAL,w.Color))),this._requestRender()}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}render(e,r,t,s,n){this._isRendering=!0,this.performanceInfo.startFrame();const{camera:i,contentCamera:a,mode:o}=t;this._state=o,this._renderOverlay(n),this.performanceInfo.advance(ae.OVERLAY),this._renderContext.time=n,this._bindParameters.transparencyPassType=ee.NONE;const l=this._offscreenRendering;l.setupRenderTarget(this.hasWaterReflection);const _=P(this._sliceHelper.plane);s===x.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),i.setGLViewport(this._rctx),this._prepare(i,a),this._renderPlugins.prepareRender(),this.performanceInfo.advance(ae.PREPARE);const c=this._computeDepthRange(i);this._renderShadowMap(e,i,this._bindParameters.lighting.mainLight.direction,c),this.performanceInfo.advance(ae.SHADOW_MAP),l.initializeFrame(i),this._ensureBindParameters(i,a),this._renderLinearDepth(),this.performanceInfo.advance(ae.LINEAR_DEPTH),this._accumulateShadows(c,i,a),this.performanceInfo.advance(ae.ACCUMULATED_SHADOWS),this._renderNormal(),this.performanceInfo.advance(ae.NORMALS),this._ensureBindParametersSSR(),this._renderSSAO(),this.performanceInfo.advance(ae.SSAO),this._renderContext.output=w.Color,l.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(ae.OPAQUE);const p=this._terrainRenderingEnabled&&(this._terrainTransparency===y.Semitransparent||this._terrainTransparency===y.TransparentWithDraped),m=this._highQualityTransparency&&p;this._renderTerrainLinearDepth(m),this._setMultipassEnabled(m),this._setTerrainCulling(m),this._renderEdges(te.OPAQUE),this.performanceInfo.advance(ae.OPAQUE_EDGES),this._offscreenRendering.bindTarget(this._offscreenRendering.currentColorTarget,this._offscreenRendering.mainDepth),this._renderSlot(Q.VOXEL),this.performanceInfo.advance(ae.VOXEL),this._renderHiddenTransparentEdges();const g=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;g&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ae.TRANSPARENT),this._renderGeometryLinearDepth(m);const u=this._renderHUDVisibility(m);m||this._renderInternalSlot(Q.LINE_CALLOUTS),this.performanceInfo.advance(ae.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(ae.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(te.TRANSPARENT,m),this.performanceInfo.advance(ae.TRANSPARENT_EDGES),this._renderTransparentTerrain(),p&&u&&(m?this._renderLineCallouts(C.Occluded):l.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(C.Occluded,l.framebuffer),this.performanceInfo.advance(ae.HUD_OCCLUDED)),this.performanceInfo.advance(ae.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),p&&(l.compositeTransparentTerrainOntoMain(this._bindParameters),m&&(this._renderEdges(te.OPAQUE),this.performanceInfo.advance(ae.OPAQUE_EDGES),g&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(ae.TRANSPARENT),this._renderEdges(te.TRANSPARENT),this.performanceInfo.advance(ae.TRANSPARENT_EDGES))),m&&this._renderLineCallouts(C.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),l.renderToTargets((()=>{this._renderInternalSlot(Q.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(Q.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(Q.LASERLINES)}),l.currentColorTarget,l.mainDepth),this.performanceInfo.advance(ae.ENVIRONMENT),this._renderPlugins.needsLaserlineWithContrastControl&&l.renderTmpAndCompositeToMain((()=>this._renderSlot(Q.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,ne.PremultipliedAlpha),this.performanceInfo.advance(ae.LASER_LINE),this._renderOccluded(),this.performanceInfo.advance(ae.OCCLUDED);const f=s===x.ON&&this._magnifierHelper.enabled,T=f&&d(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(T);const R=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(R)&&h(R)&&this._compositingHelper.composite(this._bindParameters,R,ne.None),this.performanceInfo.advance(ae.ANTIALIASING),this._renderHUD(C.NotOccluded,T),this.performanceInfo.advance(ae.HUD),this._renderHighlights(T,this._bindParameters),this.performanceInfo.advance(ae.HIGHLIGHTS),f&&this._magnifierHelper.render(this._rctx,this._bindParameters),T!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.tmpColorTexture,ne.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=_,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.finishFrame()}_renderObjectAndLayerIdColor(e){h(e)&&has("enable-feature:objectAndLayerId-rendering")&&(this._rctx.bindFramebuffer(e),this._offscreenRendering.renderToFBO((()=>this._renderGeometryAndTransparentTerrainPass(w.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e),this._offscreenRendering.renderToFBO((()=>{this._bindParameters.renderTransparentlyOccludedHUD=C.NotOccluded,this._renderInternalSlot(Q.HUD_MATERIAL)}),void 0,!0,!0))}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===I.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),n=Math.max(e,s);this._animationTimestep.frame(n,t)}}readDepthPixels(e,r,t){const s=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=de.COLOR_BUFFER_BIT|de.DEPTH_BUFFER_BIT|de.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(w.Depth)}s.readPixels(r[0],r[1],r[2],r[3],oe.RGBA,le.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,n){this._offscreenRendering.bindTarget(this._offscreenRendering.hudVisibility).readPixels(e,r,t,s,oe.RGBA,le.UNSIGNED_BYTE,n)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;h(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,ne.Alpha,r)}_renderShadowMap(e,r,t,s){const n=this._shadowMap;n.enabled&&this.isFeatureEnabled(B.ShadowMapUpdate)&&(n.start(r,t,s),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(w.ShadowHighlight,this._shadowMap,(e=>n.takeCascadeSnapshotTo(e,J.Highlight))),n.clear(),this._renderShadowCascades(w.ShadowExcludeHighlight,this._shadowMap,(e=>{n.takeCascadeSnapshotTo(e,J.Default),this._renderGeometryAndTransparentTerrainPass(w.ShadowHighlight)}))):this._renderShadowCascades(w.Shadow),n.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.cascades)s.camera.setGLViewport(this._rctx),this._prepare(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this.hasWaterReflection||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(w.Depth)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=w.Depth,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(w.Depth)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this._needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(w.Normal)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return M;const r=N(e,this._materialRenderers,this._stage.layers);return v(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderSSAO(){this._ssaoHelper.computeSSAO(this._bindParameters,this._offscreenRendering.linearDepthTexture,this._offscreenRendering.normalTexture)}_renderOpaqueGeometry(){this._renderSlot(Q.INTEGRATED_MESH),this._renderSlot(Q.OPAQUE_TERRAIN),this._renderInternalSlot(Q.OPAQUE_MATERIAL),this._renderSlot(Q.OPAQUE_MATERIAL),this._renderSlot(Q.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(Q.TRANSPARENT_MATERIAL),this._renderSlot(Q.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(Q.TRANSPARENT_TERRAIN)}_renderHUDVisibility(e){let r=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,r=this._renderInternalSlot(Q.OCCLUSION_PIXELS)}),e),r}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===C.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(Q.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(Q.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreenRendering.hudColorTexture,ne.PremultipliedAlpha)):e===C.Occluded?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(C.Occluded)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(Q.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(Q.HUD_MATERIAL),this._renderInternalSlot(Q.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlight,s=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(w.Highlight),this._rctx.clearSafe(de.DEPTH_BUFFER_BIT),this._renderHUDElements(C.Both)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&h(this._offscreenRendering.linearDepthTexture)&&this._shadowAccumulator.renderAccumulation(this._offscreenRendering.linearDepthTexture,e,r,t)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._bindParameters.transparencyPassType=t,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.output;this._renderContext.output=w.Alpha,t(ee.Alpha),this._renderContext.output=w.Color,t(ee.Color),t(ee.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(this._bindParameters,r),this._bindParameters.transparencyPassType=ee.NONE,this._renderContext.output=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forAll((({material:r})=>{r&&r.isVisible()&&r.renderOccluded===j.OccludeAndTransparentStencil&&(e|=r.renderOccluded,me.push(r))}));const r=this._offscreenRendering,t=(t,s,n,i,a)=>{0!=(e&s)&&(r.renderToTargets(n,r.tmpColor,r.mainDepth,[0,0,0,0],i,a),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==me.length&&(this._renderInternalSlot(Q.OCCLUDER_MATERIAL,me),t(.5,j.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(Q.TRANSPARENT_OCCLUDER_MATERIAL,me)),!1,!1),me.length=0),this._materialRenderers.forAll((({material:r})=>{r&&r.isVisible()&&(r.renderOccluded===j.OccludeAndTransparent||r.renderOccluded===j.Transparent||r.renderOccluded===j.Opaque)&&(e|=r.renderOccluded,pe.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,s>j.Occlude&&this._renderSlot(Q.OCCLUDED_TERRAIN),this._renderInternalSlot(Q.OPAQUE_MATERIAL,pe),this._renderInternalSlot(Q.TRANSPARENT_MATERIAL,pe),this._renderInternalSlot(Q.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,pe),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=w.Color,t(.5,j.OccludeAndTransparent,(()=>n(j.OccludeAndTransparent)),!0,H.OutlineVisualElementMask),t(.5,j.Transparent,(()=>n(j.Transparent)),!0,H.OutlineVisualElementMask),t(1,j.Opaque,(()=>n(j.Opaque)),!0,H.OutlineVisualElementMask),pe.length=0}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&h(e))return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.requiresSlot(Q.TRANSPARENT_MATERIAL,w.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=E:(R(ue,this._bindParameters.camera.viewMatrix),R(ge,this._bindParameters.camera.projectionMatrix),b(fe,ue,ge),b(fe,this._renderContext.lastFrameCamera.viewMatrix,fe),b(fe,this._renderContext.lastFrameCamera.projectionMatrix,fe),this._reprojectionMatrix=fe),this._bindParameters.ssr.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._bindParameters.ssr.lastFrameColorTexture=null,this._bindParameters.ssr.enabled=this.hasWaterReflection}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,h(r)?r.forEach((e=>{if(!e.shouldRender(this._renderContext))return;const r=this._materialRenderers.find((r=>r.material===e));h(r)&&(t=r.render(this._renderContext.output,this._bindParameters)||t)})):this._materialRenderers.forAll((e=>{e.material.shouldRender(this._renderContext)&&e.render(this._renderContext.output,this._bindParameters)&&(t=!0)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=U(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreenRendering?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,getFramebufferTexture:r=>{switch(r){case ce.Color:return e._offscreenRendering.colorTexture;case ce.LinearDepth:return e._offscreenRendering.linearDepthTexture;case ce.Normals:return e._offscreenRendering.normalTexture;case ce.ShadowMap:return e._shadowMap.depthTexture;case ce.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case ce.Highlight:return e._offscreenRendering.highlightTexture}}}}};var ce;e([u()],_e.prototype,"_shadowAccumulator",void 0),e([u()],_e.prototype,"_state",void 0),e([u({readOnly:!0})],_e.prototype,"_renderStateFeatures",void 0),e([u()],_e.prototype,"_antialiasingEnabled",void 0),e([u({readOnly:!0})],_e.prototype,"_antialiasing",null),e([u()],_e.prototype,"_ssaoEnabled",void 0),e([u()],_e.prototype,"_smaaPass",void 0),e([u({autoDestroy:!0})],_e.prototype,"_edgeView",void 0),e([u()],_e.prototype,"updating",null),e([u()],_e.prototype,"isCameraFinal",null),_e=e([f("esri.views.3d.webgl-engine.lib.Renderer")],_e),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(ce||(ce={}));const pe=[],me=[],ge=A(),ue=A(),fe=A();export{ce as FramebufferId,_e 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as t}from"../../../../core/compilerUtils.js";import e from"../../../../core/Error.js";import r from"../../../../core/Evented.js";import{isPowerOfTwo as i,nextHighestPowerOfTwo as s}from"../../../../core/mathUtils.js";import{isNone as a,isSome as o,removeMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as m,onAbort as h,createAbortError as l}from"../../../../core/promiseUtils.js";import{isArrayBuffer as p,isUint8Array as d}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as _,isDataProtocol as c}from"../../../../core/urlUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as T}from"../../../../support/requestUtils.js";import{T as g}from"../../../../chunks/TextureOnly.glsl.js";import{PowerOfTwoResizeMode as f}from"./basicInterfaces.js";import{estimateMemoryKTX2 as w,estimateMemoryBasis as E,createTextureKTX2 as A,createTextureBasis as x}from"./BasisUtil.js";import{ContentObject as D}from"./ContentObject.js";import{ContentObjectType as I}from"./ContentObjectType.js";import{createDDSTexture as M}from"./DDSUtil.js";import{createQuadVAO as y}from"./glUtil3D.js";import{assert as F}from"./Util.js";import{TextureWrapMode as O,TextureType as N,PixelFormat as R,PixelType as U,TextureSamplingMode as b,TargetType as C,DepthStencilTargetType as P,PrimitiveType as S}from"../../../webgl/enums.js";import{FramebufferObject as H}from"../../../webgl/FramebufferObject.js";import{Texture as v}from"../../../webgl/Texture.js";import{vertexCount as V}from"../../../webgl/Util.js";import j from"../../../webgl/capabilities/isWebGL2Context.js";class L extends D{constructor(t,e){super(),this._data=t,this.type=I.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new r,this._passParameters=new g,this.params=e||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:O.REPEAT,t:O.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||f.STRETCH,this.estimatedTexMemRequired=L._estimateTexMemRequired(this._data,this.params),this._startPreload()}_startPreload(){const t=this._data;a(t)||(t instanceof HTMLVideoElement?this._startPreloadVideoElement(t):t instanceof HTMLImageElement&&this._startPreloadImageElement(t))}_startPreloadVideoElement(t){if(!(_(t.src)||"auto"===t.preload&&t.crossOrigin)){t.preload="auto",t.crossOrigin="anonymous";const e=!t.paused;if(t.src=t.src,e&&t.autoplay){const e=()=>{t.removeEventListener("canplay",e),t.play()};t.addEventListener("canplay",e)}}}_startPreloadImageElement(t){c(t.src)||_(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}static _getDataDimensions(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}static _estimateTexMemRequired(t,e){if(a(t))return 0;if(p(t)||d(t))return e.encoding===L.KTX2_ENCODING?w(t,!!e.mipmap):e.encoding===L.BASIS_ENCODING?E(t,!!e.mipmap):t.byteLength;const{width:r,height:i}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?L._getDataDimensions(t):e;return(e.mipmap?4/3:1)*r*i*(e.components||4)||0}dispose(){this._data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(t){return{target:N.TEXTURE_2D,pixelFormat:R.RGBA,dataType:U.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?b.LINEAR_MIPMAP_LINEAR:b.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:this.params.maxAnisotropy??(this.params.mipmap?t.parameters.maxMaxAnisotropy:1)}}get glTexture(){return this._glTexture}load(t,e){if(o(this._glTexture))return this._glTexture;if(o(this._loadingPromise))return this._loadingPromise;const r=this._data;return a(r)?(this._glTexture=new v(t,this._createDescriptor(t),null),this._glTexture):"string"==typeof r?this._loadFromURL(t,e,r):r instanceof Image?this._loadFromImageElement(t,e,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(t,e,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(t,r,e):(p(r)||d(r))&&this.params.encoding===L.DDS_ENCODING?(this._data=void 0,this._loadFromDDSData(t,r)):(p(r)||d(r))&&this.params.encoding===L.KTX2_ENCODING?(this._data=void 0,this._loadFromKTX2(t,r)):(p(r)||d(r))&&this.params.encoding===L.BASIS_ENCODING?(this._data=void 0,this._loadFromBasis(t,r)):d(r)?this._loadFromPixelData(t,r):p(r)?this._loadFromPixelData(t,new Uint8Array(r)):null}get requiresFrameUpdates(){return this._data instanceof HTMLVideoElement}frameUpdate(t,e,r){if(!(this._data instanceof HTMLVideoElement)||a(this._glTexture))return r;if(this._data.readyState<G.HAVE_CURRENT_DATA||r===this._data.currentTime)return r;if(o(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:s}=this._powerOfTwoStretchInfo;s.setData(this._data),this._drawStretchedTexture(t,e,r,i,s,this._glTexture)}else{const{videoWidth:t,videoHeight:e}=this._data,{width:r,height:i}=this._glTexture.descriptor;t!==r||e!==i?this._glTexture.updateData(0,0,0,Math.min(t,r),Math.min(e,i),this._data):this._glTexture.setData(this._data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.params.updateCallback&&this.params.updateCallback(),this._data.currentTime}_loadFromDDSData(t,e){return this._glTexture=M(t,this._createDescriptor(t),e),this._glTexture}_loadFromKTX2(t,e){return this._loadAsync((()=>A(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromBasis(t,e){return this._loadAsync((()=>x(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromPixelData(t,e){F(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(t);return r.pixelFormat=1===this.params.components?R.LUMINANCE:3===this.params.components?R.RGB:R.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new v(t,r,e),this._glTexture}_loadFromURL(t,e,r){return this._loadAsync((async i=>{const s=await u(r,{signal:i});return m(i),this._loadFromImage(t,s,e)}))}_loadFromImageElement(t,e,r){return r.complete?this._loadFromImage(t,r,e):this._loadAsync((async i=>{const s=await T(r,r.src,!1,i);return m(i),this._loadFromImage(t,s,e)}))}_loadFromVideoElement(t,e,r){return r.readyState>=G.HAVE_CURRENT_DATA?this._loadFromImage(t,r,e):this._loadFromVideoElementAsync(t,e,r)}_loadFromVideoElementAsync(t,r,i){return this._loadAsync((s=>new Promise(((a,o)=>{const m=()=>{i.removeEventListener("loadeddata",p),i.removeEventListener("error",d),n(_)},p=()=>{i.readyState>=G.HAVE_CURRENT_DATA&&(m(),a(this._loadFromImage(t,i,r)))},d=t=>{m(),o(t||new e("Failed to load video"))};i.addEventListener("loadeddata",p),i.addEventListener("error",d);const _=h(s,(()=>d(l())))}))))}_loadFromImage(t,e,r){const s=L._getDataDimensions(e);this.params.width=s.width,this.params.height=s.height;const a=this._createDescriptor(t);return a.pixelFormat=3===this.params.components?R.RGB:R.RGBA,!this._requiresPowerOfTwo(t,a)||i(s.width)&&i(s.height)?(a.width=s.width,a.height=s.height,this._glTexture=new v(t,a,e),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(t,e,s,a,r),this._glTexture)}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const i=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}_requiresPowerOfTwo(t,e){const r=O.CLAMP_TO_EDGE,i="number"==typeof e.wrapMode?e.wrapMode===r:e.wrapMode.s===r&&e.wrapMode.t===r;return!j(t.gl)&&(e.hasMipmap||!i)}_makePowerOfTwoTexture(e,r,i,a,o){const{width:n,height:m}=i,h=s(n),l=s(m);let p;switch(a.width=h,a.height=l,this.params.powerOfTwoResizeMode){case f.PAD:a.textureCoordinateScaleFactor=[n/h,m/l],p=new v(e,a),p.updateData(0,0,0,n,m,r);break;case f.STRETCH:case null:case void 0:p=this._stretchToPowerOfTwo(e,r,a,o());break;default:t(this.params.powerOfTwoResizeMode)}return a.hasMipmap&&p.generateMipmap(),p}_stretchToPowerOfTwo(t,e,r,i){const s=new v(t,r),a=new H(t,{colorTarget:C.TEXTURE,depthStencilTarget:P.NONE},s),o=new v(t,{target:N.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:U.UNSIGNED_BYTE,wrapMode:O.CLAMP_TO_EDGE,samplingMode:b.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},e),n=y(t),m=t.getBoundFramebufferObject();return this._drawStretchedTexture(t,i,a,n,o,s),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:n,sourceTexture:o,framebuffer:a}:(n.dispose(!0),o.dispose(),a.detachColorTexture(),a.dispose()),t.bindFramebuffer(m),s}_drawStretchedTexture(t,e,r,i,s,a){this._passParameters.texture=s,t.bindFramebuffer(r);const o=t.getViewport();t.setViewport(0,0,a.descriptor.width,a.descriptor.height),t.bindTechnique(e,this._passParameters,null),t.bindVAO(i),t.drawArrays(S.TRIANGLE_STRIP,0,V(i,"geometry")),t.bindFramebuffer(null),t.setViewport(o.x,o.y,o.width,o.height),this._passParameters.texture=null}unload(){if(o(this._powerOfTwoStretchInfo)){const{framebuffer:t,vao:e,sourceTexture:r}=this._powerOfTwoStretchInfo;e.dispose(!0),r.dispose(),t.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if(o(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),o(this._loadingController)){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}}var G;L.DDS_ENCODING="image/vnd-ms.dds",L.KTX2_ENCODING="image/ktx2",L.BASIS_ENCODING="image/x.basis",function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(G||(G={}));export{L as Texture};
5
+ import{neverReached as t}from"../../../../core/compilerUtils.js";import e from"../../../../core/Error.js";import r from"../../../../core/Evented.js";import{isPowerOfTwo as s,nextHighestPowerOfTwo as i}from"../../../../core/mathUtils.js";import{isNone as a,isSome as o,removeMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as h,onAbort as l,createAbortError as m}from"../../../../core/promiseUtils.js";import{isArrayBuffer as p,isUint8Array as d}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as _,isDataProtocol as c}from"../../../../core/urlUtils.js";import{requestImage as u}from"../../../../support/requestImageUtils.js";import{loadImageAsync as T}from"../../../../support/requestUtils.js";import{T as g}from"../../../../chunks/TextureOnly.glsl.js";import{PowerOfTwoResizeMode as f,TextureEncodingMimeType as w}from"./basicInterfaces.js";import{estimateMemoryKTX2 as E,estimateMemoryBasis as A,createTextureKTX2 as x,createTextureBasis as D}from"./BasisUtil.js";import{ContentObject as M}from"./ContentObject.js";import{ContentObjectType as y}from"./ContentObjectType.js";import{createDDSTexture as I}from"./DDSUtil.js";import{createQuadVAO as F}from"./glUtil3D.js";import{assert as O}from"./Util.js";import{ContextType as R}from"../../../webgl/context-util.js";import{TextureWrapMode as U,TextureType as P,PixelFormat as N,PixelType as b,TextureSamplingMode as C,TargetType as H,DepthStencilTargetType as V,PrimitiveType as v}from"../../../webgl/enums.js";import{FramebufferObject as S}from"../../../webgl/FramebufferObject.js";import{Texture as j}from"../../../webgl/Texture.js";import{vertexCount as L}from"../../../webgl/Util.js";class G extends M{constructor(t,e){super(),this._data=t,this.type=y.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new r,this._passParameters=new g,this.params=e||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:U.REPEAT,t:U.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||f.STRETCH,this.estimatedTexMemRequired=G._estimateTexMemRequired(this._data,this.params),this._startPreload()}_startPreload(){const t=this._data;a(t)||(t instanceof HTMLVideoElement?this._startPreloadVideoElement(t):t instanceof HTMLImageElement&&this._startPreloadImageElement(t))}_startPreloadVideoElement(t){if(!(_(t.src)||"auto"===t.preload&&t.crossOrigin)){t.preload="auto",t.crossOrigin="anonymous";const e=!t.paused;if(t.src=t.src,e&&t.autoplay){const e=()=>{t.removeEventListener("canplay",e),t.play()};t.addEventListener("canplay",e)}}}_startPreloadImageElement(t){c(t.src)||_(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}static _getDataDimensions(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}static _estimateTexMemRequired(t,e){if(a(t))return 0;if(p(t)||d(t))return e.encoding===w.KTX2_ENCODING?E(t,!!e.mipmap):e.encoding===w.BASIS_ENCODING?A(t,!!e.mipmap):t.byteLength;const{width:r,height:s}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?G._getDataDimensions(t):e;return(e.mipmap?4/3:1)*r*s*(e.components||4)||0}dispose(){this._data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(t){return{target:P.TEXTURE_2D,pixelFormat:N.RGBA,dataType:b.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?C.LINEAR_MIPMAP_LINEAR:C.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:this.params.maxAnisotropy??(this.params.mipmap?t.parameters.maxMaxAnisotropy:1)}}get glTexture(){return this._glTexture}load(t,e){if(o(this._glTexture))return this._glTexture;if(o(this._loadingPromise))return this._loadingPromise;const r=this._data;return a(r)?(this._glTexture=new j(t,this._createDescriptor(t),null),this._glTexture):"string"==typeof r?this._loadFromURL(t,e,r):r instanceof Image?this._loadFromImageElement(t,e,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(t,e,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(t,r,e):(p(r)||d(r))&&this.params.encoding===w.DDS_ENCODING?(this._data=void 0,this._loadFromDDSData(t,r)):(p(r)||d(r))&&this.params.encoding===w.KTX2_ENCODING?(this._data=void 0,this._loadFromKTX2(t,r)):(p(r)||d(r))&&this.params.encoding===w.BASIS_ENCODING?(this._data=void 0,this._loadFromBasis(t,r)):d(r)?this._loadFromPixelData(t,r):p(r)?this._loadFromPixelData(t,new Uint8Array(r)):null}get requiresFrameUpdates(){return this._data instanceof HTMLVideoElement}frameUpdate(t,e,r){if(!(this._data instanceof HTMLVideoElement)||a(this._glTexture))return r;if(this._data.readyState<B.HAVE_CURRENT_DATA||r===this._data.currentTime)return r;if(o(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:s,sourceTexture:i}=this._powerOfTwoStretchInfo;i.setData(this._data),this._drawStretchedTexture(t,e,r,s,i,this._glTexture)}else{const{videoWidth:t,videoHeight:e}=this._data,{width:r,height:s}=this._glTexture.descriptor;t!==r||e!==s?this._glTexture.updateData(0,0,0,Math.min(t,r),Math.min(e,s),this._data):this._glTexture.setData(this._data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.params.updateCallback&&this.params.updateCallback(),this._data.currentTime}_loadFromDDSData(t,e){return this._glTexture=I(t,this._createDescriptor(t),e),this._glTexture}_loadFromKTX2(t,e){return this._loadAsync((()=>x(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromBasis(t,e){return this._loadAsync((()=>D(t,this._createDescriptor(t),e).then((t=>(this._glTexture=t,t)))))}_loadFromPixelData(t,e){O(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(t);return r.pixelFormat=1===this.params.components?N.LUMINANCE:3===this.params.components?N.RGB:N.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new j(t,r,e),this._glTexture}_loadFromURL(t,e,r){return this._loadAsync((async s=>{const i=await u(r,{signal:s});return h(s),this._loadFromImage(t,i,e)}))}_loadFromImageElement(t,e,r){return r.complete?this._loadFromImage(t,r,e):this._loadAsync((async s=>{const i=await T(r,r.src,!1,s);return h(s),this._loadFromImage(t,i,e)}))}_loadFromVideoElement(t,e,r){return r.readyState>=B.HAVE_CURRENT_DATA?this._loadFromImage(t,r,e):this._loadFromVideoElementAsync(t,e,r)}_loadFromVideoElementAsync(t,r,s){return this._loadAsync((i=>new Promise(((a,o)=>{const h=()=>{s.removeEventListener("loadeddata",p),s.removeEventListener("error",d),n(_)},p=()=>{s.readyState>=B.HAVE_CURRENT_DATA&&(h(),a(this._loadFromImage(t,s,r)))},d=t=>{h(),o(t||new e("Failed to load video"))};s.addEventListener("loadeddata",p),s.addEventListener("error",d);const _=l(i,(()=>d(m())))}))))}_loadFromImage(t,e,r){const i=G._getDataDimensions(e);this.params.width=i.width,this.params.height=i.height;const a=this._createDescriptor(t);return a.pixelFormat=3===this.params.components?N.RGB:N.RGBA,!this._requiresPowerOfTwo(t,a)||s(i.width)&&s(i.height)?(a.width=i.width,a.height=i.height,this._glTexture=new j(t,a,e),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(t,e,i,a,r),this._glTexture)}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const s=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(s,s),r}_requiresPowerOfTwo(t,e){const r=U.CLAMP_TO_EDGE,s="number"==typeof e.wrapMode?e.wrapMode===r:e.wrapMode.s===r&&e.wrapMode.t===r;return t.type===R.WEBGL1&&(e.hasMipmap||!s)}_makePowerOfTwoTexture(e,r,s,a,o){const{width:n,height:h}=s,l=i(n),m=i(h);let p;switch(a.width=l,a.height=m,this.params.powerOfTwoResizeMode){case f.PAD:a.textureCoordinateScaleFactor=[n/l,h/m],p=new j(e,a),p.updateData(0,0,0,n,h,r);break;case f.STRETCH:case null:case void 0:p=this._stretchToPowerOfTwo(e,r,a,o());break;default:t(this.params.powerOfTwoResizeMode)}return a.hasMipmap&&p.generateMipmap(),p}_stretchToPowerOfTwo(t,e,r,s){const i=new j(t,r),a=new S(t,{colorTarget:H.TEXTURE,depthStencilTarget:V.NONE},i),o=new j(t,{target:P.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:b.UNSIGNED_BYTE,wrapMode:U.CLAMP_TO_EDGE,samplingMode:C.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},e),n=F(t),h=t.getBoundFramebufferObject();return this._drawStretchedTexture(t,s,a,n,o,i),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:n,sourceTexture:o,framebuffer:a}:(n.dispose(!0),o.dispose(),a.detachColorTexture(),a.dispose()),t.bindFramebuffer(h),i}_drawStretchedTexture(t,e,r,s,i,a){this._passParameters.texture=i,t.bindFramebuffer(r);const o=t.getViewport();t.setViewport(0,0,a.descriptor.width,a.descriptor.height),t.bindTechnique(e,this._passParameters,null),t.bindVAO(s),t.drawArrays(v.TRIANGLE_STRIP,0,L(s,"geometry")),t.bindFramebuffer(null),t.setViewport(o.x,o.y,o.width,o.height),this._passParameters.texture=null}unload(){if(o(this._powerOfTwoStretchInfo)){const{framebuffer:t,vao:e,sourceTexture:r}=this._powerOfTwoStretchInfo;e.dispose(!0),r.dispose(),t.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if(o(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),o(this._loadingController)){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}}var B;!function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(B||(B={}));export{G 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.26/esri/copyright.txt for details.
4
4
  */
5
- var n,e,N,O,t,u,a,C,D,c,i;!function(n){n[n.None=0]="None",n[n.Front=1]="Front",n[n.Back=2]="Back",n[n.COUNT=3]="COUNT"}(n||(n={})),function(n){n[n.Less=0]="Less",n[n.Lequal=1]="Lequal",n[n.COUNT=2]="COUNT"}(e||(e={})),function(n){n[n.BACKGROUND=0]="BACKGROUND",n[n.UPDATE=1]="UPDATE"}(N||(N={})),function(n){n[n.NOT_LOADED=0]="NOT_LOADED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED"}(O||(O={})),function(n){n[n.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",n[n.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(t||(t={})),function(n){n[n.ASYNC=0]="ASYNC",n[n.SYNC=1]="SYNC"}(u||(u={})),function(n){n[n.Highlight=0]="Highlight",n[n.MaskOccludee=1]="MaskOccludee",n[n.COUNT=2]="COUNT"}(a||(a={})),function(n){n[n.STRETCH=1]="STRETCH",n[n.PAD=2]="PAD"}(C||(C={})),function(n){n[n.CHANGED=0]="CHANGED",n[n.UNCHANGED=1]="UNCHANGED"}(D||(D={})),function(n){n[n.Blend=0]="Blend",n[n.Opaque=1]="Opaque",n[n.Mask=2]="Mask",n[n.MaskBlend=3]="MaskBlend",n[n.COUNT=4]="COUNT"}(c||(c={})),function(n){n[n.OFF=0]="OFF",n[n.ON=1]="ON"}(i||(i={}));export{c as AlphaDiscardMode,n as CullFaceOptions,i as Decorations,e as DepthTestFunction,a as Object3DState,C as PowerOfTwoResizeMode,N as RenderRequestType,O as ResourceState,t as StencilBits,u as UpdatePolicy,D as ValidationState};
5
+ var n,e,N,O,t,a,D,i,u,C,s,c;!function(n){n[n.None=0]="None",n[n.Front=1]="Front",n[n.Back=2]="Back",n[n.COUNT=3]="COUNT"}(n||(n={})),function(n){n[n.Less=0]="Less",n[n.Lequal=1]="Lequal",n[n.COUNT=2]="COUNT"}(e||(e={})),function(n){n[n.BACKGROUND=0]="BACKGROUND",n[n.UPDATE=1]="UPDATE"}(N||(N={})),function(n){n[n.NOT_LOADED=0]="NOT_LOADED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED"}(O||(O={})),function(n){n[n.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",n[n.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(t||(t={})),function(n){n[n.ASYNC=0]="ASYNC",n[n.SYNC=1]="SYNC"}(a||(a={})),function(n){n[n.Highlight=0]="Highlight",n[n.MaskOccludee=1]="MaskOccludee",n[n.COUNT=2]="COUNT"}(D||(D={})),function(n){n[n.STRETCH=1]="STRETCH",n[n.PAD=2]="PAD"}(i||(i={})),function(n){n[n.CHANGED=0]="CHANGED",n[n.UNCHANGED=1]="UNCHANGED"}(u||(u={})),function(n){n[n.Blend=0]="Blend",n[n.Opaque=1]="Opaque",n[n.Mask=2]="Mask",n[n.MaskBlend=3]="MaskBlend",n[n.COUNT=4]="COUNT"}(C||(C={})),function(n){n[n.OFF=0]="OFF",n[n.ON=1]="ON"}(s||(s={})),function(n){n.DDS_ENCODING="image/vnd-ms.dds",n.KTX2_ENCODING="image/ktx2",n.BASIS_ENCODING="image/x.basis"}(c||(c={}));export{C as AlphaDiscardMode,n as CullFaceOptions,s as Decorations,e as DepthTestFunction,D as Object3DState,i as PowerOfTwoResizeMode,N as RenderRequestType,O as ResourceState,t as StencilBits,c as TextureEncodingMimeType,a as UpdatePolicy,u as ValidationState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{isSome as r,isNone as a,destroyMaybe as s}from"../../../../../core/maybe.js";import{isAborted as n,throwIfAborted as i}from"../../../../../core/promiseUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as l}from"../../../../../chunks/mat4f64.js";import{b as h,e as d,m as u}from"../../../../../chunks/vec3.js";import{c as m}from"../../../../../chunks/vec3f64.js";import{c as p,f as _}from"../../../../../chunks/vec4f64.js";import f from"../../../support/debugFlags.js";import{glLayout as g}from"../../../support/buffer/glUtil.js";import{newLayout as I}from"../../../support/buffer/InterleavedLayout.js";import{ShaderOutput as y}from"../../core/shaderLibrary/ShaderOutput.js";import{Camera as C}from"../Camera.js";import{Default3D as v}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as E}from"../IntersectorInterfaces.js";import R from"../Octree.js";import{RenderSlot as D}from"../RenderSlot.js";import{assert as b}from"../Util.js";import{VertexAttribute as A}from"../VertexAttribute.js";import{InstanceData as T,StateFlags as L}from"./InstanceData.js";import{InstanceOctree as O}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as j}from"./LodLevel.js";import{RenderInstanceData as x}from"./RenderInstanceData.js";import{colorMixModes as U}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as N}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as F,noBudget as V}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as w,unbindVertexBufferLayout as B}from"../../../../webgl/Util.js";const H=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let q=class extends t{constructor(e,t){super(e),this.type=E.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new C,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[D.OPAQUE_MATERIAL,D.TRANSPARENT_MATERIAL],this.canRender=!0,this._instanceData=new T({shaderTransformation:e.shaderTransformation},e.optionalFields),this._frameTask=t.registerTask(F.LOD_RENDERER,this)}initialize(){this._instanceBufferLayout=k(this.optionalFields),this._glInstanceBufferLayout=g(this._instanceBufferLayout,1),this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))}destroy(){this._frameTask.remove()}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const r=t.memoryUsage;e.cpu+=r.cpu,e.gpu+=r.gpu})),this._highlightRenderInstanceData.forEach((t=>{const r=t.memoryUsage;e.cpu+=r.cpu,e.gpu+=r.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._defaultRenderInstanceData[r],s=this._highlightRenderInstanceData[r],n=a.size+s.size,i=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*i,trianglesPerInstance:i})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,t){this._context=e;const a=e.renderContext.rctx,s=await Promise.allSettled(this.symbol.levels.map((r=>(this._defaultRenderInstanceData.push(new x(a,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new x(a,this._instanceBufferLayout)),j.create(e,r,t))))),o=s.map((e=>"fulfilled"===e.status?e.value:null)).filter(r);if(n(t)||o.length!==s.length){o.forEach((e=>e.destroy())),i(t);for(const e of s)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=H(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(D.TRANSPARENT_MATERIAL,y.Color)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(V),this._needFullCycle=!1)}}render(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return;e.rctx.bindVAO();e.output!==y.Highlight&&e.output!==y.ShadowHighlight&&this._renderComponents(e,this._defaultRenderInstanceData);e.output!==y.ShadowExludeHighlight&&this._renderComponents(e,this._highlightRenderInstanceData)}intersect(e,t,r,s){if(!this.baseMaterial.isVisible()||a(this._octree))return;const n=m();h(n,s,r);const i=a=>{this._instanceData.getCombinedModelTransform(a,K),e.transform.set(K),u(Y,r,e.transform.inverse),u(J,s,e.transform.inverse);const n=this._instanceData.getState(a),i=this._instanceData.getLodLevel(a),o=this._levels.length;b(0!=(n&L.ACTIVE),"invalid instance state"),b(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,Y,J,a,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(i):this._octree.forEachAlongRay(r,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(a(this._octreeCached)){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new O(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&L.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=s(this._octreeCached)}_queryDepthRangeOctree(e){if(a(this._octree))return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,R.DepthOrder.FRONT_TO_BACK,e.frustum),s=this._octree.findClosest(t,R.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==s)return{near:1/0,far:-1/0};const n=e.eye,i=this._instanceData.view;i.boundingSphere.getVec(r,W),h(W,W,n);const o=d(W,t)-W[3];i.boundingSphere.getVec(s,W),h(W,W,n);const c=d(W,t)+W[3];return{near:Math.max(e.near,o),far:Math.min(e.far,c)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>e.startUpdateCycle())),this._highlightRenderInstanceData.forEach((e=>e.startUpdateCycle()))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:a,_levelSelector:s}=this;this._defaultRenderInstanceData.forEach((e=>e.beginUpdate())),this._highlightRenderInstanceData.forEach((e=>e.beginUpdate()));const n=this._instanceData,i=n.view;let o=n.size;const c=n.capacity;let l=this._instanceIndex;for(let h=0;h<o&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=i.state.get(l);let d=0;if(!(h&L.ALLOCATED)){l=l+1===c?0:l+1,o++;continue}const u=i.lodLevel.get(l);if(h&L.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[u].freeTail(),h&L.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[u].freeTail(),h&L.REMOVE)n.freeInstance(l);else if(h&L.VISIBLE){let e=0;t&&(i.modelOrigin.getVec(l,z),e=s.selectLevel(z,n.getCombinedMedianScaleFactor(l),a)),d=h&~(L.ACTIVE|L.TRANSFORM_CHANGED),e>=0&&(h&L.HIGHLIGHT?(P(this._highlightRenderInstanceData[e],i,l),d|=L.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[e],i,l),d|=L.DEFAULT_ACTIVE)),i.state.set(l,d),i.lodLevel.set(l,e)}else d=h&~(L.ACTIVE|L.TRANSFORM_CHANGED),i.state.set(l,d);if(r(this._octreeCached)){const e=!!(h&L.ACTIVE),t=!!(d&L.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&L.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===c?0:l+1,e.madeProgress()}this._instanceIndex=l,this._defaultRenderInstanceData.forEach((e=>e.endUpdate())),this._highlightRenderInstanceData.forEach((e=>e.endUpdate())),this._context.requestRender()}_renderComponents(e,t){this.levels.forEach(((r,a)=>{const s=r.components.map((r=>this._beginComponent(e,t[a],r)));r.components.forEach(((r,n)=>this._renderComponent(e,s[n],t[a],r,a)))}))}_beginComponent(e,t,a){const{bindParameters:s,rctx:n,output:i}=e;if(0===t.size||!a.material.requiresSlot(s.slot,e.output))return null;const o=a.glMaterials.load(n,s.slot,i);return r(o)?o.beginSlot(s):null}_renderComponent(e,t,r,s,n){if(a(t))return;const{bindParameters:i,rctx:o}=e,c=o.bindTechnique(t,s.material.parameters,i);o.bindVAO(s.vao),t.ensureAttributeLocations(s.vao),c.bindDraw(Z,i,s.material.parameters),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===y.Color&&(c.setUniform4fv("externalColor",Q[Math.min(n,Q.length-1)]),c.setUniform1i("colorMixMode",U.replace));const l=o.capabilities.instancing,h=r.capacity,d=r.headIndex,u=r.tailIndex,m=r.firstIndex,p=this._glInstanceBufferLayout,_=(e,a)=>{w(o,v,r.buffer,p,e),l.drawArraysInstanced(t.primitiveType,0,s.vertexCount,a-e),B(o,v,r.buffer,p)};s.material.parameters.transparent&&null!=m?d>u?(b(m>=u&&m<=d,"invalid firstIndex"),_(m,d),_(u,m)):d<u&&(m<=d?(b(m>=0&&m<=d,"invalid firstIndex"),_(m,d),_(u,h),_(0,m)):(b(m>=u&&m<=h,"invalid firstIndex"),_(m,h),_(0,d),_(u,m))):d>u?_(u,d):d<u&&(_(0,d),_(u,h)),o.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){N(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function k(e){let t=I().vec3f(A.MODELORIGINHI).vec3f(A.MODELORIGINLO).mat3f(A.MODEL).mat3f(A.MODELNORMAL);return r(e)&&e.includes("color")&&(t=t.vec4f(A.INSTANCECOLOR)),r(e)&&e.includes("featureAttribute")&&(t=t.vec4f(A.INSTANCEFEATUREATTRIBUTE)),r(e)&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(A.OBJECTANDLAYERIDCOLOR_INSTANCED)),t}e([o({constructOnly:!0})],q.prototype,"symbol",void 0),e([o({constructOnly:!0})],q.prototype,"optionalFields",void 0),e([o({constructOnly:!0})],q.prototype,"metadata",void 0),e([o({constructOnly:!0})],q.prototype,"shaderTransformation",void 0),e([o()],q.prototype,"_instanceData",void 0),e([o()],q.prototype,"_cycleStartIndex",void 0),e([o({readOnly:!0})],q.prototype,"_enableLevelSelection",null),e([o()],q.prototype,"_updateCyclesWithStaticCamera",void 0),e([o({readOnly:!0})],q.prototype,"running",null),q=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],q);const z=m(),W=p(),K=l(),Y=m(),J=m(),Q=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],Z=new M;export{q as LodRenderer};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{isSome as r,isNone as a,destroyMaybe as s}from"../../../../../core/maybe.js";import{isAborted as n,throwIfAborted as i}from"../../../../../core/promiseUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as l}from"../../../../../chunks/mat4f64.js";import{b as h,e as d,m as u}from"../../../../../chunks/vec3.js";import{c as m}from"../../../../../chunks/vec3f64.js";import{c as p,f as _}from"../../../../../chunks/vec4f64.js";import f from"../../../support/debugFlags.js";import{glLayout as g}from"../../../support/buffer/glUtil.js";import{newLayout as I}from"../../../support/buffer/InterleavedLayout.js";import{ShaderOutput as y}from"../../core/shaderLibrary/ShaderOutput.js";import{Camera as C}from"../Camera.js";import{Default3D as v}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as E}from"../IntersectorInterfaces.js";import R from"../Octree.js";import{RenderSlot as D}from"../RenderSlot.js";import{assert as b}from"../Util.js";import{VertexAttribute as A}from"../VertexAttribute.js";import{InstanceData as T,StateFlags as L}from"./InstanceData.js";import{InstanceOctree as O}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as j}from"./LodLevel.js";import{RenderInstanceData as x}from"./RenderInstanceData.js";import{colorMixModes as U}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as N}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as F,noBudget as V}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as w,unbindVertexBufferLayout as B}from"../../../../webgl/Util.js";const H=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let q=class extends t{constructor(e,t){super(e),this.type=E.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new C,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[D.OPAQUE_MATERIAL,D.TRANSPARENT_MATERIAL],this.canRender=!0,this._instanceData=new T({shaderTransformation:e.shaderTransformation},e.optionalFields),this._frameTask=t.registerTask(F.LOD_RENDERER,this)}initialize(){this._instanceBufferLayout=k(this.optionalFields),this._glInstanceBufferLayout=g(this._instanceBufferLayout,1),this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))}destroy(){this._frameTask.remove()}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const r=t.memoryUsage;e.cpu+=r.cpu,e.gpu+=r.gpu})),this._highlightRenderInstanceData.forEach((t=>{const r=t.memoryUsage;e.cpu+=r.cpu,e.gpu+=r.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._defaultRenderInstanceData[r],s=this._highlightRenderInstanceData[r],n=a.size+s.size,i=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*i,trianglesPerInstance:i})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,t){this._context=e;const a=e.renderContext.rctx,s=await Promise.allSettled(this.symbol.levels.map((r=>(this._defaultRenderInstanceData.push(new x(a,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new x(a,this._instanceBufferLayout)),j.create(e,r,t))))),o=s.map((e=>"fulfilled"===e.status?e.value:null)).filter(r);if(n(t)||o.length!==s.length){o.forEach((e=>e.destroy())),i(t);for(const e of s)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=H(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(D.TRANSPARENT_MATERIAL,y.Color)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(V),this._needFullCycle=!1)}}render(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return;e.rctx.bindVAO();e.output!==y.Highlight&&e.output!==y.ShadowHighlight&&this._renderComponents(e,this._defaultRenderInstanceData);e.output!==y.ShadowExcludeHighlight&&this._renderComponents(e,this._highlightRenderInstanceData)}intersect(e,t,r,s){if(!this.baseMaterial.isVisible()||a(this._octree))return;const n=m();h(n,s,r);const i=a=>{this._instanceData.getCombinedModelTransform(a,K),e.transform.set(K),u(Y,r,e.transform.inverse),u(J,s,e.transform.inverse);const n=this._instanceData.getState(a),i=this._instanceData.getLodLevel(a),o=this._levels.length;b(0!=(n&L.ACTIVE),"invalid instance state"),b(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,Y,J,a,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(i):this._octree.forEachAlongRay(r,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(a(this._octreeCached)){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new O(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&L.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=s(this._octreeCached)}_queryDepthRangeOctree(e){if(a(this._octree))return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,R.DepthOrder.FRONT_TO_BACK,e.frustum),s=this._octree.findClosest(t,R.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==s)return{near:1/0,far:-1/0};const n=e.eye,i=this._instanceData.view;i.boundingSphere.getVec(r,W),h(W,W,n);const o=d(W,t)-W[3];i.boundingSphere.getVec(s,W),h(W,W,n);const c=d(W,t)+W[3];return{near:Math.max(e.near,o),far:Math.min(e.far,c)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>e.startUpdateCycle())),this._highlightRenderInstanceData.forEach((e=>e.startUpdateCycle()))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:a,_levelSelector:s}=this;this._defaultRenderInstanceData.forEach((e=>e.beginUpdate())),this._highlightRenderInstanceData.forEach((e=>e.beginUpdate()));const n=this._instanceData,i=n.view;let o=n.size;const c=n.capacity;let l=this._instanceIndex;for(let h=0;h<o&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=i.state.get(l);let d=0;if(!(h&L.ALLOCATED)){l=l+1===c?0:l+1,o++;continue}const u=i.lodLevel.get(l);if(h&L.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[u].freeTail(),h&L.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[u].freeTail(),h&L.REMOVE)n.freeInstance(l);else if(h&L.VISIBLE){let e=0;t&&(i.modelOrigin.getVec(l,z),e=s.selectLevel(z,n.getCombinedMedianScaleFactor(l),a)),d=h&~(L.ACTIVE|L.TRANSFORM_CHANGED),e>=0&&(h&L.HIGHLIGHT?(P(this._highlightRenderInstanceData[e],i,l),d|=L.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[e],i,l),d|=L.DEFAULT_ACTIVE)),i.state.set(l,d),i.lodLevel.set(l,e)}else d=h&~(L.ACTIVE|L.TRANSFORM_CHANGED),i.state.set(l,d);if(r(this._octreeCached)){const e=!!(h&L.ACTIVE),t=!!(d&L.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&L.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===c?0:l+1,e.madeProgress()}this._instanceIndex=l,this._defaultRenderInstanceData.forEach((e=>e.endUpdate())),this._highlightRenderInstanceData.forEach((e=>e.endUpdate())),this._context.requestRender()}_renderComponents(e,t){this.levels.forEach(((r,a)=>{const s=r.components.map((r=>this._beginComponent(e,t[a],r)));r.components.forEach(((r,n)=>this._renderComponent(e,s[n],t[a],r,a)))}))}_beginComponent(e,t,a){const{bindParameters:s,rctx:n,output:i}=e;if(0===t.size||!a.material.requiresSlot(s.slot,e.output))return null;const o=a.glMaterials.load(n,s.slot,i);return r(o)?o.beginSlot(s):null}_renderComponent(e,t,r,s,n){if(a(t))return;const{bindParameters:i,rctx:o}=e,c=o.bindTechnique(t,s.material.parameters,i);o.bindVAO(s.vao),t.ensureAttributeLocations(s.vao),c.bindDraw(Z,i,s.material.parameters),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===y.Color&&(c.setUniform4fv("externalColor",Q[Math.min(n,Q.length-1)]),c.setUniform1i("colorMixMode",U.replace));const l=o.capabilities.instancing,h=r.capacity,d=r.headIndex,u=r.tailIndex,m=r.firstIndex,p=this._glInstanceBufferLayout,_=(e,a)=>{w(o,v,r.buffer,p,e),l.drawArraysInstanced(t.primitiveType,0,s.vertexCount,a-e),B(o,v,r.buffer,p)};s.material.parameters.transparent&&null!=m?d>u?(b(m>=u&&m<=d,"invalid firstIndex"),_(m,d),_(u,m)):d<u&&(m<=d?(b(m>=0&&m<=d,"invalid firstIndex"),_(m,d),_(u,h),_(0,m)):(b(m>=u&&m<=h,"invalid firstIndex"),_(m,h),_(0,d),_(u,m))):d>u?_(u,d):d<u&&(_(0,d),_(u,h)),o.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){N(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function k(e){let t=I().vec3f(A.MODELORIGINHI).vec3f(A.MODELORIGINLO).mat3f(A.MODEL).mat3f(A.MODELNORMAL);return r(e)&&e.includes("color")&&(t=t.vec4f(A.INSTANCECOLOR)),r(e)&&e.includes("featureAttribute")&&(t=t.vec4f(A.INSTANCEFEATUREATTRIBUTE)),r(e)&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(A.OBJECTANDLAYERIDCOLOR_INSTANCED)),t}e([o({constructOnly:!0})],q.prototype,"symbol",void 0),e([o({constructOnly:!0})],q.prototype,"optionalFields",void 0),e([o({constructOnly:!0})],q.prototype,"metadata",void 0),e([o({constructOnly:!0})],q.prototype,"shaderTransformation",void 0),e([o()],q.prototype,"_instanceData",void 0),e([o()],q.prototype,"_cycleStartIndex",void 0),e([o({readOnly:!0})],q.prototype,"_enableLevelSelection",null),e([o()],q.prototype,"_updateCyclesWithStaticCamera",void 0),e([o({readOnly:!0})],q.prototype,"running",null),q=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],q);const z=m(),W=p(),K=l(),Y=m(),J=m(),Q=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],Z=new M;export{q as LodRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{isSome as e}from"../../../../core/maybe.js";import{s as t,c as r,n as a,b as s,l as i,g as o,e as n,t as h}from"../../../../chunks/vec3.js";import{c,f as l}from"../../../../chunks/vec3f64.js";import{ViewingMode as u}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as p}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as d}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as f}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as g}from"../lib/basicInterfaces.js";import{GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as _}from"../lib/Material.js";import{OITPolygonOffsetLimit as x}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as b}from"../lib/RenderSlot.js";import{VertexAttribute as S}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as v}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as w,intersectTriangleGeometry as M}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as A,DefaultMaterialPassParameters as y}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as R}from"../shaders/RealisticTreeTechnique.js";class I extends _{constructor(e){super(e,j),this.supportsEdges=!0,this._configuration=new C,this._vertexBufferLayout=L(this.parameters)}isVisibleForOutput(e){return e!==p.Shadow&&e!==p.ShadowExludeHighlight&&e!==p.ShadowHighlight||this.parameters.castShadows}isVisible(){const t=this.parameters;if(!super.isVisible()||0===t.layerOpacity)return!1;const{instanced:r,hasVertexColors:a,hasSymbolColors:s,vvColorEnabled:i}=t,o=e(r)&&r.includes("color"),n="replace"===t.colorMixMode,h=t.opacity>0,c=t.externalColor&&t.externalColor[3]>0;return a&&(o||i||s)?!!n||h:a?n?c:h:o||i||s?!!n||h:n?c:h}getConfiguration(t,r){return this._configuration.output=t,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=!!this.parameters.instanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.hasVerticalOffset=e(this.parameters.verticalOffset),this._configuration.hasScreenSizePerspective=e(this.parameters.screenSizePerspective),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,e(this.parameters.customDepthTest)&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?g.None:this.parameters.cullFace,this._configuration.hasMultipassTerrain=r.multipassTerrain.enabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=e(this.parameters.modelTransformation),t!==p.Color&&t!==p.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=d.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?d.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?d.WindingOrder:d.None,this._configuration.instancedColor=e(this.parameters.instanced)&&this.parameters.instanced.includes("color"),this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=!!r.ssaoHelper.enabled&&this.parameters.receiveSSAO,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?f.Schematic:f.Normal:f.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.enableOffset=r.camera.relativeElevation<x,this._configuration.snowCover=this.hasSnowCover(r),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(t){return e(t.weather)&&t.weatherVisible&&"snowy"===t.weather.type&&"enabled"===t.weather.snowCover}intersect(c,l,m,p,d,f){if(e(this.parameters.verticalOffset)){const e=m.camera;t(z,l[12],l[13],l[14]);let c=null;switch(m.viewingMode){case u.Global:c=a(B,z);break;case u.Local:c=r(B,N)}let f=0;const g=s(G,z,e.eye),T=i(g),_=o(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=n(c,_)),f+=w(e,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),o(c,c,f),h(H,c,m.transform.inverseRotation),p=s(D,p,H),d=s(V,d,H)}M(c,m,p,d,v(m.verticalOffset),f)}requiresSlot(e,t){if(t===p.Color||t===p.Alpha||t===p.Depth||t===p.Normal||t===p.Shadow||t===p.ShadowHighlight||t===p.ShadowExludeHighlight||t===p.Highlight||t===p.ObjectAndLayerIdColor){return e===(this.parameters.transparent?this.parameters.writeDepth?b.TRANSPARENT_MATERIAL:b.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:b.OPAQUE_MATERIAL)||e===b.DRAPED_MATERIAL||t===p.ObjectAndLayerIdColor}return!1}createGLMaterial(e){return new E(e)}createBufferWriter(){return new O(this._vertexBufferLayout)}}class E extends T{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==p.Color&&this._output!==p.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e));const r=this._material.parameters;this.updateTexture(r.textureId);const a=e.camera.viewInverseTransposeMatrix;return t(r.origin,a[3],a[7],a[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?R:A,e)}}class P extends y{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const j=new P;function L(e){const t=m().vec3f(S.POSITION).vec3f(S.NORMAL),r=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId;return e.hasVertexTangents&&t.vec4f(S.TANGENT),r&&t.vec2f(S.UV0),e.hasVertexColors&&t.vec4u8(S.COLOR),e.hasSymbolColors&&t.vec4u8(S.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(S.OBJECTANDLAYERIDCOLOR),t}const D=c(),V=c(),N=l(0,0,1),B=c(),H=c(),z=c(),G=c();export{E as DefaultGLMaterial,I as DefaultMaterial,P as DefaultMaterialParameters};
5
+ import has from"../../../../core/has.js";import{isSome as e}from"../../../../core/maybe.js";import{s as t,c as r,n as a,b as s,l as i,g as o,e as n,t as h}from"../../../../chunks/vec3.js";import{c,f as l}from"../../../../chunks/vec3f64.js";import{ViewingMode as u}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as p}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as d}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as f}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as g}from"../lib/basicInterfaces.js";import{GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as _}from"../lib/Material.js";import{OITPolygonOffsetLimit as x}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as b}from"../lib/RenderSlot.js";import{VertexAttribute as S}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as v}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as w,intersectTriangleGeometry as M}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as A,DefaultMaterialPassParameters as y}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as R}from"../shaders/RealisticTreeTechnique.js";class I extends _{constructor(e){super(e,j),this.supportsEdges=!0,this._configuration=new C,this._vertexBufferLayout=L(this.parameters)}isVisibleForOutput(e){return e!==p.Shadow&&e!==p.ShadowExcludeHighlight&&e!==p.ShadowHighlight||this.parameters.castShadows}isVisible(){const t=this.parameters;if(!super.isVisible()||0===t.layerOpacity)return!1;const{instanced:r,hasVertexColors:a,hasSymbolColors:s,vvColorEnabled:i}=t,o=e(r)&&r.includes("color"),n="replace"===t.colorMixMode,h=t.opacity>0,c=t.externalColor&&t.externalColor[3]>0;return a&&(o||i||s)?!!n||h:a?n?c:h:o||i||s?!!n||h:n?c:h}getConfiguration(t,r){return this._configuration.output=t,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=!!this.parameters.instanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.hasVerticalOffset=e(this.parameters.verticalOffset),this._configuration.hasScreenSizePerspective=e(this.parameters.screenSizePerspective),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,e(this.parameters.customDepthTest)&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?g.None:this.parameters.cullFace,this._configuration.hasMultipassTerrain=r.multipassTerrain.enabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=e(this.parameters.modelTransformation),t!==p.Color&&t!==p.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=d.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?d.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?d.WindingOrder:d.None,this._configuration.instancedColor=e(this.parameters.instanced)&&this.parameters.instanced.includes("color"),this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=!!r.ssaoHelper.enabled&&this.parameters.receiveSSAO,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?f.Schematic:f.Normal:f.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.enableOffset=r.camera.relativeElevation<x,this._configuration.snowCover=this.hasSnowCover(r),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(t){return e(t.weather)&&t.weatherVisible&&"snowy"===t.weather.type&&"enabled"===t.weather.snowCover}intersect(c,l,m,p,d,f){if(e(this.parameters.verticalOffset)){const e=m.camera;t(z,l[12],l[13],l[14]);let c=null;switch(m.viewingMode){case u.Global:c=a(B,z);break;case u.Local:c=r(B,N)}let f=0;const g=s(G,z,e.eye),T=i(g),_=o(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=n(c,_)),f+=w(e,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),o(c,c,f),h(H,c,m.transform.inverseRotation),p=s(D,p,H),d=s(V,d,H)}M(c,m,p,d,v(m.verticalOffset),f)}requiresSlot(e,t){if(t===p.Color||t===p.Alpha||t===p.Depth||t===p.Normal||t===p.Shadow||t===p.ShadowHighlight||t===p.ShadowExcludeHighlight||t===p.Highlight||t===p.ObjectAndLayerIdColor){return e===(this.parameters.transparent?this.parameters.writeDepth?b.TRANSPARENT_MATERIAL:b.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:b.OPAQUE_MATERIAL)||e===b.DRAPED_MATERIAL||t===p.ObjectAndLayerIdColor}return!1}createGLMaterial(e){return new E(e)}createBufferWriter(){return new O(this._vertexBufferLayout)}}class E extends T{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==p.Color&&this._output!==p.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e));const r=this._material.parameters;this.updateTexture(r.textureId);const a=e.camera.viewInverseTransposeMatrix;return t(r.origin,a[3],a[7],a[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?R:A,e)}}class P extends y{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const j=new P;function L(e){const t=m().vec3f(S.POSITION).vec3f(S.NORMAL),r=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId;return e.hasVertexTangents&&t.vec4f(S.TANGENT),r&&t.vec2f(S.UV0),e.hasVertexColors&&t.vec4u8(S.COLOR),e.hasSymbolColors&&t.vec4u8(S.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(S.OBJECTANDLAYERIDCOLOR),t}const D=c(),V=c(),N=l(0,0,1),B=c(),H=c(),z=c(),G=c();export{E as DefaultGLMaterial,I as DefaultMaterial,P 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../../core/mathUtils.js";import{isNone as t}from"../../../../core/maybe.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as s}from"../core/shaderLibrary/shading/Normals.glsl.js";import o from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{isPathGeometry as h}from"../lib/PathGeometry.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as d,PathTechniqueConfiguration as p,PathTechnique as m,PathPassParameters as f}from"./PathTechnique.js";import{intersectAabbInvDir as b}from"./internal/MaterialUtil.js";class S extends n{constructor(e){super(e,new v),this.supportsEdges=!0,this._vertexAttributeLocations=d,this._configuration=new p,this._vertexBufferLayout=S.getVertexBufferLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.vvOpacity=this.parameters.vvOpacityEnabled,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==a.Color&&e!==a.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?s.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?s.WindingOrder:s.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.enabled&&this.parameters.receiveSSAO),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==a.Shadow&&e!==a.ShadowExludeHighlight&&e!==a.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(i,a,s,o,n,c){const u=i;if(!h(u))return;const l=u.path,d=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSizeEnabled){const t=this.parameters.vvSizeOffset,r=this.parameters.vvSizeFactor,i=this.parameters.vvSizeMinSize,a=this.parameters.vvSizeMaxSize,s=l.sizeAttributeValue;d[0]*=e(t[0]+s*r[0],i[0],a[0]),d[1]*=e(t[2]+s*r[2],i[2],a[2])}const p=Math.max(d[0],d[1]),m=i.boundingInfo;if(t(m))return void this._intersectTriangles(l,d,o,n,c);const f=r(m.bbMin[0]-p,m.bbMin[1]-p,m.bbMin[2]-p,m.bbMax[0]+p,m.bbMax[1]+p,m.bbMax[2]+p),S=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],g=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]),v=[g/S[0],g/S[1],g/S[2]];b(f,o,v,s.tolerance)&&this._intersectTriangles(l,d,o,n,c)}_intersectTriangles(e,t,r,i,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,a)}createBufferWriter(){return new l(this._vertexBufferLayout)}requiresSlot(e,t){switch(t){case a.Shadow:case a.ShadowHighlight:case a.ShadowExludeHighlight:if(!this.parameters.castShadows)return!1;case a.Color:case a.Alpha:case a.Depth:case a.Normal:case a.Highlight:case a.ObjectAndLayerIdColor:return e===(this.parameters.transparent?c.TRANSPARENT_MATERIAL:c.OPAQUE_MATERIAL)||e===c.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new g(e)}static getVertexBufferLayout(){return i().vec3f(u.POSITION).vec4f(u.PROFILERIGHT).vec4f(u.PROFILEUP).vec4f(u.PROFILEVERTEXANDNORMAL).vec4f(u.FEATUREVALUE)}}class g extends o{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){(t(this.technique)||e.shadowMap.enabled!==this.technique.configuration.receiveShadows)&&this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(m,e)}}class v extends f{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveSSAO=!0,this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}export{S as PathMaterial,v as PathMaterialParameters};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{isNone as t}from"../../../../core/maybe.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as s}from"../core/shaderLibrary/shading/Normals.glsl.js";import o from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{isPathGeometry as h}from"../lib/PathGeometry.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as d,PathTechniqueConfiguration as p,PathTechnique as m,PathPassParameters as f}from"./PathTechnique.js";import{intersectAabbInvDir as b}from"./internal/MaterialUtil.js";class S extends n{constructor(e){super(e,new v),this.supportsEdges=!0,this._vertexAttributeLocations=d,this._configuration=new p,this._vertexBufferLayout=S.getVertexBufferLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=this.parameters.vvSizeEnabled,this._configuration.vvColor=this.parameters.vvColorEnabled,this._configuration.vvOpacity=this.parameters.vvOpacityEnabled,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==a.Color&&e!==a.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?s.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?s.WindingOrder:s.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.enabled&&this.parameters.receiveSSAO),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==a.Shadow&&e!==a.ShadowExcludeHighlight&&e!==a.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(i,a,s,o,n,c){const u=i;if(!h(u))return;const l=u.path,d=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSizeEnabled){const t=this.parameters.vvSizeOffset,r=this.parameters.vvSizeFactor,i=this.parameters.vvSizeMinSize,a=this.parameters.vvSizeMaxSize,s=l.sizeAttributeValue;d[0]*=e(t[0]+s*r[0],i[0],a[0]),d[1]*=e(t[2]+s*r[2],i[2],a[2])}const p=Math.max(d[0],d[1]),m=i.boundingInfo;if(t(m))return void this._intersectTriangles(l,d,o,n,c);const f=r(m.bbMin[0]-p,m.bbMin[1]-p,m.bbMin[2]-p,m.bbMax[0]+p,m.bbMax[1]+p,m.bbMax[2]+p),S=[n[0]-o[0],n[1]-o[1],n[2]-o[2]],g=Math.sqrt(S[0]*S[0]+S[1]*S[1]+S[2]*S[2]),v=[g/S[0],g/S[1],g/S[2]];b(f,o,v,s.tolerance)&&this._intersectTriangles(l,d,o,n,c)}_intersectTriangles(e,t,r,i,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,a)}createBufferWriter(){return new l(this._vertexBufferLayout)}requiresSlot(e,t){switch(t){case a.Shadow:case a.ShadowHighlight:case a.ShadowExcludeHighlight:if(!this.parameters.castShadows)return!1;case a.Color:case a.Alpha:case a.Depth:case a.Normal:case a.Highlight:case a.ObjectAndLayerIdColor:return e===(this.parameters.transparent?c.TRANSPARENT_MATERIAL:c.OPAQUE_MATERIAL)||e===c.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new g(e)}static getVertexBufferLayout(){return i().vec3f(u.POSITION).vec4f(u.PROFILERIGHT).vec4f(u.PROFILEUP).vec4f(u.PROFILEVERTEXANDNORMAL).vec4f(u.FEATUREVALUE)}}class g extends o{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){(t(this.technique)||e.shadowMap.enabled!==this.technique.configuration.receiveShadows)&&this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(m,e)}}class v extends f{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveSSAO=!0,this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}export{S as PathMaterial,v as PathMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{removeUnordered as e,filterInPlace as t}from"../../../../../core/arrayUtils.js";import{someMap as r}from"../../../../../core/MapUtils.js";import{isNone as s,isSome as i}from"../../../../../core/maybe.js";import{NestedMap as a}from"../../../../../core/NestedMap.js";import o from"../../../../../core/PooledArray.js";import{m as n,a as l,t as h}from"../../../../../chunks/mat4.js";import{c as u}from"../../../../../chunks/mat4f64.js";import{glLayout as f}from"../../../support/buffer/glUtil.js";import{ShaderOutput as c}from"../../core/shaderLibrary/ShaderOutput.js";import{GLMaterials as m}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as d}from"../../lib/Material.js";import{DirtyState as g}from"../../lib/ModelDirtyTypes.js";import{assert as p,setMatrixTranslation3 as y}from"../../lib/Util.js";import{DrawParameters as _}from"../DrawParameters.js";import{WaterMaterial as v}from"../WaterMaterial.js";import{BufferRange as w,mergeAdjacentRanges as b}from"./BufferRange.js";import{Instance as O}from"./Instance.js";import{PerBufferData as B,hasVao as C}from"./PerBufferData.js";import{PerOriginData as E}from"./PerOriginData.js";import{VaoCache as A}from"./VaoCache.js";class D{constructor(e,t,r){this._rctx=e,this._materialRepository=t,this.material=r,this._dataByOrigin=new Map,this._hasHighlights=!1,this._hasOccludees=!1,this._glMaterials=new m(this.material,this._materialRepository),this._bufferWriter=r.createBufferWriter(),this._vaoCache=new A(e,r.vertexAttributeLocations,f(this._bufferWriter.vertexBufferLayout))}dispose(){this._glMaterials.destroy(),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache.dispose()}get isEmpty(){return 0===this._dataByOrigin.size}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this.material instanceof v}get rendersOccluded(){return!this.isEmpty&&this.material.renderOccluded!==d.Occlude}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((t=>e(t.geometry)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const t=this._bufferWriter,r=t.vertexBufferLayout.stride/4;for(const i of e){const e=i.renderGeometry,a=this._dataByOrigin.get(e.localOrigin.id)?.findBuffer(e.id);if(s(a))return;const o=a.instances.get(e.id);if(i.updateType&(g.GEOMETRY|g.TRANSFORMATION)){const s=V(t.elementCount(o.geometry.geometry)*r),i=t.vertexBufferLayout.createView(s.buffer);this._writeGeometry(e,i,0),a.vao.vertexBuffers.geometry.setSubData(s,o.from*r,0,o.numElements*r)}i.updateType&(g.HIGHLIGHT|g.OCCLUDEE|g.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new a;for(const i of e){const e=i.localOrigin;if(s(e))continue;let t=r.get(e.id,null);s(t)&&(t=new H(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(s(e))continue;const t=this._dataByOrigin.get(e.id)?.findBuffer(i.id);if(s(t))continue;let a=r.get(e.id,t);s(a)&&(a=new H(e.vec3),r.set(e.id,t,a)),a.changes.push(i)}return r}_addAndRemoveGeometries(t,r){const{_bufferWriter:a,_dataByOrigin:o}=this,n=a.vertexBufferLayout.stride/4,l=this._computeDeltas(t,r);l.forEach(((t,r)=>{const h=t.get(null),u=i(h)?h.changes:[];l.delete(r,null);let f=o.get(r);if(t.forEach(((t,i)=>{if(l.delete(r,i),s(i))return void p(!1,"No VAO for removed geometries");if(i.instances.size===t.changes.length)return this._vaoCache.deleteVao(i.vao),e(f.buffers,i),void(0===f.buffers.length&&0===u.length&&o.delete(r));const h=i.numElements,c=i.vao.size/4,m=u.reduce(((e,t)=>e+a.elementCount(t.geometry)),0),d=t.changes.reduce(((e,t)=>e+a.elementCount(t.geometry)),0),g=Math.min((h+m-d)*n,W),y=g>c;g>L&&g<c/2?(t.changes.forEach((({id:e})=>i.deleteInstance(e))),i.instances.forEach((({geometry:e})=>u.push(e))),this._vaoCache.deleteVao(i.vao),e(f.buffers,i)):y?this._applyAndRebuild(i,u,t):this._applyRemoves(i,t)})),u.length>0)for(s(f)&&(f=new E(h.origin),o.set(r,f)),f.buffers.forEach((e=>this._applyAdds(e,u)));u.length>0;)f.buffers.push(this._applyAndRebuild(new B,u,null))}))}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.drawCommandsDirty&&(e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,r(e.instances,(t=>(e.updateDrawState(t),e.hasHiddenInstances&&e.hasHighlights&&e.hasOccludees))),e.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)),this._hasHighlights=this._hasHighlights||e.hasHighlights,this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(i(r))for(const i of r.changes)e.deleteInstance(i.id);const s=this._bufferWriter,a=s.vertexBufferLayout.stride,o=a/4,n=Math.floor(W/o);let l=e.numElements;for(;t.length>0;){const r=t.pop(),i=s.elementCount(r.geometry);if(l+i>n&&l>0){t.push(r);break}l+=i;const a=new O(r,0,0);p(null==e.instances.get(r.id)),e.addInstance(r.id,a)}const h=l*o,u=V(h),f=s.vertexBufferLayout.createView(u.buffer);let c=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,f,c);const i=c;c+=s.elementCount(t.geometry.geometry),e.updateInstance(r,i,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(z(h)),e.vao.vertexBuffers.geometry.setSubData(u,0,0,c*o),e.holes.clear();const m=e.holes.pushNew();return m.from=c,m.to=Math.floor(e.vao.size/a),e.updateDrawCommands(a),e}_applyRemoves(e,t){if(0===t.changes.length)return;for(const o of t.changes){const t=o.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const s=I.back();if(s){if(s.to===r.from){s.to=r.to;continue}if(s.from===r.to){s.from=r.from;continue}}const i=I.pushNew();i.from=r.from,i.to=r.to}b(I);const r=this._bufferWriter.vertexBufferLayout.stride/4,s=I.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,i=V(s);i.fill(0,0,s);const a=e.vao.vertexBuffers.geometry;I.forAll((e=>a.setSubData(i,e.from*r,0,e.numElements*r))),e.holes.pushArray(I.data,I.length),I.forAll(((e,t)=>I.data[t]=null)),I.clear(),e.drawCommandsDirty=!0}_applyAdds(e,r){if(0===r.length)return;if(!C(e))return void this._applyAndRebuild(e,r,null);const i=this._bufferWriter,a=i.vertexBufferLayout.stride/4,o=e.numElements,n=r.reduce(((e,t)=>e+i.elementCount(t.geometry)),0),l=Math.min((o+n)*a,W),h=4*l;if(e.vao.size<z(W-L)&&h>e.vao.size)return void this._applyAndRebuild(e,r,null);b(e.holes);const u=new Array;for(const t of r){const r=i.elementCount(t.geometry),s=M(e.holes,r);u.push(s)}const f=e.vao.vertexBuffers.geometry;let c=0,m=0,d=0;const g=V(l),y=i.vertexBufferLayout.createView(g.buffer);r.forEach(((t,r)=>{const o=u[r];if(s(o))return;if(!(d===o)){const e=d-m;e>0&&f.setSubData(g,m*a,0,e*a),m=o,c=0}const n=i.elementCount(t.geometry);this._writeGeometry(t,y,c),c+=n,d=o+n;const l=new O(t,o,o+n);p(null==e.instances.get(t.id)),e.addInstance(t.id,l),e.drawCommandsDirty=!0}));const _=d-m;_>0&&f.setSubData(g,m*a,0,_*a),t(r,((e,t)=>s(u[t])))}_writeGeometry(e,t,r){const s=e.localOrigin.vec3;y(x,-s[0],-s[1],-s[2]);const a=i(e.transformation)?n(j,x,e.transformation):x;l(S,a),h(S,S),this._bufferWriter.write(a,S,e.geometry,t,r)}updateAnimation(e){return this.material.update(e)}requiresSlot(e,t){return this.material.requiresSlot(e,t)}render(e,t){if(!this.requiresSlot(t.slot,e))return!1;const r=e===c.Highlight||e===c.ShadowHighlight;if(r&&!this._hasHighlights)return!1;const a=e===c.ShadowExludeHighlight,o=!(r||a),n=this._rctx;let l;const h=()=>{if(i(l))return l;const r=this._glMaterials.load(n,t.slot,e);return s(r)?null:(l=r.beginSlot(t),s(l)?null:(n.bindTechnique(l,this.material.parameters,t),l))};for(const i of this._dataByOrigin.values())for(const e of i.buffers){if(r&&!e.hasHighlights)continue;const l=(r?e.drawCommandsHighlight:a&&e.needsMultipleCommands()?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,u=o&&e.drawCommandsOccludees||null;if(l?.length||u?.length){const r=h();if(s(r))return!1;r.program.bindDraw(new _(i.origin),t,this.material.parameters),r.ensureAttributeLocations(e.vao),n.bindVAO(e.vao),l?.length&&(r.bindPipelineState(n,t.slot,!1),l.forAll((e=>n.drawArrays(r.primitiveType,e.first,e.count)))),u?.length&&(r.bindPipelineState(n,t.slot,!0),u.forAll((e=>n.drawArrays(r.primitiveType,e.first,e.count))))}}return i(l)}get test(){return{material:this.material,glMaterials:this._glMaterials,dataByOrigin:this._dataByOrigin}}}class H{constructor(e){this.origin=e,this.changes=new Array}}function M(e,t){let r;if(!e.some((e=>!(e.numElements<t)&&(r=e,!0))))return null;const s=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),s}const x=u(),j=u(),S=u(),I=new o({allocator:e=>e||new w,deallocator:null}),L=65536,R=4*L,G=16777216,W=G/4;let T=new Float32Array(L);function V(e){return T.length<e&&(T=new Float32Array(e)),T}function z(e){const t=4*e;return t<R?R:Math.max(Math.min(Math.ceil(1.5*t/R)*R,G),t)}export{D as MergedRenderer};
5
+ import{removeUnordered as e,filterInPlace as t}from"../../../../../core/arrayUtils.js";import{someMap as r}from"../../../../../core/MapUtils.js";import{isNone as s,isSome as i}from"../../../../../core/maybe.js";import{NestedMap as a}from"../../../../../core/NestedMap.js";import o from"../../../../../core/PooledArray.js";import{m as n,a as l,t as h}from"../../../../../chunks/mat4.js";import{c as u}from"../../../../../chunks/mat4f64.js";import{glLayout as f}from"../../../support/buffer/glUtil.js";import{ShaderOutput as c}from"../../core/shaderLibrary/ShaderOutput.js";import{GLMaterials as m}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as d}from"../../lib/Material.js";import{DirtyState as g}from"../../lib/ModelDirtyTypes.js";import{assert as p,setMatrixTranslation3 as y}from"../../lib/Util.js";import{DrawParameters as _}from"../DrawParameters.js";import{WaterMaterial as v}from"../WaterMaterial.js";import{BufferRange as w,mergeAdjacentRanges as b}from"./BufferRange.js";import{Instance as O}from"./Instance.js";import{PerBufferData as B,hasVao as C}from"./PerBufferData.js";import{PerOriginData as E}from"./PerOriginData.js";import{VaoCache as A}from"./VaoCache.js";class D{constructor(e,t,r){this._rctx=e,this._materialRepository=t,this.material=r,this._dataByOrigin=new Map,this._hasHighlights=!1,this._hasOccludees=!1,this._glMaterials=new m(this.material,this._materialRepository),this._bufferWriter=r.createBufferWriter(),this._vaoCache=new A(e,r.vertexAttributeLocations,f(this._bufferWriter.vertexBufferLayout))}dispose(){this._glMaterials.destroy(),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache.dispose()}get isEmpty(){return 0===this._dataByOrigin.size}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this.material instanceof v}get rendersOccluded(){return!this.isEmpty&&this.material.renderOccluded!==d.Occlude}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((t=>e(t.geometry)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const t=this._bufferWriter,r=t.vertexBufferLayout.stride/4;for(const i of e){const e=i.renderGeometry,a=this._dataByOrigin.get(e.localOrigin.id)?.findBuffer(e.id);if(s(a))return;const o=a.instances.get(e.id);if(i.updateType&(g.GEOMETRY|g.TRANSFORMATION)){const s=V(t.elementCount(o.geometry.geometry)*r),i=t.vertexBufferLayout.createView(s.buffer);this._writeGeometry(e,i,0),a.vao.vertexBuffers.geometry.setSubData(s,o.from*r,0,o.numElements*r)}i.updateType&(g.HIGHLIGHT|g.OCCLUDEE|g.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new a;for(const i of e){const e=i.localOrigin;if(s(e))continue;let t=r.get(e.id,null);s(t)&&(t=new H(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(s(e))continue;const t=this._dataByOrigin.get(e.id)?.findBuffer(i.id);if(s(t))continue;let a=r.get(e.id,t);s(a)&&(a=new H(e.vec3),r.set(e.id,t,a)),a.changes.push(i)}return r}_addAndRemoveGeometries(t,r){const{_bufferWriter:a,_dataByOrigin:o}=this,n=a.vertexBufferLayout.stride/4,l=this._computeDeltas(t,r);l.forEach(((t,r)=>{const h=t.get(null),u=i(h)?h.changes:[];l.delete(r,null);let f=o.get(r);if(t.forEach(((t,i)=>{if(l.delete(r,i),s(i))return void p(!1,"No VAO for removed geometries");if(i.instances.size===t.changes.length)return this._vaoCache.deleteVao(i.vao),e(f.buffers,i),void(0===f.buffers.length&&0===u.length&&o.delete(r));const h=i.numElements,c=i.vao.size/4,m=u.reduce(((e,t)=>e+a.elementCount(t.geometry)),0),d=t.changes.reduce(((e,t)=>e+a.elementCount(t.geometry)),0),g=Math.min((h+m-d)*n,W),y=g>c;g>L&&g<c/2?(t.changes.forEach((({id:e})=>i.deleteInstance(e))),i.instances.forEach((({geometry:e})=>u.push(e))),this._vaoCache.deleteVao(i.vao),e(f.buffers,i)):y?this._applyAndRebuild(i,u,t):this._applyRemoves(i,t)})),u.length>0)for(s(f)&&(f=new E(h.origin),o.set(r,f)),f.buffers.forEach((e=>this._applyAdds(e,u)));u.length>0;)f.buffers.push(this._applyAndRebuild(new B,u,null))}))}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.drawCommandsDirty&&(e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,r(e.instances,(t=>(e.updateDrawState(t),e.hasHiddenInstances&&e.hasHighlights&&e.hasOccludees))),e.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)),this._hasHighlights=this._hasHighlights||e.hasHighlights,this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(i(r))for(const i of r.changes)e.deleteInstance(i.id);const s=this._bufferWriter,a=s.vertexBufferLayout.stride,o=a/4,n=Math.floor(W/o);let l=e.numElements;for(;t.length>0;){const r=t.pop(),i=s.elementCount(r.geometry);if(l+i>n&&l>0){t.push(r);break}l+=i;const a=new O(r,0,0);p(null==e.instances.get(r.id)),e.addInstance(r.id,a)}const h=l*o,u=V(h),f=s.vertexBufferLayout.createView(u.buffer);let c=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,f,c);const i=c;c+=s.elementCount(t.geometry.geometry),e.updateInstance(r,i,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(z(h)),e.vao.vertexBuffers.geometry.setSubData(u,0,0,c*o),e.holes.clear();const m=e.holes.pushNew();return m.from=c,m.to=Math.floor(e.vao.size/a),e.updateDrawCommands(a),e}_applyRemoves(e,t){if(0===t.changes.length)return;for(const o of t.changes){const t=o.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const s=I.back();if(s){if(s.to===r.from){s.to=r.to;continue}if(s.from===r.to){s.from=r.from;continue}}const i=I.pushNew();i.from=r.from,i.to=r.to}b(I);const r=this._bufferWriter.vertexBufferLayout.stride/4,s=I.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,i=V(s);i.fill(0,0,s);const a=e.vao.vertexBuffers.geometry;I.forAll((e=>a.setSubData(i,e.from*r,0,e.numElements*r))),e.holes.pushArray(I.data,I.length),I.forAll(((e,t)=>I.data[t]=null)),I.clear(),e.drawCommandsDirty=!0}_applyAdds(e,r){if(0===r.length)return;if(!C(e))return void this._applyAndRebuild(e,r,null);const i=this._bufferWriter,a=i.vertexBufferLayout.stride/4,o=e.numElements,n=r.reduce(((e,t)=>e+i.elementCount(t.geometry)),0),l=Math.min((o+n)*a,W),h=4*l;if(e.vao.size<z(W-L)&&h>e.vao.size)return void this._applyAndRebuild(e,r,null);b(e.holes);const u=new Array;for(const t of r){const r=i.elementCount(t.geometry),s=M(e.holes,r);u.push(s)}const f=e.vao.vertexBuffers.geometry;let c=0,m=0,d=0;const g=V(l),y=i.vertexBufferLayout.createView(g.buffer);r.forEach(((t,r)=>{const o=u[r];if(s(o))return;if(!(d===o)){const e=d-m;e>0&&f.setSubData(g,m*a,0,e*a),m=o,c=0}const n=i.elementCount(t.geometry);this._writeGeometry(t,y,c),c+=n,d=o+n;const l=new O(t,o,o+n);p(null==e.instances.get(t.id)),e.addInstance(t.id,l),e.drawCommandsDirty=!0}));const _=d-m;_>0&&f.setSubData(g,m*a,0,_*a),t(r,((e,t)=>s(u[t])))}_writeGeometry(e,t,r){const s=e.localOrigin.vec3;y(x,-s[0],-s[1],-s[2]);const a=i(e.transformation)?n(j,x,e.transformation):x;l(S,a),h(S,S),this._bufferWriter.write(a,S,e.geometry,t,r)}updateAnimation(e){return this.material.update(e)}requiresSlot(e,t){return this.material.requiresSlot(e,t)}render(e,t){if(!this.requiresSlot(t.slot,e))return!1;const r=e===c.Highlight||e===c.ShadowHighlight;if(r&&!this._hasHighlights)return!1;const a=e===c.ShadowExcludeHighlight,o=!(r||a),n=this._rctx;let l;const h=()=>{if(i(l))return l;const r=this._glMaterials.load(n,t.slot,e);return s(r)?null:(l=r.beginSlot(t),s(l)?null:(n.bindTechnique(l,this.material.parameters,t),l))};for(const i of this._dataByOrigin.values())for(const e of i.buffers){if(r&&!e.hasHighlights)continue;const l=(r?e.drawCommandsHighlight:a&&e.needsMultipleCommands()?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,u=o&&e.drawCommandsOccludees||null;if(l?.length||u?.length){const r=h();if(s(r))return!1;r.program.bindDraw(new _(i.origin),t,this.material.parameters),r.ensureAttributeLocations(e.vao),n.bindVAO(e.vao),l?.length&&(r.bindPipelineState(n,t.slot,!1),l.forAll((e=>n.drawArrays(r.primitiveType,e.first,e.count)))),u?.length&&(r.bindPipelineState(n,t.slot,!0),u.forAll((e=>n.drawArrays(r.primitiveType,e.first,e.count))))}}return i(l)}get test(){return{material:this.material,glMaterials:this._glMaterials,dataByOrigin:this._dataByOrigin}}}class H{constructor(e){this.origin=e,this.changes=new Array}}function M(e,t){let r;if(!e.some((e=>!(e.numElements<t)&&(r=e,!0))))return null;const s=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),s}const x=u(),j=u(),S=u(),I=new o({allocator:e=>e||new w,deallocator:null}),L=65536,R=4*L,G=16777216,W=G/4;let T=new Float32Array(L);function V(e){return T.length<e&&(T=new Float32Array(e)),T}function z(e){const t=4*e;return t<R?R:Math.max(Math.min(Math.ceil(1.5*t/R)*R,G),t)}export{D as MergedRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as s,destroyMaybe as o,isSome as n,isNone as a,unwrapOr as p}from"../../../../core/maybe.js";import{watch as d,initial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../../core/scheduling.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{ComponentObjectCollection as u}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueRepository as _}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{RenderRequestType as y,Decorations as f}from"../lib/basicInterfaces.js";import g from"../lib/CompositingHelper.js";import{textureToDepth as R}from"../lib/depthRangeUtils.js";import{GLMaterialRepository as x}from"../lib/GLMaterialRepository.js";import{MagnifierHelper as b}from"../lib/MagnifierHelper.js";import{ObjectAndLayerIdRenderHelper as v}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as j}from"../lib/Renderer.js";import{RenderingContext as w}from"../lib/RenderingContext.js";import{TextureRepository as A}from"../lib/TextureRepository.js";import{StippleTextureRepository as C}from"../materials/StippleTextureRepository.js";import{WaterTextureRepository as T}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as U}from"./contextCache.js";import{removeLoadedShaderModules as D}from"./requireUtils.js";import{ScreenshotManager as O,ScreenshotContext as q}from"./ScreenshotManager.js";import{contextCache as M}from"./testUtils.js";import{RenderState as S}from"../../../support/RenderState.js";import{createContextOrErrorHTML as L}from"../../../webgl/context-util.js";let H=class extends t{constructor(e){super({}),this.events=new r,this.waterTextureRepository=new T,this._magnifierHelper=new b,this.objectAndLayerIdRenderHelper=has("enable-feature:objectAndLayerId-rendering")?new v:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this._container=e.container,this._viewingMode=e.viewingMode,this._initializeContext(e),d((()=>this.waterTextureRepository?.updating),(()=>this.requestRender()),h),this._magnifierHelper.events.on("request-render",(()=>this.requestRender())),this._stippleTextureRepository=new C(this._rctx),this._shaderTechniqueRepository=new _({rctx:this._rctx,viewingMode:e.viewingMode,stippleTextureRepository:this._stippleTextureRepository,waterTextureRepository:this.waterTextureRepository}),this._textureRepository=new A(e,this._shaderTechniqueRepository,this._rctx),this._textureRepository.events.on("changed",(e=>this.requestRender(e))),this._materialRepository=new x(this._textureRepository,this._shaderTechniqueRepository,(()=>this.requestRender()),(()=>this.requestRender())),this._compositingHelper=new g(this._rctx,this._shaderTechniqueRepository),this.renderer=new j(this._materialRepository,this._textureRepository,this._shaderTechniqueRepository,this._rctx,this._compositingHelper,this._magnifierHelper,(e=>this.requestRender(e)),e);const t={renderScene:(e,t,r,i,s)=>this.renderer.render(e,t,{camera:r,contentCamera:r,mode:S.IDLE},i,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>e.options.screenshot.prepareOverlay(),renderOverlay:(t,r)=>e.options.screenshot.renderOverlay(t,r)};this._screenshotManager=new O(this._rctx,t,(e=>this.events.emit("force-camera-for-screenshot",e)),(()=>this.renderer.disposeOffscreenBuffers())),this._registerFrameTask(e)}normalizeCtorArgs(){return{}}destroy(){this._container.contains(this._canvas)&&this._container.removeChild(this._canvas),this._frameTask=s(this._frameTask),this._shaderTechniqueRepository=o(this._shaderTechniqueRepository)}get performanceInfo(){const e=this._rctx.gl;return{renderer:this.renderer.performanceInfo,textureMemory:void 0!==e.getUsedTextureMemory?e.getUsedTextureMemory():void 0,renderbufferMemory:void 0!==e.getUsedRenderbufferMemory?e.getUsedRenderbufferMemory():void 0,VBOMemory:void 0!==e.getUsedVBOMemory?e.getUsedVBOMemory():void 0}}requestRender(e=y.UPDATE){this._needsRender=!0,e===y.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textureRepository.updating||this.waterTextureRepository.updating||this._magnifierHelper.updating}get textureRepository(){return this._textureRepository}get compositingHelper(){return this._compositingHelper}set magnifier(e){this._magnifierHelper.magnifier=e}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,s,o=s){const a=i.constrainWindowSize(t,r,s*i.pixelRatio,o*i.pixelRatio),p=this._ensureDepthBuffer(a);this.renderer.readDepthPixels(i,a,p);let d=Number.MAX_VALUE;for(let n=0;n<a[2]*a[3];n++){const e=R(4*n,p,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(n(e)){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);n(s)&&d>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(d=s)}return d===Number.MAX_VALUE?void 0:d}_ensureDepthBuffer(e){const t=4*e[2]*e[3];return(a(this._tmpDepthBuffer)||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){D(),await this._shaderTechniqueRepository.reloadAll(),this.requestRender()}_registerFrameTask(e){const t=e.state;let r=!1,i=y.BACKGROUND,s=!1;const o={preRender:({time:s})=>{r=this.updating,i=this._needsUpdate?y.UPDATE:y.BACKGROUND,e.commitSyncLayers();(s-this._lastAnimationUpdate>this.renderer.animationTimestep||n(t.forcedAnimationTime)||r||this._needsRender)&&(s=p(t.forcedAnimationTime,s),this.renderer.updateAnimation({camera:t.camera,time:s})&&this.requestRender(y.BACKGROUND),this._lastAnimationUpdate=s)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(null,null,t,f.ON,e),s=!0,r&&this.renderer.hasWaterReflection&&(this.requestRender(y.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{const r=new q(t.camera,this.renderer.hasSlicePlane||this._magnifierHelper.enabled);this._textureRepository.update(),this._screenshotManager.update(r,e)},finish:()=>{s&&(this.renderer.finish(t.mode===S.IDLE?i:y.UPDATE),s=!1)}};this._frameTask=c(o)}_initializeContext(e){const t=e.options;this._canvas=t.canvas,this._canvas||(this._canvas=document.createElement("canvas")),this._canvas.setAttribute("style","width: 100%; height:100%; display:block;");const r={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:null==t.stencil||t.stencil,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},s=L("3d",this._canvas,r);if(a(s)){const e=has("esri-force-webgl");i.getLogger(this.declaredClass).error(e)}else this._rctx=this._newRenderingContext(s,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this.declaredClass).error("WebGL context has alpha channel even though no alpha channel was requested"),!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(this._container.style.backgroundColor="black"),this._container.appendChild(this._canvas)}_newRenderingContext(e,t){const r={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8},i=(e,r)=>t.resourceController.memoryController.newCache(e,r);if(M.enabled){let t=B.get(e);return t?(t.configure(r),t.newCache=i,t.ref(),t):(t=new w(e,r,i),B.set(e,t),t.ref(),t)}return new w(e,r,i)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("standardDerivatives"),this._rctx.capabilities.enable("shaderTextureLOD"),this._rctx.capabilities.enable("textureFloat")}getObjectAndLayerIdColor(e){return n(this.objectAndLayerIdRenderHelper)?this.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor(e):null}get componentObjectCollection(){return a(this._componentObjectCollection)&&(this._componentObjectCollection=new u(this.renderer.renderPassManager,this._viewingMode)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}};e([l({type:Boolean,readOnly:!0})],H.prototype,"updating",null),e([l({autoDestroy:!0})],H.prototype,"_rctx",void 0),e([l({autoDestroy:!0})],H.prototype,"_container",void 0),e([l({autoDestroy:!0})],H.prototype,"_canvas",void 0),e([l({autoDestroy:!0})],H.prototype,"_stippleTextureRepository",void 0),e([l({autoDestroy:!0})],H.prototype,"waterTextureRepository",void 0),e([l({autoDestroy:!0})],H.prototype,"_magnifierHelper",void 0),e([l({readOnly:!0})],H.prototype,"objectAndLayerIdRenderHelper",void 0),e([l({autoDestroy:!0})],H.prototype,"_textureRepository",void 0),e([l({autoDestroy:!0})],H.prototype,"_compositingHelper",void 0),e([l({autoDestroy:!0,readOnly:!0})],H.prototype,"renderer",void 0),e([l({autoDestroy:!0})],H.prototype,"_screenshotManager",void 0),e([l()],H.prototype,"componentObjectCollection",null),e([l({autoDestroy:!0})],H.prototype,"_componentObjectCollection",void 0),e([l()],H.prototype,"_needsUpdate",void 0),e([l()],H.prototype,"_needsWaterReflectionUpdate",void 0),H=e([m("esri.views.3d.webgl-engine.parts.RenderView")],H);const B=U();export{H as RenderView};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as s,destroyMaybe as o,isSome as n,isNone as a}from"../../../../core/maybe.js";import{watch as p,initial as d}from"../../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../../core/scheduling.js";import{Milliseconds as c}from"../../../../core/time.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{ComponentObjectCollection as u}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueRepository as _}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{RenderRequestType as f,Decorations as y}from"../lib/basicInterfaces.js";import g from"../lib/CompositingHelper.js";import{textureToDepth as R}from"../lib/depthRangeUtils.js";import{GLMaterialRepository as x}from"../lib/GLMaterialRepository.js";import{MagnifierHelper as b}from"../lib/MagnifierHelper.js";import{UpdateParameters as v}from"../lib/Material.js";import{ObjectAndLayerIdRenderHelper as j}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as w}from"../lib/Renderer.js";import{RenderingContext as T}from"../lib/RenderingContext.js";import{TextureRepository as A}from"../lib/TextureRepository.js";import{StippleTextureRepository as C}from"../materials/StippleTextureRepository.js";import{WaterTextureRepository as U}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as D}from"./contextCache.js";import{removeLoadedShaderModules as O}from"./requireUtils.js";import{ScreenshotManager as M,ScreenshotContext as q}from"./ScreenshotManager.js";import{contextCache as S}from"./testUtils.js";import{RenderState as L}from"../../../support/RenderState.js";import{createContextOrErrorHTML as H}from"../../../webgl/context-util.js";let B=class extends t{constructor(e){super({}),this.events=new r,this.waterTextureRepository=new U,this._magnifierHelper=new b,this.objectAndLayerIdRenderHelper=has("enable-feature:objectAndLayerId-rendering")?new j:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this._container=e.container,this._viewingMode=e.viewingMode,this._initializeContext(e),p((()=>this.waterTextureRepository?.updating),(()=>this.requestRender()),d),this._magnifierHelper.events.on("request-render",(()=>this.requestRender())),this._stippleTextureRepository=new C(this._rctx),this._shaderTechniqueRepository=new _({rctx:this._rctx,viewingMode:e.viewingMode,stippleTextureRepository:this._stippleTextureRepository,waterTextureRepository:this.waterTextureRepository}),this._textureRepository=new A(e,this._shaderTechniqueRepository,this._rctx),this._textureRepository.events.on("changed",(e=>this.requestRender(e))),this._materialRepository=new x(this._textureRepository,this._shaderTechniqueRepository,(()=>this.requestRender()),(()=>this.requestRender())),this._compositingHelper=new g(this._rctx,this._shaderTechniqueRepository),this.renderer=new w(this._materialRepository,this._textureRepository,this._shaderTechniqueRepository,this._rctx,this._compositingHelper,this._magnifierHelper,(e=>this.requestRender(e)),e);const t={renderScene:(e,t,r,i,s)=>this.renderer.render(e,t,{camera:r,contentCamera:r,mode:L.IDLE},i,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>e.options.screenshot.prepareOverlay(),renderOverlay:(t,r)=>e.options.screenshot.renderOverlay(t,r)};this._screenshotManager=new M(this._rctx,t,(e=>this.events.emit("force-camera-for-screenshot",e)),(()=>this.renderer.disposeOffscreenBuffers())),this._registerFrameTask(e)}normalizeCtorArgs(){return{}}destroy(){this._container.contains(this._canvas)&&this._container.removeChild(this._canvas),this._frameTask=s(this._frameTask),this._shaderTechniqueRepository=o(this._shaderTechniqueRepository)}get performanceInfo(){const e=this._rctx.gl;return{renderer:this.renderer.performanceInfo,textureMemory:void 0!==e.getUsedTextureMemory?e.getUsedTextureMemory():void 0,renderbufferMemory:void 0!==e.getUsedRenderbufferMemory?e.getUsedRenderbufferMemory():void 0,VBOMemory:void 0!==e.getUsedVBOMemory?e.getUsedVBOMemory():void 0}}requestRender(e=f.UPDATE){this._needsRender=!0,e===f.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textureRepository.updating||this.waterTextureRepository.updating||this._magnifierHelper.updating}get textureRepository(){return this._textureRepository}get compositingHelper(){return this._compositingHelper}set magnifier(e){this._magnifierHelper.magnifier=e}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,s,o=s){const a=i.constrainWindowSize(t,r,s*i.pixelRatio,o*i.pixelRatio),p=this._ensureDepthBuffer(a);this.renderer.readDepthPixels(i,a,p);let d=Number.MAX_VALUE;for(let n=0;n<a[2]*a[3];n++){const e=R(4*n,p,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(n(e)){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);n(s)&&d>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(d=s)}return d===Number.MAX_VALUE?void 0:d}_ensureDepthBuffer(e){const t=4*e[2]*e[3];return(a(this._tmpDepthBuffer)||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){O(),await this._shaderTechniqueRepository.reloadAll(),this.requestRender()}_registerFrameTask(e){const t=e.state;let r=!1,i=f.BACKGROUND,s=!1;const o={preRender:({time:s})=>{r=this.updating,i=this._needsUpdate?f.UPDATE:f.BACKGROUND,e.commitSyncLayers();const o=c(s-this._lastAnimationUpdate);if(o>this.renderer.animationTimestep||n(t.forcedAnimationTime)||r||this._needsRender){const e=c(o/this.renderer.animationTimeDilation),r=new v(t.camera,e,t.forcedAnimationTime);this.renderer.updateAnimation(r)&&this.requestRender(f.BACKGROUND),this._lastAnimationUpdate=s}},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(null,null,t,y.ON,e),s=!0,r&&this.renderer.hasWaterReflection&&(this.requestRender(f.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{const r=new q(t.camera,this.renderer.hasSlicePlane||this._magnifierHelper.enabled);this._textureRepository.update(),this._screenshotManager.update(r,e)},finish:()=>{s&&(this.renderer.finish(t.mode===L.IDLE?i:f.UPDATE),s=!1)}};this._frameTask=h(o)}_initializeContext(e){const t=e.options;this._canvas=t.canvas,this._canvas||(this._canvas=document.createElement("canvas")),this._canvas.setAttribute("style","width: 100%; height:100%; display:block;");const r={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:null==t.stencil||t.stencil,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},s=H("3d",this._canvas,r);if(a(s)){const e=has("esri-force-webgl");i.getLogger(this.declaredClass).error(e)}else this._rctx=this._newRenderingContext(s,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this.declaredClass).error("WebGL context has alpha channel even though no alpha channel was requested"),!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(this._container.style.backgroundColor="black"),this._container.appendChild(this._canvas)}_newRenderingContext(e,t){const r={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8},i=(e,r)=>t.resourceController.memoryController.newCache(e,r);if(S.enabled){let t=E.get(e);return t?(t.configure(r),t.newCache=i,t.ref(),t):(t=new T(e,r,i),E.set(e,t),t.ref(),t)}return new T(e,r,i)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("standardDerivatives"),this._rctx.capabilities.enable("shaderTextureLOD"),this._rctx.capabilities.enable("textureFloat")}getObjectAndLayerIdColor(e){return n(this.objectAndLayerIdRenderHelper)?this.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor(e):null}get componentObjectCollection(){return a(this._componentObjectCollection)&&(this._componentObjectCollection=new u(this.renderer.renderPassManager,this._viewingMode)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}};e([l({type:Boolean,readOnly:!0})],B.prototype,"updating",null),e([l({autoDestroy:!0})],B.prototype,"_rctx",void 0),e([l({autoDestroy:!0})],B.prototype,"_container",void 0),e([l({autoDestroy:!0})],B.prototype,"_canvas",void 0),e([l({autoDestroy:!0})],B.prototype,"_stippleTextureRepository",void 0),e([l({autoDestroy:!0})],B.prototype,"waterTextureRepository",void 0),e([l({autoDestroy:!0})],B.prototype,"_magnifierHelper",void 0),e([l({readOnly:!0})],B.prototype,"objectAndLayerIdRenderHelper",void 0),e([l({autoDestroy:!0})],B.prototype,"_textureRepository",void 0),e([l({autoDestroy:!0})],B.prototype,"_compositingHelper",void 0),e([l({autoDestroy:!0,readOnly:!0})],B.prototype,"renderer",void 0),e([l({autoDestroy:!0})],B.prototype,"_screenshotManager",void 0),e([l()],B.prototype,"componentObjectCollection",null),e([l({autoDestroy:!0})],B.prototype,"_componentObjectCollection",void 0),e([l()],B.prototype,"_needsUpdate",void 0),e([l()],B.prototype,"_needsWaterReflectionUpdate",void 0),B=e([m("esri.views.3d.webgl-engine.parts.RenderView")],B);const E=D();export{B as RenderView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as r}from"../../../core/maybe.js";function e(r,e,n){if(!e||!r||!r.map)return;const{map:s}=r,a=s.layers.find((r=>r===e));a||s.add(e,n),null!=n&&s.layers.reorder(a,n)}function n(e,n){return e.allLayerViews.find((e=>{const s=e.layer;return s===n||"sublayers"in s&&r(s.sublayers)&&s.sublayers.includes(n)}))}export{e as addUniqueLayer,n as findLayerView};
5
+ import{isSome as r}from"../../../core/maybe.js";function e(r,e,n){if(!e||!r||!r.map)return;const{map:s}=r,a=s.layers.find((r=>r===e));a||s.add(e,n),a&&null!=n&&s.layers.reorder(a,n)}function n(e,n){return e.allLayerViews.find((e=>{const s=e.layer;return s===n||"sublayers"in s&&r(s.sublayers)&&s.sublayers.includes(n)}))}export{e as addUniqueLayer,n as findLayerView};