@arcgis/core 5.2.0-next.93 → 5.2.0-next.95

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 (190) hide show
  1. package/arcade/arcadeAsyncRuntime.js +1 -1
  2. package/arcade/arcadeCompiler.js +1 -1
  3. package/arcade/functions/portal.js +2 -0
  4. package/arcade/treeAnalysis.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/{c4a0d3149947a1d2c484.js → 05662a663f761dd3dea5.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0be98adfef79fc5036f0.js +1 -0
  8. package/assets/esri/core/workers/chunks/0df9864ecebe6a2b973f.js +1 -0
  9. package/assets/esri/core/workers/chunks/10c13c36c42c5ac41d12.js +1 -0
  10. package/assets/esri/core/workers/chunks/{e50adcfb392adfb3f79c.js → 1b311ff39dede07865df.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{188c6ff5f4664827c254.js → 1c803eef9a8fdabc61e3.js} +2 -2
  12. package/assets/esri/core/workers/chunks/1d7f633f158062eb3f64.js +1 -0
  13. package/assets/esri/core/workers/chunks/1f047dd747e7c1916dc7.js +1684 -0
  14. package/assets/esri/core/workers/chunks/2524e2385f61a6898411.js +1 -0
  15. package/assets/esri/core/workers/chunks/26737d061c7cfbbab95c.js +1 -0
  16. package/assets/esri/core/workers/chunks/{91de343844ac578e7c93.js → 2b6d261fe79fe186fb22.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{8a87e1a89a0d8c6203a7.js → 2e51764c8aa31096cb2a.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{da8a314800944706511b.js → 36e35a8067b18f59cc05.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{d270b49c037085503016.js → 3a9435569ba460ff7e3d.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{5d9c92c4e60a4696fdad.js → 471027e4280bd51167b0.js} +1 -1
  21. package/assets/esri/core/workers/chunks/4c088c26d5d546c95c90.js +1 -0
  22. package/assets/esri/core/workers/chunks/{e594b6db9caee1f7b9fc.js → 4d700cb028f6306b163e.js} +1 -1
  23. package/assets/esri/core/workers/chunks/5168bd8ab6233dc9c32a.js +1 -0
  24. package/assets/esri/core/workers/chunks/{cd02a6078443b8f63927.js → 5b8591486f33627f5389.js} +1 -1
  25. package/assets/esri/core/workers/chunks/5d6733dcee9c2ef00072.js +1 -0
  26. package/assets/esri/core/workers/chunks/{a89dbef8155d7c4354da.js → 5edf77618ca51819d7c4.js} +2 -2
  27. package/assets/esri/core/workers/chunks/6057a79c68c33ee4a193.js +1 -0
  28. package/assets/esri/core/workers/chunks/{48726010778d6004e347.js → 63127e3b22e7eac6003d.js} +2 -2
  29. package/assets/esri/core/workers/chunks/{ff83d0337ac489ab08de.js → 678585509706755c0434.js} +2 -2
  30. package/assets/esri/core/workers/chunks/{2754ba5cc094028a7a3c.js → 691e9cc541cfaebe1776.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{32f11b4aeae1ef00e466.js → 6baae3e856d904fef9b1.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{aed7b80145b22c246098.js → 6cbc30b31f0bb39c73ca.js} +1 -1
  33. package/assets/esri/core/workers/chunks/6cc03ef97d7731153b9a.js +1 -0
  34. package/assets/esri/core/workers/chunks/{d44338bf5edafa3ca926.js → 6f01bd01b13662eb3bd7.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{76e7d3cde2da4bdd7820.js → 74cd9df85c4560bb8e52.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{97e41500fc2d24a88938.js → 7b70d6fdfa7a19ffffb0.js} +1 -1
  37. package/assets/esri/core/workers/chunks/7bb3411a86cdd736d555.js +1 -0
  38. package/assets/esri/core/workers/chunks/7ddb5800777fbecee3a8.js +1 -0
  39. package/assets/esri/core/workers/chunks/7eae9053065d3d38e54e.js +1 -0
  40. package/assets/esri/core/workers/chunks/7efc51324cfc8e08c756.js +1 -0
  41. package/assets/esri/core/workers/chunks/{e90076ac1cf88a83a7f9.js → 80f38ab2b7ae61e6f301.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{5aa23b0f4521ba9a07ad.js → 854f42f16fdb40000aae.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{24c44541046576fee7e0.js → 87094044458b0ea5cb0f.js} +2 -2
  44. package/assets/esri/core/workers/chunks/909ee7d2a0eec773037a.js +1 -0
  45. package/assets/esri/core/workers/chunks/92a6559a6999b26362d7.js +1 -0
  46. package/assets/esri/core/workers/chunks/{3a65693964e3976d8035.js → 9df38cadebf8e6fd746c.js} +1 -1
  47. package/assets/esri/core/workers/chunks/a0eb882a5a81d25b9153.js +1 -0
  48. package/assets/esri/core/workers/chunks/{20f6e681ccd8bf884b77.js → a72983c3621810d4b1af.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{9226205850e35b7fc610.js → a8aa8cb60b30f0983e7e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/a8e9aa5461c71c88e2e5.js +1 -0
  51. package/assets/esri/core/workers/chunks/{1ab8307ba9981124f669.js → af6b9fd77b1792fbb66e.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{19e93d4d37018e3ee849.js → b102ae764c14d8b32ace.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{1554feab934e8e1bcd28.js → b333de4dea14c5db0a4d.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{d7d5275d8b3c9430de1f.js → b7c0da9d255d5e48320d.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{6b9dbf43c0659e55c539.js → be0417df35a7d99af675.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{a46ac0be9aabc4cfedc7.js → cc3186dcbbf5edff8b9e.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{6fd0d9431b141f2a3252.js → cefb70d633c220cbedf9.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{69c9a12c97ead8963817.js → d1304d414b1fa725168a.js} +1 -1
  59. package/assets/esri/core/workers/chunks/d453627894e6e5b02023.js +1 -0
  60. package/assets/esri/core/workers/chunks/e4380706b629729f2212.js +1 -0
  61. package/assets/esri/core/workers/chunks/e5b6fa57cc4028fbd401.js +1 -0
  62. package/assets/esri/core/workers/chunks/e7fdad0c07beb3614b60.js +1 -0
  63. package/assets/esri/core/workers/chunks/ea1877ce00da3b585a30.js +1 -0
  64. package/assets/esri/core/workers/chunks/{0336f4f8498a22347720.js → ea5ee1b12b43594592a0.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{c4fef90cf08bbe4f0bb5.js → eafc591e1a98000d54ef.js} +1 -1
  66. package/assets/esri/core/workers/chunks/f331c24247d132589859.js +1 -0
  67. package/assets/esri/core/workers/chunks/f5867d8ba73c67ac27d2.js +1 -0
  68. package/assets/esri/core/workers/chunks/{b7ed5f130661e9ca00b9.js → f5a058a0ce006bce2a2a.js} +1 -1
  69. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  70. package/chunks/{GlowBlur.glsl.js → BlurEmission.glsl.js} +3 -3
  71. package/chunks/EmissionComposite.glsl.js +3 -3
  72. package/chunks/Fog.glsl.js +8 -6
  73. package/chunks/RibbonLine.glsl.js +52 -52
  74. package/chunks/bundle.js +1 -1
  75. package/chunks/portal.js +2 -0
  76. package/config.js +1 -1
  77. package/core/timeUtils.d.ts +62 -0
  78. package/core/timeUtils.js +1 -1
  79. package/kernel.js +1 -1
  80. package/layers/AnnotationFeatureLayer.d.ts +0 -1
  81. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  82. package/layers/support/AnnotationFeatureSublayer.js +1 -1
  83. package/libs/parquet/parquet.js +1 -1
  84. package/package.json +3 -3
  85. package/rest/imageService/fetchRasterInfo.js +1 -1
  86. package/support/revision.js +1 -1
  87. package/symbols/cim/types.d.ts +2 -1
  88. package/views/2d/engine/Stage.js +1 -1
  89. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  90. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  91. package/views/2d/engine/webgl/Painter.js +1 -1
  92. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  93. package/views/2d/engine/webgl/shaderGraph/techniques/Technique.js +1 -1
  94. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  95. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  96. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
  97. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
  98. package/views/2d/layers/AnnotationFeatureLayerView2D.js +1 -1
  99. package/views/2d/layers/features/FeatureContainer.js +1 -1
  100. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  101. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  102. package/views/2d/layers/graphics/GraphicContainer.js +1 -1
  103. package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
  104. package/views/3d/environment/CloudyWeather.js +1 -1
  105. package/views/3d/environment/SunnyWeather.js +1 -1
  106. package/views/3d/layers/I3SMeshView3D.js +1 -1
  107. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  108. package/views/3d/state/ViewStateManager.js +1 -1
  109. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  110. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  111. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  112. package/views/3d/terrain/TileCompositor.js +1 -1
  113. package/views/3d/webgl/RenderCamera.js +1 -1
  114. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  115. package/views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js +1 -5
  116. package/views/3d/webgl-engine/effects/clouds/CloudsParameters.js +1 -1
  117. package/views/3d/webgl-engine/effects/clouds/CloudsPresets.js +1 -1
  118. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  119. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  120. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  121. package/views/3d/webgl-engine/effects/fog/FogTechnique.js +1 -1
  122. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  123. package/views/3d/webgl-engine/effects/glow/{GlowBlur.glsl.js → BlurEmission.glsl.js} +1 -1
  124. package/views/3d/webgl-engine/effects/glow/BlurEmission.js +2 -0
  125. package/views/3d/webgl-engine/effects/glow/BlurEmissionTechnique.js +2 -0
  126. package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +37 -0
  127. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
  128. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  129. package/views/3d/webgl-engine/lib/BufferGeometry.js +2 -0
  130. package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
  131. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  132. package/views/3d/webgl-engine/lib/EmissionCompositeTechnique.js +1 -1
  133. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  134. package/views/3d/webgl-engine/lib/GeometryBaseInstance.js +1 -1
  135. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  136. package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
  137. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  138. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  139. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  140. package/views/3d/webgl-engine/lib/rendererUtils.js +1 -1
  141. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  142. package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
  143. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  144. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  145. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  146. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  147. package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +1 -1
  148. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  149. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  150. package/views/3d/webgl-engine/shaders/floatBlendScale.glsl.js +1 -1
  151. package/views/SceneView.d.ts +1 -0
  152. package/views/SceneView.js +1 -1
  153. package/views/popupAdapter.js +1 -1
  154. package/assets/esri/core/workers/chunks/0846855843f85661e974.js +0 -1
  155. package/assets/esri/core/workers/chunks/15f4f7e34e14e3cf52e6.js +0 -1
  156. package/assets/esri/core/workers/chunks/19ab024f6f732fd6c69b.js +0 -1
  157. package/assets/esri/core/workers/chunks/22c94f9a69b2157f8dbd.js +0 -1
  158. package/assets/esri/core/workers/chunks/2ec44ebc48beeba11201.js +0 -1
  159. package/assets/esri/core/workers/chunks/30376f00cda1165a2504.js +0 -1
  160. package/assets/esri/core/workers/chunks/349b0c7febc46267441d.js +0 -1684
  161. package/assets/esri/core/workers/chunks/423c2692df662b3dddd4.js +0 -1
  162. package/assets/esri/core/workers/chunks/46f8c7ae7fb356c3410d.js +0 -1
  163. package/assets/esri/core/workers/chunks/4bf7c0c874d30b1c0760.js +0 -1
  164. package/assets/esri/core/workers/chunks/5bf2ce280ea35ea4c96b.js +0 -1
  165. package/assets/esri/core/workers/chunks/7253a439c98200e3e748.js +0 -1
  166. package/assets/esri/core/workers/chunks/75b90fb05e4a2d32b7bb.js +0 -1
  167. package/assets/esri/core/workers/chunks/7e41cee4a0ae75e1490d.js +0 -1
  168. package/assets/esri/core/workers/chunks/848a9f0e5373bbf289a5.js +0 -1
  169. package/assets/esri/core/workers/chunks/95a3f09751bff63f4fab.js +0 -1
  170. package/assets/esri/core/workers/chunks/98d614d6fc9de8ebaf94.js +0 -1
  171. package/assets/esri/core/workers/chunks/b2e2234fdf8e05bc3312.js +0 -1
  172. package/assets/esri/core/workers/chunks/bb23e670736bcace8b6f.js +0 -1
  173. package/assets/esri/core/workers/chunks/bdfffa5f88b559a4b42d.js +0 -1
  174. package/assets/esri/core/workers/chunks/c352696478b48a2090d5.js +0 -1
  175. package/assets/esri/core/workers/chunks/c91042f8bf886056a29c.js +0 -1
  176. package/assets/esri/core/workers/chunks/d58d6b55b2749a535eb3.js +0 -1
  177. package/assets/esri/core/workers/chunks/ec69dd546c312ba97110.js +0 -1
  178. package/assets/esri/core/workers/chunks/f247f3c5148fa0237a7c.js +0 -1
  179. package/assets/esri/core/workers/chunks/f4d351b4cd9d1aa10632.js +0 -1
  180. package/assets/esri/core/workers/chunks/fbc7576ed12964059da6.js +0 -1
  181. package/chunks/GlowComposite.glsl.js +0 -37
  182. package/views/3d/webgl-engine/effects/glow/Glow.js +0 -2
  183. package/views/3d/webgl-engine/effects/glow/GlowBlurTechnique.js +0 -2
  184. package/views/3d/webgl-engine/effects/glow/GlowComposite.glsl.js +0 -2
  185. package/views/3d/webgl-engine/effects/glow/GlowCompositeTechnique.js +0 -2
  186. /package/assets/esri/core/workers/chunks/{188c6ff5f4664827c254.js.LICENSE.txt → 1c803eef9a8fdabc61e3.js.LICENSE.txt} +0 -0
  187. /package/assets/esri/core/workers/chunks/{a89dbef8155d7c4354da.js.LICENSE.txt → 5edf77618ca51819d7c4.js.LICENSE.txt} +0 -0
  188. /package/assets/esri/core/workers/chunks/{48726010778d6004e347.js.LICENSE.txt → 63127e3b22e7eac6003d.js.LICENSE.txt} +0 -0
  189. /package/assets/esri/core/workers/chunks/{ff83d0337ac489ab08de.js.LICENSE.txt → 678585509706755c0434.js.LICENSE.txt} +0 -0
  190. /package/assets/esri/core/workers/chunks/{24c44541046576fee7e0.js.LICENSE.txt → 87094044458b0ea5cb0f.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as n}from"../../../../core/time.js";import{exactEquals as a,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as c}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as T}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as f}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as b}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as S}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as y}from"./GaussianSplatTextureAtlas.js";import{DepthRange as C}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class V{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new C,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new S(this._renderer.renderingContext),this._fadingTexture=new f(this._renderer.renderingContext),this._headerTexture=new b(this._renderer.renderingContext),this._textureAtlas=new y(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new T(c(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],n=s[2],h=i[0],u=i[1],d=i[2],c=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&a(this._previousVisibleTileDepthRangeEye,s)&&a(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return c.near<=c.far?c:null;let g=1/0,T=-1/0;const f=this._latestSortedGaussianTiles;for(let a=0;a<f.length;a++){const e=f[a];if(null!=t){const s=e.boundingBox;if(!p(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-n),i=e.paddedMbsRadius,l=s-i;l<g&&(g=l);const _=s+i;_>T&&(T=_)}const b=g<=T;return b?c.set(g,T):c.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&m(this._previousVisibleTileDepthRangeClippingBox,t),b?c:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=n()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=n(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){const t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=s(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacity(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const n=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._renderer.clippingBox,_=this._nextCommittedVisibleGaussianTiles;_.length=0;let m=0;const{frustum:c}=o,T=this._renderer.tileCullingRevision,f=c[0],b=c[1],S=c[2],y=c[3],C=c[4],x=c[5];for(let e=0;e<s;e++){const s=t[e],{obbCenterX:i,obbCenterY:r,obbCenterZ:o,paddedMbsRadius:n}=s,a=s.gaussianCount;if(s.cullingRevision!==T){let e=null==d||p(s.boundingBox,d);if(e){const t=1.5*n;e=f[0]*i+f[1]*r+f[2]*o+f[3]<t&&b[0]*i+b[1]*r+b[2]*o+b[3]<t&&S[0]*i+S[1]*r+S[2]*o+S[3]<t&&y[0]*i+y[1]*r+y[2]*o+y[3]<t&&C[0]*i+C[1]*r+C[2]*o+C[3]<t&&x[0]*i+x[1]*r+x[2]*o+x[3]<t}s.cullingRevision=T,s.cullingVisible=e}s.cullingVisible&&(_[m++]=s,u+=a)}if(_.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V=new Map,A=[],v=new Uint32Array(m);for(let e=0;e<m;e++){const t=_[e],s=t.handle;V.set(s,t),v[e]=s,this._workerResidentTiles.get(s)!==t&&A.push({handle:s,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}const w=[];for(const e of this._workerResidentTiles.keys())V.has(e)||w.push(e);const R=new g(A,Uint32Array.from(w),v,this._sortedAtlasIndicesBuffer,u,n,a,l,this._useDeterministicSort),B=await(this._workerHandle?.sort(R,e));if(e.aborted)return;B&&(this._sortedAtlasIndicesBuffer=B.sortedAtlasIndices,this._workerResidentTiles=V);const G=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=_,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(G,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{V as GaussianSplatDataStore};
2
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as n}from"../../../../core/time.js";import{exactEquals as a,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as p,copy as m}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as c}from"../../layers/support/makeScheduleFunction.js";import{SplatSortWorkerInput as g}from"../GaussianSplatSortWorker.js";import{GaussianSplatSortWorkerHandle as T}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as f}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as b}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as y}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as S}from"./GaussianSplatTextureAtlas.js";import{DepthRange as C}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class V{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this._sortWorkerMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new C,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._sortBufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._workerResidentTiles=new Map,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new y(this._renderer.renderingContext),this._fadingTexture=new f(this._renderer.renderingContext),this._headerTexture=new b(this._renderer.renderingContext),this._textureAtlas=new S(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new T(c(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get sortWorkerMemory(){return this._sortWorkerMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory+this.sortWorkerMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],n=s[2],h=i[0],u=i[1],d=i[2],c=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&a(this._previousVisibleTileDepthRangeEye,s)&&a(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return c.near<=c.far?c:null;let g=1/0,T=-1/0;const f=this._latestSortedGaussianTiles;for(let a=0;a<f.length;a++){const e=f[a];if(null!=t){const s=e.boundingBox;if(!p(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-n),i=e.paddedMbsRadius,l=s-i;l<g&&(g=l);const _=s+i;_>T&&(T=_)}const b=g<=T;return b?c.set(g,T):c.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&m(this._previousVisibleTileDepthRangeClippingBox,t),b?c:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._sortWorkerMemory=0,this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._pendingSortTask||(this._pendingSortTask=!0,this._scheduleSortStart())}_scheduleSortStart(){if(this._isSorting)return;const e=n()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=n(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._sortedAtlasIndicesBuffer=void 0,this._sortBufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacity(e){if(this._sortBufferCapacity<e){const t=this._computeExpandedCapacity(this._sortBufferCapacity,e);this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._sortBufferMemory=s(this._sortedAtlasIndicesBuffer),this._sortBufferCapacity=t}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerResidentTiles.clear(),this._sortWorkerMemory=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacity(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const n=this._cameraDirectionNormalized[0],a=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._renderer.clippingBox,_=this._nextCommittedVisibleGaussianTiles;_.length=0;let m=0;const{frustum:c}=o,T=this._renderer.tileCullingRevision,f=c[0],b=c[1],y=c[2],S=c[3],C=c[4],x=c[5];for(let e=0;e<s;e++){const s=t[e],{obbCenterX:i,obbCenterY:r,obbCenterZ:o,paddedMbsRadius:n}=s,a=s.gaussianCount;if(s.cullingRevision!==T){let e=null==d||p(s.boundingBox,d);if(e){const t=1.5*n;e=f[0]*i+f[1]*r+f[2]*o+f[3]<t&&b[0]*i+b[1]*r+b[2]*o+b[3]<t&&y[0]*i+y[1]*r+y[2]*o+y[3]<t&&S[0]*i+S[1]*r+S[2]*o+S[3]<t&&C[0]*i+C[1]*r+C[2]*o+C[3]<t&&x[0]*i+x[1]*r+x[2]*o+x[3]<t}s.cullingRevision=T,s.cullingVisible=e}s.cullingVisible&&(_[m++]=s,u+=a)}if(_.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V=new Map,A=[],v=new Uint32Array(m);for(let e=0;e<m;e++){const t=_[e],s=t.handle;V.set(s,t),v[e]=s,this._workerResidentTiles.get(s)!==t&&A.push({handle:s,relativePositions:t.relativePositions,pageIds:t.pageIds,gaussianCount:t.gaussianCount,originX:t.obbCenterX,originY:t.obbCenterY,originZ:t.obbCenterZ})}const w=[];for(const e of this._workerResidentTiles.keys())V.has(e)||w.push(e);const k=new g(A,Uint32Array.from(w),v,this._sortedAtlasIndicesBuffer,u,n,a,l,this._useDeterministicSort),R=await(this._workerHandle?.sort(k,e));if(e.aborted)return;R&&(this._sortedAtlasIndicesBuffer=R.sortedAtlasIndices,this._sortWorkerMemory=R.usedMemory,this._workerResidentTiles=V);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=_,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{V as GaussianSplatDataStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as n}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as o}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as c}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as l}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";import d from"../../webgl/Texture.js";const _=()=>e.getLogger("esri.views.3d.terrain");class f{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._blendConfiguration=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=l(this._rctx,1),this._bindParameters=new c(e,null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=!1,n=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=r,this._blendConfiguration.premultipliedAlphaSource=i,this._blendConfiguration.background=n,this._techniques.precompile(s,this._blendConfiguration),this._techniques.get(s,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(u.TRIANGLE_STRIP,0,this._vao.vertexCount("geometry"))}drawGroup(e,t,r,i,s=!0){1===t&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const n=e.baseOpacity<1,o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=!1){if(null==e.texture)return;const n=e.baseOpacity<1;e.fboTexture=(4===t||0===i&&!n&&!s?null:this.switch(r).colorTexture)??this._rctx.emptyTexture;const o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawRasterData(e,t,r,i,s){const n=s.sourceLayerInfo.data;if(!n.source)return;if(s.tile.surface.layerViewByIndex(s.layerIndex,1).ensureSymbolizerParameters(n),!n.bind(this._rctx))return;const o=e.baseOpacity<1;e.fboTexture=(0!==i||o?this.switch(r).colorTexture:null)??this._rctx.emptyTexture;const a=this._acquireRasterTechnique(n,t,i,o);if(!a)return;n.opacity=e.opacity;const h=n.getUniforms(this._rctx);h.scale=s.scale,h.offset=s.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const c=this._rctx.bindTechnique(a,this._bindParameters,h);this._render(c)}_acquireRasterTechnique(e,t,r,i){if(!this._rctx.capabilities.colorBufferFloat)return null;const s=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterConfiguration??=new a,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.applyBaseOpacity=i,this._rasterConfiguration.colorizerType=n,this._rasterConfiguration.applyColormap=!!s.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?0:1,this._techniques.precompile(o,this._rasterConfiguration),this._techniques.get(o,this._rasterConfiguration)}drawVectorData(e,t,i,s,n,o,a,c){const l=this._rctx,u=n.sourceLayerInfo.data,d=n.tile.surface.layerViewByIndex(n.layerIndex,1),f=e.baseOpacity<1,p=f||e.opacity<1||0!==s||1!==t,b=p,m=this._acquireBlendTechnique(s,t,f,b);l.setPipelineState(m.getPipeline(this._bindParameters,e));let g=null,x=null;p?(x=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new h(this._rctx)),g=this._vtFBO.get(i),l.bindFramebuffer(g),this._clearCurrentFBO()):c&&l.clear(256);try{this._vectorTileHelper.renderBackground(l,n.sourceLod,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom),u&&this._vectorTileHelper.renderContent(l,n.sourceLod,u,n.vtlNeighborInfos,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom)}catch(T){_().warnOnce("A render call containing vector tiles did not resolve correctly.",T)}return!g||(l.bindFramebuffer(x),e.texture=g.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,b),c)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,d.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(3553,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,d.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new h(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{f as TileCompositor};
2
+ import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as i}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechnique as s}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as n}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as o}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as a}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as h}from"./support/MultiSizeFramebuffer.js";import{BindParameters as c}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as l}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as u}from"../../webgl/enums.js";import d from"../../webgl/Texture.js";const _=()=>e.getLogger("esri.views.3d.terrain");class f{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new i,this._blendConfiguration=new n,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vao=l(this._rctx,1),this._bindParameters=new c(null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper)}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,r,i=!1,n=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=r,this._blendConfiguration.premultipliedAlphaSource=i,this._blendConfiguration.background=n,this._techniques.precompile(s,this._blendConfiguration),this._techniques.get(s,this._blendConfiguration)}drawBackground(e,t){const r=this._acquireBlendTechnique(0,t?2:3,!1,!1,1),i=this._rctx.bindTechnique(r,this._bindParameters,e);this._render(i)}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(u.TRIANGLE_STRIP,0,this._vao.vertexCount("geometry"))}drawGroup(e,t,r,i,s=!0){1===t&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const n=e.baseOpacity<1,o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawImageData(e,t,r,i,s=!1){if(null==e.texture)return;const n=e.baseOpacity<1;e.fboTexture=(4===t||0===i&&!n&&!s?null:this.switch(r).colorTexture)??this._rctx.emptyTexture;const o=this._acquireBlendTechnique(i,t,n,s),a=this._rctx.bindTechnique(o,this._bindParameters,e);this._render(a)}drawRasterData(e,t,r,i,s){const n=s.sourceLayerInfo.data;if(!n.source)return;if(s.tile.surface.layerViewByIndex(s.layerIndex,1).ensureSymbolizerParameters(n),!n.bind(this._rctx))return;const o=e.baseOpacity<1;e.fboTexture=(0!==i||o?this.switch(r).colorTexture:null)??this._rctx.emptyTexture;const a=this._acquireRasterTechnique(n,t,i,o);if(!a)return;n.opacity=e.opacity;const h=n.getUniforms(this._rctx);h.scale=s.scale,h.offset=s.offset,h.backgroundColor=e.backgroundColor,h.fboTexture=e.fboTexture,h.baseOpacity=e.baseOpacity;const c=this._rctx.bindTechnique(a,this._bindParameters,h);this._render(c)}_acquireRasterTechnique(e,t,r,i){if(!this._rctx.capabilities.colorBufferFloat)return null;const s=e.symbolizerParameters,n=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterConfiguration??=new a,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=r,this._rasterConfiguration.applyBaseOpacity=i,this._rasterConfiguration.colorizerType=n,this._rasterConfiguration.applyColormap=!!s.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=e.hasStretchTypeNone()?0:1,this._techniques.precompile(o,this._rasterConfiguration),this._techniques.get(o,this._rasterConfiguration)}drawVectorData(e,t,i,s,n,o,a,c){const l=this._rctx,u=n.sourceLayerInfo.data,d=n.tile.surface.layerViewByIndex(n.layerIndex,1),f=e.baseOpacity<1,p=f||e.opacity<1||0!==s||1!==t,b=p,m=this._acquireBlendTechnique(s,t,f,b);l.setPipelineState(m.getPipeline(this._bindParameters,e));let g=null,x=null;p?(x=this.currentFBO(i),null==this._vtFBO&&(this._vtFBO=new h(this._rctx)),g=this._vtFBO.get(i),l.bindFramebuffer(g),this._clearCurrentFBO()):c&&l.clear(256);try{this._vectorTileHelper.renderBackground(l,n.sourceLod,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom),u&&this._vectorTileHelper.renderContent(l,n.sourceLod,u,n.vtlNeighborInfos,d.painter,d.layer.styleRepository,d.schemaHelper,Math.round(1/n.scale),n.offset,a,o,d.contentZoom)}catch(T){_().warnOnce("A render call containing vector tiles did not resolve correctly.",T)}return!g||(l.bindFramebuffer(x),e.texture=g.colorTexture,e.offset=r,e.scale=1,this.drawImageData(e,t,i,s,b),c)}copyFBOToTexture(e){const t=this._rctx,r=t.bindTexture(e.texture,d.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;t.gl.copyTexImage2D(3553,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),t.bindTexture(r,d.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,r=!0){if(this._current=t,t>=this._fbos.length)for(let i=this._fbos.length;i<=t;i++)this._fbos.push(new h(this._rctx));this._initFBO(this._fbos[t].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const t=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}export{f as TileCompositor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,invertOrIdentity as p,multiply as u,invert as l,transpose as _,frustum as v,exactEquals as c,lookAt as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as g}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as f,set as x,distance as M,copy as D,exactEquals as j,sub as R,dot as P,sqrLen as V,sqrDist as F,scale as C,length as b,cross as S,normalize as T,direction as I}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as E,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as O,equals as U,exactEquals as z,copy as H,squaredDistance as q,transformMat4 as W}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as G}from"../../../geometry/support/frustumPlanes.js";import{create as N}from"../../../geometry/support/ray.js";import{projectPointSignedLength as B}from"../../../geometry/support/vector.js";import{viewAngle as J}from"../state/utils/viewUtils.js";import{fovd2fovx as K,fovx2fovd as Q,fovd2fovy as Z,fovy2fovd as $}from"../webgl-engine/lib/fov.js";var tt;let it=tt=class extends i{constructor(t){super(t),this._ray=N(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=m(1,1e3),this._viewDirty=!0,this._viewMatrix=y(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=y(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=y(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=k(),this._fullViewportDirty=!0,this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=E(),this._up=E(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin,"eye")}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return p(y(),this.viewMatrix)||this._get("inverseViewMatrix")||y()}get viewForward(){return this._ensureViewClean(),x(E(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),x(E(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),x(E(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=O(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&U(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=O(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&U(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewportDirty&&(this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this._viewport[2]+this._padding[1]+this._padding[3],this._fullViewport[3]=this._viewport[3]+this._padding[0]+this._padding[2],this._fullViewportDirty=!1),this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){z(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(u(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return l(y(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||y()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return K(this._fov,this.width,this.height)}set fovX(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Z(this._fov,this.width,this.height)}set fovY(t){this._fov=$(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return M(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),_(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=v(y(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){D(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),this._fullViewportDirty=!0,d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new tt).copyFrom(this)}equals(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&z(this._viewport,t.viewport)&&z(this._padding,t.padding)&&g(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}equalsView(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&this._fov===t.fov}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||q(t.screenPadding,this.screenPadding)>=i||q(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;R(st,t.eye,t.center),R(ot,this.eye,this.center);const e=P(st,ot),r=V(st),s=V(ot),o=5e-4;return e*e>=(1-1e-10)*r*s&&F(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(B(this.viewForward,f(st,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==et&&D(et,t),et[3]=1,W(et,et,this.projectionMatrix);const e=Math.abs(et[3]);C(et,et,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*et[0]),i[1]=r(0,s[1]+s[3],.5+.5*et[1]),i[2]=.5*(et[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;et[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],et[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],et[2]=(2*t[2]-1)*t[3],et[3]=t[3],null!=this.inverseProjectionMatrix&&(W(et,et,this.inverseProjectionMatrix),i[0]=et[0],i[1]=et[1],i[2]=et[2])}projectToScreen(t,i){return null==this.projectToRenderScreen(t,nt)?null:(this.renderToScreen(nt,i),i)}projectToRenderScreen(t,i){if(et[0]=t[0],et[1]=t[1],et[2]=t[2],et[3]=1,W(et,et,this.viewProjectionMatrix),0===et[3])return null;const e=et;C(e,e,1/Math.abs(et[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,nt),i)}unprojectFromRenderScreen(t,i){if(u(rt,this.projectionMatrix,this.viewMatrix),!l(rt,rt))return null;const e=this.fullViewport;return et[0]=2*(t[0]-e[0])/e[2]-1,et[1]=2*(t[1]-e[1])/e[3]-1,et[2]=2*t[2]-1,et[3]=1,W(et,et,rt),0===et[3]?null:(i[0]=et[0]/et[3],i[1]=et[1]/et[3],i[2]=et[2]/et[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-J(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){f(st,this.center,this.eye);const t=b(this.center);t<1?j(this._up,A)&&(D(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(P(st,this.center))>.9999*b(st)*t||(S(ot,st,this.center),S(ot,ot,st),T(ot,ot),j(this._up,ot)||(D(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){I(st,this.eye,this.center),Math.abs(st[2])<=.9999&&(C(st,st,st[2]),x(st,-st[0],-st[1],1-st[2]),T(st,st),j(this._up,st)||(D(this._up,st),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?j(t,i)||(D(i,t),this._markViewDirty(),this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(G(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(w(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],it.prototype,"_viewport",void 0),t([n()],it.prototype,"_padding",void 0),t([n()],it.prototype,"_fov",void 0),t([n()],it.prototype,"_nearFar",void 0),t([n()],it.prototype,"_viewDirty",void 0),t([n()],it.prototype,"_viewMatrix",void 0),t([n()],it.prototype,"_pixelRatio",void 0),t([n()],it.prototype,"pixelRatio",null),t([n()],it.prototype,"row",void 0),t([n()],it.prototype,"column",void 0),t([n()],it.prototype,"_rows",void 0),t([n()],it.prototype,"rows",null),t([n()],it.prototype,"_columns",void 0),t([n()],it.prototype,"columns",null),t([n()],it.prototype,"eye",null),t([n()],it.prototype,"center",null),t([n()],it.prototype,"_center",void 0),t([n()],it.prototype,"up",null),t([n()],it.prototype,"_up",void 0),t([n()],it.prototype,"viewMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseViewMatrix",null),t([n({readOnly:!0})],it.prototype,"viewForward",null),t([n({readOnly:!0})],it.prototype,"viewUp",null),t([n({readOnly:!0})],it.prototype,"viewRight",null),t([n({readOnly:!0})],it.prototype,"nearFar",null),t([n()],it.prototype,"near",null),t([n()],it.prototype,"far",null),t([n()],it.prototype,"viewport",null),t([n({readOnly:!0})],it.prototype,"screenViewport",null),t([n({readOnly:!0})],it.prototype,"screenPadding",null),t([n()],it.prototype,"x",null),t([n()],it.prototype,"y",null),t([n()],it.prototype,"width",null),t([n()],it.prototype,"height",null),t([n()],it.prototype,"fullWidth",null),t([n()],it.prototype,"fullHeight",null),t([n({readOnly:!0})],it.prototype,"_aspect",null),t([n()],it.prototype,"padding",null),t([n({readOnly:!0})],it.prototype,"projectionMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseProjectionMatrix",null),t([n()],it.prototype,"fov",null),t([n()],it.prototype,"fovX",null),t([n()],it.prototype,"fovY",null),t([n()],it.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],it.prototype,"_projectionMatrixInternal",null),t([n()],it.prototype,"relativeElevation",void 0),it=tt=t([h("esri.views.3d.webgl.RenderCamera")],it);const et=k(),rt=y(),st=E(),ot=E(),nt=o();export{it as default};
2
+ import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,invertOrIdentity as p,multiply as l,invert as u,transpose as _,frustum as v,exactEquals as c,lookAt as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as g}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as f,set as x,distance as M,copy as D,exactEquals as j,sub as R,dot as P,sqrLen as V,sqrDist as F,scale as C,length as S,cross as b,normalize as T,direction as I}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as E,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as O,equals as U,exactEquals as z,copy as H,squaredDistance as q,transformMat4 as W}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as G}from"../../../geometry/support/frustumPlanes.js";import{create as N}from"../../../geometry/support/ray.js";import{projectPointSignedLength as B}from"../../../geometry/support/vector.js";import{viewAngle as J}from"../state/utils/viewUtils.js";import{fovd2fovx as K,fovx2fovd as Q,fovd2fovy as Z,fovy2fovd as $}from"../webgl-engine/lib/fov.js";var tt;let it=tt=class extends i{constructor(t){super(t),this._ray=N(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=m(1,1e3),this._viewDirty=!0,this._viewMatrix=y(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=y(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=y(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=k(),this._fullViewportDirty=!0,this._pixelRatio=1,this.pixelScale=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=E(),this._up=E(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin,"eye")}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return p(y(),this.viewMatrix)||this._get("inverseViewMatrix")||y()}get viewForward(){return this._ensureViewClean(),x(E(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),x(E(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),x(E(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=O(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&U(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=O(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&U(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewportDirty&&(this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this._viewport[2]+this._padding[1]+this._padding[3],this._fullViewport[3]=this._viewport[3]+this._padding[0]+this._padding[2],this._fullViewportDirty=!1),this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){z(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(l(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return u(y(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||y()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return K(this._fov,this.width,this.height)}set fovX(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Z(this._fov,this.width,this.height)}set fovY(t){this._fov=$(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return M(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(u(this._viewInverseTransposeMatrix,this.viewMatrix),_(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,l=v(y(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),u=this._get("projectionMatrix");return u&&c(u,l)?u:l}copyFrom(t){D(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),this._fullViewportDirty=!0,d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this.pixelRatio=t.pixelRatio,this.pixelScale=t.pixelScale,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new tt).copyFrom(this)}equals(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&z(this._viewport,t.viewport)&&z(this._padding,t.padding)&&g(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}equalsView(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&this._fov===t.fov}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||q(t.screenPadding,this.screenPadding)>=i||q(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;R(st,t.eye,t.center),R(ot,this.eye,this.center);const e=P(st,ot),r=V(st),s=V(ot),o=5e-4;return e*e>=(1-1e-10)*r*s&&F(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(B(this.viewForward,f(st,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==et&&D(et,t),et[3]=1,W(et,et,this.projectionMatrix);const e=Math.abs(et[3]);C(et,et,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*et[0]),i[1]=r(0,s[1]+s[3],.5+.5*et[1]),i[2]=.5*(et[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;et[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],et[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],et[2]=(2*t[2]-1)*t[3],et[3]=t[3],null!=this.inverseProjectionMatrix&&(W(et,et,this.inverseProjectionMatrix),i[0]=et[0],i[1]=et[1],i[2]=et[2])}projectToScreen(t,i){return null==this.projectToRenderScreen(t,nt)?null:(this.renderToScreen(nt,i),i)}projectToRenderScreen(t,i){if(et[0]=t[0],et[1]=t[1],et[2]=t[2],et[3]=1,W(et,et,this.viewProjectionMatrix),0===et[3])return null;const e=et;C(e,e,1/Math.abs(et[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,nt),i)}unprojectFromRenderScreen(t,i){if(l(rt,this.projectionMatrix,this.viewMatrix),!u(rt,rt))return null;const e=this.fullViewport;return et[0]=2*(t[0]-e[0])/e[2]-1,et[1]=2*(t[1]-e[1])/e[3]-1,et[2]=2*t[2]-1,et[3]=1,W(et,et,rt),0===et[3]?null:(i[0]=et[0]/et[3],i[1]=et[1]/et[3],i[2]=et[2]/et[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),l=e-a- -Math.min(this.fullWidth-s-e/2,0),u=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(l),Math.round(u)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-J(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){f(st,this.center,this.eye);const t=S(this.center);t<1?j(this._up,A)&&(D(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(P(st,this.center))>.9999*S(st)*t||(b(ot,st,this.center),b(ot,ot,st),T(ot,ot),j(this._up,ot)||(D(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){I(st,this.eye,this.center),Math.abs(st[2])<=.9999&&(C(st,st,st[2]),x(st,-st[0],-st[1],1-st[2]),T(st,st),j(this._up,st)||(D(this._up,st),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?j(t,i)||(D(i,t),this._markViewDirty(),this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(G(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(w(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],it.prototype,"_viewport",void 0),t([n()],it.prototype,"_padding",void 0),t([n()],it.prototype,"_fov",void 0),t([n()],it.prototype,"_nearFar",void 0),t([n()],it.prototype,"_viewDirty",void 0),t([n()],it.prototype,"_viewMatrix",void 0),t([n()],it.prototype,"pixelRatio",null),t([n()],it.prototype,"_pixelRatio",void 0),t([n()],it.prototype,"pixelScale",void 0),t([n()],it.prototype,"row",void 0),t([n()],it.prototype,"column",void 0),t([n()],it.prototype,"_rows",void 0),t([n()],it.prototype,"rows",null),t([n()],it.prototype,"_columns",void 0),t([n()],it.prototype,"columns",null),t([n()],it.prototype,"eye",null),t([n()],it.prototype,"center",null),t([n()],it.prototype,"_center",void 0),t([n()],it.prototype,"up",null),t([n()],it.prototype,"_up",void 0),t([n()],it.prototype,"viewMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseViewMatrix",null),t([n({readOnly:!0})],it.prototype,"viewForward",null),t([n({readOnly:!0})],it.prototype,"viewUp",null),t([n({readOnly:!0})],it.prototype,"viewRight",null),t([n({readOnly:!0})],it.prototype,"nearFar",null),t([n()],it.prototype,"near",null),t([n()],it.prototype,"far",null),t([n()],it.prototype,"viewport",null),t([n({readOnly:!0})],it.prototype,"screenViewport",null),t([n({readOnly:!0})],it.prototype,"screenPadding",null),t([n()],it.prototype,"x",null),t([n()],it.prototype,"y",null),t([n()],it.prototype,"width",null),t([n()],it.prototype,"height",null),t([n()],it.prototype,"fullWidth",null),t([n()],it.prototype,"fullHeight",null),t([n({readOnly:!0})],it.prototype,"_aspect",null),t([n()],it.prototype,"padding",null),t([n({readOnly:!0})],it.prototype,"projectionMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseProjectionMatrix",null),t([n()],it.prototype,"fov",null),t([n()],it.prototype,"fovX",null),t([n()],it.prototype,"fovY",null),t([n()],it.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],it.prototype,"_projectionMatrixInternal",null),t([n()],it.prototype,"relativeElevation",void 0),it=tt=t([h("esri.views.3d.webgl.RenderCamera")],it);const et=k(),rt=y(),st=E(),ot=E(),nt=o();export{it as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- function n(n){return 5===n||6===n||7===n}function r(r){return n(r)||8===r||9===r}function t(n){return d(n)||4===n}function u(n){return t(n)||r(n)}function e(n){return 10===n||11===n}function o(n){return p(n)||e(n)}function c(n){return 1===n}function f(n){return 2===n}function i(n){return c(n)||f(n)}function p(n){return 0===n||i(n)}function x(n){return 10===n}function a(n){return p(n)||11===n}function b(n){return p(n)||e(n)}function d(n){return b(n)||g(n)}function g(n){return 3===n}function h(n){return g(n)||r(n)}export{o as is2DGeometryOutput,t as is3DGeometry,u as is3DGeometryOrShadowLike,p as isColor,d as isColorHighlightOLIDOrDepth,b as isColorHighlightOrOLID,a as isColorOrOLID,g as isDepth,h as isDepthOrShadowLike,x as isHighlight,e as isHighlightOrOLID,i as isOIT,c as isOITColorAlpha,f as isOITFrontFace,n as isShadow,r as isShadowLike};
2
+ function n(n){return 5===n||6===n||7===n}function r(r){return n(r)||8===r||9===r}function t(n){return d(n)||4===n}function u(n){return t(n)||r(n)}function e(n){return 10===n||11===n}function o(n){return p(n)||e(n)}function c(n){return 1===n}function f(n){return 2===n}function i(n){return c(n)||f(n)}function p(n){return 0===n||i(n)}function x(n){return 10===n}function a(n){return p(n)||11===n}function b(n){return p(n)||e(n)}function d(n){return b(n)||g(n)}function g(n){return 3===n}export{o as is2DGeometryOutput,t as is3DGeometry,u as is3DGeometryOrShadowLike,p as isColor,d as isColorHighlightOLIDOrDepth,b as isColorHighlightOrOLID,a as isColorOrOLID,g as isDepth,x as isHighlight,e as isHighlightOrOLID,i as isOIT,c as isOITColorAlpha,f as isOITFrontFace,n as isShadow,r as isShadowLike};
@@ -1,9 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{glsl as e}from"../../shaderModules/glsl.js";function r(r,c){c.spherical?r.vertex.code.add(e`vec3 getLocalUp(in vec3 pos, in vec3 origin) {
3
- return normalize(pos + origin);
4
- }`):r.vertex.code.add(e`vec3 getLocalUp(in vec3 pos, in vec3 origin) {
5
- return vec3(0.0, 0.0, 1.0);
6
- }`),c.spherical?r.vertex.code.add(e`mat3 getTBNMatrix(in vec3 n) {
2
+ import{glsl as e}from"../../shaderModules/glsl.js";function r(r,{spherical:n}){r.vertex.code.add(n?"vec3 getLocalUp(in vec3 pos, in vec3 origin) { return normalize(pos + origin); }":"vec3 getLocalUp(in vec3 pos, in vec3 origin) { return vec3(0.0, 0.0, 1.0); }"),n?r.vertex.code.add(e`mat3 getTBNMatrix(in vec3 n) {
7
3
  vec3 t = normalize(cross(vec3(0.0, 0.0, 1.0), n));
8
4
  vec3 b = normalize(cross(n, t));
9
5
  return mat3(t, b, n);
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/has.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{signal as a}from"../../../../../core/signal.js";import{rotate as e}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as r,squaredLength as h,normalize as o,scale as n,length as c,subtract as d}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l,fromValues as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,fromPoints as f,axis as p}from"../../../../../geometry/support/axisAngleDegrees.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{heightLimit as P}from"../../../environment/weather.js";import{ensureClouds as x}from"./Clouds.js";class F{constructor(){this.startTime=0,this._data=a(null),this.coverage=0,this.absorption=0,this._readChannels=0,this.parallax=new w,this.parallaxNew=new w,this._anchorPoint=l(),this._fadeState=a(0),this._fadeFactor=a(1)}get data(){return this._data.value}set data(t){this._data.value=t}get readChannels(){return this._readChannels}needsStationaryAnchorUpdate(t){return C&&this._stationaryAnchorPointDistance(t)>j}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case 0:return 0;case 4:return 1-this.fadeFactor;case 1:return this.fadeFactor;case 2:case 3:return 1}}fade(a,e,s,i){if(this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this.startTime)/(y*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),i&&this.needsStationaryAnchorUpdate(a))switch(this.fadeState){case 3:r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 1:case 2:r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint)}this._updateParallax(a)}_evaluateState(t,a){const e=t.relativeElevation,s=this._updateAnchorPoint(t);(Math.abs(e)>1.7*P||s>k)&&this.opacity>0?this._startFade(0,a):this.isFading||(Math.abs(e)>P||s>N*k?this.opacity>0&&this._startFade(4,a):x(this.data)&&(0===this.opacity?this._startFade(1,a):2===this.data.state&&(2===this.fadeState?this._startFade(3,a):this._startFade(2,a))))}_updateParallax(t){const a=h(t.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(a-m.radius*m.radius,0))/Math.sqrt(a),f(S,this.parallax.anchorPoint,v),e(this.parallax.transform,s,v[3],p(v)),f(S,this.parallaxNew.anchorPoint,v),e(this.parallaxNew.transform,s,v[3],p(v))}_updateAnchorPoint(t){return o(this._anchorPoint,t.eye),n(this._anchorPoint,this._anchorPoint,m.radius),0===this.fadeState&&2===this.data?.state?(r(this.parallax.anchorPoint,this._anchorPoint),0):c(d(g,this.parallax.anchorPoint,this._anchorPoint))}_stationaryAnchorPointDistance(t){switch(this.fadeState){case 1:case 2:return o(b,t.eye),n(b,b,m.radius),c(d(g,this.parallax.anchorPoint,b));case 3:return o(b,t.eye),n(b,b,m.radius),c(d(g,this.parallaxNew.anchorPoint,b));case 0:case 4:return 0;default:return this.fadeState,0}}requestFade(){this._fadeFactor.value=0}_startFade(t,a){switch(this._fadeState.value=t,this.startTime=a,t){case 3:this.requestFade(),this._switchReadChannels(),r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 1:this.requestFade(),this._switchReadChannels(),r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 4:this.requestFade();break;case 2:this._switchReadChannels(),r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case 0:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&2!==this.data.state&&(this.data.state=0),this.fadeState){case 3:r(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=2;break;case 1:this._fadeState.value=2;break;case 4:this._fadeState.value=0;break;case 2:case 0:break;default:this.fadeState}}_switchReadChannels(){2===this.data?.state&&(this._readChannels=1-this._readChannels,this.data.state=3)}get isFading(){return 4===this.fadeState||1===this.fadeState||3===this.fadeState}}class w{constructor(){this.anchorPoint=l(),this.radiusCurvatureCorrection=0,this.transform=i()}}const S=u(0,0,1),v=_(),g=l(),b=l(),y=1.25,C=!1,j=1e-6,N=.5,k=2e5;export{F as CloudsParameters};
2
+ import"../../../../../core/has.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{signal as a}from"../../../../../core/signal.js";import{rotate as e}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as r,squaredLength as h,normalize as o,scale as n,length as c,subtract as d}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromPoints as f,axis as p}from"../../../../../geometry/support/axisAngleDegrees.js";import{earth as m}from"../../../../../geometry/support/Ellipsoid.js";import{heightLimit as P}from"../../../environment/weather.js";import{ensureClouds as x}from"./Clouds.js";class F{constructor(){this._data=a(null),this._startTime=0,this.coverage=0,this.absorption=0,this._readChannels=0,this.parallax=new w,this.parallaxNew=new w,this._anchorPoint=l(),this._fadeState=a(0),this._fadeFactor=a(1)}get data(){return this._data.value}set data(t){this._data.value=t}get readChannels(){return this._readChannels}needsStationaryAnchorUpdate(t){return C&&this._stationaryAnchorPointDistance(t)>j}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case 0:return 0;case 4:return 1-this.fadeFactor;case 1:return this.fadeFactor;case 2:case 3:return 1}}fade(a,e,s,i){if(this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this._startTime)/(y*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),i&&this.needsStationaryAnchorUpdate(a))switch(this.fadeState){case 3:r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 1:case 2:r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint)}this._updateParallax(a)}_evaluateState(t,a){const e=t.relativeElevation,s=this._updateAnchorPoint(t);(Math.abs(e)>1.7*P||s>k)&&this.opacity>0?this._startFade(0,a):this.isFading||(Math.abs(e)>P||s>N*k?this.opacity>0&&this._startFade(4,a):x(this.data)&&(0===this.opacity?this._startFade(1,a):2===this.data.state&&(2===this.fadeState?this._startFade(3,a):this._startFade(2,a))))}_updateParallax(t){const a=h(t.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(a-m.radius*m.radius,0))/Math.sqrt(a),f(S,this.parallax.anchorPoint,v),e(this.parallax.transform,s,v[3],p(v)),f(S,this.parallaxNew.anchorPoint,v),e(this.parallaxNew.transform,s,v[3],p(v))}_updateAnchorPoint(t){return o(this._anchorPoint,t.eye),n(this._anchorPoint,this._anchorPoint,m.radius),0===this.fadeState&&2===this.data?.state?(r(this.parallax.anchorPoint,this._anchorPoint),0):c(d(g,this.parallax.anchorPoint,this._anchorPoint))}_stationaryAnchorPointDistance(t){switch(this.fadeState){case 1:case 2:return o(b,t.eye),n(b,b,m.radius),c(d(g,this.parallax.anchorPoint,b));case 3:return o(b,t.eye),n(b,b,m.radius),c(d(g,this.parallaxNew.anchorPoint,b));case 0:case 4:return 0;default:return this.fadeState,0}}requestFade(){this._fadeFactor.value=0}_startFade(t,a){switch(this._fadeState.value=t,this._startTime=a,t){case 3:this.requestFade(),this._switchReadChannels(),r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 1:this.requestFade(),this._switchReadChannels(),r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint);break;case 4:this.requestFade();break;case 2:this._switchReadChannels(),r(this.parallax.anchorPoint,this._anchorPoint),r(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case 0:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&2!==this.data.state&&(this.data.state=0),this.fadeState){case 3:r(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=2;break;case 1:this._fadeState.value=2;break;case 4:this._fadeState.value=0;break;case 2:case 0:break;default:this.fadeState}}_switchReadChannels(){2===this.data?.state&&(this._readChannels=1-this._readChannels,this.data.state=3)}get isFading(){return 4===this.fadeState||1===this.fadeState||3===this.fadeState}}class w{constructor(){this.anchorPoint=l(),this.radiusCurvatureCorrection=0,this.transform=i()}}const S=_(0,0,1),v=u(),g=l(),b=l(),y=1.25,C=!1,j=1e-6,N=.5,k=2e5;export{F as CloudsParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- class s{constructor(s,t,i,n,e,o,h,a,c=.5){this.coverage=s,this.density=t,this.absorption=i,this.cloudSize=n,this.detailSize=e,this.smoothness=o,this.cloudHeight=h,this.raymarchingSteps=a,this.median=c}}const t={sunny:new s([0,.6],[.03,.03],[0,0],[.9,.9],[.8,.8],[.7,.7],[.05,.05],0),cloudy:new s([.3,.65],[.2,.4],[0,0],[.85,.85],[.75,.75],[.3,.4],[1,1],2,.6),rainy:new s([.6,.8],[.5,.8],[.1,.5],[.9,.9],[.75,.75],[.5,.5],[1,1],2,.4),snowy:new s([.25,.75],[.3,.3],[0,0],[.95,.95],[.7,.7],[.69,.75],[.3,1],1,.65),foggy:new s([.8,.8],[.5,.5],[0,0],[.95,.95],[.9,.9],[.55,.55],[.3,.3],0)};t.default=t.sunny;export{s as CloudPreset,t as cloudPresets};
2
+ class s{constructor(s,e,t,n,i,o,c,a,h=.5){this.coverage=s,this.density=e,this.absorption=t,this.cloudSize=n,this.detailSize=i,this.smoothness=o,this.cloudHeight=c,this.raymarchingSteps=a,this.median=h}}const e={sunny:new s([0,.6],[.03,.03],[0,0],[.9,.9],[.8,.8],[.7,.7],[.05,.05],0),cloudy:new s([.3,.65],[.2,.4],[0,0],[.85,.85],[.75,.75],[.3,.4],[1,1],2,.6),rainy:new s([.6,.8],[.5,.8],[.1,.5],[.9,.9],[.75,.75],[.5,.5],[1,1],2,.4),snowy:new s([.25,.75],[.3,.3],[0,0],[.95,.95],[.7,.7],[.69,.75],[.3,1],1,.65),foggy:new s([.8,.8],[.5,.5],[0,0],[.95,.95],[.9,.9],[.55,.55],[.3,.3],0)};e.default=e.sunny;const t=e.cloudy.coverage[0]/e.rainy.coverage[0];export{s as CloudPreset,e as cloudPresets,t as rainyToCloudy};
@@ -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 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 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,l=e.colorTexture?.descriptor,u=l?.internalFormat,f=[],m=new Array,v=new Array;let x=!1;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);f.push(e);const{hasMipmap:r,isImmutable:n}=o.descriptor;"float"!==e||r||n||(o.generateMipmap(),m[t]=!0),x||=r}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(u))});const $=this.renderingContext,{depthStencilTexture:b,level:C}=e,y=this._ensureProgram($,null!=b,f,x?C:null),R=this.fboCache.acquire(t,o,"fbo visualizer");$.useProgram(y);const w=$.boundFramebuffer;$.bindFramebuffer(R.fbo);const B=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;$.bindTexture(e.getColorTexture(r),t),y.setUniform1i(o,t),t>0&&R.acquireColor(p+t,5,"fbo visualizer"),B.push(r)});const A=b?.descriptor.linearFilterDepth??!1;if(b){const r=e.colorAttachments.length;b.setShadowFiltering(!1),$.bindTexture(b,r),y.setUniform1i("depthTex",r);const t=p+r;t>p&&R.acquireColor(t,5,"fbo visualizer"),B.push(t)}$.gl.drawBuffers(B),h($.gl);const I=$.getViewport();return $.setViewport(0,0,t,o),$.setClearColor(0,0,0,0),$.clear(16384),$.setBlendingEnabled(!0),$.setBlendFunction(1,771),y.setUniform1iv("inputTypes",v.length>0?v:[7]),y.setUniform2fv("nearFar",this.camera.nearFar),$.screen.draw(),h($.gl),$.bindFramebuffer(w),$.setViewport(I.x,I.y,I.width,I.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=R.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===v[o]?T(i?.descriptor.internalFormat):v[o])}),b&&b.setShadowFiltering(A),R}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 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(s),n.setViewport(c.x,c.y,c.width,c.height),a?.release(),p}_ensureProgram(e,r,t,o){const n=x({hasDepthAttachment:r,colorSamplerTypes:t,lod: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=o??0,d=null==o?1:1/2**(o+1),f=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, ${p}).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}).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, ${p}).rgb * float(${d}), 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p})) * 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, ${p}));\n fragColor${t}.rgb *= ${u.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${p}).a), 1.0);\n } else {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}));\n }\n }`,""),m=t.length,g=`#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(m)}) 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 ${f(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 }`,T=e.programCache.get(a,g,l);return this._programs.set(n,T),T}};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,lod: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 a from"../../../webgl/RenderNode.js";import{If as s,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 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,l=e.colorTexture?.descriptor,u=l?.internalFormat,f=[],m=new Array,v=new Array;let x=!1;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);f.push(e);const{hasMipmap:r,isImmutable:n}=o.descriptor;"float"!==e||r||n||(o.generateMipmap(),m[t]=!0),x||=r}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(u))});const $=this.renderingContext,{depthStencilTexture:b,level:C}=e,y=this._ensureProgram($,null!=b,f,x?C:null),R=this.fboCache.acquire(t,o,"fbo visualizer");$.useProgram(y);const w=$.boundFramebuffer;$.bindFramebuffer(R.fbo);const B=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;$.bindTexture(e.getColorTexture(r),t),y.setUniform1i(o,t),t>0&&R.acquireColor(p+t,5,"fbo visualizer"),B.push(r)});const A=b?.descriptor.linearFilterDepth??!1;if(b){const r=e.colorAttachments.length;b.setShadowFiltering(!1),$.bindTexture(b,r),y.setUniform1i("depthTex",r);const t=p+r;t>p&&R.acquireColor(t,5,"fbo visualizer"),B.push(t)}$.gl.drawBuffers(B),h($.gl);const I=$.getViewport();return $.setViewport(0,0,t,o),$.setClearColor(0,0,0,0),$.clear(16384),$.setBlendingEnabled(!0),$.setBlendFunction(1,771),y.setUniform1iv("inputTypes",v.length>0?v:[7]),y.setUniform2fv("nearFar",this.camera.nearFar),$.screen.draw(),h($.gl),$.bindFramebuffer(w),$.setViewport(I.x,I.y,I.width,I.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=R.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===v[o]?T(i?.descriptor.internalFormat):v[o])}),b&&b.setShadowFiltering(A),R}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 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(s),n.setViewport(c.x,c.y,c.width,c.height),a?.release(),p}_ensureProgram(e,r,t,o){const n=x({hasDepthAttachment:r,colorSamplerTypes:t,lod: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=o??0,d=1,f=null==o?1/d:1/2**(o+1)/d,m=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, ${p}).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}).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, ${p}).rgb * float(${f}), 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p})) * 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, ${p}));\n fragColor${t}.rgb *= ${u.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(readTexture(colorTex${t}, uv, ${p}).a), 1.0);\n } else {\n fragColor${t} = vec4(readTexture(colorTex${t}, uv, ${p}));\n }\n }`,""),g=t.length,T=`#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(g)}) 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 ${m(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 }`,F=e.programCache.get(a,T,l);return this._programs.set(n,F),F}};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,lod: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"../../../../../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";
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"../glow/applyEmissiveGlow.glsl.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{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};
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 o}from"../../../../../core/signal.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{add as h,normalize as m,length as p,dot as l,scale as u,lerp as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as d}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{heightLimit as f}from"../../../environment/weather.js";import{betaRayleigh as P,betaCombined as v}from"../atmosphere/atmosphereUtils.js";import{F as b}from"../../../../../chunks/Fog.glsl.js";import{FogTechnique as w}from"./FogTechnique.js";import{BlurEmission as y}from"../glow/BlurEmission.js";import{EmissiveTechniqueConfiguration as F}from"../../shaders/EmissiveTechniqueConfiguration.js";import{floatBlendReductionFactor as j}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as B,SizedPixelFormat as C,ColorAttachment0 as q,DepthStencilAttachment as x}from"../../../../webgl/enums.js";const E=.9*f,T=1.1*f;let A=class extends y{constructor(){super(...arguments),this._configuration=new F,this._newParameters=new M,this._oldParameters=new M,this._fadedParameters=new M,this._parameters=this._newParameters,this._passParameters=new b}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,()=>this._updateEnabled(),i),a(()=>this.view.environment.weather,()=>this._updateEnabled(),i),a(()=>this._updateFogParameters(),()=>{},i),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=G),"rainy"===e.type&&(this._newParameters.fogBrightness=z),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(E,T,Math.abs(e-this._ellipsoid.radius))}precompile(){this._update(),this._passParameters.amount>0&&(super.precompile(),this.techniques.precompile(w,this._configuration))}render(){const e=this.input,t=this._getTechnique();if(!t)return e;this._passParameters.emission=e.obtainAttachment(B),this._passParameters.inputScale=this._passParameters.emission?.attachment.descriptor.internalFormat===C.RGBA8?j:1;const s=this.renderingContext;this._passParameters.emission&&(this._renderEmissionMipMap(),this._configuration.useFloatBlend?(e.acquireColor(B,8,"emissive"),s.clearBuffer(1,d)):(this._passParameters.color=e.obtainAttachment(q),e.acquireColor(q,5),e.acquireColor(B,8,"emissive")));const a=e.getAttachment(x);return e.attachDepth(null),s.bindFramebuffer(e.fbo),s.bindTechnique(t,this.bindParameters,this._passParameters),s.screen.draw(),this._passParameters.color=r(this._passParameters.color),this._passParameters.emission=r(this._passParameters.emission),this._passParameters.mipmapTexture=r(this._passParameters.mipmapTexture),e.attachDepth(a),this.fboCache.debugCallback?.("fog-color",e.fbo),e}_getTechnique(){return this.renders?this.techniques.get(w,this._configuration):null}get renders(){return this._update(),this._passParameters.amount>0}_update(){const e=this.bindParameters.camera;m(R,e.eye);const t=Math.max(0,l(R,this.bindParameters.lighting.mainLight.direction)),s=this._parameters.fogBrightness;u(this._passParameters.fogColor,k,s),u(S,k,.1*s),c(this._passParameters.fogColor,S,this._passParameters.fogColor,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,this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value}get test(){return{parameters:this._passParameters}}};A=e([n("esri.views.3d.webgl-engine.effects.fog.Fog")],A);class M{constructor(){this.fogBrightness=0,this.strength=o(0),this.amount=o(0)}copy(e){this.fogBrightness=e.fogBrightness,this.strength.value=e.strength.value,this.amount.value=e.amount.value}lerp(e,t,r){this.fogBrightness=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 R=g(),S=g(),U=_(3e-4,3e-4,3e-4),k=g();h(k,v,P),h(k,k,U),m(k,k);const D=k.reduce((e,t)=>e+t,0)/3,z=.5/D,G=1.5/D;export{A as Fog,M as FogParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/Fog.glsl.js";import{makePipelineState as t,defaultColorWrite as c,separateBlendingParams as n}from"../../../../webgl/renderState.js";let l=class extends s{constructor(){super(...arguments),this.shader=new o(i,()=>import("./Fog.glsl.js"))}initializePipeline(){return t({blending:n(770,0,771,1),colorWrite:c})}};l=e([r("esri.views.3d.webgl-engine.effects.fog.FogTechnique")],l);export{l as FogTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/Fog.glsl.js";import{makePipelineState as t,defaultColorWrite as n,separateBlendingParams as c}from"../../../../webgl/renderState.js";let l=class extends s{constructor(){super(...arguments),this.shader=new o(i,()=>import("./Fog.glsl.js"))}initializePipeline(){const{useFloatBlend:e,hasEmissive:r}=this._configuration;return t(e||!r?{blending:c(770,0,771,1),colorWrite:n}:{colorWrite:n})}};l=e([r("esri.views.3d.webgl-engine.effects.fog.FogTechnique")],l);export{l as FogTechnique};
@@ -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 s,syncAndInitial as r}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,w=100;let P=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(s(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._reset(),this._requestRender()},r))}destroy(){this._lastOutput=t(this._lastOutput)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||!(this._passParameters.accumulatedFrames>w)&&this._configuration.hasEmission||this._reset()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._lastOutput?.retain(),this._lastOutput;const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),r=t?.getTexture(f),a=this._mode;if(!s||!r)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=s,this._passParameters.depthTexture=r,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,2);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,2),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:s}=this.bindParameters.camera,r=this.fboCache.acquire(t,s,o.AMBIENT_ILLUMINATION).acquireColor(b,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,s),e.clearBuffer(0,[0,0,0,1]),e.clearBuffer(1,[0,0,0,0]),r}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:s}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!s||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()],P.prototype,"consumes",void 0),e([a()],P.prototype,"produces",void 0),P=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],P);export{P as GlobalIllumination,g as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as t}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as r}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{UNIT_W as o,ZEROS as u}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as n}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{G as h}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as c}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as _}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as d}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as f}from"../../../../../chunks/GlobalIlluminationUpscale.glsl.js";import{GlobalIlluminationUpscaleTechnique as b}from"./GlobalIlluminationUpscaleTechnique.js";import{DepthStencilAttachment as g,ColorAttachment1 as w}from"../../../../webgl/enums.js";const P=1,I=100;let x=class extends m{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=n.AMBIENT_ILLUMINATION,this._passParameters=new h,this._drawParameters=new c,this._drawParametersUpscale=new f,this._maxFrames=256,this._lowQualityResolutionScale=.25,this._configuration=new d,this._lastOutput=null,this._isGlobalIlluminationUpdate=!1,this._resetBuffer=!1}initialize(){this.addHandles(s(()=>this.view.stage.renderer.hasGlobalIllumination,()=>{this._reset(),this._requestRender()},r))}destroy(){this._lastOutput=t(this._lastOutput)}resetAccumulatedFrames(){this._isGlobalIlluminationUpdate||!(this._passParameters.accumulatedFrames>I)&&this._configuration.hasEmission||this._reset()}render(e){if(this._passParameters.accumulatedFrames>=this._maxFrames)return this._lastOutput?.retain(),this._lastOutput;const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),r=t?.getTexture(g),a=this._mode;if(!s||!r)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 o=this.techniques.getCompiled(_,this._configuration),u=this.techniques.getCompiled(p),m=1===a,h=m?this._lowQualityResolutionScale:1,c=m?this.techniques.getCompiled(b):null;if(!o||!u||m&&!c)return this._requestRender(),this._emptyOutput;const d=this.renderingContext,{camera:f}=i;this._passParameters.normalTexture=s,this._passParameters.depthTexture=r,this._passParameters.projScale=1/f.computeScreenPixelSizeAtDist(1),this._passParameters.scaleGlobalIllumination=h;const{fullWidth:I,fullHeight:x}=f,T=Math.max(1,Math.floor(I*h)),q=Math.max(1,Math.floor(x*h)),F=this.fboCache.acquire(T,q,"global illumination input").acquireColor(w,2);d.bindFramebuffer(F.fbo),d.setViewport(0,0,T,q),d.bindTechnique(o,i,this._passParameters,this._drawParameters),d.screen.draw();const O=F.obtainAttachment(w),C=Math.max(1,Math.round(T/P)),G=Math.max(1,Math.round(q/P)),j=this.fboCache.acquire(C,G,"global illumination blur horizontal");d.bindFramebuffer(j.fbo),this._drawParameters.texture=F.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,0,P/q),d.bindTechnique(u,i,this._passParameters,this._drawParameters),d.setViewport(0,0,C,G),d.screen.draw(),F.release();const y=m?"global illumination blur vertical":n.AMBIENT_ILLUMINATION,M=this.fboCache.acquire(C,G,y);d.bindFramebuffer(M.fbo),d.setViewport(0,0,C,G),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.texture=j.getTexture(),this._drawParameters.weightTexture=O.attachment,l(this._drawParameters.blurSize,P/C,0),d.bindTechnique(u,i,this._passParameters,this._drawParameters),d.setViewport(0,0,C,G),d.screen.draw(),j.release(),M.attachColor(O,w),O.release();let R=M;return c&&(R=this.fboCache.acquire(I,x,n.AMBIENT_ILLUMINATION).acquireColor(w,2),d.bindFramebuffer(R.fbo),d.setViewport(0,0,I,x),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParametersUpscale.colorTexture=M.getTexture(),this._drawParametersUpscale.weightTexture=M.getTexture(w),d.bindTechnique(c,i,this._passParameters,this._drawParametersUpscale),d.screen.draw(),M.release()),d.setViewport4fv(f.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:s}=this.bindParameters.camera,r=this.fboCache.acquire(t,s,n.AMBIENT_ILLUMINATION).acquireColor(w,2);return e.bindFramebuffer(r.fbo),e.setViewport(0,0,t,s),e.clearBuffer(0,o),e.clearBuffer(1,u),r}get _canRender(){const{reprojection:e,hasEmission:t,globalIllumination:s}=this.bindParameters;return!(!e.lastFrameColor||t&&!e.lastFrameEmission||!e.lastFrameDepth||!s||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()],x.prototype,"consumes",void 0),e([a()],x.prototype,"produces",void 0),x=e([i("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],x);export{x as GlobalIllumination,P as blurSizePixels};
@@ -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/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";
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{B as BlurEmissionDrawParameters,b as build}from"../../../../../chunks/BlurEmission.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{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{getReferenceEllipsoid as o}from"../../../../../geometry/ellipsoidUtils.js";import{TransparentEnvironment as h}from"../TransparentEnvironment.js";import{B as n}from"../../../../../chunks/BlurEmission.glsl.js";import{BlurEmissionTechnique as l}from"./BlurEmissionTechnique.js";import{floatBlendReductionFactor as m}from"../../shaders/floatBlendScale.glsl.js";import{noParameters as p}from"../../../../webgl/NoParameters.js";let d=class extends h{constructor(e){super(e),this._glowBoost={realistic:0,cartographicMin:.5,cartographicDefault:2.5,cartographicMax:5},this._drawParameters=new n,this._ellipsoid=o(e.view.spatialReference)}initialize(){this.addHandles([r(()=>this._boost,e=>{this._passParameters.boost=e,this.requestRender(1)},s),r(()=>this.view.stage.renderView.fog?.strength??0,e=>{this._passParameters.scattering=e,this.requestRender(1)},s)])}precompile(){this.techniques.precompile(l)}get _atmosphereRadius(){return this._ellipsoid.radius+this._ellipsoid.atmosphereHeight}_renderEmissionMipMap(){const e=this._passParameters.emission?.attachment;if(!e)return;this._drawParameters.input=e,this._drawParameters.inputScale=this.bindParameters.useFloatBlend.value?1:m,this._drawParameters.level=0,a(this._drawParameters.size,1,1);const t=Math.floor(.5*e.descriptor.width),r=Math.floor(.5*e.descriptor.height),s=this.fboCache,i=s.acquire(t,e.descriptor.height,"blur horizontal",8);let o,h=t,n=e.descriptor.height;const d=this.renderingContext,c=this.techniques.get(l),g=d.bindTechnique(c,this.bindParameters,p);for(;h>=1&&n>=1;)this._drawParameters.isHorizontal=!0,this._setupFBO(i,h,n),g.bindDraw(this.bindParameters,p,this._drawParameters),d.screen.draw(),n=Math.floor(.5*n),this._drawParameters.input=i.getTexture(),this._drawParameters.inputScale=1,this._drawParameters.isHorizontal=!1,a(this._drawParameters.size,h/t,n/r),o??=s.acquire(h,n,"blur mipmap",9),this._setupFBO(o,h,n,this._drawParameters.level),g.bindDraw(this.bindParameters,p,this._drawParameters),d.screen.draw(),s.debugCallback?.(o.name,o.fbo),h=Math.floor(.5*h),this._drawParameters.input=o.getTexture(),++this._drawParameters.level;i.release(),o&&(o.fbo.level=0),this._passParameters.mipmapLevels=this._drawParameters.level,this._passParameters.mipmapTexture=o,d.setViewport(0,0,e.descriptor.width,e.descriptor.height)}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 _hasBlur(){return 2!==this._mode}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(e,t,r,s=0){e.fbo.level=s;const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,r),i.setClearColor(0,0,0,0),i.clear(16384)}};d=e([i("esri.views.3d.webgl-engine.effects.glow.BlurEmission")],d);export{d as BlurEmission};
@@ -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 r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/BlurEmission.glsl.js";import{makePipelineState as t,defaultColorWrite as l}from"../../../../webgl/renderState.js";let n=class extends o{constructor(){super(...arguments),this.shader=new s(i,()=>import("./BlurEmission.glsl.js"))}initializePipeline(){return t({colorWrite:l})}};n=e([r("esri.views.3d.webgl-engine.effects.glow.BlurEmissionTechnique")],n);export{n as BlurEmissionTechnique};
@@ -0,0 +1,37 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"../../../environment/FoggyWeather.js";import{ReadDepth as t}from"../../core/shaderLibrary/output/ReadDepth.glsl.js";import{FloatBindUniform as a}from"../../core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as o}from"../../core/shaderModules/FloatPassUniform.js";import{glsl as i}from"../../core/shaderModules/glsl.js";import{Texture2DBindUniform as r}from"../../core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as l}from"../../core/shaderModules/Texture2DPassUniform.js";import{DistanceFalloffPassParameters as s,getDistanceFalloff as n}from"../raymarching/DistanceFalloff.glsl.js";import{floatBlendScale as m}from"../../shaders/floatBlendScale.glsl.js";import{ToneMapping as p}from"../../shaders/ToneMapping.glsl.js";class c extends s{constructor(){super(...arguments),this.mipmapLevels=1,this.boost=1,this.scattering=1e-4}}function d(s,c){s.include(m,c),s.include(n),s.include(t),s.include(p),s.uniforms.add(new l("emissionTexture",({emission:e})=>e?.attachment),new r("depthTexture",({mainDepth:e})=>e),new o("scattering",({scattering:e})=>e),new o("boost",({boost:e})=>1+.5*e),new o("levels",({mipmapLevels:e},{camera:t})=>e+1+Math.log2(t.pixelScale)),new a("pixelRatioCorrection",({camera:e})=>Math.log2(e.pixelScale)),new l("mipmapTexture",({mipmapTexture:e})=>e?.getTexture())).constants.add("maxScattering","float",e.maxScattering).constants.add("weightEpsilon","float",.005).code.add(i`vec3 readEmission(float level) {
3
+ level *= levels;
4
+ level = max(0.0, level - pixelRatioCorrection);
5
+ return level < 1.0 ?
6
+ texture(emissionTexture, uv).rgb * floatBlendInputScale * (1.0 - level) +
7
+ textureLod(mipmapTexture, uv, 0.0).rgb * level * 0.5 :
8
+ textureLod(mipmapTexture, uv, level - 1.0).rgb / pow(2.0, level);
9
+ }
10
+ float gauss(float x, float sigmaSq) {
11
+ float expon = -(pow(x, 2.0) / (2.0 * sigmaSq));
12
+ return exp(expon) / sqrt(6.283185307179586 * sigmaSq);
13
+ }
14
+ vec3 applyEmissiveGlow() {
15
+ float mainDepth = -1.0;
16
+ float depthSample = depthFromTexture(depthTexture, uv);
17
+ if(depthSample < 1.0 && depthSample > 0.0){
18
+ vec3 cameraSpaceRay = normalize(eyeDir);
19
+ cameraSpaceRay /= cameraSpaceRay.z;
20
+ cameraSpaceRay *= linearizeDepth(depthSample);
21
+ mainDepth = max(0.0, length(cameraSpaceRay));
22
+ }
23
+ vec3 rayDir = normalize(worldRay);
24
+ float dispersionPerPixel = getDistanceFalloff(mainDepth, rayDir, scattering * 0.5);
25
+ float mainPoint = pow(dispersionPerPixel, 2.0);
26
+ vec3 emission = vec3(0.0);
27
+ float weights = 0.0;
28
+ float sigmaSq = (0.1 / maxScattering * scattering + 0.003) + 0.03 * (boost - 1.0);
29
+ for(float level = floor(mainPoint); level < levels; ++level) {
30
+ float point = level / levels;
31
+ float dist = abs(point - mainPoint);
32
+ float weight = gauss(dist, sigmaSq);
33
+ emission += readEmission(point) * weight;
34
+ weights += weight;
35
+ }
36
+ return emission * boost / weights;
37
+ }`)}export{c as BlurEmissionPassParameters,d as applyEmissiveGlow};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{sliceEquals as t}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,sync as r}from"../../../../../core/reactiveUtils.js";import{signal as a}from"../../../../../core/signal.js";import{property as o,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as u,equals as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ReadShadowMapPassParameters as d}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{volumeToVao as _}from"../focusArea/focusAreaMaskUtils.js";import{S as p}from"../../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as f}from"./ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as g}from"./ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as b}from"./ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as v}from"./ShadowCastMaskTechnique.js";import{BindParameters as y}from"../../lib/BindParameters.js";import{DepthRange as S}from"../../lib/DepthRange.js";import{createQuadVAO as w}from"../../lib/glUtil3D.js";import{ShadowMap as A}from"../../lib/ShadowMap.js";import{V as C}from"../../../../../chunks/VolumeMask.glsl.js";import{PrimitiveType as x,DepthStencilAttachment as R,PixelType as V}from"../../../../webgl/enums.js";import{DisposableFramebufferObject as F}from"../../../../webgl/FramebufferObject.js";import{noParameters as P}from"../../../../webgl/NoParameters.js";let H=class extends m{constructor(e){super(e),this.consumes={required:[]},this.produces=l.SHADOW_ACCUMULATION,this._fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new g(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new g(1),()=>this._requestRenderIfEnabled()),this._passParameters=new d,this._maskParameters=new C,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=S.Zero,this._didAccumulate=!1,this._enabled=!1,this._previewing=!1,this.accumulationRenderer=null,this._shadowAccumulatorKey=Symbol("shadowAccumulator");const{view:t}=e,i=t.stage.renderer.fboCache;this._accumulationBindParameters=new y(i.rctx,new A(i,t.stage.viewingMode)),this._accumulationBindParameters.shadowMap.enabled=!0,this._vao=w(i.rctx),this._tmpReadFbo=new F(i.rctx),this.addHandles([s(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},r),s(()=>this._numActive,()=>this._numActiveChanged(),r)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this.accumulationRenderer=null,this._fboHandle=i(this._fboHandle),this._vao=i(this._vao),this._volumeVao=i(this._volumeVao),this._tmpReadFbo=i(this._tmpReadFbo),this._accumulationBindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this._fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&this._accumulationSets().some(e=>e.active)}get canAccumulate(){return null!=this._accumulationBindParameters.depth&&this._depthRange!==S.Zero&&null!=this.accumulationRenderer&&this.accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return this._accumulationSets().every(e=>e.doneAccumulating)}get _numActive(){return this._accumulationSets().reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=i(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const i of this._accumulationSets())i.configuration.useMask=t;if(!t)return;const s=e.geometryVolume,{vao:r,vertexCount:a}=_(this._rctx,s);this._volumeVao=r,this._volumeVertexCount=a}get requireGeometryDepth(){return this.accumulating||null!=this._volumeVao}precompile(){if(this.active&&(this._fullyRecompute=0!==this.bindParameters.frameRendererTarget,this.accumulating)){for(const e of this._accumulationSets())this.techniques.precompile(f,e.configuration),this.techniques.precompile(b,e.configuration);this.techniques.precompile(v)}}get didAccumulate(){return this._didAccumulate}render(){this._updateCamera(),this._didAccumulate=this._renderAccumulation(),this._updateMask();const e=this._fboHandle;return e?.retain(),e}_renderAccumulation(){if(!this.active)return!1;if(this._accumulationBindParameters.contentCamera=this.bindParameters.contentCamera,this._accumulationBindParameters.depth=this.bindParameters.depth,this._passParameters.origin=this._accumulationBindParameters.camera.center,!this.canAccumulate)return this._accumulationBindParameters.depth=null,!1;if(this._renderAreaMask(),!this.accumulating)return this._accumulationBindParameters.depth=null,!1;(this._previewing||this._fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._accumulationBindParameters);const e=this._accumulateSetsForRenderFrame(this._previewing&&!this._fullyRecompute,this._accumulationBindParameters);return this._accumulationBindParameters.depth=null,e}_renderAreaMask(){const e=this.techniques.getCompiled(v),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(14);const a=this._rctx,o=this._accumulationBindParameters,n=o.depth,u=this._tmpReadFbo;u.attachDepthStencil(n?.attachment),a.blitFramebuffer(u,s.fbo,256),u.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const h=a.bindTechnique(e,o,P);this._maskParameters.origin=r.origin,h.bindDraw(o,P,this._maskParameters),a.bindVAO(t),a.drawArrays(x.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(e){if(this._accumulationSets().every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this.requestRender(1),i}_accumulateSet(e,t,i){const s=t?Math.min(q,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}_updateMask(){this.accumulationRenderer?.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this.accumulationRenderer?.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,V.UNSIGNED_BYTE,j),j[0]/i)}_updateCamera(){if(!this.active)return;const e=this.bindParameters.camera,t=this._accumulationBindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this.accumulationRenderer?.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this.requestRender(1)}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=i(this._fboHandle),this._enabled=!1,this.requestRender(1))}_createFBO(e,t){return this.fboCache.acquire(e,t,this.produces,this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this.techniques.get(b,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this.view.stage.renderer.renderShadowAccumulationShadowMap(t.camera,t.contentCamera,this._accumulationBindParameters.shadowMap,e.lightDirections[e.progress++],this._depthRange);const i=this.techniques.get(f,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this.requestRender(1)}get _rctx(){return this.renderingContext}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([o()],H.prototype,"consumes",void 0),e([o()],H.prototype,"produces",void 0),e([o()],H.prototype,"_refining",null),e([o()],H.prototype,"active",null),e([o()],H.prototype,"_doneAccumulating",null),e([o()],H.prototype,"_numActive",null),e([o()],H.prototype,"_colorFormat",null),e([o()],H.prototype,"_depthRange",void 0),e([o()],H.prototype,"_enabled",void 0),e([o()],H.prototype,"_previewing",void 0),e([o()],H.prototype,"accumulationRenderer",void 0),H=e([n("esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowAccumulator")],H);const q=6,j=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=a(0),this._sampleCount=a(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const i=this._cachedLightDirections,s=Math.min(p,e.length);if(!t(i,0,i.length,e,0,s,h)){i.length=s,this._sampleCount.value=s;for(let t=0;t<s;++t)i[t]=u(i[t]??c(),e[t]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}}export{H as ShadowAccumulator};
2
+ import{__decorate as e}from"tslib";import{sliceEquals as t}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,sync as r}from"../../../../../core/reactiveUtils.js";import{signal as a}from"../../../../../core/signal.js";import{property as o,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as u,equals as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ReadShadowMapPassParameters as d}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{volumeToVao as _}from"../focusArea/focusAreaMaskUtils.js";import{S as p}from"../../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as f}from"./ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as g}from"./ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as b}from"./ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as v}from"./ShadowCastMaskTechnique.js";import{BindParameters as y}from"../../lib/BindParameters.js";import{DepthRange as S}from"../../lib/DepthRange.js";import{createQuadVAO as w}from"../../lib/glUtil3D.js";import{ShadowMap as A}from"../../lib/ShadowMap.js";import{V as C}from"../../../../../chunks/VolumeMask.glsl.js";import{PrimitiveType as x,DepthStencilAttachment as R,PixelType as V}from"../../../../webgl/enums.js";import{DisposableFramebufferObject as F}from"../../../../webgl/FramebufferObject.js";import{noParameters as P}from"../../../../webgl/NoParameters.js";let H=class extends m{constructor(e){super(e),this.consumes={required:[]},this.produces=l.SHADOW_ACCUMULATION,this._fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new g(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new g(1),()=>this._requestRenderIfEnabled()),this._passParameters=new d,this._maskParameters=new C,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=S.Zero,this._didAccumulate=!1,this._enabled=!1,this._previewing=!1,this.accumulationRenderer=null,this._shadowAccumulatorKey=Symbol("shadowAccumulator");const{view:t}=e,i=t.stage.renderer.fboCache;this._accumulationBindParameters=new y(new A(i,t.stage.viewingMode)),this._accumulationBindParameters.shadowMap.enabled=!0,this._vao=w(i.rctx),this._tmpReadFbo=new F(i.rctx),this.addHandles([s(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},r),s(()=>this._numActive,()=>this._numActiveChanged(),r)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this.accumulationRenderer=null,this._fboHandle=i(this._fboHandle),this._vao=i(this._vao),this._volumeVao=i(this._volumeVao),this._tmpReadFbo=i(this._tmpReadFbo),this._accumulationBindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this._fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&this._accumulationSets().some(e=>e.active)}get canAccumulate(){return null!=this._accumulationBindParameters.depth&&this._depthRange!==S.Zero&&null!=this.accumulationRenderer&&this.accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return this._accumulationSets().every(e=>e.doneAccumulating)}get _numActive(){return this._accumulationSets().reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=i(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const i of this._accumulationSets())i.configuration.useMask=t;if(!t)return;const s=e.geometryVolume,{vao:r,vertexCount:a}=_(this._rctx,s);this._volumeVao=r,this._volumeVertexCount=a}get requireGeometryDepth(){return this.accumulating||null!=this._volumeVao}precompile(){if(this.active&&(this._fullyRecompute=0!==this.bindParameters.frameRendererTarget,this.accumulating)){for(const e of this._accumulationSets())this.techniques.precompile(f,e.configuration),this.techniques.precompile(b,e.configuration);this.techniques.precompile(v)}}get didAccumulate(){return this._didAccumulate}render(){this._updateCamera(),this._didAccumulate=this._renderAccumulation(),this._updateMask();const e=this._fboHandle;return e?.retain(),e}_renderAccumulation(){if(!this.active)return!1;if(this._accumulationBindParameters.contentCamera=this.bindParameters.contentCamera,this._accumulationBindParameters.depth=this.bindParameters.depth,this._passParameters.origin=this._accumulationBindParameters.camera.center,!this.canAccumulate)return this._accumulationBindParameters.depth=null,!1;if(this._renderAreaMask(),!this.accumulating)return this._accumulationBindParameters.depth=null,!1;(this._previewing||this._fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._accumulationBindParameters);const e=this._accumulateSetsForRenderFrame(this._previewing&&!this._fullyRecompute,this._accumulationBindParameters);return this._accumulationBindParameters.depth=null,e}_renderAreaMask(){const e=this.techniques.getCompiled(v),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(14);const a=this._rctx,o=this._accumulationBindParameters,n=o.depth,u=this._tmpReadFbo;u.attachDepthStencil(n?.attachment),a.blitFramebuffer(u,s.fbo,256),u.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const h=a.bindTechnique(e,o,P);this._maskParameters.origin=r.origin,h.bindDraw(o,P,this._maskParameters),a.bindVAO(t),a.drawArrays(x.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(e){if(this._accumulationSets().every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this.requestRender(1),i}_accumulateSet(e,t,i){const s=t?Math.min(q,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}_updateMask(){this.accumulationRenderer?.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this.accumulationRenderer?.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,V.UNSIGNED_BYTE,j),j[0]/i)}_updateCamera(){if(!this.active)return;const e=this.bindParameters.camera,t=this._accumulationBindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this.accumulationRenderer?.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this.requestRender(1)}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=i(this._fboHandle),this._enabled=!1,this.requestRender(1))}_createFBO(e,t){return this.fboCache.acquire(e,t,this.produces,this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this.techniques.get(b,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this.view.stage.renderer.renderShadowAccumulationShadowMap(t.camera,t.contentCamera,this._accumulationBindParameters.shadowMap,e.lightDirections[e.progress++],this._depthRange);const i=this.techniques.get(f,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this.requestRender(1)}get _rctx(){return this.renderingContext}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([o()],H.prototype,"consumes",void 0),e([o()],H.prototype,"produces",void 0),e([o()],H.prototype,"_refining",null),e([o()],H.prototype,"active",null),e([o()],H.prototype,"_doneAccumulating",null),e([o()],H.prototype,"_numActive",null),e([o()],H.prototype,"_colorFormat",null),e([o()],H.prototype,"_depthRange",void 0),e([o()],H.prototype,"_enabled",void 0),e([o()],H.prototype,"_previewing",void 0),e([o()],H.prototype,"accumulationRenderer",void 0),H=e([n("esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowAccumulator")],H);const q=6,j=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=a(0),this._sampleCount=a(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const i=this._cachedLightDirections,s=Math.min(p,e.length);if(!t(i,0,i.length,e,0,s,h)){i.length=s,this._sampleCount.value=s;for(let t=0;t<s;++t)i[t]=u(i[t]??c(),e[t]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}}export{H as ShadowAccumulator};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as a}from"../lighting/SceneLighting.js";class l{constructor(t,i){this.width=t,this.height=i}}const g=5e5;class u{constructor(t,h){this._rctx=t,this.shadowMap=h,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=i(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=i(new e),this._inverseViewport=s(),this._oldLighting=new a,this._newLighting=new a,this._fadedLighting=new a,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=t(this.depth),this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get emissions(){return this._emissions.value}set emissions(t){this._emissions.value=t}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(t){this._camera.value=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=s,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{u as BindParameters,l as ViewportSize};
2
+ import{releaseMaybe as i}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import e from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as n}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as r}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as a}from"../lighting/SceneLighting.js";class l{constructor(i,t){this.width=i,this.height=t}}const g=5e5;class c{constructor(i){this.shadowMap=i,this.output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this.renderingShadowAnalysisMap=!1,this._camera=t(new e),this._inverseViewport=s(),this._oldLighting=new a,this._newLighting=new a,this._fadedLighting=new a,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new r,this.highlights=new Array,this.highlightMixOrigin=s(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new n,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=i(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(i){this._emissions.value=i}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return 1===this.emissions||3===this.emissions}get hasTransparentEmission(){return 2===this.emissions||3===this.emissions}get hasEmissions(){return 0!==this.emissions}get camera(){return this._camera.value}set camera(i){this._camera.value=i,this._inverseViewport[0]=1/i.fullViewport[2],this._inverseViewport[1]=1/i.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<g}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(i,t,s,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=s,this._newLighting.set(i),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(i){i&&(i.name="geometry depth"),this._depth=i}get occluder(){return 10===this.slot||11===this.slot?this.slot:null}}export{c as BindParameters,l as ViewportSize};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{generateUID as i}from"../../../../core/uid.js";import{add as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as e}from"../../../../geometry/support/Indices.js";import{BoundingInfo as s}from"./BoundingInfo.js";import{Object3DHighlightStateID as h}from"./Object3DStateID.js";import{assert as n}from"./Util.js";class o{constructor(t,e,s){this.material=t,this._buffers=e,this.localOrigin=s,this.id=i(),this.type=1,this.baseGeometry=null,this.layerViewUid=null,this.graphicUid=null,this.castShadow=!1,this._readPrimitivePosition=null,this._boundingInfo=null,this._highlights=null,this._highlightOptionsCounts=null,this.occludees=void 0,this.visible=!0;const h=t?.useIndexing??!1,o=null!=e.index;n(h===o,"Material index requirement and BufferGeometry.buffers.index must match")}get buffers(){return this._buffers}get indexCount(){return this._buffers.index?.length??this._buffers.vertex.count??0}get readPrimitivePosition(){return this._readPrimitivePosition??=this.material.createPrimitivePositionReader(this.buffers),this._readPrimitivePosition}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}_calculateBoundingInfo(){const i=this.indexCount;if(0===i)return null;const t=this.material.primitiveVertexCount;n(i%t===0,"Indexing error: "+i+" not divisible by "+t);const h=e(i/t);return new s(h,t,this.readPrimitivePosition)}invalidateBoundingInfo(){this._boundingInfo=null}computeAttachmentOrigin(i){return!!this.material.computeAttachmentOrigin(i,this.readPrimitivePosition,this.indexCount)&&(t(i,i,this.localOrigin.vec3),!0)}get highlights(){return this._highlights||r}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}forEachHighlightOption(i){this._highlightOptionsCounts?.forEach((t,e)=>i(e))}allocateIdAndHighlight(i){const t=new h(i);return this.addHighlight(t)}addHighlight(i){this._ensureHighlights().add(i);const{highlightName:t}=i,e=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,e),i}_ensureHighlights(){let i=this._highlights;return i||(i=new Set,this._highlights=i),i}_ensureHighlightOptionsCounts(){let i=this._highlightOptionsCounts;return i||(i=new Map,this._highlightOptionsCounts=i),i}removeHighlight(i){if(this._highlights?.delete(i)){const{highlightName:t}=i,e=this._highlightOptionsCounts?.get(t)??0;e<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,e-1)}}}const r=new Set;export{o as BufferGeometry};
@@ -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/shading/Gamma.glsl.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../shaders/ToneMapping.glsl.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{E as EmissionCompositePassParameters,b as build}from"../../../../chunks/EmissionComposite.glsl.js";
2
+ import"tslib";import"../core/shaderLibrary/shading/Gamma.glsl.js";import"../core/shaderModules/FloatBindUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import"../effects/glow/applyEmissiveGlow.glsl.js";import"../shaders/floatBlendScale.glsl.js";import"../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../shaders/ToneMapping.glsl.js";import"../../../webgl/ShaderBuilder.js";export{a as EmissionCompositePassParameters,E as EmissionCompositeTechniqueConfiguration,c as build}from"../../../../chunks/EmissionComposite.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as s}from"tslib";import{watch as e,syncAndInitial as t}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderNodeOutput as o}from"../../webgl.js";import a from"../../webgl/RenderNode.js";import{E as m}from"../../../../chunks/EmissionComposite.glsl.js";import{EmissionCompositeTechnique as n}from"./EmissionCompositeTechnique.js";import{floatBlendReductionFactor as p}from"../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as c,ColorAttachment0 as h,SizedPixelFormat as d}from"../../../webgl/enums.js";let l=class extends a{constructor(){super(...arguments),this.produces=o.COMPOSITE,this.consumes={required:[o.COMPOSITE]},this._passParameters=new m}initialize(){this.addHandles([e(()=>0!==this.bindParameters.emissions,s=>this.produces=s?o.COMPOSITE:"disabled",t)])}precompile(){0!==this.bindParameters.emissions&&this.techniques.precompile(n)}render(){const s=this.input,e=s.getAttachment(c);if(!e?.attachment)return s;this._passParameters.color=s.getAttachment(h)?.attachment,this._passParameters.emission=e.attachment,this._passParameters.inputScale=this._passParameters.emission?.descriptor.internalFormat===d.RGBA8?p:1;const t=this.renderingContext,r=this.techniques.get(n),i=this.acquireOutputFramebuffer();return t.clear(16384),t.bindTechnique(r,this.bindParameters,this._passParameters),t.screen.draw(),i.moveAttachments(s),i}};s([r()],l.prototype,"produces",void 0),s([r()],l.prototype,"consumes",void 0),l=s([i("esri.views.3d.webgl-engine.lib.EmissionComposite")],l);export{l as EmissionComposite};
2
+ import{__decorate as s}from"tslib";import{releaseMaybe as e}from"../../../../core/maybe.js";import{watch as t,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{length as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{RenderNodeOutput as m}from"../../webgl.js";import{BlurEmission as n}from"../effects/glow/BlurEmission.js";import{E as p,a as c}from"../../../../chunks/EmissionComposite.glsl.js";import{EmissionCompositeTechnique as h}from"./EmissionCompositeTechnique.js";import{ColorAttachment1 as u,ColorAttachment0 as l}from"../../../webgl/enums.js";let d=class extends n{constructor(){super(...arguments),this.produces=m.COMPOSITE,this.consumes={required:[m.COMPOSITE]},this._configuration=new p,this._passParameters=new c}initialize(){this.addHandles([t(()=>0!==this.bindParameters.emissions,s=>this.produces=s?m.COMPOSITE:"disabled",r)])}precompile(){0!==this.bindParameters.emissions&&(this._configuration.applyBlur=!this.view.stage.renderView.fog?.renders&&this._hasBlur,this._configuration.applyBlur&&super.precompile(),this._configuration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(h,this._configuration))}render(){const s=this.input,t=s.getAttachment(u);if(!t?.attachment)return s;const r=a(this.bindParameters.camera.eye);this._passParameters.atmosphereC=r**2-this._atmosphereRadius**2,this._passParameters.color=s.getAttachment(l)?.attachment,this._passParameters.emission=t,this._configuration.applyBlur&&this._renderEmissionMipMap();const i=this.renderingContext,o=this.techniques.get(h,this._configuration),m=this.acquireOutputFramebuffer();return i.clear(16384),i.bindTechnique(o,this.bindParameters,this._passParameters),i.screen.draw(),this._passParameters.mipmapTexture=e(this._passParameters.mipmapTexture),m.moveAttachments(s),m}};s([i()],d.prototype,"produces",void 0),s([i()],d.prototype,"consumes",void 0),d=s([o("esri.views.3d.webgl-engine.lib.EmissionComposite")],d);export{d as EmissionComposite};