@arcgis/core 6.0.0-next.7 → 6.0.0-next.8

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 (146) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/06ab24a083c3229228dd.js +1 -0
  3. package/assets/esri/core/workers/chunks/09a63cc1987f8636c5b0.js +1 -0
  4. package/assets/esri/core/workers/chunks/{7165d6f6a5078768bebb.js → 15cc2c295682f48030f9.js} +1 -1
  5. package/assets/esri/core/workers/chunks/17b76e0d401c7e396d10.js +1 -0
  6. package/assets/esri/core/workers/chunks/{c18189710d6198516175.js → 19b9d393046a780e6c3f.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1b35ec54968fbeec17ce.js +1 -0
  8. package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +1 -0
  9. package/assets/esri/core/workers/chunks/1e0d2715d603f48a7e0b.js +1 -0
  10. package/assets/esri/core/workers/chunks/{9a7fc93cc693fd12b5d8.js → 2b6c74646ff475a6e302.js} +1 -1
  11. package/assets/esri/core/workers/chunks/2d9a1f23ec6ce90723ac.js +1 -0
  12. package/assets/esri/core/workers/chunks/340621182db9e8edbec2.js +1 -0
  13. package/assets/esri/core/workers/chunks/{71f739bb3f7350704af6.js → 384ae10053d35940de73.js} +1 -1
  14. package/assets/esri/core/workers/chunks/3b3e519f15ed52c83f0c.js +1 -0
  15. package/assets/esri/core/workers/chunks/{72019baeba520edb6bb0.js → 3b737dae6efed627406e.js} +1 -1
  16. package/assets/esri/core/workers/chunks/3c0ed15b544df6fb0903.js +1 -0
  17. package/assets/esri/core/workers/chunks/451d7d456df0f4466563.js +1 -0
  18. package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +1 -0
  19. package/assets/esri/core/workers/chunks/4e544de61f07ca660236.js +1 -0
  20. package/assets/esri/core/workers/chunks/{06e7400f5ebe0719b81c.js → 5a5d80c2519aa3ea8878.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{fb4ff0ac2bc445fec413.js → 5b434e8c98e7119d4a3b.js} +1 -1
  22. package/assets/esri/core/workers/chunks/606ea251075fe81a1206.js +1 -0
  23. package/assets/esri/core/workers/chunks/{ac4cc49104d26c384e98.js → 658b2642ab6880770e4e.js} +1 -1
  24. package/assets/esri/core/workers/chunks/68be3fb88ca61f82fb90.js +1 -0
  25. package/assets/esri/core/workers/chunks/6c9266120d46e8c69dbf.js +1 -0
  26. package/assets/esri/core/workers/chunks/6ef647b7769d27529f9c.js +1 -0
  27. package/assets/esri/core/workers/chunks/709e019885822b1f6f3e.js +1 -0
  28. package/assets/esri/core/workers/chunks/8730e7e6e0296f43f10b.js +1 -0
  29. package/assets/esri/core/workers/chunks/8bea0d706ede6f84f8aa.js +1 -0
  30. package/assets/esri/core/workers/chunks/900181f68449d8f82eeb.js +1 -0
  31. package/assets/esri/core/workers/chunks/939942b00ba380e2957e.js +1 -0
  32. package/assets/esri/core/workers/chunks/{1ef39aef6b33c530cbe4.js → 966d0832a3c1f03668a0.js} +1 -1
  33. package/assets/esri/core/workers/chunks/9a28a66807a1e3557018.js +1 -0
  34. package/assets/esri/core/workers/chunks/{2f9033890c465acff698.js → 9bf48a907f91ea004648.js} +1 -1
  35. package/assets/esri/core/workers/chunks/9c7fa9d324fa0bf64d9c.js +1 -0
  36. package/assets/esri/core/workers/chunks/{1ba1f705b6ce5c8ea702.js → a655ebdb4bf0660615a2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/af349c7bc8ef41a0e1bd.js +1 -0
  38. package/assets/esri/core/workers/chunks/c8ba0673d1b87216e619.js +1 -0
  39. package/assets/esri/core/workers/chunks/{4d3f97a48046021713a6.js → ceb112fe7aef354f8051.js} +1 -1
  40. package/assets/esri/core/workers/chunks/d6ad4390df576198e45b.js +1 -0
  41. package/assets/esri/core/workers/chunks/{801e9e66edb4961461eb.js → ded8b64a46992c3ae693.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{0b36abcbf03037b4073d.js → e1af43e2a8f2ef1059e3.js} +1 -1
  43. package/assets/esri/core/workers/chunks/eaf6d587477399a83088.js +1 -0
  44. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +1 -0
  45. package/assets/esri/core/workers/chunks/f31b424a3667686af10c.js +1 -0
  46. package/assets/esri/core/workers/chunks/{711cfb84659cb4437679.js → f528ac5c648ca6a98582.js} +1 -1
  47. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +1 -0
  48. package/config.js +1 -1
  49. package/form/elements/inputs/DynamicChoiceInput.d.ts +35 -5
  50. package/geometry/support/scaleUtils.js +1 -1
  51. package/kernel.js +1 -1
  52. package/layers/ParquetLayer.d.ts +3 -2
  53. package/layers/ParquetLayer.js +1 -1
  54. package/layers/mixins/ScaleRangeLayer.js +1 -1
  55. package/layers/mixins/SublayersOwner.js +1 -1
  56. package/layers/support/Sublayer.js +1 -1
  57. package/layers/support/SubtypeSublayer.js +1 -1
  58. package/package.json +2 -2
  59. package/popup/FeaturesModel.d.ts +26 -5
  60. package/popup/FeaturesModel.js +1 -1
  61. package/rest/support/printTaskUtils.js +1 -1
  62. package/symbols/cim/CIMSymbolHelper.js +1 -1
  63. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  64. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  65. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  66. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  67. package/views/2d/layers/LayerView2D.js +1 -1
  68. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  69. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  70. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  71. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  72. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  73. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  74. package/views/3d/analysis/Viewshed/types.d.ts +3 -1
  75. package/views/3d/environment/Environment.d.ts +2 -2
  76. package/views/3d/environment/Environment.js +1 -1
  77. package/views/3d/environment/EnvironmentView.js +2 -0
  78. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  79. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  80. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  81. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  82. package/views/3d/layers/FlowSubView3D.js +1 -1
  83. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  84. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  85. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  86. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  87. package/views/3d/layers/MediaLayerView3D.js +1 -1
  88. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  89. package/views/3d/layers/RouteLayerView3D.js +1 -1
  90. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  91. package/views/3d/layers/SceneLayerView3D.js +1 -1
  92. package/views/3d/layers/TiledLayerView3D.js +1 -1
  93. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  94. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  95. package/views/3d/layers/graphics/Labeler.js +1 -1
  96. package/views/3d/layers/support/FeatureTile.js +1 -1
  97. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  98. package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +1 -1
  99. package/views/3d/support/popupHitTest.js +1 -1
  100. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  101. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  102. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  103. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  104. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  105. package/views/SceneView.js +1 -1
  106. package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
  107. package/views/layers/LayerView.js +1 -1
  108. package/views/layers/LineOfSightLayerView.d.ts +3 -4
  109. package/views/layers/ViewshedLayerView.d.ts +5 -6
  110. package/views/support/layerViewUtils.js +1 -1
  111. package/widgets/Editor.d.ts +10 -0
  112. package/widgets/FeatureForm.d.ts +2 -2
  113. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  114. package/assets/esri/core/workers/chunks/00a600c71ceebe7bfeee.js +0 -1
  115. package/assets/esri/core/workers/chunks/00d24415bdeb0adae3df.js +0 -1
  116. package/assets/esri/core/workers/chunks/0193df3f9fb23633da87.js +0 -1
  117. package/assets/esri/core/workers/chunks/07aa6d36f1006b6ab7ff.js +0 -1
  118. package/assets/esri/core/workers/chunks/25d6c674b1c4829f040f.js +0 -1
  119. package/assets/esri/core/workers/chunks/25e6013e2c095629b236.js +0 -1
  120. package/assets/esri/core/workers/chunks/2c90f7a6432cd716db8b.js +0 -1
  121. package/assets/esri/core/workers/chunks/2e6a2f4d686b71249c0e.js +0 -1
  122. package/assets/esri/core/workers/chunks/303fde8f3459dde16555.js +0 -1
  123. package/assets/esri/core/workers/chunks/350540770781b281c39a.js +0 -1
  124. package/assets/esri/core/workers/chunks/3b017b718ea2d4ed498f.js +0 -1
  125. package/assets/esri/core/workers/chunks/43fc42405167a5537039.js +0 -1
  126. package/assets/esri/core/workers/chunks/4d82db661365daa513a6.js +0 -1
  127. package/assets/esri/core/workers/chunks/518e8883b6ed613bf451.js +0 -1
  128. package/assets/esri/core/workers/chunks/633a9051580c5302d2f7.js +0 -1
  129. package/assets/esri/core/workers/chunks/6469c0d18d3663e7da4b.js +0 -1
  130. package/assets/esri/core/workers/chunks/669e39c3437d7273f0c7.js +0 -1
  131. package/assets/esri/core/workers/chunks/7038ead1fa1674416ab3.js +0 -1
  132. package/assets/esri/core/workers/chunks/798a63653f82c0e842c5.js +0 -1
  133. package/assets/esri/core/workers/chunks/84fcbf7a1d04f01685d1.js +0 -1
  134. package/assets/esri/core/workers/chunks/8e511079918e2fd9261f.js +0 -1
  135. package/assets/esri/core/workers/chunks/95b82cbbe355266c65d7.js +0 -1
  136. package/assets/esri/core/workers/chunks/9673a9efec86040b8c13.js +0 -1
  137. package/assets/esri/core/workers/chunks/a010d2e4e34eb7bc1fec.js +0 -1
  138. package/assets/esri/core/workers/chunks/b05a41a60e30935644be.js +0 -1
  139. package/assets/esri/core/workers/chunks/d21257d2e2a37266c0f7.js +0 -1
  140. package/assets/esri/core/workers/chunks/d270cc9807161033686e.js +0 -1
  141. package/assets/esri/core/workers/chunks/ec9a2425b4a498054a19.js +0 -1
  142. package/assets/esri/core/workers/chunks/f0a68d2900d24f56afa0.js +0 -1
  143. package/assets/esri/core/workers/chunks/f762f70e7d39634ce797.js +0 -1
  144. package/assets/esri/core/workers/chunks/fd0254c6fc6c03ec11ba.js +0 -1
  145. package/assets/esri/core/workers/chunks/fd0a5c243f3426f2a0b5.js +0 -1
  146. package/views/3d/environment/EnvironmentManager.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as n,result as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as s,isAbortError as c}from"../../../../core/promiseUtils.js";import l from"../../../../core/Queue.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as m}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as h}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{make as _}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as v,LineCalloutSymbolLayerRenderingInfo as y}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as b}from"./graphicSymbolUtils.js";import{LabelInfo as x}from"./LabelInfo.js";import{LabelParameters as S}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as C,verticalPlacementFromAnchor as w,textRenderAlignmentFromHorizontalPlacement as T}from"./placementUtils.js";import{placePointOnGeometry as E}from"./pointUtils.js";import{TextRenderer as D}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as O}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as k}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as A}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as j,isInEffectiveScaleRange as M}from"../../../support/layerViewUtils.js";import{TaskPriority as N}from"../../../support/Scheduler.js";import{Yield as P}from"../../../support/Yield.js";class F{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=[],this.textLabelPlacements=[]}}class I{constructor(e,t,n,r,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=n,this.textRenderParameters=r,this.labelFunction=i,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class L{constructor(e,t,n,r,i,a,o,s){this.layer=t,this.graphics3DCore=n,this.scaleVisibility=r,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=o,this.active=s,this.labelClassAbortController=new AbortController,this._labelClassContexts=[],this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new A(e,{pickable:!0},n.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let R=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new l,this._labels=new Map,this._labelingContexts=[]}setup(){this.dispose(),this.addHandles([u(()=>this.view.state?.camera,()=>this.setDirty()),u(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),u(()=>this.view.timeZone,()=>this._resetArcadeLabels()),u(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(N.LABELER,this)]),j()&&this.addHandles(u(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new k({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),G.graphic=null,G.renderingInfo=null,G.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,n)=>{let r=new F(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(let t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;let n=e.textRenderers[t.labelClassContextIndex];n&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(n,e=>B(t.stageObject,e))),z(t.stageObject,n))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),P}_updateLabels(e){if(this._dirty){this._dirty=!1;for(let t of this._labelingContexts)if(t.active){if(V(t))this._dirty=!0;else if(H(t.labelClassContexts)){if(t.labelClassContexts===null){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(let[n,r]of t.labelsToInitialize)if(this._ensureGraphics3DResources(r)&&(this._labels.set(n,r),this.deconflictor.setDirty(),e.madeProgress()),(r.visible&&r.textInitialized||!r.visible&&r.hasGraphics3DResources)&&(t.labelsToInitialize.delete(n),e.madeProgress()),e.done){this._dirty=!0;break}}this._dirty||this.notifyChange(`updating`)}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();let{graphic3DGraphic:t,labelingContext:n}=this._focusAreasLabelsQueue.pop();if(t.labelLayers.length===0||!n.active)continue;let r=E(t.graphic.geometry);if(r==null)continue;let i=this.view.focusAreasView?.containsGeometry(r)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.focusAreaStyle==null!==i)&&(this._removeGraphic(n,t),this._addGraphic(n,t),this.setDirty())})}this._focusAreasLabelsQueue.length===0&&(this.notifyChange(`readyToRun`),this.notifyChange(`updating`))}async _createLabelClassContextAsync(e){let t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),s(t),e.scaleVisibility?.updateScaleRangeActive();let a=e.graphics3DCore,o=a.layer.labelingInfo?.filter(e=>!!e.symbol);o&&o.length!==0&&(await n(o,async(n,o)=>{let c=n.symbol,l=b(a.getOrCreateGraphics3DSymbol(c));if(l==null){i.getLogger(this).error(`Failed to create Graphics3DSymbol for label`);return}await l.load(),s(t);let u=null;g(c)&&c.hasVisibleCallout()&&(u=_(c,a.symbolCreationContext),await u.load(),s(t));let d=await r(h(n,e.layer.fieldsIndex,this.view.spatialReference));if(s(t),d.ok===!0){let r=await this._createTextRenderParameters(l.symbol);s(t);let i=new I(n,l,u,r,d.value);this._updateLabelClassContextVisibility(i),e.setLabelClassContext(o,i)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`)}),s(t))}async _createLabelClassContext(e){return e.labelClassPromise??(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(c(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange(`updating`)}).catch(()=>{}),this.notifyChange(`updating`)),e.labelClassPromise}async _createTextRenderParameters(e){let t=e.symbolLayers.at(0);return t?.type===`text`?O.fromSymbol(t,this.view.state.rasterPixelRatio):null}_destroyLabelClassContext(e){for(let t of e.labelClassContexts)t&&--t.graphics3DSymbol.referenced;let t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange(`updating`)}_createTextSymbolGraphic(e,t,n,r,i,a){if(!this._textTextureAtlas)return null;let o=new S(n,C(n.anchor),w(n.anchor),e.text,p(e.displayWidth,e.displayHeight));return G.graphic=t,G.layer=r,G.renderingInfo=null,i.createLabel(G,o,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,n,r,i){G.graphic=e,G.layer=i;let a=r.screenOffset[0];return G.renderingInfo=new y(null,t,r.translation,r.centerOffset,r.groundDistance,a,r.centerOffsetUnits,r.elevationOffset),n.createGraphics3DGraphic(G,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;let t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);let n=e.labelingContext,r=n.labelClassContexts;if(H(r)||!n.emptySymbolLabelSupported&&t.layers.length===0)return!1;let i=!1,a=t.graphic,o=n.layer,s=W(n.layer);for(let c=0;c<r.length;c++){let l=e.textRenderers[c],u=e.textLabelPlacements[c],d=r[c];if(l==null||u==null||d==null)continue;let f=d.graphics3DSymbol,p=U(f),m=f.symbolLayers[0];if(!m)continue;m.setElevationInfoOverride(n.elevationInfoOverride);let h=new x(t,p,d.labelClass),g=this._createTextSymbolGraphic(l,a,u,o,m,h);if(g==null)return!1;g.labelClass=d.labelClass,g.labelClassContextIndex=c,t.addLabelGraphic(g,n.stageLayer),this.deconflictor.setPriority(t,d.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,s),t.setVisibilityFlag(16,2,d.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),j()&&d.graphics.set(a.uid,t),i=!0;let _=d.graphics3DCalloutSymbolLayer;if(_&&u.hasLabelVerticalOffset){_.setElevationInfoOverride(n.elevationInfoOverride);let e=this._createLineCalloutGraphic(a,p,_,u,o);e!=null&&(d.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,n.stageLayer))}break}return i&&n.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){let t=e.labelingContext.labelClassContexts;for(let n of e.graphics3DGraphic.labelLayers)n.labelClass!=null&&t[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0]?.onRemoveGraphic(n);e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;let t=e.labelingContext,n=t.labelClassContexts;if(H(n))return;let r=e.graphics3DGraphic.graphic;for(let i=0;i<n.length;i++){let a=n[i];if(e.textRenderers[i]=null,e.textLabelPlacements[i]=null,a?.textRenderParameters==null)continue;let o=a.labelFunction,s;if(o.type===`arcade`)try{let e=o.needsHydrationToEvaluate()?m(r,t.layer,null):r;s=o.evaluate(e,this.view.timeZone)}catch{s=null}else s=o.evaluate(r);if(s==null||s===``||/^\s+$/.test(s))continue;let c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;let l=e.graphics3DGraphic,u=c.symbol?.type===`label-3d`?c.symbol:null,d=a.labelClass,f=t.disablePlacement,p=new x(l,u,d,f).placement;if(p==null)continue;let h=C(p.anchor),g=T(h);e.textRenderers[i]=new D(s,g,a.textRenderParameters,k.maxSize),e.textLabelPlacements[i]=p}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){let n=t.graphic.uid;if(e.graphics.set(n,t),e.active){let r=new F(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){let n=t.graphic.uid,r=this._labels.get(n);if(!r)return!0;for(let n of r.graphics3DGraphic.labelLayers)if(n.labelClass!=null&&!e.labelClassContexts[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(t.graphic,n))return!1;return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){let n=t.graphic.uid,r=this._labels.get(n);e.graphics.delete(n),e.labelClassContexts.forEach(e=>e?.graphics.delete(n)),r&&(this._destroyGraphic(r,n),e.labelsToInitialize.delete(n),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(t)for(let n of t){let t=e.graphics.get(n);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}else return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e)}_globalPropertyChanged(e,t){for(let n of t.labelClassContexts){if(!n)continue;let r=new Map;t.graphics.forEach(e=>r.set(e.graphic.uid,e)),n.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,r,e=>e.labelLayers[0]),n.graphics3DCalloutSymbolLayer&&n.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,r,e=>e.labelLayers[n.calloutSymbolLayerIndex])}}_visibilityInfoChange(e){let t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(let e of this._labelingContexts)this._resetLabels(e)}_resetArcadeLabels(){for(let e of this._labelingContexts)e.labelClassContexts.some(e=>e?.labelFunction.type===`arcade`)&&this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,n)=>{let r=this._labels.get(n);r&&(this._destroyGraphic(r,n),r.visible=!1,e.labelsToInitialize.set(n,r))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(let t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,n){let r=n?.emptySymbolLabelSupported||!1,i=n?.elevationInfoOverride||null,a=n?.disablePlacement||null;if(this._findLabelingContext(e))return;let o=e.layer,s=new L(this.view.stage,o,e,t,r,i,a,W(o));return this._labelingContexts.push(s),this.setDirty(),{addGraphic:e=>this._addGraphic(s,e),removeGraphic:e=>this._removeGraphic(s,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(s,e),layerLabelsEnabled:()=>W(s.layer),labelingInfoChange:e=>this._labelingInfoChange(s,e),elevationInfoChange:()=>this._globalPropertyChanged(`elevationInfo`,s),screenSizePerspectiveEnabledChanged:()=>this._globalPropertyChanged(`screenSizePerspectiveEnabled`,s),slicePlaneEnabledChange:()=>this._globalPropertyChanged(`slicePlaneEnabled`,s),visibilityInfoChange:()=>this._visibilityInfoChange(s),reset:()=>this._resetLabels(s),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){let t=this._findLabelingContext(e);if(!t)return;let n=this._labelingContexts.indexOf(t);this._labelingContexts.splice(n,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(let e of this._labelingContexts)if(e.active&&!V(e))for(let t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!e||!j())return;let{labelClass:t,graphics:n}=e,r={minScale:t.minScale,maxScale:t.maxScale},i=M(r,this.view.scale),a=e.scaleVisibility==null||e.scaleVisibility!==i;e.scaleVisibility=i,a&&n.size&&(n.forEach(e=>e.setVisibilityFlag(16,2,i)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){let n=e.graphic.uid,r=this._labels.get(n);r&&r.visible!==t&&(t&&!r.textureAtlasHandles.length?(this._addLabelTextureToAtlas(r),r.textInitialized||r.labelingContext.labelsToInitialize.set(n,r)):!t&&r.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(r),r.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange(`updating`))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>V(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;let e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+ +!V(t),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+e*.1+this.deconflictor.updatingProgress*.5}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};e([d({constructOnly:!0})],R.prototype,`view`,void 0),e([d({constructOnly:!0})],R.prototype,`deconflictor`,void 0),e([d()],R.prototype,`_textTextureAtlas`,void 0),e([d({type:Boolean,readOnly:!0})],R.prototype,`updating`,null),R=e([f(`esri.views.3d.layers.graphics.Labeler`)],R);function z(e,t){e.geometries[0].setAttributeData(`size`,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],`size`)}function B(e,t){e.geometries[0].setAttributeData(`uvi`,t),e.geometryVertexAttributeUpdated(e.geometries[0],`uvi`,!0)}function V(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function H(e){return(e?.length??0)===0}function U(e){return e.symbol?.type===`label-3d`?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}const G=new v(null,null,null);export{R as Labeler,W as areLabelsVisible};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as n,result as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as s,isAbortError as c}from"../../../../core/promiseUtils.js";import l from"../../../../core/Queue.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isInEffectiveScaleRange as m}from"../../../../geometry/support/scaleUtils.js";import{hydrateGraphic as h}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as g}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as _}from"../../../../symbols/callouts/calloutUtils.js";import{make as v}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as y,LineCalloutSymbolLayerRenderingInfo as b}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as x}from"./graphicSymbolUtils.js";import{LabelInfo as S}from"./LabelInfo.js";import{LabelParameters as C}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as w,verticalPlacementFromAnchor as T,textRenderAlignmentFromHorizontalPlacement as E}from"./placementUtils.js";import{placePointOnGeometry as D}from"./pointUtils.js";import{TextRenderer as O}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as k}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as A}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as M}from"../../../support/layerViewUtils.js";import{TaskPriority as N}from"../../../support/Scheduler.js";import{Yield as P}from"../../../support/Yield.js";class F{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=[],this.textLabelPlacements=[]}}class I{constructor(e,t,n,r,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=n,this.textRenderParameters=r,this.labelFunction=i,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class L{constructor(e,t,n,r,i,a,o,s){this.layer=t,this.graphics3DCore=n,this.scaleVisibility=r,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=o,this.active=s,this.labelClassAbortController=new AbortController,this._labelClassContexts=[],this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0},n.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let R=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new l,this._labels=new Map,this._labelingContexts=[]}setup(){this.dispose(),this.addHandles([u(()=>this.view.state?.camera,()=>this.setDirty()),u(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),u(()=>this.view.timeZone,()=>this._resetArcadeLabels()),u(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(N.LABELER,this)]),M()&&this.addHandles(u(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new A({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),G.graphic=null,G.renderingInfo=null,G.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,n)=>{let r=new F(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(let t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;let n=e.textRenderers[t.labelClassContextIndex];n&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(n,e=>B(t.stageObject,e))),z(t.stageObject,n))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),P}_updateLabels(e){if(this._dirty){this._dirty=!1;for(let t of this._labelingContexts)if(t.active){if(V(t))this._dirty=!0;else if(H(t.labelClassContexts)){if(t.labelClassContexts===null){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(let[n,r]of t.labelsToInitialize)if(this._ensureGraphics3DResources(r)&&(this._labels.set(n,r),this.deconflictor.setDirty(),e.madeProgress()),(r.visible&&r.textInitialized||!r.visible&&r.hasGraphics3DResources)&&(t.labelsToInitialize.delete(n),e.madeProgress()),e.done){this._dirty=!0;break}}this._dirty||this.notifyChange(`updating`)}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();let{graphic3DGraphic:t,labelingContext:n}=this._focusAreasLabelsQueue.pop();if(t.labelLayers.length===0||!n.active)continue;let r=D(t.graphic.geometry);if(r==null)continue;let i=this.view.focusAreasView?.containsGeometry(r)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.focusAreaStyle==null!==i)&&(this._removeGraphic(n,t),this._addGraphic(n,t),this.setDirty())})}this._focusAreasLabelsQueue.length===0&&(this.notifyChange(`readyToRun`),this.notifyChange(`updating`))}async _createLabelClassContextAsync(e){let t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),s(t),e.scaleVisibility?.updateScaleRangeActive();let a=e.graphics3DCore,o=a.layer.labelingInfo?.filter(e=>!!e.symbol);o&&o.length!==0&&(await n(o,async(n,o)=>{let c=n.symbol,l=x(a.getOrCreateGraphics3DSymbol(c));if(l==null){i.getLogger(this).error(`Failed to create Graphics3DSymbol for label`);return}await l.load(),s(t);let u=null;_(c)&&c.hasVisibleCallout()&&(u=v(c,a.symbolCreationContext),await u.load(),s(t));let d=await r(g(n,e.layer.fieldsIndex,this.view.spatialReference));if(s(t),d.ok===!0){let r=await this._createTextRenderParameters(l.symbol);s(t);let i=new I(n,l,u,r,d.value);this._updateLabelClassContextVisibility(i),e.setLabelClassContext(o,i)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`)}),s(t))}async _createLabelClassContext(e){return e.labelClassPromise??(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(c(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange(`updating`)}).catch(()=>{}),this.notifyChange(`updating`)),e.labelClassPromise}async _createTextRenderParameters(e){let t=e.symbolLayers.at(0);return t?.type===`text`?k.fromSymbol(t,this.view.state.rasterPixelRatio):null}_destroyLabelClassContext(e){for(let t of e.labelClassContexts)t&&--t.graphics3DSymbol.referenced;let t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange(`updating`)}_createTextSymbolGraphic(e,t,n,r,i,a){if(!this._textTextureAtlas)return null;let o=new C(n,w(n.anchor),T(n.anchor),e.text,p(e.displayWidth,e.displayHeight));return G.graphic=t,G.layer=r,G.renderingInfo=null,i.createLabel(G,o,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,n,r,i){G.graphic=e,G.layer=i;let a=r.screenOffset[0];return G.renderingInfo=new b(null,t,r.translation,r.centerOffset,r.groundDistance,a,r.centerOffsetUnits,r.elevationOffset),n.createGraphics3DGraphic(G,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;let t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);let n=e.labelingContext,r=n.labelClassContexts;if(H(r)||!n.emptySymbolLabelSupported&&t.layers.length===0)return!1;let i=!1,a=t.graphic,o=n.layer,s=W(n.layer);for(let c=0;c<r.length;c++){let l=e.textRenderers[c],u=e.textLabelPlacements[c],d=r[c];if(l==null||u==null||d==null)continue;let f=d.graphics3DSymbol,p=U(f),m=f.symbolLayers[0];if(!m)continue;m.setElevationInfoOverride(n.elevationInfoOverride);let h=new S(t,p,d.labelClass),g=this._createTextSymbolGraphic(l,a,u,o,m,h);if(g==null)return!1;g.labelClass=d.labelClass,g.labelClassContextIndex=c,t.addLabelGraphic(g,n.stageLayer),this.deconflictor.setPriority(t,d.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,s),t.setVisibilityFlag(16,2,d.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),M()&&d.graphics.set(a.uid,t),i=!0;let _=d.graphics3DCalloutSymbolLayer;if(_&&u.hasLabelVerticalOffset){_.setElevationInfoOverride(n.elevationInfoOverride);let e=this._createLineCalloutGraphic(a,p,_,u,o);e!=null&&(d.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,n.stageLayer))}break}return i&&n.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){let t=e.labelingContext.labelClassContexts;for(let n of e.graphics3DGraphic.labelLayers)n.labelClass!=null&&t[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0]?.onRemoveGraphic(n);e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;let t=e.labelingContext,n=t.labelClassContexts;if(H(n))return;let r=e.graphics3DGraphic.graphic;for(let i=0;i<n.length;i++){let a=n[i];if(e.textRenderers[i]=null,e.textLabelPlacements[i]=null,a?.textRenderParameters==null)continue;let o=a.labelFunction,s;if(o.type===`arcade`)try{let e=o.needsHydrationToEvaluate()?h(r,t.layer,null):r;s=o.evaluate(e,this.view.timeZone)}catch{s=null}else s=o.evaluate(r);if(s==null||s===``||/^\s+$/.test(s))continue;let c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;let l=e.graphics3DGraphic,u=c.symbol?.type===`label-3d`?c.symbol:null,d=a.labelClass,f=t.disablePlacement,p=new S(l,u,d,f).placement;if(p==null)continue;let m=w(p.anchor),g=E(m);e.textRenderers[i]=new O(s,g,a.textRenderParameters,A.maxSize),e.textLabelPlacements[i]=p}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){let n=t.graphic.uid;if(e.graphics.set(n,t),e.active){let r=new F(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){let n=t.graphic.uid,r=this._labels.get(n);if(!r)return!0;for(let n of r.graphics3DGraphic.labelLayers)if(n.labelClass!=null&&!e.labelClassContexts[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(t.graphic,n))return!1;return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){let n=t.graphic.uid,r=this._labels.get(n);e.graphics.delete(n),e.labelClassContexts.forEach(e=>e?.graphics.delete(n)),r&&(this._destroyGraphic(r,n),e.labelsToInitialize.delete(n),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(t)for(let n of t){let t=e.graphics.get(n);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}else return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e)}_globalPropertyChanged(e,t){for(let n of t.labelClassContexts){if(!n)continue;let r=new Map;t.graphics.forEach(e=>r.set(e.graphic.uid,e)),n.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,r,e=>e.labelLayers[0]),n.graphics3DCalloutSymbolLayer&&n.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,r,e=>e.labelLayers[n.calloutSymbolLayerIndex])}}_visibilityInfoChange(e){let t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(let e of this._labelingContexts)this._resetLabels(e)}_resetArcadeLabels(){for(let e of this._labelingContexts)e.labelClassContexts.some(e=>e?.labelFunction.type===`arcade`)&&this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,n)=>{let r=this._labels.get(n);r&&(this._destroyGraphic(r,n),r.visible=!1,e.labelsToInitialize.set(n,r))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(let t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,n){let r=n?.emptySymbolLabelSupported||!1,i=n?.elevationInfoOverride||null,a=n?.disablePlacement||null;if(this._findLabelingContext(e))return;let o=e.layer,s=new L(this.view.stage,o,e,t,r,i,a,W(o));return this._labelingContexts.push(s),this.setDirty(),{addGraphic:e=>this._addGraphic(s,e),removeGraphic:e=>this._removeGraphic(s,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(s,e),layerLabelsEnabled:()=>W(s.layer),labelingInfoChange:e=>this._labelingInfoChange(s,e),elevationInfoChange:()=>this._globalPropertyChanged(`elevationInfo`,s),screenSizePerspectiveEnabledChanged:()=>this._globalPropertyChanged(`screenSizePerspectiveEnabled`,s),slicePlaneEnabledChange:()=>this._globalPropertyChanged(`slicePlaneEnabled`,s),visibilityInfoChange:()=>this._visibilityInfoChange(s),reset:()=>this._resetLabels(s),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){let t=this._findLabelingContext(e);if(!t)return;let n=this._labelingContexts.indexOf(t);this._labelingContexts.splice(n,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(let e of this._labelingContexts)if(e.active&&!V(e))for(let t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!e||!M())return;let{labelClass:t,graphics:n}=e,r={minScale:t.minScale,maxScale:t.maxScale},i=m(r,this.view.scale),a=e.scaleVisibility==null||e.scaleVisibility!==i;e.scaleVisibility=i,a&&n.size&&(n.forEach(e=>e.setVisibilityFlag(16,2,i)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){let n=e.graphic.uid,r=this._labels.get(n);r&&r.visible!==t&&(t&&!r.textureAtlasHandles.length?(this._addLabelTextureToAtlas(r),r.textInitialized||r.labelingContext.labelsToInitialize.set(n,r)):!t&&r.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(r),r.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange(`updating`))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>V(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;let e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+ +!V(t),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+e*.1+this.deconflictor.updatingProgress*.5}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};e([d({constructOnly:!0})],R.prototype,`view`,void 0),e([d({constructOnly:!0})],R.prototype,`deconflictor`,void 0),e([d()],R.prototype,`_textTextureAtlas`,void 0),e([d({type:Boolean,readOnly:!0})],R.prototype,`updating`,null),R=e([f(`esri.views.3d.layers.graphics.Labeler`)],R);function z(e,t){e.geometries[0].setAttributeData(`size`,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],`size`)}function B(e,t){e.geometries[0].setAttributeData(`uvi`,t),e.geometryVertexAttributeUpdated(e.geometries[0],`uvi`,!0)}function V(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function H(e){return(e?.length??0)===0}function U(e){return e.symbol?.type===`label-3d`?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}const G=new y(null,null,null);export{R as Labeler,W as areLabelsVisible};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{shuffle as e}from"../../../../core/arrayUtils.js";import{baseObjectMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{create as r,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,fromExtent as o,intersects as s,copy as c,positiveInfinity as l,intersection as u}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as d,estimateSize as f,getObjectId as p,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as h}from"../graphics/graphicUtils.js";import{SampledGeometryMaxDistanceRatio as g}from"./SampledGeometryMaxDistanceRatio.js";class _{constructor(e,t){this.descriptor=e,this._memory=t,this._numVertices=0,this.exceededTransferLimit=n(!1),this._fetchFailed=n(!1),this._sorted=!1,this._numFeatures=n(v),this._emptyFeatureRatio=n(0),this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=n(0),this._featureLimit=n(0),this._fetchStatus=0,this.fetchInformation=n(``),this.fetchingResolution=this.displayingResolution=e.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&this.displayingFeatures!=null&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(e){this._fetchFailed.value=e}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){let e=this.isFetched&&this.featuresMissing;return!this.filtered&&(e||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(e){this._featureLimit.value=e}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(e,t,n,r,i=this.fetchingResolution,a=!0){this._replaceFeatures(e,i,a),this._availableFields=n,this._featuresLength.value=e?.length??0,this._sorted=!1,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._missingAttributes=r,e&&e.length>0?(this._emptyFeatureRatio.value=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+d(t.geometry),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){let e=this._features.reduce((e,{geometry:t})=>Math.max(e,h(t)??0),0);return Math.floor(e/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(e){this._numFeatures.value=e}get hasPreciseFeatureCount(){return this._numFeatures.value>v}get needsFeatureCount(){return this._numFeatures.value===v}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateEstimates(),this._estimatedSize}get sampledDensityEstimate(){return this._sampledDensityEstimate}updateEstimates(){if(this._estimatedSize<0||this._sampledDensityEstimate<0){this._estimatedSize=0,this._sampledDensityEstimate=0;let e=Math.floor(Math.sqrt(S));if(this._features){let t=null,n=new g(S,w*this.fetchingResolution),r=this._features.length;for(let i=0;i<r;++i){let a=this._features[i],o=f(a);if(this._estimatedSize+=o,!n.done){let o=r-i,s=Math.ceil(o/Math.max(1,Math.floor(Math.sqrt(n.numRemainingSamples))));if(i%s===0){let r=Math.max(Math.floor(n.numRemainingSamples/o),e);n.sampleGeometry(a.geometry,t,r)}}t=a.geometry}this._sampledDensityEstimate=n.numSamples>=C?n.ratio:0}return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=0}requestRefetch(){this._fetchStatus=1}startFetch(){this._fetchStatus=this.needsRefetch?3:2}fetchDone(e){this._fetchStatus=e}get isFetching(){return this._fetchStatus===2||this._fetchStatus===3}get isRefetching(){return this._fetchStatus===3}get needsFetch(){return this._fetchStatus===0||this._fetchStatus===1}get needsRefetch(){return this._fetchStatus===1}get isFetched(){return this._fetchStatus===4||this._fetchStatus===5}isFullyFetched(e){return!!this.features&&(this.features.length>=e||this.fetchStatus===5)}resetFetching(){this._fetchStatus=+!!this.isRefetching}get needsDisplayUpdate(){return!!this._features&&!x(this._features,this.displayingFeatures,this.featureLimit)}intersects(e){return e==null||!this.descriptor.extent||(o(e,T),s(this.descriptor.extent,T))}intersectionIncludingBorrowed(e,t){let n=this.extentIncludingBorrowedFeatures==null?this.descriptor.extent:this.extentIncludingBorrowedFeatures;return!e&&!n?(c(t,l),t):(e==null?c(t,n):(o(e,t),u(t,n,t)),t)}_shuffle(t){this._features?.sort((e,n)=>p(e,t)-p(n,t)),e(this._features,16438)}_sortBySize(e){this._features?.sort((t,n)=>i(m(n.geometry,E))-i(m(t.geometry,E))||p(t,e)-p(n,e))}reduceFeatures(e,t,n,r){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let i=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&this._fetchStatus===4&&this._features.length>0&&(this._fetchStatus=1,i=!0),!this._sorted&&e<1&&(r===1?this._shuffle(n):this._sortBySize(n),this._sorted=!0);let a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));if(this._features.length>a){for(let e=a;e<this._features.length;e++)this._memory.unref(this._features[e]);this._features.length=this._featuresLength.value=a,this._estimatedSize=-1,this.exceededTransferLimit.value=!1,this._fetchStatus===5&&(this._fetchStatus=4)}return i}get cache(){return new b(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(e){this._replaceFeatures(e.features,e.resolution),this.requestController=null,this._availableFields=e.availableFields,this._featuresLength.value=e.features?.length??0,this._numFeatures.value=e.numFeatures,this._emptyFeatureRatio.value=e.emptyFeatureRatio,this._fetchStatus=e.fetchStatus,this.exceededTransferLimit.value=e.exceededTransferLimit,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this.fetchInformation.value=e.fetchInformation}_replaceFeatures(e,t,n=!0){for(let r of e??[])this._memory.ref(r,t,n);for(let e of this._features??[])this._memory.unref(e);this._features=e}}const v=-1,y=-2;class b{constructor(e,n,r,i){this.features=n,this.numFeatures=r,this.emptyFeatureRatio=i,this.usedMemory=t+e.estimatedSize,this.resolution=e.displayingResolution,this.availableFields=e.availableFields,this.fetchStatus=e.fetchStatus,this.exceededTransferLimit=e.exceededTransferLimit.value,this.fetchInformation=e.fetchInformation.value}}function x(e,t,n){if(t==null||e==null||n!==t.length||n>e.length)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0}const S=150,C=100,w=2,T=a(),E=r();export{_ as FeatureTile,b as FeatureTileCacheItem,y as failedFeatureCount};
2
+ import{shuffle as e}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{baseObjectMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{create as r,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,fromExtent as o,intersects as s,copy as c,positiveInfinity as l,intersection as u}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as d,estimateSize as f,getObjectId as p,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as h}from"../graphics/graphicUtils.js";import{SampledGeometryMaxDistanceRatio as g}from"./SampledGeometryMaxDistanceRatio.js";class _{constructor(e,t){this.descriptor=e,this._memory=t,this._numVertices=0,this.exceededTransferLimit=n(!1),this._fetchFailed=n(!1),this._sorted=!1,this._numFeatures=n(v),this._emptyFeatureRatio=n(0),this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=n(0),this._featureLimit=n(0),this._fetchStatus=0,this.fetchInformation=n(``),this.fetchingResolution=this.displayingResolution=e.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&this.displayingFeatures!=null&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(e){this._fetchFailed.value=e}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){let e=this.isFetched&&this.featuresMissing;return!this.filtered&&(e||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(e){this._featureLimit.value=e}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(e,t,n,r,i=this.fetchingResolution,a=!0){this._replaceFeatures(e,i,a),this._availableFields=n,this._featuresLength.value=e?.length??0,this._sorted=!1,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._missingAttributes=r,e&&e.length>0?(this._emptyFeatureRatio.value=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+d(t.geometry),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){let e=this._features.reduce((e,{geometry:t})=>Math.max(e,h(t)??0),0);return Math.floor(e/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(e){this._numFeatures.value=e}get hasPreciseFeatureCount(){return this._numFeatures.value>v}get needsFeatureCount(){return this._numFeatures.value===v}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateEstimates(),this._estimatedSize}get sampledDensityEstimate(){return this._sampledDensityEstimate}updateEstimates(){if(this._estimatedSize<0||this._sampledDensityEstimate<0){this._estimatedSize=0,this._sampledDensityEstimate=0;let e=Math.floor(Math.sqrt(S));if(this._features){let t=null,n=new g(S,has(`featurelayer-snapping-density-max-distance`)*this.fetchingResolution),r=this._features.length;for(let i=0;i<r;++i){let a=this._features[i],o=f(a);if(this._estimatedSize+=o,!n.done){let o=r-i,s=Math.ceil(o/Math.max(1,Math.floor(Math.sqrt(n.numRemainingSamples))));if(i%s===0){let r=Math.max(Math.floor(n.numRemainingSamples/o),e);n.sampleGeometry(a.geometry,t,r)}}t=a.geometry}this._sampledDensityEstimate=n.numSamples>=C?n.ratio:0}return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=0}requestRefetch(){this._fetchStatus=1}startFetch(){this._fetchStatus=this.needsRefetch?3:2}fetchDone(e){this._fetchStatus=e}get isFetching(){return this._fetchStatus===2||this._fetchStatus===3}get isRefetching(){return this._fetchStatus===3}get needsFetch(){return this._fetchStatus===0||this._fetchStatus===1}get needsRefetch(){return this._fetchStatus===1}get isFetched(){return this._fetchStatus===4||this._fetchStatus===5}isFullyFetched(e){return!!this.features&&(this.features.length>=e||this.fetchStatus===5)}resetFetching(){this._fetchStatus=+!!this.isRefetching}get needsDisplayUpdate(){return!!this._features&&!x(this._features,this.displayingFeatures,this.featureLimit)}intersects(e){return e==null||!this.descriptor.extent||(o(e,w),s(this.descriptor.extent,w))}intersectionIncludingBorrowed(e,t){let n=this.extentIncludingBorrowedFeatures==null?this.descriptor.extent:this.extentIncludingBorrowedFeatures;return!e&&!n?(c(t,l),t):(e==null?c(t,n):(o(e,t),u(t,n,t)),t)}_shuffle(t){this._features?.sort((e,n)=>p(e,t)-p(n,t)),e(this._features,16438)}_sortBySize(e){this._features?.sort((t,n)=>i(m(n.geometry,T))-i(m(t.geometry,T))||p(t,e)-p(n,e))}reduceFeatures(e,t,n,r){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let i=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&this._fetchStatus===4&&this._features.length>0&&(this._fetchStatus=1,i=!0),!this._sorted&&e<1&&(r===1?this._shuffle(n):this._sortBySize(n),this._sorted=!0);let a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));if(this._features.length>a){for(let e=a;e<this._features.length;e++)this._memory.unref(this._features[e]);this._features.length=this._featuresLength.value=a,this._estimatedSize=-1,this.exceededTransferLimit.value=!1,this._fetchStatus===5&&(this._fetchStatus=4)}return i}get cache(){return new b(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(e){this._replaceFeatures(e.features,e.resolution),this.requestController=null,this._availableFields=e.availableFields,this._featuresLength.value=e.features?.length??0,this._numFeatures.value=e.numFeatures,this._emptyFeatureRatio.value=e.emptyFeatureRatio,this._fetchStatus=e.fetchStatus,this.exceededTransferLimit.value=e.exceededTransferLimit,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this.fetchInformation.value=e.fetchInformation}_replaceFeatures(e,t,n=!0){for(let r of e??[])this._memory.ref(r,t,n);for(let e of this._features??[])this._memory.unref(e);this._features=e}}const v=-1,y=-2;class b{constructor(e,n,r,i){this.features=n,this.numFeatures=r,this.emptyFeatureRatio=i,this.usedMemory=t+e.estimatedSize,this.resolution=e.displayingResolution,this.availableFields=e.availableFields,this.fetchStatus=e.fetchStatus,this.exceededTransferLimit=e.exceededTransferLimit.value,this.fetchInformation=e.fetchInformation.value}}function x(e,t,n){if(t==null||e==null||n!==t.length||n>e.length)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0}const S=150,C=100,w=a(),T=r();export{_ as FeatureTile,b as FeatureTileCacheItem,y as failedFeatureCount};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{estimateFixedArrayMemory as i,estimateNumberMemory as a,estimateAttributesMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as s}from"../../../../core/Promise.js";import{initial as c,sync as l,watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as d}from"../../../../core/screenUtils.js";import{property as f,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as g}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as _}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as v}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as y}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as b}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as x}from"../../../../layers/graphics/OptimizedFeature.js";import S from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as C}from"../../../../layers/support/fieldUtils.js";import{generateGradient as w}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as T}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as E}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as D}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as O}from"./highlightUtils.js";import{Attribute as k}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as A}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as j}from"../../webgl-engine/lib/Geometry.js";import{GeometryBaseInstance as M}from"../../webgl-engine/lib/GeometryBaseInstance.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as P}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as F,isScaleRangeActive as I}from"../../../support/layerViewUtils.js";import{PixelType as L}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as R,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const B=112;let V=class extends s{constructor(e){super(e),this.type=`heatmap`,this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=6408,this._baseInstance=new M([]),this._updatingHandles=new h}initialize(){let e;try{e=R(this._renderView.renderingContext,r.getLogger(this))}catch(t){this.addResolvingPromise(Promise.reject(t)),e=z}let{dataType:t,samplingMode:i,pixelFormat:a,internalFormat:o}=e;this._featureStore=new S({geometryType:`esriGeometryPoint`,hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=a;let s=t!==L.FLOAT,d=this.view.overlayManager,f={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:i,pixelFormat:a,internalFormat:o,rendererContext:d.renderer,drapeSource:this};this._drapeSourceRenderer=new A(f),d.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new P({usesHalfFloats:s}),this._materialWithField=new P({usesHalfFloats:s,isAttributeDriven:!0}),this._filterVisibility=new D({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),c),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),c),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},l),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(e!=null&&t){let t=0;this._featureStore.forEach(n=>t+=n.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},c),this.addHandles([u(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&r.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),u(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{e!=null&&!t&&r.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),n(()=>this.view.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy(),this._baseInstance=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){let e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,n=t?Math.ceil(t.graphics3D.maxTotalNumberOfFeatures*e):0,r=n*6;return new T(r,n)}get hasZ(){return`hasZ`in this.layer&&this.layer.hasZ===!0}get hasM(){return`hasM`in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;let{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:n}=this.view;return!F(n,e??0,t??0)}get usedMemory(){let e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===6403?1:4,n=this._dataType===L.FLOAT?4:2,r=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return r*r*t*n+e+H}get usedMemoryPerFeature(){let e=this._loadedPointGraphics.find(()=>!0);if(e==null)return 0;let t=o(e);return i([0,0],a)+(this._heatmapRendererFieldIsNumeric?a:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new E(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.overlayManager.renderer}get _overlaySpatialReference(){return this.view.overlayManager.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){let e=this._heatmapRenderer;if(e==null)return null;let{minDensity:t,maxDensity:n}=e;return{minDensity:t,maxDensity:n,fieldTotal:this._fieldTotal}}get _radiusParameter(){let e=this._heatmapRenderer;return e?{searchRadius:d(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){let e=this._heatmapRenderer;if(!e)return null;let{referenceScale:t}=e;return{resolutionForScale:t===0?0:v(t,this.view.spatialReference)}}get _colorRampParameter(){let e=this._heatmapRenderer;return e?{colorRampData:w(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return this.layer.geometryType===`point`}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){let e=this.layer.renderer;return e?.type===`heatmap`?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){let e=this._heatmapRendererFieldName;return e==null?null:this.layer.fieldsIndex.get(e)}get _heatmapRendererFieldIsNumeric(){let e=this._heatmapRendererField;return e!=null&&C(e)}get _isScaleRangeActive(){let{layer:e}=this;if(!(`effectiveScaleRange`in e))return!1;let{minScale:t,maxScale:n}=e.effectiveScaleRange;return I(t,n)}get _visibleFeatures(){return this._renderGeometries.values().reduce((e,{visible:t})=>e+ +!!t,0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return O}highlightByObjectIds(){return O}maskOccludee(){return n()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;let{objectIdField:n}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>y(e,n))),this._featureStore.addMany(e.added.map(e=>{let{attributes:t,centroid:r,geometry:i}=e,a=new x(b(i),t,r?b(r):null,y(e,n));return a.displayId=e.uid,a}));let r=e.added,i=e.removed;this._fieldTotal+=this._computeFieldTotalChange(r,i);let a=i.map(({uid:e})=>{let t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=r.map(e=>{let t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});a.length>0&&this._drapeSourceRenderer.removeGeometries(a,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||a.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;let e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){let t=this._heatmapRendererFieldName,n=t==null?this._material:this._materialWithField,r=m();g(e.geometry,r,this._overlaySpatialReference);let i=_(1),a=[[`position`,new k([r[0],r[1]],i,2)]],o=this._heatmapRendererFieldIsNumeric;t!=null&&a.push([`featureAttribute`,new k([o?e.attributes[t]??0:0],i,1)]);let s=new N(new j(n,a,null,void 0,this._baseInstance),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return s.visible=this.filterVisibility.defaultVisibility,s}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(this._heatmapRendererFieldName==null||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;let n=this._heatmapRendererFieldName,r=(e,t)=>e+(t.attributes[n]??0);return e.reduce(r,0)-t.reduce(r,0)}_clampSearchRadius(e){return e>112&&r.getLogger(this).warnOnce(`SceneView supports a maximum radius of 112 pt for HeatmapRenderer.`),Math.min(e,112)}_updateFeatureVisibilities(e){let t=[];this._featureStore.forEach(({objectId:n,displayId:r})=>{let i=e(n),a=this._renderGeometries.get(r);a&&a.visible!==i&&(t.push(a),a.visible=i)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){let t=[];for(let n of this._renderGeometries.values())n.visible!==e&&(t.push(n),n.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([f()],V.prototype,`type`,void 0),e([f({constructOnly:!0})],V.prototype,`owner`,void 0),e([f()],V.prototype,`layer`,null),e([f()],V.prototype,`featureStore`,null),e([f()],V.prototype,`updating`,null),e([f()],V.prototype,`updatingRemaining`,null),e([f()],V.prototype,`suspendInfo`,null),e([f()],V.prototype,`legendEnabled`,null),e([f()],V.prototype,`filterVisibility`,null),e([f()],V.prototype,`displayFeatureLimit`,null),e([f()],V.prototype,`preferredUpdatePolicy`,void 0),e([f()],V.prototype,`hasZ`,null),e([f()],V.prototype,`hasM`,null),e([f()],V.prototype,`dataExtent`,void 0),e([f()],V.prototype,`view`,null),e([f()],V.prototype,`fullOpacity`,null),e([f()],V.prototype,`updatePolicy`,null),e([f()],V.prototype,`drapeSourceType`,void 0),e([f()],V.prototype,`scaleVisibilitySuspended`,null),e([f()],V.prototype,`renderer`,null),e([f()],V.prototype,`_featureStore`,void 0),e([f()],V.prototype,`_filterVisibility`,void 0),e([f()],V.prototype,`_overlayRenderer`,null),e([f()],V.prototype,`_overlaySpatialReference`,null),e([f()],V.prototype,`_rendererParameters`,null),e([f()],V.prototype,`_materialParameters`,null),e([f()],V.prototype,`_densityParameters`,null),e([f()],V.prototype,`_radiusParameter`,null),e([f()],V.prototype,`_resolutionForScaleParameter`,null),e([f()],V.prototype,`_colorRampParameter`,null),e([f()],V.prototype,`_pixelRatioParameter`,null),e([f()],V.prototype,`_densityMapPixelRatio`,null),e([f()],V.prototype,`_renderGeometries`,void 0),e([f()],V.prototype,`_material`,void 0),e([f()],V.prototype,`_materialWithField`,void 0),e([f()],V.prototype,`_renderView`,null),e([f()],V.prototype,`_featuresArePoints`,null),e([f()],V.prototype,`_loadedPointGraphics`,null),e([f()],V.prototype,`_heatmapRenderer`,null),e([f()],V.prototype,`_heatmapRendererFieldName`,null),e([f()],V.prototype,`_heatmapRendererField`,null),e([f()],V.prototype,`_heatmapRendererFieldIsNumeric`,null),e([f()],V.prototype,`_fieldTotal`,void 0),e([f()],V.prototype,`_drapeSourceRenderer`,void 0),e([f()],V.prototype,`_isScaleRangeActive`,null),V=e([p(`esri.views.3d.layers.support.HeatmapFeatureProcessor`)],V);const H=i([0,0,0,0,0,0,0,0],a);export{V as HeatmapFeatureProcessor,B as maxRadiusPt};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{estimateFixedArrayMemory as i,estimateNumberMemory as a,estimateAttributesMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as s}from"../../../../core/Promise.js";import{initial as c,sync as l,watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as d}from"../../../../core/screenUtils.js";import{property as f,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as g}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as _}from"../../../../geometry/support/Indices.js";import{scaleBoundsPredicate as v,getResolutionForScale as y,isScaleRangeActive as b}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as x}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as S}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as C}from"../../../../layers/graphics/OptimizedFeature.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as T}from"../../../../layers/support/fieldUtils.js";import{generateGradient as E}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as D}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as O}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as k}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as A}from"./highlightUtils.js";import{Attribute as j}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as M}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{GeometryBaseInstance as P}from"../../webgl-engine/lib/GeometryBaseInstance.js";import{RenderGeometry as F}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as I}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{PixelType as L}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as R,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const B=112;let V=class extends s{constructor(e){super(e),this.type=`heatmap`,this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=6408,this._baseInstance=new P([]),this._updatingHandles=new h}initialize(){let e;try{e=R(this._renderView.renderingContext,r.getLogger(this))}catch(t){this.addResolvingPromise(Promise.reject(t)),e=z}let{dataType:t,samplingMode:i,pixelFormat:a,internalFormat:o}=e;this._featureStore=new w({geometryType:`esriGeometryPoint`,hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=a;let s=t!==L.FLOAT,d=this.view.overlayManager,f={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:i,pixelFormat:a,internalFormat:o,rendererContext:d.renderer,drapeSource:this};this._drapeSourceRenderer=new M(f),d.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new I({usesHalfFloats:s}),this._materialWithField=new I({usesHalfFloats:s,isAttributeDriven:!0}),this._filterVisibility=new k({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),c),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),c),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},l),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(e!=null&&t){let t=0;this._featureStore.forEach(n=>t+=n.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},c),this.addHandles([u(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&r.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),u(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{e!=null&&!t&&r.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),n(()=>this.view.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy(),this._baseInstance=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){let e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,n=t?Math.ceil(t.graphics3D.maxTotalNumberOfFeatures*e):0,r=n*6;return new D(r,n)}get hasZ(){return`hasZ`in this.layer&&this.layer.hasZ===!0}get hasM(){return`hasM`in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;let{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:n}=this.view;return!v(n,e??0,t??0)}get usedMemory(){let e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===6403?1:4,n=this._dataType===L.FLOAT?4:2,r=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return r*r*t*n+e+H}get usedMemoryPerFeature(){let e=this._loadedPointGraphics.find(()=>!0);if(e==null)return 0;let t=o(e);return i([0,0],a)+(this._heatmapRendererFieldIsNumeric?a:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new O(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.overlayManager.renderer}get _overlaySpatialReference(){return this.view.overlayManager.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){let e=this._heatmapRenderer;if(e==null)return null;let{minDensity:t,maxDensity:n}=e;return{minDensity:t,maxDensity:n,fieldTotal:this._fieldTotal}}get _radiusParameter(){let e=this._heatmapRenderer;return e?{searchRadius:d(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){let e=this._heatmapRenderer;if(!e)return null;let{referenceScale:t}=e;return{resolutionForScale:t===0?0:y(t,this.view.spatialReference)}}get _colorRampParameter(){let e=this._heatmapRenderer;return e?{colorRampData:E(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return this.layer.geometryType===`point`}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){let e=this.layer.renderer;return e?.type===`heatmap`?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){let e=this._heatmapRendererFieldName;return e==null?null:this.layer.fieldsIndex.get(e)}get _heatmapRendererFieldIsNumeric(){let e=this._heatmapRendererField;return e!=null&&T(e)}get _isScaleRangeActive(){let{layer:e}=this;if(!(`effectiveScaleRange`in e))return!1;let{minScale:t,maxScale:n}=e.effectiveScaleRange;return b(t,n)}get _visibleFeatures(){return this._renderGeometries.values().reduce((e,{visible:t})=>e+ +!!t,0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return A}highlightByObjectIds(){return A}maskOccludee(){return n()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;let{objectIdField:n}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>x(e,n))),this._featureStore.addMany(e.added.map(e=>{let{attributes:t,centroid:r,geometry:i}=e,a=new C(S(i),t,r?S(r):null,x(e,n));return a.displayId=e.uid,a}));let r=e.added,i=e.removed;this._fieldTotal+=this._computeFieldTotalChange(r,i);let a=i.map(({uid:e})=>{let t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=r.map(e=>{let t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});a.length>0&&this._drapeSourceRenderer.removeGeometries(a,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||a.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;let e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){let t=this._heatmapRendererFieldName,n=t==null?this._material:this._materialWithField,r=m();g(e.geometry,r,this._overlaySpatialReference);let i=_(1),a=[[`position`,new j([r[0],r[1]],i,2)]],o=this._heatmapRendererFieldIsNumeric;t!=null&&a.push([`featureAttribute`,new j([o?e.attributes[t]??0:0],i,1)]);let s=new F(new N(n,a,null,void 0,this._baseInstance),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return s.visible=this.filterVisibility.defaultVisibility,s}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(this._heatmapRendererFieldName==null||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;let n=this._heatmapRendererFieldName,r=(e,t)=>e+(t.attributes[n]??0);return e.reduce(r,0)-t.reduce(r,0)}_clampSearchRadius(e){return e>112&&r.getLogger(this).warnOnce(`SceneView supports a maximum radius of 112 pt for HeatmapRenderer.`),Math.min(e,112)}_updateFeatureVisibilities(e){let t=[];this._featureStore.forEach(({objectId:n,displayId:r})=>{let i=e(n),a=this._renderGeometries.get(r);a&&a.visible!==i&&(t.push(a),a.visible=i)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){let t=[];for(let n of this._renderGeometries.values())n.visible!==e&&(t.push(n),n.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([f()],V.prototype,`type`,void 0),e([f({constructOnly:!0})],V.prototype,`owner`,void 0),e([f()],V.prototype,`layer`,null),e([f()],V.prototype,`featureStore`,null),e([f()],V.prototype,`updating`,null),e([f()],V.prototype,`updatingRemaining`,null),e([f()],V.prototype,`suspendInfo`,null),e([f()],V.prototype,`legendEnabled`,null),e([f()],V.prototype,`filterVisibility`,null),e([f()],V.prototype,`displayFeatureLimit`,null),e([f()],V.prototype,`preferredUpdatePolicy`,void 0),e([f()],V.prototype,`hasZ`,null),e([f()],V.prototype,`hasM`,null),e([f()],V.prototype,`dataExtent`,void 0),e([f()],V.prototype,`view`,null),e([f()],V.prototype,`fullOpacity`,null),e([f()],V.prototype,`updatePolicy`,null),e([f()],V.prototype,`drapeSourceType`,void 0),e([f()],V.prototype,`scaleVisibilitySuspended`,null),e([f()],V.prototype,`renderer`,null),e([f()],V.prototype,`_featureStore`,void 0),e([f()],V.prototype,`_filterVisibility`,void 0),e([f()],V.prototype,`_overlayRenderer`,null),e([f()],V.prototype,`_overlaySpatialReference`,null),e([f()],V.prototype,`_rendererParameters`,null),e([f()],V.prototype,`_materialParameters`,null),e([f()],V.prototype,`_densityParameters`,null),e([f()],V.prototype,`_radiusParameter`,null),e([f()],V.prototype,`_resolutionForScaleParameter`,null),e([f()],V.prototype,`_colorRampParameter`,null),e([f()],V.prototype,`_pixelRatioParameter`,null),e([f()],V.prototype,`_densityMapPixelRatio`,null),e([f()],V.prototype,`_renderGeometries`,void 0),e([f()],V.prototype,`_material`,void 0),e([f()],V.prototype,`_materialWithField`,void 0),e([f()],V.prototype,`_renderView`,null),e([f()],V.prototype,`_featuresArePoints`,null),e([f()],V.prototype,`_loadedPointGraphics`,null),e([f()],V.prototype,`_heatmapRenderer`,null),e([f()],V.prototype,`_heatmapRendererFieldName`,null),e([f()],V.prototype,`_heatmapRendererField`,null),e([f()],V.prototype,`_heatmapRendererFieldIsNumeric`,null),e([f()],V.prototype,`_fieldTotal`,void 0),e([f()],V.prototype,`_drapeSourceRenderer`,void 0),e([f()],V.prototype,`_isScaleRangeActive`,null),V=e([p(`esri.views.3d.layers.support.HeatmapFeatureProcessor`)],V);const H=i([0,0,0,0,0,0,0,0],a);export{V as HeatmapFeatureProcessor,B as maxRadiusPt};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- class e{constructor(e,t){this._maxTotalSamples=e,this._maxDistance=t,this.count=0,this.numSamples=0}get done(){return this.numRemainingSamples===0}get numRemainingSamples(){return Math.max(0,this._maxTotalSamples-this.numSamples)}get ratio(){return this.numSamples?this.count/this.numSamples:0}sampleGeometry(e,t,n){switch(e?.type){case`point`:if(t?.type!==`point`)return;this._withinDistance(e.x-t.x,e.y-t.y)&&this.count++,this.numSamples++;break;case`polyline`:case`polygon`:{let t=e.type===`polyline`?e.paths:e.rings;for(let e=0;e<t.length;e++){let r=t[e],i=t.length-e,a=n/i,o=Math.max(1,Math.ceil(r.length/a));for(let e=Math.floor(o/2);e<r.length-1;e+=o){let t=r[e],i=r[e+1],a=i[0]-t[0],o=i[1]-t[1];if(this._withinDistance(a,o)&&this.count++,this.numSamples++,n--,n<=0||this.numSamples>=this._maxTotalSamples)return}}}}}_withinDistance(e,t){return Math.abs(e)<=this._maxDistance||Math.abs(t)<=this._maxDistance}}export{e as SampledGeometryMaxDistanceRatio};
2
+ class e{constructor(e,t){this._maxTotalSamples=e,this.count=0,this.numSamples=0,this._maxDistanceSquared=t**2}get done(){return this.numRemainingSamples===0}get numRemainingSamples(){return Math.max(0,this._maxTotalSamples-this.numSamples)}get ratio(){return this.numSamples?this.count/this.numSamples:0}sampleGeometry(e,t,n){switch(e?.type){case`point`:if(t?.type!==`point`)return;this._withinDistance(e.x-t.x,e.y-t.y)&&this.count++,this.numSamples++;break;case`polyline`:case`polygon`:{let t=e.type===`polyline`?e.paths:e.rings;for(let e=0;e<t.length;e++){let r=t[e],i=t.length-e,a=n/i,o=Math.max(1,Math.ceil(r.length/a));for(let e=Math.floor(o/2);e<r.length-1;e+=o){let t=r[e],i=r[e+1],a=i[0]-t[0],o=i[1]-t[1];if(this._withinDistance(a,o)&&this.count++,this.numSamples++,n--,n<=0||this.numSamples>=this._maxTotalSamples)return}}}}}_withinDistance(e,t){return e**2+t**2<=this._maxDistanceSquared}}export{e as SampledGeometryMaxDistanceRatio};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isScreenRect as e,createScreenPoint as t}from"../../../core/screenUtils.js";import{isTiledLayer as n,isLayerWithFlowRenderer as r}from"../../../layers/support/layerUtils.js";import{hitTestSelectSimilarDistance as i}from"../../support/hitTestSelectUtils.js";import{isScaleRangeActive as a,scaleBoundsPredicate as o}from"../../support/layerViewUtils.js";async function s(s,d){let f=await i(s,d),{results:p}=f,m=f.ground,h=e(d)?s.toMap(t(d.x+d.width/2,d.y+d.height/2)):m.mapPoint,g=h!=null,_=[],v=u(s),y=m.layer==null,b=g?c(s,v,y):l,x=0,S=0,C=()=>{let e=b.layerViews[S++];if(!g||!e||!(`fetchPopupFeaturesAtTarget`in e))return;let t=h,i=e.layer;if(n(i)&&`effectiveScaleRange`in i){let{minScale:e,maxScale:n}=i.effectiveScaleRange;if(a(e,n)){if(r(i)&&!o(s.scale,e,n))return;let a=s.basemapTerrain.getScale(t);if(!o(a,e,n))return}}_.push({geometry:t,layerView:e})},w=null;for(;x<p.length||S<b.layerViews.length;){let e=p[x];if(e&&e.type!==`graphic`)++x;else if(e?.layer?.type===`scene`&&e?.layer?.parent===s?.map?.basemap)++x;else if(e){let t=e.layer?.uid,n=b.layerUids.has(t)&&e.distance===m.distance,r=v.get(e.layer?.uid);if(w??=e.mapPoint,S<b.layerViews.length&&(n||(e.distance??0)>m.distance)&&b.layerViews[S]!==r){C();continue}_.push({graphic:e.graphic,layerView:r}),++x}else C()}return w??=h,{hits:_,location:w}}function c(e,t,n){let r=new Set,i=new Set,a=e=>{e&&(r.add(e.layer.uid),i.add(e))};if(n){let{basemapTerrain:t}=e,n=t.numLayers(1);for(let e=n-1;e>=0;e--)a(t.layerViewByIndex(e,1))}let o=e.overlayManager.renderer.layers;for(let{uid:e}of o)a(t.get(e));return{layerUids:r,layerViews:Array.from(i).reverse()}}const l={layerUids:new Set,layerViews:[]};function u(e){let t=new Map;for(let n of e.allLayerViews){let e=n.layer.uid;t.set(e,n)}return t}export{s as popupHitTest};
2
+ import{isScreenRect as e,createScreenPoint as t}from"../../../core/screenUtils.js";import{isScaleRangeActive as n,scaleBoundsPredicate as r}from"../../../geometry/support/scaleUtils.js";import{isTiledLayer as i,isLayerWithFlowRenderer as a}from"../../../layers/support/layerUtils.js";import{hitTestSelectSimilarDistance as o}from"../../support/hitTestSelectUtils.js";async function s(s,d){let f=await o(s,d),{results:p}=f,m=f.ground,h=e(d)?s.toMap(t(d.x+d.width/2,d.y+d.height/2)):m.mapPoint,g=h!=null,_=[],v=u(s),y=m.layer==null,b=g?c(s,v,y):l,x=0,S=0,C=()=>{let e=b.layerViews[S++];if(!g||!e||!(`fetchPopupFeaturesAtTarget`in e))return;let t=h,o=e.layer;if(i(o)&&`effectiveScaleRange`in o){let{minScale:e,maxScale:i}=o.effectiveScaleRange;if(n(e,i)){if(a(o)&&!r(s.scale,e,i))return;let n=s.basemapTerrain.getScale(t);if(!r(n,e,i))return}}_.push({geometry:t,layerView:e})},w=null;for(;x<p.length||S<b.layerViews.length;){let e=p[x];if(e&&e.type!==`graphic`)++x;else if(e?.layer?.type===`scene`&&e?.layer?.parent===s?.map?.basemap)++x;else if(e){let t=e.layer?.uid,n=b.layerUids.has(t)&&e.distance===m.distance,r=v.get(e.layer?.uid);if(w??=e.mapPoint,S<b.layerViews.length&&(n||(e.distance??0)>m.distance)&&b.layerViews[S]!==r){C();continue}_.push({graphic:e.graphic,layerView:r}),++x}else C()}return w??=h,{hits:_,location:w}}function c(e,t,n){let r=new Set,i=new Set,a=e=>{e&&(r.add(e.layer.uid),i.add(e))};if(n){let{basemapTerrain:t}=e,n=t.numLayers(1);for(let e=n-1;e>=0;e--)a(t.layerViewByIndex(e,1))}let o=e.overlayManager.renderer.layers;for(let{uid:e}of o)a(t.get(e));return{layerUids:r,layerViews:Array.from(i).reverse()}}const l={layerUids:new Set,layerViews:[]};function u(e){let t=new Map;for(let n of e.allLayerViews){let e=n.layer.uid;t.set(e,n)}return t}export{s as popupHitTest};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,sync as i}from"../../../../core/reactiveUtils.js";import{signal as a}from"../../../../core/signal.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{cloudPresets as c}from"./clouds/CloudsPresets.js";import{CloudsRenderer as l}from"./clouds/CloudsRenderer.js";import{Precipitation as u}from"./precipitation/Precipitation.js";let d=class extends t{constructor(e){super(e),this._clouds=a(null),this._incarnation=0,this._precipitation=null}initialize(){let e=()=>this._requestRender();this.addHandles([r(()=>this._precipitation,e,i),r(()=>this._clouds.value?.state,e,i),r(()=>this.view.state.mode,e,i),r(()=>this.view.state.stationary&&!!this.context.bind.clouds.data&&this.context.bind.clouds.needsStationaryAnchorUpdate(this.view.state.camera),t=>{t&&e()},i),r(()=>this._updateClouds(),e,i),r(()=>this._updatePrecipitation(),e,i),r(()=>this.weather,e=>this._initWeather(e))])}destroy(){this.removeHandles(),this._clouds.value=n(this._clouds.value),this._precipitation=null,this._precipitationOutgoing=null}get readyToRun(){return!!this._clouds.value?.readyToRun||this.view.state.stationary&&!!this.context.bind.clouds.data&&this.context.bind.clouds.needsStationaryAnchorUpdate(this.view.state.camera)}get usedMemory(){return this._clouds.value?.usedMemory??0}_fadeOutPrecipitation(){this._precipitation&&(this._precipitationOutgoing?.destroy(),this._precipitationOutgoing=this._precipitation,this._precipitationOutgoing.fadeOut(()=>this._precipitationOutgoing=n(this._precipitationOutgoing)),this._precipitation=null,++this._incarnation)}get snowCover(){return this._precipitationOutgoing?.snowCover??this._precipitation?.snowCover??0}get weather(){return this.view?.environmentManager?.weatherEnabled?this.view.environment.weather:null}cleanupCubemap(){let e=this._clouds.value;e?.state===0&&e.coverage===0&&!e.readyToRun&&e.destroyCubeMap()}_requestRender(){this.view.stage.renderView.requestRender()}_initWeather(e){!e||!this.context?this._clouds.value=n(this._clouds.value):this._clouds.value||(this._clouds.value=new l({context:this.context,view:this.view,requestRender:()=>this._requestRender()}))}_updateClouds(){let e=this.view.environment.weather;return e==null||this._clouds.value==null||this._clouds.value.applyPreset(c[e.type],f(e)),++this._incarnation}_updatePrecipitation(){let e=this.view.environment.weather;return e.type===this._precipitation?.type||(this._fadeOutPrecipitation(),(e.type===`rainy`||e.type===`snowy`)&&(this._precipitation=new u({view:this.view,type:e.type}),++this._incarnation)),this._incarnation}get test(){}};e([o({constructOnly:!0})],d.prototype,`view`,void 0),e([o({constructOnly:!0})],d.prototype,`context`,void 0),d=e([s(`esri.views.3d.webgl-engine.effects.WeatherFader`)],d);function f(e){switch(e.type){case`rainy`:case`snowy`:case`cloudy`:case`sunny`:return e.cloudCover;case`foggy`:return e.fogStrength}}export{d as WeatherFader};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,sync as i}from"../../../../core/reactiveUtils.js";import{signal as a}from"../../../../core/signal.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{cloudPresets as c}from"./clouds/CloudsPresets.js";import{CloudsRenderer as l}from"./clouds/CloudsRenderer.js";import{Precipitation as u}from"./precipitation/Precipitation.js";let d=class extends t{constructor(e){super(e),this._clouds=a(null),this._incarnation=0,this._precipitation=null}initialize(){let e=()=>this._requestRender();this.addHandles([r(()=>this._precipitation,e,i),r(()=>this._clouds.value?.state,e,i),r(()=>this.view.state.mode,e,i),r(()=>this.view.state.stationary&&!!this.context.bind.clouds.data&&this.context.bind.clouds.needsStationaryAnchorUpdate(this.view.state.camera),t=>{t&&e()},i),r(()=>this._updateClouds(),e,i),r(()=>this._updatePrecipitation(),e,i),r(()=>this.view.environmentView.weatherEnabled?this.view.environment.weather:null,e=>this._initWeather(e))])}destroy(){this.removeHandles(),this._clouds.value=n(this._clouds.value),this._precipitation=null,this._precipitationOutgoing=null}get readyToRun(){return!!this._clouds.value?.readyToRun||this.view.state.stationary&&!!this.context.bind.clouds.data&&this.context.bind.clouds.needsStationaryAnchorUpdate(this.view.state.camera)}get usedMemory(){return this._clouds.value?.usedMemory??0}_fadeOutPrecipitation(){this._precipitation&&(this._precipitationOutgoing?.destroy(),this._precipitationOutgoing=this._precipitation,this._precipitationOutgoing.fadeOut(()=>this._precipitationOutgoing=n(this._precipitationOutgoing)),this._precipitation=null,++this._incarnation)}get snowCover(){return this._precipitationOutgoing?.snowCover??this._precipitation?.snowCover??0}cleanupCubemap(){let e=this._clouds.value;e?.state===0&&e.coverage===0&&!e.readyToRun&&e.destroyCubeMap()}_requestRender(){this.view.stage.renderView.requestRender()}_initWeather(e){!e||!this.context?this._clouds.value=n(this._clouds.value):this._clouds.value||(this._clouds.value=new l({context:this.context,view:this.view,requestRender:()=>this._requestRender()}))}_updateClouds(){let e=this.view.environment.weather;return e==null||this._clouds.value==null||this._clouds.value.applyPreset(c[e.type],f(e)),++this._incarnation}_updatePrecipitation(){let e=this.view.environment.weather;return e.type===this._precipitation?.type||(this._fadeOutPrecipitation(),(e.type===`rainy`||e.type===`snowy`)&&(this._precipitation=new u({view:this.view,type:e.type}),++this._incarnation)),this._incarnation}get test(){}};e([o({constructOnly:!0})],d.prototype,`view`,void 0),e([o({constructOnly:!0})],d.prototype,`context`,void 0),d=e([s(`esri.views.3d.webgl-engine.effects.WeatherFader`)],d);function f(e){switch(e.type){case`rainy`:case`snowy`:case`cloudy`:case`sunny`:return e.cloudCover;case`foggy`:return e.fogStrength}}export{d as WeatherFader};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as n,initial as r}from"../../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{PBRDefaultConfiguration as a}from"../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{OpaqueEnvironment as o}from"../OpaqueEnvironment.js";import{CloudsCompositionTechnique as s}from"./CloudsCompositionTechnique.js";import{createQuadVAO as c}from"../../lib/glUtil3D.js";import{ColorAttachment0 as l,PrimitiveType as u}from"../../../../webgl/enums.js";import{noParameters as d}from"../../../../webgl/NoParameters.js";let f=class extends o{constructor(){super(...arguments),this._configuration=new a}initialize(){this.addHandles([n(()=>this.view.environment.weather!=null&&this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),r)])}destroy(){this._vao=t(this._vao)}render(){let e=this.input,t=this.bindParameters.clouds;if(!t.data)return e;let n=this.techniques.getCompiled(s,this._configuration);if(!n)return this.requestRender(1),e;let r=this.renderingContext;this._vao??=c(r);let i=r.bindTechnique(n,this.bindParameters,d);return r.setDrawBuffers([l]),r.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(u.TRIANGLE_STRIP,0,4),t.isFading&&this.requestRender(2),e}};f=e([i(`esri.views.3d.webgl-engine.effects.clouds.CloudsComposition`)],f);export{f as CloudsComposition};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as n,initial as r}from"../../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{PBRDefaultConfiguration as a}from"../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{OpaqueEnvironment as o}from"../OpaqueEnvironment.js";import{CloudsCompositionTechnique as s}from"./CloudsCompositionTechnique.js";import{createQuadVAO as c}from"../../lib/glUtil3D.js";import{ColorAttachment0 as l,PrimitiveType as u}from"../../../../webgl/enums.js";import{noParameters as d}from"../../../../webgl/NoParameters.js";let f=class extends o{constructor(){super(...arguments),this._configuration=new a}initialize(){this.addHandles([n(()=>this.view.environmentView.weatherEnabled,e=>e?this._enable():this._disable(),r)])}destroy(){this._vao=t(this._vao)}render(){let e=this.input,t=this.bindParameters.clouds;if(!t.data)return e;let n=this.techniques.getCompiled(s,this._configuration);if(!n)return this.requestRender(1),e;let r=this.renderingContext;this._vao??=c(r);let i=r.bindTechnique(n,this.bindParameters,d);return r.setDrawBuffers([l]),r.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(u.TRIANGLE_STRIP,0,4),t.isFading&&this.requestRender(2),e}};f=e([i(`esri.views.3d.webgl-engine.effects.clouds.CloudsComposition`)],f);export{f as CloudsComposition};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{smoothstep as t,lerp as n}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{signal as o}from"../../../../../core/signal.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{add as c,normalize as l,length as u,dot as d,scale as f,lerp as p}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{heightLimit as _}from"../../../environment/weather.js";import{betaRayleigh as v,betaCombined as y}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as x}from"./FogTechnique.js";import{BlurEmission as S}from"../glow/BlurEmission.js";import{EmissiveTechniqueConfiguration as C}from"../../shaders/EmissiveTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as T,SizedPixelFormat as E,ColorAttachment0 as D,DepthStencilAttachment as O}from"../../../../webgl/enums.js";const k=.9*_,A=1.1*_;let j=class extends S{constructor(){super(...arguments),this._configuration=new C,this._newParameters=new M,this._oldParameters=new M,this._fadedParameters=new M,this._parameters=this._newParameters,this._passParameters=new b}initialize(){this.addHandles([i(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),a),i(()=>this.view.environment.weather,()=>this._updateEnabled(),a),i(()=>this._updateFogParameters(),()=>{},a),i(()=>this._fadeFactor,e=>this._fade(e),a)])}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){let{_newParameters:t,_oldParameters:n}=this;e>=1?(this._parameters=t,this._oldParameters.copy(this._newParameters)):e<=0?this._parameters=n:(this._fadedParameters.lerp(n,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){let{weather:e,weatherAvailable:t}=this.view.environment,n=e.type===`foggy`||e.type===`snowy`||e.type===`rainy`;this._newParameters.strength.value=t?e.scattering:0,this._newParameters.amount.value=+!!n,(e.type===`foggy`||e.type===`snowy`)&&(this._newParameters.fogBrightness=z),e.type===`rainy`&&(this._newParameters.fogBrightness=R),this._fadeFactor>=1&&this._oldParameters.copy(this._newParameters),this.requestRender(2)}get strength(){return this._parameters.strength.value*this._heightFade}get amount(){return this._parameters.amount.value*this._heightFade}get _heightFade(){let e=u(this.bindParameters.camera.eye);return 1-t(k,A,Math.abs(e-this._ellipsoid.radius))}precompile(){this._update(),this._passParameters.amount>0&&(super.precompile(),this.techniques.precompile(x,this._configuration))}get _needsEmissionBlur(){return this._configuration.hasEmissive}render(){let e=this.input,t=this._getTechnique();if(!t)return e;this._passParameters.emission=e.obtainAttachment(T),this._passParameters.inputScale=this._passParameters.emission?.attachment.descriptor.internalFormat===E.RGBA8?w:1;let n=this.renderingContext;this._passParameters.emission&&(this._renderEmissionMipMap(),this._configuration.useFloatBlend?(e.acquireColor(T,8,`emissive`),n.clearBuffer(1,g)):(this._passParameters.color=e.obtainAttachment(D),e.acquireColor(D,5),e.acquireColor(T,8,`emissive`)));let i=e.getAttachment(O);return e.attachDepth(null),n.bindFramebuffer(e.fbo),n.bindTechnique(t,this.bindParameters,this._passParameters),n.screen.draw(),this._passParameters.color=r(this._passParameters.color),this._passParameters.emission=r(this._passParameters.emission),this._passParameters.mipmapTexture=r(this._passParameters.mipmapTexture),e.attachDepth(i),this.fboCache.debugCallback?.(`fog-color`,e.fbo),e}_getTechnique(){return this.renders?this.techniques.get(x,this._configuration):null}get renders(){return this._update(),this._passParameters.amount>0}_update(){let e=this.bindParameters.camera;l(N,e.eye);let t=Math.max(0,d(N,this.bindParameters.lighting.mainLight.direction)),n=this._parameters.fogBrightness;f(this._passParameters.fogColor,I,n),f(P,I,n*.1),p(this._passParameters.fogColor,P,this._passParameters.fogColor,t);let r=u(e.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.amount=this.amount,this._passParameters.strength=this._passParameters.scattering=this.strength,this._configuration.hasEmissive=this.bindParameters.hasEmission,this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value}get test(){return{parameters:this._passParameters}}};j=e([s(`esri.views.3d.webgl-engine.effects.fog.Fog`)],j);class M{constructor(){this.fogBrightness=0,this.strength=o(0),this.amount=o(0)}copy(e){this.fogBrightness=e.fogBrightness,this.strength.value=e.strength.value,this.amount.value=e.amount.value}lerp(e,t,r){this.fogBrightness=n(e.fogBrightness,t.fogBrightness,r),this.strength.value=n(e.strength.value,t.strength.value,r),this.amount.value=n(e.amount.value,t.amount.value,r)}}const N=m(),P=m(),F=h(3e-4,3e-4,3e-4),I=m();c(I,y,v),c(I,I,F),l(I,I);const L=I.reduce((e,t)=>e+t,0)/3,R=.5/L,z=1.5/L;export{j as Fog,M as FogParameters};
2
+ import{__decorate as e}from"tslib";import{smoothstep as t,lerp as n}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{signal as o}from"../../../../../core/signal.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{add as c,normalize as l,length as u,dot as d,scale as f,lerp as p}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{heightLimit as _}from"../../../environment/weather.js";import{betaRayleigh as v,betaCombined as y}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as x}from"./FogTechnique.js";import{BlurEmission as S}from"../glow/BlurEmission.js";import{EmissiveTechniqueConfiguration as C}from"../../shaders/EmissiveTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as T,SizedPixelFormat as E,ColorAttachment0 as D,DepthStencilAttachment as O}from"../../../../webgl/enums.js";const k=.9*_,A=1.1*_;let j=class extends S{constructor(){super(...arguments),this._configuration=new C,this._newParameters=new M,this._oldParameters=new M,this._fadedParameters=new M,this._parameters=this._newParameters,this._passParameters=new b}initialize(){this.addHandles([i(()=>this.view.environmentView.weather!=null,e=>e?this._enable():this._disable(),a),i(()=>this._updateFogParameters(),()=>{},a),i(()=>this._fadeFactor,e=>this._fade(e),a)])}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){let{_newParameters:t,_oldParameters:n}=this;e>=1?(this._parameters=t,this._oldParameters.copy(this._newParameters)):e<=0?this._parameters=n:(this._fadedParameters.lerp(n,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){let{weather:e}=this.view.environmentView,t=e?.type===`foggy`||e?.type===`snowy`||e?.type===`rainy`;this._newParameters.strength.value=e?.scattering??0,this._newParameters.amount.value=+!!t,(e?.type===`foggy`||e?.type===`snowy`)&&(this._newParameters.fogBrightness=z),e?.type===`rainy`&&(this._newParameters.fogBrightness=R),this._fadeFactor>=1&&this._oldParameters.copy(this._newParameters),this.requestRender(2)}get strength(){return this._parameters.strength.value*this._heightFade}get amount(){return this._parameters.amount.value*this._heightFade}get _heightFade(){let e=u(this.bindParameters.camera.eye);return 1-t(k,A,Math.abs(e-this._ellipsoid.radius))}precompile(){this._update(),this._passParameters.amount>0&&(super.precompile(),this.techniques.precompile(x,this._configuration))}get _needsEmissionBlur(){return this._configuration.hasEmissive}render(){let e=this.input,t=this._getTechnique();if(!t)return e;this._passParameters.emission=e.obtainAttachment(T),this._passParameters.inputScale=this._passParameters.emission?.attachment.descriptor.internalFormat===E.RGBA8?w:1;let n=this.renderingContext;this._passParameters.emission&&(this._renderEmissionMipMap(),this._configuration.useFloatBlend?(e.acquireColor(T,8,`emissive`),n.clearBuffer(1,g)):(this._passParameters.color=e.obtainAttachment(D),e.acquireColor(D,5),e.acquireColor(T,8,`emissive`)));let i=e.getAttachment(O);return e.attachDepth(null),n.bindFramebuffer(e.fbo),n.bindTechnique(t,this.bindParameters,this._passParameters),n.screen.draw(),this._passParameters.color=r(this._passParameters.color),this._passParameters.emission=r(this._passParameters.emission),this._passParameters.mipmapTexture=r(this._passParameters.mipmapTexture),e.attachDepth(i),this.fboCache.debugCallback?.(`fog-color`,e.fbo),e}_getTechnique(){return this.renders?this.techniques.get(x,this._configuration):null}get renders(){return this._update(),this._passParameters.amount>0}_update(){let e=this.bindParameters.camera;l(N,e.eye);let t=Math.max(0,d(N,this.bindParameters.lighting.mainLight.direction)),n=this._parameters.fogBrightness;f(this._passParameters.fogColor,I,n),f(P,I,n*.1),p(this._passParameters.fogColor,P,this._passParameters.fogColor,t);let r=u(e.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.amount=this.amount,this._passParameters.strength=this._passParameters.scattering=this.strength,this._configuration.hasEmissive=this.bindParameters.hasEmission,this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value}get test(){return{parameters:this._passParameters}}};j=e([s(`esri.views.3d.webgl-engine.effects.fog.Fog`)],j);class M{constructor(){this.fogBrightness=0,this.strength=o(0),this.amount=o(0)}copy(e){this.fogBrightness=e.fogBrightness,this.strength.value=e.strength.value,this.amount.value=e.amount.value}lerp(e,t,r){this.fogBrightness=n(e.fogBrightness,t.fogBrightness,r),this.strength.value=n(e.strength.value,t.strength.value,r),this.amount.value=n(e.amount.value,t.amount.value,r)}}const N=m(),P=m(),F=h(3e-4,3e-4,3e-4),I=m();c(I,y,v),c(I,I,F),l(I,I);const L=I.reduce((e,t)=>e+t,0)/3,R=.5/L,z=1.5/L;export{j as Fog,M as FogParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{length as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{RenderNodeOutput as s}from"../../webgl.js";import{BlurEmission as c}from"../effects/glow/BlurEmission.js";import{E as l,a as u}from"../../../../chunks/EmissionComposite.glsl.js";import{EmissionCompositeTechnique as d}from"./EmissionCompositeTechnique.js";import{ColorAttachment1 as f,ColorAttachment0 as p}from"../../../webgl/enums.js";let m=class extends c{constructor(){super(...arguments),this.produces=s.COMPOSITE,this.consumes={required:[s.COMPOSITE]},this._configuration=new l,this._passParameters=new u}initialize(){this.addHandles([n(()=>this.bindParameters.emissions!==0,e=>this.produces=e?s.COMPOSITE:`disabled`,r)])}precompile(){this.bindParameters.emissions!==0&&(this._configuration.applyBlur=!this.view.stage.renderView.fog?.renders&&this._hasBlur,super.precompile(),this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(d,this._configuration))}get _needsEmissionBlur(){return this._configuration.applyBlur}render(){let e=this.input,n=e.getAttachment(f);if(!n?.attachment)return e;let r=o(this.bindParameters.camera.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.color=e.getAttachment(p)?.attachment,this._passParameters.emission=n,this._passParameters.scattering=this._configuration.applyBlur&&this.view.environment.weatherAvailable?this.view.stage.renderView.fog?.strength??this.view.environment.weather.scattering:0,this._configuration.applyBlur&&this._renderEmissionMipMap();let i=this.renderingContext,a=this.techniques.get(d,this._configuration),s=this.acquireOutputFramebuffer();return i.clear(16384),i.bindTechnique(a,this.bindParameters,this._passParameters),i.screen.draw(),this._passParameters.mipmapTexture=t(this._passParameters.mipmapTexture),s.moveAttachments(e),s}};e([i()],m.prototype,`produces`,void 0),e([i()],m.prototype,`consumes`,void 0),m=e([a(`esri.views.3d.webgl-engine.lib.EmissionComposite`)],m);export{m as EmissionComposite};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{length as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{RenderNodeOutput as s}from"../../webgl.js";import{BlurEmission as c}from"../effects/glow/BlurEmission.js";import{E as l,a as u}from"../../../../chunks/EmissionComposite.glsl.js";import{EmissionCompositeTechnique as d}from"./EmissionCompositeTechnique.js";import{ColorAttachment1 as f,ColorAttachment0 as p}from"../../../webgl/enums.js";let m=class extends c{constructor(){super(...arguments),this.produces=s.COMPOSITE,this.consumes={required:[s.COMPOSITE]},this._configuration=new l,this._passParameters=new u}initialize(){this.addHandles([n(()=>this.bindParameters.emissions!==0,e=>this.produces=e?s.COMPOSITE:`disabled`,r)])}precompile(){this.bindParameters.emissions!==0&&(this._configuration.applyBlur=!this.view.stage.renderView.fog?.renders&&this._hasBlur,super.precompile(),this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(d,this._configuration))}get _needsEmissionBlur(){return this._configuration.applyBlur}render(){let e=this.input,n=e.getAttachment(f);if(!n?.attachment)return e;let r=o(this.bindParameters.camera.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.color=e.getAttachment(p)?.attachment,this._passParameters.emission=n,this._passParameters.scattering=this._configuration.applyBlur&&this.view.environmentView.weather?this.view.stage.renderView.fog?.strength??this.view.environment.weather.scattering:0,this._configuration.applyBlur&&this._renderEmissionMipMap();let i=this.renderingContext,a=this.techniques.get(d,this._configuration),s=this.acquireOutputFramebuffer();return i.clear(16384),i.bindTechnique(a,this.bindParameters,this._passParameters),i.screen.draw(),this._passParameters.mipmapTexture=t(this._passParameters.mipmapTexture),s.moveAttachments(e),s}};e([i()],m.prototype,`produces`,void 0),e([i()],m.prototype,`consumes`,void 0),m=e([a(`esri.views.3d.webgl-engine.lib.EmissionComposite`)],m);export{m as EmissionComposite};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as D}from"../effects/highlight/Highlight.js";import{OITBlend as me}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Te,PerformanceCategory as I}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Ee,ColorAttachment0 as L,ColorAttachment1 as R,ColorAttachment2 as z,DrawBufferNone as De}from"../../../webgl/enums.js";const Oe=has(`disable-feature:async-navigation-3d-depth-readback`);let B=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new Te(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new me(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=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:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...q),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(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,n=!1){try{return this._isRendering=!0,this._render(e,t,n)}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(J),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...H),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(I.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),!Oe&&(c===2||c===0)&&this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...U),t.output=0,this._plugins.precompile(...U),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(I.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Ee.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?I.OPAQUE_EDGES:I.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(I.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?I.AMBIENT_ILLUMINATION_HIGH_QUALITY:I.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(L);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,L),n?.release(),this.performanceInfo.advance(I.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(I.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,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||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,W),this._needsDepth&&this._precompilePlugins(3,G)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...W),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(I.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...U),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...K);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let 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,...K),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...G)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...V),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...V)}_renderTransparentGeometry(){this._plugins.render(...H),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...U)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...q),this._bindParameters.output=2,this._plugins.precompile(...q),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...q)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(R);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?I.HUD_OCCLUDED:I.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),D(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(I.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...ke),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(I.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...H)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(R,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(z,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(R,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?z:R;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-L,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...V)||this.plugins.produces(5,...V)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([De,R]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(R)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],B.prototype,`highResolutionAtmosphere`,null),e([m()],B.prototype,`_edgeView`,void 0),e([m()],B.prototype,`updating`,null),B=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],B);const V=[0,1,2,3],H=[7,6,4,5],U=[7,6],W=[0,1,2,4,...U],G=[3,5],K=[2,4,8],q=[16,12,14,13],ke=[4,5,2,3,0,1,...U],J=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...U],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{B as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as D}from"../effects/highlight/Highlight.js";import{OITBlend as me}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Te,PerformanceCategory as I}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Ee,ColorAttachment0 as L,ColorAttachment1 as R,ColorAttachment2 as z,DrawBufferNone as De}from"../../../webgl/enums.js";const Oe=has(`disable-feature:async-navigation-3d-depth-readback`);let B=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new Te(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new me(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=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:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...q),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(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,n=!1){try{return this._isRendering=!0,this._render(e,t,n)}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(J),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...H),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(I.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),!Oe&&(c===2||c===0)&&this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...U),t.output=0,this._plugins.precompile(...U),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(I.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Ee.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?I.OPAQUE_EDGES:I.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(I.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?I.AMBIENT_ILLUMINATION_HIGH_QUALITY:I.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(L);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,L),n?.release(),this.performanceInfo.advance(I.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(I.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,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||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,W),this._needsDepth&&this._precompilePlugins(3,G)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...W),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(I.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...U),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...K);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let 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,...K),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...G)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...V),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...V)}_renderTransparentGeometry(){this._plugins.render(...H),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...U)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...q),this._bindParameters.output=2,this._plugins.precompile(...q),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...q)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(R);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?I.HUD_OCCLUDED:I.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),D(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(I.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...ke),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(I.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...H)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(R,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(z,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(R,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?z:R;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-L,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...V)||this.plugins.produces(5,...V)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([De,R]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(R)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],B.prototype,`highResolutionAtmosphere`,null),e([m()],B.prototype,`_edgeView`,void 0),e([m()],B.prototype,`updating`,null),B=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],B);const V=[0,1,2,3],H=[7,6,4,5],U=[7,6],W=[0,1,2,4,...U],G=[3,5],K=[2,4,8],q=[16,12,14,13],ke=[4,5,2,3,0,1,...U],J=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...U],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{B as Renderer};