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

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 (116) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +1 -0
  3. package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +29 -0
  4. package/assets/esri/core/workers/chunks/2c0d92c0e3511775401a.js +29 -0
  5. package/assets/esri/core/workers/chunks/{f1f3fe9d2d96578f4f6b.js → 52efa4ded11c1e71f04f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{e5c19e9b6fa53abdca8c.js → 728ea88e7d4733230e1f.js} +72 -73
  7. package/assets/esri/core/workers/chunks/{94cebc34e49da1e295ed.js → 8026cc0065f6520c4161.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{7684f0c771d312e05bb4.js → ad5c2b0de6713d0a93a4.js} +58 -58
  9. package/assets/esri/core/workers/chunks/{9b1199104a6822ab7340.js → ae9f9e975d7a9d442fa5.js} +1 -1
  10. package/assets/esri/core/workers/chunks/b3cd17daf5a297b96705.js +29 -0
  11. package/assets/esri/core/workers/chunks/{c316234837b7ca406b1c.js → c4b13124a9cfc78c42a6.js} +6 -6
  12. package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{96d5fed0235558c0e348.js → e9c48630757bea465b7e.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{305ee2dd597c48a38e64.js → ed988360264574cd8f6b.js} +1 -1
  15. package/chunks/CutFillComposition.glsl.js +2 -2
  16. package/chunks/CutFillReduction.glsl.js +1 -1
  17. package/chunks/EmissionComposite.glsl.js +2 -0
  18. package/chunks/FocusAreaColor.glsl.js +1 -1
  19. package/chunks/Fog.glsl.js +20 -20
  20. package/chunks/GlobalIllumination.glsl.js +25 -25
  21. package/chunks/GlowBlur.glsl.js +16 -18
  22. package/chunks/GlowComposite.glsl.js +35 -0
  23. package/chunks/Laserline.glsl.js +13 -13
  24. package/chunks/LaserlinePath.glsl.js +11 -10
  25. package/chunks/Precipitation.glsl.js +6 -6
  26. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  27. package/chunks/ShadowHighlight.glsl.js +3 -3
  28. package/chunks/Viewshed.glsl.js +3 -3
  29. package/config.js +1 -1
  30. package/core/screenUtils.js +1 -1
  31. package/core/types.d.ts +7 -0
  32. package/kernel.js +1 -1
  33. package/layers/VoxelWasmPerSceneView.js +1 -1
  34. package/package.json +1 -1
  35. package/support/revision.js +1 -1
  36. package/views/3d/environment/CloudyWeather.js +1 -1
  37. package/views/3d/environment/FoggyWeather.js +1 -1
  38. package/views/3d/environment/RainyWeather.js +1 -1
  39. package/views/3d/environment/SnowyWeather.js +1 -1
  40. package/views/3d/environment/SunnyWeather.js +1 -1
  41. package/views/3d/layers/I3SMeshView3D.js +1 -1
  42. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  43. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  44. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  45. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  46. package/views/3d/support/debugFlags.js +1 -1
  47. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  48. package/views/3d/support/hitTest.js +1 -1
  49. package/views/3d/support/intersectionHitUtils.js +2 -0
  50. package/views/3d/terrain/TerrainRenderer.js +1 -1
  51. package/views/3d/webgl-engine/Stage.js +1 -1
  52. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +12 -12
  53. package/views/3d/webgl-engine/collections/Component/UniformComponentParameters.js +1 -1
  54. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  55. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +2 -2
  56. package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +8 -0
  57. package/views/3d/webgl-engine/core/shaderLibrary/util/blendEmission.glsl.js +2 -0
  58. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  59. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  60. package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
  61. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  62. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  63. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  64. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  65. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  66. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  67. package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
  68. package/views/3d/webgl-engine/effects/glow/GlowComposite.glsl.js +2 -0
  69. package/views/3d/webgl-engine/effects/glow/GlowCompositeTechnique.js +2 -0
  70. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  71. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +1 -1
  72. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  73. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  74. package/views/3d/webgl-engine/effects/laserlines/Laserline.glsl.js +1 -1
  75. package/views/3d/webgl-engine/effects/laserlines/LaserlinePath.glsl.js +1 -1
  76. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  77. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
  78. package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechniqueConfiguration.js +1 -1
  79. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  80. package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
  81. package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +2 -0
  82. package/views/3d/webgl-engine/lib/EmissionComposite.js +2 -0
  83. package/views/3d/webgl-engine/lib/EmissionCompositeTechnique.js +2 -0
  84. package/views/3d/webgl-engine/lib/HUDIntersectorResult.js +1 -1
  85. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  86. package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
  87. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  88. package/views/3d/webgl-engine/lib/PolygonIntersectionResults.js +1 -1
  89. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  90. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  91. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  92. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  93. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  94. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  95. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  96. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  97. package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +2 -0
  98. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
  99. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  100. package/views/SceneView.d.ts +4 -3
  101. package/views/SceneView.js +1 -1
  102. package/views/support/TextureCompressionWorker.js +1 -1
  103. package/views/support/TextureCompressionWorkerHandle.js +1 -1
  104. package/views/webgl/Texture.js +1 -1
  105. package/assets/esri/core/workers/chunks/5b937c405788fd14be8b.js +0 -30
  106. package/assets/esri/core/workers/chunks/8a01fe8d78ca85ea4784.js +0 -1
  107. package/assets/esri/core/workers/chunks/a38a7e3a5aa9294ab918.js +0 -30
  108. package/assets/esri/core/workers/chunks/b75db3b1becf8265ec59.js +0 -30
  109. package/assets/esri/core/workers/chunks/ca419858910af5505d3d.js +0 -1
  110. package/chunks/GlowComposition.glsl.js +0 -39
  111. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +0 -9
  112. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +0 -2
  113. package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +0 -2
  114. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +0 -2
  115. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +0 -2
  116. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(w(e,i)!==w(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,i=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===i)return d;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,d=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=i[0]-P[0],X[1]=i[1]-P[1],X[2]=i[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||h(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==d.distance||n<d.distance)&&O(d,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o),e.results.all.push(p)):n<p.distance&&O(p,n,o)),(null==a.distance||n<a.distance)&&O(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&O(l,n,o)}},D=Y;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,D,R,S)}else C(X,D,0,U,B,I,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=!1,o.hasEmission=n,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=9===s;return o.receiveShadows=t.ready&&!r,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.receiveGlobalIllumination=!r&&i.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)O(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",d),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:d;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const h of c.values()){const i=h[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:h,bind:d}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(i),h.setPipelineState(t.getPipeline(d,this._passParameters)));const u=a.geometry.indexCount;h.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),h.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(w(e,i)!==w(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,i=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===i)return d;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,d=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=i[0]-P[0],X[1]=i[1]-P[1],X[2]=i[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||h(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==d.distance||n<d.distance)&&O(d,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o),e.results.all.push(p)):n<p.distance&&O(p,n,o)),(null==a.distance||n<a.distance)&&O(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&O(l,n,o)}},D=Y;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,D,R,S)}else C(X,D,0,U,B,I,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=!1,o.hasEmission=n,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=9===s;return o.receiveShadows=t.ready&&!r,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.receiveGlobalIllumination=!r&&i.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)O(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",d),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:d;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const h of c.values()){const i=h[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:h,bind:d}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(i),h.setPipelineState(t.getPipeline(d,this._passParameters)));const u=a.geometry.indexCount;h.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),h.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
@@ -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{removeUnordered as r}from"../../../core/arrayUtils.js";import{toConst as s}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{isPromiseLike as n}from"../../../core/promiseUtils.js";import{signal as o}from"../../../core/signal.js";import{property as d,subclass as h}from"../../../core/accessorSupport/decorators.js";import{isIntersectionHandler as a}from"../state/helpers/SceneIntersectionHelper.js";import{TextureCollection as l}from"../support/TextureCollection.js";import{ChangeSet as c}from"./lib/ChangeSet.js";import{Model as y}from"./parts/Model.js";import{RenderView as m}from"./parts/RenderView.js";import{TaskPriority as u,noBudget as _}from"../../support/Scheduler.js";import{Yield as p}from"../../support/Yield.js";let S=class extends t{constructor(e){super(e),this._model=new y,this._canCompact=o(!1),this._layers=new Array,this._asyncChangeSet=new c,this._syncChangeSet=new c,this._layerSyncSet=new Set,this._textures=new l(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(u.STAGE,this),this.addHandles(this._frameTask)}initialize(){try{this._renderView=new m({view:this.view},this)}catch(e){return void console.error("Failed to initialize render view",e)}}destroy(){this.removeAllHandles(),this._textures.destroy(),this._set("textures",null),this._renderView=i(this._renderView),this._set("renderView",null),this._layers.length=0,this._model=null,this._set("renderer",null),this.options.canvas=null,this._set("options",null)}get viewingMode(){return this.view.state.viewingMode}get updating(){return!this.destroyed&&!this.destroying&&(this.readyToRun||this.renderView.updating||this._frameTask.updating||this.textures.updating)}get renderView(){return this._renderView}get renderer(){return this.renderView?.renderer}get textures(){return this._textures}addTexture(e){this._model.addTexture(e),this.renderView.requestRender()}removeTexture(e){null!=e&&!this.destroyed&&this._model.hasTexture(e)&&(this._model.removeTexture(e),this.renderView.requestRender())}addTextures(e){null!=e&&(this._model.addTextures(e),this.renderView.requestRender())}removeTextures(e){null!=e&&(this._model?.removeTextures(e),this.renderView.requestRender())}forEachTexture(e){this._model.forEachTexture(e)}getTexture(e){return this._model.getTexture(e)}addLayer(e){this._layers.includes(e)||(this._model.addLayer(e),this._layers.push(e),this._model.dirtySet.layerAdded(e),this.renderView.requestRender())}removeLayer(e){null!=e&&!this.destroyed&&this._model.hasLayer(s(e))&&(this._model.dirtySet.layerRemoved(e),this.commitLayer(e),r(this._layers,e),this._model.dirtySet.assertLayerClean(e.id),this._model.removeLayer(e),this.renderView.requestRender())}getLayer(e){return this._model.getLayer(e)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get readyToRun(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return p}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||1===r.updatePolicy,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.commit(i,s?_:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(r=>{e.done||this._layerSyncSet.has(r.id)||0!==r.updatePolicy||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange("readyToRun")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forEach(t=>{this._layerSyncSet.has(t.id)||1===t.updatePolicy?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)});for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender())}commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}get layers(){return this._layers}addRenderPlugin(e,t){const r=this.renderer.plugins.add(e,t),s=()=>{a(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(n(r))return r.then(s);s()}removeRenderPlugin(e){this.destroyed||(a(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get test(){}};e([d({constructOnly:!0})],S.prototype,"view",void 0),e([d({constructOnly:!0})],S.prototype,"options",void 0),e([d({constructOnly:!0})],S.prototype,"container",void 0),e([d({readOnly:!0})],S.prototype,"viewingMode",null),e([d({readOnly:!0})],S.prototype,"updating",null),e([d({readOnly:!0})],S.prototype,"renderView",null),e([d({readOnly:!0})],S.prototype,"renderer",null),e([d({readOnly:!0})],S.prototype,"textures",null),e([d({readOnly:!0})],S.prototype,"readyToRun",null),S=e([h("esri.views.3d.webgl-engine.Stage")],S);export{S as Stage};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import{toConst as s}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{isPromiseLike as n}from"../../../core/promiseUtils.js";import{signal as o}from"../../../core/signal.js";import{property as d,subclass as a}from"../../../core/accessorSupport/decorators.js";import{isIntersectionHandler as h}from"../state/helpers/SceneIntersectionHelper.js";import{debugFlags as l}from"../support/debugFlags.js";import{TextureCollection as c}from"../support/TextureCollection.js";import{ChangeSet as y}from"./lib/ChangeSet.js";import{Model as m}from"./parts/Model.js";import{RenderView as u}from"./parts/RenderView.js";import{TaskPriority as p,noBudget as _}from"../../support/Scheduler.js";import{Yield as g}from"../../support/Yield.js";let S=class extends t{constructor(e){super(e),this._model=new m,this._canCompact=o(!1),this._layers=new Array,this._asyncChangeSet=new y,this._syncChangeSet=new y,this._layerSyncSet=new Set,this._textures=new c(this,e.view.resourceController.scheduler),this._frameTask=e.view.resourceController.scheduler.registerTask(p.STAGE,this),this.addHandles(this._frameTask)}initialize(){try{this._renderView=new u({view:this.view},this)}catch(e){return void console.error("Failed to initialize render view",e)}}destroy(){this.removeAllHandles(),this._textures.destroy(),this._set("textures",null),this._renderView=i(this._renderView),this._set("renderView",null),this._layers.length=0,this._model=null,this._set("renderer",null),this.options.canvas=null,this._set("options",null)}get viewingMode(){return this.view.state.viewingMode}get updating(){if(this.destroyed||this.destroying)return!1;const e=this.readyToRun||this.renderView.updating||this._frameTask.updating||this.textures.updating;return e&&l.UPDATING&&console.log(" Stage:",this.readyToRun,this.renderView.updating,this._frameTask.updating,this.textures.updating),e}get renderView(){return this._renderView}get renderer(){return this.renderView?.renderer}get textures(){return this._textures}addTexture(e){this._model.addTexture(e),this.renderView.requestRender()}removeTexture(e){null!=e&&!this.destroyed&&this._model.hasTexture(e)&&(this._model.removeTexture(e),this.renderView.requestRender())}addTextures(e){null!=e&&(this._model.addTextures(e),this.renderView.requestRender())}removeTextures(e){null!=e&&(this._model?.removeTextures(e),this.renderView.requestRender())}forEachTexture(e){this._model.forEachTexture(e)}getTexture(e){return this._model.getTexture(e)}addLayer(e){this._layers.includes(e)||(this._model.addLayer(e),this._layers.push(e),this._model.dirtySet.layerAdded(e),this.renderView.requestRender())}removeLayer(e){null!=e&&!this.destroyed&&this._model.hasLayer(s(e))&&(this._model.dirtySet.layerRemoved(e),this.commitLayer(e),r(this._layers,e),this._model.dirtySet.assertLayerClean(e.id),this._model.removeLayer(e),this.renderView.requestRender())}getLayer(e){return this._model.getLayer(e)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get readyToRun(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty||this._canCompact.value}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),this.renderer.compact(e),this._canCompact.value=this.renderer.canCompact,!e.hasProgressed)return g}compact(e){return this._canCompact.value=!1,this.renderer.compact(e)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||1===r.updatePolicy,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.commit(i,s?_:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender(),e.madeProgress()),this._layers.forEach(r=>{e.done||this._layerSyncSet.has(r.id)||0!==r.updatePolicy||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.commit(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange("readyToRun")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forEach(t=>{this._layerSyncSet.has(t.id)||1===t.updatePolicy?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)});for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender())}commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.commit(this._syncChangeSet,_),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}get layers(){return this._layers}addRenderPlugin(e,t){const r=this.renderer.plugins.add(e,t),s=()=>{h(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(n(r))return r.then(s);s()}removeRenderPlugin(e){this.destroyed||(h(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get test(){}};e([d({constructOnly:!0})],S.prototype,"view",void 0),e([d({constructOnly:!0})],S.prototype,"options",void 0),e([d({constructOnly:!0})],S.prototype,"container",void 0),e([d({readOnly:!0})],S.prototype,"viewingMode",null),e([d({readOnly:!0})],S.prototype,"updating",null),e([d({readOnly:!0})],S.prototype,"renderView",null),e([d({readOnly:!0})],S.prototype,"renderer",null),e([d({readOnly:!0})],S.prototype,"textures",null),e([d({readOnly:!0})],S.prototype,"readyToRun",null),S=e([a("esri.views.3d.webgl-engine.Stage")],S);export{S as Stage};
@@ -1,16 +1,16 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{DecodeSymbolColor as o}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as e}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{Float4DrawUniform as r}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as t}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as n,If as d}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as a}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as l}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{olidEnabled as i}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as s,componentDataOlidLayout as c}from"../../../materials/DefaultLayouts.js";import{floatBlendScale as u}from"../../../shaders/floatBlendScale.glsl.js";function m(o,e){switch(e.componentDataType){case 1:return p(o,e);case 0:return M(o,e);case 2:return;default:e.componentDataType}}const f=new l("componentTextureBuffer",o=>o.textureBackedBuffer?.texture),v=new e({layout:s,itemIndexExpression:"componentIndex",bufferUniform:f}),x=new e({layout:c,itemIndexExpression:"componentIndex",bufferUniform:f});function C(){return i()?x:v}function p(e,r){const{vertex:t,fragment:a}=e,{output:l,hasEmission:i}=r,s=11===l,c=C().createBuilder(e,r);e.attributes.add("componentIndex","uint"),e.varyings.add("vExternalColorMixMode","mediump float"),e.varyings.add("vExternalColor","vec4"),s&&e.varyings.add("vObjectAndLayerIdColor","vec4"),i&&(e.varyings.add("emissiveStrength","float"),e.varyings.add("emissiveSource","int")),e.include(o),t.include(u,r),t.code.add(n`
2
+ import{__decorate as o}from"tslib";import{DecodeSymbolColor as e}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as r}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{EmissionsConfiguration as t,hasEmissiveStrengthFromUniform as n}from"../../../core/shaderLibrary/output/getEmissions.glsl.js";import{Float4DrawUniform as a}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as d}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as l,If as i}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as s}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as c}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{parameter as u}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{olidEnabled as m}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as f,componentDataOlidLayout as v}from"../../../materials/DefaultLayouts.js";import{floatBlendScale as x}from"../../../shaders/floatBlendScale.glsl.js";class C extends t{constructor(){super(...arguments),this.componentDataType=0}}function p(o,e){switch(e.componentDataType){case 1:return b(o,e);case 0:case 2:return y(o,e);default:e.componentDataType}}o([u({count:2})],C.prototype,"componentDataType",void 0);const h=new c("componentTextureBuffer",o=>o.textureBackedBuffer?.texture),g=new r({layout:f,itemIndexExpression:"componentIndex",bufferUniform:h}),M=new r({layout:v,itemIndexExpression:"componentIndex",bufferUniform:h});function w(){return m()?M:g}function b(o,r){const{vertex:t,fragment:a}=o,{output:d,hasEmission:s}=r,c=11===d,u=w().createBuilder(o,r);o.attributes.add("componentIndex","uint"),o.varyings.add("vExternalColorMixMode","mediump float"),o.varyings.add("vExternalColor","vec4"),c&&o.varyings.add("vObjectAndLayerIdColor","vec4");const m=s&&!n(r);m&&(o.varyings.add("emissiveStrength","float"),o.varyings.add("emissiveSource","int")),o.include(e),t.include(x,r),t.code.add(l`
3
3
  float readElevationOffset() {
4
- return ${c.getTextureAttribute("elevationOffset")};
4
+ return ${u.getTextureAttribute("elevationOffset")};
5
5
  }
6
6
 
7
7
  void forwardEmissiveStrength() {
8
- ${d(i,n`emissiveStrength = clamp(${c.getTextureAttribute("emissiveStrength")}, 0.0, maxEmissiveStrength);
9
- emissiveSource = ${c.getTextureAttribute("emissiveSourceMode")} == 0u ? 0 : 1;`)}
8
+ ${i(m,l`emissiveStrength = clamp(${u.getTextureAttribute("emissiveStrength")}, 0.0, maxEmissiveStrength);
9
+ emissiveSource = ${u.getTextureAttribute("emissiveSourceMode")} == 0u ? 0 : 1;`)}
10
10
  }
11
11
 
12
12
  void forwardObjectAndLayerIdColor() {
13
- ${d(s,n`vObjectAndLayerIdColor = vec4(${c.getTextureAttribute("olidColor")})/255.0;`)}
13
+ ${i(c,l`vObjectAndLayerIdColor = vec4(${u.getTextureAttribute("olidColor")})/255.0;`)}
14
14
  }
15
15
 
16
16
  void decodeColorAndCastShadow(uvec4 colorAndCastShadowEncoded, out vec4 color, out bool castShadow) {
@@ -22,7 +22,7 @@ import{DecodeSymbolColor as o}from"./DecodeSymbolColor.glsl.js";import{TextureBa
22
22
 
23
23
  vec4 forwardExternalColor(out bool castShadows) {
24
24
  vec4 componentColor;
25
- decodeColorAndCastShadow(${c.getTextureAttribute("colorAndCastShadows")}, componentColor, castShadows);
25
+ decodeColorAndCastShadow(${u.getTextureAttribute("colorAndCastShadows")}, componentColor, castShadows);
26
26
 
27
27
  int decodedColorMixMode;
28
28
  vExternalColor = decodeSymbolColor(componentColor, decodedColorMixMode) * 0.003921568627451; // = 1/255;
@@ -30,16 +30,16 @@ import{DecodeSymbolColor as o}from"./DecodeSymbolColor.glsl.js";import{TextureBa
30
30
 
31
31
  return vExternalColor;
32
32
  }
33
- `),a.code.add(n`
33
+ `),a.code.add(l`
34
34
  void readExternalColor(out vec4 externalColor, out int externalColorMixMode) {
35
35
  externalColor = vExternalColor;
36
36
  externalColorMixMode = int(vExternalColorMixMode);
37
37
  }
38
38
 
39
39
  void outputObjectAndLayerIdColor() {
40
- ${s?n`fragColor = vObjectAndLayerIdColor;`:""}
40
+ ${c?l`fragColor = vObjectAndLayerIdColor;`:""}
41
41
  }
42
- `)}function M(o,e){const{vertex:l,fragment:i}=o;o.varyings.add("vExternalColor","vec4"),i.uniforms.add(new t("emissiveStrength",o=>o.componentParameters.emissiveStrength)),l.uniforms.add(new r("externalColor",o=>o.componentParameters.externalColor)).code.add(n`float readElevationOffset() {
42
+ `)}function y(o,e){const{vertex:r,fragment:t}=o;o.varyings.add("vExternalColor","vec4"),t.uniforms.add(new d("emissiveStrength",o=>o.componentParameters.emissiveStrength)),r.uniforms.add(new a("externalColor",o=>o.componentParameters.externalColor)).code.add(l`float readElevationOffset() {
43
43
  return 0.0;
44
44
  }
45
45
  void forwardObjectAndLayerIdColor() {}
@@ -48,13 +48,13 @@ vec4 forwardExternalColor(out bool castShadows) {
48
48
  vExternalColor = externalColor;
49
49
  castShadows = true;
50
50
  return externalColor;
51
- }`);const s=11===e.output;i.uniforms.add(new a("externalColorMixMode",o=>o.componentParameters.externalColorMixMode)).code.add(n`
51
+ }`);const n=11===e.output;t.uniforms.add(new s("externalColorMixMode",o=>o.componentParameters.externalColorMixMode)).code.add(l`
52
52
  void readExternalColor(out vec4 color, out int colorMixMode) {
53
53
  color = vExternalColor;
54
54
  colorMixMode = externalColorMixMode;
55
55
  }
56
56
 
57
57
  void outputObjectAndLayerIdColor() {
58
- ${d(s,"fragColor = vec4(0, 0, 0, 0);")}
58
+ ${i(n,"fragColor = vec4(0, 0, 0, 0);")}
59
59
  }
60
- `)}export{m as ComponentData};
60
+ `)}export{p as ComponentData,C as ComponentDataConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{emissiveStrengthDefault as t}from"../../core/shaderLibrary/output/Emissions.glsl.js";class i{constructor(){this.externalColor=s(),this.externalColorMixMode=1,this.castShadows=!0,this.pickable=!0,this.elevationOffset=0,this.emissiveStrength=t,this.emissiveSource=0}}export{i as UniformComponentParameters};
2
+ import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{emissiveStrengthDefault as t}from"../../core/shaderLibrary/output/getEmissions.glsl.js";class e{constructor(){this.externalColor=s(),this.externalColorMixMode=1,this.castShadows=!0,this.pickable=!0,this.elevationOffset=0,this.emissiveStrength=t,this.emissiveSource=0}}export{e as UniformComponentParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as t}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as r,DepthTextureFormats as h,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOCacheUsage as s}from"./FBOCacheUsage.js";import{FBOPool as o}from"./FBOPool.js";import{DepthStencilAttachment as n,ColorAttachment0 as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import m from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new s,this._acquired=new Set,this._cache=new o(e.newCache,"FBOCache"),this._colorCache=new o(e.newCache,"ColorAttachmentCache"),this._depthCache=new o(e.newCache,"DepthAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){this.debugCallback&&(this._usage.summarize(),this._acquired.forEach(e=>this.debugCallback?.(e.name,e.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,t)=>e+t.usedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(e,t,h,i=5){const s=p(i,e,t);let o=this._cache.pop(s);const{rctx:m}=this;if(o){o.retain(),o.setName(h);const e=o.getAttachment(n);e&&(e.name=C);const t=o.getAttachment(l);t&&(t.name=_(0)),m.unbindTexture(o.fbo.colorTexture)}else{const r=new u(m),d=(a,c,r)=>{c??=5;const h=this._acquireColor(c,e,t,r??_(a-l));return this.rctx.unbindTexture(h.attachment),o.attachColor(h,a),h.release(),o},p=a=>{a??=14;const c=this.acquireDepth(a,e,t,`${o.name} ${C}`);return o.attachDepth(c),c.release(),o},f=()=>{if(!o)return;this.debugCallback?.(o.name,o.fbo),this._acquired.delete(o);const e=c(i);e&&null!=o.getAttachment(n)||!e&&null!=o.getAttachment(l)?(e?(o.fbo?.invalidateAttachments([n]),o.detachAllColors()):(o.fbo?.invalidateAttachments([l]),o.detachAllButColor0()),this._trackRelease(o),this._cache.put(o)):o.dispose()};o=new a(s,h,r,d,p,f),c(i)?o.acquireDepth(i):o.acquireColor(l,i)}return this._trackAcquire(o,"f "+r(i),e,t),this._trackHandle(o)}acquireDepth(e,a,c,i){const s=p(e,a,c);let o=this._depthCache.pop(s);if(o)o.retain(),o.attachment.setShadowFiltering(!1);else{const r=new m(this.rctx,{...h[e],width:a,height:c});o=new t(s,r,()=>{this._trackRelease(o),this._depthCache.put(o)})}return o.name=i,this._trackAcquire(o,"d "+r(e),a,c),o}_acquireColor(t,a,c,h){const s=p(t,a,c);let o=this._colorCache.pop(s);if(o)o.retain();else{const r=new m(this.rctx,{...i[t],width:a,height:c,isImmutable:!0});o=new e(s,r,()=>{this._trackRelease(o),this._colorCache.put(o)})}return o.name=h,this._trackAcquire(o,"c "+r(t),a,c),o}_trackHandle(e){return this._acquired.add(e),e}_trackAcquire(e,t,a,c){this.debugCallback&&this._usage.add(e,t,a,c)}_trackRelease(e){this.debugCallback&&this._usage.remove(e)}}function _(e=0){return`color${e}`}const C="depth";function p(e,t,a){return`${t}x${a}:${e}`}export{d as FBOCache};
2
+ import e from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as t}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{isDepthFormat as c,formatString as r,DepthTextureFormats as h,ColorFormats as i}from"./FBOCacheFormats.js";import{FBOCacheUsage as s}from"./FBOCacheUsage.js";import{FBOPool as o}from"./FBOPool.js";import{DepthStencilAttachment as n,ColorAttachment0 as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import m from"../../../webgl/Texture.js";class d{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new s,this._acquired=new Set,this._cache=new o(e.newCache,"FBOCache"),this._colorCache=new o(e.newCache,"ColorAttachmentCache"),this._depthCache=new o(e.newCache,"DepthAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){this.debugCallback&&(this._usage.summarize(),this._acquired.forEach(e=>this.debugCallback?.(e.name,e.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,t)=>e+t.usedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(e,t,h,i=5){const s=p(i,e,t);let o=this._cache.pop(s);const{rctx:m}=this;if(o){o.retain(),o.setName(h);const e=o.getAttachment(n);e&&(e.name=C);const t=o.getAttachment(l);t&&(t.name=_(0)),m.unbindTexture(o.fbo.colorTexture)}else{const r=new u(m),d=(a,c,r)=>{c??=5,r??=_(a-l);const h=this._acquireColor(c,e,t,r);return this.rctx.unbindTexture(h.attachment),o.attachColor(h,a),h.release(),o},p=a=>{a??=14;const c=this.acquireDepth(a,e,t,`${o.name} ${C}`);return o.attachDepth(c),c.release(),o},f=()=>{if(!o)return;this.debugCallback?.(o.name,o.fbo),this._acquired.delete(o);const e=c(i);e&&null!=o.getAttachment(n)||!e&&null!=o.getAttachment(l)?(e?(o.fbo?.invalidateAttachments([n]),o.detachAllColors()):(o.fbo?.invalidateAttachments([l]),o.detachAllButColor0()),this._trackRelease(o),this._cache.put(o)):o.dispose()};o=new a(s,h,r,d,p,f),c(i)?o.acquireDepth(i):o.acquireColor(l,i)}return this._trackAcquire(o,"f "+r(i),e,t),this._trackHandle(o)}acquireDepth(e,a,c,i){const s=p(e,a,c);let o=this._depthCache.pop(s);if(o)o.retain(),o.attachment.setShadowFiltering(!1);else{const r=new m(this.rctx,{...h[e],width:a,height:c});o=new t(s,r,()=>{this._trackRelease(o),this._depthCache.put(o)})}return o.name=i,this._trackAcquire(o,"d "+r(e),a,c),o}_acquireColor(t,a,c,h){const s=p(t,a,c);let o=this._colorCache.pop(s);if(o)o.retain();else{const r=new m(this.rctx,{...i[t],width:a,height:c,isImmutable:!0});o=new e(s,r,()=>{this._trackRelease(o),this._colorCache.put(o)})}return o.name=h,this._trackAcquire(o,"c "+r(t),a,c),o}_trackHandle(e){return this._acquired.add(e),e}_trackAcquire(e,t,a,c){this.debugCallback&&this._usage.add(e,t,a,c)}_trackRelease(e){this.debugCallback&&this._usage.remove(e)}}function _(e=0){return`color${e}`}const C="depth";function p(e,t,a){return`${t}x${a}:${e}`}export{d as FBOCache};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import{glsl as i}from"../shaderModules/glsl.js";function o(o,t=!0){o.attributes.add("position","vec2"),t&&o.varyings.add("uv","vec2"),o.vertex.main.add(i`
3
- gl_Position = vec4(position, 0.0, 1.0);
4
- ${t?i`uv = position * 0.5 + vec2(0.5);`:""}
3
+ gl_Position = vec4(position, 0.0, 1.0);
4
+ ${t?i`uv = position * 0.5 + vec2(0.5);`:""}
5
5
  `)}export{o as ScreenSpacePass};
@@ -0,0 +1,8 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{clamp as s}from"../../../../../../core/mathUtils.js";import{isColor as o}from"../ShaderOutput.js";import{ShaderOutputConfiguration as i}from"../ShaderOutputConfiguration.js";import{VertexTextureCoordinates as r}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as m}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as t}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as n}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as d}from"../../shaderModules/FloatPassUniform.js";import{glsl as c}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as u}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as v}from"../../shaderModules/Texture2DPassUniform.js";import{parameter as l}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";import{floatBlendReductionFactor as f}from"../../../shaders/floatBlendScale.glsl.js";const p=1;class h extends i{constructor(){super(...arguments),this.emissionSource=0}}function x(e,i){const{hasEmission:l,emissionSource:p,hasEmissiveTextureTransform:h,bindType:x}=i;if(!o(i.output)||!l)return;const S=e.fragment;S.include(m);const T=3===p||4===p||5===p;T&&(e.include(r,i),S.uniforms.add(1===x?new v("texEmission",e=>e.textureEmissive):new u("texEmission",e=>e.textureEmissive)));const j=2===p||T;if(j&&S.uniforms.add(1===x?new a("emissiveBaseColor",e=>e.emissiveBaseColor):new t("emissiveBaseColor",e=>e.emissiveBaseColor)),l&&g(i)){const e=e=>s(e??0,0,f);S.uniforms.add(1===x?new d("emissiveStrength",s=>e(s.emissiveStrength)):new n("emissiveStrength",s=>e(s.emissiveStrength)))}const C=7===p,b=5===p,E=1===p||6===p||C;S.code.add(c`vec4 getEmissions(vec3 symbolColor) {
3
+ vec4 emissions =`),j?b?S.code.add("emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(emissiveBaseColor, 1.0)"):E?C?S.code.add("emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(linearizeGamma(symbolColor), 1.0)"):S.code.add("vec4(0.0)"),S.code.add(";"),T&&(b?S.code.add(c`
4
+ if(emissiveSource == 0) {
5
+ vec4 emissiveFromTex = textureLookup(texEmission, ${h?"emissiveUV":"vuv0"});
6
+ emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);
7
+ }
8
+ `):S.code.add(`vec4 emissiveFromTex = textureLookup(texEmission, ${h?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`),S.code.add("emissions.a = emissions.rgb == vec3(0.0) ? 0.0: emissions.a;")),l&&S.code.add("emissions.rgb *= emissiveStrength;"),S.code.add("return emissions;}")}function g({emissionSource:e}){return 0===e||1===e||2===e||3===e}e([l({count:8})],h.prototype,"emissionSource",void 0),e([l()],h.prototype,"hasEmissiveTextureTransform",void 0);export{h as EmissionsConfiguration,p as emissiveStrengthDefault,x as getEmissions,g as hasEmissiveStrengthFromUniform};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function a(a,i){i.hasEmissive&&(a.outputs.add("fragEmission","vec4",1),a.fragment.main.add("fragEmission = vec4(vec3(0.0), fragColor.a);"))}export{a as blendEmission};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as a}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as c}from"../../../../../geometry/support/Ellipsoid.js";import{OpaqueEnvironment as d}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as u,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as f,ChapmanAtmosphereTechnique as b}from"./ChapmanAtmosphereTechnique.js";import{createQuadVAO as g}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as _}from"../../lib/textureUtils.js";import{A as P}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as w}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as v,ColorAttachment0 as j,PrimitiveType as A}from"../../../../webgl/enums.js";import x from"../../../../../webscene/background/ColorBackground.js";let C=class extends d{constructor(){super(...arguments),this._compositingPassParameters=new P,this._vao=null,this._passParameters=new f}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof x?e.color.toUnitRGBA():p;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._passParameters.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??p,this.requestRender(1)},a),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}render(){const e=this.input;if(!this.bindParameters.mainDepth)return e;const r=this.renderingContext;this._vao??=g(r,1);const s=e.getAttachment(v);this._update();const i=this.techniques.getCompiled(b),a=this.techniques.getCompiled(w);if(!i||!a)return this.requestRender(1),e;if(!this._passParameters.reduced)return e.detachDepth(),r.bindFramebuffer(e.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),r.setDrawBuffers([j]),r.bindVAO(this._vao),r.drawArrays(A.TRIANGLE_STRIP,0,4),e.attachDepth(s),e;const o=r.getViewport(),n=this.bindParameters.camera,m=h(n.eye)-c.radius;let p;const d=c.atmosphereHeight;if(m<d){const e=Math.min(1,Math.max(0,m/d));p=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(m-d)/(15*d)));p=t(.3,.6,e)}const u=this.renderingContext.parameters.maxTextureSize,l=_(Math.round(p*n.fullViewport[2]),u),f=_(Math.round(p*n.fullViewport[3]),u);r.setViewport(0,0,l,f);const P=this.fboCache.acquire(l,f,"chapman",5);return r.bindFramebuffer(P.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(A.TRIANGLE_STRIP,0,4),r.setViewport(o.x,o.y,o.width,o.height),this._compositingPassParameters.color=P.getTexture(),e.detachDepth(),r.bindFramebuffer(e.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.setDrawBuffers([j]),r.screen.draw(),e.attachDepth(s),P.release(),e}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+c.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=u(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};C=e([o("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],C);export{C as ChapmanAtmosphere};
2
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as a}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as c}from"../../../../../geometry/support/Ellipsoid.js";import{OpaqueEnvironment as d}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as u,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as f,ChapmanAtmosphereTechnique as b}from"./ChapmanAtmosphereTechnique.js";import{createQuadVAO as g}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as _}from"../../lib/textureUtils.js";import{A as P}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as w}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as v,ColorAttachment0 as j,PrimitiveType as A}from"../../../../webgl/enums.js";import x from"../../../../../webscene/background/ColorBackground.js";let C=class extends d{constructor(){super(...arguments),this._compositingPassParameters=new P,this._vao=null,this._passParameters=new f}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof x?e.color.toUnitRGBA():p;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._passParameters.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??p,this.requestRender(1)},a),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}render(){const e=this.input;if(!this.bindParameters.mainDepth)return e;const r=this.renderingContext;this._vao??=g(r,1);const s=e.getAttachment(v);this._update();const i=this.techniques.getCompiled(b),a=this.techniques.getCompiled(w);if(!i||!a)return this.requestRender(1),e;if(!this._passParameters.reduced)return e.detachDepth(),r.bindFramebuffer(e.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),r.setDrawBuffers([j]),r.bindVAO(this._vao),r.drawArrays(A.TRIANGLE_STRIP,0,4),e.attachDepth(s),e;const o=r.getViewport(),n=this.bindParameters.camera,m=h(n.eye)-c.radius;let p;const d=c.atmosphereHeight;if(m<d){const e=Math.min(1,Math.max(0,m/d));p=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(m-d)/(15*d)));p=t(.3,.6,e)}const u=this.renderingContext.parameters.maxTextureSize,l=_(Math.round(p*n.fullViewport[2]),u),f=_(Math.round(p*n.fullViewport[3]),u);r.setViewport(0,0,l,f);const P=this.fboCache.acquire(l,f,"chapman");return r.bindFramebuffer(P.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(A.TRIANGLE_STRIP,0,4),r.setViewport(o.x,o.y,o.width,o.height),this._compositingPassParameters.color=P.getTexture(),e.detachDepth(),r.bindFramebuffer(e.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.setDrawBuffers([j]),r.screen.draw(),e.attachDepth(s),P.release(),e}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+c.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=u(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};C=e([o("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],C);export{C as ChapmanAtmosphere};
@@ -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 r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{If as s,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as l}from"../../shaders/floatBlendScale.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as d,DataType as f}from"../../../../webgl/enums.js";let m=class extends a{constructor(e){super(e),this.destroyedCB=null,this.consumes={required:[i.FINAL]},this.produces=i.FINAL,this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(){const e=this.input;if(!this._focusedTexture)return e;const r=this.renderingContext,t=r.boundFramebuffer;r.bindFramebuffer(e.fbo),r.setClearColor(0,0,0,0),r.clear(16384);const o=this._focusedTexture.attachment,n=[g(o)],i=this._ensureProgram(r,!1,n);return r.useProgram(i),r.bindTexture(o,0),i.setUniform1i("colorTex0",0),i.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&i.setUniform2fv("nearFar",this.camera.nearFar),r.setDrawBuffers([p]),r.screen.draw(),r.bindFramebuffer(t),e}getDownscaledFBO(e,r,t,o,n,i){if(n?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;t=e.width*r,o=e.height*r}else i=null;const a="linear depth"===r||r.includes("shadow"),s="overlay highlight"===r||"highlights"===r||"highlight mix"===r,c="highlight coverage"===r,u=e.colorTexture?.descriptor,l=u?.internalFormat,f=[],m=new Array,v=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);f.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),m[t]=!0)}if(t>0){const e=o?.descriptor.internalFormat;return void(e===d.RGBA8&&(o?.debugName?.indexOf("emissive")??-1)>=0?v.push(8):v.push(T(e)))}v.push(a?0:s?1:c?2:i??T(l))});const x=this.renderingContext,{depthStencilTexture:$}=e,b=this._ensureProgram(x,null!=$,f,e.level),C=this.fboCache.acquire(t,o,"fbo visualizer");x.useProgram(b);const R=x.boundFramebuffer;x.bindFramebuffer(C.fbo);const y=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;x.bindTexture(e.getColorTexture(r),t),b.setUniform1i(o,t),t>0&&C.acquireColor(p+t,5,"fbo visualizer"),y.push(r)});const w=$?.descriptor.linearFilterDepth??!1;if($){const r=e.colorAttachments.length;$.setShadowFiltering(!1),x.bindTexture($,r),b.setUniform1i("depthTex",r);const t=p+r;t>p&&C.acquireColor(t,5,"fbo visualizer"),y.push(t)}x.gl.drawBuffers(y),h(x.gl);const B=x.getViewport();return x.setViewport(0,0,t,o),x.setClearColor(0,0,0,0),x.clear(16384),x.setBlendingEnabled(!0),x.setBlendFunction(1,771),b.setUniform1iv("inputTypes",v.length>0?v:[7]),b.setUniform2fv("nearFar",this.camera.nearFar),x.screen.draw(),h(x.gl),x.bindFramebuffer(R),x.setViewport(B.x,B.y,B.width,B.height),e.colorAttachments.forEach((t,o)=>{const i=e.getColorTexture(t);m[o]&&i?.clearMipmap(),n===F(r,e,t,!1)&&(this._focusedTexture?.release(),this._focusedTexture=C.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===v[o]?T(i?.descriptor.internalFormat):v[o])}),$&&$.setShadowFiltering(w),C}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),a=this.fboCache.acquire(e,r,"fbo visualizer"),s=n.boundFramebuffer;n.bindFramebuffer(a?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const u=t.attachment,l=this._ensureProgram(n,!1,[g(u)]);n.useProgram(l),n.bindTexture(u,0),l.setUniform1i("colorTex0",0),l.setUniform1iv("inputTypes",[i||u.descriptor.internalFormat!==d.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,f.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(s),n.setViewport(c.x,c.y,c.width,c.height),a?.release(),p}_ensureProgram(e,r,t,o=0){const n=x({hasDepthAttachment:r,colorSamplerTypes:t,level:o}),i=this._programs.get(n);if(i)return i;const a="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${v(o)} colorTex${c.int(t)};`}return r},p=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${o}).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}).rgb, 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o})) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv * texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t}, iuv, 0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}));\n fragColor${t}.rgb *= ${l.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${o}).a), 1.0);\n } else {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}));\n }\n }`,""),d=t.length,f=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${s(r,`layout(location = ${c.int(d)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n vec4 readTexture(sampler2D tex, vec2 uv, int lod) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(tex, lod)));\n return texelFetch(tex, iuv, lod);\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${p(t)}\n ${s(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,m=e.programCache.get(a,f,u);return this._programs.set(n,m),m}};function v(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function g(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case d.R8I:case d.R16I:case d.R32I:case d.RG8I:case d.RG16I:case d.RG32I:case d.RGB8I:case d.RGB16I:case d.RGB32I:case d.RGBA8I:case d.RGBA16I:case d.RGBA32I:return"int";case d.R8UI:case d.R16UI:case d.R32UI:case d.RG8UI:case d.RG16UI:case d.RG32UI:case d.RGB8UI:case d.RGB16UI:case d.RGB32UI:case d.RGBA8UI:case d.RGBA16UI:case d.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t,level:o}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")} ${o}`}function T(e){switch(e){case d.R16F:case d.R32F:case d.R8:return 3;case d.RG8:return 4;case d.RGBA16F:return 5;case d.RG8UI:return 6;default:return 7}}function F(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${$(r,t)}`}function $(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,F as getAttachmentName};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as l}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as u}from"../../shaders/floatBlendScale.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as d,DataType as f}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.consumes={required:[i.FINAL]},this.produces=i.FINAL,this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(){const e=this.input;if(!this._focusedTexture)return e;const r=this.renderingContext,t=r.boundFramebuffer;r.bindFramebuffer(e.fbo),r.setClearColor(0,0,0,0),r.clear(16384);const o=this._focusedTexture.attachment,n=[g(o)],i=this._ensureProgram(r,!1,n);return r.useProgram(i),r.bindTexture(o,0),i.setUniform1i("colorTex0",0),i.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&i.setUniform2fv("nearFar",this.camera.nearFar),r.setDrawBuffers([p]),r.screen.draw(),r.bindFramebuffer(t),e}getDownscaledFBO(e,r,t,o,n,i){if(n?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;t=e.width*r,o=e.height*r}else i=null;const s="linear depth"===r||r.includes("shadow"),a="overlay highlight"===r||"highlights"===r||"highlight mix"===r,c="highlight coverage"===r,l=e.colorTexture?.descriptor,u=l?.internalFormat,f=[],m=new Array,v=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);f.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),m[t]=!0)}if(t>0){const e=o?.descriptor.internalFormat;return void(e===d.RGBA8&&(o?.debugName?.indexOf("emissive")??-1)>=0?v.push(8):v.push(T(e)))}v.push(s?0:a?1:c?2:i??T(u))});const x=this.renderingContext,{depthStencilTexture:$}=e,b=this._ensureProgram(x,null!=$,f,e.level),C=this.fboCache.acquire(t,o,"fbo visualizer");x.useProgram(b);const y=x.boundFramebuffer;x.bindFramebuffer(C.fbo);const R=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;x.bindTexture(e.getColorTexture(r),t),b.setUniform1i(o,t),t>0&&C.acquireColor(p+t,5,"fbo visualizer"),R.push(r)});const w=$?.descriptor.linearFilterDepth??!1;if($){const r=e.colorAttachments.length;$.setShadowFiltering(!1),x.bindTexture($,r),b.setUniform1i("depthTex",r);const t=p+r;t>p&&C.acquireColor(t,5,"fbo visualizer"),R.push(t)}x.gl.drawBuffers(R),h(x.gl);const B=x.getViewport();return x.setViewport(0,0,t,o),x.setClearColor(0,0,0,0),x.clear(16384),x.setBlendingEnabled(!0),x.setBlendFunction(1,771),b.setUniform1iv("inputTypes",v.length>0?v:[7]),b.setUniform2fv("nearFar",this.camera.nearFar),x.screen.draw(),h(x.gl),x.bindFramebuffer(y),x.setViewport(B.x,B.y,B.width,B.height),e.colorAttachments.forEach((t,o)=>{const i=e.getColorTexture(t);m[o]&&i?.clearMipmap(),n===F(r,e,t,!1)&&(this._focusedTexture?.release(),this._focusedTexture=C.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===v[o]?T(i?.descriptor.internalFormat):v[o])}),$&&$.setShadowFiltering(w),C}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer"),a=n.boundFramebuffer;n.bindFramebuffer(s?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const l=t.attachment,u=this._ensureProgram(n,!1,[g(l)]);n.useProgram(u),n.bindTexture(l,0),u.setUniform1i("colorTex0",0),u.setUniform1iv("inputTypes",[i||l.descriptor.internalFormat!==d.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,f.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(a),n.setViewport(c.x,c.y,c.width,c.height),s?.release(),p}_ensureProgram(e,r,t,o=0){const n=x({hasDepthAttachment:r,colorSamplerTypes:t,level:o}),i=this._programs.get(n);if(i)return i;const s="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${v(o)} colorTex${c.int(t)};`}return r},p=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${o}).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n // Currently only emissive glow uses mipmap levels - and it doubles the energy on each level.\n // Correct this for display. In the future when there are other mipmaps implement this cleaner.\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}).rgb / pow(2.0, ${o}.0), 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o})) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv * texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t}, iuv, 0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}));\n fragColor${t}.rgb *= ${u.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${o}).a), 1.0);\n } else {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${o}));\n }\n }`,""),d=t.length,f=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${a(r,`layout(location = ${c.int(d)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n vec4 readTexture(sampler2D tex, vec2 uv, int lod) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(tex, lod)));\n return texelFetch(tex, iuv, lod);\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${p(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,m=e.programCache.get(s,f,l);return this._programs.set(n,m),m}};function v(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function g(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case d.R8I:case d.R16I:case d.R32I:case d.RG8I:case d.RG16I:case d.RG32I:case d.RGB8I:case d.RGB16I:case d.RGB32I:case d.RGBA8I:case d.RGBA16I:case d.RGBA32I:return"int";case d.R8UI:case d.R16UI:case d.R32UI:case d.RG8UI:case d.RG16UI:case d.RG32UI:case d.RGB8UI:case d.RGB16UI:case d.RGB32UI:case d.RGBA8UI:case d.RGBA16UI:case d.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t,level:o}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")} ${o}`}function T(e){switch(e){case d.R16F:case d.R32F:case d.R8:return 3;case d.RG8:return 4;case d.RGBA16F:return 5;case d.RG8UI:return 6;default:return 7}}function F(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${$(r,t)}`}function $(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,F as getAttachmentName};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as i}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as o}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{ColorAttachment0 as m}from"../../../../webgl/enums.js";let u=class extends a{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._fadeDirection=0,this._passParameters=new n}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(t(()=>this._passParameters.fadeFactor.value,t=>{0===t&&(this.removeAllHandles(),e())})),this.requestRender(2)}render(e){const t=this.input,r=this.techniques.getCompiled(c);if(!r)return this.requestRender(1),t;const s=this.focusAreasView.style,a=this.bindParameters;this._startTime??=this.view.stage?.renderer.renderContext.time;const n=this.view.qualitySettings.fadeDuration,u=n>0?Math.min(n,this.view.stage?.renderer.renderContext.time-this._startTime)/n:1,h=e.find(({name:e})=>e===o.FOCUSAREA),f=this.renderingContext,l="bright"===s;this._passParameters.color=l?t.getTexture():f.emptyTexture,this._passParameters.focusArea=h.getTexture(),this._passParameters.effect=d[s],this._passParameters.fadeFactor.value=0===this._fadeDirection?u:1-u;const p=a.camera,A=p.fullViewport[2],w=p.fullViewport[3],g=l?this.fboCache.acquire(A,w,this.produces).moveAttachments(t):t;return f.bindFramebuffer(g.fbo),l&&f.clearBuffer(0,i),f.bindTechnique(r,a,this._passParameters),f.setDrawBuffers([m]),f.screen.draw(),u<1&&this.requestRender(2),g}};e([r()],u.prototype,"consumes",void 0),e([r()],u.prototype,"produces",void 0),e([r({constructOnly:!0})],u.prototype,"focusAreasView",void 0),u=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaVisualization")],u);const d={bright:0,dark:1};export{u as FocusAreaVisualization,d as styleToEffect};
2
+ import{__decorate as e}from"tslib";import{watch as s}from"../../../../../core/reactiveUtils.js";import{property as t,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as i}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as o}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{EmissiveTechniqueConfiguration as h}from"../../shaders/EmissiveTechniqueConfiguration.js";let m=class extends a{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._fadeDirection=0,this._configuration=new h,this._passParameters=new n}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(s(()=>this._passParameters.fadeFactor.value,s=>{0===s&&(this.removeAllHandles(),e())})),this.requestRender(2)}precompile(){this._configuration.hasEmissive=0!==this.bindParameters.emissions,this.techniques.precompile(c,this._configuration)}render(e){const s=this.bindParameters;this._startTime??=this.view.stage?.renderer.renderContext.time;const t=this.view.qualitySettings.fadeDuration,r=t>0?Math.min(t,this.view.stage?.renderer.renderContext.time-this._startTime)/t:1,a=this.renderingContext,n=this.techniques.get(c,this._configuration),h=this.input,m=e.find(({name:e})=>e===o.FOCUSAREA),f="bright"===this.focusAreasView.style;this._passParameters.color=f?h.getTexture():a.emptyTexture,this._passParameters.focusArea=m.getTexture(),this._passParameters.effect=u[this.focusAreasView.style],this._passParameters.fadeFactor.value=0===this._fadeDirection?r:1-r;const d=s.camera,l=d.fullViewport[2],p=d.fullViewport[3],g=f?this.fboCache.acquire(l,p,this.produces).moveAttachments(h):h;return a.bindFramebuffer(g.fbo),f&&a.clearBuffer(0,i),a.bindTechnique(n,s,this._passParameters),a.screen.draw(),r<1&&this.requestRender(2),g}};e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t({constructOnly:!0})],m.prototype,"focusAreasView",void 0),m=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaVisualization")],m);const u={bright:0,dark:1};export{m as FocusAreaVisualization,u as styleToEffect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/DistanceFalloff.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{F as FogPassParameters,b as build}from"../../../../../chunks/Fog.glsl.js";
2
+ import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/util/ColorConversion.glsl.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/DistanceFalloff.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{F as FogPassParameters,b as build}from"../../../../../chunks/Fog.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{smoothstep as t,lerp as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{add as o,normalize as h,dot as m,scale as p,lerp as c,length as g}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as u}from"../../../../../geometry/ellipsoidUtils.js";import{heightLimit as l}from"../../../environment/weather.js";import{TransparentEnvironment as f}from"../TransparentEnvironment.js";import{betaRayleigh as P,betaCombined as w}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as v}from"./FogTechnique.js";import{FogTechniqueConfiguration as y}from"./FogTechniqueConfiguration.js";import{DepthStencilAttachment as j,ColorAttachment1 as F}from"../../../../webgl/enums.js";const B=.95,E=1;let q=class extends f{constructor(e){super(e),this._configuration=new y,this._newParameters=new x,this._oldParameters=new x,this._fadedParameters=new x,this._parameters=this._newParameters,this._passParameters=new b;const t=u(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(a(()=>this._fadeFactor,e=>this._fade(e),i))}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copy(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const{weather:e,weatherAvailable:t}=this.view.environment,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength=t?e.fogOpacity:0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||(this._newParameters.fogBrightness=D),"rainy"===e.type&&(this._newParameters.fogBrightness=H),this._fadeFactor>=1&&this._oldParameters.copy(this._newParameters),this.requestRender(2)}get strength(){return this._parameters.strength}precompile(){this._update(),this._passParameters.amount>0&&this.techniques.precompile(v,this._configuration)}render(){const e=this.input;if(0===this._parameters.amount)return e;const t=this._getTechnique();if(!t)return e;const s=this.renderingContext,a=e.getAttachment(j);return this._passParameters.emission=e.obtainAttachment(F),e.attachDepth(null),s.bindFramebuffer(e.fbo),s.bindTechnique(t,this.bindParameters,this._passParameters),s.screen.draw(),e.attachDepth(a),this._passParameters.emission&&(e.attachColor(this._passParameters.emission,F),this._passParameters.emission=r(this._passParameters.emission)),e}_getTechnique(){return this._update(),this._passParameters.amount>0?this.techniques.get(v,this._configuration):null}_update(){const e=this.bindParameters.camera;h(R,e.eye);const s=Math.max(0,m(R,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.fogBrightness;p(this._passParameters.color,U,r),p(T,U,.1*r),c(this._passParameters.color,T,this._passParameters.color,s);const a=g(e.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-t(B*l,E*l,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength,this._configuration.useFloatBlend=this.view.environment.atmosphereEnabled&&this.bindParameters.useFloatBlend.value,this._configuration.hasEmissive=this.bindParameters.hasEmission}get test(){return{parameters:this._passParameters}}};q=e([n("esri.views.3d.webgl-engine.effects.fog.Fog")],q);class x{constructor(){this.fogBrightness=0,this.strength=0,this.amount=0}copy(e){this.fogBrightness=e.fogBrightness,this.strength=e.strength,this.amount=e.amount}lerp(e,t,r){this.fogBrightness=s(e.fogBrightness,t.fogBrightness,r),this.strength=s(e.strength,t.strength,r),this.amount=s(e.amount,t.amount,r)}}const R=_(),T=_(),C=d(3e-4,3e-4,3e-4),U=_();o(U,w,P),o(U,U,C),h(U,U);const A=U.reduce((e,t)=>e+t,0)/3,H=.5/A,D=1.5/A;export{q as Fog,x as FogParameters};
2
+ import{__decorate as e}from"tslib";import{smoothstep as t,lerp as s}from"../../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{signal as n}from"../../../../../core/signal.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{add as h,normalize as m,length as p,dot as c,scale as l,lerp as u}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../../geometry/ellipsoidUtils.js";import{heightLimit as f}from"../../../environment/weather.js";import{TransparentEnvironment as P}from"../TransparentEnvironment.js";import{betaRayleigh as v,betaCombined as w}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as y}from"./FogTechnique.js";import{EmissiveTechniqueConfiguration as j}from"../../shaders/EmissiveTechniqueConfiguration.js";import{floatBlendReductionFactor as F}from"../../shaders/floatBlendScale.glsl.js";import{DepthStencilAttachment as B,ColorAttachment1 as q,SizedPixelFormat as E}from"../../../../webgl/enums.js";const x=.9*f,C=1.1*f;let R=class extends P{constructor(e){super(e),this._configuration=new j,this._newParameters=new T,this._oldParameters=new T,this._fadedParameters=new T,this._parameters=this._newParameters,this._passParameters=new b;const t=_(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(a(()=>this._fadeFactor,e=>this._fade(e),i))}_updateEnabled(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copy(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const{weather:e,weatherAvailable:t}=this.view.environment,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength.value=t?e.scattering:0,this._newParameters.amount.value=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||(this._newParameters.fogBrightness=M),"rainy"===e.type&&(this._newParameters.fogBrightness=D),this._fadeFactor>=1&&this._oldParameters.copy(this._newParameters),this.requestRender(2)}get strength(){return this._parameters.strength.value*this._heightFade}get amount(){return this._parameters.amount.value*this._heightFade}get _heightFade(){const e=p(this.bindParameters.camera.eye);return 1-t(x,C,Math.abs(e-this._planetRadius))}precompile(){this._update(),this._passParameters.amount>0&&this.techniques.precompile(y,this._configuration)}render(){const e=this.input,t=this._getTechnique();if(!t)return e;const s=this.renderingContext,a=e.getAttachment(B);if(this._passParameters.emission=e.obtainAttachment(q),this._passParameters.inputScale=this._passParameters.emission?.attachment.descriptor.internalFormat===E.RGBA8?F:1,this._passParameters.emission){const t=1===this._passParameters.inputScale?8:5;e.acquireColor(q,t,"emissive")}return e.attachDepth(null),s.bindFramebuffer(e.fbo),s.bindTechnique(t,this.bindParameters,this._passParameters),s.screen.draw(),this._passParameters.emission=r(this._passParameters.emission),e.attachDepth(a),this.fboCache.debugCallback?.("fog-color",e.fbo),e}_getTechnique(){return this._update(),this._passParameters.amount>0?this.techniques.get(y,this._configuration):null}_update(){const e=this.bindParameters.camera;m(A,e.eye);const t=Math.max(0,c(A,this.bindParameters.lighting.mainLight.direction)),s=this._parameters.fogBrightness;l(this._passParameters.color,H,s),l(S,H,.1*s),u(this._passParameters.color,S,this._passParameters.color,t);const r=p(e.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.amount=this.amount,this._passParameters.strength=this.strength,this._configuration.hasEmissive=this.bindParameters.hasEmission}get test(){return{parameters:this._passParameters}}};R=e([o("esri.views.3d.webgl-engine.effects.fog.Fog")],R);class T{constructor(){this.fogBrightness=0,this.strength=n(0),this.amount=n(0)}copy(e){this.fogBrightness=e.fogBrightness,this.strength.value=e.strength.value,this.amount.value=e.amount.value}lerp(e,t,r){this.fogBrightness=s(e.fogBrightness,t.fogBrightness,r),this.strength.value=s(e.strength.value,t.strength.value,r),this.amount.value=s(e.amount.value,t.amount.value,r)}}const A=g(),S=g(),U=d(3e-4,3e-4,3e-4),H=g();h(H,w,v),h(H,H,U),m(H,H);const k=H.reduce((e,t)=>e+t,0)/3,D=.5/k,M=1.5/k;export{R as Fog,T as FogParameters};
@@ -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/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,c as build,e as defaultColorBleedWeight,d as defaultRayMarchMaxReach,f as defaultRayMarchMaxReachEmissionWeight,b as defaultRayMarchMaxSteps,g as defaultRayMarchMinReach,h as defaultRayMarchMinReachEmissionWeight,i as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./GlobalIlluminationColorQuantization.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,c as build,e as defaultColorBleedWeight,d as defaultRayMarchMaxReach,f as defaultRayMarchMaxReachEmissionWeight,b as defaultRayMarchMaxSteps,g as defaultRayMarchMinReach,h as defaultRayMarchMinReachEmissionWeight,i as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";
@@ -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,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};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{property as a,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 u from"../../../webgl/RenderNode.js";import{G as n}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as m}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as h}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as c}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as p}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as _}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as d}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as f,ColorAttachment1 as b}from"../../../../webgl/enums.js";const g=1;let w=class extends u{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=o.AMBIENT_ILLUMINATION,this._passParameters=new n,this._drawParameters=new m,this._drawParametersUpscale=new _,this._maxFrames=256,this._lowQualityResolutionScale=.25,this._configuration=new p,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(r(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._reset(),this._requestRender()},s))}destroy(){this._lastOutput=t(this._lastOutput)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||this._reset()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._lastOutput?.retain(),this._lastOutput;const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(f),a=this._mode;if(!r||!s)return this._emptyOutput;if(0===a)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 u=this.techniques.getCompiled(c,this._configuration),n=this.techniques.getCompiled(h),m=1===a,p=m?this._lowQualityResolutionScale:1,_=m?this.techniques.getCompiled(d):null;if(!u||!n||m&&!_)return this._requestRender(),this._emptyOutput;const w=this.renderingContext,{camera:P}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.projScale=1/P.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=p;const{fullWidth:I,fullHeight:x}=P,T=Math.max(1,Math.floor(I*p)),q=Math.max(1,Math.floor(x*p)),F=this.fboCache.acquire(T,q,"global illumination input").acquireColor(b,0);w.bindFramebuffer(F.fbo),w.setViewport(0,0,T,q),w.bindTechnique(u,i,this._passParameters,this._drawParameters),w.screen.draw();const O=F.obtainAttachment(b),C=Math.max(1,Math.round(T/g)),G=Math.max(1,Math.round(q/g)),j=this.fboCache.acquire(C,G,"global illumination blur horizontal");w.bindFramebuffer(j.fbo),this._drawParameters.texture=F.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,0,g/q),w.bindTechnique(n,i,this._passParameters,this._drawParameters),w.setViewport(0,0,C,G),w.screen.draw(),F.release();const y=m?"global illumination blur vertical":o.AMBIENT_ILLUMINATION,M=this.fboCache.acquire(C,G,y);w.bindFramebuffer(M.fbo),w.setViewport(0,0,C,G),w.setClearColor(1,1,1,0),w.clear(16384),this._drawParameters.texture=j.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,g/C,0),w.bindTechnique(n,i,this._passParameters,this._drawParameters),w.setViewport(0,0,C,G),w.screen.draw(),j.release(),M.attachColor(O,b),O.release();let R=M;return _&&(R=this.fboCache.acquire(I,x,o.AMBIENT_ILLUMINATION).acquireColor(b,0),w.bindFramebuffer(R.fbo),w.setViewport(0,0,I,x),w.setClearColor(1,1,1,0),w.clear(16384),this._drawParametersUpscale.colorTexture=M.getTexture(),this._drawParametersUpscale.weightTexture=M.getTexture(b),w.bindTechnique(_,i,this._passParameters,this._drawParametersUpscale),w.screen.draw(),M.release()),w.setViewport4fv(P.fullViewport),this._passParameters.temporalSampleFrame=(this._passParameters.temporalSampleFrame+1)%64,++this._passParameters.accumulatedFrames,this._storeOutput(R),this._passParameters.accumulatedFrames<this._maxFrames&&this._requestRender(),R}_requestRender(){this._isGlobalIlluminationUpdate=!0,this.requestRender(1),this._isGlobalIlluminationUpdate=!1}_storeOutput(e){this._lastOutput!==e&&(this._lastOutput=t(this._lastOutput),this._lastOutput=e,this._lastOutput.retain())}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,o.AMBIENT_ILLUMINATION).acquireColor(b,0);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),s}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:r}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!r||this._resetBuffer)}get _mode(){const{hasGlobalIlluminationHighQuality:e,hasGlobalIllumination:t}=this.view.stage.renderer;return e?2:t?1:0}_reset(){this._passParameters.accumulatedFrames=0,this._lastOutput=t(this._lastOutput)}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._reset(),this._passParameters.temporalSampleFrame=0,this._resetBuffer=!0,this._requestRender()}}}};e([a()],w.prototype,"consumes",void 0),e([a()],w.prototype,"produces",void 0),w=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],w);export{w as GlobalIllumination,g as blurSizePixels};
@@ -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}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};
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};
@@ -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/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};
2
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{releaseMaybe as s}from"../../../../../core/maybe.js";import{watch as r,initial as i}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as m}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 l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as p}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as b}from"./GlowBlurTechnique.js";import{G as f}from"../../../../../chunks/GlowComposite.glsl.js";import{GlowCompositeTechnique as _}from"./GlowCompositeTechnique.js";import{FloatBlendScaleConfiguration as g,floatBlendReductionFactor as d}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as w,DrawBufferNone as P}from"../../../../webgl/enums.js";import{noParameters as v}from"../../../../webgl/NoParameters.js";let B=class extends p{constructor(e){super(e),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._glowBoost={realistic:0,cartographicMin:.5,cartographicDefault:2.5,cartographicMax:5},this._compositeConfiguration=new g,this._compositeParameters=new f,this._blurParameters=new u;const t=h(e.view.spatialReference);this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([r(()=>this._mode,e=>2===e?this._disable():this._enable(),i),r(()=>this._boost,e=>{this._compositeParameters.boost=e,this.requestRender(1)},i),r(()=>this.view.stage.renderView.fog?.strength??0,e=>{this._compositeParameters.scattering=e,this.requestRender(1)},i)])}precompile(){this.techniques.precompile(b),this._compositeConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(_,this._compositeConfiguration)}render(){const e=this.input;if(this._compositeParameters.emission=e.obtainAttachment(w),!this._compositeParameters.emission?.attachment)return e;const{fullWidth:t,fullHeight:r,eye:i}=this.bindParameters.camera,o=n(i);this._compositeParameters.atmosphereC=o**2-this._atmosphereRadius**2,this._compositeParameters.mipmapLevels=this._renderGlowMipMap();const a=this.renderingContext,m=e.obtainDepthTexture();e.acquireColor(w,8,"emissive"),a.bindFramebuffer(e.fbo),a.setViewport(0,0,t,r),a.clearBuffer(1,l);const h=a.setDrawBuffers([P,w]),c=this.techniques.get(_,this._compositeConfiguration);return a.bindTechnique(c,this.bindParameters,this._compositeParameters),a.screen.draw(),a.setDrawBuffers(h),this._compositeParameters.emission=s(this._compositeParameters.emission),this._compositeParameters.mipmapTexture=s(this._compositeParameters.mipmapTexture),e.attachDepth(m),m?.release(),this.fboCache.debugCallback?.("glow-color",e.fbo),e}_renderGlowMipMap(){const e=this.fboCache,{fullWidth:t,fullHeight:s}=this.camera,r=this.renderingContext;this._blurParameters.input=this._compositeParameters.emission?.attachment,this._blurParameters.inputScale=this.bindParameters.useFloatBlend.value?1:d,this._blurParameters.level=0,m(this._blurParameters.size,1,1);const i=Math.floor(.5*t),o=Math.floor(.5*s),a=e.acquire(i,s,"glow horizontal",8);let n,l=i,h=s;const c=this.techniques.get(b),p=r.bindTechnique(c,this.bindParameters,v);for(;l>=1&&h>=1;)this._blurParameters.isHorizontal=!0,this._setupFBO(a,l,h),p.bindDraw(this.bindParameters,v,this._blurParameters),r.screen.draw(),h=Math.floor(.5*h),this._blurParameters.input=a.getTexture(),this._blurParameters.inputScale=1,this._blurParameters.isHorizontal=!1,m(this._blurParameters.size,l/i,h/o),n??=e.acquire(l,h,"glow mipmap",9),this._setupFBO(n,l,h,this._blurParameters.level),p.bindDraw(this.bindParameters,v,this._blurParameters),r.screen.draw(),e.debugCallback?.(n.name,n.fbo),l=Math.floor(.5*l),this._blurParameters.input=n.getTexture(),++this._blurParameters.level;return a.release(),this._compositeParameters.mipmapTexture=n,n&&(n.fbo.level=0),this._blurParameters.level}get _boost(){return 0===this._mode?this._glowBoost.realistic:this._intensity<=.5?t(this._glowBoost.cartographicMin,this._glowBoost.cartographicDefault,2*this._intensity):t(this._glowBoost.cartographicDefault,this._glowBoost.cartographicMax,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(e,t,s,r=0){e.fbo.level=r;const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,s),i.setClearColor(0,0,0,0),i.clear(16384)}};e([o()],B.prototype,"consumes",void 0),e([o()],B.prototype,"produces",void 0),B=e([a("esri.views.3d.webgl-engine.effects.glow.Glow")],B);export{B as Glow};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/arrayUtils.js";import"../../../../../core/mathUtils.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurPassParameters,b as build}from"../../../../../chunks/GlowBlur.glsl.js";
2
+ import"../../../../../core/arrayUtils.js";import"../../../../../core/mathUtils.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/BooleanDrawUniform.js";import"../../core/shaderModules/Float2DrawUniform.js";import"../../core/shaderModules/FloatDrawUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DDrawUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowBlurDrawParameters,b as build,w as weights}from"../../../../../chunks/GlowBlur.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../raymarching/DistanceFalloff.glsl.js";import"../../shaders/floatBlendScale.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowCompositePassParameters,b as build}from"../../../../../chunks/GlowComposite.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as r}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/GlowComposite.glsl.js";import{makePipelineState as t,defaultColorWrite as l}from"../../../../webgl/renderState.js";let c=class extends s{constructor(){super(...arguments),this.shader=new r(i,()=>import("./GlowComposite.glsl.js"))}initializePipeline(){return t({colorWrite:l})}};c=e([o("esri.views.3d.webgl-engine.effects.glow.GlowCompositeTechnique")],c);export{c as GlowCompositeTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{TransparentEnvironment as u}from"../TransparentEnvironment.js";import{H as d}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as p}from"./HazeCompositingTechnique.js";import{HazePassParameters as c,HazeTechnique as f}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as l}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as _}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as b}from"../../lib/textureUtils.js";import{DepthStencilAttachment as g,ColorAttachment0 as w,PrimitiveType as P}from"../../../../webgl/enums.js";let v=class extends u{constructor(e){super(e),this._compositingPassParameters=new d,this._passParameters=new c,this._hazeConfiguration=new l,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount}initialize(){this.addHandles([s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),s(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),s(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),s(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}render(){const e=this.input;if(!this.bindParameters.mainDepth)return e;const i=this.techniques.getCompiled(f,this._hazeConfiguration),r=!!this._hazeConfiguration.reduced&&this.techniques.getCompiled(p);if(null==i||null==r)return e;const s=this.renderingContext,o=e.getAttachment(g);if(this._update(),!r)return e.detachDepth(),s.bindFramebuffer(e.fbo),s.bindTechnique(i,this.bindParameters,this._passParameters),s.setDrawBuffers([w]),this._renderCommon(s),e.attachDepth(o),e;const a=s.getViewport(),n=this.camera,u=h(n.eye)-m.radius;let d;const c=m.atmosphereHeight;if(u<c){const e=Math.min(1,Math.max(0,u/c));d=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(u-c)/(15*c)));d=t(.5,1,e)}const l=this.renderingContext.parameters.maxTextureSize,_=b(Math.round(d*n.fullViewport[2]),l),P=b(Math.round(d*n.fullViewport[3]),l);s.setViewport(0,0,_,P);const v=this.fboCache.acquire(_,P,"haze",5);return s.bindFramebuffer(v.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(s),s.setViewport(a.x,a.y,a.width,a.height),this._compositingPassParameters.color=v.getTexture(),e.detachDepth(),s.bindFramebuffer(e.fbo),s.bindTechnique(r,this.bindParameters,this._compositingPassParameters),s.setDrawBuffers([w]),s.screen.draw(),e.attachDepth(o),v.release(),e}_renderCommon(e){this._vao??=_(e,1),e.bindVAO(this._vao),e.drawArrays(P.TRIANGLE_STRIP,0,4)}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+m.atmosphereHeight);const r=h(this.bindParameters.camera.eye);this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,r-m.radius)),1,this._amount)}};v=e([a("esri.views.3d.webgl-engine.effects.haze.Haze")],v);export{v as Haze};
2
+ import{__decorate as e}from"tslib";import{lerp as t,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{TransparentEnvironment as u}from"../TransparentEnvironment.js";import{H as d}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as p}from"./HazeCompositingTechnique.js";import{HazePassParameters as c,HazeTechnique as f}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as l}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as _}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as b}from"../../lib/textureUtils.js";import{DepthStencilAttachment as g,ColorAttachment0 as w,PrimitiveType as P}from"../../../../webgl/enums.js";let v=class extends u{constructor(e){super(e),this._compositingPassParameters=new d,this._passParameters=new c,this._hazeConfiguration=new l,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount}initialize(){this.addHandles([s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),s(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),s(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),s(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}render(){const e=this.input;if(!this.bindParameters.mainDepth)return e;const i=this.techniques.getCompiled(f,this._hazeConfiguration),r=!!this._hazeConfiguration.reduced&&this.techniques.getCompiled(p);if(null==i||null==r)return e;const s=this.renderingContext,o=e.getAttachment(g);if(this._update(),!r)return e.detachDepth(),s.bindFramebuffer(e.fbo),s.bindTechnique(i,this.bindParameters,this._passParameters),s.setDrawBuffers([w]),this._renderCommon(s),e.attachDepth(o),e;const a=s.getViewport(),n=this.camera,u=h(n.eye)-m.radius;let d;const c=m.atmosphereHeight;if(u<c){const e=Math.min(1,Math.max(0,u/c));d=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(u-c)/(15*c)));d=t(.5,1,e)}const l=this.renderingContext.parameters.maxTextureSize,_=b(Math.round(d*n.fullViewport[2]),l),P=b(Math.round(d*n.fullViewport[3]),l);s.setViewport(0,0,_,P);const v=this.fboCache.acquire(_,P,"haze");return s.bindFramebuffer(v.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(s),s.setViewport(a.x,a.y,a.width,a.height),this._compositingPassParameters.color=v.getTexture(),e.detachDepth(),s.bindFramebuffer(e.fbo),s.bindTechnique(r,this.bindParameters,this._compositingPassParameters),s.setDrawBuffers([w]),s.screen.draw(),e.attachDepth(o),v.release(),e}_renderCommon(e){this._vao??=_(e,1),e.bindVAO(this._vao),e.drawArrays(P.TRIANGLE_STRIP,0,4)}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+m.atmosphereHeight);const r=h(this.bindParameters.camera.eye);this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,r-m.radius)),1,this._amount)}};v=e([a("esri.views.3d.webgl-engine.effects.haze.Haze")],v);export{v as Haze};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/libs/gl-matrix-2/math/vec3.js";import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/NormalFromDepth.glsl.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js";import"../../core/shaderLibrary/shading/ShadowmapFiltering.glsl.js";import"../../core/shaderModules/Float3BindUniform.js";import"../../core/shaderModules/Float4PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DShadowBindUniform.js";import"../../core/shaderModules/Texture2DUintPassUniform.js";import"../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../chunks/ShadowHighlight.glsl.js";
2
+ import"../../../../../core/libs/gl-matrix-2/math/vec3.js";import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderLibrary/NormalFromDepth.glsl.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js";import"../../core/shaderLibrary/shading/ShadowmapFiltering.glsl.js";import"../../core/shaderLibrary/util/blendEmission.glsl.js";import"../../core/shaderModules/Float3BindUniform.js";import"../../core/shaderModules/Float4PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DShadowBindUniform.js";import"../../core/shaderModules/Texture2DUintPassUniform.js";import"../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../chunks/ShadowHighlight.glsl.js";