@arcgis/core 4.33.0-next.20250423 → 4.33.0-next.20250424

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 (204) hide show
  1. package/Graphic.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/Analysis.d.ts +4 -0
  4. package/analysis/Analysis.js +1 -1
  5. package/analysis/SliceAnalysis.js +1 -1
  6. package/analysis/SlicePlane.js +1 -1
  7. package/analysis/support/AnalysisOriginWebScene.d.ts +4 -0
  8. package/analysis/support/AnalysisOriginWebScene.js +5 -0
  9. package/analysis/support/SliceAnalysisExcludedLayer.js +5 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{d4d011eea16a89a5aad9.js → 0219c3f9408d3fa3c9a0.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{4f8782b3b6ad414409e8.js → 0a48b9734ab4c64a6f4f.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{ccc50f28f217e50cc2c3.js → 1427e7953c3d8c87c5e8.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{184d7c8ea818bec5c462.js → 146b3699a9e8b1f2dcc2.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{8ba7d44eff348004f084.js → 1a6d2d090b643a87408a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +1 -0
  17. package/assets/esri/core/workers/chunks/{5e5225623977e61fd0ef.js → 213adc87c843d627c5d6.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{fa8a3c75f9b41d31559b.js → 265f69d153b7b6f07e42.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{769b66cca8347f0f84db.js → 279bbd61b32577693a4a.js} +1 -1
  20. package/assets/esri/core/workers/chunks/290b065b377f9d2ee058.js +1 -0
  21. package/assets/esri/core/workers/chunks/29d3245261a7223124ed.js +1 -0
  22. package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +1 -0
  23. package/assets/esri/core/workers/chunks/5958af341014e13475d2.js +1 -0
  24. package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +1 -0
  25. package/assets/esri/core/workers/chunks/{26e0a0a13060cd3e4291.js → 626ba3a7dee952308566.js} +1 -1
  26. package/assets/esri/core/workers/chunks/7cd32b10ed0e18e44ef2.js +1 -0
  27. package/assets/esri/core/workers/chunks/7ffa68d69c138db1295d.js +1 -0
  28. package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +1 -0
  29. package/assets/esri/core/workers/chunks/9661ee8569ee208e6237.js +1 -0
  30. package/assets/esri/core/workers/chunks/974742af7beb000c4b4a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{e27fa1e84f16b7f19a90.js → 9850ff14bd9c7da81c65.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{a276980c06d5d311a37e.js → 9f416cc5673665f8c37c.js} +1 -1
  33. package/assets/esri/core/workers/chunks/a0c51c4c30a5f749dfc6.js +1 -0
  34. package/assets/esri/core/workers/chunks/{fdcbd28f38bc485ac5e3.js → ab6ecd8eeec5ff761b34.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{5bdd5ae2d2f23ef6b331.js → c87e2a63b96e0da77dfe.js} +1 -1
  36. package/assets/esri/core/workers/chunks/cc4dd739c4c7e3ccea3f.js +1 -0
  37. package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +1 -0
  38. package/assets/esri/core/workers/chunks/{26fcbe053194bd78fcc3.js → d8474dca270b25705699.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{7c42281188b874ffcdad.js → db5913824d5e5a2a8365.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{48a1bb1e171dd06a7c6e.js → dd94585508f49863dc15.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{9408a72968cbd985dd24.js → f2cef954b58c6604642c.js} +34 -34
  42. package/chunks/BloomBlur.glsl.js +7 -7
  43. package/chunks/BloomComposition.glsl.js +24 -25
  44. package/chunks/cameraUtilsSpherical.js +1 -1
  45. package/chunks/sphere.js +1 -1
  46. package/core/Collection.js +1 -1
  47. package/core/JSONSupport.js +1 -1
  48. package/core/SetUtils.js +1 -1
  49. package/{views/webgl/GLObjectType.js → core/support/jsonUtils.js} +1 -1
  50. package/core/urlUtils.js +1 -1
  51. package/geometry/Mesh.js +1 -1
  52. package/geometry/support/normalizeUtilsSync.js +1 -1
  53. package/geometry/support/sphere.js +1 -1
  54. package/interfaces.d.ts +344 -111
  55. package/layers/DimensionLayer.js +1 -1
  56. package/layers/RouteLayer.js +1 -1
  57. package/layers/SubtypeGroupLayer.js +1 -1
  58. package/layers/ViewshedLayer.js +1 -1
  59. package/layers/graphics/data/QueryEngine.js +1 -1
  60. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  61. package/layers/orientedImagery/transformations/utils.js +1 -1
  62. package/layers/support/FieldsIndex.js +1 -1
  63. package/layers/support/VideoElement.js +1 -1
  64. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  65. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  66. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  67. package/layers/support/rasterFormats/{TiffTags.js → tiffTag.js} +1 -1
  68. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  69. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  70. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  71. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  72. package/layers/support/rasterFunctions/RemapFunction.js +1 -1
  73. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  74. package/layers/support/videoUtils.js +5 -0
  75. package/package.json +1 -1
  76. package/portal/schemas/definitions.js +1 -1
  77. package/renderers/UniqueValueRenderer.js +1 -1
  78. package/renderers/support/colorRampUtils.js +1 -1
  79. package/support/revision.js +1 -1
  80. package/symbols/IconSymbol3DLayer.js +1 -1
  81. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  82. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  84. package/views/2d/engine/webgl/textureUtils.js +1 -1
  85. package/views/2d/layers/MediaLayerView2D.js +1 -1
  86. package/views/2d/layers/TileLayerView2D.js +1 -1
  87. package/views/2d/layers/support/DebugOverlay.js +1 -1
  88. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  89. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  90. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  91. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  92. package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +1 -1
  93. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  94. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  95. package/views/3d/camera/constraintUtils/distance.js +1 -1
  96. package/views/3d/camera/intersectionUtils.js +1 -1
  97. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  98. package/views/3d/environment/atmosphereUtils.js +1 -1
  99. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  100. package/views/3d/interactive/visualElements/EngineVisualElement.js +1 -1
  101. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  102. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  103. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  104. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  105. package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
  106. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  107. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  108. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  109. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  110. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  111. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  112. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  113. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  114. package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +1 -1
  115. package/views/3d/interactive/visualElements/VisualElement.js +1 -1
  116. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  117. package/views/3d/layers/I3SMeshView3D.js +1 -1
  118. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  119. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  120. package/views/3d/state/ConstraintsManager.js +1 -1
  121. package/views/3d/state/NearFarHeuristic.js +1 -1
  122. package/views/3d/state/ViewState.js +1 -1
  123. package/views/3d/state/ViewStateManager.js +1 -1
  124. package/views/3d/state/utils/navigationUtils.js +1 -1
  125. package/views/3d/support/cameraUtilsSpherical.js +1 -1
  126. package/views/3d/support/geometryUtils/sphere.js +1 -1
  127. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  128. package/views/3d/webgl/ManagedDepthTexture.js +1 -1
  129. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  130. package/views/3d/webgl-engine/core/FBOCacheFormats.js +5 -0
  131. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +12 -14
  132. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
  133. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  134. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  135. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  136. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  137. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  138. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  139. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  140. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  141. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  142. package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
  143. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  144. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  145. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  146. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  147. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  148. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  149. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  150. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  151. package/views/SceneView.js +1 -1
  152. package/views/VideoView.js +1 -1
  153. package/views/webgl/FBOAttachmentType.js +5 -0
  154. package/views/webgl/FramebufferObject.js +1 -1
  155. package/views/webgl/Renderbuffer.js +1 -1
  156. package/views/webgl/RenderbufferDescriptor.js +1 -1
  157. package/views/webgl/Texture.js +1 -1
  158. package/views/webgl/TextureDescriptor.js +1 -1
  159. package/views/webgl/textureUtils.js +1 -1
  160. package/webscene/InitialViewProperties.js +1 -1
  161. package/webscene/Presentation.js +1 -1
  162. package/webscene/Slide.js +1 -1
  163. package/webscene/SlideLegendInfo.js +1 -1
  164. package/webscene/background/ColorBackground.js +1 -1
  165. package/webscene/spec-certification/api.js +1 -1
  166. package/webscene/spec-certification/compare.js +1 -1
  167. package/webscene/spec-certification/index.js +1 -1
  168. package/webscene/spec-certification/spec.js +1 -1
  169. package/webscene/spec-certification/utils.js +1 -1
  170. package/webscene/support/Description.js +1 -1
  171. package/webscene/support/SlideElements.js +1 -1
  172. package/webscene/support/SlideEnvironment.js +1 -1
  173. package/webscene/support/SlideGround.js +1 -1
  174. package/webscene/support/SlideVisibleLayer.js +1 -1
  175. package/webscene/support/Title.js +1 -1
  176. package/webscene/support/analysisUtils.js +5 -0
  177. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  178. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  179. package/widgets/Editor/EditorViewModel.js +1 -1
  180. package/widgets/Editor/UpdateWorkflow.js +1 -1
  181. package/widgets/Editor/support/SketchController.js +5 -0
  182. package/widgets/Editor/workflowUtils.js +1 -1
  183. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  184. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  185. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  186. package/widgets/FeatureTable.js +1 -1
  187. package/widgets/LayerList/LayerListItem.js +1 -1
  188. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  189. package/widgets/Widget.js +1 -1
  190. package/widgets/support/SelectionList.js +1 -1
  191. package/widgets/support/SnappingControls.js +1 -1
  192. package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +0 -1
  193. package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +0 -1
  194. package/assets/esri/core/workers/chunks/388a763da712ca71ccf4.js +0 -1
  195. package/assets/esri/core/workers/chunks/5ffc3ca6c6a4d32e1282.js +0 -1
  196. package/assets/esri/core/workers/chunks/642a595353a86f3717e3.js +0 -1
  197. package/assets/esri/core/workers/chunks/93e9dfd1ba8f393c6c47.js +0 -1
  198. package/assets/esri/core/workers/chunks/95379fdd6917c8a84c71.js +0 -1
  199. package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +0 -1
  200. package/assets/esri/core/workers/chunks/a197c86d42cc9ce21924.js +0 -1
  201. package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +0 -1
  202. package/assets/esri/core/workers/chunks/dd8e72d6784a8ebc115d.js +0 -1
  203. package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +0 -1
  204. package/views/webgl/formats.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import f from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as C,requiresLoad as x}from"../../../geometry/projection.js";import{ViewingMode as R}from"../../ViewingMode.js";import{applyAll as P}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as S,surfaceElevationBelowRenderLocation as O}from"../camera/intersectionUtils.js";import{ConstraintsManager as T}from"./ConstraintsManager.js";import{Frustum as b}from"./Frustum.js";import{GoToOperation as j}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as I}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as M,externalToInternal as z,toArea as A,toExtent as E,applyTiltAdjustToScale as L,scaleToZoom as H,fromExtentSync as N,OrientationMode as V,getObserverForPointAtDistanceSync as B,viewScaleToCameraDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as U,toCameraSync as F}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Z}from"../../webgl/FramebufferObject.js";let Q=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ne,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ne:0}},this._propertiesPool=new J({frustum:b},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new X}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(ae)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=M(this.view,this.view.state.camera,te);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(z(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=M(this.view,this.view.state.contentCamera,te);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=z(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(se),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(se),this.test.contentCameraResetState.clear())})),o((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),o((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],se),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?f.fromExtent(e):null}return A(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=E(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,re),this.view.state.updateCamera((e=>e.padding=re)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?H(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&Z(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?.stage?.renderer.isFeatureEnabled(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?.stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!C(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!C(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!C(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||C(this.viewpoint.targetGeometry?.spatialReference,e)&&C(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new T({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===R.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(ae),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),ae)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ae),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new j(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(S(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of $){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(z(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=N(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(z(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=N(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(z(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Y.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!x(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=ee){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=ie){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=N(this.view,e,t,i,V.ADJUST,te);return r?z(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=D(t,e,t.state.contentCamera,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return z(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&P(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new I({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||(ie.copyFrom(e),ie.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,re),ie.padding=re),ie.fullWidth=i.width,ie.fullHeight=i.height,ie.pixelRatio=i.pixelRatio,this.view.state.camera=ie),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?O(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],Q.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Q.prototype,"contentCamera",null),e([m({type:_})],Q.prototype,"center",null),e([m()],Q.prototype,"visibleArea",null),e([m({type:y})],Q.prototype,"extent",null),e([m({readOnly:!0})],Q.prototype,"frustum",null),e([m()],Q.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Q.prototype,"constraintsManager",null),e([m()],Q.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Q.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Q.prototype,"ready",void 0),e([m({type:Number})],Q.prototype,"scale",null),e([m()],Q.prototype,"padding",null),e([m({readOnly:!0})],Q.prototype,"screenCenter",null),e([m({constructOnly:!0})],Q.prototype,"view",void 0),e([m({type:i})],Q.prototype,"viewpoint",null),e([m({type:Number})],Q.prototype,"zoom",null),e([m({readOnly:!0})],Q.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Q.prototype,"_windowDevicePixelRatio",void 0),e([m()],Q.prototype,"_devicePixelRatioOverride",void 0),Q=e([d("esri.views.3d.state.ViewStateManager")],Q);class X{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Y=new Set(["camera","viewpoint","extent","scale","center","zoom"]),$=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],ee={heading:0,tilt:0},te=new t,ie=new k,re=g(),ae="pending-initial-view",se="content-camera-reset",ne=300,oe=100;export{Q as ViewStateManager,oe as interactingTimeout};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import f from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as C,requiresLoad as x}from"../../../geometry/projection.js";import{ViewingMode as R}from"../../ViewingMode.js";import{applyAll as P}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as S,surfaceElevationBelowRenderLocation as O}from"../camera/intersectionUtils.js";import{ConstraintsManager as T}from"./ConstraintsManager.js";import{Frustum as b}from"./Frustum.js";import{GoToOperation as j}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as I}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as M,externalToInternal as z,toArea as A,toExtent as E,applyTiltAdjustToScale as L,scaleToZoom as H,fromExtentSync as N,OrientationMode as V,getObserverForPointAtDistanceSync as B,viewScaleToCameraDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as U,toCameraSync as F}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Z}from"../../webgl/FramebufferObject.js";let Q=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ne,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ne:0}},this._propertiesPool=new J({frustum:b},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new X}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(({camera:e})=>e&&this._updateElevation(e))),o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(ae)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=M(this.view,this.view.state.camera,te);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(z(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=M(this.view,this.view.state.contentCamera,te);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=z(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(se),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(se),this.test.contentCameraResetState.clear())})),o((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),o((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],se),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?f.fromExtent(e):null}return A(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=E(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,re),this.view.state.updateCamera((e=>e.padding=re)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?H(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&Z(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?.stage?.renderer.isFeatureEnabled(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?.stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!C(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!C(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!C(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||C(this.viewpoint.targetGeometry?.spatialReference,e)&&C(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new T({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===R.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(ae),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),ae)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ae),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new j(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(S(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of $){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(z(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=N(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(z(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=N(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(z(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Y.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!x(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=ee){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=ie){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=N(this.view,e,t,i,V.ADJUST,te);return r?z(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=D(t,e,t.state.contentCamera,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return z(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&P(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new I({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||(ie.copyFrom(e),ie.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,re),ie.padding=re),ie.fullWidth=i.width,ie.fullHeight=i.height,ie.pixelRatio=i.pixelRatio,this.view.state.camera=ie),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?O(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],Q.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Q.prototype,"contentCamera",null),e([m({type:_})],Q.prototype,"center",null),e([m()],Q.prototype,"visibleArea",null),e([m({type:y})],Q.prototype,"extent",null),e([m({readOnly:!0})],Q.prototype,"frustum",null),e([m()],Q.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Q.prototype,"constraintsManager",null),e([m()],Q.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Q.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Q.prototype,"ready",void 0),e([m({type:Number})],Q.prototype,"scale",null),e([m()],Q.prototype,"padding",null),e([m({readOnly:!0})],Q.prototype,"screenCenter",null),e([m({constructOnly:!0})],Q.prototype,"view",void 0),e([m({type:i})],Q.prototype,"viewpoint",null),e([m({type:Number})],Q.prototype,"zoom",null),e([m({readOnly:!0})],Q.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Q.prototype,"_windowDevicePixelRatio",void 0),e([m()],Q.prototype,"_devicePixelRatioOverride",void 0),Q=e([d("esri.views.3d.state.ViewStateManager")],Q);class X{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Y=new Set(["camera","viewpoint","extent","scale","center","zoom"]),$=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],ee={heading:0,tilt:0},te=new t,ie=new k,re=g(),ae="pending-initial-view",se="content-camera-reset",ne=300,oe=100;export{Q as ViewStateManager,oe as interactingTimeout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as i,exactEquals as s,multiply as c,rotate as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as h,t as M,g,l as y,h as b,m as d,i as x,f as v,n as j,s as z,c as P,e as w}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as H,axis as S,fromPoints as k,wrapAxisAngle as A}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as E,vectorCoordinates as T}from"../../../../geometry/support/coordinateSystem.js";import{create as U,intersectRay as G,fromNormalAndOffset as R}from"../../../../geometry/support/plane.js";import{k as q,j as C,a as F,c as V}from"../../../../chunks/sphere.js";import{sm4d as O,sv3d as W}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as B,fromScreenAtEye as D}from"../../support/geometryUtils/ray.js";import{intersectScreen as J}from"../../support/geometryUtils/sphere.js";import K from"../../webgl/RenderCamera.js";import{terrainId as L}from"../../webgl-engine/lib/verticalOffsetUtils.js";var N;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(N||(N={}));const Q=30,X=[1,3e8],Y=80,Z=8,$=200,_=1508e5,tt=5,et=50,nt=5,ot=10,rt=90,at={exclude:new Set([L])};function it(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function st(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ct(t,e,n){const o=i(O.get(),n[3],S(n));null==o||s(o,m)||(h(re,t.eye,e),M(re,re,o),t.eye=g(re,re,e),h(re,t.center,e),M(re,re,o),t.center=g(re,re,e),t.up=M(re,t.up,o))}function lt(t,e,n,o){return G(t,B(e,n,le),o)}function mt(t,e,n,o){return G(t,D(e,n,le),o)}function ut(t,e,n,o){const r=W.get();let a=1-n;h(r,e,t.eye);const i=y(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(b(r,r,a),t.eye=g(re,t.eye,r),t.center=d(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(pt),J(t,e,pt,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=b(W.get(),e.viewForward,r);e.eye=h(re,e.center,a)}const pt=a();function ht(t,e){x(e,0,0,0);for(const n of t)g(e,e,n);b(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/y(e))*(n+o.radius)}function gt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var yt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(yt||(yt={}));const bt={Elevation:3e4,Angle:e(16)},dt=e(80);function xt(t,e,n,o,r,a){const i=I(),s=V();let c=!0,l=!0;return t.intersectScreen(n,i,a)?s[3]=y(i):(l=!1,e.aboveGround&&r!==N.Ellipsoid?s[3]=Math.max(y(e.center),.9*o.radius):s[3]=y(e.eye)-e.relativeElevation,r===N.Silhouette?Pt(s,e,n,i):c=J(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:l}}function vt(t,e,n,o){const r=t.relativeElevation;if(r>bt.Elevation&&"global"===o)return yt.Horizontal;D(t,e,me);const a=Math.sign(r),i=n.worldUpAtPosition(t.eye,re);return-a*v(i,me.direction)<Math.sin(bt.Angle)*y(me.direction)?yt.Vertical:yt.Horizontal}function jt(t,e,n){h(zt,n,e),t.eye=h(re,t.eye,zt),t.center=h(re,t.center,zt)}const zt=I();function Pt(t,e,n,o){const r=D(e,n,le);return null!=r&&(q(t,r,wt),C(t,r,o)?!(z(wt,r.origin)<z(o,r.origin))||(P(o,wt),!1):(h(It,e.eye,e.center),j(It,It),R(It,-v(j(It,It),wt),Ht),G(Ht,r,o),!1))}const wt=I(),It=I(),Ht=U();function St(a,i,s,c,l,m){let u=0;if(w(se,a,i),h(ae,a,i),y(a)<=l||!c.aboveGround){w(s,ae,c.eye);const f=v(a,i)/(y(a)*y(i));if(f<.9999)u=o(f);else{const t=y(w(I(),a,i))/(y(a)*y(i));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,dt));u=-u-Math.max(0,y(i)-l)/(p*l)}else h(kt,c.eye,c.center),w(s,ae,kt),u=-y(ae)/l;return j(s,s),b(s,s,y(se)),u}const kt=I();function At(r,a,i,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,dt));return c=a>i?-(a-i)/(m*i):a<-i?Math.PI-(a+i)/(m*i):o(a/i),l=r>i?-(r-i)/(m*i):r<-i?Math.PI-(r+i)/(m*i):o(r/i),(l-c)*i}function Et(t,e,n,o,r,a,i,s,c,l){const m=At(t[2],e[2],a[3],s),u=c?At(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(i)*u-Math.cos(i)*m,h=Math.cos(i)*u+Math.sin(i)*m;j(re,r);const M=c?p/Math.sqrt(Math.abs(a[3]**2-v(n,re)**2)):p/a[3],g=h/Math.sqrt(Math.abs(a[3]**2-v(n,o)**2));f(l,M,g)}function Tt(t,e,n,o,r,a,i,s,c,l){w(se,t,e),E(a.up,a.eye,Nt,Qt,Xt),E([0,0,1],a.eye,Jt,Kt,Lt),P(n,Kt),P(o,Jt),j(n,n),b(n,n,y(se)),T(t,j(Qt,Qt),j(Xt,Xt),j(Nt,Nt),Yt),T(e,Qt,Xt,Nt,Zt),Et(Yt,Zt,t,Jt,Kt,i,s,c,l,r)}function Ut(t,e,n,o,r,a,s){i(te,r,o),i(ee,s,a),c(ne,te,ee),h(e,t,n),M(e,e,ne),g(e,e,n)}function Gt(t,e,n,o,r,a){i(te,o,n),i(ee,a,r),c(ne,te,ee),h(re,t.eye,e),M(re,re,ne),t.eye=g(re,re,e),h(re,t.center,e),M(re,re,ne),t.center=g(re,re,e),h(re,t.up,e),M(re,re,ne),t.up=g(re,re,e)}const Rt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let qt=!1;function Ct(t,e,n,o,r,a){const i=Math.abs(o)>Math.PI-Rt.Angle||Math.abs(o)<Rt.Angle,s=(Math.abs(t[2])<n*Rt.Pole||Math.abs(e)>n)&&a;return i&&s?!qt&&r<Rt.Tilt-Rt.TiltHysteresisMargin?qt=!0:qt&&r>Rt.Tilt+Rt.TiltHysteresisMargin&&(qt=!1):qt=!1,qt}function Ft(t,e,n,o,r,a){if(a)k(n,o,_t),ct(e,F(t),_t);else{const a=St(n,o,ce,e,t[3],r);ct(e,F(t),A(ce,a))}}function Vt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let l,m;P(oe,o),ie.copyFrom(e);for(let u=0;u<s&&z(n,oe)>c&&(l=z(n,oe),Tt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Gt(ie,F(t),Jt,$t[1],Kt,$t[0]),Ut(oe,oe,F(t),Jt,$t[1],Kt,$t[0]),m=z(n,oe),m<l||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Ct(r,v(o.up,r),n[3],-t.normalize(e(i)),s,o.aboveGround)?Vt(n,o,r,a,-t.normalize(e(i)),s,c):Ft(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;E([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,c="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-v(t.center,Jt)**2/y(t.center)**2)),.5),u=(Math.sin(a)*c+Math.cos(a)*s)/m,f=-Math.cos(a)*c+Math.sin(a)*s;switch(l(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":l(o.pan.matrix,o.pan.matrix,f,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=w(W.get(),i,a),c=e.translation[0]*n.pan;switch(0!==c&&(l(o.pan.matrix,o.pan.matrix,-c,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(l(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,l,m){Ct(n.center,v(n.up,n.center),y(n.center),-t.normalize(e(s)),c,o.aboveGround)?Wt(o,r,a,l,m,-t.normalize(e(i))):Bt(o,r,a,l,m)}const Jt=I(),Kt=I(),Lt=I(),Nt=I(),Qt=I(),Xt=I(),Yt=I(),Zt=I(),$t=p(),_t=H(),te=u(),ee=u(),ne=u(),oe=I(),re=I(),ae=I(),ie=new K,se=I(),ce=I(),le={origin:I(),direction:I()},me={origin:I(),direction:I()};export{yt as NavigationMode,N as SpherePickPointFallback,dt as TiltThresholdPanningSpeed,bt as VerticalPanTresholds,jt as applyPanPlanar,Ft as applyPanSphericalDirectRotation,Vt as applyPanSphericalPreserveHeading,ct as applyRotation,Gt as applyRotationWithTwoAxes,ft as applyZoomOnSphere,ut as applyZoomToPoint,ht as centroid,at as contentIntersectorOptions,X as distanceClampValues,lt as intersectPlaneFromScreenPoint,mt as intersectPlaneFromScreenPointAtEye,At as lengthFromPoints,et as minHeightLimit,vt as navigationMode,it as normalizeCoordinate,st as normalizeRotationDelta,gt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,tt as panDistanceModifier,Dt as panMotionToRotationMatrix,Ot as panToPosition,xt as pickPointAndInitSphere,Q as pivotDistanceModifier,Rt as preservingHeadingThresholds,nt as rotatePivotDistanceModifier,ot as rotatePivotMinDistanceModifier,Ut as rotatePointAroundTwoAxes,rt as rotateScreenPixelArea,St as rotationAngleAndAxisDirectRotation,Tt as rotationAnglesAndAxesHeadingPreserving,Et as rotationAnglesHeadingPreserving,Y as screenPixelArea,Ct as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,Z as zoomDistanceModifier,_ as zoomMaxDistanceModifier,$ as zoomMinDistanceModifier};
5
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as i,exactEquals as s,multiply as c,rotate as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as h,t as M,g,l as y,h as b,m as d,i as x,f as v,n as j,s as z,c as P,e as w}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as H,axis as S,fromPoints as k,wrapAxisAngle as A}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as E,vectorCoordinates as T}from"../../../../geometry/support/coordinateSystem.js";import{create as U,intersectRay as G,fromNormalAndOffset as R}from"../../../../geometry/support/plane.js";import{k as q,h as C,a as F,c as V}from"../../../../chunks/sphere.js";import{sm4d as O,sv3d as W}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as B,fromScreenAtEye as D}from"../../support/geometryUtils/ray.js";import{intersectScreen as J}from"../../support/geometryUtils/sphere.js";import K from"../../webgl/RenderCamera.js";import{terrainId as L}from"../../webgl-engine/lib/verticalOffsetUtils.js";var N;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(N||(N={}));const Q=30,X=[1,3e8],Y=80,Z=8,$=200,_=1508e5,tt=5,et=50,nt=5,ot=10,rt=90,at={exclude:new Set([L])};function it(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function st(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ct(t,e,n){const o=i(O.get(),n[3],S(n));null==o||s(o,m)||(h(re,t.eye,e),M(re,re,o),t.eye=g(re,re,e),h(re,t.center,e),M(re,re,o),t.center=g(re,re,e),t.up=M(re,t.up,o))}function lt(t,e,n,o){return G(t,B(e,n,le),o)}function mt(t,e,n,o){return G(t,D(e,n,le),o)}function ut(t,e,n,o){const r=W.get();let a=1-n;h(r,e,t.eye);const i=y(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(b(r,r,a),t.eye=g(re,t.eye,r),t.center=d(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(pt),J(t,e,pt,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=b(W.get(),e.viewForward,r);e.eye=h(re,e.center,a)}const pt=a();function ht(t,e){x(e,0,0,0);for(const n of t)g(e,e,n);b(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/y(e))*(n+o.radius)}function gt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var yt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(yt||(yt={}));const bt={Elevation:3e4,Angle:e(16)},dt=e(80);function xt(t,e,n,o,r,a){const i=I(),s=V();let c=!0,l=!0;return t.intersectScreen(n,i,a)?s[3]=y(i):(l=!1,e.aboveGround&&r!==N.Ellipsoid?s[3]=Math.max(y(e.center),.9*o.radius):s[3]=y(e.eye)-e.relativeElevation,r===N.Silhouette?Pt(s,e,n,i):c=J(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:l}}function vt(t,e,n,o){const r=t.relativeElevation;if(r>bt.Elevation&&"global"===o)return yt.Horizontal;D(t,e,me);const a=Math.sign(r),i=n.worldUpAtPosition(t.eye,re);return-a*v(i,me.direction)<Math.sin(bt.Angle)*y(me.direction)?yt.Vertical:yt.Horizontal}function jt(t,e,n){h(zt,n,e),t.eye=h(re,t.eye,zt),t.center=h(re,t.center,zt)}const zt=I();function Pt(t,e,n,o){const r=D(e,n,le);return null!=r&&(q(t,r,wt),C(t,r,o)?!(z(wt,r.origin)<z(o,r.origin))||(P(o,wt),!1):(h(It,e.eye,e.center),j(It,It),R(It,-v(j(It,It),wt),Ht),G(Ht,r,o),!1))}const wt=I(),It=I(),Ht=U();function St(a,i,s,c,l,m){let u=0;if(w(se,a,i),h(ae,a,i),y(a)<=l||!c.aboveGround){w(s,ae,c.eye);const f=v(a,i)/(y(a)*y(i));if(f<.9999)u=o(f);else{const t=y(w(I(),a,i))/(y(a)*y(i));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,dt));u=-u-Math.max(0,y(i)-l)/(p*l)}else h(kt,c.eye,c.center),w(s,ae,kt),u=-y(ae)/l;return j(s,s),b(s,s,y(se)),u}const kt=I();function At(r,a,i,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,dt));return c=a>i?-(a-i)/(m*i):a<-i?Math.PI-(a+i)/(m*i):o(a/i),l=r>i?-(r-i)/(m*i):r<-i?Math.PI-(r+i)/(m*i):o(r/i),(l-c)*i}function Et(t,e,n,o,r,a,i,s,c,l){const m=At(t[2],e[2],a[3],s),u=c?At(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(i)*u-Math.cos(i)*m,h=Math.cos(i)*u+Math.sin(i)*m;j(re,r);const M=c?p/Math.sqrt(Math.abs(a[3]**2-v(n,re)**2)):p/a[3],g=h/Math.sqrt(Math.abs(a[3]**2-v(n,o)**2));f(l,M,g)}function Tt(t,e,n,o,r,a,i,s,c,l){w(se,t,e),E(a.up,a.eye,Nt,Qt,Xt),E([0,0,1],a.eye,Jt,Kt,Lt),P(n,Kt),P(o,Jt),j(n,n),b(n,n,y(se)),T(t,j(Qt,Qt),j(Xt,Xt),j(Nt,Nt),Yt),T(e,Qt,Xt,Nt,Zt),Et(Yt,Zt,t,Jt,Kt,i,s,c,l,r)}function Ut(t,e,n,o,r,a,s){i(te,r,o),i(ee,s,a),c(ne,te,ee),h(e,t,n),M(e,e,ne),g(e,e,n)}function Gt(t,e,n,o,r,a){i(te,o,n),i(ee,a,r),c(ne,te,ee),h(re,t.eye,e),M(re,re,ne),t.eye=g(re,re,e),h(re,t.center,e),M(re,re,ne),t.center=g(re,re,e),h(re,t.up,e),M(re,re,ne),t.up=g(re,re,e)}const Rt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let qt=!1;function Ct(t,e,n,o,r,a){const i=Math.abs(o)>Math.PI-Rt.Angle||Math.abs(o)<Rt.Angle,s=(Math.abs(t[2])<n*Rt.Pole||Math.abs(e)>n)&&a;return i&&s?!qt&&r<Rt.Tilt-Rt.TiltHysteresisMargin?qt=!0:qt&&r>Rt.Tilt+Rt.TiltHysteresisMargin&&(qt=!1):qt=!1,qt}function Ft(t,e,n,o,r,a){if(a)k(n,o,_t),ct(e,F(t),_t);else{const a=St(n,o,ce,e,t[3],r);ct(e,F(t),A(ce,a))}}function Vt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let l,m;P(oe,o),ie.copyFrom(e);for(let u=0;u<s&&z(n,oe)>c&&(l=z(n,oe),Tt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Gt(ie,F(t),Jt,$t[1],Kt,$t[0]),Ut(oe,oe,F(t),Jt,$t[1],Kt,$t[0]),m=z(n,oe),m<l||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Ct(r,v(o.up,r),n[3],-t.normalize(e(i)),s,o.aboveGround)?Vt(n,o,r,a,-t.normalize(e(i)),s,c):Ft(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;E([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,c="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-v(t.center,Jt)**2/y(t.center)**2)),.5),u=(Math.sin(a)*c+Math.cos(a)*s)/m,f=-Math.cos(a)*c+Math.sin(a)*s;switch(l(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":l(o.pan.matrix,o.pan.matrix,f,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=w(W.get(),i,a),c=e.translation[0]*n.pan;switch(0!==c&&(l(o.pan.matrix,o.pan.matrix,-c,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(l(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,l,m){Ct(n.center,v(n.up,n.center),y(n.center),-t.normalize(e(s)),c,o.aboveGround)?Wt(o,r,a,l,m,-t.normalize(e(i))):Bt(o,r,a,l,m)}const Jt=I(),Kt=I(),Lt=I(),Nt=I(),Qt=I(),Xt=I(),Yt=I(),Zt=I(),$t=p(),_t=H(),te=u(),ee=u(),ne=u(),oe=I(),re=I(),ae=I(),ie=new K,se=I(),ce=I(),le={origin:I(),direction:I()},me={origin:I(),direction:I()};export{yt as NavigationMode,N as SpherePickPointFallback,dt as TiltThresholdPanningSpeed,bt as VerticalPanTresholds,jt as applyPanPlanar,Ft as applyPanSphericalDirectRotation,Vt as applyPanSphericalPreserveHeading,ct as applyRotation,Gt as applyRotationWithTwoAxes,ft as applyZoomOnSphere,ut as applyZoomToPoint,ht as centroid,at as contentIntersectorOptions,X as distanceClampValues,lt as intersectPlaneFromScreenPoint,mt as intersectPlaneFromScreenPointAtEye,At as lengthFromPoints,et as minHeightLimit,vt as navigationMode,it as normalizeCoordinate,st as normalizeRotationDelta,gt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,tt as panDistanceModifier,Dt as panMotionToRotationMatrix,Ot as panToPosition,xt as pickPointAndInitSphere,Q as pivotDistanceModifier,Rt as preservingHeadingThresholds,nt as rotatePivotDistanceModifier,ot as rotatePivotMinDistanceModifier,Ut as rotatePointAroundTwoAxes,rt as rotateScreenPixelArea,St as rotationAngleAndAxisDirectRotation,Tt as rotationAnglesAndAxesHeadingPreserving,Et as rotationAnglesHeadingPreserving,Y as screenPixelArea,Ct as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,Z as zoomDistanceModifier,_ as zoomMaxDistanceModifier,$ as zoomMinDistanceModifier};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/Cyclical.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../chunks/vec32.js";import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../../chunks/vec42.js";import"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../../../core/libs/gl-matrix-2/math/common.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/Extent.js";import"../../../geometry/Polygon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/coordsUtils.js";import"../../../geometry/support/frustum.js";import"../../../geometry/support/lineSegment.js";import"../../../geometry/support/plane.js";import"../../../geometry/support/ray.js";import"../../../chunks/sphere.js";import"../../../geometry/support/webMercatorUtils.js";import"../state/Frustum.js";import"../state/utils/viewUtils.js";import"./cameraUtilsInternal.js";import"./earthUtils.js";import"./mathUtils.js";export{d as directionToHeadingTilt,e as eyeForCenterWithHeadingTilt,a as eyeTiltToLookAtTilt,h as headingTiltToDirectionUp,l as lookAtTiltToEyeTilt,b as toArea,t as toExtent}from"../../../chunks/cameraUtilsSpherical.js";
5
+ import"../../../core/Cyclical.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../chunks/vec32.js";import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../../chunks/vec42.js";import"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../../../core/libs/gl-matrix-2/math/common.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/Extent.js";import"../../../geometry/Polygon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/coordsUtils.js";import"../../../geometry/support/frustum.js";import"../../../geometry/support/lineSegment.js";import"../../../geometry/support/plane.js";import"../../../geometry/support/ray.js";import"../../../chunks/sphere.js";import"../../../geometry/support/webMercatorUtils.js";import"../state/Frustum.js";import"../state/NearFarHeuristic.js";import"../state/utils/viewUtils.js";import"./cameraUtilsInternal.js";import"./earthUtils.js";import"./mathUtils.js";export{d as directionToHeadingTilt,e as eyeForCenterWithHeadingTilt,a as eyeTiltToLookAtTilt,h as headingTiltToDirectionUp,l as lookAtTiltToEyeTilt,b as toArea,t as toExtent}from"../../../chunks/cameraUtilsSpherical.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as r}from"../../../../geometry/support/ray.js";import{j as o}from"../../../../chunks/sphere.js";import{fromScreenAtEye as t}from"./ray.js";function s(r,s,p,e){const n=t(s,p,m);return o(r,n,e)}const m=r();export{s as intersectScreen};
5
+ import{create as r}from"../../../../geometry/support/ray.js";import{h as o}from"../../../../chunks/sphere.js";import{fromScreenAtEye as t}from"./ray.js";function s(r,s,p,e){const n=t(s,p,m);return o(r,n,e)}const m=r();export{s as intersectScreen};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{OverlayContent as e}from"./OverlayContent.js";import{OverlayFramebufferObject as r}from"./OverlayFramebufferObject.js";import{ShaderOutput as o}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{olidEnabled as t}from"../webgl-engine/effects/geometry/olidUtils.js";import{ColorFormat as l}from"../../webgl/formats.js";class s{constructor(e,o,t,s,i=l.RGBA8_MIPMAP){this.output=t,this.content=s,this.fbo=new r(e,i,o)}get valid(){return this.fbo.valid}}class i{constructor(r){this.targets=[new s(r,"overlay color",o.Color,e.Color),new s(r,"overlay IM color",o.Color,e.ColorNoRasterImage),new s(r,"overlay highlight",o.Highlight,e.Highlight,l.RG8UI),new s(r,"overlay water",o.Normal,e.WaterNormal),new s(r,"overlay occluded",o.Color,e.Occluded)],t()&&this.targets.push(new s(r,"overlay olid",o.ObjectAndLayerIdColor,e.ObjectAndLayerIdColor,l.RGBA8))}getTexture(e){return this.targets[e]?.fbo.texture}dispose(){for(const e of this.targets)e.fbo.dispose()}computeValidity(){return this.targets.reduce(((e,r,o)=>r.valid?e|=1<<o:e),0)}}export{i as OverlayRenderTargets,s as RenderTargetDescriptor};
5
+ import{OverlayContent as e}from"./OverlayContent.js";import{OverlayFramebufferObject as r}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl-engine/core/FBOCacheFormats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../webgl-engine/effects/geometry/olidUtils.js";class s{constructor(e,t,l,s,i=o.RGBA8UNORM_MIPMAP){this.output=l,this.content=s,this.fbo=new r(e,i,t)}get valid(){return this.fbo.valid}}class i{constructor(r){this.targets=[new s(r,"overlay color",t.Color,e.Color),new s(r,"overlay IM color",t.Color,e.ColorNoRasterImage),new s(r,"overlay highlight",t.Highlight,e.Highlight,o.RG8UINT),new s(r,"overlay water",t.Normal,e.WaterNormal),new s(r,"overlay occluded",t.Color,e.Occluded)],l()&&this.targets.push(new s(r,"overlay olid",t.ObjectAndLayerIdColor,e.ObjectAndLayerIdColor,o.RGBA8UNORM))}getTexture(e){return this.targets[e]?.fbo.texture}dispose(){for(const e of this.targets)e.fbo.dispose()}computeValidity(){return this.targets.reduce(((e,r,o)=>r.valid?e|=1<<o:e),0)}}export{i as OverlayRenderTargets,s as RenderTargetDescriptor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{GLObjectType as t}from"../../webgl/GLObjectType.js";function e(e){return e?.attachment.type===t.Texture}export{e as isManagedDepthTexture};
5
+ import{FBOAttachmentType as t}from"../../webgl/FBOAttachmentType.js";function e(e){return e?.attachment.type===t.Texture}export{e as isManagedDepthTexture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as r}from"../../webgl/ManagedDepthAttachment.js";import a from"../../webgl/ManagedFBO.js";import{AttachmentType as o}from"../../webgl/ManagedFBOResource.js";import{FBOPool as n}from"./FBOPool.js";import{PixelFormat as c,SizedPixelFormat as i,TextureWrapMode as s,TextureSamplingMode as h,PixelType as m,SizedDepthFormat as _,SizedDepthStencilFormat as l,ColorAttachment0 as p,UnsizedDepthFormat as d}from"../../../webgl/enums.js";import{ColorFormat as u,DepthFormat as E,depthFormatTextureDisambiguationOffset as T,depthFormatRenderbufferDisambiguationOffset as w}from"../../../webgl/formats.js";import{FramebufferObject as C}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as f}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as A}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as M}from"../../../webgl/Texture.js";import{TextureDescriptor as R}from"../../../webgl/TextureDescriptor.js";import{isDepthAndOrStencilFormat as F,isSizedDepthFormat as D}from"../../../webgl/textureUtils.js";class N{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new n(e.newCache,"FBOCache"),this._depthCache=new n(e.newCache,"DepthAttachmentCache"),this._colorCache=new n(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===o.FBO&&e(t.name,t.fbo,t.numberOfColorAttachments)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+t.cachedMemory),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(t,r,o,n=u.RGBA8){const c=O(n,t,r);let i=this._cache.pop(c);const{rctx:s}=this;if(i){i.retain(),i.setName(o);const{fbo:t}=i;if(!t)throw new e("renderer","attempt to use a not existing framebuffer");s.temporaryBindFramebufferObject(t,(()=>{s.setDrawBuffers([p]),s.unbindTexture(t.colorTexture)}))}else{const e=new C(s);i=new a(c,o,e,(e=>{e??=E.DEPTH24_STENCIL8_TEXTURE;const a=this._acquireDepth(e,t,r,`${i.name} depth`);return i.attachDepth(a),a.release(),i}),((e,a,o)=>{a??=u.RGBA8;const n=this._acquireColor(a,t,r,o??`${i.name} color ${e}`);return this.rctx.unbindTexture(n.attachment),i.attachColor(n,e),n.release(),i}),(()=>{this.debugCallback?.(i.name,i.fbo,i.numberOfColorAttachments),this._acquired.delete(i),null!=i?.getAttachment(p)?(i.fbo?.invalidateAttachments([p],!0),i.detachAllButColor0(),this._cache.put(i)):i?.dispose()})),F(n)?i.acquireDepth(n):i.acquireColor(p,n,o)}return this._trackHandle(i)}acquireDepth(e,t,r,a){return this._acquireDepth(e,t,r,a)}_acquireDepth(e,t,a,o){const n=O(e,t,a);let c=this._depthCache.pop(n);if(c)c.retain();else{const o=e>T,i=o?e-T:e-w,s=o?new M(this.rctx,U(i,t,a)):new f(this.rctx,new A(i,t,a)),h=new r(n,s,(()=>{this._depthCache.put(h)}));c=h}return c.name=o,c}_acquireColor(e,r,a,o){const n=O(e,r,a),c=this._colorCache.pop(n);if(c)return c.retain(),c.name=o,c;const i=new t(n,new M(this.rctx,{...H[e],width:r,height:a}),(()=>{this._colorCache.put(i)}));return i.name=o,i}_trackHandle(e){return this._acquired.add(e),e}}const b=new a("default","default",null,(()=>b),(()=>b),(()=>{}));function O(e,t,r){return`${e}x${t}x${r}`}b.release=()=>!1;const G=new R;G.pixelFormat=c.RED,G.internalFormat=i.R8,G.wrapMode=s.CLAMP_TO_EDGE;const g=new R;g.pixelFormat=c.RED_INTEGER,g.internalFormat=i.R8UI,g.wrapMode=s.CLAMP_TO_EDGE,g.samplingMode=h.NEAREST;const P=new R;P.pixelFormat=c.RG,P.internalFormat=i.RG8,P.wrapMode=s.CLAMP_TO_EDGE;const x=new R;x.pixelFormat=c.RG_INTEGER,x.internalFormat=i.RG8UI,x.wrapMode=s.CLAMP_TO_EDGE,x.samplingMode=h.NEAREST;const I=new R;I.internalFormat=i.RGBA4,I.dataType=m.UNSIGNED_SHORT_4_4_4_4,I.wrapMode=s.CLAMP_TO_EDGE;const L=new R;L.wrapMode=s.CLAMP_TO_EDGE;const S=new R;S.wrapMode=s.CLAMP_TO_EDGE,S.samplingMode=h.LINEAR_MIPMAP_LINEAR,S.hasMipmap=!0,S.maxAnisotropy=8;const y=new R;y.pixelFormat=c.RED,y.dataType=m.HALF_FLOAT,y.internalFormat=i.R16F,y.samplingMode=h.NEAREST;const B=new R;B.dataType=m.HALF_FLOAT,B.internalFormat=i.RGBA16F,B.samplingMode=h.NEAREST;const j=new R;j.dataType=m.HALF_FLOAT,j.internalFormat=i.RGBA16F,j.wrapMode=s.CLAMP_TO_EDGE;const H={[u.R8]:G,[u.R8UI]:g,[u.RG8]:P,[u.RG8UI]:x,[u.RGBA4]:I,[u.RGBA8]:L,[u.RGBA8_MIPMAP]:S,[u.R16F]:y,[u.RGBA16F_NEAREST]:B,[u.RGBA16F]:j},q={[_.DEPTH_COMPONENT16]:m.UNSIGNED_SHORT,[_.DEPTH_COMPONENT24]:m.UNSIGNED_INT,[_.DEPTH_COMPONENT32F]:m.FLOAT,[l.DEPTH24_STENCIL8]:m.UNSIGNED_INT_24_8,[l.DEPTH32F_STENCIL8]:m.FLOAT_32_UNSIGNED_INT_24_8_REV};function U(e,t,r){const a=new R(t,r);return a.pixelFormat=D(e)?d.DEPTH_COMPONENT:d.DEPTH_STENCIL,a.dataType=q[e],a.samplingMode=h.NEAREST,a.wrapMode=s.CLAMP_TO_EDGE,a.internalFormat=e,a.hasMipmap=!1,a.isImmutable=!0,a}export{N as FBOCache,b as defaultWebGLFBO};
5
+ import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as r}from"../../webgl/ManagedDepthAttachment.js";import a from"../../webgl/ManagedFBO.js";import{AttachmentType as c}from"../../webgl/ManagedFBOResource.js";import{DepthTextureFormat as h,ColorFormat as o,isDepthFormat as i,isDepthTextureFormat as s,DepthTextureFormats as n,DepthRenderbufferFormats as u,ColorFormats as l}from"./FBOCacheFormats.js";import{FBOPool as m}from"./FBOPool.js";import{ColorAttachment0 as d}from"../../../webgl/enums.js";import{FramebufferObject as f}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as p}from"../../../webgl/Renderbuffer.js";import{Texture as _}from"../../../webgl/Texture.js";class C{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new m(e.newCache,"FBOCache"),this._depthCache=new m(e.newCache,"DepthAttachmentCache"),this._colorCache=new m(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===c.FBO&&e(t.name,t.fbo,t.numberOfColorAttachments)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+t.cachedMemory),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(t,r,c,s=o.RGBA8UNORM){const n=b(s,t,r);let u=this._cache.pop(n);const{rctx:l}=this;if(u){u.retain(),u.setName(c);const{fbo:t}=u;if(!t)throw new e("renderer","attempt to use a not existing framebuffer");l.temporaryBindFramebufferObject(t,(()=>{l.setDrawBuffers([d]),l.unbindTexture(t.colorTexture)}))}else{const e=new f(l);u=new a(n,c,e,(e=>{e??=h.DEPTH24_STENCIL8;const a=this._acquireDepth(e,t,r,`${u.name} depth`);return u.attachDepth(a),a.release(),u}),((e,a,c)=>{a??=o.RGBA8UNORM;const h=this._acquireColor(a,t,r,c??`${u.name} color ${e}`);return this.rctx.unbindTexture(h.attachment),u.attachColor(h,e),h.release(),u}),(()=>{this.debugCallback?.(u.name,u.fbo,u.numberOfColorAttachments),this._acquired.delete(u),null!=u?.getAttachment(d)?(u.fbo?.invalidateAttachments([d],!0),u.detachAllButColor0(),this._cache.put(u)):u?.dispose()})),i(s)?u.acquireDepth(s):u.acquireColor(d,s,c)}return this._trackHandle(u)}acquireDepth(e,t,r,a){return this._acquireDepth(e,t,r,a)}_acquireDepth(e,t,a,c){const h=b(e,t,a);let o=this._depthCache.pop(h);if(o)o.retain();else{const c=s(e)?new _(this.rctx,{...n[e],width:t,height:a}):new p(this.rctx,{...u[e],width:t,height:a}),i=new r(h,c,(()=>this._depthCache.put(i)));o=i}return o.name=c,o}_acquireColor(e,r,a,c){const h=b(e,r,a),o=this._colorCache.pop(h);if(o)return o.retain(),o.name=c,o;const i=new t(h,new _(this.rctx,{...l[e],width:r,height:a}),(()=>{this._colorCache.put(i)}));return i.name=c,i}_trackHandle(e){return this._acquired.add(e),e}}const w=new a("default","default",null,(()=>w),(()=>w),(()=>{}));function b(e,t,r){return`${e}x${t}x${r}`}w.release=()=>!1;export{C as FBOCache,w as defaultWebGLFBO};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{PixelFormat as T,SizedPixelFormat as E,TextureWrapMode as N,TextureSamplingMode as R,PixelType as n,SizedDepthFormat as e,SizedDepthStencilFormat as t,UnsizedDepthFormat as o}from"../../../webgl/enums.js";import{RenderbufferDescriptor as r}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as _}from"../../../webgl/TextureDescriptor.js";import{isSizedDepthFormat as O}from"../../../webgl/textureUtils.js";var M,a,A;function G(T){return T>=M.COUNT}function P(T){return T>=a.COUNT}!function(T){T[T.R8UNORM=0]="R8UNORM",T[T.R8UINT=1]="R8UINT",T[T.RG8UNORM=2]="RG8UNORM",T[T.RG8UINT=3]="RG8UINT",T[T.RGBA4UNORM=4]="RGBA4UNORM",T[T.RGBA8UNORM=5]="RGBA8UNORM",T[T.RGBA8UNORM_MIPMAP=6]="RGBA8UNORM_MIPMAP",T[T.R16FLOAT=7]="R16FLOAT",T[T.RGBA16FLOAT=8]="RGBA16FLOAT",T[T.COUNT=9]="COUNT"}(M||(M={})),function(T){T[T.DEPTH16=9]="DEPTH16",T[T.COUNT=10]="COUNT"}(a||(a={})),function(T){T[T.DEPTH24_STENCIL8=10]="DEPTH24_STENCIL8"}(A||(A={}));const U=new _;U.pixelFormat=T.RED,U.internalFormat=E.R8,U.wrapMode=N.CLAMP_TO_EDGE;const i=new _;i.pixelFormat=T.RED_INTEGER,i.internalFormat=E.R8UI,i.wrapMode=N.CLAMP_TO_EDGE,i.samplingMode=R.NEAREST;const p=new _;p.pixelFormat=T.RG,p.internalFormat=E.RG8,p.wrapMode=N.CLAMP_TO_EDGE;const D=new _;D.pixelFormat=T.RG_INTEGER,D.internalFormat=E.RG8UI,D.wrapMode=N.CLAMP_TO_EDGE,D.samplingMode=R.NEAREST;const m=new _;m.internalFormat=E.RGBA4,m.dataType=n.UNSIGNED_SHORT_4_4_4_4,m.wrapMode=N.CLAMP_TO_EDGE;const I=new _;I.wrapMode=N.CLAMP_TO_EDGE;const F=new _;F.wrapMode=N.CLAMP_TO_EDGE,F.samplingMode=R.LINEAR_MIPMAP_LINEAR,F.hasMipmap=!0,F.maxAnisotropy=8;const L=new _;L.pixelFormat=T.RED,L.dataType=n.HALF_FLOAT,L.internalFormat=E.R16F,L.samplingMode=R.NEAREST;const l=new _;l.dataType=n.HALF_FLOAT,l.internalFormat=E.RGBA16F,l.wrapMode=N.CLAMP_TO_EDGE;const C={[M.R8UNORM]:U,[M.R8UINT]:i,[M.RG8UNORM]:p,[M.RG8UINT]:D,[M.RGBA4UNORM]:m,[M.RGBA8UNORM]:I,[M.RGBA8UNORM_MIPMAP]:F,[M.R16FLOAT]:L,[M.RGBA16FLOAT]:l,[M.COUNT]:null},s={[e.DEPTH_COMPONENT16]:n.UNSIGNED_SHORT,[e.DEPTH_COMPONENT24]:n.UNSIGNED_INT,[e.DEPTH_COMPONENT32F]:n.FLOAT,[t.DEPTH24_STENCIL8]:n.UNSIGNED_INT_24_8,[t.DEPTH32F_STENCIL8]:n.FLOAT_32_UNSIGNED_INT_24_8_REV},w={[a.DEPTH16]:new r(e.DEPTH_COMPONENT16),[a.COUNT]:null},c={[A.DEPTH24_STENCIL8]:d(t.DEPTH24_STENCIL8)};function d(T){const E=new _;return E.pixelFormat=O(T)?o.DEPTH_COMPONENT:o.DEPTH_STENCIL,E.dataType=s[T],E.samplingMode=R.NEAREST,E.wrapMode=N.CLAMP_TO_EDGE,E.internalFormat=T,E.hasMipmap=!1,E.isImmutable=!0,E}export{M as ColorFormat,C as ColorFormats,a as DepthRenderbufferFormat,w as DepthRenderbufferFormats,A as DepthTextureFormat,c as DepthTextureFormats,G as isDepthFormat,P as isDepthTextureFormat};
@@ -2,15 +2,15 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ReadDepth as e}from"./output/ReadDepth.glsl.js";import{CameraSpace as o}from"./util/CameraSpace.glsl.js";import{Float3PassUniform as l}from"../shaderModules/Float3PassUniform.js";import{FloatPassUniform as t}from"../shaderModules/FloatPassUniform.js";import{glsl as r}from"../shaderModules/glsl.js";import{Texture2DBindUniform as a}from"../shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as n}from"../shaderModules/Texture2DPassUniform.js";function i(i,p){const d=i.fragment;d.include(e),i.include(o),d.uniforms.add(new t("globalAlpha",(e=>e.globalAlpha)),new l("glowColor",(e=>e.glowColor)),new t("glowWidth",((e,o)=>e.glowWidth*o.camera.pixelRatio)),new t("glowFalloff",(e=>e.glowFalloff)),new l("innerColor",(e=>e.innerColor)),new t("innerWidth",((e,o)=>e.innerWidth*o.camera.pixelRatio)),new a("depthMap",(e=>e.depth?.attachment)),new n("normalMap",(e=>e.normals))),d.code.add(r`vec4 blendPremultiplied(vec4 source, vec4 dest) {
5
+ import{ReadDepth as o}from"./output/ReadDepth.glsl.js";import{CameraSpace as e}from"./util/CameraSpace.glsl.js";import{Float3PassUniform as l}from"../shaderModules/Float3PassUniform.js";import{FloatPassUniform as t}from"../shaderModules/FloatPassUniform.js";import{glsl as r}from"../shaderModules/glsl.js";import{Texture2DBindUniform as a}from"../shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as n}from"../shaderModules/Texture2DPassUniform.js";function d(d,i){const p=d.fragment;p.include(o),d.include(e),p.uniforms.add(new t("globalAlpha",(o=>o.globalAlpha)),new l("glowColor",(o=>o.glowColor)),new t("glowWidth",((o,e)=>o.glowWidth*e.camera.pixelRatio)),new t("glowFalloff",(o=>o.glowFalloff)),new l("innerColor",(o=>o.innerColor)),new t("innerWidth",((o,e)=>o.innerWidth*e.camera.pixelRatio)),new a("depthMap",(o=>o.depth?.attachment)),new n("normalMap",(o=>o.normals))),p.code.add(r`vec4 blendPremultiplied(vec4 source, vec4 dest) {
6
6
  float oneMinusSourceAlpha = 1.0 - source.a;
7
7
  return vec4(
8
8
  source.rgb + dest.rgb * oneMinusSourceAlpha,
9
9
  source.a + dest.a * oneMinusSourceAlpha
10
10
  );
11
- }`),d.code.add(r`vec4 premultipliedColor(vec3 rgb, float alpha) {
11
+ }`),p.code.add(r`vec4 premultipliedColor(vec3 rgb, float alpha) {
12
12
  return vec4(rgb * alpha, alpha);
13
- }`),d.code.add(r`vec4 laserlineProfile(float dist) {
13
+ }`),p.code.add(r`vec4 laserlineProfile(float dist) {
14
14
  if (dist > glowWidth) {
15
15
  return vec4(0.0);
16
16
  }
@@ -20,7 +20,7 @@ return blendPremultiplied(
20
20
  premultipliedColor(innerColor, innerAlpha),
21
21
  premultipliedColor(glowColor, glowAlpha)
22
22
  );
23
- }`),d.code.add(r`bool laserlineReconstructFromDepth(out vec3 pos, out vec3 normal, out float angleCutoffAdjust, out float depthDiscontinuityAlpha) {
23
+ }`),p.code.add(r`bool laserlineReconstructFromDepth(out vec3 pos, out vec3 normal, out float angleCutoffAdjust, out float depthDiscontinuityAlpha) {
24
24
  float depth = depthFromTexture(depthMap, uv);
25
25
  if (depth == 1.0) {
26
26
  return false;
@@ -31,23 +31,21 @@ float minStep = 6e-8;
31
31
  float depthStep = clamp(depth + minStep, 0.0, 1.0);
32
32
  float linearDepthStep = linearizeDepth(depthStep);
33
33
  float depthError = abs(linearDepthStep - linearDepth);
34
- if (depthError > 0.2) {
35
- normal = normalize(texture(normalMap, uv).xyz * 2.0 - 1.0);
36
- angleCutoffAdjust = 0.004;
37
- } else {
38
- normal = normalize(cross(dFdx(pos), dFdy(pos)));
39
- angleCutoffAdjust = 0.0;
40
- }
34
+ vec3 normalReconstructed = normalize(cross(dFdx(pos), dFdy(pos)));
35
+ vec3 normalFromTexture = normalize(texture(normalMap, uv).xyz * 2.0 - 1.0);
36
+ float blendFactor = smoothstep(0.15, 0.2, depthError);
37
+ normal = normalize(mix(normalReconstructed, normalFromTexture, blendFactor));
38
+ angleCutoffAdjust = mix(0.0, 0.004, blendFactor);
41
39
  float ddepth = fwidth(linearDepth);
42
40
  depthDiscontinuityAlpha = 1.0 - smoothstep(0.0, 0.01, -ddepth / linearDepth);
43
41
  return true;
44
- }`),p.contrastControlEnabled?d.uniforms.add(new n("frameColor",((e,o)=>e.colors)),new t("globalAlphaContrastBoost",(e=>e.globalAlphaContrastBoost))).code.add(r`float rgbToLuminance(vec3 color) {
42
+ }`),i.contrastControlEnabled?p.uniforms.add(new n("frameColor",((o,e)=>o.colors)),new t("globalAlphaContrastBoost",(o=>o.globalAlphaContrastBoost))).code.add(r`float rgbToLuminance(vec3 color) {
45
43
  return dot(vec3(0.2126, 0.7152, 0.0722), color);
46
44
  }
47
45
  vec4 laserlineOutput(vec4 color) {
48
46
  float backgroundLuminance = rgbToLuminance(texture(frameColor, uv).rgb);
49
47
  float alpha = clamp(globalAlpha * max(backgroundLuminance * globalAlphaContrastBoost, 1.0), 0.0, 1.0);
50
48
  return color * alpha;
51
- }`):d.code.add(r`vec4 laserlineOutput(vec4 color) {
49
+ }`):p.code.add(r`vec4 laserlineOutput(vec4 color) {
52
50
  return color * globalAlpha;
53
- }`)}export{i as Laserline};
51
+ }`)}export{d as Laserline};
@@ -6,7 +6,7 @@ import{isColorOrColorEmission as s}from"../ShaderOutput.js";import{VertexTexture
6
6
  vec4 getEmissions(vec3 symbolColor) {
7
7
  vec4 emissions = ${g?"vec4(emissiveBaseColor, 1.0)":T?"vec4(symbolColor, 1.0)":"vec4(0.0)"};
8
8
  ${n(C,`emissions *= textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions.w = emissions.rgb == vec3(0.0) ? 0.0: emissions.w;`)}
9
- ${n(h,"emissions *= emissiveStrength;")}
9
+ ${n(h,"emissions.rgb *= emissiveStrength;")}
10
10
  return emissions;
11
11
  }
12
12
  `)}export{f as EmissionSource,c as Emissions,v as EmissionsParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{B as n,a as l}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as u}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as c}from"./BloomBlurTechniqueConfiguration.js";import{B as h}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as p}from"./BloomCompositionTechnique.js";import{BloomCompositionTechniqueConfiguration as b}from"./BloomCompositionTechniqueConfiguration.js";import{blurRadiusPresets as _,lodFactorsPresets as f,normalizePreset as d}from"./BloomPresets.glsl.js";import{RenderRequestType as g}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as P,DepthStencilAttachment as T,FramebufferBit as R}from"../../../../webgl/enums.js";import{ColorFormat as C}from"../../../../webgl/formats.js";let j=class extends m{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT_ENVIRONMENT,"emissive"]},this._blurHorizontalConfiguration=new c,this._blurVerticalConfiguration=new c,this._compositionConfiguration=new b,this._compositionParameters=new h,this._blurParameters=new n,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),o),r((()=>this.view.qualitySettings.bloom),(e=>{e?(this._enable(),this.precompile()):this._disable()}),o)])}destroy(){}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=_[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(_.cloudy,_[e.type],r)}this._compositionParameters.lodFactors=f[e.type].far,this._compositionParameters.lodFactorsFront=f[e.type].near,this.requestRender(g.UPDATE)}precompile(){this.techniques.precompile(u,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.bloomStage=l.Vertical,this.techniques.precompile(u,this._blurVerticalConfiguration),this.techniques.precompile(p,this._compositionConfiguration)}render(e){const t=e.find((({name:e})=>e===a.TRANSPARENT_ENVIRONMENT)),r=t.getAttachment(P)?.attachment;if(!r)return t;const o=this.techniques.get(u,this._blurHorizontalConfiguration),s=this.techniques.get(u,this._blurVerticalConfiguration),i=this.techniques.get(p,this._compositionConfiguration);if(!o.compiled||!s.compiled||!i.compiled)return this.requestRender(g.UPDATE),t;const m=t.getTexture(),n=this.fboCache,{fullWidth:l,fullHeight:c}=this.bindParameters.camera,h=this.renderingContext;let b=r,_=l,f=c;const d=5,R=this._blurParameters.blurRadius;for(let a=0;a<d;a++){const e=n.acquire(_,f,"bloomHorizontal",C.RGBA16F);this._blurParameters.color=b,this._prepareFBO(e,_,f),h.bindTechnique(o,this.bindParameters,this._blurParameters),h.screen.draw();const t=n.acquire(_,f,"bloomVertical",C.RGBA16F);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,_,f),h.bindTechnique(s,this.bindParameters,this._blurParameters),h.screen.draw(),e.release(),this._bloomResults[a]=t,_=Math.ceil(_/2),f=Math.ceil(f/2),b=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=R,this._compositionParameters.color=m,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const j=this.acquireOutputFramebuffer();return this._prepareFBO(j,l,c),h.bindTechnique(i,this.bindParameters,this._compositionParameters),h.screen.draw(),this._bloomResults.forEach((e=>e.release())),j.attachDepth(t.getAttachment(T)),j.attachColor(t.getAttachment(P),P),j}_prepareFBO(e,t,r){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,r),o.setClearColor(0,0,0,0),o.clear(R.COLOR)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=d(e)}}}};e([s()],j.prototype,"consumes",void 0),j=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],j);export{j as BloomRenderNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{ColorFormat as m}from"../../core/FBOCacheFormats.js";import{TransparentEnvironment as n}from"../TransparentEnvironment.js";import{B as l,a as u}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as c}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as h}from"./BloomBlurTechniqueConfiguration.js";import{B as p}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as b}from"./BloomCompositionTechnique.js";import{BloomCompositionTechniqueConfiguration as _}from"./BloomCompositionTechniqueConfiguration.js";import{blurRadiusPresets as f,lodFactorsPresets as d,normalizePreset as g}from"./BloomPresets.glsl.js";import{RenderRequestType as P}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as T,DepthStencilAttachment as R,FramebufferBit as C}from"../../../../webgl/enums.js";let j=class extends n{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT_ENVIRONMENT,"emissive"]},this._blurHorizontalConfiguration=new h,this._blurVerticalConfiguration=new h,this._compositionConfiguration=new _,this._compositionParameters=new p,this._blurParameters=new l,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),o),r((()=>this.view.qualitySettings.bloom),(e=>{e?(this._enable(),this.precompile()):this._disable()}),o)])}destroy(){}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=f[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(f.cloudy,f[e.type],r)}this._compositionParameters.lodFactors=d[e.type].far,this._compositionParameters.lodFactorsFront=d[e.type].near,this.requestRender(P.UPDATE)}precompile(){this.techniques.precompile(c,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.bloomStage=u.Vertical,this.techniques.precompile(c,this._blurVerticalConfiguration),this.techniques.precompile(b,this._compositionConfiguration)}render(e){const t=e.find((({name:e})=>e===a.TRANSPARENT_ENVIRONMENT)),r=t.getAttachment(T)?.attachment;if(!r)return t;const o=this.techniques.get(c,this._blurHorizontalConfiguration),s=this.techniques.get(c,this._blurVerticalConfiguration),i=this.techniques.get(b,this._compositionConfiguration);if(!o.compiled||!s.compiled||!i.compiled)return this.requestRender(P.UPDATE),t;const n=t.getTexture(),l=this.fboCache,{fullWidth:u,fullHeight:h}=this.bindParameters.camera,p=this.renderingContext;let _=r,f=u/2,d=h/2;const g=5,C=this._blurParameters.blurRadius;for(let a=0;a<g;a++){const e=l.acquire(f,d,"bloomHorizontal",m.RGBA16FLOAT);this._blurParameters.color=_,this._prepareFBO(e,f,d),p.bindTechnique(o,this.bindParameters,this._blurParameters),p.screen.draw();const t=l.acquire(f,d,"bloomVertical",m.RGBA16FLOAT);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,f,d),p.bindTechnique(s,this.bindParameters,this._blurParameters),p.screen.draw(),e.release(),this._bloomResults[a]=t,f=Math.ceil(f/2),d=Math.ceil(d/2),_=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=C,this._compositionParameters.color=n,this._compositionParameters.emission=r,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const j=this.acquireOutputFramebuffer();return this._prepareFBO(j,u,h),p.bindTechnique(i,this.bindParameters,this._compositionParameters),p.screen.draw(),this._bloomResults.forEach((e=>e.release())),j.attachDepth(t.getAttachment(R)),j.attachColor(t.getAttachment(T),T),j}_prepareFBO(e,t,r){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,r),o.setClearColor(0,0,0,0),o.clear(C.COLOR)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=g(e)}}}};e([s()],j.prototype,"consumes",void 0),j=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],j);export{j as BloomRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{If as c,glsl as s}from"../../core/shaderModules/glsl.js";import{Default3D as a}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as l,ColorAttachment0 as u,BlendFactor as p,SizedPixelFormat as h,PixelFormat as f,DataType as d}from"../../../../webgl/enums.js";import{ColorFormat as m}from"../../../../webgl/formats.js";import{alphaCutoff as v}from"../../../../../webscene/support/AlphaCutoff.js";let g=class extends i{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=o,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(l.COLOR);const o=this._focusedFBO.getTexture(),i=[F(o)],c=this._ensureShader(t,!1,i);return t.useProgram(c),t.bindTexture(o,0),c.setUniform1i("colorTex",0),c.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&c.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n,i){t===x.ON&&(n=e.width,i=e.height);const c=[];for(let l=0;l<Math.min(r,e.colorAttachments.length);++l){const r=e.getColorTexture(u+l);r&&c.push(F(r))}const s=this.renderingContext,{colorTexture:a,depthStencilTexture:f}=e,d=a?.descriptor,v=this._ensureShader(s,null!=f,c),g=this.fboCache.acquire(n,i,"fbo visualizer");let T=!1;a&&(T="float"===c[0]&&!a.descriptor.hasMipmap,T&&e.colorTexture?.generateMipmap()),s.useProgram(v),s.bindFramebuffer(g.fbo);let R=0;const b=[u],C=null!=f;if(s.bindTexture(a,R),v.setUniform1i("colorTex",R),f){R++,s.bindTexture(f,R),v.setUniform1i("depthTex",R);const e=u+R;g.acquireColor(e,m.RGBA8,"depth to color"),b.push(e)}for(let l=1;l<r;++l){R++;const r=u+R,t=C?1:0;s.bindTexture(e.getColorTexture(r-t),R);const o="colorTex"+(R-t);v.setUniform1i(o,R),g.acquireColor(r,m.RGBA8),b.push(r)}s.gl.drawBuffers(b);const B=s.getViewport();s.setViewport(0,0,n,i),s.setClearColor(0,0,0,0),s.clear(l.COLOR),s.setBlendingEnabled(!0),s.setBlendFunction(p.ONE,p.ONE_MINUS_SRC_ALPHA);const A="linear-depth"===o||o.includes("shadow"),y="overlay highlight"===o||"highlights"===o||"highlight mix"===o,I="highlight coverage"===o,_=d?.internalFormat,G=A?3:y?5:I?6:_===h.R16F||_===h.R32F||_===h.R8?1:_===h.RG8?2:_===h.RGBA16F?4:_===h.RG8UI?7:0;return v.setUniform1i("inputType",G),A&&v.setUniform2fv("nearFar",this.camera.nearFar),s.screen.draw(),s.bindFramebuffer(null),s.setViewport(B.x,B.y,B.width,B.height),t===x.ON&&(this._focusedFBO=g,this._focusedFBOType=G),T&&e.colorTexture?.clearMipmap(),g}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,t,o){if(!t)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(l.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(p.ONE,p.ONE_MINUS_SRC_ALPHA);const c=t.getColorTexture(o);n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1,[F(c)]);n.useProgram(s),n.bindTexture(c,0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,f.RGBA,d.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),n.bindFramebuffer(null),i?.release(),a}_ensureShader(e,r,t){const o=R({hasDepthAttachment:r,colorAttachmentTypes:t}),n=this._program.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",l=(e,r)=>{let t="";const o=e?1:0;for(let n=1;n<r.length;++n){const e=r[n];t+=`layout(location = ${s.int(o+n)}) out vec4 fragColor${s.int(n)};\n uniform ${T(e)} colorTex${s.int(n)};`}return t},u=e=>{let r="";for(let t=1;t<e.length;++t){const o=e[t],n=`texture(colorTex${s.int(t)}, uv)`,i="float"===o?n:`vec4( vec2(${n}), 0.0, 1.0)`;r+=`fragColor${s.int(t)} = ${i};`}return r},p=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n uniform ${T(t[0])} colorTex;\n layout(location = 0) out vec4 fragColor;\n ${c(r,"layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;")}\n ${l(r,t)}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaTofloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaTofloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n vec4 color;\n if (inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if (inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if (inputType == 3) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == 4) {\n color = vec4(texture(colorTex, uv));\n color = vec4(color.rgb / color.a, color.a);\n } else if (inputType == 5) {\n color = vec4(texture(colorTex, uv)) * 255.0;\n color = vec4(color.rgb / color.a, color.a);\n } else if(inputType == 6) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex,iuv,0).rg);\n color = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n color = vec4(texture(colorTex, uv));\n }\n\n\n if(color.a < ${s.float(v)})\n discard;\n else {\n fragColor = color;\n ${c(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n ${c(t.length>1,u(t))}\n }\n }`,h=e.programCache.acquire(i,p,a);return this._program.set(o,h),h}};var x;function T(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function F(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case h.R8I:case h.R16I:case h.R32I:case h.RG8I:case h.RG16I:case h.RG32I:case h.RGB8I:case h.RGB16I:case h.RGB32I:case h.RGBA8I:case h.RGBA16I:case h.RGBA32I:return"int";case h.R8UI:case h.R16UI:case h.R32UI:case h.RG8UI:case h.RG16UI:case h.RG32UI:case h.RGB8UI:case h.RGB16UI:case h.RGB32UI:case h.RGBA8UI:case h.RGBA16UI:case h.RGBA32UI:return"uint";default:return"float"}}function R(e){const{hasDepthAttachment:r,colorAttachmentTypes:t}=e;return`${r?"Depth":""}${t.reduceRight(((e,r)=>e+`|C${r}`),"")}`}e([r()],g.prototype,"destroyedCB",void 0),e([r()],g.prototype,"produces",void 0),e([r()],g.prototype,"consumes",void 0),e([r()],g.prototype,"clearColor",void 0),g=e([t("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],g),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(x||(x={}));export{x as FocusState,g as RenderNodeVisualizerNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{ColorFormat as c}from"../../core/FBOCacheFormats.js";import{If as s,glsl as a}from"../../core/shaderModules/glsl.js";import{Default3D as l}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as u,ColorAttachment0 as p,BlendFactor as h,SizedPixelFormat as f,PixelFormat as d,DataType as m}from"../../../../webgl/enums.js";import{alphaCutoff as v}from"../../../../../webscene/support/AlphaCutoff.js";let g=class extends i{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=o,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(u.COLOR);const o=this._focusedFBO.getTexture(),i=[F(o)],c=this._ensureShader(t,!1,i);return t.useProgram(c),t.bindTexture(o,0),c.setUniform1i("colorTex",0),c.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&c.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n,i){t===x.ON&&(n=e.width,i=e.height);const s=[];for(let c=0;c<Math.min(r,e.colorAttachments.length);++c){const r=e.getColorTexture(p+c);r&&s.push(F(r))}const a=this.renderingContext,{colorTexture:l,depthStencilTexture:d}=e,m=l?.descriptor,v=this._ensureShader(a,null!=d,s),g=this.fboCache.acquire(n,i,"fbo visualizer");let T=!1;l&&(T="float"===s[0]&&!l.descriptor.hasMipmap,T&&e.colorTexture?.generateMipmap()),a.useProgram(v),a.bindFramebuffer(g.fbo);let R=0;const b=[p],C=null!=d;if(a.bindTexture(l,R),v.setUniform1i("colorTex",R),d){R++,a.bindTexture(d,R),v.setUniform1i("depthTex",R);const e=p+R;g.acquireColor(e,c.RGBA8UNORM,"depth to color"),b.push(e)}for(let u=1;u<r;++u){R++;const r=p+R,t=C?1:0;a.bindTexture(e.getColorTexture(r-t),R);const o="colorTex"+(R-t);v.setUniform1i(o,R),g.acquireColor(r,c.RGBA8UNORM),b.push(r)}a.gl.drawBuffers(b);const B=a.getViewport();a.setViewport(0,0,n,i),a.setClearColor(0,0,0,0),a.clear(u.COLOR),a.setBlendingEnabled(!0),a.setBlendFunction(h.ONE,h.ONE_MINUS_SRC_ALPHA);const A="linear-depth"===o||o.includes("shadow"),O="overlay highlight"===o||"highlights"===o||"highlight mix"===o,y="highlight coverage"===o,I=m?.internalFormat,_=A?3:O?5:y?6:I===f.R16F||I===f.R32F||I===f.R8?1:I===f.RG8?2:I===f.RGBA16F?4:I===f.RG8UI?7:0;return v.setUniform1i("inputType",_),A&&v.setUniform2fv("nearFar",this.camera.nearFar),a.screen.draw(),a.bindFramebuffer(null),a.setViewport(B.x,B.y,B.width,B.height),t===x.ON&&(this._focusedFBO=g,this._focusedFBOType=_),T&&e.colorTexture?.clearMipmap(),g}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,t,o){if(!t)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(u.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(h.ONE,h.ONE_MINUS_SRC_ALPHA);const c=t.getColorTexture(o);n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1,[F(c)]);n.useProgram(s),n.bindTexture(c,0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,d.RGBA,m.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),n.bindFramebuffer(null),i?.release(),a}_ensureShader(e,r,t){const o=R({hasDepthAttachment:r,colorAttachmentTypes:t}),n=this._program.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",c=(e,r)=>{let t="";const o=e?1:0;for(let n=1;n<r.length;++n){const e=r[n];t+=`layout(location = ${a.int(o+n)}) out vec4 fragColor${a.int(n)};\n uniform ${T(e)} colorTex${a.int(n)};`}return t},u=e=>{let r="";for(let t=1;t<e.length;++t){const o=e[t],n=`texture(colorTex${a.int(t)}, uv)`,i="float"===o?n:`vec4( vec2(${n}), 0.0, 1.0)`;r+=`fragColor${a.int(t)} = ${i};`}return r},p=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n uniform ${T(t[0])} colorTex;\n layout(location = 0) out vec4 fragColor;\n ${s(r,"layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;")}\n ${c(r,t)}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaTofloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaTofloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n vec4 color;\n if (inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if (inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if (inputType == 3) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == 4) {\n color = vec4(texture(colorTex, uv));\n color = vec4(color.rgb / color.a, color.a);\n } else if (inputType == 5) {\n color = vec4(texture(colorTex, uv)) * 255.0;\n color = vec4(color.rgb / color.a, color.a);\n } else if(inputType == 6) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex,iuv,0).rg);\n color = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n color = vec4(texture(colorTex, uv));\n }\n\n\n if(color.a < ${a.float(v)})\n discard;\n else {\n fragColor = color;\n ${s(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n ${s(t.length>1,u(t))}\n }\n }`,h=e.programCache.acquire(i,p,l);return this._program.set(o,h),h}};var x;function T(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function F(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case f.R8I:case f.R16I:case f.R32I:case f.RG8I:case f.RG16I:case f.RG32I:case f.RGB8I:case f.RGB16I:case f.RGB32I:case f.RGBA8I:case f.RGBA16I:case f.RGBA32I:return"int";case f.R8UI:case f.R16UI:case f.R32UI:case f.RG8UI:case f.RG16UI:case f.RG32UI:case f.RGB8UI:case f.RGB16UI:case f.RGB32UI:case f.RGBA8UI:case f.RGBA16UI:case f.RGBA32UI:return"uint";default:return"float"}}function R(e){const{hasDepthAttachment:r,colorAttachmentTypes:t}=e;return`${r?"Depth":""}${t.reduceRight(((e,r)=>e+`|C${r}`),"")}`}e([r()],g.prototype,"destroyedCB",void 0),e([r()],g.prototype,"produces",void 0),e([r()],g.prototype,"consumes",void 0),e([r()],g.prototype,"clearColor",void 0),g=e([t("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],g),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(x||(x={}));export{x as FocusState,g as RenderNodeVisualizerNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as r,RenderCategory as o}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{FocusAreaMaskTechnique as n}from"./FocusAreaMaskTechnique.js";import{Default3D as a}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as c}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as h}from"../../lib/VertexArrayObject.js";import{F as p}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as u}from"../../../../webgl/BufferObject.js";import{DepthStencilAttachment as l,FramebufferBit as m,Face as d,StencilOperation as f,CompareFunction as g,PrimitiveType as A,Usage as E}from"../../../../webgl/enums.js";import{ColorFormat as b}from"../../../../webgl/formats.js";import{noParameters as w}from"../../../../webgl/NoParameters.js";let _=class extends i{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[r.FOCUSAREA,o.TRANSPARENT]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new p}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(n)}render(e){const t=this.techniques.get(n),s=this.bindParameters,i=s.camera,a=i.fullViewport[2],c=i.fullViewport[3],h=this.fboCache.acquire(a,c,r.FOCUSAREA,b.RGBA8);if(!t.compiled||!this._vaos)return this.requestRender(),h;const p=e.find((({name:e})=>e===o.TRANSPARENT)),u=this.renderingContext;h.attachDepth(p.getAttachment(l)),u.bindFramebuffer(h.fbo),u.clear(m.COLOR|m.STENCIL),u.setViewport(0,0,a,c),u.clear(m.STENCIL,0);const E=u.bindTechnique(t,s);u.setFaceCullingEnabled(!1),u.setStencilTestEnabled(!0),u.setStencilOpSeparate(d.FRONT,f.KEEP,f.INCR_WRAP,f.KEEP),u.setStencilOpSeparate(d.BACK,f.KEEP,f.DECR_WRAP,f.KEEP),u.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],t=this._counts[r];this._maskParameters.origin=this._origins[r],E.bindDraw(s,w,this._maskParameters),u.bindVAO(e),u.setDepthTestEnabled(!0),u.setStencilWriteMask(255),u.setStencilFunction(g.ALWAYS,0,255),u.setColorMask(!1,!1,!1,!1),u.drawArrays(A.TRIANGLES,0,t),u.setDepthTestEnabled(!1),u.setStencilWriteMask(0),u.setStencilFunction(g.NOTEQUAL,0,255),u.setColorMask(!0,!0,!0,!0),u.drawArrays(A.TRIANGLES,0,t)}return h}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0;const e=this.focusAreas.geometries;for(const t of e){const e=new Array,s=t.indicesBottom;for(let n=0;n<s.length;n++)e.push(t.positions[3*(s[n]-1)]),e.push(t.positions[3*(s[n]-1)+1]),e.push(t.positions[3*(s[n]-1)+2]);const r=t.indicesExtruded;for(let n=0;n<r.length;n++)e.push(t.positions[3*r[n]]),e.push(t.positions[3*r[n]+1]),e.push(t.positions[3*r[n]+2]);const o=new Float32Array(e),i=new h(this.renderingContext,a,new Map([["geometry",c]]),new Map([["geometry",u.createVertex(this.renderingContext,E.STATIC_DRAW,o)]]));this._vaos.push(i),this._counts.push(s.length+r.length),this._origins.push(t.origin)}this.requestRender()}};e([t()],_.prototype,"consumes",void 0),e([t()],_.prototype,"produces",void 0),e([t({constructOnly:!0})],_.prototype,"focusAreas",void 0),_=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],_);class R{constructor(e,t,s,r,o,i){this.positions=e,this.indicesBottom=t,this.indicesExtruded=s,this.height=r,this.origin=o,this.color=i}}var S;!function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(S||(S={}));export{S as FocusAreaEffect,R as FocusAreaGeometry,_ as FocusAreaMaskNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as r,RenderCategory as o}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{ColorFormat as n}from"../../core/FBOCacheFormats.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{Default3D as c}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as h}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as p}from"../../lib/VertexArrayObject.js";import{F as u}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as l}from"../../../../webgl/BufferObject.js";import{DepthStencilAttachment as m,FramebufferBit as d,Face as f,StencilOperation as A,CompareFunction as g,PrimitiveType as E,Usage as b}from"../../../../webgl/enums.js";import{noParameters as R}from"../../../../webgl/NoParameters.js";let _=class extends i{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[r.FOCUSAREA,o.TRANSPARENT]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new u}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const t=this.techniques.get(a),s=this.bindParameters,i=s.camera,c=i.fullViewport[2],h=i.fullViewport[3],p=this.fboCache.acquire(c,h,r.FOCUSAREA,n.RGBA8UNORM);if(!t.compiled||!this._vaos)return this.requestRender(),p;const u=e.find((({name:e})=>e===o.TRANSPARENT)),l=this.renderingContext;p.attachDepth(u.getAttachment(m)),l.bindFramebuffer(p.fbo),l.clear(d.COLOR|d.STENCIL),l.setViewport(0,0,c,h),l.clear(d.STENCIL,0);const b=l.bindTechnique(t,s);l.setFaceCullingEnabled(!1),l.setStencilTestEnabled(!0),l.setStencilOpSeparate(f.FRONT,A.KEEP,A.INCR_WRAP,A.KEEP),l.setStencilOpSeparate(f.BACK,A.KEEP,A.DECR_WRAP,A.KEEP),l.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],t=this._counts[r];this._maskParameters.origin=this._origins[r],b.bindDraw(s,R,this._maskParameters),l.bindVAO(e),l.setDepthTestEnabled(!0),l.setStencilWriteMask(255),l.setStencilFunction(g.ALWAYS,0,255),l.setColorMask(!1,!1,!1,!1),l.drawArrays(E.TRIANGLES,0,t),l.setDepthTestEnabled(!1),l.setStencilWriteMask(0),l.setStencilFunction(g.NOTEQUAL,0,255),l.setColorMask(!0,!0,!0,!0),l.drawArrays(E.TRIANGLES,0,t)}return p}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0;const e=this.focusAreas.geometries;for(const t of e){const e=new Array,s=t.indicesBottom;for(let n=0;n<s.length;n++)e.push(t.positions[3*(s[n]-1)]),e.push(t.positions[3*(s[n]-1)+1]),e.push(t.positions[3*(s[n]-1)+2]);const r=t.indicesExtruded;for(let n=0;n<r.length;n++)e.push(t.positions[3*r[n]]),e.push(t.positions[3*r[n]+1]),e.push(t.positions[3*r[n]+2]);const o=new Float32Array(e),i=new p(this.renderingContext,c,new Map([["geometry",h]]),new Map([["geometry",l.createVertex(this.renderingContext,b.STATIC_DRAW,o)]]));this._vaos.push(i),this._counts.push(s.length+r.length),this._origins.push(t.origin)}this.requestRender()}};e([t()],_.prototype,"consumes",void 0),e([t()],_.prototype,"produces",void 0),e([t({constructOnly:!0})],_.prototype,"focusAreas",void 0),_=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],_);class w{constructor(e,t,s,r,o,i){this.positions=e,this.indicesBottom=t,this.indicesExtruded=s,this.height=r,this.origin=o,this.color=i}}var S;!function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(S||(S={}));export{S as FocusAreaEffect,w as FocusAreaGeometry,_ as FocusAreaMaskNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/PooledArray.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{Blit as c}from"../blit/Blit.js";import{StencilBits as l}from"../../lib/basicInterfaces.js";import{RenderOccludedFlag as a}from"../../lib/Material.js";import{RenderSlot as d}from"../../lib/RenderSlot.js";import{BlitMode as p}from"../../shaders/CompositingTechniqueConfiguration.js";import{DepthStencilAttachment as u}from"../../../../webgl/enums.js";import{DepthFormat as m}from"../../../../webgl/formats.js";let f=class extends i{constructor(e){super(e),this.consumes={required:[n.OCCLUDED]},this.produces=n.OCCLUDED,this._blit=new c(e.view.stage.renderView.techniques,p.PremultipliedAlpha)}precompile(){const e=this.view.stage.renderer;e.plugins.plugins.forAll((r=>{e.precompileSlots(r,d.OCCLUDED_TERRAIN,d.TRANSPARENT_OCCLUDER_MATERIAL),r.material&&e.precompileOccludedSlots(r,g)}))}render(e){const r=e.find((({name:e})=>e===this.produces)),t=this.view.stage.renderer;let s=0;if(h.clear(),t.plugins.plugins.forAll((e=>{if(!e.material)return;e.queryRenderOccludedState(a.OccludeAndTransparentStencil)&&(s|=a.OccludeAndTransparentStencil,h.push(e))})),h.length>0&&(t.renderSlots(h,d.OCCLUDER_MATERIAL),s&a.OccludeAndTransparentStencil&&this._renderAndComposite(r,.5,(()=>t.renderSlots(h,d.TRANSPARENT_OCCLUDER_MATERIAL)),!1,!1)),h.clear(),t.plugins.plugins.forAll((e=>{if(!e.material)return;const r=e.queryRenderOccludedState(a.OccludeAndTransparent),t=e.queryRenderOccludedState(a.Transparent),o=e.queryRenderOccludedState(a.Opaque);(r||t||o)&&(s|=r?a.OccludeAndTransparent:t?a.Transparent:a.Opaque,h.push(e))})),s|=t.plugins.renderOccludedFlags,!s)return r;for(const o of g)s&o&&this._renderAndComposite(r,o===a.Opaque?1:.5,(()=>t.renderOccludedSlots(h,o)),!0,l.OutlineVisualElementMask);return h.clear(),r}_renderAndComposite(e,r,t,s,n){const i=this.renderingContext,{width:c,height:l}=e.fbo,a=this.fboCache.acquire(c,l,"tmp color"),d=s?this.fboCache.acquireDepth(m.DEPTH24_STENCIL8_TEXTURE,c,l,"tmp depth"):e.getAttachment(u);a.attachDepth(d),i.bindFramebuffer(a.fbo),i.clearFramebuffer(o,s,n),t(),a.detachDepth(),this._blit.blend(i,a,e,this.bindParameters,r),s&&d.release(),a.release()}};e([t()],f.prototype,"consumes",void 0),e([t()],f.prototype,"produces",void 0),f=e([s("esri.views.3d.webgl-engine.effects.geometry.RenderOccludedRenderNode")],f);const h=new r,g=[a.OccludeAndTransparent,a.Transparent,a.Opaque];export{f as RenderOccludedRenderNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/PooledArray.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as n}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{DepthTextureFormat as c}from"../../core/FBOCacheFormats.js";import{Blit as a}from"../blit/Blit.js";import{StencilBits as l}from"../../lib/basicInterfaces.js";import{RenderOccludedFlag as d}from"../../lib/Material.js";import{RenderSlot as p}from"../../lib/RenderSlot.js";import{BlitMode as u}from"../../shaders/CompositingTechniqueConfiguration.js";import{DepthStencilAttachment as m}from"../../../../webgl/enums.js";let f=class extends i{constructor(e){super(e),this.consumes={required:[n.OCCLUDED]},this.produces=n.OCCLUDED,this._blit=new a(e.view.stage.renderView.techniques,u.PremultipliedAlpha)}precompile(){const e=this.view.stage.renderer;e.plugins.plugins.forAll((r=>{e.precompileSlots(r,p.OCCLUDED_TERRAIN,p.TRANSPARENT_OCCLUDER_MATERIAL),r.material&&e.precompileOccludedSlots(r,g)}))}render(e){const r=e.find((({name:e})=>e===this.produces)),t=this.view.stage.renderer;let s=0;if(h.clear(),t.plugins.plugins.forAll((e=>{if(!e.material)return;e.queryRenderOccludedState(d.OccludeAndTransparentStencil)&&(s|=d.OccludeAndTransparentStencil,h.push(e))})),h.length>0&&(t.renderSlots(h,p.OCCLUDER_MATERIAL),s&d.OccludeAndTransparentStencil&&this._renderAndComposite(r,.5,(()=>t.renderSlots(h,p.TRANSPARENT_OCCLUDER_MATERIAL)),!1,!1)),h.clear(),t.plugins.plugins.forAll((e=>{if(!e.material)return;const r=e.queryRenderOccludedState(d.OccludeAndTransparent),t=e.queryRenderOccludedState(d.Transparent),o=e.queryRenderOccludedState(d.Opaque);(r||t||o)&&(s|=r?d.OccludeAndTransparent:t?d.Transparent:d.Opaque,h.push(e))})),s|=t.plugins.renderOccludedFlags,!s)return r;for(const o of g)s&o&&this._renderAndComposite(r,o===d.Opaque?1:.5,(()=>t.renderOccludedSlots(h,o)),!0,l.OutlineVisualElementMask);return h.clear(),r}_renderAndComposite(e,r,t,s,n){const i=this.renderingContext,{width:a,height:l}=e.fbo,d=this.fboCache.acquire(a,l,"tmp color"),p=s?this.fboCache.acquireDepth(c.DEPTH24_STENCIL8,a,l,"tmp depth"):e.getAttachment(m);d.attachDepth(p),i.bindFramebuffer(d.fbo),i.clearFramebuffer(o,s,n),t(),d.detachDepth(),this._blit.blend(i,d,e,this.bindParameters,r),s&&p.release(),d.release()}};e([t()],f.prototype,"consumes",void 0),e([t()],f.prototype,"produces",void 0),f=e([s("esri.views.3d.webgl-engine.effects.geometry.RenderOccludedRenderNode")],f);const h=new r,g=[d.OccludeAndTransparent,d.Transparent,d.Opaque];export{f as RenderOccludedRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t,clamp as s,smoothstep as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,k as c}from"../../../../../chunks/vec32.js";import{s as p}from"../../../../../chunks/vec42.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{H as f}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as _}from"./HazeCompositingTechnique.js";import{HazePassParameters as g,HazeTechnique as b}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as w}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as P,Layout as j}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as v}from"../../lib/textureUtils.js";import{DepthStencilAttachment as A,PrimitiveType as T}from"../../../../webgl/enums.js";import{ColorFormat as C}from"../../../../webgl/formats.js";let x=class extends l{constructor(e){super(e),this._compositingPassParameters=new f,this._passParameters=new g,this._hazeConfiguration=new w,this._vao=null,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view.stage.renderView.techniques;t.precompile(b,new w);const s=new w;s.reduced=!0,t.precompile(b,s),t.precompile(_)}initialize(){this.addHandles([o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a),o((()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1),(e=>this._fade(e)),a),o((()=>this.view.environment.weather.type),(e=>this._newAmount="rainy"===e?0:1),a),o((()=>this.view.stage.renderer?.fullResolutionAtmosphere),(e=>this._hazeConfiguration.reduced=!e),a)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=i(this._vao)}render(e){const s=e.find((({name:e})=>e===d.TRANSPARENT_ENVIRONMENT));if(!this.bindParameters.mainDepth)return s;const r=this.renderingContext;this._vao??=P(r,j.Pos2Tex);const i=this.techniques.get(b,this._hazeConfiguration);if(!i.compiled)return s;const o=s.getAttachment(A);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),s.attachDepth(o),s;const a=this.techniques.get(_);if(!a.compiled)return s;const n=r.getViewport(),m=this.camera,c=h(m.eye)-u.radius;let p;const l=u.atmosphereHeight;if(c<l){const e=Math.min(1,Math.max(0,c/l));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(c-l)/(15*l)));p=t(.5,1,e)}const f=this.renderingContext.parameters.maxTextureSize,g=v(Math.round(p*m.fullViewport[2]),f),w=v(Math.round(p*m.fullViewport[3]),f);r.setViewport(0,0,g,w);const T=this.fboCache.acquire(g,w,"haze",C.RGBA8);return r.bindFramebuffer(T.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=T.getTexture(),s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),s.attachDepth(o),T.release(),s}_renderCommon(e){null!=this._vao&&(e.bindVAO(this._vao),e.drawArrays(T.TRIANGLE_STRIP,0,4))}_update(){const e=this.bindParameters.camera,i=c(e.eye),o=Math.sqrt(i),a=i-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((o-this._passParameters.radii[0])/u.atmosphereHeight,0,1);p(this._passParameters.heightParameters,o,i,a,n);const h=this.view.basemapTerrain?.getLowerBoundRadius()??0;m(this._passParameters.radii,h,h+u.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,r(9500,10500,o-u.radius)),1,this._amount)}};x=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],x);export{x as Haze};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t,clamp as s,smoothstep as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,k as c}from"../../../../../chunks/vec32.js";import{s as p}from"../../../../../chunks/vec42.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{ColorFormat as l}from"../../core/FBOCacheFormats.js";import{TransparentEnvironment as f}from"../TransparentEnvironment.js";import{H as _}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as g}from"./HazeCompositingTechnique.js";import{HazePassParameters as b,HazeTechnique as w}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as P}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as j,Layout as v}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as A}from"../../lib/textureUtils.js";import{DepthStencilAttachment as C,PrimitiveType as T}from"../../../../webgl/enums.js";let x=class extends f{constructor(e){super(e),this._compositingPassParameters=new _,this._passParameters=new b,this._hazeConfiguration=new P,this._vao=null,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view.stage.renderView.techniques;t.precompile(w,new P);const s=new P;s.reduced=!0,t.precompile(w,s),t.precompile(g)}initialize(){this.addHandles([o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a),o((()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1),(e=>this._fade(e)),a),o((()=>this.view.environment.weather.type),(e=>this._newAmount="rainy"===e?0:1),a),o((()=>this.view.stage.renderer?.fullResolutionAtmosphere),(e=>this._hazeConfiguration.reduced=!e),a)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=i(this._vao)}render(e){const s=e.find((({name:e})=>e===d.TRANSPARENT_ENVIRONMENT));if(!this.bindParameters.mainDepth)return s;const r=this.renderingContext;this._vao??=j(r,v.Pos2Tex);const i=this.techniques.get(w,this._hazeConfiguration);if(!i.compiled)return s;const o=s.getAttachment(C);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),s.attachDepth(o),s;const a=this.techniques.get(g);if(!a.compiled)return s;const n=r.getViewport(),m=this.camera,c=h(m.eye)-u.radius;let p;const f=u.atmosphereHeight;if(c<f){const e=Math.min(1,Math.max(0,c/f));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(c-f)/(15*f)));p=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,b=A(Math.round(p*m.fullViewport[2]),_),P=A(Math.round(p*m.fullViewport[3]),_);r.setViewport(0,0,b,P);const T=this.fboCache.acquire(b,P,"haze",l.RGBA8UNORM);return r.bindFramebuffer(T.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=T.getTexture(),s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),s.attachDepth(o),T.release(),s}_renderCommon(e){null!=this._vao&&(e.bindVAO(this._vao),e.drawArrays(T.TRIANGLE_STRIP,0,4))}_update(){const e=this.bindParameters.camera,i=c(e.eye),o=Math.sqrt(i),a=i-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((o-this._passParameters.radii[0])/u.atmosphereHeight,0,1);p(this._passParameters.heightParameters,o,i,a,n);const h=this.view.basemapTerrain?.getLowerBoundRadius()??0;m(this._passParameters.radii,h,h+u.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,r(9500,10500,o-u.radius)),1,this._amount)}};x=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],x);export{x as Haze};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as c}from"./HighlightBlurTechnique.js";import{HighlightDownsampleTechnique as u}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as m}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as p}from"./HighlightToSingleTechnique.js";import{RenderRequestType as d}from"../../lib/basicInterfaces.js";import{Default3D as f}from"../../lib/DefaultVertexAttributeLocations.js";import{NoVertex as b}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as T}from"../../lib/VertexArrayObject.js";import{H as w}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as x,g as C}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as v}from"../../../../webgl/BufferObject.js";import{PixelFormat as _,TextureSamplingMode as j,FramebufferBit as H,Usage as P,TextureType as R,PrimitiveType as O,DataType as q}from"../../../../webgl/enums.js";import{ColorFormat as D}from"../../../../webgl/formats.js";import{Texture as I}from"../../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../../webgl/TextureDescriptor.js";let A=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHTS,this.consumes={required:[l.HIGHLIGHTS,"highlights"]},this._downsampleDrawParameters=new x,this._passParameters=new m,this._highlightBlurDrawParameters=new w,this._grid=new U}initialize(){this.addHandles([i((()=>this._updateOptionsTexture()),(()=>{}),s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new y(16,2);e.internalFormat=_.RGBA,e.samplingMode=j.NEAREST,this._passParameters.highlightOptionsTexture=new I(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(E(this.view.state.highlights)),this.requestRender(d.UPDATE)}precompile(){this.techniques.precompile(u),this.techniques.precompile(p),this.techniques.precompile(c),this.techniques.precompile(g)}render(e){const t=e.find((({name:e})=>e===l.HIGHLIGHTS)),{techniques:r,bindParameters:i,_passParameters:s,renderingContext:o}=this;if(!i.decorations)return t;const h=r.get(u);if(!h.compiled)return this.requestRender(d.UPDATE),t;const n=e.find((({name:e})=>"highlights"===e)).getTexture();s.highlightTexture=n;const a=()=>{this._gridUpdateResources(n);const e=this._gridComputeCoverage(h,n,i),{horizontalCellCount:t,verticalCellCount:r}=e;return s.horizontalCellCount=t,s.verticalCellCount=r,s.coverageTexture=e.coverage?.getTexture(),e},g=e=>{const t=e.verticalCellCount*e.horizontalCellCount;o.bindVAO(e.vao),o.drawElementsInstanced(O.TRIANGLES,6,q.UNSIGNED_BYTE,0,t)},{camera:c}=i,m=()=>{o.bindFramebuffer(t.fbo),o.setViewport4fv(c.fullViewport)};return this._renderHighlightPostprocess(n,a,g,m),s.highlightTexture=null,s.coverageTexture=null,t}_renderHighlightPostprocess(e,t,r,i){const{fboCache:s,techniques:o,bindParameters:h,_passParameters:l,renderingContext:a}=this,u=o.get(p),m=o.get(c),f=o.get(g);if(!f.compiled||!m.compiled||!u.compiled)return void this.requestRender(d.UPDATE);l.highlightTexture=e;const b=t(),{width:T,height:w}=e.descriptor;l.highlightTexture=e;const{camera:x}=h,{fullWidth:C,fullHeight:v,pixelRatio:_}=x,j=Math.ceil(C/_),P=Math.ceil(v/_),{_highlightBlurDrawParameters:R}=this,O=this.view.stage.renderView.renderer,{highlights:q}=h;for(let g=0;g<q.length;++g){const{name:e}=q[g];if(!O.hasHighlight(e))continue;l.highlightLevel=g,a.setClearColor(0,0,0,0);const t=s.acquire(T,w,"single highlight",D.RG8);a.bindFramebuffer(t.fbo),a.setViewport(0,0,T,w),a.clear(H.COLOR),a.bindTechnique(u,h,l),r(b),R.blurInput=t.getTexture(),n(R.blurSize,1/j,0);const o=s.acquire(j,P,"single highlight blur h",D.RG8);a.unbindTexture(o.fbo?.colorTexture),a.bindFramebuffer(o.fbo),a.setViewport(0,0,j,P),a.clear(H.COLOR),a.bindTechnique(m,h,l,R),r(b),t.release(),n(R.blurSize,0,1/P),l.highlightBlurTexture=o.getTexture(),i(),a.bindTechnique(f,h,l,R),r(b),o.release()}}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/C),t.verticalCellCount=Math.ceil(i/C),t.vao)return;const s=this.renderingContext,o=v.createIndex(s,P.STATIC_DRAW,L);t.vao=new T(s,f,new Map([["geometry",b]]),new Map([["geometry",v.createVertex(s,P.STATIC_DRAW)]]),o)}_gridComputeCoverage(e,t,r){const i=this.renderingContext,s=this._grid,o=t.descriptor,h=Math.ceil(o.width/C),n=Math.ceil(o.height/C);this._downsampleDrawParameters.input=t;const{highlights:l}=r;s.coverage?.release();const a=this.fboCache.acquire(h,n,"highlight coverage",l.length>B?D.RG8UI:D.R8UI);return s.coverage=a,i.bindFramebuffer(a.fbo),i.bindTechnique(e,r,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,h,n),i.screen.draw(),s}get test(){}};e([o()],A.prototype,"produces",void 0),e([o()],A.prototype,"consumes",void 0),A=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],A);class U{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function E(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let S=0;function G(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return S+++(t>=0?0:1)}const L=new Uint8Array([0,1,2,2,1,3]);function M(e,t,r,i,s,o=0){const{highlights:h}=i,l=h.length>1?t.acquire(r.width,r.height,"highlight mix",h.length>B?D.RG8UI:D.R8UI):null,{gl:a}=e;if(l){const t=e.getBoundFramebufferObject();e.bindFramebuffer(l.fbo),a.clearBufferuiv(a.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const g=l?.getTexture();i.highlightMixTexture=g,n(i.highlightMixOrigin,o,0),h.forEach(((t,h)=>{if(h>0){const t=I.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(g,t),e.setActiveTexture(t),a.copyTexSubImage2D(R.TEXTURE_2D,0,0,0,o,0,r.width,r.height),e.bindTexture(null,t)}e.clear(H.DEPTH),i.highlightLevel=h,s()})),i.highlightLevel=null,i.highlightMixTexture=null,l?.release()}const B=4;export{A as Highlight,B as maxHighlightsPerChannel,M as renderHighlightBuffer,G as trackHighlightOptions};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{ColorFormat as g}from"../../core/FBOCacheFormats.js";import{HighlightApplyTechnique as c}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as u}from"./HighlightBlurTechnique.js";import{HighlightDownsampleTechnique as m}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as p}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as d}from"./HighlightToSingleTechnique.js";import{RenderRequestType as f}from"../../lib/basicInterfaces.js";import{Default3D as T}from"../../lib/DefaultVertexAttributeLocations.js";import{NoVertex as b}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{H as x}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as C,g as v}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as _}from"../../../../webgl/BufferObject.js";import{PixelFormat as j,TextureSamplingMode as O,FramebufferBit as R,Usage as H,TextureType as P,PrimitiveType as q,DataType as D}from"../../../../webgl/enums.js";import{Texture as I}from"../../../../webgl/Texture.js";import{TextureDescriptor as U}from"../../../../webgl/TextureDescriptor.js";let y=class extends a{constructor(){super(...arguments),this.produces=l.HIGHLIGHTS,this.consumes={required:[l.HIGHLIGHTS,"highlights"]},this._downsampleDrawParameters=new C,this._passParameters=new p,this._highlightBlurDrawParameters=new x,this._grid=new A}initialize(){this.addHandles([i((()=>this._updateOptionsTexture()),(()=>{}),s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new U(16,2);e.internalFormat=j.RGBA,e.samplingMode=O.NEAREST,this._passParameters.highlightOptionsTexture=new I(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(E(this.view.state.highlights)),this.requestRender(f.UPDATE)}precompile(){this.techniques.precompile(m),this.techniques.precompile(d),this.techniques.precompile(u),this.techniques.precompile(c)}render(e){const t=e.find((({name:e})=>e===l.HIGHLIGHTS)),{techniques:r,bindParameters:i,_passParameters:s,renderingContext:o}=this;if(!i.decorations)return t;const h=r.get(m);if(!h.compiled)return this.requestRender(f.UPDATE),t;const n=e.find((({name:e})=>"highlights"===e)).getTexture();s.highlightTexture=n;const a=()=>{this._gridUpdateResources(n);const e=this._gridComputeCoverage(h,n,i),{horizontalCellCount:t,verticalCellCount:r}=e;return s.horizontalCellCount=t,s.verticalCellCount=r,s.coverageTexture=e.coverage?.getTexture(),e},g=e=>{const t=e.verticalCellCount*e.horizontalCellCount;o.bindVAO(e.vao),o.drawElementsInstanced(q.TRIANGLES,6,D.UNSIGNED_BYTE,0,t)},{camera:c}=i,u=()=>{o.bindFramebuffer(t.fbo),o.setViewport4fv(c.fullViewport)};return this._renderHighlightPostprocess(n,a,g,u),s.highlightTexture=null,s.coverageTexture=null,t}_renderHighlightPostprocess(e,t,r,i){const{fboCache:s,techniques:o,bindParameters:h,_passParameters:l,renderingContext:a}=this,m=o.get(d),p=o.get(u),T=o.get(c);if(!T.compiled||!p.compiled||!m.compiled)return void this.requestRender(f.UPDATE);l.highlightTexture=e;const b=t(),{width:w,height:x}=e.descriptor;l.highlightTexture=e;const{camera:C}=h,{fullWidth:v,fullHeight:_,pixelRatio:j}=C,O=Math.ceil(v/j),H=Math.ceil(_/j),{_highlightBlurDrawParameters:P}=this,q=this.view.stage.renderView.renderer,{highlights:D}=h;for(let c=0;c<D.length;++c){const{name:e}=D[c];if(!q.hasHighlight(e))continue;l.highlightLevel=c,a.setClearColor(0,0,0,0);const t=s.acquire(w,x,"single highlight",g.RG8UNORM);a.bindFramebuffer(t.fbo),a.setViewport(0,0,w,x),a.clear(R.COLOR),a.bindTechnique(m,h,l),r(b),P.blurInput=t.getTexture(),n(P.blurSize,1/O,0);const o=s.acquire(O,H,"single highlight blur h",g.RG8UNORM);a.unbindTexture(o.fbo?.colorTexture),a.bindFramebuffer(o.fbo),a.setViewport(0,0,O,H),a.clear(R.COLOR),a.bindTechnique(p,h,l,P),r(b),t.release(),n(P.blurSize,0,1/H),l.highlightBlurTexture=o.getTexture(),i(),a.bindTechnique(T,h,l,P),r(b),o.release()}}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/v),t.verticalCellCount=Math.ceil(i/v),t.vao)return;const s=this.renderingContext,o=_.createIndex(s,H.STATIC_DRAW,L);t.vao=new w(s,T,new Map([["geometry",b]]),new Map([["geometry",_.createVertex(s,H.STATIC_DRAW)]]),o)}_gridComputeCoverage(e,t,r){const i=this.renderingContext,s=this._grid,o=t.descriptor,h=Math.ceil(o.width/v),n=Math.ceil(o.height/v);this._downsampleDrawParameters.input=t;const{highlights:l}=r;s.coverage?.release();const a=this.fboCache.acquire(h,n,"highlight coverage",l.length>B?g.RG8UINT:g.R8UINT);return s.coverage=a,i.bindFramebuffer(a.fbo),i.bindTechnique(e,r,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,h,n),i.screen.draw(),s}get test(){}};e([o()],y.prototype,"produces",void 0),e([o()],y.prototype,"consumes",void 0),y=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],y);class A{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function E(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let S=0;function G(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return S+++(t>=0?0:1)}const L=new Uint8Array([0,1,2,2,1,3]);function M(e,t,r,i,s,o=0){const{highlights:h}=i,l=h.length>1?t.acquire(r.width,r.height,"highlight mix",h.length>B?g.RG8UINT:g.R8UINT):null,{gl:a}=e;if(l){const t=e.getBoundFramebufferObject();e.bindFramebuffer(l.fbo),a.clearBufferuiv(a.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const c=l?.getTexture();i.highlightMixTexture=c,n(i.highlightMixOrigin,o,0),h.forEach(((t,h)=>{if(h>0){const t=I.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(c,t),e.setActiveTexture(t),a.copyTexSubImage2D(P.TEXTURE_2D,0,0,0,o,0,r.width,r.height),e.bindTexture(null,t)}e.clear(R.DEPTH),i.highlightLevel=h,s()})),i.highlightLevel=null,i.highlightMixTexture=null,l?.release()}const B=4;export{y as Highlight,B as maxHighlightsPerChannel,M as renderHighlightBuffer,G as trackHighlightOptions};