@arcgis/core 4.27.0-next.20230516 → 4.27.0-next.20230518

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 (194) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/03dba2a2bbc363369a0f.js +1 -0
  3. package/assets/esri/core/workers/chunks/12714d64a0154688072e.js +1 -0
  4. package/assets/esri/core/workers/chunks/{a507135977d83aea4421.js → 1827a3da6b5b9272ffe1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/1edc5c06874cb12c5478.js +1 -0
  6. package/assets/esri/core/workers/chunks/{395ef46b635f9e9a5643.js → 20e8e18e4bd2fd5da47c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/23f73f81aea461c0c6e6.js +1 -0
  8. package/assets/esri/core/workers/chunks/{15dda462b979e90b58fe.js → 3cebdd77a8401495097f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/3eb75b6c3c4b3aea2325.js +1 -0
  10. package/assets/esri/core/workers/chunks/48cb634255e39711a720.js +1 -0
  11. package/assets/esri/core/workers/chunks/4d5f71d84c85f45c97ea.js +1 -0
  12. package/assets/esri/core/workers/chunks/55ca6ba8b40921025181.js +2 -0
  13. package/assets/esri/core/workers/chunks/{ef141014ed21a7fd1ff3.js.LICENSE.txt → 55ca6ba8b40921025181.js.LICENSE.txt} +1 -1
  14. package/assets/esri/core/workers/chunks/6312783626bacf52df7a.js +1 -0
  15. package/assets/esri/core/workers/chunks/{a3822a97701890c12d63.js → 6b3b277a21de7c434717.js} +1 -1
  16. package/assets/esri/core/workers/chunks/6d80f81bf6ad97a7e69e.js +1 -0
  17. package/assets/esri/core/workers/chunks/887a630c5c980c5028e1.js +1 -0
  18. package/assets/esri/core/workers/chunks/{522660da4589739a70c3.js → c7fb48ea5d907883bcce.js} +1 -1
  19. package/assets/esri/core/workers/chunks/d0ff968e42116f592065.js +1 -0
  20. package/assets/esri/core/workers/chunks/{fdf64f23529a22c79fbd.js → d52c920acf08c95277c3.js} +19 -19
  21. package/assets/esri/core/workers/chunks/d64c271c173797d98286.js +1 -0
  22. package/assets/esri/core/workers/chunks/e1b2076d0040fcb7d864.js +1 -0
  23. package/assets/esri/core/workers/chunks/e3397036e060dac3b4d5.js +1 -0
  24. package/assets/esri/core/workers/chunks/e6836c84470fb6bd25bf.js +1 -0
  25. package/assets/esri/core/workers/chunks/f3f6035a17f7dcd19675.js +1 -0
  26. package/assets/esri/core/workers/chunks/{bff317b08e91414f6edc.js → f720967ba8c5486a26a2.js} +1 -1
  27. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +20 -11
  28. package/assets/esri/themes/base/widgets/_Editor.scss +0 -9
  29. package/assets/esri/themes/base/widgets/_FeatureForm.scss +4 -2
  30. package/assets/esri/themes/base/widgets/_ItemList.scss +0 -49
  31. package/assets/esri/themes/base/widgets/_ValuePicker.scss +27 -10
  32. package/assets/esri/themes/dark/main.css +1 -1
  33. package/assets/esri/themes/light/main.css +1 -1
  34. package/assets/esri/themes/light/view.css +1 -1
  35. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
  36. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
  37. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
  38. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
  39. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
  40. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
  41. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
  42. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
  43. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
  44. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
  45. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
  46. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
  47. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
  48. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
  49. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
  50. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
  51. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
  52. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
  53. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
  54. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
  55. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
  56. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
  57. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
  58. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
  59. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
  60. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
  61. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
  62. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
  63. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
  64. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
  65. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
  66. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
  67. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
  68. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
  69. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
  70. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
  71. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
  72. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
  73. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
  74. package/chunks/DefaultMaterial.glsl.js +4 -4
  75. package/chunks/HUDMaterial.glsl.js +22 -22
  76. package/chunks/HeatmapDensity.glsl.js +5 -5
  77. package/chunks/LineMarker.glsl.js +35 -35
  78. package/chunks/RibbonLine.glsl.js +47 -47
  79. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  80. package/core/Queue.js +1 -1
  81. package/core/a11yUtils.js +5 -0
  82. package/interfaces.d.ts +769 -25
  83. package/intl/date.js +1 -1
  84. package/layers/ImageryTileLayer.js +1 -1
  85. package/layers/WMSLayer.js +1 -1
  86. package/layers/graphics/data/QueryEngine.js +1 -1
  87. package/layers/graphics/data/attributeSupport.js +1 -1
  88. package/layers/mixins/ArcGISImageService.js +1 -1
  89. package/layers/support/RasterBandInfo.d.ts +4 -0
  90. package/layers/support/RasterSensorInfo.d.ts +4 -0
  91. package/layers/support/infoFor3D.js +1 -1
  92. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  93. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  94. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  95. package/package.json +2 -2
  96. package/popup/FieldInfo.js +1 -1
  97. package/popup/support/FieldInfoFormat.js +1 -1
  98. package/portal/schemas/definitions.js +1 -1
  99. package/rest/support/BaseImageMeasureParameters.d.ts +4 -0
  100. package/rest/support/BaseImageMeasureParameters.js +1 -1
  101. package/rest/support/ImageHistogramParameters.js +1 -1
  102. package/rest/support/ImageIdentifyParameters.js +1 -1
  103. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  104. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  105. package/support/revision.js +1 -1
  106. package/views/2d/engine/vectorTiles/GlyphMosaic.js +1 -1
  107. package/views/2d/engine/vectorTiles/GlyphSource.js +1 -1
  108. package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
  109. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  110. package/views/2d/engine/webgl/GlyphSource.js +1 -1
  111. package/views/2d/layers/MediaLayerView2D.js +1 -1
  112. package/views/2d/layers/TileLayerView2D.js +1 -1
  113. package/views/2d/layers/support/cimSymbolUtils.js +1 -1
  114. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  115. package/views/3d/support/DisplayQualityProfile.js +1 -1
  116. package/views/3d/support/QualitySettings.js +1 -1
  117. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  118. package/views/3d/terrain/Overlay.js +1 -1
  119. package/views/3d/terrain/OverlayManager.js +1 -1
  120. package/views/3d/terrain/OverlayRenderer.js +1 -1
  121. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +13 -13
  122. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +18 -18
  123. package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +8 -8
  124. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  125. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  126. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  127. package/views/3d/webgl-engine/lib/RenderTargetHelper.js +1 -1
  128. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  129. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  130. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  131. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  132. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  133. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  134. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  135. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  136. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  137. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  138. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  139. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  140. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  141. package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
  142. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  143. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  144. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  145. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
  146. package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
  147. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  148. package/views/DOMContainer.js +1 -1
  149. package/views/PopupView.js +1 -1
  150. package/views/draw/DrawOperation.js +1 -1
  151. package/views/webgl/ValidatedTextureDescriptor.js +1 -1
  152. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  153. package/widgets/Editor/CreateWorkflow.js +1 -1
  154. package/widgets/Editor/EditorViewModel.js +1 -1
  155. package/widgets/Editor/UpdateWorkflow.js +1 -1
  156. package/widgets/Editor/Upload.js +1 -1
  157. package/widgets/Editor/Workflow.js +1 -1
  158. package/widgets/Editor/modelUploadUtils.js +1 -1
  159. package/widgets/Editor/workflowUtils.js +1 -1
  160. package/widgets/Editor.js +1 -1
  161. package/widgets/Feature/FeatureMedia.js +1 -1
  162. package/widgets/FeatureForm/InputField.js +5 -0
  163. package/widgets/FeatureForm/InputFieldGroup.js +5 -0
  164. package/widgets/FeatureForm/css.js +1 -1
  165. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  166. package/widgets/FeatureTable.js +1 -1
  167. package/widgets/FeatureTemplates/ItemList.js +1 -1
  168. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  169. package/widgets/Print/PrintViewModel.js +1 -1
  170. package/widgets/Search/SearchViewModel.js +1 -1
  171. package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
  172. package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
  173. package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
  174. package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
  175. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  176. package/widgets/ValuePicker/ValuePickerViewModel.js +1 -1
  177. package/widgets/ValuePicker.js +1 -1
  178. package/assets/esri/core/workers/chunks/009026614cae60e9505c.js +0 -1
  179. package/assets/esri/core/workers/chunks/415c326d268b1a8fd03f.js +0 -1
  180. package/assets/esri/core/workers/chunks/504e929b686570ee858d.js +0 -1
  181. package/assets/esri/core/workers/chunks/5c811527898eb1c04e67.js +0 -1
  182. package/assets/esri/core/workers/chunks/6164a9c654c38f9cb64e.js +0 -1
  183. package/assets/esri/core/workers/chunks/6dd99db0adce09ac9794.js +0 -1
  184. package/assets/esri/core/workers/chunks/7cec069db0598431829e.js +0 -1
  185. package/assets/esri/core/workers/chunks/8bb3b10a777ae19f57f9.js +0 -1
  186. package/assets/esri/core/workers/chunks/91971a76a4ae0474a878.js +0 -1
  187. package/assets/esri/core/workers/chunks/9ed9e2ad50816a4f937a.js +0 -1
  188. package/assets/esri/core/workers/chunks/b3013a5a39d038b2d748.js +0 -1
  189. package/assets/esri/core/workers/chunks/b81bb096ccfcea182cc1.js +0 -1
  190. package/assets/esri/core/workers/chunks/cf3dd5aad1d60ff1b0b6.js +0 -1
  191. package/assets/esri/core/workers/chunks/d05d9ddf244bb3dcbcaa.js +0 -1
  192. package/assets/esri/core/workers/chunks/d3a6504fbaf555707c58.js +0 -1
  193. package/assets/esri/core/workers/chunks/ef141014ed21a7fd1ff3.js +0 -2
  194. package/assets/esri/core/workers/chunks/f4933025edecdc1aae76.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import has from"../../../../core/has.js";import{removeMaybe as i,disposeMaybe as a,destroyMaybe as n,applySome as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{watch as d,syncAndInitial as _,initial as l,sync as p}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{h as u,a as f,m as T}from"../../../../chunks/mat4.js";import{I as g,c as A}from"../../../../chunks/mat4f64.js";import{a as E}from"../../../../chunks/boundedPlane.js";import R from"../../support/debugFlags.js";import{TransparencyMode as S}from"../../terrain/TerrainRenderer.js";import{RenderPassManager as P}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as b}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparencyRenderStyle as y}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AnimationTimeStep as I}from"./AnimationTimeStep.js";import{Decorations as O,RenderRequestType as C,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as w}from"./BoundingInfo.js";import{ZERO as x,union as N}from"./depthRange.js";import{depthRangeFromScene as L}from"./depthRangeUtils.js";import{createEmptyDepthTexture as H}from"./glUtil3D.js";import{Highlight as M}from"./Highlight.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as F}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as j}from"./rendererUtils.js";import{RenderFeature as G,setupFeatureDefaults as q}from"./RenderFeature.js";import{RenderPluginManager as V}from"./RenderPluginManager.js";import{RenderSlot as B}from"./RenderSlot.js";import{ShadowAccumulator as Q}from"./ShadowAccumulator.js";import{ShadowHighlight as k}from"./ShadowHighlight.js";import{ShadowMap as W,SnapshotSlot as Y}from"./ShadowMap.js";import X from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as J}from"./SSAOHelper.js";import{TransparencyPassType as K}from"./TransparencyPassType.js";import{EdgeView as Z}from"./edgeRendering/EdgeView.js";import{Transparency as $}from"./edgeRendering/interfaces.js";import{MergedRenderer as ee}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as re}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as te,PerformanceCategory as se}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ie}from"../../../support/RenderState.js";import{ClearBufferBit as ae,PixelFormat as ne,PixelType as he}from"../../../webgl/enums.js";let oe=class extends r{get _bindParameters(){return this._renderContext.bindParameters}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _antialiasing(){return this._antialiasingEnabled||this.isFeatureEnabled(G.Antialiasing)}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(G.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(G.WaterReflection))}get hasWater(){return this._hasWater||this._hasOverlayWater}constructor(e,r,t,i,a,n,h,p){super({}),this._stage=e,this._materialRepository=r,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=p,this._materialRenderers=new o,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._renderOverlay=e=>{},this._isRendering=!1,this._fallbackDepthStencilTexture=null,this._sliceHelper=new X,this._state=ie.IDLE,this._renderStateFeatures=q(),this._antialiasingEnabled=!0,this._highQualityTransparencyEnabled=!0,this._terrainRenderingEnabled=!0,this._terrainTransparency=S.Opaque,this._ssrEnabled=!1,this._ssaoEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new I,this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,i),p(),this._offscreen=new U(this._rctx,this._compositingHelper),this.performanceInfo=new te(this._rctx),this._shadowMap=new W(this._rctx,e.viewingMode),this._ssaoHelper=new J(e.view,i,this._rctx,p),this._highlight=new M(i,this._rctx),this._shadowHighlight=new k(this._rctx,e.viewingMode),this._shadowAccumulator=new Q(this._rctx,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t,!0),this._renderShadowCascades(b.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),p),this._renderContext=new F(this._rctx,this._offscreen,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new V({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:this._materialRepository,requestRender:p,controller:e}),this.renderPassManager=new P(this._rctx,this._techniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([d((()=>this._stage.view.state.camera),(()=>p()),_),d((()=>R.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges($.TRANSPARENT):()=>{},p()}),l),d((()=>this._ssaoEnabled||this.isFeatureEnabled(G.SSAO)),(e=>this._ssaoHelper.enabled=e),_)])}normalizeCtorArgs(){return{}}destroy(){this._handles.destroy(),this._smaaPass.dispose(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreen.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.dispose(),this._ssaoHelper.destroy(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),this._edgeView=n(this._edgeView),this.renderPassManager.destroy(),w.prune()}disposeOffscreenBuffers(){this._offscreen.dispose(),this._shadowMap.disposeOffscreenBuffers(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new Z({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:ue(e)}),this._handles.add(d((()=>h(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),p)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return u(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.qualitySettings?.ambientOcclusion&&this._ssaoEnabled!==e.qualitySettings.ambientOcclusion&&(this._ssaoEnabled=e.qualitySettings.ambientOcclusion,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}e.background&&this._offscreen.background!==e.background&&(this._offscreen.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasingEnabled!==e.antialiasingEnabled&&(this._antialiasingEnabled=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.renderOverlay&&this._renderOverlay!==e.renderOverlay&&(this._renderOverlay=e.renderOverlay,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainRenderingEnabled&&this._terrainRenderingEnabled!==e.terrainRenderingEnabled&&(this._terrainRenderingEnabled=e.terrainRenderingEnabled,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=j(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._materialRenderers.find((e=>e.material===s));null==i&&t.adds.length>0&&(i=new ee(this._rctx,this._materialRepository,s),this._materialRenderers.push(i)),i&&(i.modify(t),i.isEmpty&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._hasHighlights=this._materialRenderers.some((e=>e.hasHighlights)),this._bindParameters.hasOccludees=this._materialRenderers.some((e=>e.hasOccludees)),this._hasWater=this._materialRenderers.some((e=>e.hasWater)),this._hasHUDElements=this._materialRenderers.some((e=>e.requiresSlot(B.LINE_CALLOUTS_HUD_DEPTH,b.Color)||e.requiresSlot(B.HUD_MATERIAL,b.Color)||e.requiresSlot(B.LABEL_MATERIAL,b.Color))),this._requestRender()}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}render(e,r,t,s,i){this._isRendering=!0,this._oitUsed=!1,this.performanceInfo.startFrame();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=t;this._state=h,this._renderOverlay(i),this.performanceInfo.advance(se.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=K.NONE,this._bindParameters.alignPixelEnabled=o;const d=this._offscreen;d.setupRenderTarget(this.hasReflections);const _=E(this._sliceHelper.plane);s===O.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),a.setGLViewport(this._rctx),this._prepare(a,n),this._renderPlugins.prepareRender(),this.performanceInfo.advance(se.PREPARE);const l=this._computeDepthRange(a);this._renderShadowMap(e,a,this._bindParameters.lighting.mainLight.direction,l),this.performanceInfo.advance(se.SHADOW_MAP),d.initializeFrame(a),this._ensureBindParameters(a,n);const p=this._terrainRenderingEnabled&&(this._terrainTransparency===S.Semitransparent||this._terrainTransparency===S.TransparentWithDraped),c=this._highQualityTransparency&&p,m=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;this._prepareShaders(c,m),this._renderLinearDepth(),this.performanceInfo.advance(se.LINEAR_DEPTH),this._accumulateShadows(l,a,n),this.performanceInfo.advance(se.ACCUMULATED_SHADOWS),this._renderNormal(),this.performanceInfo.advance(se.NORMALS),this._ensureBindParametersSSR(i),this._renderSSAO(i),this.performanceInfo.advance(se.SSAO),this._renderContext.output=b.Color,d.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.OPAQUE),this._renderTerrainLinearDepth(c),this._setMultipassTerrain(c),this._renderEdges($.OPAQUE),this.performanceInfo.advance(se.OPAQUE_EDGES),this._offscreen.bindTarget(this._offscreen.currentColorTarget,this._offscreen.mainDepth),this._renderSlot(B.VOXEL),this.performanceInfo.advance(se.VOXEL),this._renderHiddenTransparentEdges(),m&&(this._oitEnabled?this._renderOITPass(de.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(se.TRANSPARENT),this._renderGeometryLinearDepth(c);const u=this._renderHUDVisibility(c);c||this._renderInternalSlot(B.LINE_CALLOUTS),this.performanceInfo.advance(se.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(se.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges($.TRANSPARENT,c),this.performanceInfo.advance(se.TRANSPARENT_EDGES),this._renderTransparentTerrain(),p&&u&&(c?this._renderLineCallouts(y.Occluded):d.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(y.Occluded,d.framebuffer),this.performanceInfo.advance(se.HUD_OCCLUDED)),this.performanceInfo.advance(se.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),p&&(d.compositeTransparentTerrainOntoMain(this._bindParameters),c&&(this._renderEdges($.OPAQUE),this.performanceInfo.advance(se.OPAQUE_EDGES),m&&(this._oitEnabled?this._renderOITPass(de.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(se.TRANSPARENT),this._renderEdges($.TRANSPARENT),this.performanceInfo.advance(se.TRANSPARENT_EDGES))),c&&this._renderLineCallouts(y.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),d.renderToTargets((()=>{this._renderInternalSlot(B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(B.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(B.LASERLINES)}),d.currentColorTarget,d.mainDepth),this.performanceInfo.advance(se.ENVIRONMENT),this._renderPlugins.needsLaserlineWithContrastControl&&d.renderTmpAndCompositeToMain((()=>this._renderSlot(B.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,re.PremultipliedAlpha),this.performanceInfo.advance(se.LASER_LINE),this._renderOccluded(),this.performanceInfo.advance(se.OCCLUDED);const f=s===O.ON&&this._magnifierHelper.enabled,T=f&&null==e?this._offscreen.getFramebuffer(this._offscreen.tmpColor,this._offscreen.tmpDepth):e;this._rctx.bindFramebuffer(T);const g=this._offscreen.colorTexture;this._renderAntiAliasing(g)||null==g||this._compositingHelper.composite(this._bindParameters,g,re.None),this.performanceInfo.advance(se.ANTIALIASING),this._renderHUD(y.NotOccluded,T),this.performanceInfo.advance(se.HUD),this._renderHighlights(T,this._bindParameters),this.performanceInfo.advance(se.HIGHLIGHTS),f&&this._magnifierHelper.render(this._rctx,this._bindParameters),T!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreen.tmpColorTexture,re.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=_,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.finishFrame()}_prepareShaders(e,r){this._renderContext.output=b.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._prepareSlots(B.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,B.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._prepareSlots(B.POSTPROCESSING_ENVIRONMENT_TRANSPARENT,B.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null!=e&&has("enable-feature:objectAndLayerId-rendering")){const r=this._renderContext.output;this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>this._renderGeometryAndTransparentTerrainPass(b.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>{this._bindParameters.renderTransparentlyOccludedHUD=y.NotOccluded,this._renderInternalSlot(B.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===C.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._offscreen.bindTarget(this._offscreen.linearDepth,this._offscreen.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ae.COLOR_BUFFER_BIT|ae.DEPTH_BUFFER_BIT|ae.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(b.Depth)}s.readPixels(r[0],r[1],r[2],r[3],ne.RGBA,he.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,i){this._offscreen.bindTarget(this._offscreen.hudVisibility).readPixels(e,r,t,s,ne.RGBA,he.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_prepareSlots(...e){this._renderPlugins.prepareSlots(e)}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;null!=t&&t.shouldRender()&&this._offscreen.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,re.Alpha,r)}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s,this._stage.view.qualitySettings.highQualityShadows||this.isFeatureEnabled(G.HighQualityShadows)),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(b.ShadowHighlight,this._shadowMap,(e=>i.takeCascadeSnapshotTo(e,Y.Highlight))),i.clear(),this._renderShadowCascades(b.ShadowExcludeHighlight,this._shadowMap,(e=>{i.takeCascadeSnapshotTo(e,Y.Default),this._renderGeometryAndTransparentTerrainPass(b.ShadowHighlight)}))):this._renderShadowCascades(b.Shadow),i.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.cascades)s.camera.setGLViewport(this._rctx),this._prepare(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.active||this._renderPlugins.needsLinearDepth||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreen.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(b.Depth)),this._offscreen.linearDepth,this._offscreen.tmpDepth,[0,0,0,0],!0,!0):this._offscreen.disposeTarget(this._offscreen.linearDepth),this._bindParameters.linearDepthTexture=this._offscreen.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=b.Depth,this._offscreen.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreen.terrainLinearDepth,this._offscreen.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreen.disposeTarget(this._offscreen.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreen.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreen.renderToTargets((()=>this._renderGeometryPass(b.Depth)),this._offscreen.geometryLinearDepth,this._offscreen.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreen.disposeTarget(this._offscreen.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreen.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.active}_renderNormal(){this._needsNormal?this._offscreen.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(b.Normal)}),this._offscreen.normal,this._offscreen.tmpDepth,[0,0,0,0],!0,!0):this._offscreen.disposeTarget(this._offscreen.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return x;const r=L(e,this._materialRenderers,this._stage.layers);return N(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._prepareSlots(B.TRANSPARENT_TERRAIN),this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._prepareSlots(B.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderSSAO(e){this._ssaoHelper.render(this._bindParameters,e,this._offscreen.linearDepthTexture,this._offscreen.normalTexture)}_prepareOpaqueGeometrySlots(){this._prepareSlots(B.INTEGRATED_MESH,B.OPAQUE_TERRAIN,B.OPAQUE_MATERIAL,B.POSTPROCESSING_ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,B.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderSlot(B.INTEGRATED_MESH),this._renderSlot(B.OPAQUE_TERRAIN),this._renderInternalSlot(B.OPAQUE_MATERIAL),this._renderSlot(B.OPAQUE_MATERIAL),this._renderSlot(B.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(B.TRANSPARENT_MATERIAL),this._renderSlot(B.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(B.TRANSPARENT_TERRAIN)}_renderHUDVisibility(e){let r=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,r=this._renderInternalSlot(B.OCCLUSION_PIXELS)}),e),r}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===y.Occluded?this._offscreen.renderToTargets((()=>this._renderInternalSlot(B.LINE_CALLOUTS)),this._offscreen.currentColorTarget,this._offscreen.tmpDepth,void 0,!0,!0):this._renderInternalSlot(B.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOITPass(de.HUD,e),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreen.hudColorTexture,re.PremultipliedAlpha)):e===y.Occluded?this._offscreen.renderToTargets((()=>this._renderHUDElements(y.Occluded)),this._offscreen.currentColorTarget,this._offscreen.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._prepareInternalSlots(this._materialRenderers,B.LINE_CALLOUTS_HUD_DEPTH,B.HUD_MATERIAL,B.LABEL_MATERIAL),this._renderInternalSlot(B.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(B.HUD_MATERIAL),this._renderInternalSlot(B.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreen.disposeTarget(this._offscreen.highlight);const t=this._highlight,s=this._offscreen.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(b.Highlight),this._rctx.clearSafe(ae.DEPTH_BUFFER_BIT),this._renderHUDElements(y.Both)}),this._offscreen.highlight,this._offscreen.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&null!=this._offscreen.linearDepthTexture&&this._shadowAccumulator.renderAccumulation(this._offscreen.linearDepthTexture,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=b.Alpha,this._bindParameters.transparencyPassType=K.Alpha,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._renderContext.output=b.Color,this._bindParameters.transparencyPassType=K.Color,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=K.FrontFace,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=K.NONE}_renderOITPass(e,r=y.Both){const t=e===de.HUD,s=t?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),i=e=>{this._bindParameters.transparencyPassType=e,this._offscreen.renderOITPass(s,e,t)},a=this._renderContext.output;this._renderContext.output=b.Alpha,i(K.Alpha),this._renderContext.output=b.Color,i(K.Color),i(K.FrontFace),this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,t),this._bindParameters.transparencyPassType=K.NONE,this._renderContext.output=a,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreen.disposeTarget(this._offscreen.alphaFloatTarget),this._offscreen.disposeTarget(this._offscreen.colorFloatTarget),this._offscreen.disposeTarget(this._offscreen.frontFaceTarget))}_renderOccluded(){let e=0;le.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&r.material.renderOccluded===v.OccludeAndTransparentStencil&&(e|=r.material.renderOccluded,le.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{0!=(e&s)&&(r.renderToTargets(i,r.tmpColor,r.mainDepth,[0,0,0,0],a,n),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==le.length&&(this._prepareInternalSlots(le,B.OCCLUDER_MATERIAL,B.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(B.OCCLUDER_MATERIAL,le),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(B.TRANSPARENT_OCCLUDER_MATERIAL,le)),!1,!1)),le.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&(r.material.renderOccluded===v.OccludeAndTransparent||r.material.renderOccluded===v.Transparent||r.material.renderOccluded===v.Opaque)&&(e|=r.material.renderOccluded,le.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,this._prepareInternalSlots(le,B.OPAQUE_MATERIAL,B.TRANSPARENT_MATERIAL,B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),s>v.Occlude&&this._renderSlot(B.OCCLUDED_TERRAIN),this._renderInternalSlot(B.OPAQUE_MATERIAL,le),this._renderInternalSlot(B.TRANSPARENT_MATERIAL,le),this._renderInternalSlot(B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,le),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=b.Color,t(.5,v.OccludeAndTransparent,(()=>i(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>i(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>i(v.Opaque)),!0,D.OutlineVisualElementMask),le.clear()}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&null!=e)return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.requiresSlot(B.TRANSPARENT_MATERIAL,b.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.enabled=this.hasReflections,this._bindParameters.ssr.enabled){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(f(ce,this._bindParameters.camera.viewMatrix),f(pe,this._bindParameters.camera.projectionMatrix),T(me,ce,pe),T(me,this._renderContext.lastFrameCamera.viewMatrix,me),T(me,this._renderContext.lastFrameCamera.projectionMatrix,me),this._reprojectionMatrix=me),this._bindParameters.ssr.lastFrameColorTexture=this._offscreen.lastFrameColorTexture;const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._bindParameters.ssr.lastFrameColorTexture=null,this._ssrEnableTime=null}_prepareInternalSlots(e,...r){for(const t of r)this._bindParameters.slot=t,e.forAll((e=>{e.material.shouldRender(this._renderContext)&&e.prepareTechnique(this._renderContext)}))}_renderInternalSlot(e,r=this._materialRenderers){let t=!1;return this._bindParameters.slot=e,r.forAll((e=>{if(e.material.shouldRender(this._renderContext)){const r=e.prepareTechnique(this._renderContext);null!=r&&(e.render(this._renderContext,r),t=!0)}})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=H(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreen?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=q()},getFramebufferTexture:r=>{switch(r){case _e.Color:return e._offscreen.colorTexture;case _e.LinearDepth:return e._offscreen.linearDepthTexture;case _e.Normals:return e._offscreen.normalTexture;case _e.ShadowMap:return e._shadowMap.depthTexture;case _e.HudVisibility:return e._offscreen.hudVisibilityTexture;case _e.Highlight:return e._offscreen.highlightTexture}}}}};var de,_e;e([c()],oe.prototype,"_renderPlugins",void 0),e([c()],oe.prototype,"_shadowAccumulator",void 0),e([c()],oe.prototype,"_state",void 0),e([c()],oe.prototype,"_renderStateFeatures",void 0),e([c()],oe.prototype,"_antialiasingEnabled",void 0),e([c({readOnly:!0})],oe.prototype,"_antialiasing",null),e([c()],oe.prototype,"_ssaoEnabled",void 0),e([c()],oe.prototype,"_smaaPass",void 0),e([c({autoDestroy:!0})],oe.prototype,"_edgeView",void 0),e([c()],oe.prototype,"updating",null),e([c()],oe.prototype,"isCameraFinal",null),oe=e([m("esri.views.3d.webgl-engine.lib.Renderer")],oe),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(de||(de={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(_e||(_e={}));const le=new o,pe=A(),ce=A(),me=A();function ue(e){return r=>e.immediate.schedule(r)}export{_e as FramebufferId,oe as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import has from"../../../../core/has.js";import{removeMaybe as i,disposeMaybe as a,destroyMaybe as n,applySome as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{watch as d,syncAndInitial as l,initial as _,sync as p}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{h as u,a as f,m as T}from"../../../../chunks/mat4.js";import{I as g,c as R}from"../../../../chunks/mat4f64.js";import{a as A}from"../../../../chunks/boundedPlane.js";import E from"../../support/debugFlags.js";import{TransparencyMode as S}from"../../terrain/TerrainRenderer.js";import{RenderPassManager as P}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as b}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparencyRenderStyle as y}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AnimationTimeStep as I}from"./AnimationTimeStep.js";import{Decorations as O,RenderRequestType as C,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as w}from"./BoundingInfo.js";import{ZERO as x,union as N}from"./depthRange.js";import{depthRangeFromScene as L}from"./depthRangeUtils.js";import{createEmptyDepthTexture as H}from"./glUtil3D.js";import{Highlight as M}from"./Highlight.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as F}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as j}from"./rendererUtils.js";import{RenderFeature as q,setupFeatureDefaults as G}from"./RenderFeature.js";import{RenderPluginManager as V}from"./RenderPluginManager.js";import{RenderSlot as B}from"./RenderSlot.js";import{ShadowAccumulator as Q}from"./ShadowAccumulator.js";import{ShadowHighlight as k}from"./ShadowHighlight.js";import{ShadowMap as W,SnapshotSlot as Y}from"./ShadowMap.js";import X from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as J}from"./SSAOHelper.js";import{TransparencyPassType as K}from"./TransparencyPassType.js";import{EdgeView as Z}from"./edgeRendering/EdgeView.js";import{Transparency as $}from"./edgeRendering/interfaces.js";import{MergedRenderer as ee}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as re}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as te,PerformanceCategory as se}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ie}from"../../../support/RenderState.js";import{ClearBufferBit as ae,PixelFormat as ne,PixelType as he}from"../../../webgl/enums.js";let oe=class extends r{get _bindParameters(){return this._renderContext.bindParameters}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _antialiasing(){return this._antialiasingEnabled||this.isFeatureEnabled(q.Antialiasing)}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(q.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(q.WaterReflection))}get hasWater(){return this._hasWater||this._hasOverlayWater}constructor(e,r,t,i,a,n,h,p){super({}),this._stage=e,this._materialRepository=r,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=p,this._materialRenderers=new o,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._renderOverlay=e=>{},this._isRendering=!1,this._fallbackDepthStencilTexture=null,this._sliceHelper=new X,this._state=ie.IDLE,this._renderStateFeatures=G(),this._antialiasingEnabled=!0,this._highQualityTransparencyEnabled=!0,this._terrainRenderingEnabled=!0,this._terrainTransparency=S.Opaque,this._ssrEnabled=!1,this._ssaoEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new I,this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,i),p(),this._offscreen=new U(this._rctx,this._compositingHelper),this.performanceInfo=new te(this._rctx),this._shadowMap=new W(this._rctx,e.viewingMode),this._ssaoHelper=new J(e.view,i,this._rctx,p),this._highlight=new M(i,this._rctx),this._shadowHighlight=new k(this._rctx,e.viewingMode),this._shadowAccumulator=new Q(this._rctx,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t,!0,this._stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(b.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),p),this._renderContext=new F(this._rctx,this._offscreen,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new V({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:this._materialRepository,requestRender:p,controller:e}),this.renderPassManager=new P(this._rctx,this._techniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([d((()=>this._stage.view.state.camera),(()=>p()),l),d((()=>E.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges($.TRANSPARENT):()=>{},p()}),_),d((()=>this._ssaoEnabled||this.isFeatureEnabled(q.SSAO)),(e=>this._ssaoHelper.enabled=e),l)])}normalizeCtorArgs(){return{}}destroy(){this._handles.destroy(),this._smaaPass.dispose(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreen.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.dispose(),this._ssaoHelper.destroy(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),this._edgeView=n(this._edgeView),this.renderPassManager.destroy(),w.prune()}disposeOffscreenBuffers(){this._offscreen.dispose(),this._shadowMap.disposeOffscreenBuffers(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new Z({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:ue(e)}),this._handles.add(d((()=>h(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),p)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return u(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.qualitySettings?.ambientOcclusion&&this._ssaoEnabled!==e.qualitySettings.ambientOcclusion&&(this._ssaoEnabled=e.qualitySettings.ambientOcclusion,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}e.background&&this._offscreen.background!==e.background&&(this._offscreen.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasingEnabled!==e.antialiasingEnabled&&(this._antialiasingEnabled=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.renderOverlay&&this._renderOverlay!==e.renderOverlay&&(this._renderOverlay=e.renderOverlay,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainRenderingEnabled&&this._terrainRenderingEnabled!==e.terrainRenderingEnabled&&(this._terrainRenderingEnabled=e.terrainRenderingEnabled,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=j(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._materialRenderers.find((e=>e.material===s));null==i&&t.adds.length>0&&(i=new ee(this._rctx,this._materialRepository,s),this._materialRenderers.push(i)),i&&(i.modify(t),i.isEmpty&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._hasHighlights=this._materialRenderers.some((e=>e.hasHighlights)),this._bindParameters.hasOccludees=this._materialRenderers.some((e=>e.hasOccludees)),this._hasWater=this._materialRenderers.some((e=>e.hasWater)),this._hasHUDElements=this._materialRenderers.some((e=>e.requiresSlot(B.LINE_CALLOUTS_HUD_DEPTH,b.Color)||e.requiresSlot(B.HUD_MATERIAL,b.Color)||e.requiresSlot(B.LABEL_MATERIAL,b.Color))),this._requestRender()}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}render(e,r,t,s,i){this._isRendering=!0,this._oitUsed=!1,this.performanceInfo.startFrame();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=t;this._state=h,this._renderOverlay(i),this.performanceInfo.advance(se.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=K.NONE,this._bindParameters.alignPixelEnabled=o;const d=this._offscreen;d.setupRenderTarget(this.hasReflections);const l=A(this._sliceHelper.plane);s===O.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),a.setGLViewport(this._rctx),this._prepare(a,n),this._renderPlugins.prepareRender(),this.performanceInfo.advance(se.PREPARE);const _=this._computeDepthRange(a);this._renderShadowMap(e,a,this._bindParameters.lighting.mainLight.direction,_),this.performanceInfo.advance(se.SHADOW_MAP),d.initializeFrame(a),this._ensureBindParameters(a,n);const p=this._terrainRenderingEnabled&&(this._terrainTransparency===S.Semitransparent||this._terrainTransparency===S.TransparentWithDraped),c=this._highQualityTransparency&&p,m=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;this._prepareShaders(c,m),this._renderLinearDepth(),this.performanceInfo.advance(se.LINEAR_DEPTH),this._accumulateShadows(_,a,n),this.performanceInfo.advance(se.ACCUMULATED_SHADOWS),this._renderNormal(),this.performanceInfo.advance(se.NORMALS),this._ensureBindParametersSSR(i),this._renderSSAO(i),this.performanceInfo.advance(se.SSAO),this._renderContext.output=b.Color,d.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.OPAQUE),this._renderTerrainLinearDepth(c),this._setMultipassTerrain(c),this._renderEdges($.OPAQUE),this.performanceInfo.advance(se.OPAQUE_EDGES),this._offscreen.bindTarget(this._offscreen.currentColorTarget,this._offscreen.mainDepth),this._renderSlot(B.VOXEL),this.performanceInfo.advance(se.VOXEL),this._renderHiddenTransparentEdges(),m&&(this._oitEnabled?this._renderOITPass(de.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(se.TRANSPARENT),this._renderGeometryLinearDepth(c);const u=this._renderHUDVisibility(c);c||this._renderInternalSlot(B.LINE_CALLOUTS),this.performanceInfo.advance(se.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(se.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges($.TRANSPARENT,c),this.performanceInfo.advance(se.TRANSPARENT_EDGES),this._renderTransparentTerrain(),p&&u&&(c?this._renderLineCallouts(y.Occluded):d.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(y.Occluded,d.framebuffer),this.performanceInfo.advance(se.HUD_OCCLUDED)),this.performanceInfo.advance(se.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),p&&(d.compositeTransparentTerrainOntoMain(this._bindParameters),c&&(this._renderEdges($.OPAQUE),this.performanceInfo.advance(se.OPAQUE_EDGES),m&&(this._oitEnabled?this._renderOITPass(de.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(se.TRANSPARENT),this._renderEdges($.TRANSPARENT),this.performanceInfo.advance(se.TRANSPARENT_EDGES))),c&&this._renderLineCallouts(y.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),d.renderToTargets((()=>{this._renderInternalSlot(B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(B.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(B.LASERLINES)}),d.currentColorTarget,d.mainDepth),this.performanceInfo.advance(se.ENVIRONMENT),this._renderPlugins.needsLaserlineWithContrastControl&&d.renderTmpAndCompositeToMain((()=>this._renderSlot(B.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,re.PremultipliedAlpha),this.performanceInfo.advance(se.LASER_LINE),this._renderOccluded(),this.performanceInfo.advance(se.OCCLUDED);const f=s===O.ON&&this._magnifierHelper.enabled,T=f&&null==e?this._offscreen.getFramebuffer(this._offscreen.tmpColor,this._offscreen.tmpDepth):e;this._rctx.bindFramebuffer(T);const g=this._offscreen.colorTexture;this._renderAntiAliasing(g)||null==g||this._compositingHelper.composite(this._bindParameters,g,re.None),this.performanceInfo.advance(se.ANTIALIASING),this._renderHUD(y.NotOccluded,T),this.performanceInfo.advance(se.HUD),this._renderHighlights(T,this._bindParameters),this.performanceInfo.advance(se.HIGHLIGHTS),f&&this._magnifierHelper.render(this._rctx,this._bindParameters),T!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreen.tmpColorTexture,re.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=l,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.finishFrame()}_prepareShaders(e,r){this._renderContext.output=b.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._prepareSlots(B.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,B.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._prepareSlots(B.POSTPROCESSING_ENVIRONMENT_TRANSPARENT,B.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null!=e&&has("enable-feature:objectAndLayerId-rendering")){const r=this._renderContext.output;this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>this._renderGeometryAndTransparentTerrainPass(b.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>{this._bindParameters.renderTransparentlyOccludedHUD=y.NotOccluded,this._renderInternalSlot(B.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===C.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._offscreen.bindTarget(this._offscreen.linearDepth,this._offscreen.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ae.COLOR_BUFFER_BIT|ae.DEPTH_BUFFER_BIT|ae.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(b.Depth)}s.readPixels(r[0],r[1],r[2],r[3],ne.RGBA,he.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,i){this._offscreen.bindTarget(this._offscreen.hudVisibility).readPixels(e,r,t,s,ne.RGBA,he.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_prepareSlots(...e){this._renderPlugins.prepareSlots(e)}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;null!=t&&t.shouldRender()&&this._offscreen.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,re.Alpha,r)}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s,this.isFeatureEnabled(q.HighQualityShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(b.ShadowHighlight,this._shadowMap,(e=>i.takeCascadeSnapshotTo(e,Y.Highlight))),i.clear(),this._renderShadowCascades(b.ShadowExcludeHighlight,this._shadowMap,(e=>{i.takeCascadeSnapshotTo(e,Y.Default),this._renderGeometryAndTransparentTerrainPass(b.ShadowHighlight)}))):this._renderShadowCascades(b.Shadow),i.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.cascades)s.camera.setGLViewport(this._rctx),this._prepare(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.active||this._renderPlugins.needsLinearDepth||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreen.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(b.Depth)),this._offscreen.linearDepth,this._offscreen.tmpDepth,[0,0,0,0],!0,!0):this._offscreen.disposeTarget(this._offscreen.linearDepth),this._bindParameters.linearDepthTexture=this._offscreen.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=b.Depth,this._offscreen.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreen.terrainLinearDepth,this._offscreen.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreen.disposeTarget(this._offscreen.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreen.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreen.renderToTargets((()=>this._renderGeometryPass(b.Depth)),this._offscreen.geometryLinearDepth,this._offscreen.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreen.disposeTarget(this._offscreen.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreen.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.active}_renderNormal(){this._needsNormal?this._offscreen.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(b.Normal)}),this._offscreen.normal,this._offscreen.tmpDepth,[0,0,0,0],!0,!0):this._offscreen.disposeTarget(this._offscreen.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return x;const r=L(e,this._materialRenderers,this._stage.layers);return N(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._prepareSlots(B.TRANSPARENT_TERRAIN),this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._prepareSlots(B.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderSSAO(e){this._ssaoHelper.render(this._bindParameters,e,this._offscreen.linearDepthTexture,this._offscreen.normalTexture)}_prepareOpaqueGeometrySlots(){this._prepareSlots(B.INTEGRATED_MESH,B.OPAQUE_TERRAIN,B.OPAQUE_MATERIAL,B.POSTPROCESSING_ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,B.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderSlot(B.INTEGRATED_MESH),this._renderSlot(B.OPAQUE_TERRAIN),this._renderInternalSlot(B.OPAQUE_MATERIAL),this._renderSlot(B.OPAQUE_MATERIAL),this._renderSlot(B.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(B.TRANSPARENT_MATERIAL),this._renderSlot(B.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(B.TRANSPARENT_TERRAIN)}_renderHUDVisibility(e){let r=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,r=this._renderInternalSlot(B.OCCLUSION_PIXELS)}),e),r}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===y.Occluded?this._offscreen.renderToTargets((()=>this._renderInternalSlot(B.LINE_CALLOUTS)),this._offscreen.currentColorTarget,this._offscreen.tmpDepth,void 0,!0,!0):this._renderInternalSlot(B.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOITPass(de.HUD,e),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreen.hudColorTexture,re.PremultipliedAlpha)):e===y.Occluded?this._offscreen.renderToTargets((()=>this._renderHUDElements(y.Occluded)),this._offscreen.currentColorTarget,this._offscreen.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._prepareInternalSlots(this._materialRenderers,B.LINE_CALLOUTS_HUD_DEPTH,B.HUD_MATERIAL,B.LABEL_MATERIAL),this._renderInternalSlot(B.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(B.HUD_MATERIAL),this._renderInternalSlot(B.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreen.disposeTarget(this._offscreen.highlight);const t=this._highlight,s=this._offscreen.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(b.Highlight),this._rctx.clearSafe(ae.DEPTH_BUFFER_BIT),this._renderHUDElements(y.Both)}),this._offscreen.highlight,this._offscreen.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&null!=this._offscreen.linearDepthTexture&&this._shadowAccumulator.renderAccumulation(this._offscreen.linearDepthTexture,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=b.Alpha,this._bindParameters.transparencyPassType=K.Alpha,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._renderContext.output=b.Color,this._bindParameters.transparencyPassType=K.Color,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=K.FrontFace,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=K.NONE}_renderOITPass(e,r=y.Both){const t=e===de.HUD,s=t?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),i=e=>{this._bindParameters.transparencyPassType=e,this._offscreen.renderOITPass(s,e,t)},a=this._renderContext.output;this._renderContext.output=b.Alpha,i(K.Alpha),this._renderContext.output=b.Color,i(K.Color),i(K.FrontFace),this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,t),this._bindParameters.transparencyPassType=K.NONE,this._renderContext.output=a,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreen.disposeTarget(this._offscreen.alphaFloatTarget),this._offscreen.disposeTarget(this._offscreen.colorFloatTarget),this._offscreen.disposeTarget(this._offscreen.frontFaceTarget))}_renderOccluded(){let e=0;_e.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&r.material.renderOccluded===v.OccludeAndTransparentStencil&&(e|=r.material.renderOccluded,_e.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{0!=(e&s)&&(r.renderToTargets(i,r.tmpColor,r.mainDepth,[0,0,0,0],a,n),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==_e.length&&(this._prepareInternalSlots(_e,B.OCCLUDER_MATERIAL,B.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(B.OCCLUDER_MATERIAL,_e),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(B.TRANSPARENT_OCCLUDER_MATERIAL,_e)),!1,!1)),_e.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&(r.material.renderOccluded===v.OccludeAndTransparent||r.material.renderOccluded===v.Transparent||r.material.renderOccluded===v.Opaque)&&(e|=r.material.renderOccluded,_e.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,this._prepareInternalSlots(_e,B.OPAQUE_MATERIAL,B.TRANSPARENT_MATERIAL,B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),s>v.Occlude&&this._renderSlot(B.OCCLUDED_TERRAIN),this._renderInternalSlot(B.OPAQUE_MATERIAL,_e),this._renderInternalSlot(B.TRANSPARENT_MATERIAL,_e),this._renderInternalSlot(B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,_e),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=b.Color,t(.5,v.OccludeAndTransparent,(()=>i(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>i(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>i(v.Opaque)),!0,D.OutlineVisualElementMask),_e.clear()}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&null!=e)return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.requiresSlot(B.TRANSPARENT_MATERIAL,b.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.enabled=this.hasReflections,this._bindParameters.ssr.enabled){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(f(ce,this._bindParameters.camera.viewMatrix),f(pe,this._bindParameters.camera.projectionMatrix),T(me,ce,pe),T(me,this._renderContext.lastFrameCamera.viewMatrix,me),T(me,this._renderContext.lastFrameCamera.projectionMatrix,me),this._reprojectionMatrix=me),this._bindParameters.ssr.lastFrameColorTexture=this._offscreen.lastFrameColorTexture;const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._bindParameters.ssr.lastFrameColorTexture=null,this._ssrEnableTime=null}_prepareInternalSlots(e,...r){for(const t of r)this._bindParameters.slot=t,e.forAll((e=>{e.material.shouldRender(this._renderContext)&&e.prepareTechnique(this._renderContext)}))}_renderInternalSlot(e,r=this._materialRenderers){let t=!1;return this._bindParameters.slot=e,r.forAll((e=>{if(e.material.shouldRender(this._renderContext)){const r=e.prepareTechnique(this._renderContext);null!=r&&(e.render(this._renderContext,r),t=!0)}})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=H(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreen?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=G()},getFramebufferTexture:r=>{switch(r){case le.Color:return e._offscreen.colorTexture;case le.LinearDepth:return e._offscreen.linearDepthTexture;case le.Normals:return e._offscreen.normalTexture;case le.ShadowMap:return e._shadowMap.depthTexture;case le.HudVisibility:return e._offscreen.hudVisibilityTexture;case le.Highlight:return e._offscreen.highlightTexture}}}}};var de,le;e([c()],oe.prototype,"_renderPlugins",void 0),e([c()],oe.prototype,"_shadowAccumulator",void 0),e([c()],oe.prototype,"_state",void 0),e([c()],oe.prototype,"_renderStateFeatures",void 0),e([c()],oe.prototype,"_antialiasingEnabled",void 0),e([c({readOnly:!0})],oe.prototype,"_antialiasing",null),e([c()],oe.prototype,"_ssaoEnabled",void 0),e([c()],oe.prototype,"_smaaPass",void 0),e([c({autoDestroy:!0})],oe.prototype,"_edgeView",void 0),e([c()],oe.prototype,"updating",null),e([c()],oe.prototype,"isCameraFinal",null),oe=e([m("esri.views.3d.webgl-engine.lib.Renderer")],oe),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(de||(de={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(le||(le={}));const _e=new o,pe=R(),ce=R(),me=R();function ue(e){return r=>e.immediate.schedule(r)}export{le as FramebufferId,oe as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{disposeMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h,sync as c}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/has.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{F as u,c as m}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{BindParameters as d}from"./BindParameters.js";import{ZERO as g}from"./depthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as v,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as w,shadowCastDisableElevationMin as A}from"./ShadowCastRenderer.js";import{ShadowMap as y}from"./ShadowMap.js";import{S as R,a as C}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as D}from"../shaders/ShadowCastAccumulateTechnique.js";import{TaskPriority as S}from"../../../support/Scheduler.js";import{TextureWrapMode as j,PixelFormat as F,PixelType as T,ClearBufferBit as P}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../webgl/TextureDescriptor.js";import{vertexCount as E}from"../../../webgl/Util.js";let M=class extends t{constructor(e,t,i,r,o,a){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=a,this._progress=0,this._sampleCount=0,this._passParameters=new R,this._enabledInternal=!1,this._cachedLightDirections=[],this._depthRange=g,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._bindParameters=new d(new y(e,i.viewingMode),null,null),this._bindParameters.shadowMap.enabled=!0,this._vao=f(e);const _=new q;_.wrapMode=j.CLAMP_TO_EDGE,this._fbo=new x(e,_),this._accumulationRenderer=new v(t,e,this,a);const l=this._stage.view.resourceController.scheduler;this._handles.add([l.registerTask(S.SHADOW_ACCUMULATOR,this),n((()=>i.renderView),(e=>{this._handles.remove(U),null!=e&&this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),U)}),h),n((()=>this._previewing),(()=>this._requestRenderIfEnabled()),c)])}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechniqueCached=a(this._accumulationTechniqueCached),this._cachedLightDirections.length=0,this._sampleCount=0}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get _accumulationTechnique(){if(null==this._accumulationTechniqueCached){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode};this._accumulationTechniqueCached=new D(e)}return this._accumulationTechniqueCached}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._enabledInternal&&this._sampleCount>0}get canAccumulate(){return null!==this._passParameters.linearDepthTexture&&this._depthRange!==g&&this._opacityFromElevation>b}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,u))return;const s=Math.min(C,e.length);t.length=s,this._sampleCount=s;for(let i=0;i<s;++i)t[i]=m(t[i]??p(),e[i]);this._invalidate()}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this.canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,t,i,s){if(this._depthRange=t,this._updateCamera(i),this._bindParameters.contentCamera=s,this._passParameters.linearDepthTexture=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.isAccumulating||!this.canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const r=this._cameraForcedForScreenshot?this._sampleCount:Math.min(I,this._sampleCount-this._progress);for(let o=0;o<r;++o)this._accumulateShadow();this._cameraForcedForScreenshot=!1,this._requestRender()}render(e){this._accumulationRenderer.render(e)}setOptions(e){void 0!==e.enabled&&(this._enabled=e.enabled),void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._lightDirections=e.lightDirections),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){return!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height?0:(this._fbo.readPixels(e,t,1,1,F.RGBA,T.UNSIGNED_BYTE,O),O[0]/this._progress)}_start(){this._progress=0,this._enabledInternal=!0}_stop(){this._enabledInternal=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(P.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){this._renderToShadowMap(this._bindParameters,this._sampleLightDirection(),this._depthRange);const e=this._accumulationTechnique;this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._passParameters,this._bindParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,E(this._vao,"geometry"))}_sampleLightDirection(){return this._progress++,this._lightDirections[this._progress*L%this._lightDirections.length]}_updateCamera(e){e.equals(this._bindParameters.camera)||(this._bindParameters.camera.copyFrom(e),this._fbo.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-r(A,w,e.relativeElevation))}set _enabled(e){e!==this._enabledInternal&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabledInternal&&this._requestRender()}get test(){const e=this;return{lightDirections:this._lightDirections,get isDone(){return e._isDoneAccumulating},get isActive(){return e._isActive}}}};e([_()],M.prototype,"_progress",void 0),e([_()],M.prototype,"_sampleCount",void 0),e([_()],M.prototype,"_enabledInternal",void 0),e([_()],M.prototype,"_depthRange",void 0),e([_()],M.prototype,"_previewing",void 0),e([_()],M.prototype,"_accumulationRenderer",void 0),e([_()],M.prototype,"_isRefining",null),e([_()],M.prototype,"_isActive",null),e([_()],M.prototype,"canAccumulate",null),e([_()],M.prototype,"_isDoneAccumulating",null),e([_()],M.prototype,"_opacityFromElevation",null),e([_()],M.prototype,"running",null),M=e([l("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],M);const I=6,U="renderView",L=104729,O=new Uint8Array(4);export{M as ShadowAccumulator};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{disposeMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h,sync as c}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/has.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{F as l,c as m}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{BindParameters as d}from"./BindParameters.js";import{ZERO as g}from"./depthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as b,shadowCastDisabledElevationThreshold as v,shadowCastDisableElevationMax as w,shadowCastDisableElevationMin as A}from"./ShadowCastRenderer.js";import{ShadowMap as y}from"./ShadowMap.js";import{S as R,a as C}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as D}from"../shaders/ShadowCastAccumulateTechnique.js";import{TaskPriority as S}from"../../../support/Scheduler.js";import{PixelFormat as j,PixelType as F,TextureWrapMode as T,ClearBufferBit as P}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../webgl/TextureDescriptor.js";import{vertexCount as E}from"../../../webgl/Util.js";let M=class extends t{constructor(e,t,i,r,o,a){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=a,this._progress=0,this._sampleCount=0,this._passParameters=new R,this._cachedLightDirections=[],this._depthRange=g,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._bindParameters=new d(new y(e,i.viewingMode),null,null),this._bindParameters.shadowMap.enabled=!0,this._vao=f(e),this._accumulationRenderer=new b(t,e,this,a);const _=this._stage.view.resourceController.scheduler;this._handles.add([_.registerTask(S.SHADOW_ACCUMULATOR,this),n((()=>i.renderView),(e=>{this._handles.remove(L),null!=e&&this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),L)}),h),n((()=>this._previewing),(()=>this._requestRenderIfEnabled()),c)])}normalizeCtorArgs(){return{}}dispose(){this._disable(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechniqueCached=a(this._accumulationTechniqueCached),this._cachedLightDirections.length=0,this._sampleCount=0}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo?.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get _accumulationTechnique(){if(null==this._accumulationTechniqueCached){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode};this._accumulationTechniqueCached=new D(e)}return this._accumulationTechniqueCached}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return null!=this._fbo&&this._sampleCount>0}get canAccumulate(){return null!==this._passParameters.linearDepthTexture&&this._depthRange!==g&&this._opacityFromElevation>v}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,l))return;const s=Math.min(C,e.length);t.length=s,this._sampleCount=s;for(let i=0;i<s;++i)t[i]=m(t[i]??p(),e[i]);this._invalidate()}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this.canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,t,i,s){if(this._depthRange=t,this._updateCamera(i),this._bindParameters.contentCamera=s,this._passParameters.linearDepthTexture=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.isAccumulating||!this.canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const r=this._cameraForcedForScreenshot?this._sampleCount:Math.min(U,this._sampleCount-this._progress);for(let o=0;o<r;++o)this._accumulateShadow();this._cameraForcedForScreenshot=!1,this._requestRender()}render(e){this._accumulationRenderer.render(e)}setOptions(e){if(void 0!==e.enabled){const t=null!=this._fbo;e.enabled!==t&&(e.enabled?this._enable():this._disable())}void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._lightDirections=e.lightDirections),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){return!this._isActive||!this._fbo||this._progress<1||e<0||e>=this._fbo.width||t<0||t>=this._fbo.height?0:(this._fbo.readPixels(e,t,1,1,j.RGBA,F.UNSIGNED_BYTE,k),k[0]/this._progress)}_enable(){this._progress=0;const e=new q;e.wrapMode=T.CLAMP_TO_EDGE,this._fbo=new x(this._rctx,e)}_disable(){this._fbo=o(this._fbo)}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(P.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){this._renderToShadowMap(this._bindParameters,this._sampleLightDirection(),this._depthRange);const e=this._accumulationTechnique;this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._passParameters,this._bindParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,E(this._vao,"geometry"))}_sampleLightDirection(){return this._progress++,this._lightDirections[this._progress*O%this._lightDirections.length]}_updateCamera(e){!e.equals(this._bindParameters.camera)&&this._fbo&&(this._bindParameters.camera.copyFrom(e),this._fbo.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-r(A,w,e.relativeElevation))}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){const e=this;return{lightDirections:this._lightDirections,get isDone(){return e._isDoneAccumulating},get isActive(){return e._isActive}}}};e([_()],M.prototype,"_progress",void 0),e([_()],M.prototype,"_sampleCount",void 0),e([_()],M.prototype,"_fbo",void 0),e([_()],M.prototype,"_depthRange",void 0),e([_()],M.prototype,"_previewing",void 0),e([_()],M.prototype,"_accumulationRenderer",void 0),e([_()],M.prototype,"_isRefining",null),e([_()],M.prototype,"_isActive",null),e([_()],M.prototype,"canAccumulate",null),e([_()],M.prototype,"_isDoneAccumulating",null),e([_()],M.prototype,"_opacityFromElevation",null),e([_()],M.prototype,"running",null),M=e([u("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],M);const U=6,L="renderView",O=104729,k=new Uint8Array(4);export{M as ShadowAccumulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as r,c as o}from"../../../../chunks/vec4.js";import{createQuadVAO as n}from"./glUtil3D.js";import{S as h}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as _}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as l,ShadowCastVisualization as u}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{vertexCount as d}from"../../../webgl/Util.js";const c=4e4,p=5e4,m=1/512;let b=class extends t{constructor(e,t,s,i){super({}),this._techniqueRepository=e,this._rctx=t,this._data=s,this._requestRender=i,this._passParameters=new h(this._data.shadowCastTexture),this._techniqueConfig=new l,this._enabled=!1,this._vao=n(t),this._techniqueConfig.visualization=u.Gradient}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._vao=s(this._vao),this._techniqueRepository.release(this._technique),this._technique=null}get _visualizeShadowCastTechnique(){return this._technique=this._techniqueRepository.releaseAndAcquire(_,this._techniqueConfig,this._technique),this._technique}render(e){if(!this._showVisualization)return;this._passParameters.sampleScale=1/this._data.computedSamples;const t=this._visualizeShadowCastTechnique;this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(t,this._passParameters,e),this._rctx.drawArrays(t.primitiveType,0,d(this._vao,"geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.color&&this._setColor(e.color),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize),void 0!==e.bandsEnabled&&(this._bandsEnabled=e.bandsEnabled)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(e){this._passParameters.opacityFromElevation!==e&&(this._passParameters.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&this._data.computedSamples>0&&this.opacityFromElevation>m}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfRunning())}get _visualization(){return this._techniqueConfig.visualization}set _visualization(e){e!==this._visualization&&(this._techniqueConfig.visualization=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfRunning())}get _bandsEnabled(){return this._techniqueConfig.bandsEnabled}set _bandsEnabled(e){e!==this._bandsEnabled&&(this._techniqueConfig.bandsEnabled=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}_setColor(e){const t=this._passParameters.color;r(e,t)||(o(this._passParameters.color,e),this._requestRenderIfRunning())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfRunning(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};e([i()],b.prototype,"opacityFromElevation",null),b=e([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],b);export{b as ShadowCastRenderer,p as shadowCastDisableElevationMax,c as shadowCastDisableElevationMin,m as shadowCastDisabledElevationThreshold};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as r,c as o}from"../../../../chunks/vec4.js";import{createQuadVAO as n}from"./glUtil3D.js";import{S as h}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as _}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as l,ShadowCastVisualization as u}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{vertexCount as d}from"../../../webgl/Util.js";const c=4e4,p=5e4,m=1/512;let b=class extends t{constructor(e,t,s,i){super({}),this._techniqueRepository=e,this._rctx=t,this._data=s,this._requestRender=i,this._passParameters=new h(this._data),this._techniqueConfig=new l,this._enabled=!1,this._vao=n(t),this._techniqueConfig.visualization=u.Gradient}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._vao=s(this._vao),this._techniqueRepository.release(this._technique),this._technique=null}get _visualizeShadowCastTechnique(){return this._technique=this._techniqueRepository.releaseAndAcquire(_,this._techniqueConfig,this._technique),this._technique}render(e){if(!this._showVisualization)return;this._passParameters.sampleScale=1/this._data.computedSamples;const t=this._visualizeShadowCastTechnique;this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(t,this._passParameters,e),this._rctx.drawArrays(t.primitiveType,0,d(this._vao,"geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.color&&this._setColor(e.color),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize),void 0!==e.bandsEnabled&&(this._bandsEnabled=e.bandsEnabled)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(e){this._passParameters.opacityFromElevation!==e&&(this._passParameters.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&this._data.computedSamples>0&&this.opacityFromElevation>m}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfRunning())}get _visualization(){return this._techniqueConfig.visualization}set _visualization(e){e!==this._visualization&&(this._techniqueConfig.visualization=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfRunning())}get _bandsEnabled(){return this._techniqueConfig.bandsEnabled}set _bandsEnabled(e){e!==this._bandsEnabled&&(this._techniqueConfig.bandsEnabled=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}_setColor(e){const t=this._passParameters.color;r(e,t)||(o(this._passParameters.color,e),this._requestRenderIfRunning())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfRunning(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};e([i()],b.prototype,"opacityFromElevation",null),b=e([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],b);export{b as ShadowCastRenderer,p as shadowCastDisableElevationMax,c as shadowCastDisableElevationMin,m as shadowCastDisabledElevationThreshold};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{c as a}from"../../../../chunks/mat3f64.js";import{w as r,m as h,a as n,u as c}from"../../../../chunks/mat4.js";import{c as o}from"../../../../chunks/mat4f64.js";import{s as u,j as _,b as m,l as d,k as l,a as p,h as f,n as x,f as g,c as w}from"../../../../chunks/vec2.js";import{a as M}from"../../../../chunks/vec2f64.js";import{k as b,c as T,o as S,m as C,s as j}from"../../../../chunks/vec3.js";import{c as y}from"../../../../chunks/vec3f64.js";import{s as D,t as v}from"../../../../chunks/vec4.js";import{c as z}from"../../../../chunks/vec4f64.js";import{ViewingMode as E}from"../../../ViewingMode.js";import{CascadeCamera as O}from"./CascadeCamera.js";import{applyTextureResizeModulo as R}from"./textureUtils.js";import{assert as H,logWithBase as U,verify as F,rayRay2D as N}from"./Util.js";import{TextureType as Q,ClearBufferBit as A,TextureWrapMode as k,TextureSamplingMode as L,RenderbufferFormat as V}from"../../../webgl/enums.js";import{FramebufferObject as I}from"../../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as P}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as B}from"../../../webgl/Texture.js";import{TextureDescriptor as G}from"../../../webgl/TextureDescriptor.js";var X;!function(t){t[t.Highlight=0]="Highlight",t[t.Default=1]="Default"}(X||(X={}));class q{constructor(){this.camera=new O,this.lightMat=o()}}class W{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1,this.textureSizeModLowQuality=.8,this.splitSchemeLambda=0}}class J{get depthTexture(){return this._fbo?.colorTexture}get textureSize(){return this._textureSize}get numCascades(){return this._numCascades}get cascadeDistances(){return D(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}constructor(t,s){this._rctx=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureSize=0,this._numCascades=1,this._renderHighQuality=!0,this.settings=new W,this._projectionView=o(),this._projectionViewInverse=o(),this._modelViewLight=o(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=z(),this._cascades=[new q,new q,new q,new q],this._lastOrigin=null,this._maxTextureSize=Math.min(has("esri-mobile")?2048:8192,this._rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}disposeOffscreenBuffers(){this._discardDepthTexture(),this._discardAllSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||(this._discardDepthTexture(),this._discardAllSnapshots())}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}getSnapshot(t){return this.enabled?this._snapshots[t]:null}get cascades(){for(let t=0;t<this._numCascades;++t)rt[t]=this._cascades[t];return rt.length=this._numCascades,rt}start(t,s,e,i){H(this.enabled),this._renderHighQuality=i,this._textureSize=this._computeTextureSize(t),this._ensureDepthTexture();const{near:a,far:r}=this._clampNearFar(e);this._computeCascadeDistances(r,a),this._setupMatrices(t,s);const{viewMatrix:h,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,h,s);this._lastOrigin=null,this.clear()}finish(t){H(this.enabled),this._rctx.bindFramebuffer(t)}getShadowMapMatrices(t){if(!this._lastOrigin||!b(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||y(),T(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(ht,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)nt[16*s+t]=ht[t]}}return nt}takeCascadeSnapshotTo(t,s){H(this.enabled);const e=this._ensureSnapshot(s);this._bindFbo();const i=this._rctx,a=i.bindTexture(e,B.TEXTURE_UNIT_FOR_UPDATES);i.gl.copyTexSubImage2D(Q.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),i.bindTexture(a,B.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this._rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(A.COLOR_BUFFER_BIT|A.DEPTH_BUFFER_BIT)}_computeTextureSize(t){const s=R(Math.max(t.fullWidth,t.fullHeight)/t.pixelRatio),e=this._renderHighQuality?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality,i=Math.floor(Math.min(this._maxTextureSize,(1===this.numCascades?1:2)*s)*e);return Math.min(i,this._rctx.parameters.maxTextureSize)}_ensureDepthTexture(){if(this.depthTexture&&this.depthTexture.descriptor.width===this._textureSize)return;this._discardDepthTexture();const t=new G(this._textureSize);t.wrapMode=k.CLAMP_TO_EDGE,t.samplingMode=L.NEAREST,this._fbo=new I(this._rctx,t,new P(V.DEPTH_COMPONENT16,this._textureSize))}_ensureSnapshot(t){let s=this._snapshots[t];if(null!=s&&s.descriptor.width===this._textureSize)return s;this._discardSnapshot(t);const e=new G;return e.wrapMode=k.CLAMP_TO_EDGE,e.samplingMode=L.NEAREST,e.width=this._textureSize,e.height=this._textureSize,s=new B(this._rctx,e),this._snapshots[t]=s,s}_discardDepthTexture(){this._fbo=i(this._fbo)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){const t=this._rctx;t.unbindTexture(this.depthTexture),t.bindFramebuffer(this._fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],n=-this._cascadeDistances[t],c=-this._cascadeDistances[t+1],o=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]),u=(s[10]*c+s[14])/Math.abs(s[11]*c+s[15]);H(o<u);for(let r=0;r<8;++r){D(Y,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?o:u,1);const t=Z[r];v(t,Y,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}S(at,Z[0]),a.camera.viewMatrix=r(K,this._modelViewLight,at);for(let r=0;r<8;++r)C(Z[r],Z[r],a.camera.viewMatrix);let _=Z[0][2],m=Z[0][2];for(let r=1;r<8;++r)_=Math.min(_,Z[r][2]),m=Math.max(m,Z[r][2]);_-=200,m+=200,a.camera.near=-m,a.camera.far=-_,jt(e,i,_,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const d=this._textureSize/(1===this.numCascades?1:2);a.camera.viewport=[t%2==0?0:d,0===Math.floor(t/2)?0:d,d,d]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),n(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===E.Global?t.eye:j(at,0,0,1);c(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_clampNearFar(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}_computeCascadeDistances(t,e){const i=this._renderHighQuality?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(U(t/e,4)),i);const a=(t-e)/this._numCascades,r=(t/e)**(1/this._numCascades);let h=e,n=e;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(h,n,this.settings.splitSchemeLambda),h*=r,n+=a}get gpuMemoryUsage(){return this._snapshots.reduce(((t,s)=>t+(s?.gpuMemoryUsage??0)),this._fbo?.gpuMemoryUsage??0)}get test(){return{cascades:this._cascades,textureSize:this._textureSize}}}const K=o(),Y=z(),Z=[];for(let yt=0;yt<8;++yt)Z.push(z());const $=M(),tt=M(),st=M(),et=M(),it=M(),at=y(),rt=[],ht=o(),nt=new Array(64),ct=M(),ot=M(),ut=[M(),M(),M(),M()],_t=M(),mt=M(),dt=M(),lt=M(),pt=M(),ft=M(),xt=M();function gt(t,s,e,i,a,r,h,n){u(ct,0,0);for(let u=0;u<4;++u)_(ct,ct,t[u]);m(ct,ct,.25),u(ot,0,0);for(let u=4;u<8;++u)_(ot,ot,t[u]);m(ot,ot,.25),d(ut[0],t[4],t[5],.5),d(ut[1],t[5],t[6],.5),d(ut[2],t[6],t[7],.5),d(ut[3],t[7],t[4],.5);let c=0,o=l(ut[0],ct);for(let u=1;u<4;++u){const t=l(ut[u],ct);t<o&&(o=t,c=u)}p(_t,ut[c],t[c+4]);const M=_t[0];let b,T;_t[0]=-_t[1],_t[1]=M,p(mt,ot,ct),f(mt,_t)<0&&x(_t,_t),d(_t,_t,mt,e),g(_t,_t),b=T=f(p(dt,t[0],ct),_t);for(let u=1;u<8;++u){const s=f(p(dt,t[u],ct),_t);s<b?b=s:s>T&&(T=s)}w(i,ct),m(dt,_t,b-s),_(i,i,dt);let S=-1,C=1,j=0,y=0;for(let u=0;u<8;++u){p(lt,t[u],i),g(lt,lt);const s=_t[0]*lt[1]-_t[1]*lt[0];s>0?s>S&&(S=s,j=u):s<C&&(C=s,y=u)}F(S>0,"leftArea"),F(C<0,"rightArea"),m(pt,_t,b),_(pt,pt,ct),m(ft,_t,T),_(ft,ft,ct),xt[0]=-_t[1],xt[1]=_t[0];const D=N(i,t[y],ft,_(dt,ft,xt),1,a),v=N(i,t[j],ft,dt,1,r),z=N(i,t[j],pt,_(dt,pt,xt),1,h),E=N(i,t[y],pt,dt,1,n);F(D,"rayRay"),F(v,"rayRay"),F(z,"rayRay"),F(E,"rayRay")}function wt(t,s){return 3*s+t}const Mt=M();function bt(t,s){return u(Mt,t[s],t[s+3]),Mt}const Tt=M(),St=a();function Ct(t,s,e,i,a){p(Tt,e,i),m(Tt,Tt,.5),St[0]=Tt[0],St[1]=Tt[1],St[2]=0,St[3]=Tt[1],St[4]=-Tt[0],St[5]=0,St[6]=Tt[0]*Tt[0]+Tt[1]*Tt[1],St[7]=Tt[0]*Tt[1]-Tt[1]*Tt[0],St[8]=1,St[wt(0,2)]=-f(bt(St,0),t),St[wt(1,2)]=-f(bt(St,1),t);let r=f(bt(St,0),e)+St[wt(0,2)],h=f(bt(St,1),e)+St[wt(1,2)],n=f(bt(St,0),i)+St[wt(0,2)],c=f(bt(St,1),i)+St[wt(1,2)];r=-(r+n)/(h+c),St[wt(0,0)]+=St[wt(1,0)]*r,St[wt(0,1)]+=St[wt(1,1)]*r,St[wt(0,2)]+=St[wt(1,2)]*r,r=1/(f(bt(St,0),e)+St[wt(0,2)]),h=1/(f(bt(St,1),e)+St[wt(1,2)]),St[wt(0,0)]*=r,St[wt(0,1)]*=r,St[wt(0,2)]*=r,St[wt(1,0)]*=h,St[wt(1,1)]*=h,St[wt(1,2)]*=h,St[wt(2,0)]=St[wt(1,0)],St[wt(2,1)]=St[wt(1,1)],St[wt(2,2)]=St[wt(1,2)],St[wt(1,2)]+=1,r=f(bt(St,1),s)+St[wt(1,2)],h=f(bt(St,2),s)+St[wt(2,2)],n=f(bt(St,1),e)+St[wt(1,2)],c=f(bt(St,2),e)+St[wt(2,2)],r=-.5*(r/h+n/c),St[wt(1,0)]+=St[wt(2,0)]*r,St[wt(1,1)]+=St[wt(2,1)]*r,St[wt(1,2)]+=St[wt(2,2)]*r,r=f(bt(St,1),s)+St[wt(1,2)],h=f(bt(St,2),s)+St[wt(2,2)],n=-h/r,St[wt(1,0)]*=n,St[wt(1,1)]*=n,St[wt(1,2)]*=n,a[0]=St[0],a[1]=St[1],a[2]=0,a[3]=St[2],a[4]=St[3],a[5]=St[4],a[6]=0,a[7]=St[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=St[6],a[13]=St[7],a[14]=0,a[15]=St[8]}function jt(t,s,i,a,r){const h=1/Z[0][3],n=1/Z[4][3];H(h<n);let c=h+Math.sqrt(h*n);const o=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));c/=o,gt(Z,c,o,$,tt,st,et,it),Ct($,tt,et,it,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}export{J as ShadowMap,X as SnapshotSlot};
5
+ import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{c as a}from"../../../../chunks/mat3f64.js";import{w as r,m as n,a as h,u as o}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{s as u,j as m,b as _,l,k as d,a as p,h as f,n as x,f as g,c as w}from"../../../../chunks/vec2.js";import{a as M}from"../../../../chunks/vec2f64.js";import{k as b,c as S,o as C,m as T,s as j}from"../../../../chunks/vec3.js";import{c as y}from"../../../../chunks/vec3f64.js";import{s as D,t as v}from"../../../../chunks/vec4.js";import{c as z}from"../../../../chunks/vec4f64.js";import{ViewingMode as E}from"../../../ViewingMode.js";import{CascadeCamera as O}from"./CascadeCamera.js";import{applyTextureResizeModulo as R}from"./textureUtils.js";import{assert as H,logWithBase as U,verify as F,rayRay2D as N}from"./Util.js";import{TextureType as Q,ClearBufferBit as k,TextureWrapMode as A,TextureSamplingMode as L,RenderbufferFormat as V}from"../../../webgl/enums.js";import{FramebufferObject as I}from"../../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as P}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as B}from"../../../webgl/Texture.js";import{TextureDescriptor as G}from"../../../webgl/TextureDescriptor.js";var X;!function(t){t[t.Highlight=0]="Highlight",t[t.Default=1]="Default"}(X||(X={}));class q{constructor(){this.camera=new O,this.lightMat=c()}}class W{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class J{get depthTexture(){return this._fbo?.colorTexture}get textureSize(){return this._textureSize}get numCascades(){return this._numCascades}get cascadeDistances(){return D(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}constructor(t,s){this._rctx=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureSize=0,this._numCascades=1,this._renderHighQuality=!0,this.settings=new W,this._projectionView=c(),this._projectionViewInverse=c(),this._modelViewLight=c(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=z(),this._cascades=[new q,new q,new q,new q],this._lastOrigin=null,this._maxTextureSize=Math.min(has("esri-mobile")?2048:8192,this._rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}disposeOffscreenBuffers(){this._fbo=i(this._fbo),this._discardAllSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}getSnapshot(t){return this.enabled?this._snapshots[t]:null}get cascades(){for(let t=0;t<this._numCascades;++t)rt[t]=this._cascades[t];return rt.length=this._numCascades,rt}start(t,s,e,i,a){H(this.enabled),this._renderHighQuality=i,this._textureSize=this._computeTextureSize(t,a),this._ensureDepthTexture();const{near:r,far:n}=this._clampNearFar(e);this._computeCascadeDistances(n,r),this._setupMatrices(t,s);const{viewMatrix:h,projectionMatrix:o}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,o,h,s);this._lastOrigin=null,this.clear()}finish(t){H(this.enabled),this._rctx.bindFramebuffer(t)}getShadowMapMatrices(t){if(!this._lastOrigin||!b(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||y(),S(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(nt,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)ht[16*s+t]=nt[t]}}return ht}takeCascadeSnapshotTo(t,s){H(this.enabled);const e=this._ensureSnapshot(s);this._bindFbo();const i=this._rctx,a=i.bindTexture(e,B.TEXTURE_UNIT_FOR_UPDATES);i.gl.copyTexSubImage2D(Q.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),i.bindTexture(a,B.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this._rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT)}_computeTextureSize(t,s){const e=Math.min(window.devicePixelRatio,s)/t.pixelRatio,i=R(Math.max(t.fullWidth,t.fullHeight)*e),a=this._renderHighQuality?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality,r=Math.floor(Math.min(this._maxTextureSize,(1===this.numCascades?1:2)*i)*a);return Math.min(r,this._rctx.parameters.maxTextureSize)}_ensureDepthTexture(){if(this._fbo?.width===this._textureSize)return;const t=new G(this._textureSize);t.wrapMode=A.CLAMP_TO_EDGE,t.samplingMode=L.NEAREST,this._fbo?.dispose(),this._fbo=new I(this._rctx,t,new P(V.DEPTH_COMPONENT16,this._textureSize))}_ensureSnapshot(t){let s=this._snapshots[t];if(null!=s&&s.descriptor.width===this._textureSize)return s;this._discardSnapshot(t);const e=new G;return e.wrapMode=A.CLAMP_TO_EDGE,e.samplingMode=L.NEAREST,e.width=this._textureSize,e.height=this._textureSize,s=new B(this._rctx,e),this._snapshots[t]=s,s}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){const t=this._rctx;t.unbindTexture(this.depthTexture),t.bindFramebuffer(this._fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],h=-this._cascadeDistances[t],o=-this._cascadeDistances[t+1],c=(s[10]*h+s[14])/Math.abs(s[11]*h+s[15]),u=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]);H(c<u);for(let r=0;r<8;++r){D(Y,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:u,1);const t=Z[r];v(t,Y,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}C(at,Z[0]),a.camera.viewMatrix=r(K,this._modelViewLight,at);for(let r=0;r<8;++r)T(Z[r],Z[r],a.camera.viewMatrix);let m=Z[0][2],_=Z[0][2];for(let r=1;r<8;++r)m=Math.min(m,Z[r][2]),_=Math.max(_,Z[r][2]);m-=200,_+=200,a.camera.near=-_,a.camera.far=-m,jt(e,i,m,_,a.camera),n(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const l=this._textureSize/(1===this.numCascades?1:2);a.camera.viewport=[t%2==0?0:l,0===Math.floor(t/2)?0:l,l,l]}_setupMatrices(t,s){n(this._projectionView,t.projectionMatrix,t.viewMatrix),h(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===E.Global?t.eye:j(at,0,0,1);o(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_clampNearFar(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}_computeCascadeDistances(t,e){const i=this._renderHighQuality?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(U(t/e,4)),i);const a=(t-e)/this._numCascades,r=(t/e)**(1/this._numCascades);let n=e,h=e;for(let o=0;o<this._numCascades+1;++o)this._cascadeDistances[o]=s(n,h,this.settings.splitSchemeLambda),n*=r,h+=a}get gpuMemoryUsage(){return this._snapshots.reduce(((t,s)=>t+(s?.gpuMemoryUsage??0)),this._fbo?.gpuMemoryUsage??0)}get test(){return{cascades:this._cascades,textureSize:this._textureSize}}}const K=c(),Y=z(),Z=[];for(let yt=0;yt<8;++yt)Z.push(z());const $=M(),tt=M(),st=M(),et=M(),it=M(),at=y(),rt=[],nt=c(),ht=new Array(64),ot=M(),ct=M(),ut=[M(),M(),M(),M()],mt=M(),_t=M(),lt=M(),dt=M(),pt=M(),ft=M(),xt=M();function gt(t,s,e,i,a,r,n,h){u(ot,0,0);for(let u=0;u<4;++u)m(ot,ot,t[u]);_(ot,ot,.25),u(ct,0,0);for(let u=4;u<8;++u)m(ct,ct,t[u]);_(ct,ct,.25),l(ut[0],t[4],t[5],.5),l(ut[1],t[5],t[6],.5),l(ut[2],t[6],t[7],.5),l(ut[3],t[7],t[4],.5);let o=0,c=d(ut[0],ot);for(let u=1;u<4;++u){const t=d(ut[u],ot);t<c&&(c=t,o=u)}p(mt,ut[o],t[o+4]);const M=mt[0];let b,S;mt[0]=-mt[1],mt[1]=M,p(_t,ct,ot),f(_t,mt)<0&&x(mt,mt),l(mt,mt,_t,e),g(mt,mt),b=S=f(p(lt,t[0],ot),mt);for(let u=1;u<8;++u){const s=f(p(lt,t[u],ot),mt);s<b?b=s:s>S&&(S=s)}w(i,ot),_(lt,mt,b-s),m(i,i,lt);let C=-1,T=1,j=0,y=0;for(let u=0;u<8;++u){p(dt,t[u],i),g(dt,dt);const s=mt[0]*dt[1]-mt[1]*dt[0];s>0?s>C&&(C=s,j=u):s<T&&(T=s,y=u)}F(C>0,"leftArea"),F(T<0,"rightArea"),_(pt,mt,b),m(pt,pt,ot),_(ft,mt,S),m(ft,ft,ot),xt[0]=-mt[1],xt[1]=mt[0];const D=N(i,t[y],ft,m(lt,ft,xt),1,a),v=N(i,t[j],ft,lt,1,r),z=N(i,t[j],pt,m(lt,pt,xt),1,n),E=N(i,t[y],pt,lt,1,h);F(D,"rayRay"),F(v,"rayRay"),F(z,"rayRay"),F(E,"rayRay")}function wt(t,s){return 3*s+t}const Mt=M();function bt(t,s){return u(Mt,t[s],t[s+3]),Mt}const St=M(),Ct=a();function Tt(t,s,e,i,a){p(St,e,i),_(St,St,.5),Ct[0]=St[0],Ct[1]=St[1],Ct[2]=0,Ct[3]=St[1],Ct[4]=-St[0],Ct[5]=0,Ct[6]=St[0]*St[0]+St[1]*St[1],Ct[7]=St[0]*St[1]-St[1]*St[0],Ct[8]=1,Ct[wt(0,2)]=-f(bt(Ct,0),t),Ct[wt(1,2)]=-f(bt(Ct,1),t);let r=f(bt(Ct,0),e)+Ct[wt(0,2)],n=f(bt(Ct,1),e)+Ct[wt(1,2)],h=f(bt(Ct,0),i)+Ct[wt(0,2)],o=f(bt(Ct,1),i)+Ct[wt(1,2)];r=-(r+h)/(n+o),Ct[wt(0,0)]+=Ct[wt(1,0)]*r,Ct[wt(0,1)]+=Ct[wt(1,1)]*r,Ct[wt(0,2)]+=Ct[wt(1,2)]*r,r=1/(f(bt(Ct,0),e)+Ct[wt(0,2)]),n=1/(f(bt(Ct,1),e)+Ct[wt(1,2)]),Ct[wt(0,0)]*=r,Ct[wt(0,1)]*=r,Ct[wt(0,2)]*=r,Ct[wt(1,0)]*=n,Ct[wt(1,1)]*=n,Ct[wt(1,2)]*=n,Ct[wt(2,0)]=Ct[wt(1,0)],Ct[wt(2,1)]=Ct[wt(1,1)],Ct[wt(2,2)]=Ct[wt(1,2)],Ct[wt(1,2)]+=1,r=f(bt(Ct,1),s)+Ct[wt(1,2)],n=f(bt(Ct,2),s)+Ct[wt(2,2)],h=f(bt(Ct,1),e)+Ct[wt(1,2)],o=f(bt(Ct,2),e)+Ct[wt(2,2)],r=-.5*(r/n+h/o),Ct[wt(1,0)]+=Ct[wt(2,0)]*r,Ct[wt(1,1)]+=Ct[wt(2,1)]*r,Ct[wt(1,2)]+=Ct[wt(2,2)]*r,r=f(bt(Ct,1),s)+Ct[wt(1,2)],n=f(bt(Ct,2),s)+Ct[wt(2,2)],h=-n/r,Ct[wt(1,0)]*=h,Ct[wt(1,1)]*=h,Ct[wt(1,2)]*=h,a[0]=Ct[0],a[1]=Ct[1],a[2]=0,a[3]=Ct[2],a[4]=Ct[3],a[5]=Ct[4],a[6]=0,a[7]=Ct[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=Ct[6],a[13]=Ct[7],a[14]=0,a[15]=Ct[8]}function jt(t,s,i,a,r){const n=1/Z[0][3],h=1/Z[4][3];H(n<h);let o=n+Math.sqrt(n*h);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));o/=c,gt(Z,o,c,$,tt,st,et,it),Tt($,tt,et,it,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}export{J as ShadowMap,X as SnapshotSlot};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{glLayout as t}from"../../../support/buffer/glUtil.js";import{Default3D as r}from"../DefaultVertexAttributeLocations.js";import{GLMaterials as e}from"../GLMaterials.js";import{newIntersectorResult as s}from"../Intersector.js";import{IntersectorType as o,StoreResults as i}from"../IntersectorInterfaces.js";import{VertexArrayObject as a}from"../VertexArrayObject.js";import{LodTarget as n}from"./Intersector.js";import{BufferObject as m}from"../../../../webgl/BufferObject.js";import{Usage as l}from"../../../../webgl/enums.js";class u{constructor(s,o){const i=s.renderContext.rctx,n=o.geometry;this._materialRepository=s.materialRepository,n.material.setParameters({instancedDoublePrecision:!0});const u=n.material.createBufferWriter(),f=u.vertexBufferLayout,d=u.elementCount(n),p=u.allocate(d);u.write(null,null,n,p,0),this.geometry=n,this.material=n.material,this.glMaterials=new e(n.material,this._materialRepository),this.vertexBufferLayout=f,this.vbo=m.createVertex(i,l.STATIC_DRAW,p.buffer),this.vao=new a(i,r,{geometry:t(f)},{geometry:this.vbo}),this.vertexCount=d}destroy(){this.glMaterials.destroy(),this.vbo.dispose(),this.vao.dispose()}get boundingInfo(){return this.geometry.boundingInfo}get triangleCount(){return this.vertexCount/3}intersect(t,r,e,a,m,l,u,f){const d=this.geometry.id;this.material.intersect(this.geometry,t.transform.transform,t,e,a,((e,a,p,c,y)=>{if(e>=0){if(null!=r&&!r(t.rayBegin,t.rayEnd,e))return;const c=new n(l.layerUid,l.graphicUid(m),d,p,u,f);if((null==t.results.min.drapedLayerOrder||y>=t.results.min.drapedLayerOrder)&&(null==t.results.min.dist||e<t.results.min.dist)&&t.results.min.set(o.LOD,c,e,a,t.transform.transform,y),t.options.store!==i.MIN&&(null==t.results.max.drapedLayerOrder||y>=t.results.max.drapedLayerOrder)&&(null==t.results.max.dist||e>t.results.max.dist)&&t.results.max.set(o.LOD,c,e,a,t.transform.transform,y),t.options.store===i.ALL){const r=s(t.results.min.ray);r.set(o.LOD,c,e,a,t.transform.transform,y),t.results.all.push(r)}}}))}}export{u as LodComponentData};
5
+ import{glLayout as r}from"../../../support/buffer/glUtil.js";import{Default3D as t}from"../DefaultVertexAttributeLocations.js";import{GLMaterials as e}from"../GLMaterials.js";import{newIntersectorResult as s}from"../Intersector.js";import{IntersectorType as o,StoreResults as i}from"../IntersectorInterfaces.js";import{VertexArrayObject as a}from"../VertexArrayObject.js";import{LodTarget as n}from"./Intersector.js";import{BufferObject as m}from"../../../../webgl/BufferObject.js";import{Usage as l}from"../../../../webgl/enums.js";class u{constructor(s,o){const i=s.renderContext.rctx,n=o.geometry;this._materialRepository=s.materialRepository,n.material.setParameters({instancedDoublePrecision:!0});const u=n.material.createBufferWriter(),f=u.vertexBufferLayout,d=u.elementCount(n),p=f.createBuffer(d);u.write(null,null,n,p,0),this.geometry=n,this.material=n.material,this.glMaterials=new e(n.material,this._materialRepository),this.vertexBufferLayout=f,this.vbo=m.createVertex(i,l.STATIC_DRAW,p.buffer),this.vao=new a(i,t,{geometry:r(f)},{geometry:this.vbo}),this.vertexCount=d}destroy(){this.glMaterials.destroy(),this.vbo.dispose(),this.vao.dispose()}get boundingInfo(){return this.geometry.boundingInfo}get triangleCount(){return this.vertexCount/3}intersect(r,t,e,a,m,l,u,f){const d=this.geometry.id;this.material.intersect(this.geometry,r.transform.transform,r,e,a,((e,a,p,c,y)=>{if(e>=0){if(null!=t&&!t(r.rayBegin,r.rayEnd,e))return;const c=new n(l.layerUid,l.graphicUid(m),d,p,u,f);if((null==r.results.min.drapedLayerOrder||y>=r.results.min.drapedLayerOrder)&&(null==r.results.min.dist||e<r.results.min.dist)&&r.results.min.set(o.LOD,c,e,a,r.transform.transform,y),r.options.store!==i.MIN&&(null==r.results.max.drapedLayerOrder||y>=r.results.max.drapedLayerOrder)&&(null==r.results.max.dist||e>r.results.max.dist)&&r.results.max.set(o.LOD,c,e,a,r.transform.transform,y),r.options.store===i.ALL){const t=s(r.results.min.ray);t.set(o.LOD,c,e,a,r.transform.transform,y),r.results.all.push(t)}}}))}}export{u as LodComponentData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{VertexAttribute as t}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as e}from"./internal/bufferWriterUtils.js";class r{constructor(t){this.vertexBufferLayout=t}allocate(t){return this.vertexBufferLayout.createBuffer(t)}elementCount(e){return e.indices.get(t.POSITION).length}write(t,r,i,u,f){e(i,this.vertexBufferLayout,t,r,u,f)}}export{r as DefaultBufferWriter};
5
+ import{VertexAttribute as t}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as e}from"./internal/bufferWriterUtils.js";class r{constructor(t){this.vertexBufferLayout=t}elementCount(e){return e.indices.get(t.POSITION).length}write(t,r,i,o,s){e(i,this.vertexBufferLayout,t,r,o,s)}}export{r as DefaultBufferWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{c as r}from"../../../../chunks/mat3f64.js";import{a as s}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/mat4f64.js";import{c as a}from"../../../../chunks/vec2.js";import{a as n,f as o}from"../../../../chunks/vec2f64.js";import{s as c,m as l,n as f,b as u,g as h,c as p,l as m,i as d,t as g,e as O,a as S}from"../../../../chunks/vec3.js";import{c as v,f as A}from"../../../../chunks/vec3f64.js";import{c as b,f as P}from"../../../../chunks/vec4f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as y}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as _}from"../../../../geometry/support/buffer/BufferView.js";import I from"../../support/debugFlags.js";import{newLayout as T}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as j}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as L,GLTextureMaterialBindParameters as z}from"../lib/GLTextureMaterial.js";import{Material as M,RenderOccludedFlag as R}from"../lib/Material.js";import{RenderSlot as U}from"../lib/RenderSlot.js";import{applyScaleFactor as D,applyPrecomputedScaleFactor as E,precomputeScaleFactor as w}from"../lib/screenSizePerspectiveUtils.js";import{assert as V}from"../lib/Util.js";import{VertexAttribute as N}from"../lib/VertexAttribute.js";import{ScaleInfo as B}from"./ScaleInfo.js";import{writePosition as X,writeNormal as H,writeColor as G,writeBufferVec4 as k,writeBufferVec4Zeros as F,writeObjectAndLayerIdColor as W}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as q}from"./internal/MaterialUtil.js";import{c as Z}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as J}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as Y}from"../shaders/HUDMaterialTechniqueConfiguration.js";class K extends M{constructor(e){super(e,new ve),this._configuration=new Y}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?C.Screen:C.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.isDraped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===U.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===j.Color||e===j.Alpha),e===j.Color&&(this._configuration.debugDrawLabelBorder=!!I.LABELS_SHOW_BORDER),e===j.Highlight&&(this._configuration.binaryHighlightOcclusionEnabled=this.parameters.binaryHighlightOcclusion),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassGeometry=t.multipassGeometry.enabled,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,r,i,a,n,o){if(!i.options.selectionMode||!i.options.hud||!e.visible)return;const g=this.parameters;let O=1,S=1;if(t(le,r),null!=e.shaderTransformer){const t=e.shaderTransformer(me);O=t[0],S=t[5],ee(le)}const A=e.vertexAttributes.get(N.POSITION),b=e.vertexAttributes.get(N.SIZE),P=e.vertexAttributes.get(N.NORMAL),x=e.vertexAttributes.get(N.AUXPOS1);V(A.size>=3);const y=i.point,_=i.camera,I=Z(g);O*=_.pixelRatio,S*=_.pixelRatio;const T="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<A.data.length/A.size;t++){const e=t*A.size;c(ie,A.data[e],A.data[e+1],A.data[e+2]),l(ie,ie,r);const a=t*b.size;Oe[0]=b.data[a]*O,Oe[1]=b.data[a+1]*S,l(ie,ie,_.viewMatrix);const n=t*x.size;if(c(he,x.data[n],x.data[n+1],x.data[n+2]),!T&&(ie[0]+=he[0],ie[1]+=he[1],0!==he[2])){const e=he[2];f(he,ie),u(ie,ie,h(he,he,e))}const j=t*P.size;if(c(ae,P.data[j],P.data[j+1],P.data[j+2]),this._normalAndViewAngle(ae,le,_,pe),this._applyVerticalOffsetTransformationView(ie,pe,_,re),_.applyProjection(ie,ne),ne[0]>-1){ne[0]=Math.floor(ne[0]),ne[1]=Math.floor(ne[1]),T&&(he[0]||he[1])&&(ne[0]+=he[0],0!==he[1]&&(ne[1]+=D(he[1],re.factorAlignment)),_.unapplyProjection(ne,ie)),ne[0]+=this.parameters.screenOffset[0],ne[1]+=this.parameters.screenOffset[1],E(Oe,re.factor,Oe);const e=de*_.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*_.pixelRatio/2),y&&te(y,ne[0],ne[1],Oe,e,t,g,I)){const e=i.ray;if(l(ce,ie,s(ue,_.viewMatrix)),ne[0]=y[0],ne[1]=y[1],_.unprojectFromRenderScreen(ne,ie)){const t=v();p(t,e.direction);const r=1/m(t);h(t,t,r);o(d(e.origin,ie)*r,t,-1,!0,1,ce)}}}}}intersectDraped(e,t,r,s,i,a){const n=e.vertexAttributes.get(N.POSITION),o=e.vertexAttributes.get(N.SIZE),c=this.parameters,l=Z(c);let f=1,u=1;if(null!=e.shaderTransformer){const t=e.shaderTransformer(me);f=t[0],u=t[5]}f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const h=ge*e.screenToWorldRatio;for(let p=0;p<n.data.length/n.size;p++){const t=p*n.size,r=n.data[t],m=n.data[t+1],d=p*o.size;Oe[0]=o.data[d]*f,Oe[1]=o.data[d+1]*u;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),te(s,r,m,Oe,h,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new Pe(this)}_normalAndViewAngle(e,r,s,i){return x(r)&&(r=t(fe,r)),g(i.normal,e,r),l(i.normal,i.normal,s.viewInverseTransposeMatrix),i.cosAngle=O(oe,Se),i}_updateScaleInfo(e,t,r){const s=this.parameters;null!=s.screenSizePerspective?w(r,t,s.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minPixelSize=0,e.factor.paddingPixels=0),null!=s.screenSizePerspectiveAlignment?w(r,t,s.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minPixelSize=e.factor.minPixelSize,e.factorAlignment.paddingPixels=e.factor.paddingPixels)}applyShaderOffsetsView(e,t,r,s,i,a,n){const o=this._normalAndViewAngle(t,r,i,pe);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,s[3],i,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,r,s,i){return this._applyCenterOffsetNDC(e,t,r,s),null!=i&&p(i,s),this._applyPolygonOffsetNDC(s,t,r,s),s}_applyPolygonOffsetView(t,r,s,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return p(a,t);const l=e(Math.abs(r.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return h(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,r,s){const i=m(e),a=r.aboveGround?1:-1,n=.5*r.computeRenderPixelSizeAtDist(i),o=h(ie,t.normal,a*n);return S(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,r,s){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const r=m(e);this._updateScaleInfo(s,r,t.cosAngle)}else s.factor.scale=1,s.factorAlignment.scale=1;return e}const a=m(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=q(r,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(s,a,t.cosAngle),h(t.normal,t.normal,o),S(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&p(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(f(ae,r),S(r,r,h(ae,ae,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&p(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&p(s,e),i){const e=r.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*i}return s}requiresSlot(e,t){if(t===j.Color||t===j.Alpha||t===j.Highlight||t===j.ObjectAndLayerIdColor){if(e===U.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:r}=this.parameters;return e===(t?U.LABEL_MATERIAL:U.HUD_MATERIAL)||r&&e===U.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new Q(e)}calculateRelativeScreenBounds(e,t,r=y()){return $(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}}class Q extends L{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(J,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function $(e,t,r,s=se){return a(s,e.anchorPosition),s[0]*=-t[0],s[1]*=-t[1],s[0]+=e.screenOffset[0]*r,s[1]+=e.screenOffset[1]*r,s}function ee(e){const t=e[0],r=e[1],s=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+r*r+s*s),u=1/Math.sqrt(i*i+a*a+n*n),h=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*h,e[7]=c*h,e[8]=l*h,e}function te(e,t,r,s,i,a,n,o){let c=t-i-(o[0]>0?s[0]*o[0]:0),l=c+s[0]+2*i,f=r-i-(o[1]>0?s[1]*o[1]:0),u=f+s[1]+2*i;const h=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=h&&(c+=s[0]*h[0],f+=s[1]*h[1],l-=s[0]*(1-h[2]),u-=s[1]*(1-h[3]),c-=a,l+=a,f-=a,u+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const re=new B,se=n(),ie=v(),ae=v(),ne=b(),oe=v(),ce=v(),le=r(),fe=r(),ue=i(),he=v(),pe={normal:oe,cosAngle:0},me=i(),de=1,ge=2,Oe=[0,0],Se=A(0,0,1);class ve extends z{constructor(){super(...arguments),this.renderOccluded=R.Occlude,this.color=P(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=o(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.outlineColor=P(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.binaryHighlightOcclusion=!0,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const Ae=T().vec3f(N.POSITION).vec3f(N.NORMAL).vec2f(N.UV0).vec4u8(N.COLOR).vec2f(N.SIZE).vec4f(N.AUXPOS1).vec4f(N.AUXPOS2),be=Ae.clone().vec4u8(N.OBJECTANDLAYERIDCOLOR);class Pe{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?be:Ae}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 6*e.indices.get(N.POSITION).length}write(e,t,r,s,i){X(r.indices.get(N.POSITION),r.vertexAttributes.get(N.POSITION).data,e,s.position,i,6),H(r.indices.get(N.NORMAL),r.vertexAttributes.get(N.NORMAL).data,t,s.normal,i,6);const a=r.vertexAttributes.get(N.UV0).data;let n,o,c,l;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,c=e.texCoordScale[0],l=e.texCoordScale[1]}else n=a[0],o=a[1],c=a[2],l=a[3];c=Math.min(1.99999,c+1),l=Math.min(1.99999,l+1);let f=r.indices.get(N.POSITION).length,u=i;const h=s.uv0;for(let g=0;g<f;++g)h.set(u,0,n),h.set(u,1,o),u+=1,h.set(u,0,c),h.set(u,1,o),u+=1,h.set(u,0,c),h.set(u,1,l),u+=1,h.set(u,0,c),h.set(u,1,l),u+=1,h.set(u,0,n),h.set(u,1,l),u+=1,h.set(u,0,n),h.set(u,1,o),u+=1;G(r.indices.get(N.COLOR),r.vertexAttributes.get(N.COLOR).data,4,s.color,i,6);const p=r.indices.get(N.SIZE),m=r.vertexAttributes.get(N.SIZE).data;f=p.length;const d=s.size;u=i;for(let g=0;g<f;++g){const e=m[2*p[g]],t=m[2*p[g]+1];for(let r=0;r<6;++r)d.set(u,0,e),d.set(u,1,t),u+=1}if(r.indices.get(N.AUXPOS1)&&r.vertexAttributes.get(N.AUXPOS1)?k(r.indices.get(N.AUXPOS1),r.vertexAttributes.get(N.AUXPOS1).data,s.auxpos1,i,6):F(s.auxpos1,i,6*f),r.indices.get(N.AUXPOS2)&&r.vertexAttributes.get(N.AUXPOS2)?k(r.indices.get(N.AUXPOS2),r.vertexAttributes.get(N.AUXPOS2).data,s.auxpos2,i,6):F(s.auxpos2,i,6*f),null!=r.objectAndLayerIdColor){if(r.indices.get(N.POSITION)){const e=r.indices.get(N.POSITION).length,t=s.getField(N.OBJECTANDLAYERIDCOLOR,_);W(r.objectAndLayerIdColor,t,e,i,6)}}}}export{K as HUDMaterial,ve as Parameters};
5
+ import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{c as r}from"../../../../chunks/mat3f64.js";import{a as s}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/mat4f64.js";import{c as a}from"../../../../chunks/vec2.js";import{a as n,f as o}from"../../../../chunks/vec2f64.js";import{s as c,m as l,n as f,b as u,g as p,c as h,l as m,i as d,t as g,e as O,a as S}from"../../../../chunks/vec3.js";import{c as v,f as A}from"../../../../chunks/vec3f64.js";import{c as b,f as P}from"../../../../chunks/vec4f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as y}from"../../../../geometry/support/buffer/BufferView.js";import I from"../../support/debugFlags.js";import{newLayout as T}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as j}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as L,GLTextureMaterialBindParameters as z}from"../lib/GLTextureMaterial.js";import{Material as M,RenderOccludedFlag as R}from"../lib/Material.js";import{RenderSlot as U}from"../lib/RenderSlot.js";import{applyScaleFactor as E,applyPrecomputedScaleFactor as w,precomputeScaleFactor as D}from"../lib/screenSizePerspectiveUtils.js";import{assert as V}from"../lib/Util.js";import{VertexAttribute as N}from"../lib/VertexAttribute.js";import{ScaleInfo as B}from"./ScaleInfo.js";import{writePosition as X,writeNormal as H,writeColor as G,writeBufferVec4 as k,writeBufferVec4Zeros as F,writeObjectAndLayerIdColor as W}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as q}from"./internal/MaterialUtil.js";import{c as Z}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as J}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as Y}from"../shaders/HUDMaterialTechniqueConfiguration.js";class K extends M{constructor(e){super(e,new ve),this._configuration=new Y}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?C.Screen:C.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===U.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===j.Color||e===j.Alpha),e===j.Color&&(this._configuration.debugDrawLabelBorder=!!I.LABELS_SHOW_BORDER),e===j.Highlight&&(this._configuration.binaryHighlightOcclusionEnabled=this.parameters.binaryHighlightOcclusion),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassGeometry=t.multipassGeometry.enabled,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,r,i,a,n,o){if(!i.options.selectionMode||!i.options.hud||!e.visible)return;const g=this.parameters;let O=1,S=1;if(t(le,r),null!=e.shaderTransformer){const t=e.shaderTransformer(me);O=t[0],S=t[5],ee(le)}const A=e.vertexAttributes.get(N.POSITION),b=e.vertexAttributes.get(N.SIZE),P=e.vertexAttributes.get(N.NORMAL),x=e.vertexAttributes.get(N.AUXPOS1);V(A.size>=3);const _=i.point,y=i.camera,I=Z(g);O*=y.pixelRatio,S*=y.pixelRatio;const T="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<A.data.length/A.size;t++){const e=t*A.size;c(ie,A.data[e],A.data[e+1],A.data[e+2]),l(ie,ie,r);const a=t*b.size;Oe[0]=b.data[a]*O,Oe[1]=b.data[a+1]*S,l(ie,ie,y.viewMatrix);const n=t*x.size;if(c(pe,x.data[n],x.data[n+1],x.data[n+2]),!T&&(ie[0]+=pe[0],ie[1]+=pe[1],0!==pe[2])){const e=pe[2];f(pe,ie),u(ie,ie,p(pe,pe,e))}const j=t*P.size;if(c(ae,P.data[j],P.data[j+1],P.data[j+2]),this._normalAndViewAngle(ae,le,y,he),this._applyVerticalOffsetTransformationView(ie,he,y,re),y.applyProjection(ie,ne),ne[0]>-1){ne[0]=Math.floor(ne[0]),ne[1]=Math.floor(ne[1]),T&&(pe[0]||pe[1])&&(ne[0]+=pe[0],0!==pe[1]&&(ne[1]+=E(pe[1],re.factorAlignment)),y.unapplyProjection(ne,ie)),ne[0]+=this.parameters.screenOffset[0],ne[1]+=this.parameters.screenOffset[1],w(Oe,re.factor,Oe);const e=de*y.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*y.pixelRatio/2),_&&te(_,ne[0],ne[1],Oe,e,t,g,I)){const e=i.ray;if(l(ce,ie,s(ue,y.viewMatrix)),ne[0]=_[0],ne[1]=_[1],y.unprojectFromRenderScreen(ne,ie)){const t=v();h(t,e.direction);const r=1/m(t);p(t,t,r);o(d(e.origin,ie)*r,t,-1,!0,1,ce)}}}}}intersectDraped(e,t,r,s,i,a){const n=e.vertexAttributes.get(N.POSITION),o=e.vertexAttributes.get(N.SIZE),c=this.parameters,l=Z(c);let f=1,u=1;if(null!=e.shaderTransformer){const t=e.shaderTransformer(me);f=t[0],u=t[5]}f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=ge*e.screenToWorldRatio;for(let h=0;h<n.data.length/n.size;h++){const t=h*n.size,r=n.data[t],m=n.data[t+1],d=h*o.size;Oe[0]=o.data[d]*f,Oe[1]=o.data[d+1]*u;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),te(s,r,m,Oe,p,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new Pe(this)}_normalAndViewAngle(e,r,s,i){return x(r)&&(r=t(fe,r)),g(i.normal,e,r),l(i.normal,i.normal,s.viewInverseTransposeMatrix),i.cosAngle=O(oe,Se),i}_updateScaleInfo(e,t,r){const s=this.parameters;null!=s.screenSizePerspective?D(r,t,s.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minPixelSize=0,e.factor.paddingPixels=0),null!=s.screenSizePerspectiveAlignment?D(r,t,s.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minPixelSize=e.factor.minPixelSize,e.factorAlignment.paddingPixels=e.factor.paddingPixels)}applyShaderOffsetsView(e,t,r,s,i,a,n){const o=this._normalAndViewAngle(t,r,i,he);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,s[3],i,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,r,s,i){return this._applyCenterOffsetNDC(e,t,r,s),null!=i&&h(i,s),this._applyPolygonOffsetNDC(s,t,r,s),s}_applyPolygonOffsetView(t,r,s,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const l=e(Math.abs(r.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return p(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,r,s){const i=m(e),a=r.aboveGround?1:-1,n=.5*r.computeRenderPixelSizeAtDist(i),o=p(ie,t.normal,a*n);return S(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,r,s){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const r=m(e);this._updateScaleInfo(s,r,t.cosAngle)}else s.factor.scale=1,s.factorAlignment.scale=1;return e}const a=m(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=q(r,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(s,a,t.cosAngle),p(t.normal,t.normal,o),S(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(f(ae,r),S(r,r,p(ae,ae,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&h(s,e),i){const e=r.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*i}return s}requiresSlot(e,t){if(t===j.Color||t===j.Alpha||t===j.Highlight||t===j.ObjectAndLayerIdColor){if(e===U.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:r}=this.parameters;return e===(t?U.LABEL_MATERIAL:U.HUD_MATERIAL)||r&&e===U.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new Q(e)}calculateRelativeScreenBounds(e,t,r=_()){return $(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}}class Q extends L{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(J,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function $(e,t,r,s=se){return a(s,e.anchorPosition),s[0]*=-t[0],s[1]*=-t[1],s[0]+=e.screenOffset[0]*r,s[1]+=e.screenOffset[1]*r,s}function ee(e){const t=e[0],r=e[1],s=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+r*r+s*s),u=1/Math.sqrt(i*i+a*a+n*n),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function te(e,t,r,s,i,a,n,o){let c=t-i-(o[0]>0?s[0]*o[0]:0),l=c+s[0]+2*i,f=r-i-(o[1]>0?s[1]*o[1]:0),u=f+s[1]+2*i;const p=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=p&&(c+=s[0]*p[0],f+=s[1]*p[1],l-=s[0]*(1-p[2]),u-=s[1]*(1-p[3]),c-=a,l+=a,f-=a,u+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const re=new B,se=n(),ie=v(),ae=v(),ne=b(),oe=v(),ce=v(),le=r(),fe=r(),ue=i(),pe=v(),he={normal:oe,cosAngle:0},me=i(),de=1,ge=2,Oe=[0,0],Se=A(0,0,1);class ve extends z{constructor(){super(...arguments),this.renderOccluded=R.Occlude,this.color=P(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=o(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.outlineColor=P(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.binaryHighlightOcclusion=!0,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const Ae=T().vec3f(N.POSITION).vec3f(N.NORMAL).vec2f(N.UV0).vec4u8(N.COLOR).vec2f(N.SIZE).vec4f(N.AUXPOS1).vec4f(N.AUXPOS2),be=Ae.clone().vec4u8(N.OBJECTANDLAYERIDCOLOR);class Pe{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?be:Ae}elementCount(e){return 6*e.indices.get(N.POSITION).length}write(e,t,r,s,i){X(r.indices.get(N.POSITION),r.vertexAttributes.get(N.POSITION).data,e,s.position,i,6),H(r.indices.get(N.NORMAL),r.vertexAttributes.get(N.NORMAL).data,t,s.normal,i,6);const a=r.vertexAttributes.get(N.UV0).data;let n,o,c,l;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,c=e.texCoordScale[0],l=e.texCoordScale[1]}else n=a[0],o=a[1],c=a[2],l=a[3];c=Math.min(1.99999,c+1),l=Math.min(1.99999,l+1);let f=r.indices.get(N.POSITION).length,u=i;const p=s.uv0;for(let g=0;g<f;++g)p.set(u,0,n),p.set(u,1,o),u+=1,p.set(u,0,c),p.set(u,1,o),u+=1,p.set(u,0,c),p.set(u,1,l),u+=1,p.set(u,0,c),p.set(u,1,l),u+=1,p.set(u,0,n),p.set(u,1,l),u+=1,p.set(u,0,n),p.set(u,1,o),u+=1;G(r.indices.get(N.COLOR),r.vertexAttributes.get(N.COLOR).data,4,s.color,i,6);const h=r.indices.get(N.SIZE),m=r.vertexAttributes.get(N.SIZE).data;f=h.length;const d=s.size;u=i;for(let g=0;g<f;++g){const e=m[2*h[g]],t=m[2*h[g]+1];for(let r=0;r<6;++r)d.set(u,0,e),d.set(u,1,t),u+=1}if(r.indices.get(N.AUXPOS1)&&r.vertexAttributes.get(N.AUXPOS1)?k(r.indices.get(N.AUXPOS1),r.vertexAttributes.get(N.AUXPOS1).data,s.auxpos1,i,6):F(s.auxpos1,i,6*f),r.indices.get(N.AUXPOS2)&&r.vertexAttributes.get(N.AUXPOS2)?k(r.indices.get(N.AUXPOS2),r.vertexAttributes.get(N.AUXPOS2).data,s.auxpos2,i,6):F(s.auxpos2,i,6*f),null!=r.objectAndLayerIdColor){if(r.indices.get(N.POSITION)){const e=r.indices.get(N.POSITION).length,t=s.getField(N.OBJECTANDLAYERIDCOLOR,y);W(r.objectAndLayerIdColor,t,e,i,6)}}}}export{K as HUDMaterial,ve as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as T}from"../shaders/HeatmapDensityTechnique.js";const h=2;class p extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends o{constructor(t){super(t,new p),this._configuration=new m}requiresSlot(t,e){return t===n.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new A(t)}intersect(){}intersectDraped(r,s,i,a,o,n){const l=r.vertexAttributes.get(u.POSITION),{parameters:c}=this,{searchRadius:f}=c,{screenToWorldRatio:m}=r,T=f*m+h*m,p=T*T,d=l.data.length/l.size;for(let u=0;u<d;u++){const r=u*l.size,s=t(E,l.data[r],l.data[r+1]);e(s,a)<p&&o(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new I(this.parameters.isAttributeDriven?g:b)}}class A extends a{beginSlot(t){return this.ensureTechnique(T,t)}}class I{constructor(t){this.vertexBufferLayout=t}allocate(t){return this.vertexBufferLayout.createBuffer(t)}elementCount(t){return t.indices.get(u.POSITION).length*v}write(t,e,r,s,i){l(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,t,s.position,i,v);const a=r.indices.get(u.POSITION).length,o=s.uv0;let n=i;for(let u=0;u<a;++u)o.setValues(n++,-1,-1),o.setValues(n++,1,-1),o.setValues(n++,1,1),o.setValues(n++,1,1),o.setValues(n++,-1,1),o.setValues(n++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&c(r.indices.get(u.FEATUREATTRIBUTE),r.vertexAttributes.get(u.FEATUREATTRIBUTE).data,f,i,v)}}const b=s().vec3f(u.POSITION).vec2f(u.UV0),g=b.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{d as HeatmapDensityMaterial,p as HeatmapDensityMaterialParameters};
5
+ import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as T}from"../shaders/HeatmapDensityTechnique.js";const h=2;class p extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends o{constructor(t){super(t,new p),this._configuration=new m}requiresSlot(t,e){return t===n.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new A(t)}intersect(){}intersectDraped(r,s,i,a,o,n){const l=r.vertexAttributes.get(u.POSITION),{parameters:c}=this,{searchRadius:f}=c,{screenToWorldRatio:m}=r,T=f*m+h*m,p=T*T,d=l.data.length/l.size;for(let u=0;u<d;u++){const r=u*l.size,s=t(E,l.data[r],l.data[r+1]);e(s,a)<p&&o(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new I(this.parameters.isAttributeDriven?g:b)}}class A extends a{beginSlot(t){return this.ensureTechnique(T,t)}}class I{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.indices.get(u.POSITION).length*v}write(t,e,r,s,i){l(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,t,s.position,i,v);const a=r.indices.get(u.POSITION).length,o=s.uv0;let n=i;for(let u=0;u<a;++u)o.setValues(n++,-1,-1),o.setValues(n++,1,-1),o.setValues(n++,1,1),o.setValues(n++,1,1),o.setValues(n++,-1,1),o.setValues(n++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&c(r.indices.get(u.FEATUREATTRIBUTE),r.vertexAttributes.get(u.FEATUREATTRIBUTE).data,f,i,v)}}const b=s().vec3f(u.POSITION).vec2f(u.UV0),g=b.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{d as HeatmapDensityMaterial,p as HeatmapDensityMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{f as e}from"../../../../chunks/vec2f32.js";import{Z as t}from"../../../../chunks/vec2f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as s}from"../core/shaderLibrary/hud/HUD.glsl.js";import n from"../lib/GLMaterial.js";import{Material as a,MaterialParameters as o}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as l,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as d}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";class p extends a{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new O),this._configuration=new m,this._uniqueMaterialIdentifier=p.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,t){const r=t?.slot!==u.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?s.Screen:s.World,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasMultipassGeometry=t.multipassGeometry.enabled,this._configuration}intersect(){}requiresSlot(e,t){if(t===i.Color)switch(e){case u.LINE_CALLOUTS:case u.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new g(e)}createBufferWriter(){return new I}validateParameters(e){const t=p.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({screenOffset:e.screenOffset||[0,0],centerOffsetUnits:e.centerOffsetUnits||"world"})}}class g extends n{beginSlot(e){return this.ensureTechnique(d,e)}}class O extends o{constructor(){super(...arguments),this.screenOffset=t,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const S=r().vec3f(c.POSITION).vec3f(c.NORMAL).vec2f(c.UV0).vec4f(c.AUXPOS1),L=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class I{constructor(){this.vertexBufferLayout=S}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 6*e.indices.get(c.POSITION).length}write(e,t,r,i,s){f(r.indices.get(c.POSITION),r.vertexAttributes.get(c.POSITION).data,e,i.position,s,6),l(r.indices.get(c.NORMAL),r.vertexAttributes.get(c.NORMAL).data,t,i.normal,s,6),h(r.indices.get(c.AUXPOS1),r.vertexAttributes.get(c.AUXPOS1).data,i.auxpos1,s,6);for(let n=0;n<L.length;++n)i.uv0.setVec(s+n,L[n])}}export{p as LineCalloutMaterial,O as Parameters};
5
+ import{f as e}from"../../../../chunks/vec2f32.js";import{Z as t}from"../../../../chunks/vec2f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as s}from"../core/shaderLibrary/hud/HUD.glsl.js";import n from"../lib/GLMaterial.js";import{Material as a,MaterialParameters as o}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as l,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as d}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";class p extends a{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new O),this._configuration=new m,this._uniqueMaterialIdentifier=p.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,t){const r=t?.slot!==u.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?s.Screen:s.World,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasMultipassGeometry=t.multipassGeometry.enabled,this._configuration}intersect(){}requiresSlot(e,t){if(t===i.Color)switch(e){case u.LINE_CALLOUTS:case u.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new g(e)}createBufferWriter(){return new L}validateParameters(e){const t=p.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({screenOffset:e.screenOffset||[0,0],centerOffsetUnits:e.centerOffsetUnits||"world"})}}class g extends n{beginSlot(e){return this.ensureTechnique(d,e)}}class O extends o{constructor(){super(...arguments),this.screenOffset=t,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const S=r().vec3f(c.POSITION).vec3f(c.NORMAL).vec2f(c.UV0).vec4f(c.AUXPOS1),I=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class L{constructor(){this.vertexBufferLayout=S}elementCount(e){return 6*e.indices.get(c.POSITION).length}write(e,t,r,i,s){f(r.indices.get(c.POSITION),r.vertexAttributes.get(c.POSITION).data,e,i.position,s,6),l(r.indices.get(c.NORMAL),r.vertexAttributes.get(c.NORMAL).data,t,i.normal,s,6),h(r.indices.get(c.AUXPOS1),r.vertexAttributes.get(c.AUXPOS1).data,i.auxpos1,s,6);for(let n=0;n<I.length;++n)i.uv0.setVec(s+n,I[n])}}export{p as LineCalloutMaterial,O as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{s as e,F as t,m as r}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as o}from"../lib/GLTextureMaterial.js";import{Material as n,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as l,LineMarkerTechnique as m}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d,LineMarkerSpace as T,LineMarkerAnchor as A}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as f}from"../shaders/RibbonLineTechniqueConfiguration.js";class v extends n{constructor(e){super(e,new E),this._vertexAttributeLocations=l,this._configuration=new d,this._layout=this.createLayout()}dispose(){}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===u.DRAPED_MATERIAL?T.Draped:this.parameters.worldSpace?T.World:T.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==f.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=s().vec3f(c.POSITION).vec2f(c.UV0).vec3f(c.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(c.NORMAL),this.parameters.vvSize?e.f32(c.SIZEFEATUREATTRIBUTE):e.f32(c.SIZE),this.parameters.vvColor?e.f32(c.COLORFEATUREATTRIBUTE):e.vec4f(c.COLOR),this.parameters.vvOpacity&&e.f32(c.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new S(this._layout,this.parameters)}requiresSlot(e,t){if(t===a.Color||t===a.Alpha||t===a.Highlight||t===a.Depth){if(e===u.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===u.OPAQUE_MATERIAL||e===u.OCCLUDER_MATERIAL||e===u.TRANSPARENT_OCCLUDER_MATERIAL;if(t===a.Color||t===a.Alpha){return e===(this.parameters.writeDepth?u.TRANSPARENT_MATERIAL:u.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===u.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new _(e)}}class _ extends o{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(m,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class E extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=f.BUTT,this.anchor=A.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class S{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,a,o,n){const h=a.vertexAttributes.get(c.POSITION).data,u=h.length/3;let p=[1,0,0];const l=a.vertexAttributes.get(c.NORMAL);this._parameters.worldSpace&&null!=l&&(p=l.data);let m=1,d=0;this._parameters.vvSize?d=a.vertexAttributes.get(c.SIZEFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(c.SIZE)&&(m=a.vertexAttributes.get(c.SIZE).data[0]);let T=[1,1,1,1],A=0;this._parameters.vvColor?A=a.vertexAttributes.get(c.COLORFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(c.COLOR)&&(T=a.vertexAttributes.get(c.COLOR).data);let f=0;this._parameters.vvOpacity&&(f=a.vertexAttributes.get(c.OPACITYFEATUREATTRIBUTE).data[0]);const v=new Float32Array(o.buffer);let _=n*(this.vertexBufferLayout.stride/4);const E=(e,t,r,i)=>{if(v[_++]=e[0],v[_++]=e[1],v[_++]=e[2],v[_++]=r[0],v[_++]=r[1],v[_++]=t[0],v[_++]=t[1],v[_++]=t[2],this._parameters.worldSpace&&(v[_++]=p[0],v[_++]=p[1],v[_++]=p[2]),this._parameters.vvSize?v[_++]=d:v[_++]=m,this._parameters.vvColor)v[_++]=A;else{const e=Math.min(4*i,T.length-4);v[_++]=T[e],v[_++]=T[e+1],v[_++]=T[e+2],v[_++]=T[e+3]}this._parameters.vvOpacity&&(v[_++]=f)};let S;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(S||(S={}));const g=(s,a)=>{const o=e(O,h[3*s],h[3*s+1],h[3*s+2]),n=R;let c=s+a;do{e(n,h[3*c],h[3*c+1],h[3*c+2]),c+=a}while(t(o,n)&&c>=0&&c<u);i&&(r(o,o,i),r(n,n,i)),E(o,n,[-1,-1],s),E(o,n,[1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,1],s)},I=this._parameters.placement;"begin"!==I&&"begin-end"!==I||g(0,S.ASCENDING),"end"!==I&&"begin-end"!==I||g(u-1,S.DESCENDING)}}const O=i(),R=i();export{v as LineMarkerMaterial,E as Parameters};
5
+ import{s as e,F as t,m as r}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as o}from"../lib/GLTextureMaterial.js";import{Material as n,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as l,LineMarkerTechnique as m}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d,LineMarkerSpace as T,LineMarkerAnchor as A}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as _}from"../shaders/RibbonLineTechniqueConfiguration.js";class v extends n{constructor(e){super(e,new E),this._vertexAttributeLocations=l,this._configuration=new d,this._layout=this.createLayout()}dispose(){}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===c.DRAPED_MATERIAL?T.Draped:this.parameters.worldSpace?T.World:T.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==_.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=s().vec3f(u.POSITION).vec2f(u.UV0).vec3f(u.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(u.NORMAL),this.parameters.vvSize?e.f32(u.SIZEFEATUREATTRIBUTE):e.f32(u.SIZE),this.parameters.vvColor?e.f32(u.COLORFEATUREATTRIBUTE):e.vec4f(u.COLOR),this.parameters.vvOpacity&&e.f32(u.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new S(this._layout,this.parameters)}requiresSlot(e,t){if(t===a.Color||t===a.Alpha||t===a.Highlight||t===a.Depth){if(e===c.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===c.OPAQUE_MATERIAL||e===c.OCCLUDER_MATERIAL||e===c.TRANSPARENT_OCCLUDER_MATERIAL;if(t===a.Color||t===a.Alpha){return e===(this.parameters.writeDepth?c.TRANSPARENT_MATERIAL:c.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===c.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new f(e)}}class f extends o{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(m,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class E extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=_.BUTT,this.anchor=A.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class S{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,a,o,n){const h=a.vertexAttributes.get(u.POSITION).data,c=h.length/3;let p=[1,0,0];const l=a.vertexAttributes.get(u.NORMAL);this._parameters.worldSpace&&null!=l&&(p=l.data);let m=1,d=0;this._parameters.vvSize?d=a.vertexAttributes.get(u.SIZEFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.SIZE)&&(m=a.vertexAttributes.get(u.SIZE).data[0]);let T=[1,1,1,1],A=0;this._parameters.vvColor?A=a.vertexAttributes.get(u.COLORFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.COLOR)&&(T=a.vertexAttributes.get(u.COLOR).data);let _=0;this._parameters.vvOpacity&&(_=a.vertexAttributes.get(u.OPACITYFEATUREATTRIBUTE).data[0]);const v=new Float32Array(o.buffer);let f=n*(this.vertexBufferLayout.stride/4);const E=(e,t,r,i)=>{if(v[f++]=e[0],v[f++]=e[1],v[f++]=e[2],v[f++]=r[0],v[f++]=r[1],v[f++]=t[0],v[f++]=t[1],v[f++]=t[2],this._parameters.worldSpace&&(v[f++]=p[0],v[f++]=p[1],v[f++]=p[2]),this._parameters.vvSize?v[f++]=d:v[f++]=m,this._parameters.vvColor)v[f++]=A;else{const e=Math.min(4*i,T.length-4);v[f++]=T[e],v[f++]=T[e+1],v[f++]=T[e+2],v[f++]=T[e+3]}this._parameters.vvOpacity&&(v[f++]=_)};let S;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(S||(S={}));const g=(s,a)=>{const o=e(O,h[3*s],h[3*s+1],h[3*s+2]),n=R;let u=s+a;do{e(n,h[3*u],h[3*u+1],h[3*u+2]),u+=a}while(t(o,n)&&u>=0&&u<c);i&&(r(o,o,i),r(n,n,i)),E(o,n,[-1,-1],s),E(o,n,[1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,1],s)},I=this._parameters.placement;"begin"!==I&&"begin-end"!==I||g(0,S.ASCENDING),"end"!==I&&"begin-end"!==I||g(c-1,S.DESCENDING)}}const O=i(),R=i();export{v as LineMarkerMaterial,E as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,n as e,b as r,f as s,i as o,m as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as l,MaterialParameters as p}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends l{constructor(t){super(t,new v),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}dispose(){}intersect(){}requiresSlot(t,e){if(e===u.Color||e===u.Alpha){return t===(this._transparent?h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){return new y}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class A extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class v extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const T=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),I=i(),_=i(),b=i(),L=i(),S=i();class y{constructor(){this.vertexBufferLayout=T}allocate(t){return this.vertexBufferLayout.createBuffer(t)}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(i,a,c,u,f){const l=c.vertexAttributes.get(m.POSITION).data,p=c.vertexAttributes.get(m.NORMAL).data,h=l.length/3,d=c&&c.indices&&c.indices.get(m.POSITION);d&&d.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=I,O=_,A=b,v=L,T=S,y=u.position,j=u.normal,x=u.uv0;let E=0;for(let m=0;m<h;++m){const c=3*m;if(t(g,l[c],l[c+1],l[c+2]),m<h-1){const o=3*(m+1);t(O,l[o],l[o+1],l[o+2]),t(T,p[o],p[o+1],p[o+2]),e(T,T),r(A,O,g),e(A,A),s(v,T,A),e(v,v)}const u=o(g,O);i&&a&&(n(g,g,i),n(O,O,i),n(v,v,a));const d=f+2*m,I=d+1;y.setVec(d,g),y.setVec(I,g),j.setVec(d,v),j.setVec(I,v),x.set(d,0,E),x.set(d,1,-1),x.set(I,0,E),x.set(I,1,1),m<h-1&&(E+=u)}const M=u.auxpos1;for(let t=0;t<2*h;++t)M.set(f+t,E)}}export{O as MeasurementArrowMaterial,v as Parameters};
5
+ import{s as t,n as e,b as r,f as s,i as o,m as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as l,MaterialParameters as p}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends l{constructor(t){super(t,new T),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}dispose(){}intersect(){}requiresSlot(t,e){if(e===u.Color||e===u.Alpha){return t===(this._transparent?h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){return new j}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class A extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class T extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const v=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),I=i(),_=i(),b=i(),S=i(),L=i();class j{constructor(){this.vertexBufferLayout=v}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(i,a,c,u,f){const l=c.vertexAttributes.get(m.POSITION).data,p=c.vertexAttributes.get(m.NORMAL).data,h=l.length/3,d=c&&c.indices&&c.indices.get(m.POSITION);d&&d.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=I,O=_,A=b,T=S,v=L,j=u.position,y=u.normal,E=u.uv0;let M=0;for(let m=0;m<h;++m){const c=3*m;if(t(g,l[c],l[c+1],l[c+2]),m<h-1){const o=3*(m+1);t(O,l[o],l[o+1],l[o+2]),t(v,p[o],p[o+1],p[o+2]),e(v,v),r(A,O,g),e(A,A),s(T,v,A),e(T,T)}const u=o(g,O);i&&a&&(n(g,g,i),n(O,O,i),n(T,T,a));const d=f+2*m,I=d+1;j.setVec(d,g),j.setVec(I,g),y.setVec(d,T),y.setVec(I,T),E.set(d,0,M),E.set(d,1,-1),E.set(I,0,M),E.set(I,1,1),m<h-1&&(M+=u)}const P=u.auxpos1;for(let t=0;t<2*h;++t)P.set(f+t,M)}}export{O as MeasurementArrowMaterial,T as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{c as s}from"../../../../chunks/vec2.js";import{s as i,b as o,e as n,g as a,a as l,c as u,l as c,i as p,m as f}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{O as m}from"../../../../chunks/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as g,distance2 as A,fromPoints as _,closestLineSegmentPoint as O}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as T,signedDistance as P,normal as j}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as b,BufferViewVec2f as x}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as y}from"../core/shaderLibrary/ShaderOutput.js";import v from"../lib/GLMaterial.js";import{Material as R,MaterialParameters as E}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as I}from"../lib/Util.js";import{VertexAttribute as L}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{PositionColorLayout as C,PositionLayout as U}from"./DefaultLayouts.js";import{writeDefaultAttributes as V}from"./internal/bufferWriterUtils.js";import{NativeLineTechnique as B}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as M}from"../shaders/NativeLineTechniqueConfiguration.js";var D;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(D||(D={}));class X extends R{constructor(e){super(e,new W),this._configuration=new M}getConfiguration(e,t){this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._configuration}intersect(t,r,f,h,m,g){if(!f.options.selectionMode||!t.visible)return;if(!I(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const S=t.vertexAttributes.get(L.POSITION).data,b=f.camera,x=ee;s(x,f.point);const y=2;i(te[0],x[0]-y,x[1]+y,0),i(te[1],x[0]+y,x[1]+y,0),i(te[2],x[0]+y,x[1]-y,0),i(te[3],x[0]-y,x[1]-y,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(te[e],re[e]))return;T(b.eye,re[0],re[1],se),T(b.eye,re[1],re[2],ie),T(b.eye,re[2],re[3],oe),T(b.eye,re[3],re[0],ne);let v=Number.MAX_VALUE,R=0;for(let e=0;e<S.length-5;e+=3){if(F[0]=S[e]+r[12],F[1]=S[e+1]+r[13],F[2]=S[e+2]+r[14],G[0]=S[e+3]+r[12],G[1]=S[e+4]+r[13],G[2]=S[e+5]+r[14],P(se,F)<0&&P(se,G)<0||P(ie,F)<0&&P(ie,G)<0||P(oe,F)<0&&P(oe,G)<0||P(ne,F)<0&&P(ne,G)<0)continue;if(b.projectToRenderScreen(F,Z),b.projectToRenderScreen(G,z),Z[2]<0&&z[2]>0){o(H,F,G);const e=b.frustum,t=-P(e[d.NEAR],F)/n(H,j(e[d.NEAR]));a(H,H,t),l(F,F,H),b.projectToRenderScreen(F,Z)}else if(Z[2]>0&&z[2]<0){o(H,G,F);const e=b.frustum,t=-P(e[d.NEAR],G)/n(H,j(e[d.NEAR]));a(H,H,t),l(G,G,H),b.projectToRenderScreen(G,z)}else if(Z[2]<0&&z[2]<0)continue;Z[2]=0,z[2]=0;const t=A(_(Z,z,Y),x);t<v&&(v=t,u(J,F),u(K,G),R=e/3)}const E=f.rayBegin,N=f.rayEnd;if(v<y*y){let e=Number.MAX_VALUE;if(O(_(J,K,Y),_(E,N,$),Q)){o(Q,Q,E);const t=c(Q);a(Q,Q,1/t),e=t/p(E,N)}g(e,Q,R,!1)}}intersectDraped(e,r,s,i,o,n){if(!s.options.selectionMode)return;const a=e.vertexAttributes.get(L.POSITION).data,l=e.vertexAttributes.get(L.SIZE),u=l?l.data[0]:0,c=i[0],p=i[1],f=((u+1)/2+4)*e.screenToWorldRatio;let h=Number.MAX_VALUE,m=0;for(let d=0;d<a.length-5;d+=3){const e=a[d],r=a[d+1],s=c-e,i=p-r,o=a[d+3]-e,n=a[d+4]-r,l=t((o*s+n*i)/(o*o+n*n),0,1),u=o*l-s,f=n*l-i,g=u*u+f*f;g<h&&(h=g,m=d/3)}h<f*f&&o(n.dist,n.normal,m,!1)}requiresSlot(e,t){return!(t!==y.Color&&t!==y.Highlight&&t!==y.ObjectAndLayerIdColor||e!==N.OPAQUE_MATERIAL&&e!==N.DRAPED_MATERIAL)}createGLMaterial(e){return new k(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?C:U;return null==this.parameters.stipplePattern?new w(e):new q(e.clone().vec3f(L.AUXPOS1).vec2f(L.UV0))}}class k extends v{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===y.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(B,e)}}class q{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(L.POSITION).length}write(e,t,r,s,i){V(r,this.vertexBufferLayout,e,t,s,i),this._writeAuxpos1(e,r,s,i),this._writeUV0(e,r,s,i)}_writeAuxpos1(e,t,r,s){const i=r.getField(L.AUXPOS1,b),o=t.indices.get(L.POSITION),n=t.vertexAttributes.get(L.POSITION).data,a=e,l=i.typedBufferStride,u=i.typedBuffer;s*=l;for(let c=0;c<o.length-1;c+=2)for(const e of[1,0]){const t=3*o[c+e],r=n[t],i=n[t+1],p=n[t+2],f=a[0]*r+a[4]*i+a[8]*p+a[12],h=a[1]*r+a[5]*i+a[9]*p+a[13],m=a[2]*r+a[6]*i+a[10]*p+a[14];u[s]=f,u[s+1]=h,u[s+2]=m,s+=l}}_writeUV0(e,t,r,s){const o=r.getField(L.UV0,x),n=t.indices.get(L.POSITION),a=t.vertexAttributes.get(L.POSITION).data,l=t.vertexAttributes.get(L.DISTANCETOSTART)?.data,c=o.typedBufferStride,h=o.typedBuffer;let m=0;h[s*=c]=D.START,h[s+1]=m,s+=c;const d=3*n[0],g=i(F,a[d],a[d+1],a[d+2]);e&&f(g,g,e);const A=G,_=n.length-1;let O=1;const S=l?(e,t,r)=>m=l[r]:(e,t,r)=>m+=p(e,t);for(let p=1;p<_;p+=2){const t=3*n[p];i(A,a[t],a[t+1],a[t+2]),e&&f(A,A,e),S(g,A,O++);for(let e=0;e<2;++e)h[s]=1-e,h[s+1]=m,s+=c;u(g,A)}const T=3*n[_];i(A,a[T],a[T+1],a[T+2]),e&&f(A,A,e),S(g,A,O),h[s]=D.END,h[s+1]=m}}class W extends E{constructor(){super(...arguments),this.color=m,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.stipplePreferContinuous=!0,this.hasOccludees=!1,this.stippleTexture=null}}const F=h(),G=h(),H=h(),Q=h(),Z=r(),z=r(),J=h(),K=h(),Y=g(),$=g(),ee=h(),te=[r(),r(),r(),r()],re=[h(),h(),h(),h()],se=S(),ie=S(),oe=S(),ne=S();export{X as NativeLineMaterial,W as Parameters};
5
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{c as s}from"../../../../chunks/vec2.js";import{s as i,b as o,e as n,g as a,a as l,c,l as u,i as p,m as f}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{O as h}from"../../../../chunks/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as g,distance2 as A,fromPoints as _,closestLineSegmentPoint as O}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as T,signedDistance as P,normal as j}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as b,BufferViewVec2f as x}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as y}from"../core/shaderLibrary/ShaderOutput.js";import R from"../lib/GLMaterial.js";import{Material as v,MaterialParameters as E}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as I}from"../lib/Util.js";import{VertexAttribute as L}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{PositionColorLayout as C,PositionLayout as U}from"./DefaultLayouts.js";import{writeDefaultAttributes as V}from"./internal/bufferWriterUtils.js";import{NativeLineTechnique as M}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as D}from"../shaders/NativeLineTechniqueConfiguration.js";var B;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(B||(B={}));class X extends v{constructor(e){super(e,new W),this._configuration=new D}getConfiguration(e,t){this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._configuration}intersect(t,r,f,m,h,g){if(!f.options.selectionMode||!t.visible)return;if(!I(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const S=t.vertexAttributes.get(L.POSITION).data,b=f.camera,x=ee;s(x,f.point);const y=2;i(te[0],x[0]-y,x[1]+y,0),i(te[1],x[0]+y,x[1]+y,0),i(te[2],x[0]+y,x[1]-y,0),i(te[3],x[0]-y,x[1]-y,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(te[e],re[e]))return;T(b.eye,re[0],re[1],se),T(b.eye,re[1],re[2],ie),T(b.eye,re[2],re[3],oe),T(b.eye,re[3],re[0],ne);let R=Number.MAX_VALUE,v=0;for(let e=0;e<S.length-5;e+=3){if(F[0]=S[e]+r[12],F[1]=S[e+1]+r[13],F[2]=S[e+2]+r[14],G[0]=S[e+3]+r[12],G[1]=S[e+4]+r[13],G[2]=S[e+5]+r[14],P(se,F)<0&&P(se,G)<0||P(ie,F)<0&&P(ie,G)<0||P(oe,F)<0&&P(oe,G)<0||P(ne,F)<0&&P(ne,G)<0)continue;if(b.projectToRenderScreen(F,Z),b.projectToRenderScreen(G,z),Z[2]<0&&z[2]>0){o(H,F,G);const e=b.frustum,t=-P(e[d.NEAR],F)/n(H,j(e[d.NEAR]));a(H,H,t),l(F,F,H),b.projectToRenderScreen(F,Z)}else if(Z[2]>0&&z[2]<0){o(H,G,F);const e=b.frustum,t=-P(e[d.NEAR],G)/n(H,j(e[d.NEAR]));a(H,H,t),l(G,G,H),b.projectToRenderScreen(G,z)}else if(Z[2]<0&&z[2]<0)continue;Z[2]=0,z[2]=0;const t=A(_(Z,z,Y),x);t<R&&(R=t,c(J,F),c(K,G),v=e/3)}const E=f.rayBegin,N=f.rayEnd;if(R<y*y){let e=Number.MAX_VALUE;if(O(_(J,K,Y),_(E,N,$),Q)){o(Q,Q,E);const t=u(Q);a(Q,Q,1/t),e=t/p(E,N)}g(e,Q,v,!1)}}intersectDraped(e,r,s,i,o,n){if(!s.options.selectionMode)return;const a=e.vertexAttributes.get(L.POSITION).data,l=e.vertexAttributes.get(L.SIZE),c=l?l.data[0]:0,u=i[0],p=i[1],f=((c+1)/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,h=0;for(let d=0;d<a.length-5;d+=3){const e=a[d],r=a[d+1],s=u-e,i=p-r,o=a[d+3]-e,n=a[d+4]-r,l=t((o*s+n*i)/(o*o+n*n),0,1),c=o*l-s,f=n*l-i,g=c*c+f*f;g<m&&(m=g,h=d/3)}m<f*f&&o(n.dist,n.normal,h,!1)}requiresSlot(e,t){return!(t!==y.Color&&t!==y.Highlight&&t!==y.ObjectAndLayerIdColor||e!==N.OPAQUE_MATERIAL&&e!==N.DRAPED_MATERIAL)}createGLMaterial(e){return new k(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?C:U;return null==this.parameters.stipplePattern?new w(e):new q(e.clone().vec3f(L.AUXPOS1).vec2f(L.UV0))}}class k extends R{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===y.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(M,e)}}class q{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.indices.get(L.POSITION).length}write(e,t,r,s,i){V(r,this.vertexBufferLayout,e,t,s,i),this._writeAuxpos1(e,r,s,i),this._writeUV0(e,r,s,i)}_writeAuxpos1(e,t,r,s){const i=r.getField(L.AUXPOS1,b),o=t.indices.get(L.POSITION),n=t.vertexAttributes.get(L.POSITION).data,a=e,l=i.typedBufferStride,c=i.typedBuffer;s*=l;for(let u=0;u<o.length-1;u+=2)for(const e of[1,0]){const t=3*o[u+e],r=n[t],i=n[t+1],p=n[t+2],f=a[0]*r+a[4]*i+a[8]*p+a[12],m=a[1]*r+a[5]*i+a[9]*p+a[13],h=a[2]*r+a[6]*i+a[10]*p+a[14];c[s]=f,c[s+1]=m,c[s+2]=h,s+=l}}_writeUV0(e,t,r,s){const o=r.getField(L.UV0,x),n=t.indices.get(L.POSITION),a=t.vertexAttributes.get(L.POSITION).data,l=t.vertexAttributes.get(L.DISTANCETOSTART)?.data,u=o.typedBufferStride,m=o.typedBuffer;let h=0;m[s*=u]=B.START,m[s+1]=h,s+=u;const d=3*n[0],g=i(F,a[d],a[d+1],a[d+2]);e&&f(g,g,e);const A=G,_=n.length-1;let O=1;const S=l?(e,t,r)=>h=l[r]:(e,t,r)=>h+=p(e,t);for(let p=1;p<_;p+=2){const t=3*n[p];i(A,a[t],a[t+1],a[t+2]),e&&f(A,A,e),S(g,A,O++);for(let e=0;e<2;++e)m[s]=1-e,m[s+1]=h,s+=u;c(g,A)}const T=3*n[_];i(A,a[T],a[T+1],a[T+2]),e&&f(A,A,e),S(g,A,O),m[s]=B.END,m[s+1]=h}}class W extends E{constructor(){super(...arguments),this.color=h,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.stipplePreferContinuous=!0,this.hasOccludees=!1,this.stippleTexture=null}}const F=m(),G=m(),H=m(),Q=m(),Z=r(),z=r(),J=m(),K=m(),Y=g(),$=g(),ee=m(),te=[r(),r(),r(),r()],re=[m(),m(),m(),m()],se=S(),ie=S(),oe=S(),ne=S();export{X as NativeLineMaterial,W as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,s as t,g as r,a as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as S}from"../lib/Util.js";import{VertexAttribute as b}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as E,writePosition as g}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as A}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as T,vertexAttributeLocations as _,ShadedColorMaterialTechnique as F}from"../shaders/ShadedColorMaterialTechnique.js";class v extends f{constructor(e){super(e,new x),this.supportsEdges=!0,this._configuration=new T,this._vertexAttributeLocations=_}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u){if(this.parameters.screenSizeEnabled){const s=e.vertexAttributes.get(b.OFFSET),h={applyToVertex:(e,n,o,c)=>{const l=t(L,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),u=t(w,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,L);return o(e,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(t))}};A(e,a,c,l,h,u)}else A(e,a,c,l,void 0,u)}requiresSlot(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new j(e)}createBufferWriter(){return new O(this.parameters.screenSizeEnabled)}}class j extends p{beginSlot(e){return this.ensureTechnique(F,e)}}class x extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class O{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(b.POSITION).vec3f(b.NORMAL);this.screenSizeEnabled&&t.vec3f(b.OFFSET),this.vertexBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(b.POSITION).length}write(e,t,r,i,s){if(E(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.vertexAttributes.has(b.OFFSET))throw new Error(`${b.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.vertexAttributes.get(b.OFFSET),a=r.indices.get(b.OFFSET);S(3===e.size);const n=i.getField(b.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+b.OFFSET);g(a,e.data,t,n,s)}}}}const L=s(),w=s();export{v as ShadedColorMaterial,x as ShadedColorMaterialParameters};
5
+ import{n as e,s as t,g as r,a as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as S}from"../lib/Util.js";import{VertexAttribute as b}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as E,writePosition as g}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as A}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as T,vertexAttributeLocations as _,ShadedColorMaterialTechnique as F}from"../shaders/ShadedColorMaterialTechnique.js";class v extends f{constructor(e){super(e,new O),this.supportsEdges=!0,this._configuration=new T,this._vertexAttributeLocations=_}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.hasMultipassTerrain=t.multipassTerrain.enabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u){if(this.parameters.screenSizeEnabled){const s=e.vertexAttributes.get(b.OFFSET),h={applyToVertex:(e,n,o,c)=>{const l=t(w,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),u=t(z,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,w);return o(e,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(t))}};A(e,a,c,l,h,u)}else A(e,a,c,l,void 0,u)}requiresSlot(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new j(e)}createBufferWriter(){return new x(this.parameters.screenSizeEnabled)}}class j extends p{beginSlot(e){return this.ensureTechnique(F,e)}}class O extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class x{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(b.POSITION).vec3f(b.NORMAL);this.screenSizeEnabled&&t.vec3f(b.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.indices.get(b.POSITION).length}write(e,t,r,i,s){if(E(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.vertexAttributes.has(b.OFFSET))throw new Error(`${b.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.vertexAttributes.get(b.OFFSET),a=r.indices.get(b.OFFSET);S(3===e.size);const n=i.getField(b.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+b.OFFSET);g(a,e.data,t,n,s)}}}}const w=s(),z=s();export{v as ShadedColorMaterial,O as ShadedColorMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- const t={dash:[4,3],dot:[1,3],"long-dash":[8,3],"short-dash":[4,1],"short-dot":[1,1]},o={dash:t.dash,"dash-dot":[...t.dash,...t.dot],dot:t.dot,"long-dash":t["long-dash"],"long-dash-dot":[...t["long-dash"],...t.dot],"long-dash-dot-dot":[...t["long-dash"],...t.dot,...t.dot],none:null,"short-dash":t["short-dash"],"short-dash-dot":[...t["short-dash"],...t["short-dot"]],"short-dash-dot-dot":[...t["short-dash"],...t["short-dot"],...t["short-dot"]],"short-dot":t["short-dot"],solid:null},d=8;function s(t,o=2){return null==t?t:{pattern:t.slice(),pixelRatio:o}}function h(t,o=2){return{pattern:[t,t],pixelRatio:o}}function n(t){return null!=t&&"style"===t.type?l(t.style):null}function l(t){return null!=t?s(o[t],d):null}export{s as createStipplePattern,h as createStipplePatternSimple,n as getStipplePatternForLinePattern,l as getStipplePatternForPatternStyle};
5
+ const t={dash:[4,3],dot:[1,3],"long-dash":[8,3],"short-dash":[4,1],"short-dot":[1,1]},o={dash:t.dash,"dash-dot":[...t.dash,...t.dot],dot:t.dot,"long-dash":t["long-dash"],"long-dash-dot":[...t["long-dash"],...t.dot],"long-dash-dot-dot":[...t["long-dash"],...t.dot,...t.dot],none:null,"short-dash":t["short-dash"],"short-dash-dot":[...t["short-dash"],...t["short-dot"]],"short-dash-dot-dot":[...t["short-dash"],...t["short-dot"],...t["short-dot"]],"short-dot":t["short-dot"],solid:null},d=8;function s(t,o){return null==t?t:{pattern:t.slice(),pixelRatio:o}}function h(t){return{pattern:[t,t],pixelRatio:2}}function n(t){return null!=t&&"style"===t.type?l(t.style):null}function l(t){return null!=t?s(o[t],d):null}export{h as createStipplePatternSimple,n as getStipplePatternForLinePattern,l as getStipplePatternForPatternStyle};