@arcgis/core 5.2.0-next.42 → 5.2.0-next.44

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 (182) hide show
  1. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0115681a3de6df0aebdf.js +1 -0
  4. package/assets/esri/core/workers/chunks/025caafc70ac26f0a4ed.js +1 -0
  5. package/assets/esri/core/workers/chunks/{d66d58ed5d66520ab1bf.js → 04a167c110fb7811169d.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{72fe7fb03c156f26a589.js → 08e18fb12533fc76e49c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{2e79fb1b8445b2091cdb.js → 0a0732ba8271d7dc985c.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{e6b5c015205d38abe037.js → 127b111ee53e4b9184f8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{2d7cfc68a38dabd8898a.js → 176c5eaaa23a479c88e0.js} +1 -1
  10. package/assets/esri/core/workers/chunks/1d1f5578c7d8619f7a46.js +1 -0
  11. package/assets/esri/core/workers/chunks/268637fd6c50264acfc3.js +1 -0
  12. package/assets/esri/core/workers/chunks/296fa9fb80e521c30cb1.js +1 -0
  13. package/assets/esri/core/workers/chunks/{c50e4e8c6188e64e7d45.js → 2974cddb0b0f67df7d2d.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{e9511627418c6864148a.js → 305ee2dd597c48a38e64.js} +1 -1
  15. package/assets/esri/core/workers/chunks/3252da57b800356116af.js +1 -0
  16. package/assets/esri/core/workers/chunks/{fd47ee8598e37fea03fe.js → 384b619854ef8a3f6e94.js} +1 -1
  17. package/assets/esri/core/workers/chunks/3af923abeb6e65c4468f.js +1 -0
  18. package/assets/esri/core/workers/chunks/3f4f1595c8a77d072b04.js +1 -0
  19. package/assets/esri/core/workers/chunks/4f09f208ece2ec1db727.js +1 -0
  20. package/assets/esri/core/workers/chunks/{67468c50ecb1fbedda87.js → 549295a5db9bf1536491.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{284e88805184334396fe.js → 57374213084bef59b776.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{2a8d791aef3123e6a3c4.js → 57970d43cdcc5cf57a30.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{dedf678490572c500a19.js → 5b937c405788fd14be8b.js} +2 -2
  24. package/assets/esri/core/workers/chunks/5f9c4dad6952c4c58ebf.js +1 -0
  25. package/assets/esri/core/workers/chunks/706230b70a36d2e038f7.js +1 -0
  26. package/assets/esri/core/workers/chunks/76713b700e053f8bad29.js +1 -0
  27. package/assets/esri/core/workers/chunks/{90ace5f9b4af1beea6bf.js → 7b6b8d0673976c6c26de.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{321dbc60f44819c2b4de.js → 81d55594cee124040565.js} +1 -1
  29. package/assets/esri/core/workers/chunks/8a01fe8d78ca85ea4784.js +1 -0
  30. package/assets/esri/core/workers/chunks/9114a575b78a7ea18d0f.js +1 -0
  31. package/assets/esri/core/workers/chunks/93e705c1147cc8ceca02.js +1 -0
  32. package/assets/esri/core/workers/chunks/{d082de5dd83bd73d209b.js → 94cebc34e49da1e295ed.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{34fcb776e4de1d870bbd.js → a38a7e3a5aa9294ab918.js} +2 -2
  34. package/assets/esri/core/workers/chunks/a8033e606b2db1ee332d.js +1 -0
  35. package/assets/esri/core/workers/chunks/{6f408397e2c8a2ea9805.js → aea247138617e12b699b.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{26e7884d8639df4d994b.js → b03dcf3d55266745f3d1.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{f1d3cf674b6bea89e122.js → b3cefc1895bfd62fc440.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{ec1a2e68957fae48e60b.js → b75db3b1becf8265ec59.js} +3 -3
  39. package/assets/esri/core/workers/chunks/{82f4aa0533db009b11d8.js → bac4d4a9f3a9b7f6864d.js} +2 -2
  40. package/assets/esri/core/workers/chunks/{2f29f08cddd5add9388e.js → c01a121ebe571a848452.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{c1845682cc9a5aac8703.js → c316234837b7ca406b1c.js} +3 -3
  42. package/assets/esri/core/workers/chunks/c3cd38ca8690286d40d7.js +1 -0
  43. package/assets/esri/core/workers/chunks/c6042825f61cd70d54d8.js +1 -0
  44. package/assets/esri/core/workers/chunks/{0646524250bb9fe82935.js → d8b67ca02cdc1e8191e3.js} +1 -1
  45. package/assets/esri/core/workers/chunks/db416ba3132034e20642.js +1 -0
  46. package/assets/esri/core/workers/chunks/{590e977f8eeb379b86c8.js → e5c19e9b6fa53abdca8c.js} +21 -27
  47. package/assets/esri/core/workers/chunks/f9b2727b41943d83d4ca.js +1 -0
  48. package/assets/esri/core/workers/chunks/{934044f2ef6ce199b399.js → fc880b275f5eaf42171e.js} +1 -1
  49. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  50. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  51. package/chunks/Component.glsl.js +2 -2
  52. package/chunks/CutFillTargetDepth.glsl.js +1 -2
  53. package/chunks/Fog.glsl.js +3 -3
  54. package/chunks/GlobalIllumination.glsl.js +21 -21
  55. package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
  56. package/chunks/GlowComposition.glsl.js +3 -3
  57. package/chunks/OITAddEmission.glsl.js +1 -1
  58. package/chunks/Path.glsl.js +4 -4
  59. package/chunks/Terrain.glsl.js +2 -2
  60. package/chunks/basis_encoder.js +1 -1
  61. package/chunks/dxt_encoder.js +1 -1
  62. package/config.js +1 -1
  63. package/geometry/support/aaBoundingBox.js +1 -1
  64. package/geometry/support/frustum.js +1 -1
  65. package/kernel.js +1 -1
  66. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  67. package/package.json +2 -2
  68. package/support/revision.js +1 -1
  69. package/third-party-notices.txt +156 -0
  70. package/views/2d/engine/webgl/Painter.js +1 -1
  71. package/views/2d/engine/webgl/RenderingDevice.js +1 -1
  72. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  73. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
  74. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  75. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
  76. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  77. package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +1 -1
  78. package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +1 -1
  79. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  81. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
  82. package/views/2d/engine/webgl/shaderGraph/techniques/utility/BitBlitTechnique.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/utility/HighlightTechnique.js +1 -1
  84. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  85. package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
  86. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  87. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  88. package/views/2d/webglDeps.js +1 -1
  89. package/views/3d/analysis/LineOfSight/LineOfSightAggregateManipulatedObject3D.js +1 -1
  90. package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
  91. package/views/3d/analysis/LineOfSight/LineOfSightDrawToolRenderer.js +1 -1
  92. package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
  93. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  94. package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
  95. package/views/3d/input/SceneInputManager.js +1 -1
  96. package/views/3d/layers/I3SMeshView3D.js +1 -1
  97. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  98. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  99. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  100. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  101. package/views/3d/terrain/GeometryState.js +1 -1
  102. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  103. package/views/3d/terrain/PatchRenderData.js +1 -1
  104. package/views/3d/terrain/TerrainSurface.js +1 -1
  105. package/views/3d/terrain/Tile.js +1 -1
  106. package/views/3d/terrain/TileAgent.js +1 -1
  107. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  108. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  109. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  110. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  111. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  112. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  113. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  114. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +1 -1
  115. package/views/3d/webgl-engine/collections/Component/Transform.js +1 -1
  116. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
  117. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +4 -4
  118. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +4 -10
  119. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  120. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  121. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  122. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +1 -1
  123. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  124. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  125. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  126. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  127. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  128. package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +1 -1
  129. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  130. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +1 -1
  131. package/views/3d/webgl-engine/effects/transparency/OITAddEmission.glsl.js +1 -1
  132. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  133. package/views/3d/webgl-engine/effects/transparency/OITBlendFragmentTechniqueConfiguration.js +1 -1
  134. package/views/3d/webgl-engine/effects/transparency/oitBlendFragment.glsl.js +1 -1
  135. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  136. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  137. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  138. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  139. package/views/3d/webgl-engine/shaders/CutFillTargetDepth.glsl.js +1 -1
  140. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechniqueConfiguration.js +1 -1
  141. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +2 -2
  142. package/views/3d/webgl-engine/shaders/{oitResolution.glsl.js → floatBlendScale.glsl.js} +1 -1
  143. package/views/GroundView.js +1 -1
  144. package/views/input/BrowserEventSource.js +1 -1
  145. package/views/input/InputManager.js +1 -1
  146. package/views/support/LayerViewManager.js +1 -1
  147. package/views/support/TextureCompressionWorker.js +1 -1
  148. package/views/support/imageReprojection.js +1 -1
  149. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  150. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  151. package/widgets/BatchAttributeForm.js +1 -1
  152. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  153. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  154. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  155. package/widgets/Sketch/SketchViewModel.js +1 -1
  156. package/widgets/support/dateUtils.js +1 -1
  157. package/assets/esri/core/workers/chunks/0d6afba80d2f8dcb5cf7.js +0 -1
  158. package/assets/esri/core/workers/chunks/1276df03201c1b855fee.js +0 -1
  159. package/assets/esri/core/workers/chunks/18d874739ee9ffad7480.js +0 -1
  160. package/assets/esri/core/workers/chunks/23570397304969f724b3.js +0 -1
  161. package/assets/esri/core/workers/chunks/474ea8c97d101e41b3f5.js +0 -1
  162. package/assets/esri/core/workers/chunks/551d0c5432f7a08dea77.js +0 -1
  163. package/assets/esri/core/workers/chunks/5923ebadd4f75be2c9cc.js +0 -1
  164. package/assets/esri/core/workers/chunks/7cb0681cc6a5e956cb15.js +0 -1
  165. package/assets/esri/core/workers/chunks/8b73694d5a97638a3a61.js +0 -1
  166. package/assets/esri/core/workers/chunks/8dee03779b569f233daf.js +0 -1
  167. package/assets/esri/core/workers/chunks/9ebc98746b1f085b82b7.js +0 -1
  168. package/assets/esri/core/workers/chunks/9ee3741eef73f3edb18b.js +0 -1
  169. package/assets/esri/core/workers/chunks/af97e19516dbbcfb5286.js +0 -1
  170. package/assets/esri/core/workers/chunks/b4047333265a2665aef9.js +0 -1
  171. package/assets/esri/core/workers/chunks/c3fae4f4522604a9c17e.js +0 -1
  172. package/assets/esri/core/workers/chunks/cce83896093279c70449.js +0 -1
  173. package/assets/esri/core/workers/chunks/d5561dff043789494845.js +0 -1
  174. package/assets/esri/core/workers/chunks/e2c9393bec747f7876bb.js +0 -1
  175. package/assets/esri/core/workers/chunks/e94f2d6037fba042dc6e.js +0 -1
  176. package/assets/esri/core/workers/chunks/f5d7f69047e1b1116202.js +0 -1
  177. package/views/2d/engine/webgl/MaterialManager.js +0 -2
  178. package/views/2d/engine/webgl/shaders/MaterialPrograms.js +0 -2
  179. package/views/2d/engine/webgl/shaders/sources/resolver.js +0 -2
  180. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +0 -2
  181. package/views/webgl/ShaderCompiler.js +0 -2
  182. /package/assets/esri/core/workers/chunks/{82f4aa0533db009b11d8.js.LICENSE.txt → bac4d4a9f3a9b7f6864d.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as o}from"../../../webgl.js";import n from"../../../webgl/RenderNode.js";import{G as m}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as u}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as h}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as c}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as _}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as p}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as d}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as b,ColorAttachment1 as f}from"../../../../webgl/enums.js";const g=1;let I=class extends n{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=o.AMBIENT_ILLUMINATION,this._passParameters=new m,this._drawParameters=new u,this._drawParametersUpscale=new p,this._maxFrames=256,this._lowQualityResolutionScale=.25,this._configuration=new _,this._globalIllumination=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(a(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._resetAccumulatedFrames(),this._requestRender()},r))}destroy(){this._globalIllumination=t(this._globalIllumination)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||this._resetAccumulatedFrames()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._globalIllumination?.retain(),this._globalIllumination;const t=e.find(({name:e})=>"normals"===e),a=t?.getTexture(),r=t?.getTexture(b),s=this._mode;if(!a||!r)return this._emptyOutput;if(0===s)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this._requestRender(),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=!!i.reprojection.lastFrameEmission;const n=this.techniques.getCompiled(c,this._configuration),m=this.techniques.getCompiled(h),u=1===s,_=u?this._lowQualityResolutionScale:1,p=u?this.techniques.getCompiled(d):null;if(!n||!m||u&&!p)return this._requestRender(),this._emptyOutput;const I=this.renderingContext,{camera:w}=i;this._passParameters.normalTexture=a,this._passParameters.depthTexture=r,this._passParameters.projScale=1/w.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=_;const{fullWidth:P,fullHeight:x}=w,F=Math.max(1,Math.floor(P*_)),T=Math.max(1,Math.floor(x*_)),q=this.fboCache.acquire(F,T,"global illumination input").acquireColor(f,0);I.bindFramebuffer(q.fbo),I.setViewport(0,0,F,T),I.bindTechnique(n,i,this._passParameters,this._drawParameters),I.screen.draw();const G=q.obtainAttachment(f),C=Math.max(1,Math.round(F/g)),j=Math.max(1,Math.round(T/g)),y=this.fboCache.acquire(C,j,"global illumination blur horizontal");I.bindFramebuffer(y.fbo),this._drawParameters.texture=q.getTexture(),this._drawParameters.weightTexture=G.attachment,l(this._drawParameters.blurSize,0,g/T),I.bindTechnique(m,i,this._passParameters,this._drawParameters),I.setViewport(0,0,C,j),I.screen.draw(),q.release();const A=u?"global illumination blur vertical":o.AMBIENT_ILLUMINATION,M=this.fboCache.acquire(C,j,A);I.bindFramebuffer(M.fbo),I.setViewport(0,0,C,j),I.setClearColor(1,1,1,0),I.clear(16384),this._drawParameters.texture=y.getTexture(),this._drawParameters.weightTexture=G.attachment,l(this._drawParameters.blurSize,g/C,0),I.bindTechnique(m,i,this._passParameters,this._drawParameters),I.setViewport(0,0,C,j),I.screen.draw(),y.release(),M.attachColor(G,f),G.release();let R=M;return p&&(R=this.fboCache.acquire(P,x,o.AMBIENT_ILLUMINATION).acquireColor(f,0),I.bindFramebuffer(R.fbo),I.setViewport(0,0,P,x),I.setClearColor(1,1,1,0),I.clear(16384),this._drawParametersUpscale.colorTexture=M.getTexture(),this._drawParametersUpscale.weightTexture=M.getTexture(f),I.bindTechnique(p,i,this._passParameters,this._drawParametersUpscale),I.screen.draw(),M.release()),I.setViewport4fv(w.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._cacheGlobalIllumination(R),this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),R}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_cacheGlobalIllumination(e){this._globalIllumination!==e&&(this._globalIllumination=t(this._globalIllumination),this._globalIllumination=e,this._globalIllumination.retain())}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:a}=this.bindParameters.camera,r=this.fboCache.acquire(t,a,o.AMBIENT_ILLUMINATION).acquireColor(f,0);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,a),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),r}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:a}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!a||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}_resetAccumulatedFrames(){this._passParameters.accumulatedFrames=0,this._globalIllumination=t(this._globalIllumination)}get test(){const e=this;return{passParameters:this._passParameters,configuration:this._configuration,get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},get mode(){return e._mode},restartAccumulation:()=>{this._resetAccumulatedFrames(),this._passParameters.temporalSampleFrame=0,this._resetBuffer=!0,this._requestRender()}}}};e([s()],I.prototype,"consumes",void 0),e([s()],I.prototype,"produces",void 0),I=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],I);export{I as GlobalIllumination,g as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as o}from"../../../webgl.js";import n from"../../../webgl/RenderNode.js";import{G as m}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as u}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as h}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as c}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as _}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as p}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as d}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as b,ColorAttachment1 as f}from"../../../../webgl/enums.js";const g=1;let I=class extends n{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=o.AMBIENT_ILLUMINATION,this._passParameters=new m,this._drawParameters=new u,this._drawParametersUpscale=new p,this._maxFrames=256,this._lowQualityResolutionScale=.25,this._configuration=new _,this._globalIllumination=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(a(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._resetAccumulatedFrames(),this._requestRender()},r))}destroy(){this._globalIllumination=t(this._globalIllumination)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||this._resetAccumulatedFrames()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._globalIllumination?.retain(),this._globalIllumination;const t=e.find(({name:e})=>"normals"===e),a=t?.getTexture(),r=t?.getTexture(b),s=this._mode;if(!a||!r)return this._emptyOutput;if(0===s)return this._resetBuffer=!1,this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this._requestRender(),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=!!i.reprojection.lastFrameEmission,this._configuration.useFloatBlend=i.useFloatBlend.value;const n=this.techniques.getCompiled(c,this._configuration),m=this.techniques.getCompiled(h),u=1===s,_=u?this._lowQualityResolutionScale:1,p=u?this.techniques.getCompiled(d):null;if(!n||!m||u&&!p)return this._requestRender(),this._emptyOutput;const I=this.renderingContext,{camera:w}=i;this._passParameters.normalTexture=a,this._passParameters.depthTexture=r,this._passParameters.projScale=1/w.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=_;const{fullWidth:P,fullHeight:x}=w,F=Math.max(1,Math.floor(P*_)),T=Math.max(1,Math.floor(x*_)),q=this.fboCache.acquire(F,T,"global illumination input").acquireColor(f,0);I.bindFramebuffer(q.fbo),I.setViewport(0,0,F,T),I.bindTechnique(n,i,this._passParameters,this._drawParameters),I.screen.draw();const G=q.obtainAttachment(f),C=Math.max(1,Math.round(F/g)),j=Math.max(1,Math.round(T/g)),y=this.fboCache.acquire(C,j,"global illumination blur horizontal");I.bindFramebuffer(y.fbo),this._drawParameters.texture=q.getTexture(),this._drawParameters.weightTexture=G.attachment,l(this._drawParameters.blurSize,0,g/T),I.bindTechnique(m,i,this._passParameters,this._drawParameters),I.setViewport(0,0,C,j),I.screen.draw(),q.release();const A=u?"global illumination blur vertical":o.AMBIENT_ILLUMINATION,M=this.fboCache.acquire(C,j,A);I.bindFramebuffer(M.fbo),I.setViewport(0,0,C,j),I.setClearColor(1,1,1,0),I.clear(16384),this._drawParameters.texture=y.getTexture(),this._drawParameters.weightTexture=G.attachment,l(this._drawParameters.blurSize,g/C,0),I.bindTechnique(m,i,this._passParameters,this._drawParameters),I.setViewport(0,0,C,j),I.screen.draw(),y.release(),M.attachColor(G,f),G.release();let R=M;return p&&(R=this.fboCache.acquire(P,x,o.AMBIENT_ILLUMINATION).acquireColor(f,0),I.bindFramebuffer(R.fbo),I.setViewport(0,0,P,x),I.setClearColor(1,1,1,0),I.clear(16384),this._drawParametersUpscale.colorTexture=M.getTexture(),this._drawParametersUpscale.weightTexture=M.getTexture(f),I.bindTechnique(p,i,this._passParameters,this._drawParametersUpscale),I.screen.draw(),M.release()),I.setViewport4fv(w.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._cacheGlobalIllumination(R),this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),R}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_cacheGlobalIllumination(e){this._globalIllumination!==e&&(this._globalIllumination=t(this._globalIllumination),this._globalIllumination=e,this._globalIllumination.retain())}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:a}=this.bindParameters.camera,r=this.fboCache.acquire(t,a,o.AMBIENT_ILLUMINATION).acquireColor(f,0);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,a),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),r}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:a}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!a||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}_resetAccumulatedFrames(){this._passParameters.accumulatedFrames=0,this._globalIllumination=t(this._globalIllumination)}get test(){const e=this;return{passParameters:this._passParameters,configuration:this._configuration,get maxFrames(){return e._maxFrames},set maxFrames(t){e._maxFrames=t},get lowQualityResolutionScale(){return e._lowQualityResolutionScale},set lowQualityResolutionScale(t){e._lowQualityResolutionScale=t},get mode(){return e._mode},restartAccumulation:()=>{this._resetAccumulatedFrames(),this._passParameters.temporalSampleFrame=0,this._resetBuffer=!0,this._requestRender()}}}};e([s()],I.prototype,"consumes",void 0),e([s()],I.prototype,"produces",void 0),I=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],I);export{I as GlobalIllumination,g as blurSizePixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/BooleanBindUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/ditherNoise.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationBlurDrawParameters,b as build}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";
2
+ import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/BooleanBindUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/ditherNoise.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationBlurDrawParameters,b as build}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as s}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as r}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{d as t,b as a}from"../../../../../chunks/GlobalIllumination.glsl.js";class i extends r{constructor(){super(...arguments),this.hasColor=!0,this.hasEmission=!1,this.rayMarchMaxReach=t,this.rayMarchMaxSteps=a,this.useProjectedRayLength=!0,this.clampRayToScreen=!1}}s([o()],i.prototype,"hasColor",void 0),s([o()],i.prototype,"hasEmission",void 0);export{i as GlobalIlluminationTechniqueConfiguration};
2
+ import{__decorate as s}from"tslib";import{parameter as o}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{d as r,b as a}from"../../../../../chunks/GlobalIllumination.glsl.js";import{FloatBlendScaleConfiguration as t}from"../../shaders/floatBlendScale.glsl.js";class e extends t{constructor(){super(...arguments),this.hasColor=!0,this.hasEmission=!1,this.rayMarchMaxReach=r,this.rayMarchMaxSteps=a,this.useProjectedRayLength=!0,this.clampRayToScreen=!1}}s([o()],e.prototype,"hasColor",void 0),s([o()],e.prototype,"hasEmission",void 0);export{e as GlobalIlluminationTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as v}from"../../../../webgl/enums.js";let T=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.9,.06,.03,.01,0,0],1),cartographicMin:new g([.58,.18,.12,.08,.04,0],1),cartographicDefault:new g([.99,.95,.75,.2,.1,.01],3),cartographicMax:new g([2.8,2.32,2.05,1.4,.4,.03],9)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositeConfiguration=new P,this._compositionParameters=new d,this._blurParameters=new u,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=l(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateConfigurations(){this._compositeConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositeConfiguration.blurEnabled=2!==this._mode}precompile(){this._updateConfigurations(),this._compositeConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositeConfiguration)}render(){const t=this.input,i=t.getAttachment(C);if(!i?.attachment)return t;const r=t.getTexture(),s=t.getAttachment(v),o=this.fboCache,{fullWidth:a,fullHeight:h}=this.bindParameters.camera,l=this.renderingContext;this._updateConfigurations();const c=this.camera,m=n(c.eye);if(this._compositionParameters.fogOpacity=this.view.stage.renderView.fog?.strength??0,this._compositionParameters.color=r,this._compositionParameters.emission=i.attachment,this._compositionParameters.atmosphereC=m**2-this._atmosphereRadius**2,!this._compositeConfiguration.blurEnabled){const t=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);this._setupFBO(t,a,h);const e=this.techniques.get(f,this._compositeConfiguration);return l.bindTechnique(e,this.bindParameters,this._compositionParameters),l.screen.draw(),t.attachDepth(s),t.attachColor(i,C),t}this._renderGlowMipMap();const u=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);u.acquireColor(C,this.bindParameters.useFloatBlend.value?8:5,"emissive"),this._setupFBO(u,a,h,!0);const p=this.techniques.get(f,this._compositeConfiguration);return l.bindTechnique(p,this.bindParameters,this._compositionParameters),l.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),u.attachDepth(s),u}_renderGlowMipMap(){const t=this.fboCache,{fullWidth:e,fullHeight:i}=this.camera,r=this.renderingContext,s=5,o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration);this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=w,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*e,.5*i);let h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]);const c=t.acquire(h,l,"glow horizontal",8);for(this._compositionParameters.lodTexture=t.acquire(h,l,"glow mipmap",9);h>1&&l>1&&this._blurParameters.level<s;)this._setupFBO(c,h,l),r.bindTechnique(o,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,c.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=c.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,h,l,!1,this._blurParameters.level),r.bindTechnique(n,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*h,.5*l),h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;c.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,h)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)}}}};t([s()],T.prototype,"consumes",void 0),t([s()],T.prototype,"produces",void 0),T=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],T);export{T as Glow};
2
+ import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as v}from"../../../../webgl/enums.js";let T=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.9,.06,.03,.01,0,0],1),cartographicMin:new g([.58,.18,.12,.08,.04,0],1),cartographicDefault:new g([.99,.95,.75,.2,.1,.01],3),cartographicMax:new g([2.8,2.32,2.05,1.4,.4,.03],9)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositeConfiguration=new P,this._compositionParameters=new d,this._blurParameters=new u,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=l(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateConfigurations(){this._compositeConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositeConfiguration.blurEnabled=2!==this._mode}precompile(){this._updateConfigurations(),this._compositeConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositeConfiguration)}render(){const t=this.input,i=t.getAttachment(C);if(!i?.attachment)return t;const r=t.getTexture(),s=t.getAttachment(v),o=this.fboCache,{fullWidth:a,fullHeight:h}=this.bindParameters.camera,l=this.renderingContext;this._updateConfigurations();const c=this.camera,m=n(c.eye);if(this._compositionParameters.fogOpacity=this.view.stage.renderView.fog?.strength??0,this._compositionParameters.color=r,this._compositionParameters.emission=i.attachment,this._compositionParameters.atmosphereC=m**2-this._atmosphereRadius**2,!this._compositeConfiguration.blurEnabled){const t=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);this._setupFBO(t,a,h);const e=this.techniques.get(f,this._compositeConfiguration);return l.bindTechnique(e,this.bindParameters,this._compositionParameters),l.screen.draw(),t.attachDepth(s),t.attachColor(i,C),t}this._renderGlowMipMap();const u=o.acquire(r.descriptor.width,r.descriptor.height,this.produces);u.acquireColor(C,this.bindParameters.useFloatBlend.value?8:5,"emissive"),this._setupFBO(u,a,h,!0);const p=this.techniques.get(f,this._compositeConfiguration);return l.bindTechnique(p,this.bindParameters,this._compositionParameters),l.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),u.attachDepth(s),u}_renderGlowMipMap(){const t=this.fboCache,{fullWidth:e,fullHeight:i}=this.camera,r=this.renderingContext,s=5,o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration);this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=w,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*e,.5*i);let h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]);const c=t.acquire(h,l,"glow horizontal",8);for(this._compositionParameters.lodTexture=t.acquire(h,l,"glow mipmap",9);h>1&&l>1&&this._blurParameters.level<s;)this._setupFBO(c,h,l),r.bindTechnique(o,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,c.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=c.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,h,l,!1,this._blurParameters.level),r.bindTechnique(n,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*h,.5*l),h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;c.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,h)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)}}}};t([s()],T.prototype,"consumes",void 0),t([s()],T.prototype,"produces",void 0),T=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],T);export{T as Glow};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{parameter as t}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{OITResolutionConfiguration as e}from"../../shaders/oitResolution.glsl.js";class r extends e{constructor(){super(...arguments),this.glowStage=0}}o([t({count:2})],r.prototype,"glowStage",void 0);export{r as GlowBlurTechniqueConfiguration};
2
+ import{__decorate as o}from"tslib";import{parameter as e}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{FloatBlendScaleConfiguration as r}from"../../shaders/floatBlendScale.glsl.js";class t extends r{constructor(){super(...arguments),this.glowStage=0}}o([e({count:2})],t.prototype,"glowStage",void 0);export{t as GlowBlurTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/arrayUtils.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/DistanceFalloff.glsl.js";import"../../shaders/ditherNoise.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{a as GlowCompositionPassParameters,G as GlowLodFactors,c as build,m as mixPreset}from"../../../../../chunks/GlowComposition.glsl.js";
2
+ import"../../../../../core/arrayUtils.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/DistanceFalloff.glsl.js";import"../../shaders/ditherNoise.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{a as GlowCompositionPassParameters,G as GlowLodFactors,c as build,m as mixPreset}from"../../../../../chunks/GlowComposition.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{parameter as r}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{OITResolutionConfiguration as e}from"../../shaders/oitResolution.glsl.js";class s extends e{constructor(){super(...arguments),this.blurEnabled=!1}}o([r()],s.prototype,"blurEnabled",void 0);export{s as GlowCompositionTechniqueConfiguration};
2
+ import{__decorate as r}from"tslib";import{parameter as e}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{FloatBlendScaleConfiguration as o}from"../../shaders/floatBlendScale.glsl.js";class s extends o{constructor(){super(...arguments),this.blurEnabled=!1}}r([e()],s.prototype,"blurEnabled",void 0);export{s as GlowCompositionTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/util/ColorConversion.glsl.js";import"../../core/shaderLibrary/util/emissionFilter.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./oitBlendFragment.glsl.js";import"../../shaders/oitResolution.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{O as OITAddEmissionPassParameters,b as build}from"../../../../../chunks/OITAddEmission.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/util/ColorConversion.glsl.js";import"../../core/shaderLibrary/util/emissionFilter.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./oitBlendFragment.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{O as OITAddEmissionPassParameters,b as build}from"../../../../../chunks/OITAddEmission.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{O as e}from"../../../../../chunks/OITAddEmission.glsl.js";import{OITAddEmissionTechnique as i}from"./OITAddEmissionTechnique.js";import{OITBlendFragmentTechniqueConfiguration as s}from"./OITBlendFragmentTechniqueConfiguration.js";import{OITBlendTechnique as t}from"./OITBlendTechnique.js";import{OITBlendTechniqueConfiguration as n}from"./OITBlendTechniqueConfiguration.js";import{OITFilterOpaqueTechnique as r}from"./OITFilterOpaqueTechnique.js";import{OITResolutionConfiguration as o}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as a,ColorAttachment2 as u,DrawBufferNone as h}from"../../../../webgl/enums.js";class f{constructor(i){this._techniques=i,this._parameters=new e,this._blendConfiguration=new n,this._filterOpaqueConfiguration=new s,this._addEmissionConfiguration=new o}precompile(e,s,n){this._updateConfigurations(e,s,n);const{hasTransparentEmission:o,hasOpaqueEmission:a}=e;a&&1!==n&&this._techniques.precompile(r,this._filterOpaqueConfiguration),this._techniques.precompile(t,this._blendConfiguration),o&&0===n&&this._techniques.precompile(i,this._addEmissionConfiguration)}blend(e,s,n,o,f,m,d){this._updateConfigurations(o,f,m),this._parameters.colorTexture=s.getTexture(),this._parameters.alphaTexture=s.getTexture(a),this._parameters.emissionTexture=s.getTexture(u),this._parameters.frontFaceTexture=n.getTexture(),this._parameters.frontFaceEmissionTexture=n.getTexture(a);const p=e.drawBuffers,{hasOpaqueEmission:c,hasTransparentEmission:l}=o;if(c&&1!==m){const i=this._techniques.get(r,this._filterOpaqueConfiguration);e.bindTechnique(i,o,this._parameters),e.setDrawBuffers([h,a]),e.screen.draw(),d?.("oit opaque emission filter",e.boundFramebuffer)}const _=this._techniques.get(t,this._blendConfiguration);if(e.bindTechnique(_,o,this._parameters),!c&&l){const i=p.slice();i[1]=h,e.setDrawBuffers(i),e.screen.draw()}else e.setDrawBuffers(p),e.screen.draw();if(d?.("oit composited",e.boundFramebuffer),l&&0===m){const s=this._techniques.get(i,this._addEmissionConfiguration);e.bindTechnique(s,o,this._parameters),e.setDrawBuffers([h,a]),e.screen.draw(),d?.("oit transparent emission",e.boundFramebuffer)}e.setDrawBuffers(p)}_updateConfigurations(e,i,s){this._blendConfiguration.useFloatBlend=this._filterOpaqueConfiguration.useFloatBlend=this._addEmissionConfiguration.useFloatBlend=e.useFloatBlend.value,this._blendConfiguration.computeHudOcclusion=i,this._blendConfiguration.hasOpaqueEmission=0===s&&e.hasOpaqueEmission,this._blendConfiguration.hasEmissionAttachment=0===s&&0!==e.emissions,this._blendConfiguration.frontFaceMask=1===s}}export{f as OITBlend};
2
+ import{O as e}from"../../../../../chunks/OITAddEmission.glsl.js";import{OITAddEmissionTechnique as i}from"./OITAddEmissionTechnique.js";import{OITBlendFragmentTechniqueConfiguration as s}from"./OITBlendFragmentTechniqueConfiguration.js";import{OITBlendTechnique as t}from"./OITBlendTechnique.js";import{OITBlendTechniqueConfiguration as n}from"./OITBlendTechniqueConfiguration.js";import{OITFilterOpaqueTechnique as r}from"./OITFilterOpaqueTechnique.js";import{FloatBlendScaleConfiguration as o}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as a,ColorAttachment2 as u,DrawBufferNone as h}from"../../../../webgl/enums.js";class f{constructor(i){this._techniques=i,this._parameters=new e,this._blendConfiguration=new n,this._filterOpaqueConfiguration=new s,this._addEmissionConfiguration=new o}precompile(e,s,n){this._updateConfigurations(e,s,n);const{hasTransparentEmission:o,hasOpaqueEmission:a}=e;a&&1!==n&&this._techniques.precompile(r,this._filterOpaqueConfiguration),this._techniques.precompile(t,this._blendConfiguration),o&&0===n&&this._techniques.precompile(i,this._addEmissionConfiguration)}blend(e,s,n,o,f,m,d){this._updateConfigurations(o,f,m),this._parameters.colorTexture=s.getTexture(),this._parameters.alphaTexture=s.getTexture(a),this._parameters.emissionTexture=s.getTexture(u),this._parameters.frontFaceTexture=n.getTexture(),this._parameters.frontFaceEmissionTexture=n.getTexture(a);const l=e.drawBuffers,{hasOpaqueEmission:p,hasTransparentEmission:c}=o;if(p&&1!==m){const i=this._techniques.get(r,this._filterOpaqueConfiguration);e.bindTechnique(i,o,this._parameters),e.setDrawBuffers([h,a]),e.screen.draw(),d?.("oit opaque emission filter",e.boundFramebuffer)}const _=this._techniques.get(t,this._blendConfiguration);if(e.bindTechnique(_,o,this._parameters),!p&&c){const i=l.slice();i[1]=h,e.setDrawBuffers(i),e.screen.draw()}else e.setDrawBuffers(l),e.screen.draw();if(d?.("oit composited",e.boundFramebuffer),c&&0===m){const s=this._techniques.get(i,this._addEmissionConfiguration);e.bindTechnique(s,o,this._parameters),e.setDrawBuffers([h,a]),e.screen.draw(),d?.("oit transparent emission",e.boundFramebuffer)}e.setDrawBuffers(l)}_updateConfigurations(e,i,s){this._blendConfiguration.useFloatBlend=this._filterOpaqueConfiguration.useFloatBlend=this._addEmissionConfiguration.useFloatBlend=e.useFloatBlend.value,this._blendConfiguration.computeHudOcclusion=i,this._blendConfiguration.hasOpaqueEmission=0===s&&e.hasOpaqueEmission,this._blendConfiguration.hasEmissionAttachment=0===s&&0!==e.emissions,this._blendConfiguration.frontFaceMask=1===s}}export{f as OITBlend};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{parameter as r}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{OITResolutionConfiguration as e}from"../../shaders/oitResolution.glsl.js";class s extends e{constructor(){super(...arguments),this.frontFaceMask=!1}}o([r()],s.prototype,"frontFaceMask",void 0);export{s as OITBlendFragmentTechniqueConfiguration};
2
+ import{__decorate as o}from"tslib";import{parameter as r}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{FloatBlendScaleConfiguration as e}from"../../shaders/floatBlendScale.glsl.js";class s extends e{constructor(){super(...arguments),this.frontFaceMask=!1}}o([r()],s.prototype,"frontFaceMask",void 0);export{s as OITBlendFragmentTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{If as e}from"../../core/shaderModules/glsl.js";import{Texture2DPassUniform as r}from"../../core/shaderModules/Texture2DPassUniform.js";import{alphaCutoff as t}from"../../shaders/alphaCutoff.glsl.js";import{oitResolution as o}from"../../shaders/oitResolution.glsl.js";import{NoParameters as n}from"../../../../webgl/NoParameters.js";class a extends n{}function l(n,a){const{frontFaceMask:l,useFloatBlend:c}=a;n.include(o,a),n.include(t),n.uniforms.add(new r("colorTexture",e=>e.colorTexture),new r("alphaTexture",e=>e.alphaTexture),new r("frontFaceTexture",e=>e.frontFaceTexture)).code.add(`\n vec4 oitBlendFragment(sampler2D colorTex, sampler2D frontFaceTex, float frontFaceScale) {\n float srcAlpha = texture(alphaTexture, uv).r * floatBlendInputScale;\n if(srcAlpha < alphaCutoff) {\n return vec4(0.0);\n }\n vec4 frontFace = texture(frontFaceTex, uv);\n ${e(l,"if (frontFace.a == 0.0) return vec4(0.0);")}\n\n vec4 srcColor = texture(colorTex, uv);\n srcColor.rgb *= floatBlendInputScale / srcAlpha;\n\n ${e(!c,"float frontWeight = srcAlpha * floatBlendOutputScale;\n frontWeight = clamp((frontWeight - 0.9) * 10.0, 0.0, 1.0);\n\n float toAlpha = (1.0 + frontFace.a) * 0.5;\n frontFace.a = mix(frontFace.a, toAlpha, frontWeight);")}\n return vec4(mix(srcColor.rgb, frontFace.rgb * frontFaceScale, frontFace.a), 1.0 - srcColor.a);\n }\n\n vec4 oitBlendFragment() {\n return oitBlendFragment(colorTexture, frontFaceTexture, 1.0);\n }\n `)}export{a as OITBlendFragmentPassParameters,l as oitBlendFragment};
2
+ import{If as e}from"../../core/shaderModules/glsl.js";import{Texture2DPassUniform as r}from"../../core/shaderModules/Texture2DPassUniform.js";import{alphaCutoff as t}from"../../shaders/alphaCutoff.glsl.js";import{floatBlendScale as o}from"../../shaders/floatBlendScale.glsl.js";import{NoParameters as n}from"../../../../webgl/NoParameters.js";class a extends n{}function l(n,a){const{frontFaceMask:l,useFloatBlend:c}=a;n.include(o,a),n.include(t),n.uniforms.add(new r("colorTexture",e=>e.colorTexture),new r("alphaTexture",e=>e.alphaTexture),new r("frontFaceTexture",e=>e.frontFaceTexture)).code.add(`\n vec4 oitBlendFragment(sampler2D colorTex, sampler2D frontFaceTex, float frontFaceScale) {\n float srcAlpha = texture(alphaTexture, uv).r * floatBlendInputScale;\n if(srcAlpha < alphaCutoff) {\n return vec4(0.0);\n }\n vec4 frontFace = texture(frontFaceTex, uv);\n ${e(l,"if (frontFace.a == 0.0) return vec4(0.0);")}\n\n vec4 srcColor = texture(colorTex, uv);\n srcColor.rgb *= floatBlendInputScale / srcAlpha;\n\n ${e(!c,"float frontWeight = srcAlpha * floatBlendOutputScale;\n frontWeight = clamp((frontWeight - 0.9) * 10.0, 0.0, 1.0);\n\n float toAlpha = (1.0 + frontFace.a) * 0.5;\n frontFace.a = mix(frontFace.a, toAlpha, frontWeight);")}\n return vec4(mix(srcColor.rgb, frontFace.rgb * frontFaceScale, frontFace.a), 1.0 - srcColor.a);\n }\n\n vec4 oitBlendFragment() {\n return oitBlendFragment(colorTexture, frontFaceTexture, 1.0);\n }\n `)}export{a as OITBlendFragmentPassParameters,l as oitBlendFragment};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{nextPowerOfTwo as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as r}from"../../../../core/maybe.js";import{property as s,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{ortho as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UNIT_X as d,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as p}from"../../webgl.js";import{Frustum as m}from"../../state/Frustum.js";import{glLayout as _}from"../../support/buffer/glUtil.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import f from"../../webgl/RenderCamera.js";import g from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as C}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as w}from"./VertexArrayObject.js";import{CutFillMinMaxDepthTechnique as x}from"../shaders/CutFillMinMaxDepthTechnique.js";import{C as T}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as P}from"../shaders/CutFillReductionTechnique.js";import{CutFillReductionTechniqueConfiguration as y}from"../shaders/CutFillReductionTechniqueConfiguration.js";import{C as R}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as b}from"../shaders/CutFillTargetDepthTechnique.js";import{C as F}from"../../../../chunks/CutFillTotalDepth.glsl.js";import{CutFillTotalDepthTechnique as B}from"../shaders/CutFillTotalDepthTechnique.js";import{ImmediateTask as j,TaskPriority as E}from"../../../support/Scheduler.js";import{Yield as D}from"../../../support/Yield.js";import{PrimitiveType as O,DataType as S}from"../../../webgl/enums.js";import{Sync as q}from"../../../webgl/Sync.js";import{VertexBuffer as v}from"../../../webgl/VertexBuffer.js";let V=class extends g{constructor(t){super(t),this.consumes={required:[p.CUTFILL_COMPUTATION,p.TRANSPARENT_NO_DEPTH]},this.produces=p.CUTFILL_COMPUTATION,this._targetDepthConfiguration=new C,this._reductionConfiguration=new y,this._targetDepthParameters=new R,this._depthParameters=new F,this._reductionParameters=new T,this.needsRender=!1,this.readyToRun=!1,this.done=!0,this._frameTask=j,this._result=new U,this._localOrigin=u(),this._maxTextureSize=512,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=14,this._colorFormat=11,this._numChannels=2,this._targetGeometryVao=null,this._numReductions=3,this._reductionPasses=0,this._pixelBufferSize=0,this._pixelBufferOffset=0,this._perReductionPixelBufferSize=0}initialize(){this._frameTask=this.view.resourceController.scheduler.registerTask(E.VOLUME_MEASUREMENT,this),this.addHandles(this._frameTask),this._targetDepthConfiguration.output=9,this._maxTextureSize=Math.min(this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._frustum=new m(this.view.renderCoordsHelper)}destroy(){this._targetGeometryVao=i(this._targetGeometryVao),this._sync=r(this._sync),this._pixelBuffer&&(this.gl.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0)}precompile(){this.view.stage.renderer.precompileCutFillOrthographicReferenceDepth()}render(){const t=this.input;if(!this._orthographicCamera||!this._targetGeometryVao||!this.needsRender||this._sync)return t;const e=this.techniques.getCompiled(b,this._targetDepthConfiguration),i=this.techniques.getCompiled(B),r=this.techniques.getCompiled(x);this._reductionConfiguration.reductionPass=0;const s=this.techniques.getCompiled(P,this._reductionConfiguration);this._reductionConfiguration.reductionPass=1;const h=this.techniques.getCompiled(P,this._reductionConfiguration);this._reductionConfiguration.reductionPass=2;const o=this.techniques.getCompiled(P,this._reductionConfiguration);if(!(e&&i&&r&&s&&h&&o))return this.requestRender(1),t;this.needsRender=!1;const n=this.renderingContext,a=this.fboCache,u=this.gl,p=n.getViewport(),m=a.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);n.bindFramebuffer(m.fbo),n.setViewport(0,0,this._width,this._height),n.clear(1280),this.view.stage.renderer.renderCutFillOrthographicReferenceDepth(this._orthographicCamera);const _=a.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);n.bindFramebuffer(_.fbo),n.setViewport(0,0,this._width,this._height),n.setClearDepth(1),n.clear(256),this._targetDepthParameters.origin=this._localOrigin,this._targetDepthParameters.cutFillCamera=this._orthographicCamera,n.bindTechnique(e,this.bindParameters,this._targetDepthParameters),n.bindVAO(this._targetGeometryVao),n.drawArrays(O.TRIANGLES,0,this._targetGeometryVao.vertexCount("geometry"));const l=a.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),f=a.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);return this._depthParameters.referenceDepth=m.depthTexture,this._depthParameters.targetDepth=_.depthTexture,this._pixelBuffer||(this._pixelBuffer=u.createBuffer()),u.bindBuffer(u.PIXEL_PACK_BUFFER,this._pixelBuffer),u.bufferData(u.PIXEL_PACK_BUFFER,this._pixelBufferSize,u.STREAM_READ),this._prepareFBO(l,this.width,this.height),n.bindTechnique(i,this.bindParameters,this._depthParameters),n.screen.draw(),this._runPyramidReduction(l,f,s),this._prepareFBO(l,this.width,this.height,d),n.bindTechnique(r,this.bindParameters,this._depthParameters),n.screen.draw(),this._runPyramidReduction(l,f,h),this._prepareFBO(l,this.width,this.height,c),n.bindTechnique(r,this.bindParameters,this._depthParameters),n.screen.draw(),this._runPyramidReduction(l,f,o),m.release(),_.release(),l.release(),f.release(),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),n.setViewport(p.x,p.y,p.width,p.height),this._sync=new q(u),setTimeout(()=>this.readyToRun=!0,0),t}update(t,i){if(!this.done)return;this.done=!1;const r=this.renderingContext,{cameraDimensions:{width:s,height:h},localOriginRenderSpace:o}=t,n=this._maxTextureSize,a=h/s,u=s>h?n:n/a,d=s>h?n*a:n;this._width=e(u),this._height=e(d);const c=[this._width,this._height];this._orthographicCamera=this._createCamera(t,c),this._frustum?.update(this._orthographicCamera),this._updateTargetVao(r,i),this._localOrigin=o,this._reductionPasses=Math.ceil(Math.log2(Math.min(this._width,this._height))),this._reducedWidth=Math.ceil(this._width/2**this._reductionPasses),this._reducedHeight=Math.ceil(this._height/2**this._reductionPasses),this._perReductionPixelBufferSize=this._reducedWidth*this._reducedHeight*this._numChannels*4,this._pixelBufferSize=this._perReductionPixelBufferSize*this._numReductions,this._pixelBufferOffset=0,this.needsRender=!0,this.requestRender(1)}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return D}catch(e){return this.readyToRun=!1,void(this._sync=r(this._sync))}this.readyToRun=!1,this._sync=r(this._sync);const t=this.gl;this._cpuBuffer=new Float32Array(this._pixelBufferSize/4),t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this._updateResults(this._cpuBuffer),this.done=!0}getResult(){return this._result}get frustum(){return this._frustum}get width(){return this._width}get height(){return this._height}get updating(){return this.readyToRun||!this.done||this._frameTask.updating}_runPyramidReduction(t,e,i){const r=this.renderingContext,s=this.gl;let h=this._width,o=this._height;for(let n=0;n<this._reductionPasses;n++)h=Math.ceil(h/2),o=Math.ceil(o/2),this._reductionParameters.depthTexture=t.getTexture(),this._prepareFBO(e,h,o),r.bindTechnique(i,this.bindParameters,this._reductionParameters),r.screen.draw(),[t,e]=[e,t];s.readPixels(0,0,h,o,33319,S.FLOAT,this._pixelBufferOffset),this._pixelBufferOffset+=this._perReductionPixelBufferSize}_updateResults(t){const e=new L(0,1,a()),i=new L(0,0,a());for(let r=0;r<this._reducedWidth;r++)for(let s=0;s<this._reducedHeight;s++){let h=(r+s*this._reducedWidth)*this._numChannels;const o=this._reducedWidth*this._reducedHeight*this._numChannels;e.totalDepth+=t[h],i.totalDepth+=t[h+1],h+=o;const n=t[h];n<e.depthExtremum&&(e.depthExtremum=n,M(e.depthExtremumCoords,t[h+1],this._width)),h+=o;const a=t[h];a>i.depthExtremum&&(i.depthExtremum=a,M(i.depthExtremumCoords,t[h+1],this._width))}this._result=new U(this._width,this._height,e,i)}_prepareFBO(t,e,i,r=c){const s=this.renderingContext;s.bindFramebuffer(t.fbo),s.setViewport(0,0,e,i),s.setClearColor(r[0],r[1],r[2],r[3]),s.clear(16384)}_createCamera(t,e){const{cameraPositionRenderSpace:i,localOriginRenderSpace:r,northVector:s,cameraDimensions:{width:h,height:n},cameraNearFar:{near:a,far:u}}=t,d=new f({eye:i,center:r,up:s,near:a,far:u});return d.viewport=[0,0,e[0],e[1]],o(d.projectionMatrix,-h/2,h/2,-n/2,n/2,a,u),d}_updateTargetVao(t,e){this._targetGeometryVao=i(this._targetGeometryVao);const r=e.indices.length,s=A.createBuffer(r),h=s.position,{positions:o,indices:n}=e;for(let i=0;i<n.length;++i){const t=3*n[i];h.set(i,0,o[t]),h.set(i,1,o[t+1]),h.set(i,2,o[t+2])}const a=new v(t,_(A),s.buffer);this._targetGeometryVao=new w(t,a)}};t([s()],V.prototype,"consumes",void 0),t([s()],V.prototype,"produces",void 0),t([s()],V.prototype,"needsRender",void 0),t([s()],V.prototype,"readyToRun",void 0),t([s()],V.prototype,"done",void 0),t([s()],V.prototype,"updating",null),t([s()],V.prototype,"_frameTask",void 0),V=t([h("esri.views.3d.webgl-engine.lib.CutFillComputation")],V);const A=l().vec3f("position").freeze();function M(t,e,i){const r=e%i,s=Math.floor(e/i);n(t,r,s)}class z{constructor(t,e){this.positions=t,this.indices=e}}class L{constructor(t,e,i){this.totalDepth=t,this.depthExtremum=e,this.depthExtremumCoords=i}}class U{constructor(t=0,e=0,i=new L(0,1,a()),r=new L(0,0,a())){this.width=t,this.height=e,this.cut=i,this.fill=r}}export{V as CutFillComputation,U as CutFillComputationResult,L as CutFillDepthResult,z as TargetGeometryRenderInfo};
2
+ import{__decorate as e}from"tslib";import{nextPowerOfTwo as t}from"../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as r}from"../../../../core/maybe.js";import{property as s,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{ortho as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UNIT_X as d,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as m}from"../../webgl.js";import{Frustum as l}from"../../state/Frustum.js";import{glLayout as _}from"../../support/buffer/glUtil.js";import{newLayout as p}from"../../support/buffer/InterleavedLayout.js";import f from"../../webgl/RenderCamera.js";import g from"../../webgl/RenderNode.js";import{VertexArrayObject as C}from"./VertexArrayObject.js";import{CutFillMinMaxDepthTechnique as w}from"../shaders/CutFillMinMaxDepthTechnique.js";import{C as x}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as T}from"../shaders/CutFillReductionTechnique.js";import{CutFillReductionTechniqueConfiguration as P}from"../shaders/CutFillReductionTechniqueConfiguration.js";import{C as R}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as y}from"../shaders/CutFillTargetDepthTechnique.js";import{C as b}from"../../../../chunks/CutFillTotalDepth.glsl.js";import{CutFillTotalDepthTechnique as F}from"../shaders/CutFillTotalDepthTechnique.js";import{ImmediateTask as B,TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";import{PrimitiveType as O,DataType as S}from"../../../webgl/enums.js";import{Sync as q}from"../../../webgl/Sync.js";import{VertexBuffer as D}from"../../../webgl/VertexBuffer.js";let v=class extends g{constructor(e){super(e),this.consumes={required:[m.CUTFILL_COMPUTATION,m.TRANSPARENT_NO_DEPTH]},this.produces=m.CUTFILL_COMPUTATION,this._reductionConfiguration=new P,this._targetDepthParameters=new R,this._depthParameters=new b,this._reductionParameters=new x,this.needsRender=!1,this.readyToRun=!1,this.done=!0,this._frameTask=B,this._result=new L,this._localOrigin=u(),this._maxTextureSize=512,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=14,this._colorFormat=11,this._numChannels=2,this._targetGeometryVao=null,this._numReductions=3,this._reductionPasses=0,this._pixelBufferSize=0,this._pixelBufferOffset=0,this._perReductionPixelBufferSize=0}initialize(){this._frameTask=this.view.resourceController.scheduler.registerTask(j.VOLUME_MEASUREMENT,this),this.addHandles(this._frameTask),this._maxTextureSize=Math.min(this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._frustum=new l(this.view.renderCoordsHelper)}destroy(){this._targetGeometryVao=i(this._targetGeometryVao),this._sync=r(this._sync),this._pixelBuffer&&(this.gl.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0)}precompile(){this.view.stage.renderer.precompileCutFillOrthographicReferenceDepth()}render(){const e=this.input;if(!this._orthographicCamera||!this._targetGeometryVao||!this.needsRender||this._sync)return e;const t=this.techniques.getCompiled(y),i=this.techniques.getCompiled(F),r=this.techniques.getCompiled(w);this._reductionConfiguration.reductionPass=0;const s=this.techniques.getCompiled(T,this._reductionConfiguration);this._reductionConfiguration.reductionPass=1;const h=this.techniques.getCompiled(T,this._reductionConfiguration);this._reductionConfiguration.reductionPass=2;const o=this.techniques.getCompiled(T,this._reductionConfiguration);if(!(t&&i&&r&&s&&h&&o))return this.requestRender(1),e;this.needsRender=!1;const n=this.renderingContext,a=this.fboCache,u=this.gl,m=n.getViewport(),l=a.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);n.bindFramebuffer(l.fbo),n.setViewport(0,0,this._width,this._height),n.clear(1280),this.view.stage.renderer.renderCutFillOrthographicReferenceDepth(this._orthographicCamera);const _=a.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);n.bindFramebuffer(_.fbo),n.setViewport(0,0,this._width,this._height),n.setClearDepth(1),n.clear(256),this._targetDepthParameters.origin=this._localOrigin,this._targetDepthParameters.cutFillCamera=this._orthographicCamera,n.bindTechnique(t,this.bindParameters,this._targetDepthParameters),n.bindVAO(this._targetGeometryVao),n.drawArrays(O.TRIANGLES,0,this._targetGeometryVao.vertexCount("geometry"));const p=a.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),f=a.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);return this._depthParameters.referenceDepth=l.depthTexture,this._depthParameters.targetDepth=_.depthTexture,this._pixelBuffer||(this._pixelBuffer=u.createBuffer()),u.bindBuffer(u.PIXEL_PACK_BUFFER,this._pixelBuffer),u.bufferData(u.PIXEL_PACK_BUFFER,this._pixelBufferSize,u.STREAM_READ),this._prepareFBO(p,this.width,this.height),n.bindTechnique(i,this.bindParameters,this._depthParameters),n.screen.draw(),this._runPyramidReduction(p,f,s),this._prepareFBO(p,this.width,this.height,d),n.bindTechnique(r,this.bindParameters,this._depthParameters),n.screen.draw(),this._runPyramidReduction(p,f,h),this._prepareFBO(p,this.width,this.height,c),n.bindTechnique(r,this.bindParameters,this._depthParameters),n.screen.draw(),this._runPyramidReduction(p,f,o),l.release(),_.release(),p.release(),f.release(),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),n.setViewport(m.x,m.y,m.width,m.height),this._sync=new q(u),setTimeout(()=>this.readyToRun=!0,0),e}update(e,i){if(!this.done)return;this.done=!1;const r=this.renderingContext,{cameraDimensions:{width:s,height:h},localOriginRenderSpace:o}=e,n=this._maxTextureSize,a=h/s,u=s>h?n:n/a,d=s>h?n*a:n;this._width=t(u),this._height=t(d);const c=[this._width,this._height];this._orthographicCamera=this._createCamera(e,c),this._frustum?.update(this._orthographicCamera),this._updateTargetVao(r,i),this._localOrigin=o,this._reductionPasses=Math.ceil(Math.log2(Math.min(this._width,this._height))),this._reducedWidth=Math.ceil(this._width/2**this._reductionPasses),this._reducedHeight=Math.ceil(this._height/2**this._reductionPasses),this._perReductionPixelBufferSize=this._reducedWidth*this._reducedHeight*this._numChannels*4,this._pixelBufferSize=this._perReductionPixelBufferSize*this._numReductions,this._pixelBufferOffset=0,this.needsRender=!0,this.requestRender(1)}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return E}catch(t){return this.readyToRun=!1,void(this._sync=r(this._sync))}this.readyToRun=!1,this._sync=r(this._sync);const e=this.gl;this._cpuBuffer=new Float32Array(this._pixelBufferSize/4),e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pixelBuffer),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._cpuBuffer),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),this._updateResults(this._cpuBuffer),this.done=!0}getResult(){return this._result}get frustum(){return this._frustum}get width(){return this._width}get height(){return this._height}get updating(){return this.readyToRun||!this.done||this._frameTask.updating}_runPyramidReduction(e,t,i){const r=this.renderingContext,s=this.gl;let h=this._width,o=this._height;for(let n=0;n<this._reductionPasses;n++)h=Math.ceil(h/2),o=Math.ceil(o/2),this._reductionParameters.depthTexture=e.getTexture(),this._prepareFBO(t,h,o),r.bindTechnique(i,this.bindParameters,this._reductionParameters),r.screen.draw(),[e,t]=[t,e];s.readPixels(0,0,h,o,33319,S.FLOAT,this._pixelBufferOffset),this._pixelBufferOffset+=this._perReductionPixelBufferSize}_updateResults(e){const t=new z(0,1,a()),i=new z(0,0,a());for(let r=0;r<this._reducedWidth;r++)for(let s=0;s<this._reducedHeight;s++){let h=(r+s*this._reducedWidth)*this._numChannels;const o=this._reducedWidth*this._reducedHeight*this._numChannels;t.totalDepth+=e[h],i.totalDepth+=e[h+1],h+=o;const n=e[h];n<t.depthExtremum&&(t.depthExtremum=n,A(t.depthExtremumCoords,e[h+1],this._width)),h+=o;const a=e[h];a>i.depthExtremum&&(i.depthExtremum=a,A(i.depthExtremumCoords,e[h+1],this._width))}this._result=new L(this._width,this._height,t,i)}_prepareFBO(e,t,i,r=c){const s=this.renderingContext;s.bindFramebuffer(e.fbo),s.setViewport(0,0,t,i),s.setClearColor(r[0],r[1],r[2],r[3]),s.clear(16384)}_createCamera(e,t){const{cameraPositionRenderSpace:i,localOriginRenderSpace:r,northVector:s,cameraDimensions:{width:h,height:n},cameraNearFar:{near:a,far:u}}=e,d=new f({eye:i,center:r,up:s,near:a,far:u});return d.viewport=[0,0,t[0],t[1]],o(d.projectionMatrix,-h/2,h/2,-n/2,n/2,a,u),d}_updateTargetVao(e,t){this._targetGeometryVao=i(this._targetGeometryVao);const r=t.indices.length,s=V.createBuffer(r),h=s.position,{positions:o,indices:n}=t;for(let i=0;i<n.length;++i){const e=3*n[i];h.set(i,0,o[e]),h.set(i,1,o[e+1]),h.set(i,2,o[e+2])}const a=new D(e,_(V),s.buffer);this._targetGeometryVao=new C(e,a)}};e([s()],v.prototype,"consumes",void 0),e([s()],v.prototype,"produces",void 0),e([s()],v.prototype,"needsRender",void 0),e([s()],v.prototype,"readyToRun",void 0),e([s()],v.prototype,"done",void 0),e([s()],v.prototype,"updating",null),e([s()],v.prototype,"_frameTask",void 0),v=e([h("esri.views.3d.webgl-engine.lib.CutFillComputation")],v);const V=p().vec3f("position").freeze();function A(e,t,i){const r=t%i,s=Math.floor(t/i);n(e,r,s)}class M{constructor(e,t){this.positions=e,this.indices=t}}class z{constructor(e,t,i){this.totalDepth=e,this.depthExtremum=t,this.depthExtremumCoords=i}}class L{constructor(e=0,t=0,i=new z(0,1,a()),r=new z(0,0,a())){this.width=e,this.height=t,this.cut=i,this.fill=r}}export{v as CutFillComputation,L as CutFillComputationResult,z as CutFillDepthResult,M as TargetGeometryRenderInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{nan as i,fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{newContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{MeshIntersectionOptions as a,intersectRayTriangles as o}from"./RayIntersections.js";const c=40,h=.8,d=10,m=1e-6;class l{constructor(e,i,r){this.globalTriangleVertexIndices=e,this.numTriangles=i,this.positions=r,this._rayDirection=n(),this._callback=I,this._intersectionOptions=M,this.bspNodeTree=new Array,this.triangleIndexMap=s(i);const a=x(e,i,r.data,r.stride),o=t(Math.log2(i/c),2,d),m=(t,e,n)=>{const i=u(this.triangleIndexMap,a,t,e),r=e-t;if(r<=c){const n=new g(i,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:s,midValue:d}=p(i),l=f(this.triangleIndexMap,a,t,e,s,d),x=(t,e)=>{if(n>o)return;const i=e-t;return i<c||i>=h*r?void 0:m(t,e,n+1)},y=new g(i,s,d,l.next,l.mid);return this.bspNodeTree.push(y),y.leftNode=x(t,l.next),y.rightNode=x(l.mid,e),y};m(0,i,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:i}=this.positions;o(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,i,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),l.numFacesTested+=e-t}intersectRay(t,e,n,i){l.numFacesTested=0;const r=t,s=e,a=s[0]-r[0],o=s[1]-r[1],c=s[2]-r[2];if(a*a+o*o+c*c<m)return;this._rayFrom=r;const h=this._rayDirection;h[0]=a,h[1]=o,h[2]=c;const d=this.triangleIndexMap.length;this._callback=i,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,d),this._callback=I,this._intersectionOptions=M}intersectRayBSP(t,e,n){const i=this._rayFrom,r=this._rayDirection,s=[{node:t,rangeStart:e,rangeEnd:n}];for(;s.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=s.pop();if(!y(t.aabb,i,r))continue;const a=t.axis,o=t.d;if(i[a]<o||r[a]<0){const n=e,i=t.midStartIndex;if(n<i){const e=t.leftNode;void 0!==e?s.push({node:e,rangeStart:n,rangeEnd:i}):this.intersectRayTriangleRange(n,i)}}if(this.intersectRayTriangleRange(t.midStartIndex,t.rightStartIndex),i[a]>o||r[a]>0){const e=t.rightStartIndex,i=n;if(e<i){const n=t.rightNode;void 0!==n?s.push({node:n,rangeStart:e,rangeEnd:i}):this.intersectRayTriangleRange(e,i)}}}}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class g{constructor(t,e,n,i,r){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=i,this.rightStartIndex=r}}function f(t,e,n,i,r,s){const a=r+3;let o=n,c=n,h=i;for(;c<h;){const n=t[c],i=6*n;e[i+a]<=s?(t[c]=t[o],t[o]=n,++o,++c):e[i+r]>=s?(--h,t[c]=t[h],t[h]=n):++c}return{next:o,mid:h}}function u(t,e,n,s){if(s<=n)return i;let a=6*t[n],o=e[a++],c=e[a++],h=e[a++],d=e[a++],m=e[a++],l=e[a];for(let i=n+1;i<s;++i)a=6*t[i],o=Math.min(o,e[a++]),c=Math.min(c,e[a++]),h=Math.min(h,e[a++]),d=Math.max(d,e[a++]),m=Math.max(m,e[a++]),l=Math.max(l,e[a]);return r(o,c,h,d,m,l)}function p(t){const e=t[3]-t[0],n=t[4]-t[1],i=t[5]-t[2],r=e>n?e>i?0:n>i?1:2:n>i?1:i>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function x(t,e,n,i){const r=new Float64Array(6*e);for(let s=0;s<e;++s){const e=3*s,a=t[e]*i,o=t[e+1]*i,c=t[e+2]*i;for(let t=0;t<3;++t){const e=n[a+t],i=n[o+t],h=n[c+t];r[6*s+t]=Math.min(e,i,h),r[6*s+3+t]=Math.max(e,i,h)}}return r}function y(t,e,n){const i=e,r=n;let s=0,a=1/0;for(let o=0;o<3;++o){{const e=t[o];if(i[o]<e){if(r[o]<=m)return!1;const t=(e-i[o])/r[o];s=Math.max(s,t)}else if(r[o]<=-m){const t=(e-i[o])/r[o];a=Math.min(a,t)}if(s>a)return!1}{const e=t[o+3];if(i[o]>e){if(r[o]>=-m)return!1;const t=(e-i[o])/r[o];s=Math.max(s,t)}else if(r[o]>=m){const t=(e-i[o])/r[o];a=Math.min(a,t)}if(s>a)return!1}}return!0}const M=new a,I=()=>{};export{l as TriangleIntersectionData};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,copy as r,nan as i,fromValues as o}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as a}from"../../../../geometry/support/frustum.js";import{newContinuousIndexArray as c}from"../../../../geometry/support/Indices.js";import{MeshIntersectionOptions as l,intersectRayTriangles as h}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as g}from"./screenPolygonTriangleIntersections.js";const m=40,d=.8,u=10,y=1e-6;class _{constructor(e,s,r){this.globalTriangleVertexIndices=e,this.numTriangles=s,this.positions=r,this._rayDirection=n(),this._callback=T,this._intersectionOptions=S,this._screenPolygonCallback=M,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=new Array,this.triangleIndexMap=c(s);const i=I(e,s,r.data,r.stride),o=t(Math.log2(s/m),2,u),a=(t,e,n)=>{const s=P(this.triangleIndexMap,i,t,e),r=e-t;if(r<=m){const n=new p(s,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:c,midValue:l}=x(s),h=f(this.triangleIndexMap,i,t,e,c,l),g=(t,e)=>{if(n>o)return;const s=e-t;return s<m||s>=d*r?void 0:a(t,e,n+1)},u=new p(s,c,l,h.next,h.mid);return this.bspNodeTree.push(u),u.leftNode=g(t,h.next),u.rightNode=g(h.mid,e),u};a(0,s,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:s}=this.positions;h(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,s,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),_.numFacesTested+=e-t}forEachScreenPolygonHit(t,e,n,s,r){null!=t.camera&&0!==this.bspNodeTree.length&&(this._screenPolygonIntersector=t,this._screenPolygonTransformation=e,this._screenPolygonQuery=n,this._screenPolygonDisplacement=s,this._screenPolygonCallback=r,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=M,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(t,e,n,s){_.numFacesTested=0;const r=t,i=e,o=i[0]-r[0],a=i[1]-r[1],c=i[2]-r[2];if(o*o+a*a+c*c<y)return;this._rayFrom=r;const l=this._rayDirection;l[0]=o,l[1]=a,l[2]=c;const h=this.triangleIndexMap.length;this._callback=s,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,h),this._callback=T,this._intersectionOptions=S}intersectRayBSP(t,e,n){const s=this._rayFrom,r=this._rayDirection;this._traverseBSP(t,e,n,t=>b(t.aabb,s,r),t=>{const e=t.axis;return s[e]<t.d||r[e]<0},t=>{const e=t.axis;return s[e]>t.d||r[e]>0},(t,e)=>this.intersectRayTriangleRange(t,e))}_intersectScreenPolygonTriangleRange(t,e){if(t>=e)return;const n=this._screenPolygonIntersector,s=this._screenPolygonQuery;if(null!=n&&null!=s)for(const r of g(n,this._screenPolygonTransformation,s,t,e,this.globalTriangleVertexIndices,this.positions.data,this.positions.stride,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(r.distance,r.primitiveIndex,r.point)}_intersectScreenPolygonBSP(t,e,n){const s=this._screenPolygonIntersector,r=this._screenPolygonQuery;null!=s?.camera&&null!=r&&this._traverseBSP(t,e,n,t=>this._nodeIntersectsScreenPolygonBroadPhase(t.aabb),()=>!0,()=>!0,(t,e)=>this._intersectScreenPolygonTriangleRange(t,e))}_traverseBSP(t,e,n,s,r,i,o){const a=[{node:t,rangeStart:e,rangeEnd:n}];for(;a.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=a.pop();s(t)&&(r(t)&&this._traverseBSPRange(a,t.leftNode,e,t.midStartIndex,o),o(t.midStartIndex,t.rightStartIndex),i(t)&&this._traverseBSPRange(a,t.rightNode,t.rightStartIndex,n,o))}}_traverseBSPRange(t,e,n,s,r){n>=s||(void 0!==e?t.push({node:e,rangeStart:n,rangeEnd:s}):r(n,s))}_nodeIntersectsScreenPolygonBroadPhase(t){const e=this._screenPolygonQuery;if(null==e)return!1;const n=this._screenPolygonDisplacement,s=n?n.applyToAabb(r(B,t)):t;return a(e.broadPhaseFrustum,s,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class p{constructor(t,e,n,s,r){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=s,this.rightStartIndex=r}}function f(t,e,n,s,r,i){const o=r+3;let a=n,c=n,l=s;for(;c<l;){const n=t[c],s=6*n;e[s+o]<=i?(t[c]=t[a],t[a]=n,++a,++c):e[s+r]>=i?(--l,t[c]=t[l],t[l]=n):++c}return{next:a,mid:l}}function P(t,e,n,s){if(s<=n)return i;let r=6*t[n],a=e[r++],c=e[r++],l=e[r++],h=e[r++],g=e[r++],m=e[r];for(let i=n+1;i<s;++i)r=6*t[i],a=Math.min(a,e[r++]),c=Math.min(c,e[r++]),l=Math.min(l,e[r++]),h=Math.max(h,e[r++]),g=Math.max(g,e[r++]),m=Math.max(m,e[r]);return o(a,c,l,h,g,m)}function x(t){const e=t[3]-t[0],n=t[4]-t[1],s=t[5]-t[2],r=e>n?e>s?0:n>s?1:2:n>s?1:s>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function I(t,e,n,s){const r=new Float64Array(6*e);for(let i=0;i<e;++i){const e=3*i,o=t[e]*s,a=t[e+1]*s,c=t[e+2]*s;for(let t=0;t<3;++t){const e=n[o+t],s=n[a+t],l=n[c+t];r[6*i+t]=Math.min(e,s,l),r[6*i+3+t]=Math.max(e,s,l)}}return r}function b(t,e,n){const s=e,r=n;let i=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(s[a]<e){if(r[a]<=y)return!1;const t=(e-s[a])/r[a];i=Math.max(i,t)}else if(r[a]<=-y){const t=(e-s[a])/r[a];o=Math.min(o,t)}if(i>o)return!1}{const e=t[a+3];if(s[a]>e){if(r[a]>=-y)return!1;const t=(e-s[a])/r[a];i=Math.max(i,t)}else if(r[a]>=y){const t=(e-s[a])/r[a];o=Math.min(o,t)}if(i>o)return!1}}return!0}const S=new l,T=()=>{},M=()=>{},B=s();export{_ as TriangleIntersectionData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t,createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{transformMat4 as r,copy as e,distance as o,set as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as s,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as c,expandPointInPlace as f,clone as a,intersects as p,containsPoint as l,create as h,fromValues as m}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as d,create as g,distance2 as M}from"../../../../geometry/support/lineSegment.js";import{signedDistance as b,intersectLineSegment as j}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as x}from"../../../../geometry/support/triangle.js";class I{constructor(t,n,r){this.bounds=t,this.nearestDistance=n,this.nearestPoint=r}}function N(t,n){return t.isRectangle?l(t.bounds,n):V(n,t.points)}function T(t,n,r){const e=n[0]-r,o=n[1]-r,i=n[0]+r,s=n[1]+r;if(!p(t.bounds,m(e,o,i,s,z)))return!1;if(N(t,n))return!0;const u=r*r;for(const c of t.points){const t=c[0]-n[0],r=c[1]-n[1];if(t*t+r*r<=u)return!0}for(let c=0;c<t.points.length;c++){if(D(n,t.points[c],t.points[(c+1)%t.points.length])<=u)return!0}return!1}function S(t,n){if(!p(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(l(n,r))return!0;for(let r=0;r<4;r++)if(V(q(A,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const e=t.points[r],o=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(Y(e,o,q(A,n,t),q(G,n,(t+1)%4)))return!0}}return!1}function R(t,n,r,e){const o=Math.min(n[0],r[0],e[0]),i=Math.min(n[1],r[1],e[1]),s=Math.max(n[0],r[0],e[0]),u=Math.max(n[1],r[1],e[1]);if(!S(t,m(o,i,s,u,z)))return!1;if(N(t,n)||N(t,r)||N(t,e))return!0;for(const c of t.points)if(x(n,r,e,c,rt))return!0;for(let c=0;c<t.points.length;c++){const o=t.points[c],i=t.points[(c+1)%t.points.length];if(Y(n,r,o,i)||Y(r,e,o,i)||Y(e,n,o,i))return!0}return!1}function y(t,n,r,e){const o=Math.min(n[0],r[0])-e,i=Math.min(n[1],r[1])-e,s=Math.max(n[0],r[0])+e,u=Math.max(n[1],r[1])+e;if(!p(t.bounds,m(o,i,s,u,z)))return!1;if(N(t,n)||N(t,r))return!0;const c=e*e;for(const f of t.points)if(D(f,n,r)<=c)return!0;for(let f=0;f<t.points.length;f++){const e=t.points[f],o=t.points[(f+1)%t.points.length];if(Y(n,r,e,o)||B(n,r,e,o)<=c)return!0}return!1}function _(t,n,r){return v(t,n.bbMin,n.bbMax,r)}function v(t,n,o,i){const u=c(z);nt.reset(t.eye);let p=0;for(let s=0;s<2;s++)for(let c=0;c<2;c++)for(let a=0;a<2;a++)K[0]=0===s?n[0]:o[0],K[1]=0===c?n[1]:o[1],K[2]=0===a?n[2]:o[2],i&&r(K,K,i),e(Z[p++],K),P(t,K)||(t.projectToScreen(K,A),f(u,A),nt.addNearestCandidate(K));return C(t,u,Z,nt),nt.valid?new I(a(u),nt.distance,s(nt.point)):null}function C(t,n,r,e){for(let o=0;o<r.length;o++)for(const i of $){const s=o|i;if(s===o)continue;O(t,r[o],r[s],L)&&(t.projectToScreen(L,A),f(n,A),e.addNearestCandidate(L))}}function F(t,n,r,o,i){e(L,n),e(Q,r);const s=t.projectToRenderScreen(L,H),u=t.projectToRenderScreen(Q,J);if(null==s||null==u)return!1;const c=P(t,L),f=P(t,Q);if(c&&f)return!1;if(c!==f){const n=c?L:Q,r=c?s:u;if(!E(t,n,c?Q:L))return!1;if(!t.projectToRenderScreen(n,r))return!1}return o[0]=s[0],o[1]=s[1],o[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function P(t,n){return w(t,n)>0}function w(t,n){return b(t.frustum[4],n)}function E(t,n,r){return O(t,n,r,n)}function O(t,n,r,e){return j(t.frustum[4],d(n,r,X),e)}function V(t,n){let r=!1;for(let e=0,o=n.length-1;e<n.length;o=e++){const i=n[e],s=n[o];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function Y(t,n,r,e){const o=U(t,n,r),i=U(t,n,e),s=U(r,e,t),u=U(r,e,n);return o!==i&&s!==u||(0===o&&k(t,n,r)||0===i&&k(t,n,e)||0===s&&k(r,e,t)||0===u&&k(r,e,n))}function B(t,n,r,e){return Y(t,n,r,e)?0:Math.min(D(t,r,e),D(n,r,e),D(r,t,n),D(e,t,n))}function D(t,n,r){return M(d(i(L,n[0],n[1],0),i(Q,r[0],r[1],0),X),i(W,t[0],t[1],0))}function U(t,n,r){const e=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(e)<=rt?0:Math.sign(e)}function k(t,n,r){return r[0]>=Math.min(t[0],n[0])-rt&&r[0]<=Math.max(t[0],n[0])+rt&&r[1]>=Math.min(t[1],n[1])-rt&&r[1]<=Math.max(t[1],n[1])+rt}function q(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const z=h(),A=t(),G=t(),H=n(),J=n(),K=u(),L=u(),Q=u(),W=u(),X=g(),Z=[u(),u(),u(),u(),u(),u(),u(),u()],$=[1,2,4];class tt{constructor(){this._origin=u(),this.point=u(),this.distance=Number.POSITIVE_INFINITY}get valid(){return Number.isFinite(this.distance)}addNearestCandidate(t){const n=o(this._origin,t);n<this.distance&&(this.distance=n,e(this.point,t))}reset(t){this.distance=Number.POSITIVE_INFINITY,e(this._origin,t)}}const nt=new tt,rt=1e-9;export{I as ProjectedScreenBounds,P as isBehindNearPlane,v as projectAabbToScreenBounds,_ as projectBoundingInfoToScreenBounds,F as projectWorldLineSegmentToRenderScreen,N as screenPolygonContainsPoint,S as screenPolygonIntersectsBounds,y as screenPolygonIntersectsBufferedSegment,T as screenPolygonIntersectsCircle,R as screenPolygonIntersectsTriangle};
2
+ import{createRenderScreenPointArray3 as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{copy as r,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as i,fromValues as s,create as u,containsPoint as f}from"../../../../geometry/support/aaBoundingRect.js";import{distance2 as c,fromPoints as p,create as m}from"../../../../geometry/support/lineSegment.js";import{signedDistance as a,intersectLineSegment as l}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as h}from"../../../../geometry/support/triangle.js";function g(t,n){return t.isRectangle?f(t.bounds,n):v(n,t.points)}function M(t,n,r){const o=n[0]-r,e=n[1]-r,u=n[0]+r,f=n[1]+r;if(!i(t.bounds,s(o,e,u,f,A)))return!1;if(g(t,n))return!0;const c=r*r;for(const i of t.points){const t=i[0]-n[0],r=i[1]-n[1];if(t*t+r*r<=c)return!0}for(let i=0;i<t.points.length;i++){if(k(n,t.points[i],t.points[(i+1)%t.points.length])<=c)return!0}return!1}function j(t,n){if(!i(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(f(n,r))return!0;for(let r=0;r<4;r++)if(v(z(C,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const o=t.points[r],e=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(B(o,e,z(C,n,t),z(D,n,(t+1)%4)))return!0}}return!1}function x(t,n,r,o){const e=Math.min(n[0],r[0],o[0]),i=Math.min(n[1],r[1],o[1]),u=Math.max(n[0],r[0],o[0]),f=Math.max(n[1],r[1],o[1]);if(!j(t,s(e,i,u,f,A)))return!1;if(g(t,n)||g(t,r)||g(t,o))return!0;for(const s of t.points)if(h(n,r,o,s,K))return!0;for(let s=0;s<t.points.length;s++){const e=t.points[s],i=t.points[(s+1)%t.points.length];if(B(n,r,e,i)||B(r,o,e,i)||B(o,n,e,i))return!0}return!1}function d(t,n,r,o){const e=Math.min(n[0],r[0])-o,u=Math.min(n[1],r[1])-o,f=Math.max(n[0],r[0])+o,c=Math.max(n[1],r[1])+o;if(!i(t.bounds,s(e,u,f,c,A)))return!1;if(g(t,n)||g(t,r))return!0;const p=o*o;for(const i of t.points)if(k(i,n,r)<=p)return!0;for(let i=0;i<t.points.length;i++){const o=t.points[i],e=t.points[(i+1)%t.points.length];if(B(n,r,o,e)||U(n,r,o,e)<=p)return!0}return!1}function b(t,n,o,e,i){r(G,n),r(H,o);const s=t.projectToRenderScreen(G,E),u=t.projectToRenderScreen(H,F);if(null==s||null==u)return!1;const f=R(t,G),c=R(t,H);if(f&&c)return!1;if(f!==c){const n=f?G:H,r=f?s:u;if(!S(t,n,f?H:G))return!1;if(!t.projectToRenderScreen(n,r))return!1}return e[0]=s[0],e[1]=s[1],e[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function R(t,n){return y(t,n)>0}function y(t,n){return a(t.frustum[4],n)}function S(t,n,r){return T(t,n,r,n)}function T(t,n,r,o){return l(t.frustum[4],p(n,r,J),o)}function v(t,n){let r=!1;for(let o=0,e=n.length-1;o<n.length;e=o++){const i=n[o],s=n[e];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function B(t,n,r,o){const e=q(t,n,r),i=q(t,n,o),s=q(r,o,t),u=q(r,o,n);return e!==i&&s!==u||(0===e&&w(t,n,r)||0===i&&w(t,n,o)||0===s&&w(r,o,t)||0===u&&w(r,o,n))}function U(t,n,r,o){return B(t,n,r,o)?0:Math.min(k(t,r,o),k(n,r,o),k(r,t,n),k(o,t,n))}function k(t,n,r){return c(p(o(G,n[0],n[1],0),o(H,r[0],r[1],0),J),o(I,t[0],t[1],0))}function q(t,n,r){const o=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(o)<=K?0:Math.sign(o)}function w(t,n,r){return r[0]>=Math.min(t[0],n[0])-K&&r[0]<=Math.max(t[0],n[0])+K&&r[1]>=Math.min(t[1],n[1])-K&&r[1]<=Math.max(t[1],n[1])+K}function z(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const A=u(),C=n(),D=n(),E=t(),F=t(),G=e(),H=e(),I=e(),J=m(),K=1e-9;export{R as isBehindNearPlane,b as projectWorldLineSegmentToRenderScreen,g as screenPolygonContainsPoint,j as screenPolygonIntersectsBounds,d as screenPolygonIntersectsBufferedSegment,M as screenPolygonIntersectsCircle,x as screenPolygonIntersectsTriangle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,distance as n,squaredDistance as o,set as r,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as u,getMax as c,getMin as a,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as v}from"./screenPolygonOverlapUtils.js";class y{constructor(t){this.primitiveIndex=t}}class N{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function x(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new N(4);let s;if(t.boundingInfo)s=F(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=C(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,u){const c=new N(4);for(const a of C(t,e,n,o,r,i,s,l,u,null,0))c.updateIfCloser(a);return c.valid?c:null}function j(t,e,n,o,r){const i=new N(4);for(const s of P(t,e,n,o,r))i.updateIfCloser(s);return i.valid?i:null}function*C(t,e,n,o,r,i,s,l,u,c=null,a=0){const f=(t,n,o,r)=>{const f=(c?.[r]??r)+a,m=null==c?f:r,p=3*f;return V(t,i,s,l,p+0,u,m,e),V(n,i,s,l,p+1,u,m,e),V(o,i,s,l,p+2,u,m,e),f};return yield*P(t,n,o,r,f)}function*P(t,e,o,r,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let u=o;u<r;++u){const t=i(E[0],E[1],E[2],u),o=M;let r;k.reset();for(const{list:i,count:u}of l.processTriangle(q,E)){const l=m(s.frustum[4],i,u,Y,!1);if(!(l<3)){for(let t=0;t<l;t++)s.projectToScreen(Y[t],_[t]);w(e,_,l)&&(A(s.eye,Y,l,B),null==r&&(r=p(M,E[0],E[1],E[2])),k.updateIfCloserFromValues(n(s.eye,B),t,B,r?o:null))}}k.valid&&(yield k)}}function*F(t,e,n,o,r){const i=e.camera,s=null!=r?(l(O,t.bbMin),u(O,t.bbMax),r.applyToAabb(O),h(i,a(O,E[0]),c(O,E[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*F(t,e,n,o,r);return}}yield*C(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function V(t,e,n,o,s,l,u,c){const a=o*e[s],f=n[a+0],m=n[a+1],p=n[a+2];null!=l?l.applyToVertex(t,f,m,p,u):r(t,f,m,p),c&&i(t,t,c)}function w(t,e,n){for(let o=1;o<n-1;o++)if(v(t,e[0],e[o],e[o+1]))return!0;return!1}function A(t,n,r,i){let s=Number.POSITIVE_INFINITY;for(let l=1;l<r-1;l++){d(U,t,n[0],n[l],n[l+1]);const r=o(t,U);r<s&&(s=r,e(i,U))}}const O=f(),S=12,E=[s(),s(),s()],Y=Array.from({length:S},()=>s()),_=Array.from({length:S},()=>t()),B=s(),M=s(),U=s(),k=new N(4),q={list:[],count:0};export{y as DrapedHit,N as Hit,C as forEachTriangleRangeScreenPolygonHit,P as forEachTriangleReaderRangeScreenPolygonHit,x as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon,j as intersectTriangleReaderRangeScreenPolygon};
2
+ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,distance as r,squaredDistance as o,set as i,transformMat4 as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as u,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as c,intersectsTransformedAabbFromMinMax as m}from"../../../../geometry/support/frustum.js";import{clipPolygon as f}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as h}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as I}from"./screenPolygonOverlapUtils.js";class b{constructor(t){this.primitiveIndex=t}}class g{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,r,o,i){this.distance=t,this.primitiveIndex=r,e(this.point,o),this.hasNormal=null!=i,null!=i&&e(this.normal,i)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:i}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?i:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,r,o,i){if(!t.visible||0!==t.type)return null;const n=new g(4);let s;if(t.boundingInfo)s=j(t.boundingInfo,e,r,o,i);else{const n=t.positionAttribute,l=t.primitivePositionIndices;s=N(e,r,o,0,l.length/3,l,n.data,n.stride,i,null,0)}for(const l of s)n.updateIfCloser(l);return n.valid?n:null}function v(t,e,r,o,i){const n=new g(4);for(const s of x(t,e,r,o,i))n.updateIfCloser(s);return n.valid?n:null}function*N(t,e,r,o,i,n,s,l,u,a=null,c=0){const m=(t,r,o,i)=>{const m=(a?.[i]??i)+c,f=null==a?m:i,p=3*m;return P(t,n,s,l,p+0,u,f,e),P(r,n,s,l,p+1,u,f,e),P(o,n,s,l,p+2,u,f,e),m};return yield*x(t,r,o,i,m)}function*x(t,e,o,i,n){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let u=o;u<i;++u){const t=n(A[0],A[1],A[2],u),o=w;let i;Y.reset();for(const{list:n,count:u}of l.processTriangle(_,A)){const l=f(s.frustum[4],n,u,M,!1);if(!(l<3)){for(let t=0;t<l;t++)s.projectToScreen(M[t],O[t]);T(e,O,l)&&(F(s.eye,M,l,S),null==i&&(i=p(w,A[0],A[1],A[2])),Y.updateIfCloserFromValues(r(s.eye,S),t,S,i?o:null))}}Y.valid&&(yield Y)}}function*j(t,e,r,o,i){let n;if(null!=i?(l(C,t.bbMin),u(C,t.bbMax),i.applyToAabb(C),n=c(o.broadPhaseFrustum,C,r)):n=m(o.broadPhaseFrustum,t.bbMin,t.bbMax,r),!n)return;const{primitiveIndices:s,position:a}=t,f=s?s.length:a.indices.length/3;if(f>h){const n=t.getChildren();if(void 0!==n){for(const t of n)yield*j(t,e,r,o,i);return}}yield*N(e,r,o,0,f,a.indices,a.data,a.stride,i,s,0)}function P(t,e,r,o,s,l,u,a){const c=o*e[s],m=r[c+0],f=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,m,f,p,u):i(t,m,f,p),a&&n(t,t,a)}function T(t,e,r){for(let o=1;o<r-1;o++)if(I(t,e[0],e[o],e[o+1]))return!0;return!1}function F(t,r,i,n){let s=Number.POSITIVE_INFINITY;for(let l=1;l<i-1;l++){d(E,t,r[0],r[l],r[l+1]);const i=o(t,E);i<s&&(s=i,e(n,E))}}const C=a(),V=12,A=[s(),s(),s()],M=Array.from({length:V},()=>s()),O=Array.from({length:V},()=>t()),S=s(),w=s(),E=s(),Y=new g(4),_={list:[],count:0};export{b as DrapedHit,g as Hit,N as forEachTriangleRangeScreenPolygonHit,x as forEachTriangleReaderRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon,v as intersectTriangleReaderRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{C as CutFillTargetDepthParameters,b as build}from"../../../../chunks/CutFillTargetDepth.glsl.js";
2
+ import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{C as CutFillTargetDepthParameters,b as build}from"../../../../chunks/CutFillTargetDepth.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{parameter as s}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{OITResolutionConfiguration as i}from"./oitResolution.glsl.js";class r extends i{constructor(){super(...arguments),this.hasEmission=!1}}o([s()],r.prototype,"hasEmission",void 0);export{r as GaussianSplatCompositionTechniqueConfiguration};
2
+ import{__decorate as o}from"tslib";import{parameter as s}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{FloatBlendScaleConfiguration as r}from"./floatBlendScale.glsl.js";class e extends r{constructor(){super(...arguments),this.hasEmission=!1}}o([s()],e.prototype,"hasEmission",void 0);export{e as GaussianSplatCompositionTechniqueConfiguration};
@@ -1,8 +1,8 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isColor as o,isOITColorAlpha as i,isOITFrontFace as l}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as r}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as s}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as a}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{emissionFilter as e}from"../core/shaderLibrary/util/emissionFilter.glsl.js";import{If as n,glsl as t}from"../core/shaderModules/glsl.js";import{alphaCutoff as f}from"./alphaCutoff.glsl.js";import{ditherNoise as m}from"./ditherNoise.glsl.js";import{oitResolution as u}from"./oitResolution.glsl.js";function d(d,g){d.include(s,g),d.include(r,g);const{fragment:p,outputs:c}=d;p.include(a);const{output:C,hasEmission:h,oitPremultipliedAlpha:b,snowCover:E,emissionDimmingPass:v,renderOccluded:y}=g,j=11===C,O=i(C),$=l(C),A=o(C)&&!O,L=0!==C||y;let S=0;(A||O)&&c.add("fragColor","vec4",S++),O&&c.add("fragAlpha","float",S++),h&&c.add("fragEmission","vec4",S++),p.include(a),p.include(f),p.include(u,g),p.include(m,g),v&&p.include(e),p.code.add(t`
2
+ import{isColor as o,isOITColorAlpha as i,isOITFrontFace as l}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as r}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as s}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as a}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{emissionFilter as e}from"../core/shaderLibrary/util/emissionFilter.glsl.js";import{If as n,glsl as t}from"../core/shaderModules/glsl.js";import{alphaCutoff as f}from"./alphaCutoff.glsl.js";import{ditherNoise as m}from"./ditherNoise.glsl.js";import{floatBlendScale as u}from"./floatBlendScale.glsl.js";function d(d,g){d.include(s,g),d.include(r,g);const{fragment:p,outputs:c}=d;p.include(a);const{output:C,hasEmission:h,oitPremultipliedAlpha:b,snowCover:E,emissionDimmingPass:v,renderOccluded:y}=g,j=11===C,O=i(C),$=l(C),A=o(C)&&!O,S=0!==C||y;let L=0;(A||O)&&c.add("fragColor","vec4",L++),O&&c.add("fragAlpha","float",L++),h&&c.add("fragEmission","vec4",L++),p.include(a),p.include(f),p.include(u,g),p.include(m,g),v&&p.include(e),p.code.add(t`
3
3
  void outputColorHighlightOLID(vec4 finalColor, vec3 emissiveSymbolColor ${n(E,", float snow")}) {
4
4
  ${n(j,"finalColor.a = 1.0;")}
5
- ${n(L,"if (finalColor.a < alphaCutoff) discard;")}
5
+ ${n(S,"if (finalColor.a < alphaCutoff) discard;")}
6
6
 
7
7
  ${n(O,`float noise = ditherNoise(finalColor);\n fragColor = ${n(b,"finalColor","premultiplyAlpha(finalColor)")};\n fragColor.rgb = fragColor.rgb * floatBlendOutputScale + noise;\n fragAlpha = finalColor.a * floatBlendOutputScale + noise;\n `)}
8
8
  ${n($&&b,"finalColor.rgb /= finalColor.a;")}
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as a}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class n extends a{constructor(){super(...arguments),this.useFloatBlend=!0}}t([o()],n.prototype,"useFloatBlend",void 0);const e=16,l=e;function s(t,o){o.useFloatBlend?(t.constants.add("floatBlendOutputScale","float",1),t.constants.add("floatBlendInputScale","float",1)):(t.constants.add("floatBlendOutputScale","float",1/e),t.constants.add("floatBlendInputScale","float",e)),t.constants.add("maxEmissiveStrength","float",l)}export{n as OITResolutionConfiguration,e as floatBlendReductionFactor,s as oitResolution};
2
+ import{__decorate as t}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as a}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class n extends a{constructor(){super(...arguments),this.useFloatBlend=!0}}t([o()],n.prototype,"useFloatBlend",void 0);const e=16,l=e;function s(t,o){o.useFloatBlend?(t.constants.add("floatBlendOutputScale","float",1),t.constants.add("floatBlendInputScale","float",1)):(t.constants.add("floatBlendOutputScale","float",1/e),t.constants.add("floatBlendInputScale","float",e)),t.constants.add("maxEmissiveStrength","float",l)}export{n as FloatBlendScaleConfiguration,e as floatBlendReductionFactor,s as floatBlendScale};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../core/Accessor.js";import t from"../core/Collection.js";import{when as s,watch as i}from"../core/reactiveUtils.js";import{property as n,subclass as a}from"../core/accessorSupport/decorators.js";import{isIntegratedMesh3DTilesLayerView3D as o}from"./3d/layers/support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{toExtent as l}from"./3d/support/cameraUtils.js";import{GroundElevationSampler as p}from"./support/GroundElevationSampler.js";let d=class extends r{constructor(e){super(e),this.view=null,this.layerViews=new t}initialize(){this.addHandles([s(()=>this.view?.map?.ground,async e=>e.load()),i(()=>!this.hasTerrainReplacement,e=>{this.view?.basemapTerrain?.enable(e)},{sync:!0})])}get hasTerrainReplacement(){const{view:e}=this;if("3d"!==e?.type||!e.map?.basemap)return!1;return!!e.map.basemap.groundLayers.some(r=>(!!e.basemapView?.groundLayerViews.find(e=>o(e)&&e.ready&&(e.layer===r||e.canRecycleWith(r)))||e.layerViewManager.isRecyclingLayerViewForLayer(r))&&"replacesTerrain"in r&&r.replacesTerrain)}get ground(){return this.view?.map?.ground}destroy(){this._set("view",null),this.layerViews.destroyAll()}get elevationSampler(){return"3d"===this.view.type?new p({view:this.view}):null}get extent(){const{view:e}=this;return e?.ready?l(e,e.state.camera,e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation):null}get updating(){return!this.suspended&&this.layerViews.some(({updating:e})=>e)}get suspended(){return this.view?.suspended??!0}};e([n()],d.prototype,"hasTerrainReplacement",null),e([n({readOnly:!0})],d.prototype,"elevationSampler",null),e([n({readOnly:!0})],d.prototype,"extent",null),e([n({type:Boolean,readOnly:!0})],d.prototype,"updating",null),e([n({constructOnly:!0})],d.prototype,"view",void 0),e([n({type:t,readOnly:!0})],d.prototype,"layerViews",void 0),e([n({readOnly:!0})],d.prototype,"suspended",null),d=e([a("esri.views.GroundView")],d);const u=d;export{u as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import r from"../core/Collection.js";import{when as s,watch as i}from"../core/reactiveUtils.js";import{property as n,subclass as o}from"../core/accessorSupport/decorators.js";import{isIntegratedMesh3DTilesLayerView3D as a}from"./3d/layers/support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{toExtent as l}from"./3d/support/cameraUtils.js";import{GroundElevationSampler as p}from"./support/GroundElevationSampler.js";let d=class extends t{constructor(e){super(e),this.view=null,this.layerViews=new r}initialize(){this.addHandles([s(()=>this.view?.map?.ground,async e=>e.load()),i(()=>!this.hasTerrainReplacement,e=>{this.view?.basemapTerrain?.enable(e)},{sync:!0})])}get hasTerrainReplacement(){const{view:e}=this;if("3d"!==e?.type||!e.map?.basemap)return!1;for(const t of e.layerViewManager.allLayerViews)if(a(t)&&t.ready&&t.layer.replacesTerrain)return!0;return!1}get ground(){return this.view?.map?.ground}destroy(){this._set("view",null),this.layerViews.destroyAll()}get elevationSampler(){return"3d"===this.view.type?new p({view:this.view}):null}get extent(){const{view:e}=this;return e?.ready?l(e,e.state.camera,e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation):null}get updating(){return!this.suspended&&this.layerViews.some(({updating:e})=>e)}get suspended(){return this.view?.suspended??!0}};e([n()],d.prototype,"hasTerrainReplacement",null),e([n({readOnly:!0})],d.prototype,"elevationSampler",null),e([n({readOnly:!0})],d.prototype,"extent",null),e([n({type:Boolean,readOnly:!0})],d.prototype,"updating",null),e([n({constructOnly:!0})],d.prototype,"view",void 0),e([n({type:r,readOnly:!0})],d.prototype,"layerViews",void 0),e([n({readOnly:!0})],d.prototype,"suspended",null),d=e([o("esri.views.GroundView")],d);const u=d;export{u as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../core/has.js";import{destroyMaybe as e}from"../../core/maybe.js";import{GamepadSource as t}from"./gamepad/GamepadSource.js";import{createScreenPointFromNativeEvent as n}from"../support/screenUtils.js";const i=has("edge"),o=has("chrome"),a=has("ff"),s=has("safari"),r="esri-view-surface",h={touchNone:`${r}--touch-none`,touchPan:`${r}--touch-pan`};class l{static{this.test={disableSubpixelCoordinates:!1}}constructor(e,n){this._active={},this._callback=()=>{},this._keyModifierCallback=()=>{},this._activePointerCaptures=new Set,this._keyDownState=new Set,this._eventId=1,this._browserTouchPanningEnabled=!1,this._forwardWindowModifierKeyPresses=e=>{if(document.activeElement===this._element)return;const t="keydown"===e.type?"key-down":"key-up";this._active[t]&&"b"===e.key&&this._keyModifierCallback(t,{native:e,key:e.key,repeat:e.repeat})},this._element=e,e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),this._eventHandlers={"key-down":this._handleKey,"key-up":this._handleKey,"pointer-down":this._handlePointer,"pointer-move":this._handlePointerPreventDefault,"pointer-up":this._handlePointerPreventDefault,"pointer-enter":this._handlePointer,"pointer-leave":this._handlePointer,"pointer-cancel":this._handlePointer,"mouse-wheel":this._handleMouseWheel,"pointer-capture-lost":this._handlePointerCaptureLost},this._updateTouchAction(),this._element.addEventListener("keydown",this._preventAltKeyDefault),window.addEventListener("keydown",this._forwardWindowModifierKeyPresses),window.addEventListener("keyup",this._forwardWindowModifierKeyPresses),this._gamepadSource=new t(e,n),this._gamepadSource.onEvent=e=>this._callback("gamepad",e)}destroy(){this._callback=()=>{},this._keyModifierCallback=()=>{},this.activeEvents=null,this._activePointerCaptures.forEach(e=>this._releasePointerCaptureSafe(e)),this._activePointerCaptures.clear(),this._gamepadSource=e(this._gamepadSource),this._removeTouchAction(),this._element.removeEventListener("keydown",this._preventAltKeyDefault),window.removeEventListener("keydown",this._forwardWindowModifierKeyPresses),window.removeEventListener("keyup",this._forwardWindowModifierKeyPresses)}get browserTouchPanningEnabled(){return this._browserTouchPanningEnabled}set browserTouchPanningEnabled(e){this._browserTouchPanningEnabled=e,this._updateTouchAction(),this._updateTouchEventHandling()}set onEventReceived(e){this._callback=e}set onKeyModifierReceived(e){this._keyModifierCallback=e}set activeEvents(e){for(const t in this._active)if(!e||!e.has(t)){const e=this._active[t];this._element.removeEventListener(c[t],e),delete this._active[t]}e&&e.forEach(e=>{if(!this._active[e]&&c[e]){const t=(this._eventHandlers[e]||this._handleDefault).bind(this,e);this._element.addEventListener(c[e],t),this._active[e]=t}}),this._gamepadSource&&(this._gamepadSource.hasEventListeners=e?.has("gamepad")??!1)}setPointerCapture(e,t){t?this._setPointerCaptureSafe(e.pointerId):(this._releasePointerCaptureSafe(e.pointerId),this._activePointerCaptures.delete(e.pointerId))}_updateTouchAction(){this._element.classList.remove(this._browserTouchPanningEnabled?h.touchNone:h.touchPan),this._element.classList.add(this._browserTouchPanningEnabled?h.touchPan:h.touchNone)}_updateTouchEventHandling(){this._browserTouchPanningEnabled?this._element.addEventListener("touchmove",this._preventMultiTouchPanning):this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_removeTouchAction(){this._element.classList.remove(h.touchNone),this._element.classList.remove(h.touchPan),this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_setPointerCaptureSafe(e){try{this._element.setPointerCapture(e),this._activePointerCaptures.add(e)}catch{}}_releasePointerCaptureSafe(e){try{if(this._element.hasPointerCapture&&!this._element.hasPointerCapture(e))return;this._element.releasePointerCapture(e)}catch(t){}}_updateNormalizedPointerLikeEvent(e,t){const i=n(this._element,e);return l.test.disableSubpixelCoordinates&&(i.x=Math.round(i.x),i.y=Math.round(i.y)),t.x=i.x,t.y=i.y,t}_handleKey(e,t){const{key:n}=t;n&&"key-up"===e&&this._keyDownState.delete(n);const i={native:t,key:n,repeat:!!n&&this._keyDownState.has(n)};n&&"key-down"===e&&this._keyDownState.add(i.key),this._callback(e,i)}_handlePointer(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});this._callback(e,n)}_handlePointerPreventDefault(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});t.preventDefault(),this._callback(e,n)}_getDeltaFromTrackpadOrMouseWheel(e){return e.shiftKey&&has("mac")&&0===e.deltaY?e.deltaX:e.deltaY}_handleMouseWheel(e,t){let n=this._getDeltaFromTrackpadOrMouseWheel(t);switch(t.deltaMode){case 0:i&&(n=n/document.documentElement.clientHeight*600);break;case 1:n*=30;break;case 2:n*=900}i?n*=.7:o||s?n*=.6:a&&(n*=1.375);const r=100,h=Math.abs(n);if(h>r){n=n/h*200/(1+Math.exp(-.02*(h-r)))}const l=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,deltaY:n});this._callback(e,l)}_handlePointerCaptureLost(e,t){this._activePointerCaptures.delete(t.pointerId),this._handleDefault(e,t)}_handleDefault(e,t){const n={native:t};t.preventDefault(),this._callback(e,n)}_preventAltKeyDefault(e){"Alt"===e.key&&e.preventDefault()}_preventMultiTouchPanning(e){e.touches.length>1&&e.preventDefault()}}const c={"key-down":"keydown","key-up":"keyup","pointer-down":"pointerdown","pointer-up":"pointerup","pointer-move":"pointermove","mouse-wheel":"wheel","pointer-capture-got":"gotpointercapture","pointer-capture-lost":"lostpointercapture","context-menu":"contextmenu","touch-start":"touchstart","touch-end":"touchend","pointer-enter":"pointerenter","pointer-leave":"pointerleave","pointer-cancel":"pointercancel",focus:"focus",blur:"blur"};export{l as BrowserEventSource};
2
+ import has from"../../core/has.js";import{destroyMaybe as e}from"../../core/maybe.js";import{GamepadSource as t}from"./gamepad/GamepadSource.js";import{createScreenPointFromNativeEvent as n}from"../support/screenUtils.js";const i=has("edge"),o=has("chrome"),a=has("ff"),s=has("safari"),r="esri-view-surface",h={touchNone:`${r}--touch-none`,touchPan:`${r}--touch-pan`};class l{static{this.test={disableSubpixelCoordinates:!1}}constructor(e,n){this._active={},this._callback=()=>{},this._keyModifierCallback=()=>{},this._modifierKeys=null,this._activePointerCaptures=new Set,this._keyDownState=new Set,this._eventId=1,this._browserTouchPanningEnabled=!1,this._forwardWindowModifierKeyPresses=e=>{if(document.activeElement===this._element)return;const t="keydown"===e.type?"key-down":"key-up";this._active[t]&&this._modifierKeys?.has(e.key)&&this._keyModifierCallback(t,{native:e,key:e.key,repeat:e.repeat})},this._element=e,e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),this._eventHandlers={"key-down":this._handleKey,"key-up":this._handleKey,"pointer-down":this._handlePointer,"pointer-move":this._handlePointerPreventDefault,"pointer-up":this._handlePointerPreventDefault,"pointer-enter":this._handlePointer,"pointer-leave":this._handlePointer,"pointer-cancel":this._handlePointer,"mouse-wheel":this._handleMouseWheel,"pointer-capture-lost":this._handlePointerCaptureLost},this._updateTouchAction(),this._element.addEventListener("keydown",this._preventAltKeyDefault),window.addEventListener("keydown",this._forwardWindowModifierKeyPresses),window.addEventListener("keyup",this._forwardWindowModifierKeyPresses),this._gamepadSource=new t(e,n),this._gamepadSource.onEvent=e=>this._callback("gamepad",e)}destroy(){this._callback=()=>{},this._keyModifierCallback=()=>{},this.activeEvents=null,this.modifierKeys=null,this._activePointerCaptures.forEach(e=>this._releasePointerCaptureSafe(e)),this._activePointerCaptures.clear(),this._gamepadSource=e(this._gamepadSource),this._removeTouchAction(),this._element.removeEventListener("keydown",this._preventAltKeyDefault),window.removeEventListener("keydown",this._forwardWindowModifierKeyPresses),window.removeEventListener("keyup",this._forwardWindowModifierKeyPresses)}get browserTouchPanningEnabled(){return this._browserTouchPanningEnabled}set browserTouchPanningEnabled(e){this._browserTouchPanningEnabled=e,this._updateTouchAction(),this._updateTouchEventHandling()}set onEventReceived(e){this._callback=e}set onKeyModifierReceived(e){this._keyModifierCallback=e}set activeEvents(e){for(const t in this._active)if(!e||!e.has(t)){const e=this._active[t];this._element.removeEventListener(d[t],e),delete this._active[t]}e&&e.forEach(e=>{if(!this._active[e]&&d[e]){const t=(this._eventHandlers[e]||this._handleDefault).bind(this,e);this._element.addEventListener(d[e],t),this._active[e]=t}}),this._gamepadSource&&(this._gamepadSource.hasEventListeners=e?.has("gamepad")??!1)}set modifierKeys(e){this._modifierKeys=e}setPointerCapture(e,t){t?this._setPointerCaptureSafe(e.pointerId):(this._releasePointerCaptureSafe(e.pointerId),this._activePointerCaptures.delete(e.pointerId))}_updateTouchAction(){this._element.classList.remove(this._browserTouchPanningEnabled?h.touchNone:h.touchPan),this._element.classList.add(this._browserTouchPanningEnabled?h.touchPan:h.touchNone)}_updateTouchEventHandling(){this._browserTouchPanningEnabled?this._element.addEventListener("touchmove",this._preventMultiTouchPanning):this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_removeTouchAction(){this._element.classList.remove(h.touchNone),this._element.classList.remove(h.touchPan),this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_setPointerCaptureSafe(e){try{this._element.setPointerCapture(e),this._activePointerCaptures.add(e)}catch{}}_releasePointerCaptureSafe(e){try{if(this._element.hasPointerCapture&&!this._element.hasPointerCapture(e))return;this._element.releasePointerCapture(e)}catch(t){}}_updateNormalizedPointerLikeEvent(e,t){const i=n(this._element,e);return l.test.disableSubpixelCoordinates&&(i.x=Math.round(i.x),i.y=Math.round(i.y)),t.x=i.x,t.y=i.y,t}_handleKey(e,t){const{key:n}=t;n&&"key-up"===e&&this._keyDownState.delete(n);const i={native:t,key:n,repeat:!!n&&this._keyDownState.has(n)};n&&"key-down"===e&&this._keyDownState.add(i.key),this._callback(e,i)}_handlePointer(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});this._callback(e,n)}_handlePointerPreventDefault(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});t.preventDefault(),this._callback(e,n)}_getDeltaFromTrackpadOrMouseWheel(e){return e.shiftKey&&has("mac")&&0===e.deltaY?e.deltaX:e.deltaY}_handleMouseWheel(e,t){let n=this._getDeltaFromTrackpadOrMouseWheel(t);switch(t.deltaMode){case 0:i&&(n=n/document.documentElement.clientHeight*600);break;case 1:n*=30;break;case 2:n*=900}i?n*=.7:o||s?n*=.6:a&&(n*=1.375);const r=100,h=Math.abs(n);if(h>r){n=n/h*200/(1+Math.exp(-.02*(h-r)))}const l=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,deltaY:n});this._callback(e,l)}_handlePointerCaptureLost(e,t){this._activePointerCaptures.delete(t.pointerId),this._handleDefault(e,t)}_handleDefault(e,t){const n={native:t};t.preventDefault(),this._callback(e,n)}_preventAltKeyDefault(e){"Alt"===e.key&&e.preventDefault()}_preventMultiTouchPanning(e){e.touches.length>1&&e.preventDefault()}}const d={"key-down":"keydown","key-up":"keyup","pointer-down":"pointerdown","pointer-up":"pointerup","pointer-move":"pointermove","mouse-wheel":"wheel","pointer-capture-got":"gotpointercapture","pointer-capture-lost":"lostpointercapture","context-menu":"contextmenu","touch-start":"touchstart","touch-end":"touchend","pointer-enter":"pointerenter","pointer-leave":"pointerleave","pointer-cancel":"pointercancel",focus:"focus",blur:"blur"};export{l as BrowserEventSource};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import"../../core/has.js";import i from"../../core/Logger.js";import n from"../../core/Queue.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import{primaryKey as a,isSystemModifier as l}from"./keys.js";import{LatestPen as h}from"./handlers/LatestPen.js";import{LatestPointer as p}from"./handlers/LatestPointer.js";import{MultiTouch as d}from"./handlers/MultiTouch.js";import{PropertiesPool as u}from"../support/PropertiesPool.js";class c{constructor(){this.id=0,this.type="mouse",this.location=r()}}class _{constructor(){this.tiltX=0,this.tiltY=0}}let f=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=a,this._propertiesPool=new u({latestPointerInfo:()=>new c,latestPenInfo:()=>new _},this),this._latestPointerInfo=void 0,this._latestPenInfo=void 0,this._paused=!1,this._testTimestamp=void 0}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this.eventSource.onKeyModifierReceived=this._updateKeyModifiers.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some(e=>e.handler.hasPendingInputs)}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get latestPointerInfo(){return this._latestPointerInfo}get latestPenInfo(){return this._latestPenInfo}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,t,i=y.INTERNAL){if(this._nameToGroup[e])return;if(0===t.length)return;const n={name:e,handlers:t.map(e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:i,eventCallback:null,uninstallCallback:null}))};this._nameToGroup[e]=n;for(let r=n.handlers.length-1;r>=0;r--){const e=n.handlers[r];this._handlers.push(e),e.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(t,i,n,r,s)=>{this._emitInputEvent(e.priorityIndex+1,t,i,n,s,r)},setPointerCapture:(t,i)=>{this._setPointerCapture(n,e,t,i)},setEventCallback:t=>{e.eventCallback=t},setUninstallCallback:t=>{e.uninstallCallback=t},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const t=this._nameToGroup[e];t?(t.handlers.forEach(e=>{e.removed=!0,e.uninstallCallback?.()}),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):i.getLogger(this).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return void 0!==this._nameToGroup[e]}isModifierKeyDown(e){return this._activeKeyModifiers.has(e)}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,t=new Set;this._handlersPriority=[];for(let i=this._handlers.length-1;i>=0;i--){const e=this._handlers[i];e.priorityIndex=i,this._handlersPriority.push(e)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let i=this._handlersPriority.length-1;i>=0;i--){const n=this._handlersPriority[i];n.priorityIndex=i;let r=n.handler.hasSideEffects;if(!r)for(const t of n.handler.outgoingEventTypes)if(e.has(t)){r=!0;break}if(r)for(const i of n.handler.incomingEventMatches){e.add(i.eventType);for(const e of i.keyModifiers)l(e)||t.add(e)}n.active=r}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,t,i,n){const r=this._latestPointerInfo;if(null==r||r.id!==e||r.type!==t||r.location.x!==i||r.location.y!==n){const r=this._propertiesPool.get("latestPointerInfo");r.id=e,r.type=t,r.location.x=i,r.location.y=n,this._latestPointerInfo=r}}_setLatestPen(e,t){const i=this._latestPenInfo,n=null!=i&&0===e&&0===t,r=n?i?.tiltX:e,s=n?i?.tiltY:t;if(null!=r&&null!=s){if(null==i||i.tiltX!==r||i.tiltY!==s){const e=this._propertiesPool.get("latestPenInfo");e.tiltX=r,e.tiltY=s,this._latestPenInfo=e}}else null!=i&&(this._latestPenInfo=void 0)}_onEventReceived(e,t){if("pointer-capture-lost"===e){const e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);const i=this._testTimestamp??t.native?.timestamp,n=t.native?.cancelable;this._emitInputEventFromSource(e,t,i,n)}_updateKeyModifiers(e,t){if(!t)return;let i=!1;const n=()=>{i||(this._activeKeyModifiers=new Set(this._activeKeyModifiers),i=!0)},r=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(n(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(n(),this._activeKeyModifiers.delete(e))};if("key-down"===e||"key-up"===e){const i=t.key;this._keyModifiers.has(i)&&r(i,"key-down"===e)}const s=t.native;r("Alt",!!s?.altKey),r("Control",!!s?.ctrlKey),r("Ctrl",!!s?.ctrlKey),r("Shift",!!s?.shiftKey),r("Meta",!!s?.metaKey),r("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new p((e,t,i,n)=>this._setLatestPointer(e,t,i,n)),this._latestPenHandler=new h((e,t)=>this._setLatestPen(e,t)),this._multiTouchHandler=new d,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._latestPenHandler,this._multiTouchHandler],y.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,y.INTERNAL)}_setPointerCapture(e,t,i,n){const r=e.name+"-"+t.priorityIndex,s=this._pointerCaptures.get(i.pointerId)||new Set;this._pointerCaptures.set(i.pointerId,s),n?(s.add(r),1===s.size&&this.eventSource&&this.eventSource.setPointerCapture(i,!0)):s.has(r)&&(s.delete(r),0===s.size&&(this._pointerCaptures.delete(i.pointerId),this.eventSource&&this.eventSource.setPointerCapture(i,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter(e=>!e.removed),this.updateDependencies()}_emitInputEventFromSource(e,t,i,n){this._emitInputEvent(0,e,t,i,n)}_emitInputEvent(e,t,i,n,r,s){const o=n??this._currentPropagation?.timestamp??performance.now(),a=r??!1,l={event:new g(t,i,o,s||this._activeKeyModifiers,a),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(l):this._doNewPropagation(l)}_doNewPropagation(e){this._currentPropagation={events:new n,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){this._paused=!1;const e=this._currentPropagation;if(e){for(;e.events.length>0;){const{event:t,priorityIndex:i}=e.events.pop(),n=t.data?.eventId;if(!(null!=n&&this._stoppedPropagationEventIds.has(n)))for(e.currentHandler=this._handlersPriority[i];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback?.(t),t.shouldStopPropagation()){null!=n&&this._stoppedPropagationEventIds.add(n);break}if(t.shouldPausePropagation(()=>this._continuePropagation()))return void this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const t=new n;t.push(e);const i=this._currentPropagation;if(i){for(;i.events.length;)t.push(i.events.pop());i.events=t,i.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(const i of e.handler.incomingEventMatches)for(const e of t.handler.incomingEventMatches){if(i.eventType!==e.eventType)continue;const t=i.keyModifiers.filter(t=>e.keyModifiers.includes(t));if(t.length===i.keyModifiers.length!==(t.length===e.keyModifiers.length))return i.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){const t=[];for(const i of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(i,t[e])>=0;)e++;t.splice(e,0,i)}return t}get test(){}};e([s({readOnly:!0})],f.prototype,"hasPendingInputs",null),e([s({constructOnly:!0})],f.prototype,"eventSource",void 0),e([s({constructOnly:!0})],f.prototype,"recognizers",void 0),e([s()],f.prototype,"multiTouchActive",null),e([s()],f.prototype,"_latestPointerInfo",void 0),e([s()],f.prototype,"latestPointerInfo",null),e([s()],f.prototype,"_latestPenInfo",void 0),e([s()],f.prototype,"latestPenInfo",null),e([s()],f.prototype,"_paused",void 0),e([s({readOnly:!0})],f.prototype,"updating",null),f=e([o("esri.views.input.InputManager")],f);class g{constructor(e,t,i,n,r){this.type=e,this.data=t,this.timestamp=i,this.modifiers=n,this.cancelable=r,this._propagationState=0,this._resumeCallback=null}stopPropagation(){this._propagationState|=1}shouldStopPropagation(){return!!(1&this._propagationState)}defer(e){this._propagationState|=2;const t=(e,t)=>{this._propagationState&=-3;const i=this._resumeCallback;if(this._resumeCallback=null,i&&i(),t)throw e;return e};return("function"==typeof e?e():e).then(e=>t(e,!1),e=>t(e,!0))}shouldPausePropagation(e){return!!(2&this._propagationState)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}}const y={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};export{f as InputManager,_ as LatestPenInfo,c as LatestPointerInfo,y as ViewEventPriorities};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import"../../core/has.js";import i from"../../core/Logger.js";import n from"../../core/Queue.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import{primaryKey as a,isSystemModifier as l}from"./keys.js";import{LatestPen as h}from"./handlers/LatestPen.js";import{LatestPointer as d}from"./handlers/LatestPointer.js";import{MultiTouch as p}from"./handlers/MultiTouch.js";import{PropertiesPool as u}from"../support/PropertiesPool.js";class c{constructor(){this.id=0,this.type="mouse",this.location=r()}}class _{constructor(){this.tiltX=0,this.tiltY=0}}let f=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=a,this._propertiesPool=new u({latestPointerInfo:()=>new c,latestPenInfo:()=>new _},this),this._latestPointerInfo=void 0,this._latestPenInfo=void 0,this._paused=!1,this._testTimestamp=void 0}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this.eventSource.onKeyModifierReceived=this._updateKeyModifiers.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some(e=>e.handler.hasPendingInputs)}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get latestPointerInfo(){return this._latestPointerInfo}get latestPenInfo(){return this._latestPenInfo}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,t,i=y.INTERNAL){if(this._nameToGroup[e])return;if(0===t.length)return;const n={name:e,handlers:t.map(e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:i,eventCallback:null,uninstallCallback:null}))};this._nameToGroup[e]=n;for(let r=n.handlers.length-1;r>=0;r--){const e=n.handlers[r];this._handlers.push(e),e.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(t,i,n,r,s)=>{this._emitInputEvent(e.priorityIndex+1,t,i,n,s,r)},setPointerCapture:(t,i)=>{this._setPointerCapture(n,e,t,i)},setEventCallback:t=>{e.eventCallback=t},setUninstallCallback:t=>{e.uninstallCallback=t},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const t=this._nameToGroup[e];t?(t.handlers.forEach(e=>{e.removed=!0,e.uninstallCallback?.()}),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):i.getLogger(this).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return void 0!==this._nameToGroup[e]}isModifierKeyDown(e){return this._activeKeyModifiers.has(e)}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,t=new Set;this._handlersPriority=[];for(let i=this._handlers.length-1;i>=0;i--){const e=this._handlers[i];e.priorityIndex=i,this._handlersPriority.push(e)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let i=this._handlersPriority.length-1;i>=0;i--){const n=this._handlersPriority[i];n.priorityIndex=i;let r=n.handler.hasSideEffects;if(!r)for(const t of n.handler.outgoingEventTypes)if(e.has(t)){r=!0;break}if(r)for(const i of n.handler.incomingEventMatches){e.add(i.eventType);for(const e of i.keyModifiers)l(e)||t.add(e)}n.active=r}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents,this.eventSource.modifierKeys=this._keyModifiers)}_setLatestPointer(e,t,i,n){const r=this._latestPointerInfo;if(null==r||r.id!==e||r.type!==t||r.location.x!==i||r.location.y!==n){const r=this._propertiesPool.get("latestPointerInfo");r.id=e,r.type=t,r.location.x=i,r.location.y=n,this._latestPointerInfo=r}}_setLatestPen(e,t){const i=this._latestPenInfo,n=null!=i&&0===e&&0===t,r=n?i?.tiltX:e,s=n?i?.tiltY:t;if(null!=r&&null!=s){if(null==i||i.tiltX!==r||i.tiltY!==s){const e=this._propertiesPool.get("latestPenInfo");e.tiltX=r,e.tiltY=s,this._latestPenInfo=e}}else null!=i&&(this._latestPenInfo=void 0)}_onEventReceived(e,t){if("pointer-capture-lost"===e){const e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);const i=this._testTimestamp??t.native?.timestamp,n=t.native?.cancelable;this._emitInputEventFromSource(e,t,i,n)}_updateKeyModifiers(e,t){if(!t)return;let i=!1;const n=()=>{i||(this._activeKeyModifiers=new Set(this._activeKeyModifiers),i=!0)},r=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(n(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(n(),this._activeKeyModifiers.delete(e))};if("key-down"===e||"key-up"===e){const i=t.key;this._keyModifiers.has(i)&&r(i,"key-down"===e)}const s=t.native;r("Alt",!!s?.altKey),r("Control",!!s?.ctrlKey),r("Ctrl",!!s?.ctrlKey),r("Shift",!!s?.shiftKey),r("Meta",!!s?.metaKey),r("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new d((e,t,i,n)=>this._setLatestPointer(e,t,i,n)),this._latestPenHandler=new h((e,t)=>this._setLatestPen(e,t)),this._multiTouchHandler=new p,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._latestPenHandler,this._multiTouchHandler],y.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,y.INTERNAL)}_setPointerCapture(e,t,i,n){const r=e.name+"-"+t.priorityIndex,s=this._pointerCaptures.get(i.pointerId)||new Set;this._pointerCaptures.set(i.pointerId,s),n?(s.add(r),1===s.size&&this.eventSource&&this.eventSource.setPointerCapture(i,!0)):s.has(r)&&(s.delete(r),0===s.size&&(this._pointerCaptures.delete(i.pointerId),this.eventSource&&this.eventSource.setPointerCapture(i,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter(e=>!e.removed),this.updateDependencies()}_emitInputEventFromSource(e,t,i,n){this._emitInputEvent(0,e,t,i,n)}_emitInputEvent(e,t,i,n,r,s){const o=n??this._currentPropagation?.timestamp??performance.now(),a=r??!1,l={event:new g(t,i,o,s||this._activeKeyModifiers,a),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(l):this._doNewPropagation(l)}_doNewPropagation(e){this._currentPropagation={events:new n,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){this._paused=!1;const e=this._currentPropagation;if(e){for(;e.events.length>0;){const{event:t,priorityIndex:i}=e.events.pop(),n=t.data?.eventId;if(!(null!=n&&this._stoppedPropagationEventIds.has(n)))for(e.currentHandler=this._handlersPriority[i];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback?.(t),t.shouldStopPropagation()){null!=n&&this._stoppedPropagationEventIds.add(n);break}if(t.shouldPausePropagation(()=>this._continuePropagation()))return void this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const t=new n;t.push(e);const i=this._currentPropagation;if(i){for(;i.events.length;)t.push(i.events.pop());i.events=t,i.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(const i of e.handler.incomingEventMatches)for(const e of t.handler.incomingEventMatches){if(i.eventType!==e.eventType)continue;const t=i.keyModifiers.filter(t=>e.keyModifiers.includes(t));if(t.length===i.keyModifiers.length!==(t.length===e.keyModifiers.length))return i.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){const t=[];for(const i of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(i,t[e])>=0;)e++;t.splice(e,0,i)}return t}get test(){}};e([s({readOnly:!0})],f.prototype,"hasPendingInputs",null),e([s({constructOnly:!0})],f.prototype,"eventSource",void 0),e([s({constructOnly:!0})],f.prototype,"recognizers",void 0),e([s()],f.prototype,"multiTouchActive",null),e([s()],f.prototype,"_latestPointerInfo",void 0),e([s()],f.prototype,"latestPointerInfo",null),e([s()],f.prototype,"_latestPenInfo",void 0),e([s()],f.prototype,"latestPenInfo",null),e([s()],f.prototype,"_paused",void 0),e([s({readOnly:!0})],f.prototype,"updating",null),f=e([o("esri.views.input.InputManager")],f);class g{constructor(e,t,i,n,r){this.type=e,this.data=t,this.timestamp=i,this.modifiers=n,this.cancelable=r,this._propagationState=0,this._resumeCallback=null}stopPropagation(){this._propagationState|=1}shouldStopPropagation(){return!!(1&this._propagationState)}defer(e){this._propagationState|=2;const t=(e,t)=>{this._propagationState&=-3;const i=this._resumeCallback;if(this._resumeCallback=null,i&&i(),t)throw e;return e};return("function"==typeof e?e():e).then(e=>t(e,!1),e=>t(e,!0))}shouldPausePropagation(e){return!!(2&this._propagationState)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}}const y={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};export{f as InputManager,_ as LatestPenInfo,c as LatestPointerInfo,y as ViewEventPriorities};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as m}from"./LayerLayerViewInfo.js";function u(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let g=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new w,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(y(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,n=e=>{const r=e.tryRecycle(i);r?(this._recyclingInfoMap.set(e.layer,e),this._watchUpdatingTracking.consumePromise(r),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{a(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),n(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),n(a));for(const a of i)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),h)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),f(this._recyclingInfoMap),f(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),f(this._layerLayerViewInfoMap),f(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,t))}isRecyclingLayerViewForLayer(e){return this._recyclingInfoMap.has(e)}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void r?.removeAll();let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&u(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++t}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new m(e,this.view,this.layerViewImporter);this._watchUpdatingTracking.consumePromise(r.promise),r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],g.prototype,"_workPromise",void 0),e([c({readOnly:!0})],g.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],g.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],g.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],g.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],g.prototype,"layerViewFilter",void 0),e([c()],g.prototype,"layerViewImporter",void 0),e([c({readOnly:!0})],g.prototype,"updating",null),e([c({readOnly:!0})],g.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],g.prototype,"view",void 0),g=e([p("esri.views.support.LayerViewManager")],g);const _=g;export{_ as default};
2
+ import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as y}from"../../core/reactiveUtils.js";import{schedule as h}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as u}from"./LayerLayerViewInfo.js";function g(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let m=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new w,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(h(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,n=e=>{const r=e.tryRecycle(i);r?(this._recyclingInfoMap.set(e.layer,e),this._watchUpdatingTracking.consumePromise(r),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating"),this.notifyChange("allLayerViews")}).catch(r=>{a(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"),this.notifyChange("allLayerViews"))})):o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),n(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),n(a));for(const a of i)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),y)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),f(this._recyclingInfoMap),f(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),f(this._layerLayerViewInfoMap),f(this._recyclingInfoMap),this.notifyChange("allLayerViews"))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,t))}get allLayerViews(){const e=[];for(const r of this._layerLayerViewInfoMap.values())r.layerView&&e.push(r.layerView);for(const r of this._recyclingInfoMap.values())r.layerView&&e.push(r.layerView);return e}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining"),this.notifyChange("allLayerViews")}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void r?.removeAll();let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&g(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++t}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new u(e,this.view,this.layerViewImporter);this._watchUpdatingTracking.consumePromise(r.promise),r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining"),this.notifyChange("allLayerViews")}};e([c()],m.prototype,"_workPromise",void 0),e([c({readOnly:!0})],m.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],m.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],m.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],m.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],m.prototype,"layerViewFilter",void 0),e([c()],m.prototype,"layerViewImporter",void 0),e([c({readOnly:!0})],m.prototype,"updating",null),e([c({readOnly:!0})],m.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],m.prototype,"view",void 0),e([c({readOnly:!0})],m.prototype,"allLayerViews",null),m=e([p("esri.views.support.LayerViewManager")],m);const _=m;export{_ as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getBasisEncoder as e,destroyBasisEncoder as t}from"../../libs/basisu/BasisUEncoder.js";import{getDXTEncoder as n,destroyDXTEncoder as r}from"../../libs/dxtEncoder/DXTEncoder.js";import{CompressedTextureFormat as a}from"../webgl/enums.js";let l,s,i=null,o=null;class u{constructor(e,t){this.internalFormat=e,this.compressedTexture=t}}function c(){i=null,l=null,o=null,s=null,t(),r()}async function h(e){const t=e.data instanceof ImageBitmap?e.data:null;let n;n=e.data instanceof ImageBitmap?w(e.data):y(e.data,e.width,e.height,e.components,e.needsFlip);try{if(e.hasS3TC){o||await f();const t=new Uint8Array(n.length);if(o?.encode(n,e.width,e.height,e.preMultiplyAlpha,t)){const e=U(t,!0),n=[t.buffer];return{result:new u(e?.internalFormat??null,e?.textureData??null),transferList:n}}return{result:new u(null,null)}}if(e.hasETC){if(i||await d(),e.preMultiplyAlpha&&!o&&await f(),e.preMultiplyAlpha){const t=new Uint8ClampedArray(n.length);o?.premultiply(new Uint8Array(n),e.width,e.height,t),n=t}const t=p(n,e.width,e.height,e.hasMipmap),r=t?m(t):null,a=r?.compressedTexture?.levels.map(e=>e.buffer)||[];return{result:new u(r?.internalFormat??null,r?.compressedTexture??null),transferList:a}}return{result:new u(null,null)}}finally{t?.close()}}async function d(){i||(i=await(l??=e()),l=null)}async function f(){o||(o=await(s??=n()),s=null)}function p(e,t,n,r,a=255,l=0,s=!1,o=!1){if(!i)return null;const u=new i.BasisEncoder;u.setPerceptual(!o),u.setCheckForAlpha(!0),u.setForceAlpha(!1),u.setRenormalize(o),u.setMipGen(r),u.setMipSRGB(!o),u.setCreateKTX2File(!0),u.setKTX2SRGBTransferFunc(!o),u.setQualityLevel(a),u.setCompressionLevel(l);const c=new Uint8Array(e.byteLength);u.setSliceSourceImage(0,new Uint8Array(e),t,n,s);const h=u.encode(c),d=new Uint8Array(c.buffer,0,h),f=new i.KTX2File(new Uint8Array(d));return f.isValid()?(u.delete(),d):(f.close(),f.delete(),u.delete(),null)}function m(e){if(!i)return new u(null,null);const t=new i.KTX2File(new Uint8Array(e));t.startTranscoding();const[n,r]=t.getHasAlpha()?[1,a.COMPRESSED_RGBA8_ETC2_EAC]:[0,a.COMPRESSED_RGB8_ETC2],l=t.getLevels(),s=[];for(let a=0;a<l;a++)s.push(new Uint8Array(t.getImageTranscodedSizeInBytes(a,0,0,n))),t.transcodeImage(s[a],a,0,0,n,0,-1,-1);return t.close(),t.delete(),{internalFormat:r,compressedTexture:{type:"compressed",levels:s}}}function w(e){const t=new OffscreenCanvas(e.width,e.height),n=t.getContext("2d");n.drawImage(e,0,0);return n.getImageData(0,0,t.width,t.height).data}function y(e,t,n,r,a){const l=new Uint8ClampedArray(e).subarray(0,t*n*r);if(!a)return l;const s=new Uint8ClampedArray(l.length),i=t*r;for(let o=0;o<n;o++){const e=o*i,t=(n-o-1)*i;s.set(l.subarray(e,e+i),t)}return s}const T=31,A=1,g=2,C=3,E=4,S=7,b=21,_=131072;function D(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const M=D("DXT1"),X=D("DXT3"),R=D("DXT5");function U(e,t){const n=new Int32Array(e.buffer,e.byteOffset,T);let r,l;switch(n[b]){case M:r=8,l=a.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case X:r=16,l=a.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case R:r=16,l=a.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}let s=1,i=n[E],o=n[C];(3&i||3&o)&&(i=i+3&-4,o=o+3&-4);const u=i,c=o;let h,d;n[g]&_&&!1!==t&&(s=Math.max(1,n[S]));let f=e.byteOffset+n[A]+4;const p=[];for(let a=0;a<s;++a)d=(i+3>>2)*(o+3>>2)*r,h=new Uint8Array(e.buffer,f,d),p.push(h),f+=d,i=Math.max(1,i>>1),o=Math.max(1,o>>1);return{textureData:{type:"compressed",levels:p},internalFormat:l,width:u,height:c}}export{u as TextureCompressionWorkerOutput,h as compress,p as compressRGBADataToKTX2,m as createTextureDataKTX2,c as destroy,d as initializeBasisEncoder,f as initializeDXTEncoder};
2
+ import{getBasisEncoder as e,destroyBasisEncoder as t}from"../../libs/basisu/BasisUEncoder.js";import{getDXTEncoder as n,destroyDXTEncoder as r}from"../../libs/dxtEncoder/DXTEncoder.js";import{CompressedTextureFormat as a}from"../webgl/enums.js";let l,s,i=null,o=null;class u{constructor(e,t){this.internalFormat=e,this.compressedTexture=t}}function c(){i=null,l=null,o=null,s=null,t(),r()}async function d(e){const t=e.data instanceof ImageBitmap?e.data:null;let n;n=e.data instanceof ImageBitmap?w(e.data):y(e.data,e.width,e.height,e.components,e.needsFlip);try{if(e.hasS3TC){o||await f();const t=new Uint8Array(n.length);if(o?.encode(n,e.width,e.height,e.preMultiplyAlpha,t)){const e=R(t,!0),n=[t.buffer];return{result:new u(e?.internalFormat??null,e?.textureData??null),transferList:n}}return{result:new u(null,null)}}if(e.hasETC){if(i||await h(),e.preMultiplyAlpha&&!o&&await f(),e.preMultiplyAlpha){const t=new Uint8ClampedArray(n.length);o?.premultiply(new Uint8Array(n),e.width,e.height,t),n=t}const t=p(n,e.width,e.height,e.hasMipmap),r=t?m(t):null,a=r?.compressedTexture?.levels.map(e=>e.buffer)||[];return{result:new u(r?.internalFormat??null,r?.compressedTexture??null),transferList:a}}return{result:new u(null,null)}}finally{t?.close()}}async function h(){i||(i=await(l??=e()),l=null)}async function f(){o||(o=await(s??=n()),s=null)}function p(e,t,n,r,a=255,l=0,s=!1,o=!1){if(!i)return null;const u=new i.BasisEncoder;u.setPerceptual(!o),u.setCheckForAlpha(!0),u.setForceAlpha(!1),u.setRenormalize(o),u.setMipGen(r),u.setMipSRGB(!o),u.setCreateKTX2File(!0),u.setKTX2AndBasisSRGBTransferFunc(!o),u.setQualityLevel(a),u.setETC1SCompressionLevel(l);const c=new Uint8Array(e.byteLength);u.setSliceSourceImage(0,new Uint8Array(e),t,n,s);const d=u.encode(c),h=new Uint8Array(c.buffer,0,d),f=new i.KTX2File(new Uint8Array(h));return f.isValid()?(u.delete(),h):(f.close(),f.delete(),u.delete(),null)}function m(e){if(!i)return new u(null,null);const t=new i.KTX2File(new Uint8Array(e));t.startTranscoding();const[n,r]=t.getHasAlpha()?[1,a.COMPRESSED_RGBA8_ETC2_EAC]:[0,a.COMPRESSED_RGB8_ETC2],l=t.getLevels(),s=[];for(let a=0;a<l;a++)s.push(new Uint8Array(t.getImageTranscodedSizeInBytes(a,0,0,n))),t.transcodeImage(s[a],a,0,0,n,0,-1,-1);return t.close(),t.delete(),{internalFormat:r,compressedTexture:{type:"compressed",levels:s}}}function w(e){const t=new OffscreenCanvas(e.width,e.height),n=t.getContext("2d");n.drawImage(e,0,0);return n.getImageData(0,0,t.width,t.height).data}function y(e,t,n,r,a){const l=new Uint8ClampedArray(e).subarray(0,t*n*r);if(!a)return l;const s=new Uint8ClampedArray(l.length),i=t*r;for(let o=0;o<n;o++){const e=o*i,t=(n-o-1)*i;s.set(l.subarray(e,e+i),t)}return s}const T=31,A=1,C=2,g=3,E=4,S=7,b=21,_=131072;function D(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const M=D("DXT1"),X=D("DXT3"),B=D("DXT5");function R(e,t){const n=new Int32Array(e.buffer,e.byteOffset,T);let r,l;switch(n[b]){case M:r=8,l=a.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case X:r=16,l=a.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case B:r=16,l=a.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}let s=1,i=n[E],o=n[g];(3&i||3&o)&&(i=i+3&-4,o=o+3&-4);const u=i,c=o;let d,h;n[C]&_&&!1!==t&&(s=Math.max(1,n[S]));let f=e.byteOffset+n[A]+4;const p=[];for(let a=0;a<s;++a)h=(i+3>>2)*(o+3>>2)*r,d=new Uint8Array(e.buffer,f,h),p.push(d),f+=h,i=Math.max(1,i>>1),o=Math.max(1,o>>1);return{textureData:{type:"compressed",levels:p},internalFormat:l,width:u,height:c}}export{u as TextureCompressionWorkerOutput,d as compress,p as compressRGBADataToKTX2,m as createTextureDataKTX2,c as destroy,h as initializeBasisEncoder,f as initializeDXTEncoder};