@arcgis/core 5.1.0-next.103 → 5.1.0-next.105

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 (169) hide show
  1. package/analysis/ShadowCastAnalysis.d.ts +81 -62
  2. package/assets/esri/core/t9n/Units.json +1 -1
  3. package/assets/esri/core/t9n/Units_en.json +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{f5bd0a4f82df5e942b70.js → 093f27e4e4781870b431.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{8e986167d4a393ee41ea.js → 130851b81f04e6a008cd.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{1cb0c4fc315bbc2bd00b.js → 1c8a21b7b60c0709e6b2.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{ce0c7070eeb723a718e7.js → 1e8d5bfc5f8c2664190c.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{7d571845292b1b7769c2.js → 2dced41ff2aa1bd86665.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{bff0c4094c14cb97b18f.js → 359dbfbfb9acfb18bc6e.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{9542ef3f6c2bc7c14d85.js → 39a8e6c9d710d3faea3c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/3fed503185ea1913fb84.js +1 -0
  13. package/assets/esri/core/workers/chunks/466c250537415f12eb59.js +1 -0
  14. package/assets/esri/core/workers/chunks/4b130db9b7b4e2e32ea4.js +1 -0
  15. package/assets/esri/core/workers/chunks/{0cb8bc6dbbbe3b212712.js → 558606a1af22e4a0d536.js} +1 -1
  16. package/assets/esri/core/workers/chunks/6854b28853f5dd195110.js +262 -0
  17. package/assets/esri/core/workers/chunks/{b63cbf6c2c9ec1b02b9a.js → 6e21675bbd7a44070771.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{bb04aff0b4947408592c.js → 7617bd0f3a70dfe61637.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{cf3c0bee919bb509cd4f.js → 7b66691d133dabd87ce6.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{bf2c202dec5ab7bc770b.js → 829a0583b8a228c65379.js} +1 -1
  21. package/assets/esri/core/workers/chunks/8a1751187a20b6578875.js +1 -0
  22. package/assets/esri/core/workers/chunks/{d610f517fb3c6cb24365.js → 8ade869fa9bae446266a.js} +1 -1
  23. package/assets/esri/core/workers/chunks/9b89cc85c1b5d561df7c.js +2 -0
  24. package/assets/esri/core/workers/chunks/{2a5f6a8d282f2c391591.js → a0e72b107991ba38a9f0.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{f3a9100518b044e79501.js → a943bd2e6fb7443c2b66.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{037b36d415ae27e987f9.js → aec4a4cd7044fdbbbe34.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{29b00d07d3e1d095c590.js → b262478da29470abb72b.js} +2 -2
  28. package/assets/esri/core/workers/chunks/b7a81fd4994eabba1869.js +640 -0
  29. package/assets/esri/core/workers/chunks/{3c9482764c9e4f8bcbb0.js → c187bc997bad61b6c6e9.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{1c83e61fd9a4f8fc8372.js → d3f08f1a9a250cd8a2c8.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{c476f4979048e558baa7.js → e90afd914f2ccd4f5374.js} +57 -75
  32. package/assets/esri/core/workers/chunks/{5cffc7b49966201eccdb.js → f75295cdd5e84eb97d5a.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{95798e3de3419fdda6ac.js → fb415b01f0f1d644832d.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{64e268ebac0b62076f81.js → fbb23db01f3cf629d32e.js} +1 -1
  35. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  36. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  37. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  38. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  39. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  40. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  41. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  42. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  43. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  44. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  45. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  46. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  47. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  48. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  49. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  50. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  51. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  52. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  53. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  54. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  55. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  56. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  57. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  58. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  59. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  60. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  61. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  62. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  63. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  64. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  65. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  66. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  67. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  68. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  69. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  70. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  71. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  72. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  73. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  74. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  75. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  76. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  77. package/chunks/ChapmanAtmosphere.glsl.js +14 -19
  78. package/chunks/Compositing.glsl.js +4 -4
  79. package/chunks/GaussianSplatShadow.glsl.js +7 -7
  80. package/chunks/GlobalIllumination.glsl.js +27 -50
  81. package/chunks/GlobalIlluminationBlur.glsl.js +16 -11
  82. package/chunks/Terrain.glsl.js +1 -1
  83. package/config.js +1 -1
  84. package/core/ReactiveSet.js +1 -1
  85. package/kernel.js +1 -1
  86. package/layers/VideoLayer.js +1 -1
  87. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  88. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +1 -1
  89. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  90. package/layers/knowledgeGraph/layerUtils.js +1 -1
  91. package/layers/orientedImagery/core/utils.js +1 -1
  92. package/package.json +2 -2
  93. package/support/revision.js +1 -1
  94. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  95. package/symbols/cim/utils.js +1 -1
  96. package/symbols/support/cimSymbolUtils.js +1 -1
  97. package/symbols/support/utils.js +1 -1
  98. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  99. package/views/2d/engine/webgl/RenderingDevice.js +1 -1
  100. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  101. package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
  102. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  103. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
  104. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
  105. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  106. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
  107. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  108. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  109. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  110. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  111. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  112. package/views/2d/layers/features/FeatureContainer.js +1 -1
  113. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  114. package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +9 -5
  115. package/views/3d/layers/FlowSubView3D.js +1 -1
  116. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  117. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  118. package/views/3d/terrain/TerrainRenderer.js +1 -1
  119. package/views/3d/terrain/TileCompositor.js +1 -1
  120. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  121. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  122. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.glsl.js +1 -1
  123. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  124. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechnique.js +1 -1
  125. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  126. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  127. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  128. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  129. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  130. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  131. package/views/3d/webgl-engine/lib/Compositor.js +1 -1
  132. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  133. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  134. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  135. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  136. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  137. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  138. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  139. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  140. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  141. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  142. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  143. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  144. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  145. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  146. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  147. package/views/3d/webgl-engine/shaders/ditherNoise.glsl.js +1 -1
  148. package/views/layers/FeatureLikeLayerView.js +1 -1
  149. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  150. package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.js +1 -1
  151. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  152. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  153. package/widgets/OrientedImageryViewer.js +1 -1
  154. package/widgets/TableList/TableListViewModel.js +1 -1
  155. package/widgets/Track/TrackViewModel.d.ts +1 -0
  156. package/widgets/Track/TrackViewModel.js +1 -1
  157. package/widgets/Track.js +1 -1
  158. package/widgets/support/GeolocationPositioning.d.ts +1 -0
  159. package/widgets/support/GeolocationPositioning.js +1 -1
  160. package/assets/esri/core/workers/chunks/35fdd62277fd06468a29.js +0 -2
  161. package/assets/esri/core/workers/chunks/40caf5e09e4382d81104.js +0 -640
  162. package/assets/esri/core/workers/chunks/4213aa844900fcf95287.js +0 -1
  163. package/assets/esri/core/workers/chunks/594e1f633527749d92d7.js +0 -1
  164. package/assets/esri/core/workers/chunks/cc8d55d1830d7542c3f5.js +0 -262
  165. package/assets/esri/core/workers/chunks/f196ad0c7dbcbf632776.js +0 -1
  166. package/assets/esri/core/workers/chunks/fae79769df54eb4c4154.js +0 -1
  167. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechniqueConfiguration.js +0 -2
  168. /package/assets/esri/core/workers/chunks/{35fdd62277fd06468a29.js.LICENSE.txt → 9b89cc85c1b5d561df7c.js.LICENSE.txt} +0 -0
  169. /package/assets/esri/core/workers/chunks/{29b00d07d3e1d095c590.js.LICENSE.txt → b262478da29470abb72b.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{effectFlag0 as i,filterFlag0 as n}from"../../engine/webgl/definitions.js";import a from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as o}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as h}from"./FeatureTilePresentStrategy.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as l}from"../support/util.js";import{createHittestQuery as d}from"../../support/hitTestUtils.js";class c{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class p{constructor(e,t){this.id=e,this.version=t}}class f extends r{constructor(e){super(e.view.featuresTilingScheme),this._updatingChildren=s(!1),this._hitTestsRequests=[],this._renderState=s(null),this._renderStateNext=s(null),this._store=new a,this._subscriptions=new Map,this._presentation=new h,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has("featurelayer-strict-draw-order")?1:has("featurelayer-force-marker-text-draw-order")?2:0}get updating(){const e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,s=!!this._renderStateNext.value,r=this.attributeView.updating;return e||t||s||r}subscriptions(){return this._subscriptions.values()}get hasLabels(){return null!==this.labelSchema}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw new Error("InternalError: DeconflictionInfo not defined. Was update called?");return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&o.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(_(t))return t;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){const e=new Set;for(const t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(const t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(const e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 16:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&"dictionary"!==this._schema?.mesh.factory.symbology.type,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,s){return this._updateResolver=new c({schema:e,deconflictionInfo:t,invalidateMesh:s}),this.requestRender(),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this.requestDeclutter()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe){if(!this._subscriptions.has(t)){const e=new p(t,s);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=s}for(const t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){const t=this.attributeView.getFilterFlags(e),s=t&n,r=null==this._layerView.featureEffectView.featureEffect||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&i;return!(s&&r)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw new Error("InternalError: renderStateNext already exists");has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new u(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this,this.tilingScheme)}async swapRenderState(){if(!this._renderStateNext.value)throw new Error("InternalError: renderStateNext not yet created");if(this._renderStateSwapResolver)throw new Error("InternalError: renderState swap already in progress");this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,s){t(s);const r=e.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext.value??this._renderState.value;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(e),this.requestRender()}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}hitTest(e){const t=d(e);if(!t)return console.warn("Unexpected hittest input:",e),Promise.resolve([]);let s=this._hitTestsRequests.find(({query:e})=>t.hittestType===e.hittestType&&t.input===e.input);const r=Promise.withResolvers();return s?s.resolvers.push(r):(s={query:t,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach((e,t)=>s.set(t,e)),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=o.heatmap.getStencilReference(t)}_finializeUpdate(){if(!this._updateResolver)return;const{schema:e,deconflictionInfo:t,invalidateMesh:s}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),s&&(this.restartAllAnimations(),this.swapRenderState());const r="heatmap"===e.mesh.factory.symbology.type?"target-defer":"eager";this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);const e=this._renderState.value,t=new Set,s=new Set;for(const r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&s.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(const r of this._renderState.value.tiles())t.has(r.id)&&(r.decluttering=!0),s.has(r.id)&&(r.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&l(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.boundFramebuffer,i=t.getViewport(),n=e.passOptions,a=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=8;const{distance:o,smallSymbolDistance:h}=e.passOptions,u=Math.max(o,h),l=e.passOptions.hittestType;for(const d of this.children)d.visible&&("rect"===l?d.containsScreenRect(e.state,e.passOptions.tlbr)&&this._renderTile(d,e,0):d.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(d,e,0));s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(i),e.passOptions=n,e.drawPhase=a}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,19);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){t.selection=s,e.getDisplayList()?.render(t,r)}}function _(e){return 19===e.techniqueRef.type}export{f as FeatureContainer};
2
+ import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{effectFlag0 as i,filterFlag0 as n}from"../../engine/webgl/definitions.js";import a from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as o}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as h}from"./FeatureTilePresentStrategy.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as l}from"../support/util.js";import{createHittestQuery as d}from"../../support/hitTestUtils.js";class c{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class p{constructor(e,t){this.id=e,this.version=t}}class f extends r{constructor(e){super(e.view.featuresTilingScheme),this._updatingChildren=s(!1),this._hitTestsRequests=[],this._renderState=s(null),this._renderStateNext=s(null),this._store=new a,this._subscriptions=new Map,this._presentation=new h,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has("featurelayer-strict-draw-order")?1:has("featurelayer-force-marker-text-draw-order")?2:0}get updating(){const e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,s=!!this._renderStateNext.value,r=this.attributeView.updating;return e||t||s||r}subscriptions(){return this._subscriptions.values()}get hasLabels(){return null!==this.labelSchema}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw new Error("InternalError: DeconflictionInfo not defined. Was update called?");return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&o.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(_(t))return t;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){const e=new Set;for(const t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(const t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(const e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 16:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&"dictionary"!==this._schema?.mesh.factory.symbology.type,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,s){return this._updateResolver=new c({schema:e,deconflictionInfo:t,invalidateMesh:s}),this.requestRender(),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this.requestDeclutter()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe){if(!this._subscriptions.has(t)){const e=new p(t,s);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=s}for(const t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){const t=this.attributeView.getFilterFlags(e),s=t&n,r=null==this._layerView.featureEffectView.featureEffect||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&i;return!(s&&r)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw new Error("InternalError: renderStateNext already exists");has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new u(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this,this.tilingScheme)}async swapRenderState(){if(!this._renderStateNext.value)throw new Error("InternalError: renderStateNext not yet created");if(this._renderStateSwapResolver)throw new Error("InternalError: renderState swap already in progress");this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,s){t(s);const r=e.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext.value??this._renderState.value;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(e),this.requestRender()}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}hitTest(e){const t=d(e);if(!t)return console.warn("Unexpected hittest input:",e),Promise.resolve({trueHitIds:[],candidateHitIds:[]});let s=this._hitTestsRequests.find(({query:e})=>t.hittestType===e.hittestType&&t.input===e.input);const r=Promise.withResolvers();return s?s.resolvers.push(r):(s={query:t,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach((e,t)=>s.set(t,e)),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=o.heatmap.getStencilReference(t)}_finializeUpdate(){if(!this._updateResolver)return;const{schema:e,deconflictionInfo:t,invalidateMesh:s}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),s&&(this.restartAllAnimations(),this.swapRenderState());const r="heatmap"===e.mesh.factory.symbology.type?"target-defer":"eager";this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);const e=this._renderState.value,t=new Set,s=new Set;for(const r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&s.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(const r of this._renderState.value.tiles())t.has(r.id)&&(r.decluttering=!0),s.has(r.id)&&(r.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&l(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.boundFramebuffer,i=t.getViewport(),n=e.passOptions,a=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=8;const{distance:o,smallSymbolDistance:h}=e.passOptions,u=Math.max(o,h),l=e.passOptions.hittestType;for(const d of this.children)d.visible&&("rect"===l?d.containsScreenRect(e.state,e.passOptions.tlbr)&&this._renderTile(d,e,0):d.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(d,e,0));s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(i),e.passOptions=n,e.drawPhase=a}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,19);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){t.selection=s,e.getDisplayList()?.render(t,r)}}function _(e){return 19===e.techniqueRef.type}export{f as FeatureContainer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{sqlAnd as e}from"../../../../../core/sql.js";import{systemIsSpatialFieldName as r}from"../../../../../layers/knowledgeGraph/constants.js";import t from"../../../../../layers/support/FeatureFilter.js";import{getEffectiveFeatureReduction as i}from"./featureReductionUtils.js";import{getServiceGeometryType as s}from"./geometryUtils.js";import{createLabelVVEvaluator as a}from"./labelingUtils.js";import{ExceedsLimitCache as o}from"../schema/ExceedsLimitCache.js";import{createFeatureSourceSchema as n}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as l}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as u}from"../support/rendererUtils.js";class p{constructor(e){this.layer=e,this._cache=new o}getLabelingDeconflictionInfo(){return[{vvEvaluators:{0:a(this.layer.renderer)}}]}async createSourceSchema(e,r){const t=this._createServiceInfo(e);return n(t,null,{definitionExpression:this.layer.definitionExpression,returnZ:e.returnZ,returnM:e.returnM,queryScaleRanges:[],displayFilterEnabled:e.displayFilterEnabled,displayFilterInfo:this.layer.displayFilterInfo,customParameters:null,gdbVersion:null,historicMoment:null,timeExtent:this.layer.timeExtent,apiKey:null,sourceRefreshVersion:r,availableFields:e.availableFields,cache:this._cache,postQueryFilter:null})}createProcessorSchema(e,r,t){const{fields:s,renderer:a,geometryType:o,labelingInfo:n,labelsVisible:u,objectIdField:p}=this.layer,d={fields:s.map(e=>e.toJSON()),renderer:a?.clone(),labelingInfoSource:this.layer.id,featureReduction:i(this.layer,r),geometryType:o,labelingInfo:n,labelsVisible:u,objectIdField:p,orderBy:"default"};return l(e,r,d,t)}get hasRequiredSupport(){return u(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>i(this.layer,e),()=>d(this.layer)]}hasFilters(e){return d(this.layer)}addFilters(i,s){if(d(this.layer)){const s=e(i?.where,`${r}=1`);if(!s)return i;i??=new t,i.where=s}return i}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}setAggregateGraphicOrigin(e){e.origin=this.layer.aggregateGraphicOrigin}openMessagePorts(){return this.layer.source.openPorts()}_createServiceInfo(e){const r=this.layer,{capabilities:t,objectIdField:i}=r,a=r.fieldsIndex.toJSON(),o=s(r),n=r.spatialReference.toJSON(),l=i,u=e.spatialReference.toJSON();return{type:"memory",orderByFields:l,outSpatialReference:u,metadata:{fieldsIndex:a,geometryType:o,hasZ:this.layer.hasZ,hasM:this.layer.hasM,featureIdInfo:{type:"object-id",fieldName:r.objectIdField},spatialReference:n,outSpatialReference:u,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:r.timeInfo?.toJSON(),timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:t.query.maxRecordCount,tileMaxRecordCount:t.query.tileMaxRecordCount,supportsCompactGeometry:t.query.supportsCompactGeometry,supportsDefaultSpatialReference:t.query.supportsDefaultSpatialReference,supportsFormatPBF:t.query.supportsFormatPBF,supportsMaxRecordCountFactor:t.query.supportsMaxRecordCountFactor,supportsQuantization:t.query.supportsQuantization,supportsCentroidOnDegeneratedQuantizedGeometry:t.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:t.query.supportsDegeneratedQuantizedGeometry,supportsReturnExceededLimitGeometries:t.query.supportsReturnExceededLimitGeometries,lastEditDate:null}}}}function d(e){return"link-chart"===e.parentCompositeLayer.type&&"hidden"===e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode}export{p as KnowledgeGraphSublayerAdapter};
2
+ import{sqlAnd as e}from"../../../../../core/sql.js";import{systemIsSpatialFieldName as r}from"../../../../../layers/knowledgeGraph/constants.js";import t from"../../../../../layers/support/FeatureFilter.js";import{getEffectiveFeatureReduction as i}from"./featureReductionUtils.js";import{getServiceGeometryType as s}from"./geometryUtils.js";import{createLabelVVEvaluator as a}from"./labelingUtils.js";import{ExceedsLimitCache as o}from"../schema/ExceedsLimitCache.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as p}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e,this._cache=new o}getLabelingDeconflictionInfo(){return[{vvEvaluators:{0:a(this.layer.renderer)}}]}async createSourceSchema(e,r){const t=this._createServiceInfo(e);return l(t,null,{definitionExpression:this.layer.definitionExpression,returnZ:e.returnZ,returnM:e.returnM,queryScaleRanges:[],displayFilterEnabled:e.displayFilterEnabled,displayFilterInfo:this.layer.displayFilterInfo,customParameters:null,gdbVersion:null,historicMoment:null,timeExtent:this.layer.timeExtent,apiKey:null,sourceRefreshVersion:r,availableFields:e.availableFields,cache:this._cache,postQueryFilter:null})}createProcessorSchema(e,r,t){const{fields:s,renderer:a,geometryType:o,labelingInfo:l,labelsVisible:p,objectIdField:u}=this.layer,d={fields:s.map(e=>e.toJSON()),renderer:a?.clone(),labelingInfoSource:this.layer.id,featureReduction:i(this.layer,r),geometryType:o,labelingInfo:l,labelsVisible:p,objectIdField:u,orderBy:"default"};return n(e,r,d,t)}get hasRequiredSupport(){return p(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>i(this.layer,e),()=>null!=this.layer.parentCompositeLayer&&d(this.layer.parentCompositeLayer)]}hasFilters(e){return null!=this.layer.parentCompositeLayer&&d(this.layer.parentCompositeLayer)}addFilters(i,s){if(null!=this.layer.parentCompositeLayer&&d(this.layer.parentCompositeLayer)){const s=e(i?.where,`${r}=1`);if(!s)return i;i??=new t,i.where=s}return i}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}setAggregateGraphicOrigin(e){e.origin=this.layer.aggregateGraphicOrigin}openMessagePorts(){return this.layer.source.openPorts()}_createServiceInfo(e){const r=this.layer,{capabilities:t,objectIdField:i}=r,a=r.fieldsIndex.toJSON(),o=s(r),l=r.spatialReference.toJSON(),n=i,p=e.spatialReference.toJSON();return{type:"memory",orderByFields:n,outSpatialReference:p,metadata:{fieldsIndex:a,geometryType:o,hasZ:this.layer.hasZ,hasM:this.layer.hasM,featureIdInfo:{type:"object-id",fieldName:r.objectIdField},spatialReference:l,outSpatialReference:p,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:r.timeInfo?.toJSON(),timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:t.query.maxRecordCount,tileMaxRecordCount:t.query.tileMaxRecordCount,supportsCompactGeometry:t.query.supportsCompactGeometry,supportsDefaultSpatialReference:t.query.supportsDefaultSpatialReference,supportsFormatPBF:t.query.supportsFormatPBF,supportsMaxRecordCountFactor:t.query.supportsMaxRecordCountFactor,supportsQuantization:t.query.supportsQuantization,supportsCentroidOnDegeneratedQuantizedGeometry:t.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:t.query.supportsDegeneratedQuantizedGeometry,supportsReturnExceededLimitGeometries:t.query.supportsReturnExceededLimitGeometries,lastEditDate:null}}}}function d(e){return"link-chart"===e.type&&"hidden"===e.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode}export{u as KnowledgeGraphSublayerAdapter};
@@ -7,8 +7,8 @@ import type { ScreenPoint } from "../../../core/types.js";
7
7
  * [SceneView.analyses](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#analyses).
8
8
  *
9
9
  * The ShadowCastAnalysisView3D is responsible for rendering a [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCastAnalysis/)
10
- * using custom visualizations. The [methods](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ShadowCastAnalysisView3D/#getDurationAtScreen)
11
- * on the analysis view provide developers with the ability to obtain the specific shadow or sunlight duration at a
10
+ * using custom visualizations. The [getDurationAtScreen()](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ShadowCastAnalysisView3D/#getDurationAtScreen) method
11
+ * on the analysis view provides developers with the ability to obtain the specific shadow or sunlight duration at a
12
12
  * certain [point](https://developers.arcgis.com/javascript/latest/references/core/core/types/#ScreenPoint) on the screen or to [disable](#interactive) the tooltip attached to the cursor.
13
13
  *
14
14
  * The view for an analysis can be retrieved using [SceneView.whenAnalysisView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenAnalysisView)
@@ -26,6 +26,7 @@ import type { ScreenPoint } from "../../../core/types.js";
26
26
  * @see [MinDurationOptions](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCast/MinDurationOptions/)
27
27
  * @see [TotalDurationOptions](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCast/TotalDurationOptions/)
28
28
  * @see [Sample - Shadow Cast analysis object](https://developers.arcgis.com/javascript/latest/sample-code/analysis-shadow-cast/)
29
+ * @see [Sample - Sunlight analysis](https://developers.arcgis.com/javascript/latest/sample-code/analysis-sunlight/)
29
30
  * @see [Sample - Analysis objects](https://developers.arcgis.com/javascript/latest/sample-code/analysis-objects/)
30
31
  * @see [Shadow Cast component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-shadow-cast/)
31
32
  */
@@ -37,7 +38,7 @@ export default abstract class ShadowCastAnalysisView3D extends AnalysisView3D {
37
38
  */
38
39
  get analysis(): ShadowCastAnalysis;
39
40
  /**
40
- * Displays the shadow tooltip attached to the cursor. Set to `false` to disable it.
41
+ * Displays the shadow or sunlight tooltip attached to the cursor. Set to `false` to disable it.
41
42
  *
42
43
  * @default true
43
44
  * @since 5.0
@@ -66,13 +67,15 @@ export default abstract class ShadowCastAnalysisView3D extends AnalysisView3D {
66
67
  */
67
68
  accessor visible: boolean;
68
69
  /**
69
- * Returns the time (in milliseconds) spent in shadow for a certain point on the screen. When
70
+ * Returns the duration (in milliseconds) for a certain point on the screen based on the current analysis settings.
71
+ * By default, this method returns the time spent in shadow. When
70
72
  * [ShadowCastAnalysis.visualizeSunlight](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCastAnalysis/#visualizeSunlight) is `true`, this method returns the time spent in sunlight.
71
73
  *
72
- * @param point - The point on the screen for which shadow cast is calculated.
74
+ * @param point - The point on the screen for which the shadow or sunlight duration is calculated.
73
75
  * @returns A promise that resolves to the duration (in milliseconds) spent in shadow or sunlight for the given screen point.
74
76
  * @since 5.0
75
77
  * @example
78
+ * ```js
76
79
  * // use getDurationAtScreen method from the analysis view once available
77
80
  * const analysisView = await view.whenAnalysisView(shadowCastAnalysis);
78
81
  *
@@ -82,6 +85,7 @@ export default abstract class ShadowCastAnalysisView3D extends AnalysisView3D {
82
85
  * const duration = await analysisView.getDurationAtScreen({ x: event.x, y: event.y });
83
86
  * // ... do something with the duration
84
87
  * });
88
+ * ```
85
89
  */
86
90
  getDurationAtScreen(point: ScreenPoint): Promise<number>;
87
91
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as s}from"../../../core/maybe.js";import{debounce as r,throwIfAborted as n,ignoreAbortErrors as l}from"../../../core/promiseUtils.js";import{watch as a,sync as o,when as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../core/scheduling.js";import{signal as p}from"../../../core/signal.js";import{Seconds as c,secondsFromMilliseconds as m}from"../../../core/time.js";import{property as g,subclass as _}from"../../../core/accessorSupport/decorators.js";import{projectOrLoad as f}from"../../../geometry/projectionUtils.js";import y from"../../../geometry/SpatialReference.js";import{fromExtent as v,intersection as w,toExtent as T,create as S,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as R}from"../../../geometry/support/spatialReferenceUtils.js";import x from"../../../symbols/support/ElevationInfo.js";import A from"./SubView3D.js";import{getFeatureTileId as L}from"./support/FeatureTileDescriptor.js";import{makeScheduleFunction as E}from"./support/makeScheduleFunction.js";import{debugFlags as j}from"../support/debugFlags.js";import{tileFilterDistance as M,scaleThresholdForLoadingAllTiles as O,defaultTransitionDuration as C,transitionDurationFactor as P,seamlessTransitionEnabled as U,densityFactor as I,loadAllTilesDensityFactor as W,averageLoadingTimeSmoothingFactor as k,fadeOutTime as F,fadeInTime as D,minimumTracingResolution as q}from"../support/flow/constants.js";import{isFullExtent as V,wrappedWidth as G,FlowQuery3D as H}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as B}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as z,createStreamlineGeometry as N}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as Q}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as J}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as K}from"../support/flow/StreamlineResources3DShape.js";import{webMercatorWorldExtent as X}from"../terrain/TerrainConst.js";import{descendantsAtLevel as Y,tilesAreRelated as Z}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as $}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as ee}from"../webgl-engine/materials/RibbonLineMaterial.js";import{hasLayerBasedScaleVisibility as te,isInEffectiveScaleRange as ie}from"../../support/layerViewUtils.js";import{TaskPriority as se}from"../../support/Scheduler.js";import{simulationSettingsEqual as re,getPositions as ne,getFlowSimulationSettings as le}from"../../support/flow/utils.js";let ae=class extends A{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=c(0),this._abortController=null,this._loadingState="ready-to-load",this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=p(!0),this.emissiveStrength=0,this._materialParametersOverridde=null,this._suspendedOverride=null,this._simulationSettingsOverride=null,this._seamlessTransitionEnabledOverride=null,this._updateTask=null,this._debouncedTileUpdate=r(async e=>{const{allTiles:t}=this.surface,i=this._getTileFilterFunction(),s=new Set;function*r(e){for(let r=0;r<t.length;++r){const n=t.at(r);i(n)&&s.add(n),e.madeProgress(),e.done&&(e=yield)}}await this.frameTask.scheduleGenerator(r,e.signal),n(e.signal),this.renderedTiles=s})}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new B(E(i)),this.frameTask=i.scheduler.registerTask(se.FLOW_GENERATOR),this._updateTask=h({update:()=>this._update()}),this.addHandles([a(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&re(e,t)}),this.updatingHandles.add(()=>this.suspended,e=>{e?this._suspend():this._resume()},o),a(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this.visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit,this._effectiveDensity]},()=>this.triggerLoad(),o),u(()=>!this.view.animationsEnabled,()=>{const{_resources:e,_lastResources:t}=this;null!=e&&(e.startTime=he),null!=t&&(t.startTime=he)},o),a(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),u(()=>e.allTilesCreated,()=>this._triggerTilesUpdate(),o),t.enableFeatureTiles(),a(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),a(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],s=e?.visualVariables??[];s.length===i.length&&s.every((e,t)=>e.type===i[t].type)||this.clear()}),u(()=>!t.featureTiles?.updating,()=>{this._triggerTilesUpdate()})]),this.suspended&&this._suspend(),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear(),this.notifyChange("updating")}abort(){this._abortController=s(this._abortController),this._tilesUpdateIsWaiting=!1,this.requireLoad=!1}_ensureAbortController(){return null==this._abortController&&(this._abortController=new AbortController),this._abortController}_resume(){this._updateTask.resume(),this._triggerTilesUpdate(),this.triggerLoad()}_suspend(){this._updateTask.pause(),this.abort(),this.clear()}get _clippingArea(){const e=f(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _dataBounds(){const e=this._fullExtentSurfaceSpatialReference;return null==e?null:v(e)}get suspended(){return null!=this._suspendedOverride?this._suspendedOverride:this.layerView.suspended||this.view.groundView.hasTerrainReplacement}get _fullExtentSurfaceSpatialReference(){return f(this.layer.fullExtent,this.surface.spatialReference).geometry}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get extent(){if(this.loadAllTiles)return pe(this._fullExtentSurfaceSpatialReference);const{spatialReference:e}=this.surface;let t=this.renderedTiles;if(null==e||null==t)return null;const i=this.view.terrainLevel;if(null!=i){const e=new Set;t.forEach(t=>{Math.abs(i-t.level)<M&&e.add(t)}),t=e}const s=Q(t,this.spatialReferenceInfo);return null==s?null:(w(s,this._clippingArea,s),pe(T(s,e)))}get loadAllTiles(){return this.view.scale>(j.FLOW_GLOBAL_SCALE_THRESHOLD??O)}get isDataGlobal(){const{extent:e,spatialReferenceInfo:t}=this;return null!=e&&V(e.xmin,e.xmax,t)}get loadAllTilesLevel(){const{tilingScheme:e}=this.surface;return Math.min(Math.ceil(e.levelAtScale(j.FLOW_GLOBAL_SCALE_THRESHOLD??O)),e.getMaxLod())}get targetTiles(){const e=new Map;if(this.loadAllTiles){const{_dataBounds:t}=this;if(null==t)return e;const i=S(),s=this.loadAllTilesLevel,r=this.surface.tilingScheme,n=r.rootTilesInExtent(t).flatMap(e=>Y(e,s));for(const l of n){const[n,a,o]=l;r.getExtent(s,a,o,i),ue(t,i)&&e.set(L(s,a,o),l)}return e}const{renderedTiles:t}=this;for(const i of t??[])e.set(i.key,i.lij);return e}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=f(e,this.surface.spatialReference).geometry;return null==t?null:v(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"===e?.type?e:null}get _materialParameters(){return{...z(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._materialParametersOverridde,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&"screenSizePerspectiveEnabled"in this.layer&&$(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){const{_averageLoadingTime:e}=this;return c(0===e?C:this._averageLoadingTime*P)}get _transitionEnabled(){return this.view.qualitySettings.flow.transitionEnabled}get _seamlessTransitionEnabled(){return!!this._transitionEnabled&&(null!=this._seamlessTransitionEnabledOverride?this._seamlessTransitionEnabledOverride:U)}get _tracingResolution(){const{extent:e}=this;if(!e)return[0,0];const t=G(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[i,s]=this.view.size;let r,n;i<s?(r=i,n=i/t):(r=s*t,n=s);const l=q,a=this.view.qualitySettings.flow.maxTracingResolution,o=Math.max(1,l/Math.min(r,n)),u=o*Math.min(1,a/Math.max(r*o,n*o));return[Math.round(r*u),Math.round(n*u)]}get visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get _effectiveDensity(){const{_simulationSettings:e}=this;if(null==e)return 0;const t=e.density*this.view.quality;return e.lineSpacing/Math.sqrt(t)<e.lineCollisionWidth?(e.lineSpacing/e.lineCollisionWidth)**2:t}get elevationInfo(){return("elevationInfo"in this.layer?this.layer.elevationInfo:void 0)??oe}startPositions(e){if(!this._seamlessTransitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:ne(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return R(this.surface.spatialReference)}get loadingState(){return this._loadingState}get loadRequirementsMet(){return null!=this.renderedTiles&&(this.renderedTiles.size>0||this.loadAllTiles)&&null!=this.extent}hasWork(){return this.updatingHandles.updating||this.requireLoad||"before-transition"===this._loadingState}get updating(){return this._debugAllowAutoLoading.value&&this.visible&&!(this.destroyed||this.destroying)&&this.hasWork()}get visibleAtCurrentScale(){return!te()||ie(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){const{_flowRenderer:e,_simulationSettingsOverride:t}=this;if(null==e)return null;let i=le(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,i.maxNumberOfStreamlines=this.view.qualitySettings.flow.maxTotalNumberOfStreamlines,i.density*=I,this.loadAllTiles&&this.isDataGlobal&&(i.density*=W),null!=t&&(i={...i,...t}),i}getSimulationSettings(e){const{_simulationSettings:t,spatialReferenceInfo:i}=this;if(null==t)return null;const s="global"===this.view.viewingMode&&null!=i&&V(e.extent.xmin,e.extent.xmax,i);return{...t,wrapAround:s,density:this._effectiveDensity}}get surface(){return this.view.basemapTerrain}doRefresh(){}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this._loadingState="ready-to-load"}_update(){const e=this._time;this._lastResources?.hasFadedOut(e)&&this._lastResources.detach();const t=this._nextStateForTransition(e);if(!this.requireLoad||this.updatingHandles.updating||"ready-to-load"!==t||!this.loadRequirementsMet)return void(this._loadingState=t);this._loadingState="loading";const i=async()=>{const t=this._time,i=this._seamlessTransitionEnabled&&null!=this._resources?c(e+this._seamlessTransitionWaitingTime):e;await this._load(i);const s=c((this._time-t)/1e3);this._updateAverageLoadingTime(s)};this.updatingHandles.consumePromise(l(i())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=k;this._averageLoadingTime=c(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){!this.suspended&&this._debugAllowAutoLoading.value&&(this.visible?this.requireLoad=!0:this.clear())}get _time(){return m(this.layerView.view.stage.renderer.renderContext.time)}async _load(e){const{extent:t,view:i}=this;if(!this.visible)return void this.clear();if(null==t)return void(this._loadingState="ready-to-load");this._transitionEnabled||(this._lastResources?.detach(),this._lastResources=null,this._resources?.detach(),this._resources=null);const s=new H(t,this.layerView.timeExtent,this._tracingResolution,i.state.contentPixelRatio,e),r=this._ensureAbortController();try{const t=await this._loadStreamlines(s,r.signal);if(n(r.signal),null!=t){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=t;const i=this._getStartTime(e);null!=this._lastResources&&(this._lastResources.endTime=i),this._resources.startTime=i,this.view.animationsEnabled||(this._lastResources?.detach(),this._lastResources=null),await t.attach(),this.suspended&&this.clear(),n(r.signal),this._loadingState=this._seamlessTransitionEnabled?"before-transition":"transitioning"}else this._loadingState="ready-to-load"}catch(l){this._loadingState="ready-to-load"}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i)return null;const{geometries:s,material:r}=await this._createGeometry(e,i,t);return this._draped?new J(e,i,r,s,this.layerView):new K(e,i,r,s,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t,i){const s=new ee(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:l,_draped:a,view:o}=this;function*u(i){for(let n=0;n<t.length;++n)r.push(N(o,e,t[n],l,s,a)),i.madeProgress(),i.done&&(i=yield)}return await this.frameTask.scheduleGenerator(u,i),n(i),{geometries:r,material:s}}_triggerTilesUpdate(){if(this.suspended)return;if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=this._ensureAbortController(),t=async()=>{try{await d(()=>this.view.stationary),n(e.signal),await this._debouncedTileUpdate(e)}finally{this._tilesUpdateIsWaiting=!1}};this.updatingHandles.consumePromise(l(t()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:s,loadAllTiles:r}=this;if(r){const{loadAllTilesLevel:t}=this;return i=>i.level===t&&ue(e,i.extent)}const n=t=>t.rendered&&t.visible&&ue(e,t.extent),{featureTiles:l}=i;if(!l)return n;const a=l.tiles.filter(e=>e.measures.visible);return e=>n(e)&&ue(s,e.extent)&&a.some(({lij:i})=>t(i,e.lij)||Z(i,e.lij))}_nextStateForTransition(e){const{_resources:t}=this;if(null==this._flowRenderer||null==t||"ready-to-load"===this._loadingState||"loading"===this._loadingState)return this._loadingState;const i=t.startTime;return e<i?"before-transition":e<i+F?"transitioning":"ready-to-load"}_getStartTime(e){if(!this.view.animationsEnabled)return he;const t=this._time;return c(t>e?t:e)}get usedMemory(){return(this._lastResources?.usedMemory??0)+(this._resources?.usedMemory??0)}get test(){}};e([g()],ae.prototype,"type",void 0),e([g()],ae.prototype,"renderedTiles",void 0),e([g()],ae.prototype,"_resources",void 0),e([g()],ae.prototype,"_lastResources",void 0),e([g()],ae.prototype,"requireLoad",void 0),e([g()],ae.prototype,"_averageLoadingTime",void 0),e([g()],ae.prototype,"_loadingState",void 0),e([g()],ae.prototype,"emissiveStrength",void 0),e([g()],ae.prototype,"_clippingArea",null),e([g()],ae.prototype,"_dataBounds",null),e([g()],ae.prototype,"suspended",null),e([g()],ae.prototype,"_fullExtentSurfaceSpatialReference",null),e([g()],ae.prototype,"_draped",null),e([g()],ae.prototype,"extent",null),e([g()],ae.prototype,"loadAllTiles",null),e([g()],ae.prototype,"isDataGlobal",null),e([g()],ae.prototype,"loadAllTilesLevel",null),e([g()],ae.prototype,"targetTiles",null),e([g()],ae.prototype,"_featureTilesBounds",null),e([g()],ae.prototype,"_flowRenderer",null),e([g()],ae.prototype,"_materialParameters",null),e([g()],ae.prototype,"_opacity",null),e([g()],ae.prototype,"_seamlessTransitionWaitingTime",null),e([g()],ae.prototype,"_transitionEnabled",null),e([g()],ae.prototype,"_seamlessTransitionEnabled",null),e([g()],ae.prototype,"_tracingResolution",null),e([g()],ae.prototype,"visible",null),e([g()],ae.prototype,"_effectiveDensity",null),e([g()],ae.prototype,"elevationInfo",null),e([g()],ae.prototype,"needsMagnitude",null),e([g()],ae.prototype,"spatialReferenceInfo",null),e([g()],ae.prototype,"loadingState",null),e([g()],ae.prototype,"updating",null),e([g()],ae.prototype,"visibleAtCurrentScale",null),e([g()],ae.prototype,"_materialParametersOverridde",void 0),e([g()],ae.prototype,"_suspendedOverride",void 0),e([g()],ae.prototype,"_simulationSettingsOverride",void 0),e([g()],ae.prototype,"_seamlessTransitionEnabledOverride",void 0),e([g()],ae.prototype,"_simulationSettings",null),e([g()],ae.prototype,"surface",null),ae=e([_("esri.views.3d.layers.FlowSubView3D")],ae);const oe=new x({mode:"on-the-ground"});function ue(e,t){return null==e||null==t||b(e,t)}const de=T(X,y.WebMercator),he=c(-D);function pe(e){return null!=e&&e.spatialReference.isWebMercator?e?.intersection(de):e}export{ae as default};
2
+ import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as s}from"../../../core/maybe.js";import{debounce as r,throwIfAborted as n,ignoreAbortErrors as l}from"../../../core/promiseUtils.js";import{watch as a,sync as o,when as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../core/scheduling.js";import{signal as p}from"../../../core/signal.js";import{Seconds as c,secondsFromMilliseconds as m}from"../../../core/time.js";import{property as g,subclass as _}from"../../../core/accessorSupport/decorators.js";import{projectOrLoad as f}from"../../../geometry/projectionUtils.js";import y from"../../../geometry/SpatialReference.js";import{fromExtent as v,intersection as w,toExtent as T,create as S,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as R}from"../../../geometry/support/spatialReferenceUtils.js";import x from"../../../symbols/support/ElevationInfo.js";import A from"./SubView3D.js";import{getFeatureTileId as L}from"./support/FeatureTileDescriptor.js";import{makeScheduleFunction as E}from"./support/makeScheduleFunction.js";import{debugFlags as j}from"../support/debugFlags.js";import{tileFilterDistance as M,scaleThresholdForLoadingAllTiles as O,defaultTransitionDuration as I,transitionDurationFactor as C,seamlessTransitionEnabled as P,densityFactor as U,loadAllTilesDensityFactor as D,averageLoadingTimeSmoothingFactor as W,fadeOutTime as k,fadeInTime as F,minimumTracingResolution as q}from"../support/flow/constants.js";import{isFullExtent as B,wrappedWidth as V,FlowQuery3D as G}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as H}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as z,createStreamlineGeometry as N}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as Q}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as J}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as K}from"../support/flow/StreamlineResources3DShape.js";import{webMercatorWorldExtent as X}from"../terrain/TerrainConst.js";import{descendantsAtLevel as Y,tilesAreRelated as Z}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as $}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as ee}from"../webgl-engine/materials/RibbonLineMaterial.js";import{hasLayerBasedScaleVisibility as te,isInEffectiveScaleRange as ie}from"../../support/layerViewUtils.js";import{TaskPriority as se}from"../../support/Scheduler.js";import{simulationSettingsEqual as re,getPositions as ne,getFlowSimulationSettings as le}from"../../support/flow/utils.js";let ae=class extends A{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.tilesIntersectDataBounds=!0,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=c(0),this._abortController=null,this._loadingState="ready-to-load",this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=p(!0),this.emissiveStrength=0,this._materialParametersOverridde=null,this._suspendedOverride=null,this._simulationSettingsOverride=null,this._seamlessTransitionEnabledOverride=null,this._updateTask=null,this._debouncedTileUpdate=r(async e=>{const{allTiles:t}=this.surface,i=this._getTileFilterFunction(),{_dataBounds:s}=this,r=new Set;let l=!1;function*a(e){for(let n=0;n<t.length;++n){const a=t.at(n),o=ue(s,a.extent);i(a)&&o&&(r.add(a),l=!0),e.madeProgress(),e.done&&(e=yield)}}await this.frameTask.scheduleGenerator(a,e.signal),n(e.signal),this.tilesIntersectDataBounds=!(0!==t.length&&!this.loadAllTiles)||l,this.renderedTiles=r})}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new H(E(i)),this.frameTask=i.scheduler.registerTask(se.FLOW_GENERATOR),this._updateTask=h({update:()=>this._update()}),this.addHandles([a(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&re(e,t)}),this.updatingHandles.add(()=>this.suspended,e=>{e?this._suspend():this._resume()},o),a(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this.visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit,this._effectiveDensity]},()=>this.triggerLoad(),o),u(()=>!this.view.animationsEnabled,()=>{const{_resources:e,_lastResources:t}=this;null!=e&&(e.startTime=he),null!=t&&(t.startTime=he)},o),a(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),u(()=>e.allTilesCreated,()=>this._triggerTilesUpdate(),o),t.enableFeatureTiles(),a(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),a(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],s=e?.visualVariables??[];s.length===i.length&&s.every((e,t)=>e.type===i[t].type)||this.clear()}),u(()=>!t.featureTiles?.updating,()=>{this._triggerTilesUpdate()})]),this.suspended&&this._suspend(),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear(),this.notifyChange("updating")}abort(){this._abortController=s(this._abortController),this._tilesUpdateIsWaiting=!1,this.requireLoad=!1}_ensureAbortController(){return null==this._abortController&&(this._abortController=new AbortController),this._abortController}_resume(){this._updateTask.resume(),this._triggerTilesUpdate(),this.triggerLoad()}_suspend(){this._updateTask.pause(),this.abort(),this.clear()}get _clippingArea(){const e=f(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _dataBounds(){const e=this._fullExtentSurfaceSpatialReference;return null==e?null:v(e)}get suspended(){return null!=this._suspendedOverride?this._suspendedOverride:this.layerView.suspended||this.view.groundView.hasTerrainReplacement}get _fullExtentSurfaceSpatialReference(){return f(this.layer.fullExtent,this.surface.spatialReference).geometry}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get extent(){if(this.loadAllTiles)return pe(this._fullExtentSurfaceSpatialReference);const{spatialReference:e}=this.surface;let t=this.renderedTiles;if(null==e||null==t)return null;const i=this.view.terrainLevel;if(null!=i){const e=new Set;t.forEach(t=>{Math.abs(i-t.level)<M&&e.add(t)}),t=e}const s=Q(t,this.spatialReferenceInfo);return null==s?null:(w(s,this._clippingArea,s),pe(T(s,e)))}get loadAllTiles(){return this.view.scale>(j.FLOW_GLOBAL_SCALE_THRESHOLD??O)}get isDataGlobal(){const{extent:e,spatialReferenceInfo:t}=this;return null!=e&&B(e.xmin,e.xmax,t)}get loadAllTilesLevel(){const{tilingScheme:e}=this.surface;return Math.min(Math.ceil(e.levelAtScale(j.FLOW_GLOBAL_SCALE_THRESHOLD??O)),e.getMaxLod())}get targetTiles(){const e=new Map;if(this.loadAllTiles){const{_dataBounds:t}=this;if(null==t)return e;const i=S(),s=this.loadAllTilesLevel,r=this.surface.tilingScheme,n=r.rootTilesInExtent(t).flatMap(e=>Y(e,s));for(const l of n){const[n,a,o]=l;r.getExtent(s,a,o,i),ue(t,i)&&e.set(L(s,a,o),l)}return e}const{renderedTiles:t}=this;for(const i of t??[])e.set(i.key,i.lij);return e}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=f(e,this.surface.spatialReference).geometry;return null==t?null:v(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"===e?.type?e:null}get _materialParameters(){return{...z(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._materialParametersOverridde,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&"screenSizePerspectiveEnabled"in this.layer&&$(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){const{_averageLoadingTime:e}=this;return c(0===e?I:this._averageLoadingTime*C)}get _transitionEnabled(){return this.view.qualitySettings.flow.transitionEnabled}get _seamlessTransitionEnabled(){return!!this._transitionEnabled&&(null!=this._seamlessTransitionEnabledOverride?this._seamlessTransitionEnabledOverride:P)}get _tracingResolution(){const{extent:e}=this;if(!e)return[0,0];const t=V(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[i,s]=this.view.size;let r,n;i<s?(r=i,n=i/t):(r=s*t,n=s);const l=q,a=this.view.qualitySettings.flow.maxTracingResolution,o=Math.max(1,l/Math.min(r,n)),u=o*Math.min(1,a/Math.max(r*o,n*o));return[Math.round(r*u),Math.round(n*u)]}get visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get _effectiveDensity(){const{_simulationSettings:e}=this;if(null==e)return 0;const t=e.density*this.view.quality;return e.lineSpacing/Math.sqrt(t)<e.lineCollisionWidth?(e.lineSpacing/e.lineCollisionWidth)**2:t}get elevationInfo(){return("elevationInfo"in this.layer?this.layer.elevationInfo:void 0)??oe}startPositions(e){if(!this._seamlessTransitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:ne(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return R(this.surface.spatialReference)}get loadingState(){return this._loadingState}get loadRequirementsMet(){return null!=this.renderedTiles&&(this.renderedTiles.size>0||this.loadAllTiles)&&null!=this.extent}hasWork(){return this.updatingHandles.updating||this.requireLoad||"before-transition"===this._loadingState}get updating(){return this._debugAllowAutoLoading.value&&this.visible&&!(this.destroyed||this.destroying)&&this.hasWork()}get visibleAtCurrentScale(){return!te()||ie(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){const{_flowRenderer:e,_simulationSettingsOverride:t}=this;if(null==e)return null;let i=le(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,i.maxNumberOfStreamlines=this.view.qualitySettings.flow.maxTotalNumberOfStreamlines,i.density*=U,this.loadAllTiles&&this.isDataGlobal&&(i.density*=D),null!=t&&(i={...i,...t}),i}getSimulationSettings(e){const{_simulationSettings:t,spatialReferenceInfo:i}=this;if(null==t)return null;const s="global"===this.view.viewingMode&&null!=i&&B(e.extent.xmin,e.extent.xmax,i);return{...t,wrapAround:s,density:this._effectiveDensity}}get surface(){return this.view.basemapTerrain}doRefresh(){}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this.tilesIntersectDataBounds=!0,this._loadingState="ready-to-load"}_update(){const e=this._time;this._lastResources?.hasFadedOut(e)&&this._lastResources.detach();const t=this._nextStateForTransition(e);if(!this.requireLoad||this.updatingHandles.updating||"ready-to-load"!==t||!this.loadRequirementsMet)return this._loadingState=t,void(this.tilesIntersectDataBounds||(this.requireLoad=!1));this._loadingState="loading";const i=async()=>{const t=this._time,i=this._seamlessTransitionEnabled&&null!=this._resources?c(e+this._seamlessTransitionWaitingTime):e;await this._load(i);const s=c((this._time-t)/1e3);this._updateAverageLoadingTime(s)};this.updatingHandles.consumePromise(l(i())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=W;this._averageLoadingTime=c(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){!this.suspended&&this._debugAllowAutoLoading.value&&(this.visible?this.requireLoad=!0:this.clear())}get _time(){return m(this.layerView.view.stage.renderer.renderContext.time)}async _load(e){const{extent:t,view:i}=this;if(!this.visible)return void this.clear();if(null==t)return void(this._loadingState="ready-to-load");this._transitionEnabled||(this._lastResources?.detach(),this._lastResources=null,this._resources?.detach(),this._resources=null);const s=new G(t,this.layerView.timeExtent,this._tracingResolution,i.state.contentPixelRatio,e),r=this._ensureAbortController();try{const t=await this._loadStreamlines(s,r.signal);if(n(r.signal),null!=t){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=t;const i=this._getStartTime(e);null!=this._lastResources&&(this._lastResources.endTime=i),this._resources.startTime=i,this.view.animationsEnabled||(this._lastResources?.detach(),this._lastResources=null),await t.attach(),this.suspended&&this.clear(),n(r.signal),this._loadingState=this._seamlessTransitionEnabled?"before-transition":"transitioning"}else this._loadingState="ready-to-load"}catch(l){this._loadingState="ready-to-load"}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i)return null;const{geometries:s,material:r}=await this._createGeometry(e,i,t);return this._draped?new J(e,i,r,s,this.layerView):new K(e,i,r,s,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t,i){const s=new ee(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:l,_draped:a,view:o}=this;function*u(i){for(let n=0;n<t.length;++n)r.push(N(o,e,t[n],l,s,a)),i.madeProgress(),i.done&&(i=yield)}return await this.frameTask.scheduleGenerator(u,i),n(i),{geometries:r,material:s}}_triggerTilesUpdate(){if(this.suspended)return;if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=this._ensureAbortController(),t=async()=>{try{await d(()=>this.view.stationary),n(e.signal),await this._debouncedTileUpdate(e)}finally{this._tilesUpdateIsWaiting=!1}};this.updatingHandles.consumePromise(l(t()))}_getTileFilterFunction(){const{view:e,_featureTilesBounds:i,loadAllTiles:s}=this;if(s){const{loadAllTilesLevel:e}=this;return t=>t.level===e}const r=e=>e.rendered&&e.visible,{featureTiles:n}=e;if(!n)return r;const l=n.tiles.filter(e=>e.measures.visible);return e=>r(e)&&ue(i,e.extent)&&l.some(({lij:i})=>t(i,e.lij)||Z(i,e.lij))}_nextStateForTransition(e){const{_resources:t}=this;if(null==this._flowRenderer||null==t||"ready-to-load"===this._loadingState||"loading"===this._loadingState)return this._loadingState;const i=t.startTime;return e<i?"before-transition":e<i+k?"transitioning":"ready-to-load"}_getStartTime(e){if(!this.view.animationsEnabled)return he;const t=this._time;return c(t>e?t:e)}get usedMemory(){return(this._lastResources?.usedMemory??0)+(this._resources?.usedMemory??0)}get test(){}};e([g()],ae.prototype,"type",void 0),e([g()],ae.prototype,"renderedTiles",void 0),e([g()],ae.prototype,"_resources",void 0),e([g()],ae.prototype,"_lastResources",void 0),e([g()],ae.prototype,"tilesIntersectDataBounds",void 0),e([g()],ae.prototype,"requireLoad",void 0),e([g()],ae.prototype,"_averageLoadingTime",void 0),e([g()],ae.prototype,"_loadingState",void 0),e([g()],ae.prototype,"emissiveStrength",void 0),e([g()],ae.prototype,"_clippingArea",null),e([g()],ae.prototype,"_dataBounds",null),e([g()],ae.prototype,"suspended",null),e([g()],ae.prototype,"_fullExtentSurfaceSpatialReference",null),e([g()],ae.prototype,"_draped",null),e([g()],ae.prototype,"extent",null),e([g()],ae.prototype,"loadAllTiles",null),e([g()],ae.prototype,"isDataGlobal",null),e([g()],ae.prototype,"loadAllTilesLevel",null),e([g()],ae.prototype,"targetTiles",null),e([g()],ae.prototype,"_featureTilesBounds",null),e([g()],ae.prototype,"_flowRenderer",null),e([g()],ae.prototype,"_materialParameters",null),e([g()],ae.prototype,"_opacity",null),e([g()],ae.prototype,"_seamlessTransitionWaitingTime",null),e([g()],ae.prototype,"_transitionEnabled",null),e([g()],ae.prototype,"_seamlessTransitionEnabled",null),e([g()],ae.prototype,"_tracingResolution",null),e([g()],ae.prototype,"visible",null),e([g()],ae.prototype,"_effectiveDensity",null),e([g()],ae.prototype,"elevationInfo",null),e([g()],ae.prototype,"needsMagnitude",null),e([g()],ae.prototype,"spatialReferenceInfo",null),e([g()],ae.prototype,"loadingState",null),e([g()],ae.prototype,"updating",null),e([g()],ae.prototype,"visibleAtCurrentScale",null),e([g()],ae.prototype,"_materialParametersOverridde",void 0),e([g()],ae.prototype,"_suspendedOverride",void 0),e([g()],ae.prototype,"_simulationSettingsOverride",void 0),e([g()],ae.prototype,"_seamlessTransitionEnabledOverride",void 0),e([g()],ae.prototype,"_simulationSettings",null),e([g()],ae.prototype,"surface",null),ae=e([_("esri.views.3d.layers.FlowSubView3D")],ae);const oe=new x({mode:"on-the-ground"});function ue(e,t){return null==e||null==t||b(e,t)}const de=T(X,y.WebMercator),he=c(-F);function pe(e){return null!=e&&e.spatialReference.isWebMercator?e?.intersection(de):e}export{ae as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as c,subtract as m,divide as f,length as d,normalize as p,lerp as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as T,expandWithVec3 as h}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as y,BufferViewVec4f as v,BufferViewVec4u8 as w,BufferViewVec4u16 as R,BufferViewVec3u8 as S,BufferViewVec3u16 as B}from"../../../../geometry/support/buffer/BufferView.js";import{f as j,t as M,n as F,l as E}from"../../../../chunks/vec3.js";import{t as A,l as C}from"../../../../chunks/vec4.js";import{n as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as U}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as O}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as V,processLoadResult as _}from"./wosrLoader.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as D}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as K}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as G}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as N,esriSymbologyMRRFactors as Q,advancedMRRFactors as $}from"../../webgl-engine/materials/pbrUtils.js";async function z(e,r){const o=q(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):V(o.url,r)),{engineResources:t,referenceBoundingBox:s}=_(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR,!!r.useEmissive);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L,o.url,r,r.usePBR,r.useEmissive)}const{engineResources:i,referenceBoundingBox:n}=J(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function q(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function J(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,re(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:Q}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:$},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=T();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new G({},r):X(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Y(e,t??new G({},r)),g=c.boundingInfo;null!=g&&0===s&&(h(p,g.bbMin),h(p,g.bbMax)),null!=t&&(l.stageResources.geometries.push(c),l.numberOfVertices+=d)}),i||c.push(l)}),{engineResources:c,referenceBoundingBox:p}}function X(r,t,o,s,i,n,l,a,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),T=null!=t.attributes.texCoord0,h=null!=t.attributes.normal,b=ee(m.alphaMode);if(!n.has(x)){if(T){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!U(r)?a.compressionOptions:void 0;l.set(e,new K(U(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!U(r)&&o,encoding:U(r)?r.encoding:void 0,compressionOptions:i}))}}},t=1!==b&&!c;e(m.colorTexture,t,1!==b),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=e(m.color[0]),f=e(m.color[1]),d=e(m.color[2]),p=null!=m.colorTexture&&T?l.get(m.colorTexture):null,g=W(m),y=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:u;n.set(x,new G({...s,customDepthTest:1,textureAlphaMode:b,textureAlphaCutoff:m.alphaCutoff,diffuse:[o,f,d],ambient:[o,f,d],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:h?0:2,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&T?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&T?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&T?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&T?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[m.emissiveFactor[0],m.emissiveFactor[1],m.emissiveFactor[2]],emissiveStrengthKHR:null!=m.emissiveStrengthKHR?m.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=i.emissiveStrengthFromSymbol?i.emissiveStrengthFromSymbol:void 0,mrrFactors:g?N:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:g,colorTextureTransformMatrix:O(m.colorTextureTransform),normalTextureTransformMatrix:O(m.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:O(m.occlusionTextureTransform),emissiveTextureTransformMatrix:O(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:O(m.metallicRoughnessTextureTransform),...i},a))}const y=n.get(x);if(o.stageResources.materials.push(y),T){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function Y(e,r){const t=e.attributes.position.count,n=P(e.indices||t,e.primitiveType),l=b(3*t),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;j(l,a,e.transform,3,u);const c=[["position",new H(l,n,3,!0)]];if(null!=e.attributes.normal){const r=b(3*t),{typedBuffer:i,typedBufferStride:l}=e.attributes.normal;s(Z,e.transform),M(r,i,Z,3,l),o(Z)&&F(r,r),c.push(["normal",new H(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=b(4*t),{typedBuffer:s,typedBufferStride:l}=e.attributes.tangent;i(Z,e.transform),A(r,s,Z,4,l),o(Z)&&F(r,r,4),c.push(["tangent",new H(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=b(2*t),{typedBuffer:o,typedBufferStride:s}=e.attributes.texCoord0;I(r,o,2,s),c.push(["uv0",new H(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*t);4===m.elementCount?m instanceof v?C(r,m,1,255):(m instanceof w||m instanceof R)&&C(r,m,1/255,255):(r.fill(255),m instanceof y?E(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof S||e.attributes.color instanceof B)&&E(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new H(r,n,4,!0)])}return{geometry:new D(r,c),vertexCount:t}}const Z=n();function ee(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function re(e,t){for(let o=0;o<e.model.lods.length;++o){const s=e.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const n=i.attributes.position,u=n.count,T=x(),h=x(),b=x(),w=new Float32Array(4*u),R=new Float32Array(3*u),S=l(a(),i.transform);let B=0,j=0;for(let l=0;l<u;l++){n.getVec(l,h),s.getVec(l,T),c(h,h,i.transform),m(b,h,t.center),f(b,b,t.radius);const a=b[2],u=d(b),x=Math.min(.45+.55*u*u,1)**r;f(b,b,t.radius),null!==S&&c(b,b,S),p(b,b),o+1!==e.model.lods.length&&e.model.lods.length>1&&g(b,b,T,a>-1?.2:Math.min(-4*a-3.8,1)),R[B]=b[0],R[B+1]=b[1],R[B+2]=b[2],B+=3,w[j]=x,w[j+1]=x,w[j+2]=x,w[j+3]=1,j+=4}i.attributes.normal=new y(R.buffer),i.attributes.color=new v(w.buffer)}}}export{z as fetch,q as parseUrl};
2
+ import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as c,subtract as m,divide as f,length as d,normalize as p,lerp as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as T,expandWithVec3 as h}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as y,BufferViewVec4f as v,BufferViewVec4u8 as w,BufferViewVec4u16 as R,BufferViewVec3u8 as S,BufferViewVec3u16 as B}from"../../../../geometry/support/buffer/BufferView.js";import{f as j,t as M,n as F,l as E}from"../../../../chunks/vec3.js";import{t as A,l as C}from"../../../../chunks/vec4.js";import{n as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as P}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as U}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as O}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as V,processLoadResult as _}from"./wosrLoader.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as D}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as K}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as G}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as W,schematicMRRFactors as N,esriSymbologyMRRFactors as Q,advancedMRRFactors as $}from"../../webgl-engine/materials/pbrUtils.js";async function z(e,r){const o=q(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):V(o.url,r)),{engineResources:t,referenceBoundingBox:s}=_(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR,!!r.useEmissive);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L,o.url,r,r.usePBR,r.useEmissive)}const{engineResources:i,referenceBoundingBox:n}=J(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function q(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return{fileType:e.match(/(.*\.(json|json\.gz))$/)?"wosr":"unknown",url:e,specifiedLodIndex:null}}function J(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,re(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:Q}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:$},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=T();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new G({},r):X(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Y(e,t??new G({},r)),g=c.boundingInfo;null!=g&&0===s&&(h(p,g.bbMin),h(p,g.bbMax)),null!=t&&(l.stageResources.geometries.push(c),l.numberOfVertices+=d)}),i||c.push(l)}),{engineResources:c,referenceBoundingBox:p}}function X(r,t,o,s,i,n,l,a,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,x=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),T=null!=t.attributes.texCoord0,h=null!=t.attributes.normal,b=ee(m.alphaMode);if(!n.has(x)){if(T){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!U(r)?a.compressionOptions:void 0;l.set(e,new K(U(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!U(r)&&o,encoding:U(r)?r.encoding:void 0,compressionOptions:i}))}}},t=1!==b&&!c;e(m.colorTexture,t,1!==b),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=e(m.color[0]),f=e(m.color[1]),d=e(m.color[2]),p=null!=m.colorTexture&&T?l.get(m.colorTexture):null,g=W(m),y=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:u;n.set(x,new G({...s,customDepthTest:1,textureAlphaMode:b,textureAlphaCutoff:m.alphaCutoff,diffuse:[o,f,d],ambient:[o,f,d],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:h?0:2,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&T?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&T?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&T?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&T?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[m.emissiveFactor[0],m.emissiveFactor[1],m.emissiveFactor[2]],emissiveStrengthKHR:null!=m.emissiveStrengthKHR?m.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=i.emissiveStrengthFromSymbol?i.emissiveStrengthFromSymbol:void 0,mrrFactors:g?N:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:g,colorTextureTransformMatrix:O(m.colorTextureTransform),normalTextureTransformMatrix:O(m.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:O(m.occlusionTextureTransform),emissiveTextureTransformMatrix:O(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:O(m.metallicRoughnessTextureTransform),...i},a))}const y=n.get(x);if(o.stageResources.materials.push(y),T){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return y}function Y(e,r){const t=e.attributes.position.count,n=P(e.indices||t,e.primitiveType),l=b(3*t),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;j(l,a,e.transform,3,u);const c=[["position",new H(l,n,3,!0)]];if(null!=e.attributes.normal){const r=b(3*t),{typedBuffer:i,typedBufferStride:l}=e.attributes.normal;s(Z,e.transform),M(r,i,Z,3,l),o(Z)&&F(r,r),c.push(["normal",new H(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=b(4*t),{typedBuffer:s,typedBufferStride:l}=e.attributes.tangent;i(Z,e.transform),A(r,s,Z,4,l),o(Z)&&F(r,r,4),c.push(["tangent",new H(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=b(2*t),{typedBuffer:o,typedBufferStride:s}=e.attributes.texCoord0;I(r,o,2,s),c.push(["uv0",new H(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*t);4===m.elementCount?m instanceof v?C(r,m,1,255):(m instanceof w||m instanceof R)&&C(r,m,1/255,255):(r.fill(255),m instanceof y?E(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof S||e.attributes.color instanceof B)&&E(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new H(r,n,4,!0)])}return{geometry:new D(r,c),vertexCount:t}}const Z=n();function ee(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function re(e,t){for(let o=0;o<e.model.lods.length;++o){const s=e.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const n=i.attributes.position,u=n.count,T=x(),h=x(),b=x(),w=new Float32Array(4*u),R=new Float32Array(3*u),S=l(a(),i.transform);let B=0,j=0;for(let l=0;l<u;l++){n.getVec(l,h),s.getVec(l,T),c(h,h,i.transform),m(b,h,t.center),f(b,b,t.radius);const a=b[2],u=d(b),x=Math.min(.45+.55*u*u,1)**r;f(b,b,t.radius),null!==S&&c(b,b,S),p(b,b),o+1!==e.model.lods.length&&e.model.lods.length>1&&g(b,b,T,a>-1?.2:Math.min(-4*a-3.8,1)),R[B]=b[0],R[B+1]=b[1],R[B+2]=b[2],B+=3,w[j]=x,w[j+1]=x,w[j+2]=x,w[j+3]=1,j+=4}i.attributes.normal=new y(R.buffer),i.attributes.color=new v(w.buffer)}}}export{z as fetch,q as parseUrl};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t,syncAndInitial as s,when as i,sync as l}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as n,create as d}from"../../../../geometry/support/aaBoundingRect.js";import h from"../../layers/FlowSubView3D.js";import{getFeatureTileId as u}from"../../layers/support/FeatureTileDescriptor.js";import{tilesWaitingTime as p}from"./constants.js";import{FlowDataTile as c}from"./loadUtils.js";import{isRasterTile as f}from"../../terrain/TerrainData.js";import{descendantsAtLevel as T}from"../../terrain/tileUtils.js";import{toFlowData as _}from"../../../support/flow/dataUtils.js";const m={type:"delete"};let g=class extends h{constructor(e){super(e),this._flowDataTiles=y(),this._throttling=!1,this._resetTileData=!0}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{if(t!==this._layerIndex||1!==s)return;const i=this.frameTask.schedule(()=>{this._applyTileDataUpdate(e)&&this.triggerLoad()});this.updatingHandles.consumePromise(i)}),t(()=>this.renderedTiles,e=>{const t=this.frameTask.scheduleGenerator(this.loadAllTiles?t=>this._applyTileDataUpdates(e,t):t=>this._syncToTiles(e,t));this.updatingHandles.consumePromise(t)},s),i(()=>null!=this.renderedTiles&&null!=this.extent&&this.loadAllTiles,()=>{const e=this.frameTask.scheduleGenerator(e=>this._enterAllTilesMode(e));this.updatingHandles.consumePromise(e)},s),t(()=>this._pixelSize,()=>{this.invalidateTileData(),this._resetTileData=!0},l),this.layerView.on("data-changed",()=>{this.invalidateTileData(),this._resetTileData=!0})]),this._throttledTriggerLoad=a(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,p,this),this.addHandles(this._throttledTriggerLoad)}clear(){super.clear(),this._resetTileData=!1}*_enterAllTilesMode(e){const{targetTiles:t,_flowDataTiles:s}=this,i=y();for(const[l,a]of s)t.has(l)&&i.set(l,a);this._setFlowDataTiles(i),e.madeProgress(),e.done&&(e=yield),yield*this._applyTileDataUpdates(new Set(this.surface.allTiles),e),this.triggerLoad()}*_syncToTiles(e,t){const s=y();for(const i of e??[]){const e=this._flowDataTiles.get(i.key),l=null==e||"delete"===e.type||"invalid"===e.type?this._getLoadedState(i):e;null!=l&&s.set(i.key,l),t.madeProgress(),t.done&&(t=yield)}this._setFlowDataTiles(s),this.triggerLoad()}*_applyTileDataUpdates(e,t){let s=!1;for(const i of e??[]){const e=this._applyTileDataUpdate(i);s||=e,t.madeProgress(),t.done&&(t=yield)}s&&this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get _pixelSize(){return this.surface.tilingScheme.pixelSize}doRefresh(){this.invalidateTileData(),super.doRefresh()}triggerLoad(){const{_throttledTriggerLoad:e}=this;null!=e?this._allTilesLoaded?(e.hasPendingUpdates()||e(),e.forceUpdate()):e():super.triggerLoad()}async fetchDataAndGenerateStreamlines(e,t){const{_flowDataTiles:s,needsMagnitude:i}=this,l=this.getSimulationSettings(e);if(null==l)return;const a=this._resetTileData;if(!a&&0===s.size)return;const r=y();s.forEach((e,t)=>{"delete"===e.type?(r.set(t,m),s.delete(t)):(a||"on-worker"!==e.type&&"invalid"!==e.type)&&(r.set(t,e),s.set(t,"invalid"===e.type?{type:"invalid",memory:e.memory}:{type:"on-worker",sourceLevel:e.sourceLevel,memory:e.memory}))});const o={simulationSettings:l,flowExtentInfo:e.flowExtentInfo,flowDataTiles:r,reset:a,needsMagnitude:i,startPositions:this.startPositions(e)};this._resetTileData=!1;const{streamlines:n}=await this.workerHandle.generateTiledStreamlines(o,t);return n}hasWork(){return super.hasWork()||this._throttling||!this.suspended&&this._resetTileData}get loadRequirementsMet(){return super.loadRequirementsMet&&(this._flowDataTiles.size>0||this._resetTileData)}_getLoadedState(e){const{_layerIndex:t}=this;if(null==t||e.isDisposed)return null;const s=e.getLayerInfo(t,1);if(null==s)return null;const i=this._getRasterTile(s,e,t);if(null==i)return this._upsampleFlowData(t,s.upsampleInfo,e.lij,e.extent);const l=this._createFlowDataTile(i,e.lij,e.extent,this._pixelSize);return{type:"loaded",memory:w(l),data:l,sourceLevel:e.level}}_upsampleFlowData(e,t,s,i){if(null==t)return null;const l=t.tile;if(null==l)return null;const a=l.getLayerInfo(e,1);if(null==a)return null;const r=this._getRasterTile(a,l,e);if(null==r)return null;const{scale:o,offset:n}=t,d=Math.max(Math.floor(this._pixelSize*o),1),h=r.source,u=Math.floor(n[0]*h.width),p=Math.floor((1-n[1]-o)*h.height),c=this._createFlowDataTile(r,s,i,d,u,p);return{type:"loaded",memory:w(c),data:c,sourceLevel:l.level}}_getRasterTile(e,t,s){const{data:i}=e;return!e.dataMissing&&t.hasLayerData(s,1)&&f(i)?i:null}_createFlowDataTile(e,t,s,i,l,a){const r=_(this.layer.serviceRasterInfo.dataType,e.source,i,i,l,a),o=r.mask.slice();return new c(r.data,o,r.width,r.height,t,n(s))}_applyTileDataUpdate(e){const{renderedTiles:t,_layerIndex:s,loadAllTiles:i,loadAllTilesLevel:l}=this;if(null==t||null==s||i&&e.level>l)return!1;if(t.has(e))return this._updateRenderedTile(e);const a=e.key;let r=this._setTileData(a,m);const o=this._updateUpsampledTiles(t,e,s);r||=o;const n=i&&this._updateDescendants(e,s);return r||=n,r}_updateRenderedTile(e){const t=e.key,{_flowDataTiles:s}=this;if(D(s.get(t),e))return!1;const i=this._getLoadedState(e);return this._setTileData(t,i)}_updateUpsampledTiles(e,t,s){const{_flowDataTiles:i}=this;let l=!1;for(const a of e.values()){const e=a.key;if(D(i.get(e),t))continue;const r=a.getLayerInfo(s,1);if(null==r)continue;if(null!=this._getRasterTile(r,a,s))continue;const o=r.upsampleInfo?.tile;if(o!==t)continue;const n=this._getLoadedState(a),d=this._setTileData(e,n);l||=d}return l}_updateDescendants(e,t){let s=!1;const{tilingScheme:i,upsampleInfoPool:l}=this.surface,{targetTiles:a,_flowDataTiles:r,loadAllTilesLevel:o}=this,n=e.lij,h=T(n,o).map(e=>[u(e[0],e[1],e[2]),e]).filter(([e])=>a.has(e));if(0===h.length)return s;const p=1<<o-n[0],c=1/p,f=n[1]*p,_=n[2]*p,m=l.acquire();for(const[u,T]of h){if(D(r.get(u),e))continue;const l=d();i.getExtent(T[0],T[1],T[2],l);const a=1-(T[1]-f)*c-c,o=(T[2]-_)*c;m.init(e,o,a,c);const n=this._upsampleFlowData(t,m,T,l),h=this._setTileData(u,n);s||=h}return l.release(m),s}_setTileData(e,t){if(null==t)return!1;const{_flowDataTiles:s}=this;return(null!=s.get(e)||"delete"!==t.type)&&(s.set(e,t),!0)}_setFlowDataTiles(e){const t=this._flowDataTiles.size!==e.size||Array.from(e).some(([e,t])=>this._flowDataTiles.get(e)!==t);this._flowDataTiles=e,t&&(this._resetTileData=!0)}get _allTilesLoaded(){let e=0;for(const t of this._flowDataTiles.values()??[])"delete"!==t.type&&"invalid"!==t.type&&e++;return this.loadAllTiles?e===this.targetTiles.size:e===this.renderedTiles?.size}invalidateTileData(){const{_flowDataTiles:e}=this;for(const[t,s]of e.entries())"delete"!==s.type&&e.set(t,{type:"invalid",memory:s.memory})}get usedMemory(){let e=0;return this._flowDataTiles.forEach(t=>{"delete"!==t.type&&(e+=t.memory)}),super.usedMemory+e}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};function y(){return new Map}function D(e,t){return null!=e&&("loaded"===e.type||"on-worker"===e.type)&&e.sourceLevel>=t.level}function w(e){return e.width*e.height*9}e([r()],g.prototype,"_throttling",void 0),e([r()],g.prototype,"_resetTileData",void 0),g=e([o("esri.views.3d.support.flow.FlowSubViewTiles3D")],g);export{g as default};
2
+ import{__decorate as e}from"tslib";import{watch as t,syncAndInitial as s,when as i,sync as l}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{clone as n,create as d}from"../../../../geometry/support/aaBoundingRect.js";import h from"../../layers/FlowSubView3D.js";import{getFeatureTileId as u}from"../../layers/support/FeatureTileDescriptor.js";import{tilesWaitingTime as c}from"./constants.js";import{FlowDataTile as p}from"./loadUtils.js";import{isRasterTile as f}from"../../terrain/TerrainData.js";import{descendantsAtLevel as T}from"../../terrain/tileUtils.js";import{toFlowData as _}from"../../../support/flow/dataUtils.js";const m={type:"delete"};let g=class extends h{constructor(e){super(e),this._flowDataTiles=y(),this._throttling=!1,this._resetTileData=!0}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{if(t!==this._layerIndex||1!==s)return;const i=this.frameTask.schedule(()=>{this._applyTileDataUpdate(e)&&this.triggerLoad()});this.updatingHandles.consumePromise(i)}),t(()=>this.renderedTiles,e=>{const t=this.frameTask.scheduleGenerator(this.loadAllTiles?t=>this._applyTileDataUpdates(e,t):t=>this._syncToTiles(e,t));this.updatingHandles.consumePromise(t)},s),i(()=>null!=this.renderedTiles&&null!=this.extent&&this.loadAllTiles,()=>{const e=this.frameTask.scheduleGenerator(e=>this._enterAllTilesMode(e));this.updatingHandles.consumePromise(e)},s),t(()=>this._pixelSize,()=>{this.invalidateTileData(),this._resetTileData=!0},l),this.layerView.on("data-changed",()=>{this.invalidateTileData(),this._resetTileData=!0})]),this._throttledTriggerLoad=a(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,c,this),this.addHandles(this._throttledTriggerLoad)}clear(){super.clear(),this._resetTileData=!1}*_enterAllTilesMode(e){const{targetTiles:t,_flowDataTiles:s}=this,i=y();for(const[l,a]of s)t.has(l)&&i.set(l,a);this._setFlowDataTiles(i),e.madeProgress(),e.done&&(e=yield),yield*this._applyTileDataUpdates(new Set(this.surface.allTiles),e),this.triggerLoad()}*_syncToTiles(e,t){const s=y();for(const i of e??[]){const e=this._flowDataTiles.get(i.key),l=null==e||"delete"===e.type||"invalid"===e.type?this._getLoadedState(i):e;null!=l&&s.set(i.key,l),t.madeProgress(),t.done&&(t=yield)}this._setFlowDataTiles(s),this.triggerLoad()}*_applyTileDataUpdates(e,t){let s=!1;for(const i of e??[]){const e=this._applyTileDataUpdate(i);s||=e,t.madeProgress(),t.done&&(t=yield)}s&&this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get _pixelSize(){return this.surface.tilingScheme.pixelSize}doRefresh(){this.invalidateTileData(),super.doRefresh()}triggerLoad(){const{_throttledTriggerLoad:e}=this;null!=e?this._allTilesLoaded?(e.hasPendingUpdates()||e(),e.forceUpdate()):e():super.triggerLoad()}async fetchDataAndGenerateStreamlines(e,t){const{_flowDataTiles:s,needsMagnitude:i}=this,l=this.getSimulationSettings(e);if(null==l)return;const a=this._resetTileData;if(!a&&0===s.size)return;const r=y();s.forEach((e,t)=>{"delete"===e.type?(r.set(t,m),s.delete(t)):(a||"on-worker"!==e.type&&"invalid"!==e.type)&&(r.set(t,e),s.set(t,"invalid"===e.type?{type:"invalid",memory:e.memory}:{type:"on-worker",sourceLevel:e.sourceLevel,memory:e.memory}))});const o={simulationSettings:l,flowExtentInfo:e.flowExtentInfo,flowDataTiles:r,reset:a,needsMagnitude:i,startPositions:this.startPositions(e)};this._resetTileData=!1;const{streamlines:n}=await this.workerHandle.generateTiledStreamlines(o,t);return n}hasWork(){const e=!this.suspended&&super.loadRequirementsMet&&this.tilesIntersectDataBounds;return super.hasWork()||this._throttling||this._resetTileData&&e}get loadRequirementsMet(){return super.loadRequirementsMet&&(this._flowDataTiles.size>0||this._resetTileData)}_getLoadedState(e){const{_layerIndex:t}=this;if(null==t||e.isDisposed)return null;const s=e.getLayerInfo(t,1);if(null==s)return null;const i=this._getRasterTile(s,e,t);if(null==i)return this._upsampleFlowData(t,s.upsampleInfo,e.lij,e.extent);const l=this._createFlowDataTile(i,e.lij,e.extent,this._pixelSize);return{type:"loaded",memory:w(l),data:l,sourceLevel:e.level}}_upsampleFlowData(e,t,s,i){if(null==t)return null;const l=t.tile;if(null==l)return null;const a=l.getLayerInfo(e,1);if(null==a)return null;const r=this._getRasterTile(a,l,e);if(null==r)return null;const{scale:o,offset:n}=t,d=Math.max(Math.floor(this._pixelSize*o),1),h=r.source,u=Math.floor(n[0]*h.width),c=Math.floor((1-n[1]-o)*h.height),p=this._createFlowDataTile(r,s,i,d,u,c);return{type:"loaded",memory:w(p),data:p,sourceLevel:l.level}}_getRasterTile(e,t,s){const{data:i}=e;return!e.dataMissing&&t.hasLayerData(s,1)&&f(i)?i:null}_createFlowDataTile(e,t,s,i,l,a){const r=_(this.layer.serviceRasterInfo.dataType,e.source,i,i,l,a),o=r.mask.slice();return new p(r.data,o,r.width,r.height,t,n(s))}_applyTileDataUpdate(e){const{renderedTiles:t,_layerIndex:s,loadAllTiles:i,loadAllTilesLevel:l}=this;if(null==t||null==s||i&&e.level>l)return!1;if(t.has(e))return this._updateRenderedTile(e);const a=e.key;let r=this._setTileData(a,m);const o=this._updateUpsampledTiles(t,e,s);r||=o;const n=i&&this._updateDescendants(e,s);return r||=n,r}_updateRenderedTile(e){const t=e.key,{_flowDataTiles:s}=this;if(D(s.get(t),e))return!1;const i=this._getLoadedState(e);return this._setTileData(t,i)}_updateUpsampledTiles(e,t,s){const{_flowDataTiles:i}=this;let l=!1;for(const a of e.values()){const e=a.key;if(D(i.get(e),t))continue;const r=a.getLayerInfo(s,1);if(null==r)continue;if(null!=this._getRasterTile(r,a,s))continue;const o=r.upsampleInfo?.tile;if(o!==t)continue;const n=this._getLoadedState(a),d=this._setTileData(e,n);l||=d}return l}_updateDescendants(e,t){let s=!1;const{tilingScheme:i,upsampleInfoPool:l}=this.surface,{targetTiles:a,_flowDataTiles:r,loadAllTilesLevel:o}=this,n=e.lij,h=T(n,o).map(e=>[u(e[0],e[1],e[2]),e]).filter(([e])=>a.has(e));if(0===h.length)return s;const c=1<<o-n[0],p=1/c,f=n[1]*c,_=n[2]*c,m=l.acquire();for(const[u,T]of h){if(D(r.get(u),e))continue;const l=d();i.getExtent(T[0],T[1],T[2],l);const a=1-(T[1]-f)*p-p,o=(T[2]-_)*p;m.init(e,o,a,p);const n=this._upsampleFlowData(t,m,T,l),h=this._setTileData(u,n);s||=h}return l.release(m),s}_setTileData(e,t){if(null==t)return!1;const{_flowDataTiles:s}=this;return(null!=s.get(e)||"delete"!==t.type)&&(s.set(e,t),!0)}_setFlowDataTiles(e){const t=this._flowDataTiles.size!==e.size||Array.from(e).some(([e,t])=>this._flowDataTiles.get(e)!==t);this._flowDataTiles=e,t&&(this._resetTileData=!0)}get _allTilesLoaded(){let e=0;for(const t of this._flowDataTiles.values()??[])"delete"!==t.type&&"invalid"!==t.type&&e++;return this.loadAllTiles?e===this.targetTiles.size:e===this.renderedTiles?.size}invalidateTileData(){const{_flowDataTiles:e}=this;for(const[t,s]of e.entries())"delete"!==s.type&&e.set(t,{type:"invalid",memory:s.memory})}get usedMemory(){let e=0;return this._flowDataTiles.forEach(t=>{"delete"!==t.type&&(e+=t.memory)}),super.usedMemory+e}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};function y(){return new Map}function D(e,t){return null!=e&&("loaded"===e.type||"on-worker"===e.type)&&e.sourceLevel>=t.level}function w(e){return e.width*e.height*9}e([r()],g.prototype,"_throttling",void 0),e([r()],g.prototype,"_resetTileData",void 0),g=e([o("esri.views.3d.support.flow.FlowSubViewTiles3D")],g);export{g as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{a as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(w(e,i)!==w(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,i=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===i)return h;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,h=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=i[0]-P[0],X[1]=i[1]-P[1],X[2]=i[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||d(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==h.distance||n<h.distance)&&O(h,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o),e.results.all.push(p)):n<p.distance&&O(p,n,o)),(null==a.distance||n<a.distance)&&O(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&O(l,n,o)}},D=Y;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,D,R,S)}else C(X,D,0,U,B,I,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=o.hasEmission=!1,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=9===s;return o.receiveShadows=t.ready&&!r,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.receiveGlobalIllumination=!r&&i.globalIlluminationEnabled,o.hasEmission=n,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)O(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",h),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:h;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const i=d[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of d){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:d,bind:h}=e;s&&(t.useStencil=this._useStencilForTile(i),d.setPipelineState(t.getPipeline(h)));const u=a.geometry.indexCount;d.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),d.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{a as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(w(e,i)!==w(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,i=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===i)return d;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,d=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=i[0]-P[0],X[1]=i[1]-P[1],X[2]=i[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||h(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==d.distance||n<d.distance)&&O(d,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o),e.results.all.push(p)):n<p.distance&&O(p,n,o)),(null==a.distance||n<a.distance)&&O(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&O(l,n,o)}},D=Y;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,D,R,S)}else C(X,D,0,U,B,I,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=o.hasEmission=!1,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=9===s;return o.receiveShadows=t.ready&&!r,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.receiveGlobalIllumination=!r&&i.globalIlluminationEnabled,o.hasEmission=n,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)O(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",d),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:d;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const h of c.values()){const i=h[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:h,bind:d}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(i),h.setPipelineState(t.getPipeline(d,this._passParameters)));const u=a.geometry.indexCount;h.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),h.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/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));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(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};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{C as t}from"../../../../../../chunks/ComponentShader.glsl.js";import{isOITColor as i,isOITFrontFace as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as n}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../../../core/shaderTechnique/ShaderTechnique.js";import{depthTest as s,blending as a}from"../../../lib/OrderIndependentTransparency.js";import{stencilBaseAllZeros as p,stencilWriteMaskOn as d,replaceBitWhenDepthTestPasses as m}from"../../../lib/StencilUtils.js";import{IndexGlLayout as u}from"../../../materials/DefaultLayouts.js";import{polygonOffset as c}from"../../../materials/PolygonOffset.js";import{makePipelineState as h,defaultColorWrite as f,defaultDepthWrite as g,premultipliedAlpha as b,cullingParams as j}from"../../../../../webgl/renderState.js";let P=class extends l{constructor(e,r,i){super(e,r,i.concat(u)),this.shader=new n(t,()=>import("./ComponentShader.glsl.js")),this.ignoreUnused=!0}getPipeline(e){return e.camera.aboveGround||null==this._belowGroundPipeline?super.getPipeline(e):this._belowGroundPipeline}initializePipeline(e){return this._belowGroundPipeline=0===e.integratedMeshMode?null:this._makePipeline(e,!0),this._makePipeline(e,!1)}_makePipeline(e,r){const{integratedMeshMode:t,output:n,transparent:l,cullFace:u,hasOccludees:P,renderOccluded:S}=e,w=0!==t,T=!i(n),O=o(n);let _=j(u);return r&&_&&(_={..._,mode:2304}),h({blending:S?b:l?a(n):null,culling:_,depthTest:S?null:s(n),depthWrite:S||!T&&!O?null:g,colorWrite:f,stencilWrite:!S&&w||P?d:null,stencilTest:w?m(1):P?p:null,polygonOffset:c(e)})}};P=e([r("esri.views.3d.webgl-engine.collections.Component.Material.ComponentTechnique")],P);export{P as ComponentTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{C as t}from"../../../../../../chunks/ComponentShader.glsl.js";import{isOITColor as i,isOITFrontFace as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as n}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../../../core/shaderTechnique/ShaderTechnique.js";import{depthTest as s,blending as a}from"../../../lib/OrderIndependentTransparency.js";import{stencilBaseAllZeros as p,stencilWriteMaskOn as d,replaceBitWhenDepthTestPasses as m}from"../../../lib/StencilUtils.js";import{IndexGlLayout as u}from"../../../materials/DefaultLayouts.js";import{polygonOffset as c}from"../../../materials/PolygonOffset.js";import{makePipelineState as h,defaultColorWrite as f,defaultDepthWrite as g,premultipliedAlpha as b,cullingParams as j}from"../../../../../webgl/renderState.js";let P=class extends l{constructor(e,r,i){super(e,r,i.concat(u)),this.shader=new n(t,()=>import("./ComponentShader.glsl.js")),this.ignoreUnused=!0}getPipeline(e,r){return e.camera.aboveGround||null==this._belowGroundPipeline?super.getPipeline(e,r):this._belowGroundPipeline}initializePipeline(e){return this._belowGroundPipeline=0===e.integratedMeshMode?null:this._makePipeline(e,!0),this._makePipeline(e,!1)}_makePipeline(e,r){const{integratedMeshMode:t,output:n,transparent:l,cullFace:u,hasOccludees:P,renderOccluded:S}=e,w=0!==t,T=!i(n),O=o(n);let _=j(u);return r&&_&&(_={..._,mode:2304}),h({blending:S?b:l?a(n):null,culling:_,depthTest:S?null:s(n),depthWrite:S||!T&&!O?null:g,colorWrite:f,stencilWrite:!S&&w||P?d:null,stencilTest:w?m(1):P?p:null,polygonOffset:c(e)})}};P=e([r("esri.views.3d.webgl-engine.collections.Component.Material.ComponentTechnique")],P);export{P as ComponentTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import i from"../../../../../core/Accessor.js";import t from"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{Pos2 as s}from"../../lib/DefaultVertexBufferLayouts.js";import{Program as o}from"../../lib/Program.js";import{PrimitiveType as n}from"../../../../webgl/enums.js";import{makePipelineState as a,defaultColorWrite as h,premultipliedAlpha as l}from"../../../../webgl/renderState.js";import{fromLayout as c}from"../../../../webgl/VertexAttributeLocations.js";const u=()=>t.getLogger("esri.views.3d.webgl.ShaderTechnique");let d=class extends i{constructor(e,i,t){super({}),this._context=e,this._configuration=i,this.primitiveType=n.TRIANGLES,this._unused=!0,this.ignoreUnused=!1,this.key=i.key,this.locations=c(t??s),this._pipeline=this.initializePipeline(i),this.reload=async t=>{if(t&&await this.shader.reload(),!this.key.equals(i.key))return void u().warn(`Configuration was changed after construction, cannot reload shader for ${this.declaredClass}.`);const r=this.shader.get().build(i);r.debugName=this.declaredClass,this._program=new o(e.rctx,r,this.locations),this._pipeline=this.initializePipeline(i)}}initialize(){const e=this.shader.get().build(this._configuration);e.debugName=this.declaredClass,this._program=new o(this._context.rctx,e,this.locations)}get program(){return this._unused=!1,this._program}get compiled(){return this._unused=!1,this.program.compiled}get unused(){return this._unused}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}getPipeline(e,i){return this._pipeline}initializePipeline(e){return a({blending:l,colorWrite:h})}};d=e([r("esri.views.3d.webgl-engine.core.shaderTechnique.ShaderTechnique")],d);export{d as ShaderTechnique};
2
+ import{__decorate as e}from"tslib";import i from"../../../../../core/Accessor.js";import t from"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{Pos2 as s}from"../../lib/DefaultVertexBufferLayouts.js";import{Program as o}from"../../lib/Program.js";import{PrimitiveType as n}from"../../../../webgl/enums.js";import{makePipelineState as a,defaultColorWrite as h,premultipliedAlpha as l}from"../../../../webgl/renderState.js";import{fromLayout as c}from"../../../../webgl/VertexAttributeLocations.js";const u=()=>t.getLogger("esri.views.3d.webgl.ShaderTechnique");let d=class extends i{constructor(e,i,t){super({}),this._context=e,this._configuration=i,this.primitiveType=n.TRIANGLES,this._unused=!0,this.ignoreUnused=!1,this.key=i.key,this.locations=c(t??s),this._pipeline=this.initializePipeline(i),this.reload=async t=>{if(t&&await this.shader.reload(),!this.key.equals(i.key))return void u().warn(`Configuration was changed after construction, cannot reload shader for ${this.declaredClass}.`);const r=this.shader.get().build(i);r.debugName=this.declaredClass,this._program=new o(e.rctx,r,this.locations),this._pipeline=this.initializePipeline(i)}}initialize(){const e=this.shader.get().build(this._configuration);e.debugName=this.declaredClass,this._program=new o(this._context.rctx,e,this.locations)}get program(){return this._unused=!1,this._program}get compiled(){return this._unused=!1,this.program.compiled}get unused(){return this._unused}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}getPipeline(e,i,t){return this._pipeline}initializePipeline(e){return a({blending:l,colorWrite:h})}};d=e([r("esri.views.3d.webgl-engine.core.shaderTechnique.ShaderTechnique")],d);export{d as ShaderTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/Float3BindUniform.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/Float4PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"./ChapmanApproximation.glsl.js";import"./ChapmanRaymarching.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/SphereIntersect.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../chunks/ChapmanAtmosphere.glsl.js";
2
+ import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderModules/BooleanPassUniform.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/Float3BindUniform.js";import"../../core/shaderModules/Float3PassUniform.js";import"../../core/shaderModules/Float4PassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"./ChapmanApproximation.glsl.js";import"./ChapmanRaymarching.glsl.js";import"../../shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../shaders/SphereIntersect.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../chunks/ChapmanAtmosphere.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as o}from"../../../../../core/reactiveUtils.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as c}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{OpaqueEnvironment as u}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as f,innerAtmosphereDepth as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as b,ChapmanAtmosphereTechnique as g}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as _}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{createQuadVAO as w}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as P}from"../../lib/textureUtils.js";import{a as j}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as v}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as A,ColorAttachment0 as C,PrimitiveType as q}from"../../../../webgl/enums.js";import x from"../../../../../webscene/background/ColorBackground.js";let T=class extends u{constructor(){super(...arguments),this._compositingPassParameters=new j,this._vao=null,this._passParameters=new b,this._configuration=new _}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof x?e.color.toUnitRGBA():p;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._configuration.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??p,this.requestRender(1)},o),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}render(e){const r=e.find(({name:e})=>e===d.OPAQUE_ENVIRONMENT);if(!this.bindParameters.mainDepth)return r;const s=this.renderingContext;this._vao??=w(s,1);const i=r.getAttachment(A);this._update();const o=this.techniques.getCompiled(g,this._configuration);if(!o)return this.requestRender(1),r;if(!this._configuration.reduced)return r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(o,this.bindParameters,this._passParameters),s.setDrawBuffers([C]),s.bindVAO(this._vao),s.drawArrays(q.TRIANGLE_STRIP,0,4),r.attachDepth(i),r;const a=this.techniques.getCompiled(v);if(!a)return this.requestRender(1),r;const n=s.getViewport(),m=this.bindParameters.camera,p=h(m.eye)-c.radius;let u;const f=c.atmosphereHeight;if(p<f){const e=Math.min(1,Math.max(0,p/f));u=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(p-f)/(15*f)));u=t(.3,.6,e)}const l=this.renderingContext.parameters.maxTextureSize,b=P(Math.round(u*m.fullViewport[2]),l),_=P(Math.round(u*m.fullViewport[3]),l);s.setViewport(0,0,b,_);const j=this.fboCache.acquire(b,_,"chapman",5);return s.bindFramebuffer(j.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(o,this.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(q.TRIANGLE_STRIP,0,4),s.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=j.getTexture(),r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(a,this.bindParameters,this._compositingPassParameters),s.setDrawBuffers([C]),s.screen.draw(),r.attachDepth(i),j.release(),r}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+c.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=f(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}};T=e([a("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],T);export{T as ChapmanAtmosphere};
2
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as i,initial as a}from"../../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as m,length as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as c}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{OpaqueEnvironment as u}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as l,innerAtmosphereDepth as f}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as b,ChapmanAtmosphereTechnique as g}from"./ChapmanAtmosphereTechnique.js";import{createQuadVAO as _}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as P}from"../../lib/textureUtils.js";import{a as w}from"../../../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as v}from"../../shaders/AtmosphereCompositingTechnique.js";import{DepthStencilAttachment as j,ColorAttachment0 as A,PrimitiveType as x}from"../../../../webgl/enums.js";import C from"../../../../../webscene/background/ColorBackground.js";let T=class extends u{constructor(){super(...arguments),this._compositingPassParameters=new w,this._vao=null,this._passParameters=new b}initialize(){this.addHandles([s(()=>this.view.environment.background,e=>{const t=e instanceof C?e.color.toUnitRGBA():p;m(this._passParameters.backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3])},i),s(()=>this.view.stage?.renderer?.highResolutionAtmosphere,e=>this._passParameters.reduced=!e,i),s(()=>this.view.map.ground.undergroundColor,e=>{this._passParameters.undergroundColor=e?.toUnitRGBA()??p,this.requestRender(1)},a),s(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),i)])}destroy(){this._vao=r(this._vao)}render(e){const r=e.find(({name:e})=>e===d.OPAQUE_ENVIRONMENT);if(!this.bindParameters.mainDepth)return r;const s=this.renderingContext;this._vao??=_(s,1);const i=r.getAttachment(j);this._update();const a=this.techniques.getCompiled(g),o=this.techniques.getCompiled(v);if(!a||!o)return this.requestRender(1),r;if(!this._passParameters.reduced)return r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(a,this.bindParameters,this._passParameters),s.setDrawBuffers([A]),s.bindVAO(this._vao),s.drawArrays(x.TRIANGLE_STRIP,0,4),r.attachDepth(i),r;const n=s.getViewport(),m=this.bindParameters.camera,p=h(m.eye)-c.radius;let u;const l=c.atmosphereHeight;if(p<l){const e=Math.min(1,Math.max(0,p/l));u=t(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(p-l)/(15*l)));u=t(.3,.6,e)}const f=this.renderingContext.parameters.maxTextureSize,b=P(Math.round(u*m.fullViewport[2]),f),w=P(Math.round(u*m.fullViewport[3]),f);s.setViewport(0,0,b,w);const C=this.fboCache.acquire(b,w,"chapman",5);return s.bindFramebuffer(C.fbo),s.clearFramebuffer([0,0,0,1],!0,!0),s.bindTechnique(a,this.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(x.TRIANGLE_STRIP,0,4),s.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=C.getTexture(),r.detachDepth(),s.bindFramebuffer(r.fbo),s.bindTechnique(o,this.bindParameters,this._compositingPassParameters),s.setDrawBuffers([A]),s.screen.draw(),r.attachDepth(i),C.release(),r}_update(){const e=this.view.basemapTerrain?.getLowerBoundRadius()??0;n(this._passParameters.radii,e,e+c.atmosphereHeight);const t=h(this.bindParameters.camera.eye);this._passParameters.altitudeFade=l(t-e),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-f)*f)}};T=e([o("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphere")],T);export{T as ChapmanAtmosphere};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ReloadableShader as t}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{ChapmanApproximationPassParameters as a}from"./ChapmanApproximation.glsl.js";import{C as m}from"../../../../../chunks/ChapmanAtmosphere.glsl.js";import{Pos2TexF16 as c}from"../../lib/DefaultVertexBufferLayouts.js";import{makePipelineState as n,defaultColorWrite as p,copySource as l,simpleBlendingParams as h}from"../../../../webgl/renderState.js";class d extends a{constructor(){super(...arguments),this.innerFadeDistance=0,this.altitudeFade=0,this.backgroundColor=o(),this.undergroundColor=s()}}let u=class extends i{constructor(e,r){super(e,r,c),this.shader=new t(m,()=>import("./ChapmanAtmosphere.glsl.js"))}initializePipeline(e){return n({blending:e.reduced?l:h(770,771),depthTest:{func:e.reduced?519:515},colorWrite:p})}};u=e([r("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphereTechnique")],u);export{d as ChapmanAtmospherePassParameters,u as ChapmanAtmosphereTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{ChapmanApproximationPassParameters as n}from"./ChapmanApproximation.glsl.js";import{C as a}from"../../../../../chunks/ChapmanAtmosphere.glsl.js";import{Pos2TexF16 as c}from"../../lib/DefaultVertexBufferLayouts.js";import{makePipelineState as p,defaultColorWrite as l,copySource as m,simpleBlendingParams as d}from"../../../../webgl/renderState.js";class h extends n{constructor(){super(...arguments),this.reduced=!1,this.innerFadeDistance=0,this.altitudeFade=0,this.backgroundColor=t(),this.undergroundColor=i()}}let u=class extends o{constructor(e,r){super(e,r,c),this.shader=new s(a,()=>import("./ChapmanAtmosphere.glsl.js")),this._reducedPipeline=p({blending:m,depthTest:{func:519},colorWrite:l})}initializePipeline(){return p({blending:d(770,771),depthTest:{func:515},colorWrite:l})}getPipeline(e,r){return r.reduced?this._reducedPipeline:super.getPipeline(e,r)}};u=e([r("esri.views.3d.webgl-engine.effects.atmosphere.ChapmanAtmosphereTechnique")],u);export{h as ChapmanAtmospherePassParameters,u as ChapmanAtmosphereTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as t}from"../../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as e}from"../../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as i}from"../../shaders/CompositingTechniqueConfiguration.js";import{ColorAttachment0 as r}from"../../../../webgl/enums.js";class s{constructor(e,r=0){this._techniques=e,this._parameters=new t,this._configuration=new i,this._configuration.blitMode=r}precompile(){this._techniques.precompile(e,this._configuration)}toFramebuffer(t,e){this.blitTexture(t.getTexture(),e)}blitTexture(t,i,r,s,o=0){const n=this._rctx;n.temporaryBindFramebuffer(r,()=>{const r=this._configuration.blitMode;this._configuration.blitMode=s??this._configuration.blitMode,n.setClearColor(0,0,0,1),n.clear(16384),this._parameters.texture=t,this._parameters.mipmapLevel=o;const a=this._techniques.get(e,this._configuration);n.bindTechnique(a,i,this._parameters),n.screen.draw(),this._configuration.blitMode=r})}blend(t,i,s,o=1){const n=this._techniques.getCompiled(e,this._configuration);if(!n)return!1;const a=this._rctx;return a.bindFramebuffer(i.fbo),this._parameters.texture=t.getTexture(),this._parameters.opacity=o,a.bindTechnique(n,s,this._parameters),a.setDrawBuffers([r]),a.screen.draw(),!0}get _rctx(){return this._techniques.context.rctx}}export{s as Blit};
2
+ import{a as t}from"../../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as e}from"../../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as i}from"../../shaders/CompositingTechniqueConfiguration.js";import{ColorAttachment0 as r}from"../../../../webgl/enums.js";class s{constructor(e,r=0){this._techniques=e,this._parameters=new t,this._configuration=new i,this._configuration.mode=r}precompile(){this._techniques.precompile(e,this._configuration)}toFramebuffer(t,e){this.blitTexture(t.getTexture(),e)}blitTexture(t,i,r,s,o=0){const n=this._rctx;n.temporaryBindFramebuffer(r,()=>{const r=this._configuration.mode;this._configuration.mode=s??this._configuration.mode,1!==this._configuration.mode&&2!==this._configuration.mode||(n.setClearColor(0,0,0,1),n.clear(16384)),this._parameters.texture=t,this._parameters.mipmapLevel=o;const a=this._techniques.get(e,this._configuration);n.bindTechnique(a,i,this._parameters),n.screen.draw(),this._configuration.mode=r})}blend(t,i,s,o=1){const n=this._techniques.getCompiled(e,this._configuration);if(!n)return!1;const a=this._rctx;return a.bindFramebuffer(i.fbo),this._parameters.texture=t.getTexture(),this._parameters.opacity=o,a.bindTechnique(n,s,this._parameters),a.setDrawBuffers([r]),a.screen.draw(),!0}get _rctx(){return this._techniques.context.rctx}}export{s as Blit};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{OpaqueEnvironment as o}from"../OpaqueEnvironment.js";import{CloudsCompositionTechnique as n}from"./CloudsCompositionTechnique.js";import{createQuadVAO as a}from"../../lib/glUtil3D.js";import{ColorAttachment0 as m,PrimitiveType as d}from"../../../../webgl/enums.js";let h=class extends o{initialize(){this.addHandles([i(()=>null!=this.view.environment.weather&&this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._vao=t(this._vao)}render(e){const t=e.find(({name:e})=>e===this.produces),i=this.bindParameters.clouds;if(!i.data)return t;const s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.renderingContext;this._vao??=a(r);const o=r.bindTechnique(s,this.bindParameters);return r.setDrawBuffers([m]),r.bindVAO(this._vao),o.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(d.TRIANGLE_STRIP,0,4),i.isFading&&this.requestRender(2),t}};h=e([r("esri.views.3d.webgl-engine.effects.clouds.CloudsComposition")],h);export{h as CloudsComposition};
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{OpaqueEnvironment as o}from"../OpaqueEnvironment.js";import{CloudsCompositionTechnique as n}from"./CloudsCompositionTechnique.js";import{createQuadVAO as a}from"../../lib/glUtil3D.js";import{ColorAttachment0 as m,PrimitiveType as d}from"../../../../webgl/enums.js";import{noParameters as l}from"../../../../webgl/NoParameters.js";let h=class extends o{initialize(){this.addHandles([i(()=>null!=this.view.environment.weather&&this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),s)])}destroy(){this._vao=t(this._vao)}render(e){const t=e.find(({name:e})=>e===this.produces),i=this.bindParameters.clouds;if(!i.data)return t;const s=this.techniques.getCompiled(n);if(!s)return this.requestRender(1),t;const r=this.renderingContext;this._vao??=a(r);const o=r.bindTechnique(s,this.bindParameters,l);return r.setDrawBuffers([m]),r.bindVAO(this._vao),o.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(d.TRIANGLE_STRIP,0,4),i.isFading&&this.requestRender(2),t}};h=e([r("esri.views.3d.webgl-engine.effects.clouds.CloudsComposition")],h);export{h as CloudsComposition};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{RenderNodeOutput as r,InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{a}from"../../../../../chunks/FocusAreaMask.glsl.js";import{FocusAreaMaskTechnique as n}from"./FocusAreaMaskTechnique.js";import{volumeToVao as h}from"./focusAreaMaskUtils.js";import{DepthStencilAttachment as c,PrimitiveType as u}from"../../../../webgl/enums.js";import{noParameters as l}from"../../../../webgl/NoParameters.js";let p=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.TRANSPARENT]},this.produces=i.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new a}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}render(e){const s=this.techniques.getCompiled(n);if(!s||!this._vaos)return void this.requestRender(1);const t=e.find(({name:e})=>e===r.TRANSPARENT),o=this.renderingContext,a=this.bindParameters,h=a.camera,p=h.fullViewport[2],d=h.fullViewport[3],m=this.fboCache.acquire(p,d,i.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(m.acquireDepth(14),o.blitFramebuffer(t.fbo,m.fbo,256)):m.attachDepth(t.getAttachment(c)),o.bindFramebuffer(m.fbo),o.setClearColor(0,0,0,1),o.clear(17408),o.setViewport(0,0,p,d);const f=o.bindTechnique(s,a);o.setFaceCullingEnabled(!1),o.setStencilTestEnabled(!0),o.setStencilOpSeparate(1028,7680,34055,7680),o.setStencilOpSeparate(1029,7680,34056,7680),o.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],f.bindDraw(a,l,this._maskParameters),o.bindVAO(e),o.setDepthTestEnabled(!0),o.setStencilWriteMask(255),o.setStencilFunction(519,0,255),o.setColorMask(!1,!1,!1,!1),o.drawArrays(u.TRIANGLES,0,s),o.setDepthTestEnabled(!1),o.setStencilWriteMask(0),o.setStencilFunction(517,0,255),o.setColorMask(!0,!0,!0,!0),o.drawArrays(u.TRIANGLES,0,s)}return m}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=e.geometryVolume,{vao:t,vertexCount:r}=h(this.renderingContext,s);this._vaos.push(t),this._counts.push(r),this._origins.push(e.origin)}),this.requestRender(1)}};e([s()],p.prototype,"consumes",void 0),e([s()],p.prototype,"produces",void 0),e([s({constructOnly:!0})],p.prototype,"focusAreasView",void 0),p=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],p);export{p as FocusAreaMaskNode};
2
+ import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{RenderNodeOutput as r,InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{a}from"../../../../../chunks/FocusAreaMask.glsl.js";import{FocusAreaMaskTechnique as n}from"./FocusAreaMaskTechnique.js";import{volumeToVao as h}from"./focusAreaMaskUtils.js";import{DepthStencilAttachment as c,PrimitiveType as u}from"../../../../webgl/enums.js";import{noParameters as l}from"../../../../webgl/NoParameters.js";let p=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.TRANSPARENT]},this.produces=i.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new a}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}render(e){const s=this.techniques.getCompiled(n);if(!s||!this._vaos)return void this.requestRender(1);const t=e.find(({name:e})=>e===r.TRANSPARENT),o=this.renderingContext,a=this.bindParameters,h=a.camera,p=h.fullViewport[2],d=h.fullViewport[3],m=this.fboCache.acquire(p,d,i.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(m.acquireDepth(14),o.blitFramebuffer(t.fbo,m.fbo,256)):m.attachDepth(t.getAttachment(c)),o.bindFramebuffer(m.fbo),o.setClearColor(0,0,0,1),o.clear(17408),o.setViewport(0,0,p,d);const f=o.bindTechnique(s,a,l);o.setFaceCullingEnabled(!1),o.setStencilTestEnabled(!0),o.setStencilOpSeparate(1028,7680,34055,7680),o.setStencilOpSeparate(1029,7680,34056,7680),o.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],f.bindDraw(a,l,this._maskParameters),o.bindVAO(e),o.setDepthTestEnabled(!0),o.setStencilWriteMask(255),o.setStencilFunction(519,0,255),o.setColorMask(!1,!1,!1,!1),o.drawArrays(u.TRIANGLES,0,s),o.setDepthTestEnabled(!1),o.setStencilWriteMask(0),o.setStencilFunction(517,0,255),o.setColorMask(!0,!0,!0,!0),o.drawArrays(u.TRIANGLES,0,s)}return m}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=e.geometryVolume,{vao:t,vertexCount:r}=h(this.renderingContext,s);this._vaos.push(t),this._counts.push(r),this._origins.push(e.origin)}),this.requestRender(1)}};e([s()],p.prototype,"consumes",void 0),e([s()],p.prototype,"produces",void 0),e([s({constructOnly:!0})],p.prototype,"focusAreasView",void 0),p=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],p);export{p as FocusAreaMaskNode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{a as GlobalIlluminationPassParameters,b as build,d as defaultRayMarchMaxReach,c as defaultRayMarchMaxReachEmissionWeight,e as defaultRayMarchMaxSteps,f as defaultRayMarchMinReach,g as defaultRayMarchMinReachEmissionWeight,h as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderLibrary/shading/MainLighting.glsl.js";import"../../core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/enums.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{a as GlobalIlluminationPassParameters,b as build,d as defaultColorBleedWeight,c as defaultRayMarchMaxReach,e as defaultRayMarchMaxReachEmissionWeight,f as defaultRayMarchMaxSteps,g as defaultRayMarchMinReach,h as defaultRayMarchMinReachEmissionWeight,i as defaultRayMarchWorldReach}from"../../../../../chunks/GlobalIllumination.glsl.js";