@arcgis/core 5.0.0-next.16 → 5.0.0-next.18

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 (262) hide show
  1. package/analysis/ElevationProfile/ElevationProfileLineInput.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{adf7ccf4ef629211c7ee.js → 08aacbfb651cc2e1c054.js} +1 -1
  4. package/assets/esri/core/workers/chunks/234b52b2a391631ceff6.js +1 -0
  5. package/assets/esri/core/workers/chunks/{658cd45b5fb304fd840a.js → 3aa77696c5ea54a238da.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{8f3503b2fb6cd38757b9.js → 458e87902abc24b375da.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{57b410198d83bf0ab708.js → 4a89e120be142ab58a27.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{49571d6875de1f2e7e25.js → 4b9dfdc23ba3d6ebcc1b.js} +2 -2
  9. package/assets/esri/core/workers/chunks/{a410dcf80d17a2383337.js → 65a4099bdbe31834d0cc.js} +1 -1
  10. package/assets/esri/core/workers/chunks/722da7a39a0ad9300752.js +1 -0
  11. package/assets/esri/core/workers/chunks/{cdb4664fd59860ddeb5a.js → 72f1c3d97e7b9546c113.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{bc318b6fef192cee2a72.js → 76e945da8f30d8641c3d.js} +20 -20
  13. package/assets/esri/core/workers/chunks/{319c3f46f2afb8f3e5a9.js → 89c9cf7f799858d14c76.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{e19cd07df8ce87e18832.js → 8b33732e3c2924c1f60d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/98739414c107ad78e4d8.js +1 -0
  16. package/assets/esri/core/workers/chunks/{8b73db0f4d6714396eb0.js → a6fa90eab77ac0e1cdfc.js} +1 -1
  17. package/assets/esri/core/workers/chunks/ac366221e8636b60aee5.js +1 -0
  18. package/assets/esri/core/workers/chunks/{23e17b745adf71a5efc7.js → aca72ca7f43f70eb8077.js} +1 -1
  19. package/assets/esri/core/workers/chunks/ad0c7225941437d18408.js +1 -0
  20. package/assets/esri/core/workers/chunks/b30897952494a3e5b9fe.js +1 -0
  21. package/assets/esri/core/workers/chunks/bfd3d81e8e148be99686.js +1 -0
  22. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  23. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  24. package/assets/esri/themes/base/widgets/_Editor.scss +2 -1
  25. package/assets/esri/themes/base/widgets/_FeatureForm.scss +1 -1
  26. package/assets/esri/themes/dark/main.css +1 -1
  27. package/assets/esri/themes/light/main.css +1 -1
  28. package/assets/esri/themes/light/view.css +1 -1
  29. package/chunks/GaussianSplat.glsl.js +2 -2
  30. package/chunks/ImageMaterial.glsl.js +1 -1
  31. package/chunks/lyr3DMain.js +1 -1
  32. package/config.js +1 -1
  33. package/graphic/graphicOriginUtils.js +1 -1
  34. package/interfaces.d.ts +113 -54
  35. package/intl/locale.js +1 -1
  36. package/kernel.js +1 -1
  37. package/layers/BingMapsLayer.js +1 -1
  38. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  39. package/layers/support/attributionUtils.js +5 -0
  40. package/layers/support/fieldConfigUtils.js +1 -1
  41. package/layers/support/fieldFormatUtils.js +1 -1
  42. package/layers/video/VideoController.js +1 -1
  43. package/libs/parquet/parquet.js +1 -1
  44. package/package.json +1 -1
  45. package/support/revision.js +1 -1
  46. package/symbols/cim/SDFHelper.js +1 -1
  47. package/symbols/cim/cimAnalyzer.js +1 -1
  48. package/views/2d/LabelManager.js +1 -1
  49. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  50. package/views/2d/engine/flow/dataUtils.js +1 -1
  51. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  52. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  53. package/views/2d/engine/webgl/TextureManager.js +1 -1
  54. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  55. package/views/2d/engine/webgl/animations/store/AnimationStore.js +1 -1
  56. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedPolyShader.js +1 -1
  57. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
  58. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
  59. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
  60. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  61. package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
  62. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  63. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  64. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  66. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  67. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  68. package/views/2d/engine/webgl/textureUtils.js +1 -1
  69. package/views/2d/layers/features/FeatureContainer.js +1 -1
  70. package/views/2d/layers/features/Processor.js +1 -1
  71. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  72. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  73. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  74. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  75. package/views/3d/GroundView3D.js +1 -1
  76. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  77. package/views/3d/analysis/ElevationProfile/ElevationProfileGeometryVisualization3D.js +1 -1
  78. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  79. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  80. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  81. package/views/3d/analysis/images/Factory.js +1 -1
  82. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  83. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  84. package/views/3d/environment/CloudsCompositionTechnique.js +1 -1
  85. package/views/3d/environment/CloudsTechnique.js +1 -1
  86. package/views/3d/environment/EnvironmentManager.js +1 -1
  87. package/views/3d/environment/FogTechnique.js +1 -1
  88. package/views/3d/environment/NoiseTextureAtlasTechnique.js +1 -1
  89. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  90. package/views/3d/environment/SimpleAtmosphereTechnique.js +1 -1
  91. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  92. package/views/3d/layers/DrapedSubView3D.js +1 -1
  93. package/views/3d/layers/FlowSubView3D.js +1 -1
  94. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  95. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  96. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  97. package/views/3d/layers/MediaLayerView3D.js +1 -1
  98. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  99. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  100. package/views/3d/layers/SceneLayerView3D.js +1 -1
  101. package/views/3d/layers/TiledLayerView3D.js +1 -1
  102. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  103. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  104. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  105. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  106. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  107. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  108. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  109. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  110. package/views/3d/support/QualityProfile.js +5 -0
  111. package/views/3d/support/QualitySettings.js +1 -1
  112. package/views/3d/support/StreamTextureCollection.js +1 -1
  113. package/views/3d/support/TextureCollection.js +1 -1
  114. package/views/3d/support/engineContent/marker.js +1 -1
  115. package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
  116. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  117. package/views/3d/support/flow/FlowWorker.js +1 -1
  118. package/views/3d/support/flow/FlowWorkerHandle.js +1 -1
  119. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  120. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  121. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  122. package/views/3d/support/flow/constants.js +1 -1
  123. package/views/3d/support/flow/loadUtils.js +1 -1
  124. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  125. package/views/3d/support/popupHitTest.js +1 -1
  126. package/views/3d/terrain/BlendLayersTechnique.js +1 -1
  127. package/views/3d/terrain/OverlayRenderer.js +1 -1
  128. package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
  129. package/views/3d/terrain/TerrainSurface.js +1 -1
  130. package/views/3d/terrain/TileAgent.js +1 -1
  131. package/views/3d/terrain/TileCompositor.js +1 -1
  132. package/views/3d/webgl-engine/Stage.js +1 -1
  133. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  134. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  135. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  136. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  137. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  138. package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
  139. package/views/3d/webgl-engine/core/shaderTechnique/{ReloadableShaderModule.js → ReloadableShader.js} +1 -1
  140. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  141. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  142. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +1 -1
  143. package/views/3d/webgl-engine/effects/glow/GlowBlurTechnique.js +1 -1
  144. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  145. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  146. package/views/3d/webgl-engine/effects/haze/HazeCompositingTechnique.js +1 -1
  147. package/views/3d/webgl-engine/effects/haze/HazeTechnique.js +1 -1
  148. package/views/3d/webgl-engine/effects/highlight/HighlightApplyTechnique.js +1 -1
  149. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +1 -1
  150. package/views/3d/webgl-engine/effects/highlight/HighlightDownsampleTechnique.js +1 -1
  151. package/views/3d/webgl-engine/effects/highlight/HighlightToSingleTechnique.js +1 -1
  152. package/views/3d/webgl-engine/effects/highlight/ShadowHighlightTechnique.js +1 -1
  153. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
  154. package/views/3d/webgl-engine/effects/laserlines/LaserlineTechnique.js +1 -1
  155. package/views/3d/webgl-engine/effects/magnifier/MagnifierTechnique.js +1 -1
  156. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  157. package/views/3d/webgl-engine/effects/smaa/SMAABlendWeightsTechnique.js +1 -1
  158. package/views/3d/webgl-engine/effects/smaa/SMAABlurTechnique.js +1 -1
  159. package/views/3d/webgl-engine/effects/smaa/SMAAEdgeDetectTechnique.js +1 -1
  160. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  161. package/views/3d/webgl-engine/effects/ssao/SSAOBlurTechnique.js +1 -1
  162. package/views/3d/webgl-engine/effects/ssao/SSAOTechnique.js +1 -1
  163. package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
  164. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  165. package/views/3d/webgl-engine/lib/AnimationTimeStep.js +1 -1
  166. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  167. package/views/3d/webgl-engine/lib/DDSUtil.js +1 -1
  168. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  169. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  170. package/views/3d/webgl-engine/lib/ManagedTexture.js +5 -0
  171. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  172. package/views/3d/webgl-engine/lib/Program.js +1 -1
  173. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  174. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  175. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  176. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  177. package/views/3d/webgl-engine/lib/TextTextureFactory.js +1 -1
  178. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  179. package/views/3d/webgl-engine/lib/TextureTechnique.js +1 -1
  180. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  181. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  182. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  183. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  184. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  185. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  186. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  187. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  188. package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +1 -1
  189. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  190. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  191. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  192. package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +1 -1
  193. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +1 -1
  194. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +1 -1
  195. package/views/3d/webgl-engine/shaders/CutFillReductionTechnique.js +1 -1
  196. package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +1 -1
  197. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  198. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  199. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechnique.js +1 -1
  200. package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
  201. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +1 -1
  202. package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
  203. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  204. package/views/3d/webgl-engine/shaders/HUDCompositingTechnique.js +1 -1
  205. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  206. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  207. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  208. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  209. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  210. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  211. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  212. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  213. package/views/3d/webgl-engine/shaders/OverlayCompositingTechnique.js +1 -1
  214. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  215. package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
  216. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  217. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  218. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  219. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  220. package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +1 -1
  221. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  222. package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
  223. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  224. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  225. package/views/GroundView.js +1 -1
  226. package/views/SceneView.js +1 -1
  227. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  228. package/views/analysis/ElevationProfile/types.d.ts +5 -0
  229. package/views/analysis/ElevationProfile/types.js +5 -0
  230. package/views/support/layerViewUtils.js +1 -1
  231. package/views/webgl/Texture.js +1 -1
  232. package/views/webgl/VertexAttributeLocations.js +1 -1
  233. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  234. package/widgets/Attribution/AttributionViewModel.js +1 -1
  235. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  236. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  237. package/widgets/Editor/UpdateWorkflow.js +1 -1
  238. package/widgets/Editor/Workflow.js +1 -1
  239. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  240. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  241. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  242. package/widgets/Editor.js +1 -1
  243. package/widgets/Feature/support/featureUtils.js +1 -1
  244. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  245. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  246. package/widgets/FeatureTable/FieldColumn.js +1 -1
  247. package/widgets/FeatureTable/Grid/Column.js +1 -1
  248. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  249. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  250. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  251. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  252. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  253. package/assets/esri/core/workers/chunks/38ee69125da60464d5a1.js +0 -1
  254. package/assets/esri/core/workers/chunks/4f0016111fd84c612f41.js +0 -1
  255. package/assets/esri/core/workers/chunks/8208dfa8f7fae7e616b9.js +0 -1
  256. package/assets/esri/core/workers/chunks/847f4fc39100fac1df01.js +0 -1
  257. package/assets/esri/core/workers/chunks/ab005fe84952f0676020.js +0 -1
  258. package/assets/esri/core/workers/chunks/bc19a232076d98825eef.js +0 -1
  259. package/assets/esri/core/workers/chunks/c3dcfe26c2c3c829762d.js +0 -1
  260. package/views/3d/support/DisplayQualityProfile.js +0 -5
  261. package/views/3d/webgl-engine/lib/Texture.js +0 -5
  262. /package/views/3d/webgl-engine/lib/{ITexture.js → IManagedTexture.js} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as t}from"../../lib/DefaultVertexBufferLayouts.js";import{E as o}from"../../../../../chunks/EdgeDetect.glsl.js";import{makePipelineState as s,defaultColorWrite as i}from"../../../../webgl/renderState.js";class l extends r{constructor(r,s){super(r,s,new e(o,()=>import("../../shaders/EdgeDetect.glsl.js")),t)}initializePipeline(){return s({colorWrite:i})}}export{l as SMAAEdgeDetectTechnique};
5
+ import{__decorate as e}from"tslib";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{E as t}from"../../../../../chunks/EdgeDetect.glsl.js";import{makePipelineState as i,defaultColorWrite as c}from"../../../../webgl/renderState.js";let a=class extends s{constructor(){super(...arguments),this.shader=new o(t,()=>import("../../shaders/EdgeDetect.glsl.js"))}initializePipeline(){return i({colorWrite:c})}};a=e([r("esri.views.3d.webgl-engine.effects.smaa.SMAAEdgeDetectTechnique")],a);export{a as SMAAEdgeDetectTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as n}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{distanceFadeEnd as c,distanceFadeStart as h}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{SSAOBlurTechnique as u}from"./SSAOBlurTechnique.js";import{noiseData as l}from"./SSAONoiseData.js";import{SSAOPassParameters as d,BlurDrawParameters as f}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{g as w}from"../../../../../chunks/SSAO.glsl.js";import{DepthStencilAttachment as S}from"../../../../webgl/enums.js";import{Texture as T}from"../../../../webgl/Texture.js";import{TextureDescriptor as _}from"../../../../webgl/TextureDescriptor.js";const g=2;let j=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=n.SSAO,this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new d,this._drawParameters=new f}initialize(){const e=Uint8Array.from(atob(l),e=>e.charCodeAt(0)),r=new _(32);r.wrapMode=33071,r.pixelFormat=6407,r.wrapMode=10497,r.hasMipmap=!0,this._passParameters.noiseTexture=new T(this.renderingContext,r,e),this.techniques.precompile(b),this.techniques.precompile(u),this.addHandles(s(()=>this.isEnabled(),()=>this._enableTime=i(0)))}destroy(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),o=t?.getTexture(S);if(!s||!o)return;const a=this.techniques.get(b),p=this.techniques.get(u);if(!a.compiled||!p.compiled)return this._enableTime=i(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=i(performance.now()));const l=this.renderingContext,d=this.view.qualitySettings.fadeDuration,f=this.bindParameters,T=f.camera,_=T.relativeElevation,j=r((c-_)/(c-h),0,1),x=d>0?Math.min(d,performance.now()-this._enableTime)/d:1,q=x*j;this._passParameters.normalTexture=s,this._passParameters.depthTexture=o,this._passParameters.projScale=1/T.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*P/w(T)**6*q;const v=T.fullViewport[2],y=T.fullViewport[3],A=this.fboCache.acquire(v,y,"ssao input",2);l.bindFramebuffer(A.fbo),l.setViewport(0,0,v,y),l.bindTechnique(a,f,this._passParameters,this._drawParameters),l.screen.draw();const C=Math.round(v/g),O=Math.round(y/g),V=this.fboCache.acquire(C,O,"ssao blur",0);l.bindFramebuffer(V.fbo),this._drawParameters.colorTexture=A.getTexture(),m(this._drawParameters.blurSize,0,g/y),l.bindTechnique(p,f,this._passParameters,this._drawParameters),l.setViewport(0,0,C,O),l.screen.draw(),A.release();const M=this.fboCache.acquire(C,O,n.SSAO,0);return l.bindFramebuffer(M.fbo),l.setViewport(0,0,v,y),l.setClearColor(1,1,1,0),l.clear(16384),this._drawParameters.colorTexture=V.getTexture(),m(this._drawParameters.blurSize,g/v,0),l.bindTechnique(p,f,this._passParameters,this._drawParameters),l.setViewport(0,0,C,O),l.screen.draw(),l.setViewport4fv(T.fullViewport),V.release(),x<1&&this.requestRender(2),M}};e([o()],j.prototype,"consumes",void 0),e([o()],j.prototype,"produces",void 0),e([o({constructOnly:!0})],j.prototype,"isEnabled",void 0),j=e([a("esri.views.3d.webgl-engine.effects.ssao.SSAO")],j);const P=.5;export{j as SSAO,g as blurSizePixels};
5
+ import{__decorate as e}from"tslib";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as n}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{distanceFadeEnd as c,distanceFadeStart as h}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{SSAOBlurTechnique as u}from"./SSAOBlurTechnique.js";import{noiseData as l}from"./SSAONoiseData.js";import{SSAOPassParameters as d,BlurDrawParameters as f}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{g as w}from"../../../../../chunks/SSAO.glsl.js";import{DepthStencilAttachment as S}from"../../../../webgl/enums.js";import{Texture as _}from"../../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../../webgl/TextureDescriptor.js";const g=2;let j=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=n.SSAO,this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new d,this._drawParameters=new f}initialize(){const e=Uint8Array.from(atob(l),e=>e.charCodeAt(0)),r=new T(32);r.wrapMode=33071,r.pixelFormat=6407,r.wrapMode=10497,r.hasMipmap=!0,this._passParameters.noiseTexture=new _(this.renderingContext,r,e),this.techniques.precompile(b),this.techniques.precompile(u),this.addHandles(s(()=>this.isEnabled(),()=>this._enableTime=i(0)))}destroy(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),o=t?.getTexture(S);if(!s||!o)return;const a=this.techniques.get(b),p=this.techniques.get(u);if(!a.compiled||!p.compiled)return this._enableTime=i(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=i(performance.now()));const l=this.renderingContext,d=this.view.qualitySettings.fadeDuration,f=this.bindParameters,_=f.camera,T=_.relativeElevation,j=r((c-T)/(c-h),0,1),x=d>0?Math.min(d,performance.now()-this._enableTime)/d:1,q=x*j;this._passParameters.normalTexture=s,this._passParameters.depthTexture=o,this._passParameters.projScale=1/_.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*P/w(_)**6*q;const v=_.fullViewport[2],y=_.fullViewport[3],A=this.fboCache.acquire(v,y,"ssao input",2);l.bindFramebuffer(A.fbo),l.setViewport(0,0,v,y),l.bindTechnique(a,f,this._passParameters,this._drawParameters),l.screen.draw();const C=Math.round(v/g),O=Math.round(y/g),V=this.fboCache.acquire(C,O,"ssao blur",0);l.bindFramebuffer(V.fbo),this._drawParameters.colorTexture=A.getTexture(),m(this._drawParameters.blurSize,0,g/y),l.bindTechnique(p,f,this._passParameters,this._drawParameters),l.setViewport(0,0,C,O),l.screen.draw(),A.release();const M=this.fboCache.acquire(C,O,n.SSAO,0);return l.bindFramebuffer(M.fbo),l.setViewport(0,0,v,y),l.setClearColor(1,1,1,0),l.clear(16384),this._drawParameters.colorTexture=V.getTexture(),m(this._drawParameters.blurSize,g/v,0),l.bindTechnique(p,f,this._passParameters,this._drawParameters),l.setViewport(0,0,C,O),l.screen.draw(),l.setViewport4fv(_.fullViewport),V.release(),x<1&&this.requestRender(2),M}};e([o()],j.prototype,"consumes",void 0),e([o()],j.prototype,"produces",void 0),e([o({constructOnly:!0})],j.prototype,"isEnabled",void 0),j=e([a("esri.views.3d.webgl-engine.effects.ssao.SSAO")],j);const P=.5;export{j as SSAO,g as blurSizePixels};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as o}from"../../lib/DefaultVertexBufferLayouts.js";import{S as s}from"../../../../../chunks/SSAOBlur.glsl.js";import{makePipelineState as t,defaultColorWrite as i}from"../../../../webgl/renderState.js";class l extends r{constructor(r,t){super(r,t,new e(s,()=>import("../../shaders/SSAOBlur.glsl.js")),o)}initializePipeline(){return t({colorWrite:i})}}export{l as SSAOBlurTechnique};
5
+ import{__decorate as r}from"tslib";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{S as i}from"../../../../../chunks/SSAOBlur.glsl.js";import{makePipelineState as t,defaultColorWrite as c}from"../../../../webgl/renderState.js";let a=class extends s{constructor(){super(...arguments),this.shader=new o(i,()=>import("../../shaders/SSAOBlur.glsl.js"))}initializePipeline(){return t({colorWrite:c})}};a=r([e("esri.views.3d.webgl-engine.effects.ssao.SSAOBlurTechnique")],a);export{a as SSAOBlurTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as o}from"../../lib/DefaultVertexBufferLayouts.js";import{S as s}from"../../../../../chunks/SSAO.glsl.js";import{makePipelineState as t,defaultColorWrite as i}from"../../../../webgl/renderState.js";class l extends r{constructor(r,t){super(r,t,new e(s,()=>import("../../shaders/SSAO.glsl.js")),o)}initializePipeline(){return t({colorWrite:i})}}export{l as SSAOTechnique};
5
+ import{__decorate as r}from"tslib";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{S as i}from"../../../../../chunks/SSAO.glsl.js";import{makePipelineState as t,defaultColorWrite as c}from"../../../../webgl/renderState.js";let a=class extends s{constructor(){super(...arguments),this.shader=new o(i,()=>import("../../shaders/SSAO.glsl.js"))}initializePipeline(){return t({colorWrite:c})}};a=r([e("esri.views.3d.webgl-engine.effects.ssao.SSAOTechnique")],a);export{a as SSAOTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{newLayout as r}from"../../../support/buffer/InterleavedLayout.js";import{ReloadableShaderModule as o}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{S as t}from"../../../../../chunks/Stars.glsl.js";import{NoParameters as i}from"../../../../webgl/NoParameters.js";import{makePipelineState as a,defaultColorWrite as c,unpremultipliedAlphaToPremultipliedAlpha as l}from"../../../../webgl/renderState.js";class n extends i{constructor(){super(...arguments),this.modelMatrix=e()}}class m extends s{constructor(e,r){super(e,r,new o(t,()=>import("./Stars.glsl.js")),p.locations)}initializePipeline(){return a({blending:l,depthTest:{func:515},colorWrite:c})}}const p=r().vec3f("position").vec4u8("color").f32("size").freeze();export{n as StarPassParameters,m as StarsTechnique,p as layout};
5
+ import{__decorate as r}from"tslib";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{newLayout as s}from"../../../support/buffer/InterleavedLayout.js";import{ReloadableShader as t}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{S as c}from"../../../../../chunks/Stars.glsl.js";import{PrimitiveType as m}from"../../../../webgl/enums.js";import{NoParameters as a}from"../../../../webgl/NoParameters.js";import{makePipelineState as p,defaultColorWrite as l,unpremultipliedAlphaToPremultipliedAlpha as n}from"../../../../webgl/renderState.js";class f extends a{constructor(){super(...arguments),this.modelMatrix=o()}}let u=class extends i{constructor(r,e){super(r,e,d.locations),this.shader=new t(c,()=>import("./Stars.glsl.js")),this.primitiveType=m.POINTS}initializePipeline(){return p({blending:n,depthTest:{func:515},colorWrite:l})}};u=r([e("esri.views.3d.webgl-engine.effects.stars.StarsTechnique")],u);const d=s().vec3f("position").vec4u8("color").f32("size").freeze();export{f as StarPassParameters,u as StarsTechnique,d as layout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as s}from"../../../../../chunks/OITBlend.glsl.js";import{Pos2Locations as i}from"../../lib/DefaultVertexBufferLayouts.js";import{DrawBufferNone as o,ColorAttachment1 as t,ColorAttachment0 as m}from"../../../../webgl/enums.js";import{makePipelineState as l,defaultColorWrite as f,modulateDestination as n,unpremultipliedAlphaToPremultipliedAlpha as u}from"../../../../webgl/renderState.js";class a extends r{constructor(r,o){super(r,o,new e(s,()=>import("./OITBlend.glsl.js")),i)}initializePipeline(e){return l({blending:e.dimEmissive?n:u,colorWrite:f,drawBuffers:e.dimEmissive?{buffers:[o,t]}:e.hasEmitters?{buffers:[m,t]}:{buffers:[m]}})}}export{a as OITBlendTechnique};
5
+ import{__decorate as e}from"tslib";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/OITBlend.glsl.js";import{DrawBufferNone as t,ColorAttachment1 as m,ColorAttachment0 as n}from"../../../../webgl/enums.js";import{makePipelineState as c,defaultColorWrite as a,modulateDestination as l,unpremultipliedAlphaToPremultipliedAlpha as d}from"../../../../webgl/renderState.js";let p=class extends o{constructor(){super(...arguments),this.shader=new s(i,()=>import("./OITBlend.glsl.js"))}initializePipeline(e){return c({blending:e.dimEmissive?l:d,colorWrite:a,drawBuffers:e.dimEmissive?{buffers:[t,m]}:e.hasEmitters?{buffers:[n,m]}:{buffers:[n]}})}};p=e([r("esri.views.3d.webgl-engine.effects.transparency.OITBlendTechnique")],p);export{p as OITBlendTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";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=i(0)}frame(e,_){_?0===this._firstIdleTime&&(this._firstIdleTime=i(performance.now())):this._firstIdleTime=i(0);if(!has("disable-feature:high-quality-idle")){const t=_?performance.now()-this._firstIdleTime:0;if(t>=r+o)return this._step=i(1/0),void(this._dilation=1);this._dilation=t>=r?h:1}else this._dilation=1;const n=t(e/s,m,a);this._step===1/0?this._step=i(n):this._step=i(this._step*l+n*(1-l))}get value(){return this._step}get timeDilation(){return this._dilation}clear(){this._step=this._firstIdleTime=i(0)}}const s=.5,r=i(12e4),o=i(1e4),h=10,l=.9,_=30,m=i(1e3/1),a=i(1e3/_);export{e as AnimationTimeStep};
5
+ import{clamp as t}from"../../../../core/mathUtils.js";import{Milliseconds as i}from"../../../../core/time.js";class e{constructor(){this._step=n,this._dilation=1,this._firstIdleTime=i(0)}frame(e,m){m?0===this._firstIdleTime&&(this._firstIdleTime=i(performance.now())):this._firstIdleTime=i(0);const p=m?performance.now()-this._firstIdleTime:0;if(p>=r+o)return this._step=i(1/0),void(this._dilation=1);this._dilation=p>=r?h:1;const a=t(e/s,n,l);this._step===1/0?this._step=i(a):this._step=i(this._step*_+a*(1-_))}get value(){return this._step}get timeDilation(){return this._dilation}clear(){this._step=this._firstIdleTime=i(0)}}const s=.5,r=i(12e4),o=i(1e4),h=10,_=.9,m=30,n=i(1e3/1),l=i(1e3/m);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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{getBasisTranscoder as e}from"../../../../libs/basisu/BasisUTranscoder.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import{Texture as n}from"../../../webgl/Texture.js";import{getFormatBytesPerElement as s}from"../../../webgl/Util.js";let r=null,i=null;async function a(){return null==i&&(i=e(),r=await i),i}function l(e,t){if(null==r)return e.byteLength;const n=new r.BasisFile(new Uint8Array(e)),s=u(n)?o(n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),t):0;return n.close(),n.delete(),s}function g(e,t){if(null==r)return e.byteLength;const n=new r.KTX2File(new Uint8Array(e)),s=c(n)?o(n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),t):0;return n.close(),n.delete(),s}function o(e,n,r,i,a){const l=s(n?t.COMPRESSED_RGBA8_ETC2_EAC:t.COMPRESSED_RGB8_ETC2),g=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*l*g)}function u(e){return e.getNumImages()>=1&&!e.isUASTC()}function c(e){return e.getFaces()>=1&&e.isETC1S()}async function m(e,t,n){null==r&&(r=await a());const s=new r.BasisFile(new Uint8Array(n));if(!u(s))return null;s.startTranscoding();const i=h(e,t,s.getNumLevels(0),s.getHasAlpha(),s.getImageWidth(0,0),s.getImageHeight(0,0),(e,t)=>s.getImageTranscodedSizeInBytes(0,e,t),(e,t,n)=>s.transcodeImage(n,0,e,t,0,0));return s.close(),s.delete(),i}async function T(e,t,n){null==r&&(r=await a());const s=new r.KTX2File(new Uint8Array(n));if(!c(s))return null;s.startTranscoding();const i=h(e,t,s.getLevels(),s.getHasAlpha(),s.getWidth(),s.getHeight(),(e,t)=>s.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,n)=>s.transcodeImage(n,e,0,0,t,0,-1,-1));return s.close(),s.delete(),i}function h(e,s,r,i,a,l,g,o){const{compressedTextureETC:u,compressedTextureS3TC:c}=e.capabilities,[m,T]=u?i?[1,t.COMPRESSED_RGBA8_ETC2_EAC]:[0,t.COMPRESSED_RGB8_ETC2]:c?i?[3,t.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,t.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=s.hasMipmap?r:Math.min(1,r),d=[];for(let t=0;t<h;t++)d.push(new Uint8Array(g(t,m))),o(t,m,d[t]);return s.internalFormat=T,s.hasMipmap=d.length>1,s.samplingMode=s.hasMipmap?9987:9729,s.width=a,s.height=l,new n(e,s,{type:"compressed",levels:d})}export{c as checkKTX2,m as createTextureBasis,T as createTextureKTX2,l as estimateMemoryBasis,g as estimateMemoryKTX2,a as loadBasisTranscoder};
5
+ import{getBasisTranscoder as e}from"../../../../libs/basisu/BasisUTranscoder.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import{Texture as n}from"../../../webgl/Texture.js";import{getFormatBytesPerElement as s}from"../../../webgl/Util.js";let r=null,i=null;async function a(){return null==i&&(i=e(),r=await i),i}function l(e,t){if(null==r)return e.byteLength;const n=new r.BasisFile(new Uint8Array(e)),s=u(n)?o(n.getNumLevels(0),n.getHasAlpha(),n.getImageWidth(0,0),n.getImageHeight(0,0),t):0;return n.close(),n.delete(),s}function g(e,t){if(null==r)return e.byteLength;const n=new r.KTX2File(new Uint8Array(e)),s=c(n)?o(n.getLevels(),n.getHasAlpha(),n.getWidth(),n.getHeight(),t):0;return n.close(),n.delete(),s}function o(e,n,r,i,a){const l=s(n?t.COMPRESSED_RGBA8_ETC2_EAC:t.COMPRESSED_RGB8_ETC2),g=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*l*g)}function u(e){return e.getNumImages()>=1&&!e.isUASTC()}function c(e){return e.getFaces()>=1&&e.isETC1S()}async function m(e,t,n){null==r&&(r=await a());const s=new r.BasisFile(new Uint8Array(n));if(!u(s))return null;s.startTranscoding();const i=T(e,t,s.getNumLevels(0),s.getHasAlpha(),s.getImageWidth(0,0),s.getImageHeight(0,0),(e,t)=>s.getImageTranscodedSizeInBytes(0,e,t),(e,t,n)=>s.transcodeImage(n,0,e,t,0,0));return s.close(),s.delete(),i}async function h(e,t,n){null==r&&(r=await a());const s=new r.KTX2File(new Uint8Array(n));if(!c(s))return null;s.startTranscoding();const i=T(e,t,s.getLevels(),s.getHasAlpha(),s.getWidth(),s.getHeight(),(e,t)=>s.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,n)=>s.transcodeImage(n,e,0,0,t,0,-1,-1));return s.close(),s.delete(),i}function T(e,s,r,i,a,l,g,o){const{compressedTextureETC:u,compressedTextureS3TC:c}=e.capabilities,[m,h]=u?i?[1,t.COMPRESSED_RGBA8_ETC2_EAC]:[0,t.COMPRESSED_RGB8_ETC2]:c?i?[3,t.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,t.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],T=s.hasMipmap?r:Math.min(1,r),d=[];for(let t=0;t<T;t++)d.push(new Uint8Array(g(t,m))),o(t,m,d[t]);return s.internalFormat=h,s.hasMipmap=d.length>1,s.samplingMode=s.hasMipmap?9987:9729,s.width=a,s.height=l,new n(e,s,{type:"compressed",levels:d})}export{c as checkKTX2,m as createTextureBasis,h as createTextureKTX2,l as estimateMemoryBasis,g as estimateMemoryKTX2,a as loadBasisTranscoder};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import{Texture as r}from"../../../webgl/Texture.js";const n=()=>e.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil"),o=542327876,a=131072,i=4;function s(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function l(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}const u=s("DXT1"),c=s("DXT3"),h=s("DXT5"),m=31,f=0,d=1,p=2,g=3,D=4,C=7,w=20,T=21;function S(e,t,n){const o=b(n,t.hasMipmap??!1);if(null==o)throw new Error("DDS texture data is null");const{textureData:a,internalFormat:i,width:s,height:l}=o;return t.samplingMode=a.levels.length>1?9987:9729,t.hasMipmap=a.levels.length>1,t.internalFormat=i,t.width=s,t.height=l,new r(e,t,a)}function b(e,r){const s=new Int32Array(e.buffer,e.byteOffset,m);if(s[f]!==o)return n().error("Invalid magic number in DDS header"),null;if(!(s[w]&i))return n().error("Unsupported format, must contain a FourCC code"),null;const S=s[T];let b,_;switch(S){case u:b=8,_=t.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case c:b=16,_=t.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case h:b=16,_=t.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return n().error("Unsupported FourCC code:",l(S)),null}let x=1,E=s[D],M=s[g];(3&E||3&M)&&(n().warn("Rounding up compressed texture size to nearest multiple of 4."),E=E+3&-4,M=M+3&-4);const X=E,A=M;let R,v;s[p]&a&&!1!==r&&(x=Math.max(1,s[C]));let y=e.byteOffset+s[d]+4;const F=[];for(let t=0;t<x;++t)v=(E+3>>2)*(M+3>>2)*b,R=new Uint8Array(e.buffer,y,v),F.push(R),y+=v,E=Math.max(1,E>>1),M=Math.max(1,M>>1);return{textureData:{type:"compressed",levels:F},internalFormat:_,width:X,height:A}}export{S as createDDSTexture,b as createDDSTextureData};
5
+ import e from"../../../../core/Logger.js";import{CompressedTextureFormat as t}from"../../../webgl/enums.js";import{Texture as r}from"../../../webgl/Texture.js";const n=()=>e.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil"),o=542327876,a=131072,i=4;function s(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function l(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}const u=s("DXT1"),c=s("DXT3"),h=s("DXT5"),m=31,f=0,d=1,p=2,g=3,D=4,C=7,w=20,S=21;function T(e,t,n){const o=b(n,t.hasMipmap??!1);if(null==o)throw new Error("DDS texture data is null");const{textureData:a,internalFormat:i,width:s,height:l}=o;return t.samplingMode=a.levels.length>1?9987:9729,t.hasMipmap=a.levels.length>1,t.internalFormat=i,t.width=s,t.height=l,new r(e,t,a)}function b(e,r){const s=new Int32Array(e.buffer,e.byteOffset,m);if(s[f]!==o)return n().error("Invalid magic number in DDS header"),null;if(!(s[w]&i))return n().error("Unsupported format, must contain a FourCC code"),null;const T=s[S];let b,_;switch(T){case u:b=8,_=t.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case c:b=16,_=t.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case h:b=16,_=t.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return n().error("Unsupported FourCC code:",l(T)),null}let E=1,x=s[D],M=s[g];(3&x||3&M)&&(n().warn("Rounding up compressed texture size to nearest multiple of 4."),x=x+3&-4,M=M+3&-4);const X=x,A=M;let R,v;s[p]&a&&!1!==r&&(E=Math.max(1,s[C]));let y=e.byteOffset+s[d]+4;const F=[];for(let t=0;t<E;++t)v=(x+3>>2)*(M+3>>2)*b,R=new Uint8Array(e.buffer,y,v),F.push(R),y+=v,x=Math.max(1,x>>1),M=Math.max(1,M>>1);return{textureData:{type:"compressed",levels:F},internalFormat:_,width:X,height:A}}export{T as createDDSTexture,b as createDDSTextureData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import s from"./GLMaterial.js";import{NoParameters as i}from"../../../webgl/NoParameters.js";class r extends s{constructor(t){super(t),this._numLoading=0,this._disposed=!1,this._textures=t.textures,this.updateTexture(t.textureId),this._acquire(t.normalTextureId,t=>this._textureNormal=t),this._acquire(t.emissiveTextureId,t=>this._textureEmissive=t),this._acquire(t.occlusionTextureId,t=>this._textureOcclusion=t),this._acquire(t.metallicRoughnessTextureId,t=>this._textureMetallicRoughness=t)}dispose(){super.dispose(),this._texture=t(this._texture),this._textureNormal=t(this._textureNormal),this._textureEmissive=t(this._textureEmissive),this._textureOcclusion=t(this._textureOcclusion),this._textureMetallicRoughness=t(this._textureMetallicRoughness),this._disposed=!0}ensureResources(t){return 0===this._numLoading?2:1}get textureBindParameters(){return new l(this._texture?.glTexture??null,this._textureNormal?.glTexture??null,this._textureEmissive?.glTexture??null,this._textureOcclusion?.glTexture??null,this._textureMetallicRoughness?.glTexture??null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=t(this._texture),this._acquire(e,t=>this._texture=t))}_acquire(s,i){if(null==s)return void i(null);const r=this._textures.acquire(s);if(e(r))return++this._numLoading,void r.then(e=>{if(this._disposed)return t(e),void i(null);i(e)}).finally(()=>--this._numLoading);i(r)}}class u extends i{constructor(t=null){super(),this.textureEmissive=t}}class l extends u{constructor(t,e,s,i,r,u,l){super(s),this.texture=t,this.textureNormal=e,this.textureOcclusion=i,this.textureMetallicRoughness=r,this.scale=u,this.normalTextureTransformMatrix=l}}export{u as GLEmissiveTexturePassParameters,r as GLTextureMaterial,l as GLTextureMaterialBindParameters};
5
+ import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import s from"./GLMaterial.js";import{NoParameters as i}from"../../../webgl/NoParameters.js";class r extends s{constructor(t){super(t),this._numLoading=0,this._disposed=!1,this._textures=t.textures,this.updateTexture(t.textureId),this._acquire(t.normalTextureId,t=>this._textureNormal=t),this._acquire(t.emissiveTextureId,t=>this._textureEmissive=t),this._acquire(t.occlusionTextureId,t=>this._textureOcclusion=t),this._acquire(t.metallicRoughnessTextureId,t=>this._textureMetallicRoughness=t)}dispose(){super.dispose(),this._texture=t(this._texture),this._textureNormal=t(this._textureNormal),this._textureEmissive=t(this._textureEmissive),this._textureOcclusion=t(this._textureOcclusion),this._textureMetallicRoughness=t(this._textureMetallicRoughness),this._disposed=!0}ensureResources(t){return 0===this._numLoading?2:1}get textureBindParameters(){return new l(this._texture?.texture??null,this._textureNormal?.texture??null,this._textureEmissive?.texture??null,this._textureOcclusion?.texture??null,this._textureMetallicRoughness?.texture??null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=t(this._texture),this._acquire(e,t=>this._texture=t))}_acquire(s,i){if(null==s)return void i(null);const r=this._textures.acquire(s);if(e(r))return++this._numLoading,void r.then(e=>{if(this._disposed)return t(e),void i(null);i(e)}).finally(()=>--this._numLoading);i(r)}}class u extends i{constructor(t=null){super(),this.textureEmissive=t}}class l extends u{constructor(t,e,s,i,r,u,l){super(s),this.texture=t,this.textureNormal=e,this.textureOcclusion=i,this.textureMetallicRoughness=r,this.scale=u,this.normalTextureTransformMatrix=l}}export{u as GLEmissiveTexturePassParameters,r as GLTextureMaterial,l as GLTextureMaterialBindParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as r,b as n,h as o,u as h,f as l,m as c,J as p,d as m}from"../../../../chunks/vec32.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as _}from"../../../../chunks/vec42.js";import{create as g}from"../../../../geometry/support/plane.js";import{fromPoints as f}from"../../../../geometry/support/ray.js";import{j as b,i as P}from"../../../../chunks/sphere.js";import{RenderCategory as C}from"../../webgl.js";import{GaussianSplatTarget as S}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as q}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import v from"../../webgl/RenderNode.js";import{IntersectorResult as w}from"./IntersectorResult.js";import{G as D}from"../../../../chunks/GaussianSplat.glsl.js";import{G as T}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as j}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as y}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as x}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as G}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as R}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as A}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as V,PrimitiveType as E}from"../../../webgl/enums.js";var I;let M=class extends v{constructor(){super(...arguments),this.gaussianPosition=u(),this.intersectionRayDir=u(),this.intersectionPlane=g(),this._slicePlaneEnabled=!1,this._data=null,this.produces=C.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._gaussianSplatParameters=new D,this._gaussianSplatCompositionParameters=new T,this._gaussianSplatDepthCompositionParameters=new y,this._splatTechniqueConfiguration=new A,this._splatDepthTechniqueConfiguration=new A(!0),this._previousCameraPosition=u(),this._previousCameraDirection=u(),this._tanFov=a(),this._tempVec=u(),this._cameraDelta=u(),this._coarseCameraPosition=u()}static{I=this}async initialize(){this._data=new q(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this._splatTechniqueConfiguration.terrainDepthTest=this.bindParameters.terrainDepthTest,this.techniques.precompile(R,this._splatTechniqueConfiguration),this._splatDepthTechniqueConfiguration.terrainDepthTest=this.bindParameters.terrainDepthTest,this.techniques.precompile(G,this._splatDepthTechniqueConfiguration),this.techniques.precompile(j),this.techniques.precompile(x)}render(t){const s=t.find(({name:t})=>t===C.OPAQUE);if(!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return s;const e=this.techniques.get(R,this._splatTechniqueConfiguration),a=this.techniques.get(G,this._splatDepthTechniqueConfiguration),r=this.techniques.get(j),n=this.techniques.get(x);if(!(e.compiled&&a.compiled&&n.compiled&&r.compiled))return this.requestRender(1),s;const{fullWidth:o,fullHeight:h}=this.bindParameters.camera,l=this.fboCache,c=l.acquire(o,h,"gaussian color output");c.attachDepth(s.getAttachment(V));const p=this.renderingContext;p.bindFramebuffer(c.fbo),p.setClearColor(0,0,0,0),p.clear(16384),this._gaussianSplatParameters.totalGaussians=this._data.visibleGaussians,this._gaussianSplatParameters.splatOrder=this._data.orderTexture.texture,this._gaussianSplatParameters.splatAtlas=this._data.textureAtlas.texture;const m=Math.tan(.5*this.camera.fovY),u=m/h*o;i(this._tanFov,u,m);const d=h/(2*m);this._gaussianSplatParameters.focalLength=d,this._gaussianSplatParameters.tanFov=this._tanFov;const _=this.view.qualitySettings.gaussianSplat,g=_.minimumSplatPixelRadius*Math.sqrt(o*h)/Math.sqrt(2073600);this._gaussianSplatParameters.minSplatRadius=g,this._gaussianSplatParameters.minSplatOpacity=_.minimumOpacity,this._prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(e,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const f=l.acquire(o,h,"splat depth",8);f.attachDepth(s.getAttachment(V)),p.bindFramebuffer(f.fbo),p.setClearColor(0,0,0,0),p.clear(16384),this.renderingContext.bindTechnique(a,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const b=l.acquire(o,h,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),b.attachDepth(s.getAttachment(V)),p.bindFramebuffer(b.fbo),p.bindTechnique(n,this.bindParameters,this._gaussianSplatDepthCompositionParameters),p.screen.draw(),this._gaussianSplatCompositionParameters.color=s.getTexture(),this._gaussianSplatCompositionParameters.splatColor=c.getTexture(),p.bindFramebuffer(b.fbo),p.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),p.screen.draw(),c.release(),f.release(),b}intersect(t,s,e,i){const{gaussianPosition:a,intersectionRayDir:p,intersectionPlane:m,layerViewUid:g}=this,C=f(e,i);r(p,i,e);const q=1/n(p);o(p,p,q);const v=u();h(v,p),_(m,p[0],p[1],p[2],-l(p,e));const D=new U,T=new U,j=new Array;this._data.visibleGaussianTiles.forEach(r=>{const{maxScale:n}=r,o=r.obb.minimumDistancePlane(m),h=r.obb.maximumDistancePlane(m),u=h<0,_=null!=D.dist&&null!=T.dist&&D.dist<o*q&&T.dist>h*q;if(u||_)return;const f=b(r.obb.center,r.obb.radius+n);if(!P(f,C,null))return;if(!r.obb.intersectRay(e,p,n))return;const{positions:S,squaredScales:w,gaussianAtlasIndices:y}=r,x=y.length;for(let m=0;m<x;m++){const r=3*m;a[0]=S[r]-e[0],a[1]=S[r+1]-e[1],a[2]=S[r+2]-e[2];const n=w[m],o=l(a,p),h=o*o;if(c(a)-h>n)continue;const u=o*q,_=t=>(t.point=t.point?t.point.fill(a[0],a[1],a[2]):d(a),t.dist=u,t.normal=v,t.layerViewUid=g,t);if((null==D.dist||u<D.dist)&&(null==s||s(e,i,u))&&_(D),0!==t.options.store&&(null==T.dist||u>T.dist)&&(null==s||s(e,i,u))&&_(T),2===t.options.store&&(null==s||s(e,i,u))){const t=new U;j.push(_(t))}}});const y=(t,s)=>{const{layerViewUid:e}=s,i=new S(s.point,e);t.set(0,i,s.dist,s.normal)};if(F(D)){const s=t.results.min;(null==s.distance||D.dist<s.distance)&&y(s,D)}if(F(T)&&0!==t.options.store){const s=t.results.max;(null==s.distance||T.dist>s.distance)&&y(s,T)}if(2===t.options.store)for(const r of j){const s=new w(C);y(s,r),t.results.all.push(s)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(t){this._slicePlaneEnabled!==t&&(this._slicePlaneEnabled=t,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const t=this.view.state.camera.eye,s=this.view.state.camera.ray.direction,e=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>e||Math.abs(t[1]-this._previousCameraPosition[1])>e||Math.abs(t[2]-this._previousCameraPosition[2])>e||Math.abs(s[0]-this._previousCameraDirection[0])>e||Math.abs(s[1]-this._previousCameraDirection[1])>e||Math.abs(s[2]-this._previousCameraDirection[2])>e)&&this._data.requestSort()}_prepareHighPrecisionCameraPosition(){o(this._tempVec,this.camera.eye,1/I.tileSize),p(this._tempVec,this._tempVec),m(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,o(this._tempVec,this._tempVec,I.tileSize),r(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}static{this.tileSize=2.048}};function F(t){return null!=t.dist&&null!=t.point}M=I=t([e("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],M);class U{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{M as GaussianSplatRenderNode};
5
+ import{__decorate as t}from"tslib";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as r,b as n,h as o,u as h,f as l,m as c,J as u,d as p}from"../../../../chunks/vec32.js";import{create as m,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g}from"../../../../chunks/vec42.js";import{create as f}from"../../../../geometry/support/plane.js";import{fromPoints as _}from"../../../../geometry/support/ray.js";import{j as b,i as P}from"../../../../chunks/sphere.js";import{RenderCategory as C}from"../../webgl.js";import{GaussianSplatTarget as S}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as q}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import v from"../../webgl/RenderNode.js";import{IntersectorResult as w}from"./IntersectorResult.js";import{G as T}from"../../../../chunks/GaussianSplat.glsl.js";import{G as D}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as j}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as y}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as x}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as G}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as R}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as A}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as V,PrimitiveType as E}from"../../../webgl/enums.js";var I;let M=class extends v{constructor(){super(...arguments),this.gaussianPosition=m(),this.intersectionRayDir=m(),this.intersectionPlane=f(),this._slicePlaneEnabled=!1,this._data=null,this.produces=C.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._gaussianSplatParameters=new T,this._gaussianSplatCompositionParameters=new D,this._gaussianSplatDepthCompositionParameters=new y,this._splatTechniqueConfiguration=new A,this._splatDepthTechniqueConfiguration=new A(!0),this._previousCameraPosition=m(),this._previousCameraDirection=m(),this._tanFov=a(),this._tempVec=m(),this._cameraDelta=m(),this._coarseCameraPosition=m()}static{I=this}async initialize(){this._data=new q(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this._splatTechniqueConfiguration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._splatTechniqueConfiguration.terrainDepthTest=this.bindParameters.terrainDepthTest,this.techniques.precompile(R,this._splatTechniqueConfiguration),this._splatDepthTechniqueConfiguration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._splatDepthTechniqueConfiguration.terrainDepthTest=this.bindParameters.terrainDepthTest,this.techniques.precompile(G,this._splatDepthTechniqueConfiguration),this.techniques.precompile(j),this.techniques.precompile(x)}render(t){const s=t.find(({name:t})=>t===C.OPAQUE);if(!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return s;const e=this.techniques.get(R,this._splatTechniqueConfiguration),a=this.techniques.get(G,this._splatDepthTechniqueConfiguration),r=this.techniques.get(j),n=this.techniques.get(x);if(!(e.compiled&&a.compiled&&n.compiled&&r.compiled))return this.requestRender(1),s;const{fullWidth:o,fullHeight:h}=this.bindParameters.camera,l=this.fboCache,c=l.acquire(o,h,"gaussian color output");c.attachDepth(s.getAttachment(V));const u=this.renderingContext;u.bindFramebuffer(c.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this._gaussianSplatParameters.totalGaussians=this._data.visibleGaussians,this._gaussianSplatParameters.splatOrder=this._data.orderTexture.texture,this._gaussianSplatParameters.splatAtlas=this._data.textureAtlas.texture;const p=Math.tan(.5*this.camera.fovY),m=p/h*o;i(this._tanFov,m,p);const d=h/(2*p);this._gaussianSplatParameters.focalLength=d,this._gaussianSplatParameters.tanFov=this._tanFov;const g=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius*Math.sqrt(o*h)/Math.sqrt(2073600);this._gaussianSplatParameters.minSplatRadius=g,this._prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(e,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const f=l.acquire(o,h,"splat depth",8);f.attachDepth(s.getAttachment(V)),u.bindFramebuffer(f.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this.renderingContext.bindTechnique(a,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const _=l.acquire(o,h,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),_.attachDepth(s.getAttachment(V)),u.bindFramebuffer(_.fbo),u.bindTechnique(n,this.bindParameters,this._gaussianSplatDepthCompositionParameters),u.screen.draw(),this._gaussianSplatCompositionParameters.color=s.getTexture(),this._gaussianSplatCompositionParameters.splatColor=c.getTexture(),u.bindFramebuffer(_.fbo),u.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),u.screen.draw(),c.release(),f.release(),_}intersect(t,s,e,i){const{gaussianPosition:a,intersectionRayDir:u,intersectionPlane:p,layerViewUid:f}=this,C=_(e,i);r(u,i,e);const q=1/n(u);o(u,u,q);const v=m();h(v,u),g(p,u[0],u[1],u[2],-l(u,e));const T=new U,D=new U,j=new Array;this._data.visibleGaussianTiles.forEach(r=>{const{maxScale:n}=r,o=r.obb.minimumDistancePlane(p),h=r.obb.maximumDistancePlane(p),m=h<0,g=null!=T.dist&&null!=D.dist&&T.dist<o*q&&D.dist>h*q;if(m||g)return;const _=b(r.obb.center,r.obb.radius+n);if(!P(_,C,null))return;if(!r.obb.intersectRay(e,u,n))return;const{positions:S,squaredScales:w,gaussianAtlasIndices:y}=r,x=y.length;for(let p=0;p<x;p++){const r=3*p;a[0]=S[r]-e[0],a[1]=S[r+1]-e[1],a[2]=S[r+2]-e[2];const n=w[p],o=l(a,u),h=o*o;if(c(a)-h>n)continue;const m=o*q,g=t=>(t.point=t.point?t.point.fill(a[0],a[1],a[2]):d(a),t.dist=m,t.normal=v,t.layerViewUid=f,t);if((null==T.dist||m<T.dist)&&(null==s||s(e,i,m))&&g(T),0!==t.options.store&&(null==D.dist||m>D.dist)&&(null==s||s(e,i,m))&&g(D),2===t.options.store&&(null==s||s(e,i,m))){const t=new U;j.push(g(t))}}});const y=(t,s)=>{const{layerViewUid:e}=s,i=new S(s.point,e);t.set(0,i,s.dist,s.normal)};if(F(T)){const s=t.results.min;(null==s.distance||T.dist<s.distance)&&y(s,T)}if(F(D)&&0!==t.options.store){const s=t.results.max;(null==s.distance||D.dist>s.distance)&&y(s,D)}if(2===t.options.store)for(const r of j){const s=new w(C);y(s,r),t.results.all.push(s)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(t){this._slicePlaneEnabled!==t&&(this._slicePlaneEnabled=t,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const t=this.view.state.camera.eye,s=this.view.state.camera.ray.direction,e=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>e||Math.abs(t[1]-this._previousCameraPosition[1])>e||Math.abs(t[2]-this._previousCameraPosition[2])>e||Math.abs(s[0]-this._previousCameraDirection[0])>e||Math.abs(s[1]-this._previousCameraDirection[1])>e||Math.abs(s[2]-this._previousCameraDirection[2])>e)&&this._data.requestSort()}_prepareHighPrecisionCameraPosition(){o(this._tempVec,this.camera.eye,1/I.tileSize),u(this._tempVec,this._tempVec),p(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,o(this._tempVec,this._tempVec,I.tileSize),r(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}static{this.tileSize=2.048}};function F(t){return null!=t.dist&&null!=t.point}M=I=t([e("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],M);class U{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{M as GaussianSplatRenderNode};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import"../../../../core/has.js";import t from"../../../../core/Error.js";import{EventEmitter as e}from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as a}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as s,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as m,isTypedArray as l}from"../../../../core/typedArrayUtil.js";import{generateUID as h}from"../../../../core/uid.js";import{isBlobProtocol as d,isDataProtocol as p}from"../../../../core/urlUtils.js";import{whenVideoPlayable as _}from"../../../../layers/support/videoUtils.js";import{requestImage as u}from"../../../../request/image.js";import{loadImage as c}from"../../../../request/loadImage.js";import{createTextureKTX2 as g,createTextureBasis as x,estimateMemoryKTX2 as y,estimateMemoryBasis as f}from"./BasisUtil.js";import{createDDSTexture as F}from"./DDSUtil.js";import{ensureImageMaxSize as E}from"./textureUtils.js";import{assert as T}from"./Util.js";import{Texture as D}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";import{getFormatComponents as A}from"../../../webgl/Util.js";class M{constructor(t,r){this._data=t,this.id=h(),this.events=new e,this._parameters={...L,...r},this._startPreload(t)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(t){t instanceof HTMLVideoElement?(this.update=e=>this._update(t,e),this._startPreloadVideoElement(t)):t instanceof HTMLImageElement&&this._startPreloadImageElement(t)}_startPreloadVideoElement(t){if(!(d(t.src)||"auto"===t.preload&&t.crossOrigin)&&(t.preload="auto",t.crossOrigin="anonymous",t.src=t.src,t.paused&&t.autoplay)){const e=[];_(t,t=>e.push(t)).then(()=>{t.play()}).finally(()=>e.forEach(t=>t.remove()))}}_startPreloadImageElement(t){p(t.src)||d(t.src)||t.crossOrigin||(t.crossOrigin="anonymous",t.src=t.src)}_createDescriptor(t){const e=new w;return e.wrapMode=this._parameters.wrap??10497,e.flipped=!this._parameters.noUnpackFlip,e.samplingMode=this._parameters.mipmap?9987:9729,e.hasMipmap=!!this._parameters.mipmap,e.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,e.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?t.parameters.maxMaxAnisotropy:1),e.dataType=this._parameters.dataType??e.dataType,e.pixelFormat=this._parameters.pixelFormat??e.pixelFormat,e.internalFormat=this._parameters.internalFormat??e.internalFormat,e}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return this._texture?.usedMemory||v(this._data,this._parameters)}load(t){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;const e=this._data;return null==e?(this._texture=new D(t,this._createDescriptor(t),null),this._texture):(this._emptyTexture=t.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof e?this._loadFromURL(t,e):e instanceof Image?this._loadFromImageElement(t,e):e instanceof HTMLVideoElement?this._loadFromVideoElement(t,e):e instanceof ImageData||e instanceof HTMLCanvasElement?this._loadFromImage(t,e):n(e)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(t,e):m(e)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(t,new Uint8Array(e)):(m(e)||n(e))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(t,e):(m(e)||n(e))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(t,e):m(e)?this._loadFromPixelData(t,new Uint8Array(e)):l(e)?this._loadFromPixelData(t,e):null)}_update(t,e){return null==this._texture||t.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||e===t.currentTime?e:(this._texture.setData(t),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),t.currentTime)}_loadFromDDSData(t,e){return this._texture=F(t,this._createDescriptor(t),e),this._emptyTexture=null,this._texture}_loadFromKTX2(t,e){return this._loadAsync(()=>g(t,this._createDescriptor(t),e).then(t=>(this._texture=t,t)))}_loadFromBasis(t,e){return this._loadAsync(()=>x(t,this._createDescriptor(t),e).then(t=>(this._texture=t,t)))}_loadFromPixelData(t,e){T(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(t);return 6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new D(t,r,e),this._texture}_loadFromURL(t,e){return this._loadAsync(async r=>{const a=await u(e,{signal:r});return i(r),this._loadFromImage(t,a)})}_loadFromImageElement(t,e){return e.complete?this._loadFromImage(t,e):this._loadAsync(async r=>{const a=await c(e,e.src,!1,r);return i(r),this._loadFromImage(t,a)})}_loadFromVideoElement(t,e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(t,e):this._loadFromVideoElementAsync(t,e)}_loadFromVideoElementAsync(e,r){return this._loadAsync(i=>new Promise((n,m)=>{const l=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",d),a(p)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),n(this._loadFromImage(e,r)))},d=e=>{l(),m(e||new t("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",d);const p=s(i,()=>d(o()))}))}_loadFromImage(t,e){let r=e;r instanceof HTMLVideoElement||(r=E(r,t.parameters));const a=j(r);this._parameters.width=a.width,this._parameters.height=a.height;const i=this._createDescriptor(t);return i.width=a.width,i.height=a.height,i.compress=this._parameters.compressionOptions,this._texture=new D(t,i,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(t){const e=new AbortController;this._loadingController=e;const r=t(e.signal);this._loadingPromise=r;const a=()=>{this._loadingController===e&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(a,a),r}unload(){if(this._texture=r(this._texture),this._emptyTexture=null,null!=this._loadingController){const t=this._loadingController;this._loadingController=null,this._loadingPromise=null,t.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function v(t,e){if(null==t)return 0;if(m(t)||n(t))return"image/ktx2"===e.encoding?y(t,!!e.mipmap):"image/x.basis"===e.encoding?f(t,!!e.mipmap):t.byteLength;const{width:r,height:a}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?j(t):e,i=e.pixelFormat??6408,s=A(i);return(e.mipmap?4/3:1)*r*a*s||0}function j(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}const L={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{M as ManagedTexture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{ColorAttachment0 as e,ColorAttachment1 as t,ColorAttachment2 as n}from"../../../webgl/enums.js";import{defaultDepthWrite as s,separateBlendingParams as u,premultipliedAlpha as c,unpremultipliedAlphaToPremultipliedAlpha as o}from"../../../webgl/renderState.js";const f=u(1,0,1,771);function a(r,e=!1){switch(r){case 0:return e?c:o;case 1:return f;case 2:case 3:return null}}function i(r){if(r.draped)return null;switch(r.oitPass){case 0:case 2:return r.writeDepth?s:null;case 1:case 3:return null}}const l=5e5,b={factor:-1,units:-2};function m({oitPass:r,enableOffset:e}){return e&&1===r?b:null}function p(r,e=513){return 0===r||2===r?e:515}function d(s,u){const c=r(u);return 1===s?c?{buffers:[e,t,n]}:{buffers:[e,t]}:c?{buffers:[e,t]}:null}export{b as OITPolygonOffset,l as OITPolygonOffsetLimit,a as blending,f as blendingColorAlpha,i as depthWrite,d as getDrawBuffers,p as oitDepthTest,m as oitPolygonOffset};
5
+ import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{ColorAttachment0 as e,ColorAttachment1 as t,ColorAttachment2 as n}from"../../../webgl/enums.js";import{defaultDepthWrite as s,separateBlendingParams as u,premultipliedAlpha as c,unpremultipliedAlphaToPremultipliedAlpha as o}from"../../../webgl/renderState.js";const f=u(1,0,1,771);function a(r,e=!1){switch(r){case 0:return e?c:o;case 1:return f;case 2:case 3:return null}}function i(r){if(r.draped)return null;switch(r.oitPass){case 0:case 2:return r.writeDepth?s:null;case 1:case 3:return null}}const l={factor:-1,units:-2},b=5e5;function m({oitPass:r,enableOffset:e}){return e&&1===r?l:null}function p(r,e=513){return 0===r||2===r?e:515}function d(s,u){const c=r(u);return 1===s?c?{buffers:[e,t,n]}:{buffers:[e,t]}:c?{buffers:[e,t]}:null}export{l as OITPolygonOffset,b as OITPolygonOffsetLimit,a as blending,f as blendingColorAlpha,i as depthWrite,d as getDrawBuffers,p as oitDepthTest,m as oitPolygonOffset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{webglDebugEnabled as t}from"../../../webgl/checkWebGLError.js";class r{constructor(r,e,i){this._context=r,this.locations=i,this._textures=new Map,this.source=t()?e:null,e.attributeNames.forEach(t=>{i.has(t)||console.error(`Missing VertexAttributeLocation for ${t} used in shader`)}),this._glProgram=r.programCache.acquire(e.generate("vertex",!0),e.generate("fragment",!0),i),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=e.generateBind(this),this.bindPass=e.generateBindPass(this),this.bindDraw=e.generateBindDraw(this)}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,r){this._glProgram.setUniform1i(t,r?1:0)}setUniform1i(t,r){this._glProgram.setUniform1i(t,r)}setUniform1f(t,r,e){this._glProgram.setUniform1f(t,r,e)}setUniform2fv(t,r,e){this._glProgram.setUniform2fv(t,r,e)}setUniform3fv(t,r,e){this._glProgram.setUniform3fv(t,r,e)}setUniform4fv(t,r,e){this._glProgram.setUniform4fv(t,r,e)}setUniformMatrix3fv(t,r,e){this._glProgram.setUniformMatrix3fv(t,r,!1,e)}setUniformMatrix4fv(t,r,e){this._glProgram.setUniformMatrix4fv(t,r,!1,e)}setUniformMatrices4fv(t,r,e){this._glProgram.setUniformMatrices4fv(t,r,!1,e)}setUniform1fv(t,r,e){this._glProgram.setUniform1fv(t,r,e)}setUniform1iv(t,r){this._glProgram.setUniform1iv(t,r)}setUniform2iv(t,r){this._glProgram.setUniform2iv(t,r)}setUniform3iv(t,r){this._glProgram.setUniform3iv(t,r)}setUniform4iv(t,r){this._glProgram.setUniform4iv(t,r)}assertCompatibleVertexAttributeLocations(t,r){let e=t.locations;if(r){const t=new Map(e);r.forEach((r,i)=>t.set(i,e.size+r)),e=t}e.size!==this.locations.size&&console.error(`VertexAttributeLocations are incompatible: ${e}, ${this.locations}`),this.locations.forEach((t,r)=>{e.get(r)!==t&&console.error(`VertexAttributeLocations are incompatible: Program has ${r} at position ${t}, VAO has it at position ${e.get(r)}.`)})}stop(){this._textures.clear()}bindTexture(r,e){e?.glName||(t()&&console.error(`Texture sampler ${r} has no given Texture in ${(new Error).stack} `),e=this._context.emptyTexture);const i=this._ensureTextureUnit(r,e);this._context.useProgram(this),this.setUniform1i(r,i.unit),this._context.bindTexture(e,i.unit)}_ensureTextureUnit(t,r){let e=this._textures.get(t);return null==e?(e={texture:r,unit:this._textures.size},this._textures.set(t,e)):e.texture=r,e}}export{r as Program};
5
+ import"../../../../core/has.js";import{webglDebugEnabled as t}from"../../../webgl/checkWebGLError.js";class r{constructor(r,e,i){this._context=r,this.locations=i,this._textures=new Map,this.source=t()?e:null,e.attributeNames.forEach(t=>{i.has(t)||console.error(`Missing VertexAttributeLocation for ${t} used in shader`)}),this._glProgram=r.programCache.acquire(e.generate("vertex",!0),e.generate("fragment",!0),i),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=e.generateBind(this),this.bindPass=e.generateBindPass(this),this.bindDraw=e.generateBindDraw(this)}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,r){this._glProgram.setUniform1i(t,r?1:0)}setUniform1i(t,r){this._glProgram.setUniform1i(t,r)}setUniform1f(t,r,e){this._glProgram.setUniform1f(t,r,e)}setUniform2fv(t,r,e){this._glProgram.setUniform2fv(t,r,e)}setUniform3fv(t,r,e){this._glProgram.setUniform3fv(t,r,e)}setUniform4fv(t,r,e){this._glProgram.setUniform4fv(t,r,e)}setUniformMatrix3fv(t,r,e){this._glProgram.setUniformMatrix3fv(t,r,!1,e)}setUniformMatrix4fv(t,r,e){this._glProgram.setUniformMatrix4fv(t,r,!1,e)}setUniformMatrices4fv(t,r,e){this._glProgram.setUniformMatrices4fv(t,r,!1,e)}setUniform1fv(t,r,e){this._glProgram.setUniform1fv(t,r,e)}setUniform1iv(t,r){this._glProgram.setUniform1iv(t,r)}setUniform2iv(t,r){this._glProgram.setUniform2iv(t,r)}setUniform3iv(t,r){this._glProgram.setUniform3iv(t,r)}setUniform4iv(t,r){this._glProgram.setUniform4iv(t,r)}assertCompatibleVertexAttributeLocations(t,r){let e=t.locations;if(r){const t=new Map(e);r.forEach((r,i)=>t.set(i,e.size+r)),e=t}e.size!==this.locations.size&&console.error(`VertexAttributeLocations are incompatible: ${e}, ${this.locations}`),this.locations.forEach((t,r)=>{e.get(r)!==t&&console.error(`VertexAttributeLocations are incompatible: Program has ${r} at position ${t}, VAO has it at position ${e.get(r)}.`)})}stop(){this._textures.clear()}bindTexture(r,e){if(!e?.glName){const i=`Texture sampler ${r} in ${this._context.debugBoundTechnique} has no given Texture in ${(new Error).stack}`;t()&&console.error(i),e=this._context.emptyTexture}const i=this._ensureTextureUnit(r,e);this._context.useProgram(this),this.setUniform1i(r,i.unit),this._context.bindTexture(e,i.unit)}_ensureTextureUnit(t,r){let e=this._textures.get(t);return null==e?(e={texture:r,unit:this._textures.size},this._textures.set(t,e)):e.texture=r,e}}export{r as Program};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";function t(t=!has("disable-feature:high-quality-idle"),s=null){const o=new e;return t?(o.set(2,0,"low"!==s),o.set(2,3,"low"!==s),o.set(2,1,!0),o.set(2,4,!0),o.set(2,5,!0),o.set(2,8,!0)):(o.set(0,6,!0),o.set(0,7,!0),o.set(1,6,!0),o.set(1,7,!0)),o.set(2,6,!0),o.set(2,7,!0),o.set(2,2,!0),o}export{t as setupFeatureDefaults};
5
+ import{NestedMap as e}from"../../../../core/NestedMap.js";function t(t){const f=new e;if("low"!==t&&(f.set(2,0,!0),f.set(2,3,!0),f.set(2,8,!0)),f.set(2,1,!0),f.set(2,4,!0),f.set(2,5,!0),f.set(2,6,!0),f.set(2,7,!0),f.set(2,2,!0),"medium"===t)for(const e of s)f.set(0,e,!0),f.set(1,e,!0),f.set(2,e,!0);else if("high"===t)for(const e of o)f.set(0,e,!0),f.set(1,e,!0),f.set(2,e,!0);return f}const s=[1],o=[...s,0,3,4,5];export{t 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as E}from"../../../../chunks/vec42.js";import{ZEROS as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as I,InternalRenderCategory as R}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as v}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as q}from"../core/renderPasses/RenderPassManager.js";import{isColorEmission as N,isColorOrColorEmission as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as z}from"../effects/transparency/OITBlend.js";import{AnimationTimer as Q}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{DepthRange as Z}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as K}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as re}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as ue,ColorAttachment2 as pe}from"../../../webgl/enums.js";let me=class extends te{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new q,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Z.Infinite),this._state=c(2),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new X(this.fboCache),this._performanceInfo=new de(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(4,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new $(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_(()=>e.view.state.camera,()=>n(),u),_(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),_(()=>e.view.environment.background?.color,e=>{const t=e?i(e):y;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),_(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=L,u),_(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),_(()=>this._bindParameters.clouds.data?.state,()=>n(),m),_(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Y.prune(),he.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(5))}get _hasHighlights(){return this._plugins.produces(9,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(9,13,14)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(4))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(_(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(3,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new Q(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(I.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=K,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(l-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),l=this._nodes.produces(I.FINAL),_=this.hasEmitters,u=_?1:0;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(R.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,_);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const f=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(0,...be);this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const b=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,b),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(f,g,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._renderOpaque(f),this._renderTransparent(g,f,u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(R.CUTFILL_DEPTH,this._renderCutFillDepth()),m.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(R.VIEWSHED,e)),m.update(e=>this._renderNodes(R.LASERLINES,e)),m.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.CUTFILL_DEPTH),m.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,b);const P=2===r?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(I.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const C=s&&!l&&!(d&&!i),w=this._pluginInput.get(I.COMPOSITE),T=C?M:this.fboCache.acquire(w.fbo.width,w.fbo.height,R.ANTIALIASING),S=this._nodes.produces(R.ANTIALIASING)?this._renderNodes(R.ANTIALIASING,T):this.blitFBO(w,T,!1);let E;this._pluginInput.set(R.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(1,S,u),E=this._renderNodes(R.HIGHLIGHTS,S)):(E=this._renderNodes(R.HIGHLIGHTS,S),this._renderHUD(1,E,u));const x=this._renderNodes(R.MAGNIFIER,E);return s&&d&&!i&&!l&&this.blitFBO(x),l?(x.attachDepth(m.depth),this.blitFBO(this._renderNodes(I.FINAL,x)),x.detachDepth()):this._pluginInput.set(I.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new oe(this._pluginInput.get(I.FINAL),P)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(R.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=2,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(R.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(R.VIEWSHED,R.CUTFILL_DEPTH,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING,R.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(i.highlights.forEach((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(9)}),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(I.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(y),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._renderContext.output,i=this._framebufferSize,s=this.fboCache.acquire(i.width,i.height,"edges"),a=()=>t.render(this._bindParameters,e),n=this._bindParameters.geometryDepth;this.renderToTargets(a,s,n??this._framebuffer.depth,y),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(6,this._shadowMap),s.copySnapshot(1),this._renderShadowCascades(5,this._shadowMap)):this._renderShadowCascades(4),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(5,this._shadowMap),s.moveSnapshot(0),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(R.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(2)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(R.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(2),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(le.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(2),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=2;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(2),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Z.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Z.Infinite);const t=e.clone();t.near=v,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(3),this._needsDepth&&this._precompileAllGeometry(2),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(5),this._precompileShadowCascades(6),this._precompileShadowCascades(5)):this._precompileShadowCascades(4)),this._shadowAccumulator.active&&this._precompileAllGeometry(4)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(y,!0,!0),this._renderGeometryWithNormals(3);const i=this._nodes.optional("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(R.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(le.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(7)}precompileCutFill(){const e=8,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(7),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=8,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...ce),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._plugins.precompile(...ge),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...ge)}_renderTransparentGeometry(){this._plugins.render(...be)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(le.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=9,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(1,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture(),0),i.release()}else if(this._renderContext.output=r,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(5,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?3:1);a.acquireDepth(13);const n=this._plugins.produces(9,0);return n&&this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),n||t.clear(1024),this._renderContext.output=9,t.bindFramebuffer(a.fbo),k(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(le.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0):this._plugins.precompile(...be)}_renderOIT(e,t,r=2){const i=1===e,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=1;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,8),_=1===t;_&&l.acquireColor(ue,8,"oit emissive"),l.acquireColor(_?pe:ue,7),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,x),n(),l.detachDepth(),h.oitPass=2;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(ue,8,"oit emissive front"),a?u.acquireDepth(12):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(y,!!a),n(),u.detachDepth(),h.oitPass=0,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new z(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_,!i),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(0,...ge);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(R.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(I.OPAQUE,e,t)),this.fboCache.debugCallback?.(I.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(20,le.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry()),i.update(t=>this._renderNodes(I.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(I.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(0,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0)));const a=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;a&&(i.bind(),this._compositingHelper.composite(this._bindParameters,a.getTexture(),N(r)?1:0),a.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(Ee,Se,Te),w(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),w(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],me.prototype,"fullResolutionAtmosphere",null),e([g()],me.prototype,"_edgeView",void 0),e([g()],me.prototype,"updating",null),me=e([b("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,4],fe=[3,5],ge=[0,1,2,3],be=[4,5],Pe=[2,4,8],Ce=[16,13,14],we=[4,5,2,3,6,0,1],Te=S(),Se=S(),Ee=S();function xe(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
5
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as x}from"../../../../chunks/vec42.js";import{ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as I}from"../../../../geometry/support/Indices.js";import{RenderCategory as R,InternalRenderCategory as y}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as v}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColorEmission as q,isColorOrColorEmission as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as z}from"../effects/transparency/OITBlend.js";import{AnimationTimer as W}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{DepthRange as Z}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as K}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as re}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as _e}from"../statistics/RendererPerformanceInfo.js";import{PixelType as le,ColorAttachment1 as ue,ColorAttachment2 as pe}from"../../../webgl/enums.js";let me=class extends te{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Z.Infinite),this._state=c(2),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(re(e.view.qualityProfile)),this._framebuffer=new X(this.fboCache),this._performanceInfo=new de(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(4,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new $(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l(()=>e.view.state.camera,()=>n(),u),l(()=>v.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),l(()=>e.view.environment.background?.color,e=>{const t=e?i(e):D;x(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),l(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=L,u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),l(()=>this._bindParameters.clouds.data?.state,()=>n(),m),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Y.prune(),he.prune(),I()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=re(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(9,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(9,13,14)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ee(this.stage.view.resourceController)});return this.addHandles(l(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(3,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(R.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=K,l=this.stage.view,u=l.stateManager.camera,p=l.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(_-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),_=this._nodes.produces(R.FINAL),l=this.hasEmitters,u=l?1:0;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(y.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(y.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,l);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const f=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(0,...be);this._precompilePrepasses(),this.performanceInfo.advance(_e.PREPARE);const b=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,b),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(f,g,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._renderOpaque(f),this._renderTransparent(g,f,u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(y.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(y.CUTFILL_DEPTH,this._renderCutFillDepth()),m.update(e=>this._renderNodes(y.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(y.VIEWSHED,e)),m.update(e=>this._renderNodes(y.LASERLINES,e)),m.update(e=>this._renderNodes(y.FOCUSAREA_COLOR,e)),this._pluginInput.release(y.FOCUSAREA),this._pluginInput.release(y.CUTFILL_DEPTH),m.update(e=>this._renderNodes(y.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,b);const P=2===r?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(R.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const C=s&&!_&&!(d&&!i),w=this._pluginInput.get(R.COMPOSITE),T=C?M:this.fboCache.acquire(w.fbo.width,w.fbo.height,y.ANTIALIASING),S=this._nodes.produces(y.ANTIALIASING)?this._renderNodes(y.ANTIALIASING,T):this.blitFBO(w,T,!1);let x;this._pluginInput.set(y.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(1,S,u),x=this._renderNodes(y.HIGHLIGHTS,S)):(x=this._renderNodes(y.HIGHLIGHTS,S),this._renderHUD(1,x,u));const E=this._renderNodes(y.MAGNIFIER,x);return s&&d&&!i&&!_&&this.blitFBO(E),_?(E.attachDepth(m.depth),this.blitFBO(this._renderNodes(R.FINAL,E)),E.detachDepth()):this._pluginInput.set(R.FINAL,E),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new oe(this._pluginInput.get(R.FINAL),P)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(y.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=2,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(y.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(y.VIEWSHED,y.CUTFILL_DEPTH,y.CUTFILL_COLOR,y.LASERLINES,y.FOCUSAREA_COLOR,y.OCCLUDED,y.ANTIALIASING,y.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(i.highlights.forEach((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(9)}),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(R.COMPOSITE,y.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(y.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(_e.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(_e.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(D),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,le.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,le.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._renderContext.output,i=this._framebufferSize,s=this.fboCache.acquire(i.width,i.height,"edges"),a=()=>t.render(this._bindParameters,e),n=this._bindParameters.geometryDepth;this.renderToTargets(a,s,n??this._framebuffer.depth,D),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),q(r)?1:0),s.release(),this.performanceInfo.advance(1===e?_e.OPAQUE_EDGES:_e.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(_e.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(6,this._shadowMap),s.copySnapshot(1),this._renderShadowCascades(5,this._shadowMap)):this._renderShadowCascades(4),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(_e.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(5,this._shadowMap),s.moveSnapshot(0),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(_e.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(y.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(2)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(y.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(2),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(_e.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(2),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(_e.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return;const t=this._renderContext.output;this._renderContext.output=2;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),this._bindParameters.terrainDepth=i.obtainDepthTexture(),i.release(),this._renderContext.output=t}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(2),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Z.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Z.Infinite);const t=e.clone();t.near=F,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED,y.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(3),this._needsDepth&&this._precompileAllGeometry(2),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(5),this._precompileShadowCascades(6),this._precompileShadowCascades(5)):this._precompileShadowCascades(4)),this._shadowAccumulator.active&&this._precompileAllGeometry(4)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(D,!0,!0),this._renderGeometryWithNormals(3);const i=this._nodes.optional("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(_e.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(y.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(_e.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(7)}precompileCutFill(){const e=8,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(7),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=8,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...ce),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._plugins.precompile(...ge),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...ge)}_renderTransparentGeometry(){this._plugins.render(...be)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,D),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,D),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(_e.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=9,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(1,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture(),0),i.release()}else if(this._renderContext.output=r,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?_e.HUD_OCCLUDED:_e.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(5,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?3:1);a.acquireDepth(13);const n=this._plugins.produces(9,0);return n&&this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),n||t.clear(1024),this._renderContext.output=9,t.bindFramebuffer(a.fbo),k(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(_e.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(_e.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0):this._plugins.precompile(...be)}_renderOIT(e,t,r=2){const i=1===e,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=1;const d=a?"oit hud color+alpha":"oit color+alpha",_=this.fboCache.acquire(s.width,s.height,d,8),l=1===t;l&&_.acquireColor(ue,8,"oit emissive"),_.acquireColor(l?pe:ue,7),a||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,E),n(),_.detachDepth(),h.oitPass=2;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return l&&u.acquireColor(ue,8,"oit emissive front"),a?u.acquireDepth(12):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(D,!!a),n(),u.detachDepth(),h.oitPass=0,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new z(this._techniques),this._oitblend.blend(this._rctx,_,u,h,l,!i),a?.detachDepth(),u.release(),_.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(0,...ge);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(y.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(y.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(R.OPAQUE,e,t)),this.fboCache.debugCallback?.(R.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(y.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(y.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(20,_e.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry()),i.update(t=>this._renderNodes(R.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(R.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(_e.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(0,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),q(r)?1:0),s.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry(),this.performanceInfo.advance(_e.TRANSPARENT)),this._renderEdges(0)));const a=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;a&&(i.bind(),this._compositingHelper.composite(this._bindParameters,a.getTexture(),q(r)?1:0),a.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(_e.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(_e.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(xe,Se,Te),w(xe,this._renderContext.lastFrameCamera.viewMatrix,xe),w(xe,this._renderContext.lastFrameCamera.projectionMatrix,xe),this._reprojectionMatrix=xe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],me.prototype,"highResolutionAtmosphere",null),e([g()],me.prototype,"_edgeView",void 0),e([g()],me.prototype,"updating",null),me=e([b("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,4],fe=[3,5],ge=[0,1,2,3],be=[4,5],Pe=[2,4,8],Ce=[16,13,14],we=[4,5,2,3,6,0,1],Te=S(),Se=S(),xe=S();function Ee(e){return t=>e.immediate.schedule(t)}export{me 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{ScreenSpaceGeometry as e}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as s}from"./glUtil3D.js";import{VaoCache as r}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class a extends i{constructor(r,t){super(r,t),this.emptyTexture=s(this),this._vaoCaches=new Map,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this._screen=new e(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._appleAmdDriverHelper?.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){const s=JSON.stringify(e),t=this._vaoCaches.get(s);if(t)return t;const i=new r(this,e);return this._vaoCaches.set(s,i),i}bindTechnique(e,s,r,t){return this.useProgram(e.program),this.setPipelineState(e.getPipeline()),e.program.bind(s),r&&(e.program.bindPass(r,s),t&&e.program.bindDraw(s,r,t)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),s=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=s??!0}return this._isAssumedMetalDriver}get test(){}}export{a as RenderingContext};
5
+ import has from"../../../../core/has.js";import{ScreenSpaceGeometry as e}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as s}from"./glUtil3D.js";import{VaoCache as r}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class a extends i{constructor(r,t){super(r,t),this.emptyTexture=s(this),this._vaoCaches=new Map,this.debugBoundTechnique="",this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this._screen=new e(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._appleAmdDriverHelper?.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){const s=JSON.stringify(e),t=this._vaoCaches.get(s);if(t)return t;const i=new r(this,e);return this._vaoCaches.set(s,i),i}bindTechnique(e,s,r,t){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline()),e.program.bind(s),r&&(e.program.bindPass(r,s),t&&e.program.bindDraw(s,r,t)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),s=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=s??!0}return this._isAssumedMetalDriver}get test(){}}export{a as RenderingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{EventEmitter as s}from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as h}from"../../../../core/uid.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{textTextureAtlas as d}from"./testUtils.js";import{applyTextureResizeModuloCeil as u}from"./textureUtils.js";import{TaskPriority as m}from"../../../support/Scheduler.js";import{Yield as g}from"../../../support/Yield.js";import{Texture as p}from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";const x=4096;let v=class extends t{constructor(e){super(e),this.id=h(),this.events=new s,this._glTexture=null,this._atlas=new y(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view.stage,this._stage.addTexture(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get loaded(){return null!=this._glTexture}get glTexture(){return this._glTexture}static get maxSize(){return b=d.stableRendering?T:0,[x-T-b,x-T-b-w]}load(e){if(this._glTexture)return this._glTexture;const t=new f;return t.wrapMode=33071,t.samplingMode=9987,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new p(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(m.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._glTexture&&(this._stage.removeTexture(this),this._glTexture=i(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._glTexture?.resize(e,t),this._glTexture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach(e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach(t=>t(e.uv))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let h=r.cursors.get(i);if(!h){if(r.height<r.nextY+i)return!1;h=[new R(r.nextY)],r.cursors.set(i,h),r.nextY+=i}let n=h.find(e=>r.width>=e.x+s);if(null==n){if(r.height<r.nextY+i)return!1;n=new R(r.nextY),r.nextY+=i,h.push(n)}return e.setNewPosition(n),this._elements.set(t,e),this._elementsToRender.set(t,e),n.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,h=i+T,n=r+T+w;if(!this._addAtlasElement(e,t,h,n)){if(this._canRepack)this._reset();else if(s.width<h){const e=u(Math.max(h,1.5*s.width),x);this._resizeAtlas(e,s.height)}else{const e=s.nextY+n,t=u(Math.max(e,1.5*s.height),x);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<x){const e=u(1.5*s.width,x);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-T,t[1]-T,s.renderedWidth+2*T,s.renderedHeight+2*T),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach(t=>t(e.uv))}get readyToRun(){return this.updating}runTask(e){if(null==this._glTexture)return g;for(;this._needsRepack&&(this._canRepack||this._atlas.height<x&&this._atlas.height<x);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach(e=>this._processAddition(e)),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new k(e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._glTexture&&(this.updating=!0)}get test(){}get usedMemory(){return(this._glTexture?.usedMemory??0)+(this._canvas?.width??0)*(this._canvas?.height??0)*4}};e([n({constructOnly:!0})],v.prototype,"view",void 0),e([n({type:Boolean})],v.prototype,"updating",void 0),v=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],v);const T=2,w=2;class k{constructor(e){this.textRenderer=e,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset,this._yOffset+t,this._xOffset+e,this._yOffset)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class y{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=b}}class R{constructor(e){this.y=e,this.x=b}}let b=0;export{v as TextTextureAtlas};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{EventEmitter as s}from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as h}from"../../../../core/uid.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{textTextureAtlas as d}from"./testUtils.js";import{applyTextureResizeModuloCeil as u}from"./textureUtils.js";import{TaskPriority as m}from"../../../support/Scheduler.js";import{Yield as p}from"../../../support/Yield.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const g=4096;let v=class extends t{constructor(e){super(e),this.id=h(),this.events=new s,this._texture=null,this._atlas=new R(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view.stage,this._stage.addTexture(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._texture=i(this._texture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get loaded(){return null!=this._texture}get texture(){return this._texture}static get maxSize(){return b=d.stableRendering?w:0,[g-w-b,g-w-b-k]}load(e){if(this._texture)return this._texture;const t=new x;return t.wrapMode=33071,t.samplingMode=9987,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._texture=new f(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(m.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._texture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._texture&&(this._stage.removeTexture(this),this._texture=i(this._texture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._texture?.resize(e,t),this._texture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach(e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach(t=>t(e.uv))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let h=r.cursors.get(i);if(!h){if(r.height<r.nextY+i)return!1;h=[new T(r.nextY)],r.cursors.set(i,h),r.nextY+=i}let n=h.find(e=>r.width>=e.x+s);if(null==n){if(r.height<r.nextY+i)return!1;n=new T(r.nextY),r.nextY+=i,h.push(n)}return e.setNewPosition(n),this._elements.set(t,e),this._elementsToRender.set(t,e),n.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,h=i+w,n=r+w+k;if(!this._addAtlasElement(e,t,h,n)){if(this._canRepack)this._reset();else if(s.width<h){const e=u(Math.max(h,1.5*s.width),g);this._resizeAtlas(e,s.height)}else{const e=s.nextY+n,t=u(Math.max(e,1.5*s.height),g);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<g){const e=u(1.5*s.width,g);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-w,t[1]-w,s.renderedWidth+2*w,s.renderedHeight+2*w),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach(t=>t(e.uv))}get readyToRun(){return this.updating}runTask(e){if(null==this._texture)return p;for(;this._needsRepack&&(this._canRepack||this._atlas.height<g&&this._atlas.height<g);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach(e=>this._processAddition(e)),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._texture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new y(e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._texture&&(this.updating=!0)}get test(){}get usedMemory(){return(this._texture?.usedMemory??0)+(this._canvas?.width??0)*(this._canvas?.height??0)*4}};e([n({constructOnly:!0})],v.prototype,"view",void 0),e([n({type:Boolean})],v.prototype,"updating",void 0),v=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],v);const w=2,k=2;class y{constructor(e){this.textRenderer=e,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset,this._yOffset+t,this._xOffset+e,this._yOffset)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class R{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=b}}class T{constructor(e){this.y=e,this.x=b}}let b=0;export{v as TextTextureAtlas};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{getTextHelperCanvas as e}from"./TextHelperCanvas.js";import{TextRenderer as r}from"./TextRenderer.js";import{TextTextureAtlas as t}from"./TextTextureAtlas.js";import{Texture as n}from"./Texture.js";class i{constructor(e,n,i){this._renderer=new r(e,n,i,t.maxSize)}get key(){return this._renderer.key}get baselineAnchorY(){return 1-this._renderer.firstRenderedBaselinePosition/this._renderer.renderedHeight}get displayWidth(){return this._renderer.displayWidth}get displayHeight(){return this._renderer.displayHeight}create(){const r=e(s,this._renderer.renderedWidth,this._renderer.renderedHeight),t=r.getContext("2d");return t.save(),this._renderer.render(t,0,0),t.restore(),new n(r,{wrap:{s:33071,t:33071},noUnpackFlip:!1,mipmap:!0,preMultiplyAlpha:!0})}}const s={canvas:null};export{i as default};
5
+ import{ManagedTexture as e}from"./ManagedTexture.js";import{getTextHelperCanvas as r}from"./TextHelperCanvas.js";import{TextRenderer as t}from"./TextRenderer.js";import{TextTextureAtlas as n}from"./TextTextureAtlas.js";class i{constructor(e,r,i){this._renderer=new t(e,r,i,n.maxSize)}get key(){return this._renderer.key}get baselineAnchorY(){return 1-this._renderer.firstRenderedBaselinePosition/this._renderer.renderedHeight}get displayWidth(){return this._renderer.displayWidth}get displayHeight(){return this._renderer.displayHeight}create(){const t=r(s,this._renderer.renderedWidth,this._renderer.renderedHeight),n=t.getContext("2d");return n.save(),this._renderer.render(n,0,0),n.restore(),new e(t,{wrap:{s:33071,t:33071},noUnpackFlip:!1,mipmap:!0,preMultiplyAlpha:!0})}}const s={canvas:null};export{i 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{EventEmitter as r}from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{isUpdatableTexture as a}from"./ITexture.js";import{TextureUpdater as d}from"./TextureUpdater.js";import{TaskPriority as l}from"../../../support/Scheduler.js";let h=class extends t{constructor(e){super({}),this._stage=e,this._textures=new Map,this._loadingCount=0,this.events=new r,this.updater=new d,this._frameTask=e.view.resourceController.scheduler.registerTask(l.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this.updater.destroy(),this._textures.forEach(e=>e.unload())}get updating(){return this._loadingCount>0||this._frameTask.updating}acquire(e){const t=this._textures.get(e);return t?(t.ref(),t.loadingPromise??t):this._createNewRef(e)}update(){this.updater.run()&&this.events.emit("changed",0)}_createNewRef(e){const t=this._stage.getTexture(e);if(null==t)return null;const r=t.events.on("unloaded",()=>{r.remove(),this._onTextureUnloaded(t)}),n=new p(t,()=>{this._frameTask.schedule(()=>{n.isUnreferenced&&t.unload()})});return this._textures.set(e,n),n.ref(),t.loaded?(this._updateGLTexture(n,t.glTexture),a(t)&&this.updater.add(t),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule(()=>{const e=t.load(this._stage.renderView.renderingContext),r=e=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,e),a(t)&&this.updater.add(t),n),u=e=>(t.unload(),this._loadingCount--,n.loadingPromise=null,i(e)||s.getLogger(this).error(e),null);return o(e)?e.then(r,u):r(e)}),n.loadingPromise)}_updateGLTexture(e,t){e.glTexture=t,this.events.emit("changed",1)}_onTextureUnloaded(e){this._textures.delete(e.id),this.updater.remove(e)}};e([n()],h.prototype,"_loadingCount",void 0),e([n()],h.prototype,"_frameTask",void 0),e([n()],h.prototype,"updating",null),h=e([u("esri.views.3d.webgl-engine.lib.TextureRepository")],h);class p{constructor(e,t){this._texture=e,this._release=t,this._refCount=0}get id(){return this._texture.id}get isUnreferenced(){return 0===this._refCount}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(0!==this._refCount?(s.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}unload(){this._texture.unload()}}export{h as TextureRepository};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{EventEmitter as r}from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{isUpdatableTexture as a}from"./IManagedTexture.js";import{TextureUpdater as d}from"./TextureUpdater.js";import{TaskPriority as h}from"../../../support/Scheduler.js";let l=class extends t{constructor(e){super({}),this._stage=e,this._textures=new Map,this._loadingCount=0,this.events=new r,this.updater=new d,this._frameTask=e.view.resourceController.scheduler.registerTask(h.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this.updater.destroy(),this._textures.forEach(e=>e.unload())}get updating(){return this._loadingCount>0||this._frameTask.updating}acquire(e){const t=this._textures.get(e);return t?(t.ref(),t.loadingPromise??t):this._createNewRef(e)}update(){this.updater.run()&&this.events.emit("changed",0)}_createNewRef(e){const t=this._stage.getTexture(e);if(null==t)return null;const r=t.events.on("unloaded",()=>{r.remove(),this._onTextureUnloaded(t)}),n=new p(t,()=>{this._frameTask.schedule(()=>{n.isUnreferenced&&t.unload()})});return this._textures.set(e,n),n.ref(),t.loaded?(this._updateGLTexture(n,t.texture),a(t)&&this.updater.add(t),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule(()=>{const e=t.load(this._stage.renderView.renderingContext),r=e=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,e),a(t)&&this.updater.add(t),n),u=e=>(t.unload(),this._loadingCount--,n.loadingPromise=null,i(e)||s.getLogger(this).error(e),null);return o(e)?e.then(r,u):r(e)}),n.loadingPromise)}_updateGLTexture(e,t){e.texture=t,this.events.emit("changed",1)}_onTextureUnloaded(e){this._textures.delete(e.id),this.updater.remove(e)}};e([n()],l.prototype,"_loadingCount",void 0),e([n()],l.prototype,"_frameTask",void 0),e([n()],l.prototype,"updating",null),l=e([u("esri.views.3d.webgl-engine.lib.TextureRepository")],l);class p{constructor(e,t){this._texture=e,this._release=t,this._refCount=0}get id(){return this._texture.id}get isUnreferenced(){return 0===this._refCount}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(0!==this._refCount?(s.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}unload(){this._texture.unload()}}export{l as TextureRepository};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../../chunks/TextureOnly.glsl.js";import{ReloadableShaderModule as r}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as t}from"./DefaultVertexBufferLayouts.js";import{makePipelineState as i,defaultColorWrite as s,unpremultipliedAlphaToPremultipliedAlpha as l}from"../../../webgl/renderState.js";class a extends o{constructor(o,i){super(o,i,new r(e,()=>import("../core/shaderLibrary/util/TextureOnly.glsl.js")),t)}initializePipeline(e){return e.hasAlpha?i({blending:l,colorWrite:s}):i({colorWrite:s})}}export{a as TextureTechnique};
5
+ import{__decorate as r}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o}from"../../../../chunks/TextureOnly.glsl.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{makePipelineState as t,defaultColorWrite as c,unpremultipliedAlphaToPremultipliedAlpha as l}from"../../../webgl/renderState.js";let a=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("../core/shaderLibrary/util/TextureOnly.glsl.js"))}initializePipeline(r){return r.hasAlpha?t({blending:l,colorWrite:c}):t({colorWrite:c})}};a=r([e("esri.views.3d.webgl-engine.lib.TextureTechnique")],a);export{a as TextureTechnique};