@arcgis/core 5.2.0-next.79 → 5.2.0-next.80

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 (192) hide show
  1. package/WebScene.js +1 -1
  2. package/arcgisGlobal.d.ts +8 -0
  3. package/assets/components/assets/input-date-picker/t9n/messages.ar.json +1 -1
  4. package/assets/components/assets/input-date-picker/t9n/messages.bg.json +1 -1
  5. package/assets/components/assets/input-date-picker/t9n/messages.bs.json +1 -1
  6. package/assets/components/assets/input-date-picker/t9n/messages.ca.json +1 -1
  7. package/assets/components/assets/input-date-picker/t9n/messages.cs.json +1 -1
  8. package/assets/components/assets/input-date-picker/t9n/messages.da.json +1 -1
  9. package/assets/components/assets/input-date-picker/t9n/messages.de.json +1 -1
  10. package/assets/components/assets/input-date-picker/t9n/messages.el.json +1 -1
  11. package/assets/components/assets/input-date-picker/t9n/messages.es.json +1 -1
  12. package/assets/components/assets/input-date-picker/t9n/messages.et.json +1 -1
  13. package/assets/components/assets/input-date-picker/t9n/messages.fi.json +1 -1
  14. package/assets/components/assets/input-date-picker/t9n/messages.fr.json +1 -1
  15. package/assets/components/assets/input-date-picker/t9n/messages.he.json +1 -1
  16. package/assets/components/assets/input-date-picker/t9n/messages.hr.json +1 -1
  17. package/assets/components/assets/input-date-picker/t9n/messages.hu.json +1 -1
  18. package/assets/components/assets/input-date-picker/t9n/messages.id.json +1 -1
  19. package/assets/components/assets/input-date-picker/t9n/messages.it.json +1 -1
  20. package/assets/components/assets/input-date-picker/t9n/messages.ja.json +1 -1
  21. package/assets/components/assets/input-date-picker/t9n/messages.ko.json +1 -1
  22. package/assets/components/assets/input-date-picker/t9n/messages.lt.json +1 -1
  23. package/assets/components/assets/input-date-picker/t9n/messages.lv.json +1 -1
  24. package/assets/components/assets/input-date-picker/t9n/messages.nl.json +1 -1
  25. package/assets/components/assets/input-date-picker/t9n/messages.no.json +1 -1
  26. package/assets/components/assets/input-date-picker/t9n/messages.pl.json +1 -1
  27. package/assets/components/assets/input-date-picker/t9n/messages.pt-BR.json +1 -1
  28. package/assets/components/assets/input-date-picker/t9n/messages.pt-PT.json +1 -1
  29. package/assets/components/assets/input-date-picker/t9n/messages.ro.json +1 -1
  30. package/assets/components/assets/input-date-picker/t9n/messages.ru.json +1 -1
  31. package/assets/components/assets/input-date-picker/t9n/messages.sk.json +1 -1
  32. package/assets/components/assets/input-date-picker/t9n/messages.sl.json +1 -1
  33. package/assets/components/assets/input-date-picker/t9n/messages.sr.json +1 -1
  34. package/assets/components/assets/input-date-picker/t9n/messages.sv.json +1 -1
  35. package/assets/components/assets/input-date-picker/t9n/messages.th.json +1 -1
  36. package/assets/components/assets/input-date-picker/t9n/messages.tr.json +1 -1
  37. package/assets/components/assets/input-date-picker/t9n/messages.uk.json +1 -1
  38. package/assets/components/assets/input-date-picker/t9n/messages.vi.json +1 -1
  39. package/assets/components/assets/input-date-picker/t9n/messages.zh-CN.json +1 -1
  40. package/assets/components/assets/input-date-picker/t9n/messages.zh-HK.json +1 -1
  41. package/assets/components/assets/input-date-picker/t9n/messages.zh-TW.json +1 -1
  42. package/assets/components/assets/input-time-picker/t9n/messages.ar.json +1 -1
  43. package/assets/components/assets/input-time-picker/t9n/messages.bg.json +1 -1
  44. package/assets/components/assets/input-time-picker/t9n/messages.bs.json +1 -1
  45. package/assets/components/assets/input-time-picker/t9n/messages.ca.json +1 -1
  46. package/assets/components/assets/input-time-picker/t9n/messages.cs.json +1 -1
  47. package/assets/components/assets/input-time-picker/t9n/messages.da.json +1 -1
  48. package/assets/components/assets/input-time-picker/t9n/messages.de.json +1 -1
  49. package/assets/components/assets/input-time-picker/t9n/messages.el.json +1 -1
  50. package/assets/components/assets/input-time-picker/t9n/messages.es.json +1 -1
  51. package/assets/components/assets/input-time-picker/t9n/messages.et.json +1 -1
  52. package/assets/components/assets/input-time-picker/t9n/messages.fi.json +1 -1
  53. package/assets/components/assets/input-time-picker/t9n/messages.fr.json +1 -1
  54. package/assets/components/assets/input-time-picker/t9n/messages.he.json +1 -1
  55. package/assets/components/assets/input-time-picker/t9n/messages.hr.json +1 -1
  56. package/assets/components/assets/input-time-picker/t9n/messages.hu.json +1 -1
  57. package/assets/components/assets/input-time-picker/t9n/messages.id.json +1 -1
  58. package/assets/components/assets/input-time-picker/t9n/messages.it.json +1 -1
  59. package/assets/components/assets/input-time-picker/t9n/messages.ja.json +1 -1
  60. package/assets/components/assets/input-time-picker/t9n/messages.ko.json +1 -1
  61. package/assets/components/assets/input-time-picker/t9n/messages.lt.json +1 -1
  62. package/assets/components/assets/input-time-picker/t9n/messages.lv.json +1 -1
  63. package/assets/components/assets/input-time-picker/t9n/messages.nl.json +1 -1
  64. package/assets/components/assets/input-time-picker/t9n/messages.no.json +1 -1
  65. package/assets/components/assets/input-time-picker/t9n/messages.pl.json +1 -1
  66. package/assets/components/assets/input-time-picker/t9n/messages.pt-BR.json +1 -1
  67. package/assets/components/assets/input-time-picker/t9n/messages.pt-PT.json +1 -1
  68. package/assets/components/assets/input-time-picker/t9n/messages.ro.json +1 -1
  69. package/assets/components/assets/input-time-picker/t9n/messages.ru.json +1 -1
  70. package/assets/components/assets/input-time-picker/t9n/messages.sk.json +1 -1
  71. package/assets/components/assets/input-time-picker/t9n/messages.sl.json +1 -1
  72. package/assets/components/assets/input-time-picker/t9n/messages.sr.json +1 -1
  73. package/assets/components/assets/input-time-picker/t9n/messages.sv.json +1 -1
  74. package/assets/components/assets/input-time-picker/t9n/messages.th.json +1 -1
  75. package/assets/components/assets/input-time-picker/t9n/messages.tr.json +1 -1
  76. package/assets/components/assets/input-time-picker/t9n/messages.uk.json +1 -1
  77. package/assets/components/assets/input-time-picker/t9n/messages.vi.json +1 -1
  78. package/assets/components/assets/input-time-picker/t9n/messages.zh-CN.json +1 -1
  79. package/assets/components/assets/input-time-picker/t9n/messages.zh-HK.json +1 -1
  80. package/assets/components/assets/input-time-picker/t9n/messages.zh-TW.json +1 -1
  81. package/assets/components/assets/input-time-zone/t9n/messages.de.json +1 -1
  82. package/assets/esri/core/workers/RemoteClient.js +1 -1
  83. package/assets/esri/core/workers/chunks/{c69cf08da4e4c2c824ee.js → 0179949495c87466b428.js} +12 -12
  84. package/assets/esri/core/workers/chunks/{ef803fb25741e9f2a0a1.js → 04105d83556409489835.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{040a73b2a23577e1eabd.js → 24729603dcdbd95fd01e.js} +1 -1
  86. package/assets/esri/core/workers/chunks/2b0558c1716425974563.js +2 -0
  87. package/assets/esri/core/workers/chunks/{ac2ba5c3d613d7d5183a.js → 2b3f76e03b7a28fc4453.js} +1 -1
  88. package/assets/esri/core/workers/chunks/345510a95e893fa8040a.js +1 -0
  89. package/assets/esri/core/workers/chunks/{57e26a86d46e02c89c4f.js → 55dda957c79fb285185f.js} +1 -1
  90. package/assets/esri/core/workers/chunks/5d8d2145533a52efb7b9.js +1 -0
  91. package/assets/esri/core/workers/chunks/5f553da48d0ccbbfcd3c.js +2 -0
  92. package/assets/esri/core/workers/chunks/{cd74de12005834244a47.js → 626a715fdec93e188e0c.js} +1 -1
  93. package/assets/esri/core/workers/chunks/6529b5cc3ac6baa29fff.js +2 -0
  94. package/assets/esri/core/workers/chunks/7253a439c98200e3e748.js +1 -0
  95. package/assets/esri/core/workers/chunks/{4115bab15c19b4f5ae08.js → 7529c0fcfb83998e63db.js} +1 -1
  96. package/assets/esri/core/workers/chunks/{b37a20c5c4a4686257d4.js → 8a3289e15e0ce92e3813.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{b82763e9401b16121f8d.js → 995a433936fc90d41634.js} +2 -2
  98. package/assets/esri/core/workers/chunks/9f1211d2267fb7673c4d.js +1 -0
  99. package/assets/esri/core/workers/chunks/{385b23d4bd5275031fb6.js → cada52d719c35d40958a.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{f703bc002c732d1c045d.js → cfdbc48f58433a3d5fc3.js} +1 -1
  101. package/assets/esri/core/workers/chunks/{83556c9f6f85c2a46779.js → d8da31bfe2bc4174e5aa.js} +1 -1
  102. package/assets/esri/core/workers/chunks/{8762da315cf5086167c3.js → e9e4b27ba06a29e6340c.js} +1 -1
  103. package/assets/esri/core/workers/chunks/{05663093b1d2a268b953.js → ebb722118a220c92efc3.js} +1 -1
  104. package/assets/esri/core/workers/chunks/ee63c693f2539f3bfa17.js +2 -0
  105. package/assets/esri/core/workers/chunks/ef9489d1dccb817460bb.js +2 -0
  106. package/assets/esri/core/workers/chunks/f086c6d229fb34a9d7f9.js +1 -0
  107. package/assets/esri/core/workers/chunks/{507b7f4c276b60ffe9d5.js → f4bae61869df1877fd3f.js} +1 -1
  108. package/chunks/Component.glsl.js +4 -4
  109. package/chunks/{FocusAreaColor.glsl.js → FocusArea.glsl.js} +1 -1
  110. package/chunks/HUDMaterial.glsl.js +5 -5
  111. package/chunks/Terrain.glsl.js +4 -4
  112. package/config.js +1 -1
  113. package/kernel.js +1 -1
  114. package/layers/list/BasemapItemCollection.d.ts +81 -0
  115. package/layers/list/BasemapItemCollection.js +2 -0
  116. package/layers/list/CatalogItemCollection.d.ts +76 -0
  117. package/layers/list/CatalogItemCollection.js +2 -0
  118. package/layers/list/Item.d.ts +262 -0
  119. package/layers/list/Item.js +2 -0
  120. package/layers/list/ItemPanel.d.ts +75 -0
  121. package/layers/list/ItemPanel.js +2 -0
  122. package/layers/list/LayerItemCollection.d.ts +106 -0
  123. package/layers/list/LayerItemCollection.js +2 -0
  124. package/layers/list/TableItem.d.ts +136 -0
  125. package/layers/list/TableItem.js +2 -0
  126. package/layers/list/TableItemCollection.d.ts +115 -0
  127. package/layers/list/TableItemCollection.js +2 -0
  128. package/layers/list/TableItemPanel.d.ts +74 -0
  129. package/layers/list/TableItemPanel.js +2 -0
  130. package/layers/list/support/layerListUtils.js +2 -0
  131. package/layers/list/types.d.ts +55 -0
  132. package/package.json +4 -4
  133. package/support/revision.js +1 -1
  134. package/views/3d/FocusAreasView.js +1 -1
  135. package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
  136. package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +2 -0
  137. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +2 -0
  138. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +2 -0
  139. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  140. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  141. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementController.js +2 -0
  142. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  143. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +2 -0
  144. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  145. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  146. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  147. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  148. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  149. package/views/3d/interactive/editingTools/reshape/isSupportedObject.js +1 -1
  150. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  151. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  152. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  153. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  154. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  155. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +16 -7
  156. package/views/3d/webgl-engine/effects/focusArea/{FocusAreaColor.glsl.js → FocusArea.glsl.js} +1 -1
  157. package/views/3d/webgl-engine/effects/focusArea/FocusArea.js +2 -0
  158. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.js +1 -1
  159. package/views/3d/webgl-engine/effects/focusArea/FocusAreaTechnique.js +2 -0
  160. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  161. package/views/3d/webgl-engine/lib/CutFill.js +2 -0
  162. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  163. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  164. package/views/3d/webgl.js +1 -1
  165. package/webscene/support/schemaValidator.js +1 -1
  166. package/webscene/version.js +2 -0
  167. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  168. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  169. package/widgets/OrientedImageryViewer/videoViewerUtils.js +1 -1
  170. package/assets/esri/core/workers/chunks/06c8547521ce9c97b258.js +0 -2
  171. package/assets/esri/core/workers/chunks/09653bd2a31d293a10d9.js +0 -2
  172. package/assets/esri/core/workers/chunks/17e9324a02b69733307a.js +0 -2
  173. package/assets/esri/core/workers/chunks/20b9bc8d5cbe9a18a644.js +0 -1
  174. package/assets/esri/core/workers/chunks/29a20a37e7837142fa6b.js +0 -2
  175. package/assets/esri/core/workers/chunks/81cd0cb9ae1371765d32.js +0 -1
  176. package/assets/esri/core/workers/chunks/95956d62591d689f1135.js +0 -1
  177. package/assets/esri/core/workers/chunks/b2812279662f1a5f8d06.js +0 -1
  178. package/assets/esri/core/workers/chunks/fdd4f78facec6387cdb0.js +0 -1
  179. package/assets/esri/core/workers/chunks/ffd5285c7b2c83208f87.js +0 -2
  180. package/views/3d/analysis/LineOfSight/LineOfSightAggregateManipulatedObject3D.js +0 -2
  181. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +0 -2
  182. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +0 -2
  183. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +0 -2
  184. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +0 -2
  185. package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +0 -2
  186. package/views/3d/webgl-engine/lib/CutFillVisualization.js +0 -2
  187. /package/assets/esri/core/workers/chunks/{09653bd2a31d293a10d9.js.LICENSE.txt → 2b0558c1716425974563.js.LICENSE.txt} +0 -0
  188. /package/assets/esri/core/workers/chunks/{17e9324a02b69733307a.js.LICENSE.txt → 5f553da48d0ccbbfcd3c.js.LICENSE.txt} +0 -0
  189. /package/assets/esri/core/workers/chunks/{06c8547521ce9c97b258.js.LICENSE.txt → 6529b5cc3ac6baa29fff.js.LICENSE.txt} +0 -0
  190. /package/assets/esri/core/workers/chunks/{b82763e9401b16121f8d.js.LICENSE.txt → 995a433936fc90d41634.js.LICENSE.txt} +0 -0
  191. /package/assets/esri/core/workers/chunks/{ffd5285c7b2c83208f87.js.LICENSE.txt → ee63c693f2539f3bfa17.js.LICENSE.txt} +0 -0
  192. /package/assets/esri/core/workers/chunks/{29a20a37e7837142fa6b.js.LICENSE.txt → ef9489d1dccb817460bb.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{C as t}from"../../../../../../chunks/Component.glsl.js";import{isOITColorAlpha as i,isOITFrontFace as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as n}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../../../core/shaderTechnique/ShaderTechnique.js";import{depthTest as s,blending as a}from"../../../lib/OrderIndependentTransparency.js";import{stencilBaseAllZeros as p,stencilWriteMaskOn as m,replaceBitWhenDepthTestPasses as u}from"../../../lib/StencilUtils.js";import{IndexGlLayout as c}from"../../../materials/DefaultLayouts.js";import{polygonOffset as d}from"../../../materials/PolygonOffset.js";import{makePipelineState as h,defaultColorWrite as f,defaultDepthWrite as g,premultipliedAlpha as b,cullingParams as j}from"../../../../../webgl/renderState.js";let P=class extends l{constructor(e,r,i){super(e,r,i.concat(c)),this.shader=new n(t,()=>import("./Component.glsl.js")),this.ignoreUnused=!0}getPipeline(e,r){return e.camera.aboveGround||null==this._belowGroundPipeline?super.getPipeline(e,r):this._belowGroundPipeline}initializePipeline(e){return this._belowGroundPipeline=0===e.integratedMeshMode?null:this._makePipeline(e,!0),this._makePipeline(e,!1)}_makePipeline(e,r){const{integratedMeshMode:t,output:n,transparent:l,cullFace:c,hasOccludees:P,renderOccluded:w}=e,T=0!==t,O=!i(n),S=o(n);let _=j(c);return r&&_&&(_={..._,mode:2304}),h({blending:w?b:l?a(n):null,culling:_,depthTest:w?null:s(n),depthWrite:w||!O&&!S?null:g,colorWrite:f,stencilWrite:!w&&T||P?m:null,stencilTest:T?u(1):P?p:null,polygonOffset:d(e)})}};P=e([r("esri.views.3d.webgl-engine.collections.Component.Material.ComponentTechnique")],P);export{P as ComponentTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../../core/accessorSupport/decorators.js";import{C as t}from"../../../../../../chunks/Component.glsl.js";import{isOITColorAlpha as i,isOITFrontFace as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as n}from"../../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../../../core/shaderTechnique/ShaderTechnique.js";import{depthTest as s,blending as a}from"../../../lib/OrderIndependentTransparency.js";import{stencilBaseAllZeros as p,stencilWriteMaskOn as m,replaceBitWhenDepthTestPasses as u}from"../../../lib/StencilUtils.js";import{IndexGlLayout as c}from"../../../materials/DefaultLayouts.js";import{polygonOffset as d}from"../../../materials/PolygonOffset.js";import{makePipelineState as h,defaultColorWrite as f,defaultDepthWrite as g,cullingParams as b}from"../../../../../webgl/renderState.js";let j=class extends l{constructor(e,r,i){super(e,r,i.concat(c)),this.shader=new n(t,()=>import("./Component.glsl.js")),this.ignoreUnused=!0}getPipeline(e,r){return e.camera.aboveGround||null==this._belowGroundPipeline?super.getPipeline(e,r):this._belowGroundPipeline}initializePipeline(e){return this._belowGroundPipeline=0===e.integratedMeshMode?null:this._makePipeline(e,!0),this._makePipeline(e,!1)}_makePipeline(e,r){const{integratedMeshMode:t,output:n,transparent:l,cullFace:c,hasOccludees:j,renderOccluded:P}=e,w=0!==t,T=!i(n),O=o(n);let S=b(c);return r&&S&&(S={...S,mode:2304}),h({blending:P||l?a(n):null,culling:S,depthTest:P?null:s(n),depthWrite:P||!T&&!O?null:g,colorWrite:f,stencilWrite:!P&&w||j?m:null,stencilTest:w?u(1):j?p:null,polygonOffset:d(e)})}};j=e([r("esri.views.3d.webgl-engine.collections.Component.Material.ComponentTechnique")],j);export{j as ComponentTechnique};
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{isColor as l}from"../ShaderOutput.js";import{addMainLightDirection as a,addMainLightIntensity as c}from"../shading/MainLighting.glsl.js";import{WaterColor as i}from"../shading/WaterColor.glsl.js";import{Float4DrawUniform as n}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as s}from"../../shaderModules/FloatPassUniform.js";import{glsl as v}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as d}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as u}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as x}from"../../../../../webgl/Uniform.js";function y(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new n("overlayTexOffset",(e,r)=>O(o.spherical,e,r)),new n("overlayTexScale",(e,r)=>T(o.spherical,e,r))),t.uniforms.add(new n("overlayTexOffset",(e,r)=>O(o.spherical,e,r)),new n("overlayTexScale",(e,r)=>T(o.spherical,e,r))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new d("ovColorTex",(e,o)=>f(e,o))),C(e,o)}function f(e,o){const r=m(e,o);return null!=r?o.overlay?.getTexture(r):null}function m(e,o){return 0===e.identifier?l(o.output)?!e.occludedGround||o.overlay?.allSourcesOccluders?1:4:3===o.output||4===o.output?1:11===o.output?5:null:2===e.identifier?2:null}function p(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new w("overlayTexOffset"),new w("overlayTexScale")),t.uniforms.add(new s("overlayOpacity",e=>e.overlayOpacity)),10!==o.output&&t.uniforms.add(new d("ovColorTex",(e,o)=>o.overlay?.getTexture(e.overlayContent))),C(e,o)}function g(e,o){switch(e){case 0:case 1:case 2:return 9!==o.slot||o.overlay?.allSourcesOccluders?0:4;case 3:case 4:return 0;case 10:return 2;case 5:case 7:case 8:case 9:return null;case 11:return 5}return null}function C(e,o){const{hasWater:r,output:t}=o;r&&e.include(i,o);const{vertex:l,fragment:n,varyings:s}=e;s.add("vtcOverlay","vec4");const d=10===t;l.code.add(v`void setOverlayVTC(in vec2 uv) {
2
+ import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{isColor as l}from"../ShaderOutput.js";import{addMainLightDirection as i,addMainLightIntensity as a}from"../shading/MainLighting.glsl.js";import{WaterColor as c}from"../shading/WaterColor.glsl.js";import{BlendColorsPremultiplied as n}from"../util/BlendColorsPremultiplied.glsl.js";import{Float4DrawUniform as s}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as v}from"../../shaderModules/FloatPassUniform.js";import{glsl as d}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as u}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as x}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as m}from"../../../../../webgl/Uniform.js";function p(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new s("overlayTexOffset",(e,r)=>T(o.spherical,e,r)),new s("overlayTexScale",(e,r)=>V(o.spherical,e,r))),t.uniforms.add(new s("overlayTexOffset",(e,r)=>T(o.spherical,e,r)),new s("overlayTexScale",(e,r)=>V(o.spherical,e,r))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new u("ovColorTex",(e,o)=>y(e,o))),O(e,o)}function y(e,o){const r=f(e,o);return null!=r?o.overlay?.getTexture(r):null}function f(e,o){return 0===e.identifier?l(o.output)?!e.occludedGround||o.overlay?.allSourcesOccluders?1:4:3===o.output||4===o.output?1:11===o.output?5:null:2===e.identifier?2:null}function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new w("overlayTexOffset"),new w("overlayTexScale")),t.uniforms.add(new v("overlayOpacity",e=>e.overlayOpacity)),10!==o.output&&t.uniforms.add(new u("ovColorTex",(e,o)=>o.overlay?.getTexture(e.overlayContent))),O(e,o)}function g(e,o){switch(e){case 0:case 1:case 2:return 9!==o.slot||o.overlay?.allSourcesOccluders?0:4;case 3:case 4:return 0;case 10:return 2;case 5:case 7:case 8:case 9:return null;case 11:return 5}return null}function O(e,o){const{hasWater:r,output:t}=o;r&&e.include(c,o);const{vertex:l,fragment:s,varyings:v}=e;v.add("vtcOverlay","vec4");const u=10===t;l.code.add(d`void setOverlayVTC(in vec2 uv) {
3
3
  vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
4
- }`),n.code.add(v`bool isValid(vec2 uv, vec2 dxdy) {
4
+ }`),s.code.add(d`bool isValid(vec2 uv, vec2 dxdy) {
5
5
  return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
6
6
  }
7
7
  vec4 getOverlayColor(sampler2D ov0Tex, vec4 texCoords) {
@@ -10,7 +10,7 @@ vec4 color1 = texture(ov0Tex, vec2(texCoords.z * 0.5 + 0.5, texCoords.w));
10
10
  bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
11
11
  bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
12
12
  return mix(color1 * float(isValid1), color0, float(isValid0));
13
- }`),d?n.uniforms.add(new u("overlayHighlightTexture",(e,o)=>o.overlay?.getTexture(2))).code.add(v`uvec2 getAllOverlayHighlightValuesEncoded(vec4 texCoords) {
13
+ }`),u?s.uniforms.add(new x("overlayHighlightTexture",(e,o)=>o.overlay?.getTexture(2))).code.add(d`uvec2 getAllOverlayHighlightValuesEncoded(vec4 texCoords) {
14
14
  vec2 uvInner = texCoords.xy;
15
15
  vec2 uvOuter = texCoords.zw;
16
16
  bool isValidInner = isValid(uvInner, fwidth(uvInner));
@@ -27,12 +27,21 @@ uvec2(0);
27
27
  }
28
28
  uvec2 getAllOverlayHighlightValuesEncoded() {
29
29
  return getAllOverlayHighlightValuesEncoded(vtcOverlay);
30
- }`):(n.code.add(v`vec4 getCombinedOverlayColor(vec4 texCoords) {
30
+ }`):(s.include(n),s.code.add(d`vec4 getCombinedOverlayColor(vec4 texCoords) {
31
31
  return overlayOpacity * getOverlayColor(ovColorTex, texCoords);
32
32
  }
33
33
  vec4 getCombinedOverlayColor() {
34
34
  return getCombinedOverlayColor(vtcOverlay);
35
- }`),n.code.add(v`vec4 getOverlayColorTexel(vec4 texCoords) {
35
+ }
36
+ vec4 compositeOverlayUnpremultiplied(vec4 baseColorUnpremultiplied, vec4 overlayColorPremultiplied) {
37
+ vec4 colorPremultiplied = blendColorsPremultiplied(
38
+ overlayColorPremultiplied,
39
+ vec4(baseColorUnpremultiplied.rgb * baseColorUnpremultiplied.a, baseColorUnpremultiplied.a)
40
+ );
41
+ return colorPremultiplied.a > 0.0
42
+ ? vec4(colorPremultiplied.rgb / colorPremultiplied.a, colorPremultiplied.a)
43
+ : vec4(0.0);
44
+ }`),s.code.add(d`vec4 getOverlayColorTexel(vec4 texCoords) {
36
45
  vec2 texDim = vec2(textureSize(ovColorTex, 0));
37
46
  vec4 color0 = texelFetch(ovColorTex, ivec2(vec2(texCoords.x * 0.5, texCoords.y) * texDim), 0);
38
47
  vec4 color1 = texelFetch(ovColorTex, ivec2(vec2(texCoords.z * 0.5 + 0.5, texCoords.w) * texDim), 0);
@@ -42,10 +51,10 @@ return mix(color1 * float(isValid1), color0, float(isValid0));
42
51
  }
43
52
  vec4 getOverlayColorTexel() {
44
53
  return getOverlayColorTexel(vtcOverlay);
45
- }`)),r&&(a(n),c(n),n.code.add(v`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
54
+ }`)),r&&(i(s),a(s),s.code.add(d`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
46
55
  float shadow, vec3 localUp, mat3 tbn, vec3 position, vec3 positionWorld) {
47
56
  vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0)));
48
57
  vec3 v = vposEyeDir;
49
58
  vec3 final = getWaterColor(n, v, mainLightDirection, colorInput.rgb, mainLightIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld);
50
59
  return vec4(final, colorInput.w);
51
- }`))}function h(e,o){return e.overlay?.overlays[o]?.extent}function O(e,l,a){const c=V,i=e&&!l.useENUForGlobalOverlayUV,n=i?0:l.toMapSpace[0],s=i?0:l.toMapSpace[1],v=(e,l)=>{const i=h(a,l);o(i)&&(c[e+0]=(n-i[0])/r(i),c[e+1]=(s-i[1])/t(i))};return v(0,0),v(2,1),c}function T(e,l,a){const c=V,i=e&&!l.useENUForGlobalOverlayUV,n=i?1:l.toMapSpace[2],s=i?1:l.toMapSpace[3],v=(e,l)=>{const i=h(a,l);o(i)&&(c[e+0]=n/r(i),c[e+1]=s/t(i))};return v(0,0),v(2,1),c}const V=e();class w extends x{constructor(e){super(e,"vec4")}}export{y as OverlayIM,p as OverlayTerrain,f as getIMColorTexture,g as getOverlayContentForOutputTerrain};
60
+ }`))}function h(e,o){return e.overlay?.overlays[o]?.extent}function T(e,l,i){const a=b,c=e&&!l.useENUForGlobalOverlayUV,n=c?0:l.toMapSpace[0],s=c?0:l.toMapSpace[1],v=(e,l)=>{const c=h(i,l);o(c)&&(a[e+0]=(n-c[0])/r(c),a[e+1]=(s-c[1])/t(c))};return v(0,0),v(2,1),a}function V(e,l,i){const a=b,c=e&&!l.useENUForGlobalOverlayUV,n=c?1:l.toMapSpace[2],s=c?1:l.toMapSpace[3],v=(e,l)=>{const c=h(i,l);o(c)&&(a[e+0]=n/r(c),a[e+1]=s/t(c))};return v(0,0),v(2,1),a}const b=e();class w extends m{constructor(e){super(e,"vec4")}}export{p as OverlayIM,C as OverlayTerrain,y as getIMColorTexture,g as getOverlayContentForOutputTerrain};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/signal.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{F as FocusAreaColorPassParameters,b as build}from"../../../../../chunks/FocusAreaColor.glsl.js";
2
+ import"../../../../../core/signal.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{F as FocusAreaPassParameters,b as build}from"../../../../../chunks/FocusArea.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{watch as s}from"../../../../../core/reactiveUtils.js";import{property as t,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as i}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as o}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusArea.glsl.js";import{FocusAreaTechnique as c}from"./FocusAreaTechnique.js";import{EmissiveTechniqueConfiguration as h}from"../../shaders/EmissiveTechniqueConfiguration.js";let m=class extends a{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA,o.FOCUSAREA_MASK]},this.produces=o.FOCUSAREA,this._fadeDirection=0,this._configuration=new h,this._passParameters=new n}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(s(()=>this._passParameters.fadeFactor.value,s=>{0===s&&(this.removeAllHandles(),e())})),this.requestRender(2)}precompile(){this._configuration.hasEmissive=0!==this.bindParameters.emissions,this.techniques.precompile(c,this._configuration)}render(e){const s=this.bindParameters;this._startTime??=this.view.stage?.renderer.renderContext.time;const t=this.view.qualitySettings.fadeDuration,r=t>0?Math.min(t,this.view.stage?.renderer.renderContext.time-this._startTime)/t:1,a=this.renderingContext,n=this.techniques.get(c,this._configuration),h=this.input,m=e.find(({name:e})=>e===o.FOCUSAREA_MASK),f="bright"===this.focusAreasView.style;this._passParameters.color=f?h.getTexture():a.emptyTexture,this._passParameters.focusArea=m.getTexture(),this._passParameters.effect=u[this.focusAreasView.style],this._passParameters.fadeFactor.value=0===this._fadeDirection?r:1-r;const d=s.camera,p=d.fullViewport[2],l=d.fullViewport[3],A=f?this.fboCache.acquire(p,l,this.produces).moveAttachments(h):h;return a.bindFramebuffer(A.fbo),f&&a.clearBuffer(0,i),a.bindTechnique(n,s,this._passParameters),a.screen.draw(),r<1&&this.requestRender(2),A}};e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"produces",void 0),e([t({constructOnly:!0})],m.prototype,"focusAreasView",void 0),m=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusArea")],m);const u={bright:0,dark:1};export{m as FocusArea,u as styleToEffect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as r}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{volumeToVao as o}from"./focusAreaMaskUtils.js";import{V as n}from"../../../../../chunks/VolumeMask.glsl.js";import{VolumeMaskTechnique as a}from"../../shaders/VolumeMaskTechnique.js";import{DepthStencilAttachment as h,PrimitiveType as c}from"../../../../webgl/enums.js";import{noParameters as l}from"../../../../webgl/NoParameters.js";let u=class extends i{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.CUTFILL_COMPUTATION]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new n}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}render(e){const s=this.techniques.getCompiled(a);if(!s||!this._vaos)return void this.requestRender(1);const t=e.find(({name:e})=>e===r.CUTFILL_COMPUTATION),i=this.renderingContext,o=this.bindParameters,n=o.camera,u=n.fullViewport[2],m=n.fullViewport[3],p=this.fboCache.acquire(u,m,r.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(p.acquireDepth(14),i.blitFramebuffer(t.fbo,p.fbo,256)):p.attachDepth(t.getAttachment(h)),i.bindFramebuffer(p.fbo),i.setClearColor(0,0,0,1),i.clear(17408),i.setViewport(0,0,u,m);const d=i.bindTechnique(s,o,l);i.setFaceCullingEnabled(!1),i.setStencilTestEnabled(!0),i.setStencilOpSeparate(1028,7680,34055,7680),i.setStencilOpSeparate(1029,7680,34056,7680),i.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],d.bindDraw(o,l,this._maskParameters),i.bindVAO(e),i.setDepthTestEnabled(!0),i.setStencilWriteMask(255),i.setStencilFunction(519,0,255),i.setColorMask(!1,!1,!1,!1),i.drawArrays(c.TRIANGLES,0,s),i.setDepthTestEnabled(!1),i.setStencilWriteMask(0),i.setStencilFunction(517,0,255),i.setColorMask(!0,!1,!1,!1),i.drawArrays(c.TRIANGLES,0,s)}return i.setColorMask(!0,!0,!0,!0),p}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=e.geometryVolume,{vao:t,vertexCount:r}=o(this.renderingContext,s);this._vaos.push(t),this._counts.push(r),this._origins.push(e.origin)}),this.requestRender(1)}};e([s()],u.prototype,"consumes",void 0),e([s()],u.prototype,"produces",void 0),e([s({constructOnly:!0})],u.prototype,"focusAreasView",void 0),u=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMask")],u);export{u as FocusAreaMask};
2
+ import{__decorate as e}from"tslib";import{property as s,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as r}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{volumeToVao as o}from"./focusAreaMaskUtils.js";import{V as n}from"../../../../../chunks/VolumeMask.glsl.js";import{VolumeMaskTechnique as a}from"../../shaders/VolumeMaskTechnique.js";import{DepthStencilAttachment as h,PrimitiveType as c}from"../../../../webgl/enums.js";import{noParameters as l}from"../../../../webgl/NoParameters.js";let u=class extends i{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.CUTFILL_COMPUTATION]},this.produces=r.FOCUSAREA_MASK,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new n}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}render(e){const s=this.techniques.getCompiled(a);if(!s||!this._vaos)return void this.requestRender(1);const t=e.find(({name:e})=>e===r.CUTFILL_COMPUTATION),i=this.renderingContext,o=this.bindParameters,n=o.camera,u=n.fullViewport[2],m=n.fullViewport[3],p=this.fboCache.acquire(u,m,r.FOCUSAREA_MASK,2);this.view.stage.renderer.occludedRequiresStencil?(p.acquireDepth(14),i.blitFramebuffer(t.fbo,p.fbo,256)):p.attachDepth(t.getAttachment(h)),i.bindFramebuffer(p.fbo),i.setClearColor(0,0,0,1),i.clear(17408),i.setViewport(0,0,u,m);const d=i.bindTechnique(s,o,l);i.setFaceCullingEnabled(!1),i.setStencilTestEnabled(!0),i.setStencilOpSeparate(1028,7680,34055,7680),i.setStencilOpSeparate(1029,7680,34056,7680),i.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],d.bindDraw(o,l,this._maskParameters),i.bindVAO(e),i.setDepthTestEnabled(!0),i.setStencilWriteMask(255),i.setStencilFunction(519,0,255),i.setColorMask(!1,!1,!1,!1),i.drawArrays(c.TRIANGLES,0,s),i.setDepthTestEnabled(!1),i.setStencilWriteMask(0),i.setStencilFunction(517,0,255),i.setColorMask(!0,!1,!1,!1),i.drawArrays(c.TRIANGLES,0,s)}return i.setColorMask(!0,!0,!0,!0),p}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=e.geometryVolume,{vao:t,vertexCount:r}=o(this.renderingContext,s);this._vaos.push(t),this._counts.push(r),this._origins.push(e.origin)}),this.requestRender(1)}};e([s()],u.prototype,"consumes",void 0),e([s()],u.prototype,"produces",void 0),e([s({constructOnly:!0})],u.prototype,"focusAreasView",void 0),u=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMask")],u);export{u as FocusAreaMask};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/FocusArea.glsl.js";import{makePipelineState as t,premultipliedAlpha as c,defaultColorWrite as a}from"../../../../webgl/renderState.js";let n=class extends o{constructor(){super(...arguments),this.shader=new s(i,()=>import("./FocusArea.glsl.js")),this.ignoreUnused=!0}initializePipeline(){return t({colorWrite:a,blending:c})}};n=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaTechnique")],n);export{n as FocusAreaTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{H as u}from"../../../../../chunks/HighlightBlur.glsl.js";import{HighlightBlurTechnique as c}from"./HighlightBlurTechnique.js";import{H as m,g as d}from"../../../../../chunks/HighlightDownsample.glsl.js";import{HighlightDownsampleTechnique as p}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as b}from"./HighlightToSingleTechnique.js";import{NoVertex as w}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as x}from"../../lib/VertexArrayObject.js";import{BufferObject as T}from"../../../../webgl/BufferObject.js";import{ColorAttachment0 as C,PrimitiveType as _,DataType as v}from"../../../../webgl/enums.js";import O from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as H}from"../../../../webgl/VertexBuffer.js";let P=class extends a{constructor(){super(...arguments),this.consumes={required:[l.HIGHLIGHT_COLOR,"highlights"]},this.produces=l.HIGHLIGHT_COLOR,this._downsampleDrawParameters=new m,this._passParameters=new f,this._highlightBlurDrawParameters=new u,this._grid=new q}initialize(){this.addHandles([i(()=>this._updateOptionsTexture(),()=>{},s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new j(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new O(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(D(this.view.state.highlights)),this.requestRender(1)}render(e){const t=e.find(({name:e})=>e===l.HIGHLIGHT_COLOR),{techniques:r,bindParameters:i,fboCache:s,_passParameters:o,renderingContext:h}=this;if(!i.decorations)return t;const a=r.getCompiled(p),u=r.getCompiled(b),m=r.getCompiled(c),d=r.getCompiled(g);if(!(a&&d&&m&&u))return this.requestRender(1),t;const f=e.find(({name:e})=>"highlights"===e).getTexture();o.highlightTexture=f;const w=this._prepareAndDownSample(f),{width:x,height:T}=f.descriptor;o.highlightTexture=f;const{camera:_}=i,{fullWidth:v,fullHeight:O,pixelRatio:j,fullViewport:H}=_,P=Math.ceil(v/j),q=Math.ceil(O/j),{_highlightBlurDrawParameters:D}=this,y=this.view.stage.renderView.renderer,{highlights:I}=i;for(let l=0;l<I.length;++l){const{name:e}=I[l];if(!y.hasHighlight(e))continue;o.highlightLevel=l,h.setClearColor(0,0,0,0);const r=s.acquire(x,T,"single highlight",2);h.bindFramebuffer(r.fbo),h.setViewport(0,0,x,T),h.clear(16384),h.bindTechnique(u,i,o),this._renderGrid(w),D.blurInput=r.getTexture(),n(D.blurSize,1/P,0);const a=s.acquire(P,q,"single highlight blur",2);h.unbindTexture(a.fbo?.colorTexture),h.bindFramebuffer(a.fbo),h.setViewport(0,0,P,q),h.clear(16384),h.bindTechnique(m,i,o,D),this._renderGrid(w),r.release(),n(D.blurSize,0,1/q),o.highlightBlurTexture=a.getTexture(),h.bindFramebuffer(t.fbo),h.setDrawBuffers([C]),h.setViewport4fv(H),h.bindTechnique(d,i,o,D),this._renderGrid(w),a.release()}return o.coverageTexture=o.highlightTexture=null,t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(p),r=this._gridComputeCoverage(t,e),{horizontalCellCount:i,verticalCellCount:s}=r,o=this._passParameters;return o.horizontalCellCount=i,o.verticalCellCount=s,o.coverageTexture=r.coverage?.getTexture(),r}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(_.TRIANGLES,6,v.UNSIGNED_BYTE,0,t)}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/d),t.verticalCellCount=Math.ceil(i/d),t.vao)return;const s=this.renderingContext,o=T.createIndex(s,35044,R);t.vao=new x(s,new H(s,w),o)}_gridComputeCoverage(e,t){const r=this.renderingContext,i=this._grid,s=t.descriptor,o=Math.ceil(s.width/d),h=Math.ceil(s.height/d);this._downsampleDrawParameters.input=t;const{highlights:n}=this.bindParameters;i.coverage?.release();const l=this.fboCache.acquire(o,h,"highlight coverage",n.length>L?3:1);return i.coverage=l,r.bindFramebuffer(l.fbo),r.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,o,h),r.screen.draw(),i}get test(){}};e([o()],P.prototype,"consumes",void 0),e([o()],P.prototype,"produces",void 0),P=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],P);class q{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function D(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let y=0;function I(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return y+++(t>=0?0:1)}const R=new Uint8Array([0,1,2,2,1,3]);function G(e,t,r,i,s,o,h=0){const{highlights:l}=s,a=l.length>1?t.acquire(r,i,"highlight mix",l.length>L?3:1):null,{gl:g}=e;if(a){const t=e.boundFramebuffer;e.bindFramebuffer(a.fbo),g.clearBufferuiv(g.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const u=a?.getTexture();s.highlightMixTexture=u,n(s.highlightMixOrigin,h,0),l.forEach((t,n)=>{if(n>0){const t=O.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(u,t),e.setActiveTexture(t),g.copyTexSubImage2D(3553,0,0,0,h,0,r,i),e.bindTexture(null,t)}e.clear(256),s.highlightLevel=n,o()}),s.highlightLevel=null,s.highlightMixTexture=null,a?.release()}const L=4;export{P as Highlight,L as maxHighlightsPerChannel,G as renderHighlightBuffer,I as trackHighlightOptions};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as l}from"../../../webgl.js";import a from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{H as u}from"../../../../../chunks/HighlightBlur.glsl.js";import{HighlightBlurTechnique as c}from"./HighlightBlurTechnique.js";import{H as m,g as d}from"../../../../../chunks/HighlightDownsample.glsl.js";import{HighlightDownsampleTechnique as p}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as b}from"./HighlightToSingleTechnique.js";import{NoVertex as w}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as x}from"../../lib/VertexArrayObject.js";import{BufferObject as T}from"../../../../webgl/BufferObject.js";import{ColorAttachment0 as C,PrimitiveType as v,DataType as _}from"../../../../webgl/enums.js";import j from"../../../../webgl/Texture.js";import{TextureDescriptor as H}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as P}from"../../../../webgl/VertexBuffer.js";let O=class extends a{constructor(){super(...arguments),this.consumes={required:[l.HIGHLIGHT,"highlights"]},this.produces=l.HIGHLIGHT,this._downsampleDrawParameters=new m,this._passParameters=new f,this._highlightBlurDrawParameters=new u,this._grid=new q}initialize(){this.addHandles([i(()=>this._updateOptionsTexture(),()=>{},s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new H(16,2);e.internalFormat=6408,e.samplingMode=9728,this._passParameters.highlightOptionsTexture=new j(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(D(this.view.state.highlights)),this.requestRender(1)}render(e){const t=e.find(({name:e})=>e===l.HIGHLIGHT),{techniques:r,bindParameters:i,fboCache:s,_passParameters:o,renderingContext:h}=this;if(!i.decorations)return t;const a=r.getCompiled(p),u=r.getCompiled(b),m=r.getCompiled(c),d=r.getCompiled(g);if(!(a&&d&&m&&u))return this.requestRender(1),t;const f=e.find(({name:e})=>"highlights"===e).getTexture();o.highlightTexture=f;const w=this._prepareAndDownSample(f),{width:x,height:T}=f.descriptor;o.highlightTexture=f;const{camera:v}=i,{fullWidth:_,fullHeight:j,pixelRatio:H,fullViewport:P}=v,O=Math.ceil(_/H),q=Math.ceil(j/H),{_highlightBlurDrawParameters:D}=this,y=this.view.stage.renderView.renderer,{highlights:I}=i;for(let l=0;l<I.length;++l){const{name:e}=I[l];if(!y.hasHighlight(e))continue;o.highlightLevel=l,h.setClearColor(0,0,0,0);const r=s.acquire(x,T,"single highlight",2);h.bindFramebuffer(r.fbo),h.setViewport(0,0,x,T),h.clear(16384),h.bindTechnique(u,i,o),this._renderGrid(w),D.blurInput=r.getTexture(),n(D.blurSize,1/O,0);const a=s.acquire(O,q,"single highlight blur",2);h.unbindTexture(a.fbo?.colorTexture),h.bindFramebuffer(a.fbo),h.setViewport(0,0,O,q),h.clear(16384),h.bindTechnique(m,i,o,D),this._renderGrid(w),r.release(),n(D.blurSize,0,1/q),o.highlightBlurTexture=a.getTexture(),h.bindFramebuffer(t.fbo),h.setDrawBuffers([C]),h.setViewport4fv(P),h.bindTechnique(d,i,o,D),this._renderGrid(w),a.release()}return o.coverageTexture=o.highlightTexture=null,t}_prepareAndDownSample(e){this._gridUpdateResources(e);const t=this.techniques.get(p),r=this._gridComputeCoverage(t,e),{horizontalCellCount:i,verticalCellCount:s}=r,o=this._passParameters;return o.horizontalCellCount=i,o.verticalCellCount=s,o.coverageTexture=r.coverage?.getTexture(),r}_renderGrid(e){const t=e.verticalCellCount*e.horizontalCellCount;this.renderingContext.bindVAO(e.vao),this.renderingContext.drawElementsInstanced(v.TRIANGLES,6,_.UNSIGNED_BYTE,0,t)}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/d),t.verticalCellCount=Math.ceil(i/d),t.vao)return;const s=this.renderingContext,o=T.createIndex(s,35044,G);t.vao=new x(s,new P(s,w),o)}_gridComputeCoverage(e,t){const r=this.renderingContext,i=this._grid,s=t.descriptor,o=Math.ceil(s.width/d),h=Math.ceil(s.height/d);this._downsampleDrawParameters.input=t;const{highlights:n}=this.bindParameters;i.coverage?.release();const l=this.fboCache.acquire(o,h,"highlight coverage",n.length>A?3:1);return i.coverage=l,r.bindFramebuffer(l.fbo),r.bindTechnique(e,this.bindParameters,this._passParameters,this._downsampleDrawParameters),r.setViewport(0,0,o,h),r.screen.draw(),i}get test(){}};e([o()],O.prototype,"consumes",void 0),e([o()],O.prototype,"produces",void 0),O=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],O);class q{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function D(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=4*r,s=4*r+64;++r;const{color:o}=i,h=i.haloColor??o;t[e+0]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]=i.fillOpacity*o.a*255,t[s+0]=h.r,t[s+1]=h.g,t[s+2]=h.b,t[s+3]=i.haloOpacity*h.a*255}return t}let y=0;function I(e){let t=0;for(const i of e){const{name:e}=i;t+=e.length;const{color:r,fillOpacity:s,haloColor:o,haloOpacity:h}=i;t+=r.r+r.g+r.b+r.a+s,t+=o?o.r+o.g+o.b+o.a+h:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r;t+=e+i+s.r+s.g+s.b+s.a}return y+++(t>=0?0:1)}const G=new Uint8Array([0,1,2,2,1,3]);function B(e,t,r,i,s,o,h=0){const{highlights:l}=s,a=l.length>1?t.acquire(r,i,"highlight mix",l.length>A?3:1):null,{gl:g}=e;if(a){const t=e.boundFramebuffer;e.bindFramebuffer(a.fbo),g.clearBufferuiv(g.COLOR,0,[0,0,0,0]),e.bindFramebuffer(t)}const u=a?.getTexture();s.highlightMixTexture=u,n(s.highlightMixOrigin,h,0),l.forEach((t,n)=>{if(n>0){const t=j.TEXTURE_UNIT_FOR_UPDATES;e.bindTexture(u,t),e.setActiveTexture(t),g.copyTexSubImage2D(3553,0,0,0,h,0,r,i),e.bindTexture(null,t)}e.clear(256),s.highlightLevel=n,o()}),s.highlightLevel=null,s.highlightMixTexture=null,a?.release()}const A=4;export{O as Highlight,A as maxHighlightsPerChannel,B as renderHighlightBuffer,I as trackHighlightOptions};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import h from"../../webgl/RenderNode.js";import{VertexArrayObject as c}from"./VertexArrayObject.js";import{C as m}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as d}from"../shaders/CutFillCompositionTechnique.js";import{DefaultMaterialPassParameters as p,DefaultMaterialDrawParameters as f,DefaultMaterialTechnique as _}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{EmissiveTechniqueConfiguration as b}from"../shaders/EmissiveTechniqueConfiguration.js";import{O as g}from"../../../../chunks/OccludedGeometryDepth.glsl.js";import{OccludedGeometryDepthTechnique as V}from"../shaders/OccludedGeometryDepthTechnique.js";import{V as v}from"../../../../chunks/VolumeMask.glsl.js";import{VolumeMaskTechnique as T}from"../shaders/VolumeMaskTechnique.js";import{DepthStencilAttachment as w,PrimitiveType as P}from"../../../webgl/enums.js";import{noParameters as q}from"../../../webgl/NoParameters.js";import{VertexBuffer as y}from"../../../webgl/VertexBuffer.js";let D=class extends h{constructor(e){super(e),this.consumes={required:[l.CUTFILL,l.GROUND_DEPTH]},this.produces=l.CUTFILL,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._compositeConfiguration=new b,this._maskParameters=new v,this._occludedGeometryDepthParameters=new g,this._cutVolumeParameters=new p,this._fillVolumeParameters=new p,this._compositeParameters=new m,this._drawParameters=new f;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new C(t),this._cutVolumeConfiguration.customDepthTest=3,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new C(t),this._fillVolumeConfiguration.customDepthTest=1,this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}precompile(){this._vaoCut&&this._vaoFill&&("cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0),this._compositeConfiguration.hasEmissive=0!==this.bindParameters.emissions,this.techniques.precompile(T),this.techniques.precompile(V),this.techniques.precompile(_,this._cutVolumeConfiguration),this.techniques.precompile(_,this._fillVolumeConfiguration),this.techniques.precompile(d,this._compositeConfiguration))}render(e){const t=this.input;if(!this._vaoCut||!this._vaoFill)return t;const i=this._vaoCut.vertexCount("geometry"),s=this._vaoFill.vertexCount("geometry"),o=this.bindParameters,r=o.camera,a=r.fullViewport[2],u=r.fullViewport[3],n=this.renderingContext,h=this.fboCache,c=e.find(({name:e})=>e===l.GROUND_DEPTH),m=h.acquire(a,u,"cutfill color mask",2).attachDepth(c.getAttachment(w));n.bindFramebuffer(m.fbo),n.setClearColor(0,0,0,1),n.clear(17408),n.setViewport(0,0,a,u);const p=this.techniques.get(T);n.bindTechnique(p,o,q,this._maskParameters),n.setFaceCullingEnabled(!1),n.setStencilTestEnabled(!0),n.setStencilOpSeparate(1028,7680,34055,7680),n.setStencilOpSeparate(1029,7680,34056,7680),n.setDepthWriteEnabled(!1),n.bindVAO(this._vaoCut),n.setDepthTestEnabled(!0),n.setStencilWriteMask(255),n.setStencilFunction(519,0,255),n.setColorMask(!1,!1,!1,!1),n.drawArrays(P.TRIANGLES,0,i),n.setDepthTestEnabled(!1),n.setStencilWriteMask(0),n.setStencilFunction(517,0,255),n.setColorMask(!0,!1,!1,!1),n.drawArrays(P.TRIANGLES,0,i),n.bindVAO(this._vaoFill),n.setDepthTestEnabled(!0),n.setStencilWriteMask(255),n.setStencilFunction(519,0,255),n.setColorMask(!1,!0,!1,!1),n.drawArrays(P.TRIANGLES,0,s);const f=h.acquire(a,u,"cutfill color cut volume",5).acquireDepth(14);n.bindFramebuffer(f.fbo),n.setClearColor(0,0,0,0),n.setClearDepth(1),n.setColorMask(!0,!0,!0,!0),n.setDepthWriteEnabled(!0),n.clear(16640);const C=this.techniques.get(V);this._occludedGeometryDepthParameters.depthTexture=c.getTexture(w),this._occludedGeometryDepthParameters.cullFace=this._cutVolumeConfiguration.cullFace,n.bindTechnique(C,o,this._occludedGeometryDepthParameters,this._drawParameters),n.bindVAO(this._vaoCut),n.drawArrays(P.TRIANGLES,0,i);const b=this.techniques.get(_,this._cutVolumeConfiguration);n.bindTechnique(b,this.bindParameters,this._cutVolumeParameters,this._drawParameters),n.bindVAO(this._vaoCut),n.drawArrays(P.TRIANGLES,0,i),f.detachDepth();const g=h.acquire(a,u,"cutfill color fill volume",5).acquireDepth(14);n.blitFramebuffer(t.fbo,g.fbo,256),n.bindFramebuffer(g.fbo),n.clear(16384),n.setColorMask(!0,!0,!0,!0);const v=this.techniques.get(_,this._fillVolumeConfiguration);n.bindTechnique(v,this.bindParameters,this._fillVolumeParameters,this._drawParameters),n.bindVAO(this._vaoFill),n.drawArrays(P.TRIANGLES,0,s),g.detachDepth();const y=t.obtainDepthTexture();n.bindFramebuffer(t.fbo),this._compositeParameters.cutVolume=f.getTexture(),this._compositeParameters.fillVolume=g.getTexture(),this._compositeParameters.mask=m.getTexture(),this._compositeParameters.sceneDepth=y?.attachment,this._compositeParameters.groundDepth=c.getTexture(w),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor);const D=this.techniques.get(d,this._compositeConfiguration);return n.bindTechnique(D,o,this._compositeParameters),n.screen.draw(),t.attachDepth(y),y?.release(),m.release(),f.release(),g.release(),t}enable(){this.produces=l.CUTFILL,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,a(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const{vertices:t,normals:i,indicesBottom:s,indicesExtruded:o}=e,r=s.length+o.length,a=this.renderingContext,l=F.createBuffer(r),{position:n,normal:h}=l;let m=0;for(let u=0;u<s.length;u++){const e=3*s[u];n.set(m,0,t[e]),n.set(m,1,t[e+1]),n.set(m,2,t[e+2]),h.set(m,0,i[e]),h.set(m,1,i[e+1]),h.set(m,2,i[e+2]),m++}for(let u=0;u<o.length;u++){const e=3*o[u];n.set(m,0,t[e]),n.set(m,1,t[e+1]),n.set(m,2,t[e+2]),h.set(m,0,i[e]),h.set(m,1,i[e+1]),h.set(m,2,i[e+2]),m++}const d=new y(a,u(F),l.buffer);return new c(a,d)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],D.prototype,"consumes",void 0),e([o()],D.prototype,"produces",void 0),e([o()],D.prototype,"cutColor",void 0),e([o()],D.prototype,"fillColor",void 0),e([o()],D.prototype,"borderColor",void 0),e([o()],D.prototype,"measureType",void 0),D=e([r("esri.views.3d.webgl-engine.lib.CutFill")],D);const F=n().vec3f("position").vec3f("normal").freeze();class j{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{D as CutFill,j as VolumeGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as _}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as A,create as I}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as E}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as S,InternalRenderCategory as O,AllRenderNodeOutputs as D,AllInternalRenderNodeOutputs as R}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as G}from"../../support/debugFlags.js";import{FBOCache as F}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as x}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as y}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as M}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as q}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as V}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{NavigationDepthCache as $}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as K}from"./OrderIndependentTransparency.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowMap as re}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as le,PixelType as ue,ColorAttachment2 as _e,ColorAttachment0 as me,DrawBufferNone as pe}from"../../../webgl/enums.js";const ce=has("disable-feature:async-navigation-3d-depth-readback");let be=class extends te{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new ae,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=m(Y.Infinite),this._state=m(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of De)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new F(i),this._compositor=new z(i,s),this._renderStateFeatures=m(se(e.view.qualityProfile));const a=new re(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,s),this._framebuffer=new X(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new q(s),this.navigationDepthCache=new $(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._nodes=new v(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new M({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>G.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=y,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},_),d(()=>this._bindParameters.clouds.data?.state,()=>r(),_),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ne.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new V(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){const e=this._plugins.emissions;return this._hasTransparentGeometry?e:1===e||3===e?1:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await(import("./edgeRendering/EdgeView.js"));o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:He(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),_)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&b(this._bindParameters.reprojection.matrix,A)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...we),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(S.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(O.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(O.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(O.CUTFILL_COLOR),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Te),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...ge),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,_=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),m=this._needsLastFrameColor;m?(_?.retain(m-1),_?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=_):_?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(O.CUTFILL_COMPUTATION,e)),this._pluginInput.set(O.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(O.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(O.VIEWSHED,e)),u.update(e=>this._renderNodes(O.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(O.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(O.CUTFILL_COLOR,e)),this._pluginInput.release(O.FOCUSAREA),this._pluginInput.release(O.GROUND_DEPTH),u.update(e=>this._renderNodes(O.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(S.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(O.ANTIALIASING,e));const b=this._hasTransparentGeometry?2:1,f=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(O.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=f,u.update(e=>this._renderNodes(O.MAGNIFIER,e)),u.update(e=>this._renderNodes(S.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),ce||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameEmission?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission?.release(),this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(le))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new he(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,O.OPAQUE_ENVIRONMENT,O.GAUSSIAN_SPLAT,O.OPAQUE_OCCLUSION_QUERY,O.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Pe),t.output=0,this._plugins.precompile(...Pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,O.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,O.TRANSPARENT_ENVIRONMENT,O.VIEWSHED,O.CUTFILL_COMPUTATION,O.CUTFILL_COLOR,O.LASERLINES,O.FOCUSAREA_COLOR,O.OCCLUDED,O.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasEmissions,O.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(t.hasEmissions,S.COMPOSITE,O.MAGNIFIER),this._nodes.precompile(t.hasEmissions,O.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(O.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(O.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,O.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(O.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(O.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(O.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=s}_renderShadowNodes(e){this._renderInternalNodeCategory(O.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(O.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(de.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(i),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(de.DEPTH)}_renderGaussianSplatPrepassDepth(e){const t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;const s=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(O.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=s}_renderGaussianSplatDepthAndNormals(e){const t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(O.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(O.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=J(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...D,O.VIEWSHED,O.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){const e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,Ae),this._needsDepth&&this._precompilePlugins(3,Ie)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,O.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(!1,O.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){const t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(!1,O.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(!1,O.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(this._bindParameters.hasEmission,O.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals");i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ae),this._renderGaussianSplatDepthAndNormals(i);const r=this._nodes.optional("normals",...D,O.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(de.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(O.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){const e=this._bindParameters;if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),e.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const t=this._nodes.produce(O.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=t,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?de.AMBIENT_ILLUMINATION_HIGH_QUALITY:de.AMBIENT_ILLUMINATION),e.globalIllumination}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=n(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=n(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ee);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Ee),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Se[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){const e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(!1,O.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Oe)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e,t){const{camera:s,contentCamera:i}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(s,i),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Oe),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,O.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ie)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...fe),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Pe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...we),this._bindParameters.output=2,this._plugins.precompile(...we),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...we)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(le);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>j?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),B(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...R)+this._nodes.optional("highlights",...R)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){const t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);const s=t.requireGeometryDepth;this._bindParameters.output=0;const i=this._nodes.produce(O.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._pluginInput.set(O.SHADOW_ACCUMULATION,null),i?.release(),s&&(this._bindParameters.depth=h(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,s,i,r){const a=this.stage.view.qualitySettings.maximumPixelRatio;this._bindParameters.renderingShadowAnalysisMap=!0;try{s.start(e,i,r,!0,a),this._renderShadowCascades(5,s),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}finally{this._bindParameters.renderingShadowAnalysisMap=!1}}_precompileTransparentGeometry(){x(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(le,this.hasFloatBlend?7:0,"oit alpha"),_=h.hasEmission&&(0===e||1!==t);_&&u.acquireColor(_e,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(K),_&&this._rctx.clearBuffer(2,K),a(),u.detachDepth(),h.output=2;const m=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");_&&m.acquireColor(le,o,"oit front emissive"),s?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(C,s),a(),m.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?_e:le;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-me,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,m,h,p,e,this._fboCache.debugCallback),b?.detachDepth(),s||(_&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),m.release(),u.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...fe)||this.plugins.produces(5,...fe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(O.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(S.OPAQUE,t,e)),this.fboCache.debugCallback?.(S.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(O.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(O.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(O.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(O.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(O.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(O.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(O.VOXEL,e)),this.fboCache.debugCallback?.(O.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(S.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(S.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(O.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(O.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([pe,le]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_renderInternalNodeCategory(e,t){if(!t)return;const s=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(s)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=A);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Ne,t.viewMatrix),f(Re,t.projectionMatrix),g(Ge,Ne,Re),g(Ge,s.viewMatrix,Ge),g(Ge,s.projectionMatrix,Ge),this._reprojectionMatrix=Ge):this._reprojectionMatrix=A,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Fe,s.viewMatrix,Ne),P(t,Fe)):P(t,A)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],be.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],be.prototype,"highResolutionAtmosphere",null),e([p()],be.prototype,"_edgeView",void 0),e([p()],be.prototype,"updating",null),be=e([c("esri.views.3d.webgl-engine.lib.Renderer")],be);const fe=[0,1,2,3],ge=[7,6,4,5],Pe=[7,6],Ae=[0,1,2,4,...Pe],Ie=[3,5],Ee=[2,4,8],we=[16,12,14,13],Ce=[4,5,2,3,0,1,...Pe],Te=[4,8,5,11],Se={0:[13],1:[12],2:[13,12],3:[13,12]},Oe=[0,1,...Pe],De=["normals","highlights"],Re=I(),Ne=I(),Ge=I(),Fe=I();function He(e){return t=>e.immediate.schedule(t)}export{be as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as A,create as I}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as E}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as S}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as T,InternalRenderCategory as D,AllRenderNodeOutputs as O,AllInternalRenderNodeOutputs as R}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as G}from"../../support/debugFlags.js";import{FBOCache as F}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as x}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as y}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as q}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as V}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as K}from"./depthRangeUtils.js";import{MainFramebuffer as J}from"./MainFramebuffer.js";import{NavigationDepthCache as X}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as $}from"./OrderIndependentTransparency.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowMap as re}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as le,PixelType as ue,ColorAttachment2 as me,ColorAttachment0 as _e,DrawBufferNone as pe}from"../../../webgl/enums.js";const ce=has("disable-feature:async-navigation-3d-depth-readback");let be=class extends te{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new ae,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=_(Y.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Oe)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new F(i),this._compositor=new z(i,s),this._renderStateFeatures=_(se(e.view.qualityProfile));const a=new re(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,s),this._framebuffer=new J(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new q(s),this.navigationDepthCache=new X(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._nodes=new v(this._renderContext),this._plugins=new M({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>G.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=y,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),d(()=>this._bindParameters.clouds.data?.state,()=>r(),m),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ne.prune(),S()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new V(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){const e=this._plugins.emissions;return this._hasTransparentGeometry?e:1===e||3===e?1:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await(import("./edgeRendering/EdgeView.js"));o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:He(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&b(this._bindParameters.reprojection.matrix,A)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...we),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(T.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(D.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(D.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(D.CUTFILL),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Se),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...ge),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),_=this._needsLastFrameColor;_?(m?.retain(_-1),m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(D.CUTFILL_COMPUTATION,e)),this._pluginInput.set(D.FOCUSAREA_MASK,this._renderFocusAreaMask()),u.update(e=>this._renderNodes(D.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(D.VIEWSHED,e)),u.update(e=>this._renderNodes(D.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(D.FOCUSAREA,e)),this._pluginInput.release(D.FOCUSAREA_MASK),u.update(e=>this._renderNodes(D.CUTFILL,e)),this._pluginInput.release(D.GROUND_DEPTH),u.update(e=>this._renderNodes(D.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(T.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(D.ANTIALIASING,e));const b=this._hasTransparentGeometry?2:1,f=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(D.HIGHLIGHT,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=f,u.update(e=>this._renderNodes(D.MAGNIFIER,e)),u.update(e=>this._renderNodes(T.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),ce||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameEmission?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission?.release(),this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(le))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new he(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,D.OPAQUE_ENVIRONMENT,D.GAUSSIAN_SPLAT,D.OPAQUE_OCCLUSION_QUERY,D.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Pe),t.output=0,this._plugins.precompile(...Pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,D.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,D.TRANSPARENT_ENVIRONMENT,D.VIEWSHED,D.CUTFILL_COMPUTATION,D.CUTFILL,D.LASERLINES,D.FOCUSAREA,D.OCCLUDED,D.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasEmissions,D.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(t.hasEmissions,T.COMPOSITE,D.MAGNIFIER),this._nodes.precompile(t.hasEmissions,D.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){const e=this._nodes.produce(D.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(D.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,D.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(D.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(D.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(D.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=s}_renderShadowNodes(e){this._renderInternalNodeCategory(D.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(D.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(de.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(i),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(de.DEPTH)}_renderGaussianSplatPrepassDepth(e){const t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;const s=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=s}_renderGaussianSplatDepthAndNormals(e){const t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=K(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(D.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=K(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...O,D.VIEWSHED,D.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){const e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,Ae),this._needsDepth&&this._precompilePlugins(3,Ie)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,D.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(!1,D.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){const t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(!1,D.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(!1,D.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(this._bindParameters.hasEmission,D.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals");i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ae),this._renderGaussianSplatDepthAndNormals(i);const r=this._nodes.optional("normals",...O,D.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(de.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){const e=this._bindParameters;if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),e.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const t=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=t,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?de.AMBIENT_ILLUMINATION_HIGH_QUALITY:de.AMBIENT_ILLUMINATION),e.globalIllumination}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=n(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=n(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ee);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Ee),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Te[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){const e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(!1,D.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e,t){const{camera:s,contentCamera:i}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(s,i),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,D.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ie)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...fe),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Pe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...we),this._bindParameters.output=2,this._plugins.precompile(...we),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...we)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(le);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>j?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),B(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...R)+this._nodes.optional("highlights",...R)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){const t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);const s=t.requireGeometryDepth;this._bindParameters.output=0;const i=this._nodes.produce(D.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._pluginInput.set(D.SHADOW_ACCUMULATION,null),i?.release(),s&&(this._bindParameters.depth=h(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,s,i,r){const a=this.stage.view.qualitySettings.maximumPixelRatio;this._bindParameters.renderingShadowAnalysisMap=!0;try{s.start(e,i,r,!0,a),this._renderShadowCascades(5,s),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}finally{this._bindParameters.renderingShadowAnalysisMap=!1}}_precompileTransparentGeometry(){x(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(le,this.hasFloatBlend?7:0,"oit alpha"),m=h.hasEmission&&(0===e||1!==t);m&&u.acquireColor(me,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer($),m&&this._rctx.clearBuffer(2,$),a(),u.detachDepth(),h.output=2;const _=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");m&&_.acquireColor(le,o,"oit front emissive"),s?_.acquireDepth(this._hudDepthFormat):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(C,s),a(),_.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?me:le;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-_e,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,_,h,p,e,this._fboCache.debugCallback),b?.detachDepth(),s||(m&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),_.release(),u.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...fe)||this.plugins.produces(5,...fe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(D.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(T.OPAQUE,t,e)),this.fboCache.debugCallback?.(T.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(D.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(D.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(D.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(D.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(D.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.VOXEL,e)),this.fboCache.debugCallback?.(D.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(T.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(T.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(D.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(D.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([pe,le]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_renderInternalNodeCategory(e,t){if(!t)return;const s=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(s)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=A);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Ne,t.viewMatrix),f(Re,t.projectionMatrix),g(Ge,Ne,Re),g(Ge,s.viewMatrix,Ge),g(Ge,s.projectionMatrix,Ge),this._reprojectionMatrix=Ge):this._reprojectionMatrix=A,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Fe,s.viewMatrix,Ne),P(t,Fe)):P(t,A)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],be.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],be.prototype,"highResolutionAtmosphere",null),e([p()],be.prototype,"_edgeView",void 0),e([p()],be.prototype,"updating",null),be=e([c("esri.views.3d.webgl-engine.lib.Renderer")],be);const fe=[0,1,2,3],ge=[7,6,4,5],Pe=[7,6],Ae=[0,1,2,4,...Pe],Ie=[3,5],Ee=[2,4,8],we=[16,12,14,13],Ce=[4,5,2,3,0,1,...Pe],Se=[4,8,5,11],Te={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Pe],Oe=["normals","highlights"],Re=I(),Ne=I(),Ge=I(),Fe=I();function He(e){return t=>e.immediate.schedule(t)}export{be as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/output/DepthConversion.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../effects/focusArea/FocusAreaVisualization.js";import"./alphaCutoff.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{a as anchorPosition,b as build}from"../../../../chunks/HUDMaterial.glsl.js";
2
+ import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/output/DepthConversion.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../effects/focusArea/FocusArea.js";import"./alphaCutoff.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{a as anchorPosition,b as build}from"../../../../chunks/HUDMaterial.glsl.js";
package/views/3d/webgl.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../geometry/Point.js";import l from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as u}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as f}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as A,viewModeDependentUtil as O}from"./support/viewingModeUtils.js";const d={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},T=[d.FINAL,d.COMPOSITE,d.OPAQUE,d.TRANSPARENT],R={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GAUSSIAN_SPLAT:"gaussian",GAUSSIAN_SPLAT_DEPTH:"gaussian-depth",GROUND_DEPTH:"ground-depth",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserlines",TRANSPARENT_NO_DEPTH:"transparent-no-depth",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_OCCLUSION_QUERY:"opaque-occlusion-query",OPAQUE_ENVIRONMENT:"opaque-environment",TRANSPARENT_ENVIRONMENT:"transparent-environment",AMBIENT_ILLUMINATION:"ambient-illumination",SHADOW_ACCUMULATION:"shadow-accumulation",SHADOWMAP:"shadowmap",SHADOW_HIGHLIGHT:"shadow-highlight",VOXEL:"voxel",VIEWSHED:"viewshed",OBJECT_AND_LAYER_ID_COLOR:"olid"},N=Array.from(Object.values(R)).concat(T);function E(o,e,r,t,i,n,a){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,a)?i:null}function I(o,e,r,t,i,n,a){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,a)?t:null}function S(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function g(r,t,i){const n=r.renderSpatialReference,a=A(r,t.eye,t.viewForward,t.up,h);let s=r.spatialReference;return p(t.eye,n,U,s)||(s=l.WGS84,p(t.eye,n,U,s)),null==i?i=new o(new c(U,s),a.heading,a.tilt,e(t.fov)):(i.position.x=U[0],i.position.y=U[1],i.position.z=U[2],i.position.spatialReference=s,i.heading=a.heading,i.tilt=a.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function L(o,e){return C(o,e,void 0)}function C(o,e,t){if(!e)return null;const c=o.renderSpatialReference,l=O(o).headingTiltToDirectionUp,s=a();if(!u(e.position,s,c))return null;const m=l(s,e.heading,e.tilt);i(m.direction,m.direction,o.state.camera.distance),n(m.direction,m.direction,s);const p=f(o,s,m.direction,m.up,t);return p.fov=r(e.fov),p.row=e.layout.row,p.rows=e.layout.rows,p.column=e.layout.column,p.columns=e.layout.columns,p}const U=a(),h={heading:0,tilt:0};export{N as AllInternalRenderNodeOutputs,T as AllRenderNodeOutputs,R as InternalRenderCategory,d as RenderNodeOutput,g as fromRenderCamera,I as fromRenderCoordinates,S as renderCoordinateTransformAt,L as toRenderCamera,C as toRenderCameraWithScale,E as toRenderCoordinates};
2
+ import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as u}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as f}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as A,viewModeDependentUtil as d}from"./support/viewingModeUtils.js";const T={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},N=[T.FINAL,T.COMPOSITE,T.OPAQUE,T.TRANSPARENT],E={ANTIALIASING:"antialiasing",CUTFILL:"cutfill",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA:"focusarea",FOCUSAREA_MASK:"focusarea-mask",GAUSSIAN_SPLAT:"gaussian",GAUSSIAN_SPLAT_DEPTH:"gaussian-depth",GROUND_DEPTH:"ground-depth",HIGHLIGHT:"highlight",LASERLINES:"laserlines",TRANSPARENT_NO_DEPTH:"transparent-no-depth",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_OCCLUSION_QUERY:"opaque-occlusion-query",OPAQUE_ENVIRONMENT:"opaque-environment",TRANSPARENT_ENVIRONMENT:"transparent-environment",AMBIENT_ILLUMINATION:"ambient-illumination",SHADOW_ACCUMULATION:"shadow-accumulation",SHADOWMAP:"shadowmap",SHADOW_HIGHLIGHT:"shadow-highlight",VOXEL:"voxel",VIEWSHED:"viewshed",OBJECT_AND_LAYER_ID_COLOR:"olid"},O=Array.from(Object.values(E)).concat(N);function R(o,e,r,t,i,n,a){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,a)?i:null}function I(o,e,r,t,i,n,a){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,a)?t:null}function S(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function g(r,t,i){const n=r.renderSpatialReference,a=A(r,t.eye,t.viewForward,t.up,L);let s=r.spatialReference;return p(t.eye,n,j,s)||(s=c.WGS84,p(t.eye,n,j,s)),null==i?i=new o(new l(j,s),a.heading,a.tilt,e(t.fov)):(i.position.x=j[0],i.position.y=j[1],i.position.z=j[2],i.position.spatialReference=s,i.heading=a.heading,i.tilt=a.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function U(o,e){return h(o,e,void 0)}function h(o,e,t){if(!e)return null;const l=o.renderSpatialReference,c=d(o).headingTiltToDirectionUp,s=a();if(!u(e.position,s,l))return null;const m=c(s,e.heading,e.tilt);i(m.direction,m.direction,o.state.camera.distance),n(m.direction,m.direction,s);const p=f(o,s,m.direction,m.up,t);return p.fov=r(e.fov),p.row=e.layout.row,p.rows=e.layout.rows,p.column=e.layout.column,p.columns=e.layout.columns,p}const j=a(),L={heading:0,tilt:0};export{O as AllInternalRenderNodeOutputs,N as AllRenderNodeOutputs,E as InternalRenderCategory,T as RenderNodeOutput,g as fromRenderCamera,I as fromRenderCoordinates,S as renderCoordinateTransformAt,U as toRenderCamera,h as toRenderCameraWithScale,R as toRenderCoordinates};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../WebScene.js";import n from"../../core/Error.js";import r from"../../core/Version.js";import o from"../../libs/ajv/ajv.bundle-wrapper.js";import{json as t}from"../../portal/schemas/webScene.js";import{convertAjvErrors as s}from"../../support/validationUtilsAjv.js";let i=null;function a(e,n){d(n);const r=h();return r.validate(j(n),e)?[]:s(r.errors??[])}async function c(n){let o=r.parse(n.version||"","webscene");const t=r.parse(e.version,"webscene");if(o.major===t.major&&o.minor===t.minor)return a(n);o.lessThan(1,38)&&(o=new r(1,38,"webscene"));const i=h(),c=m(o);if(null==i.getSchema(c)){const e=await fetch(l(o));if(e.ok){const n=await e.json();i.addSchema(n,c)}}return i.validate(c,n)?[]:s(i.errors??[])}async function f(e){const n=await c(e);if(n.length)throw new p(n)}function m(e){return`webscene-schema-v${e.major}.${e.minor}.json`}function l(e){return`https://js.arcgis.com/webscene-spec/${m(e)}`}function u(e){const n=e?t.definitions[j(e)]:void 0;if(!n)throw new Error(`invalid schema name to validate against '${e}'`);const r={};for(const o in n)r[o]=n[o];return r.definitions=t.definitions,r}function d(e){const n=j(e),r=h();if(!r.getSchema(n)){const o=u(e);r.addSchema(o,n)}}function h(){return i||(i=new o({allErrors:!0,extendRefs:!0}),i.addSchema(t,j()),i)}function w(){i=null}function j(e){return e?`${e}_schema.json`:"webScene_schema.json"}class p extends n{constructor(e){super("webscene:validation-failed",`WebScene validation failed with ${e.length} ${1===e.length?"error":"errors"}.`,{errors:e})}}export{p as WebSceneValidationError,f as assertValidWebScene,w as clearValidator,l as getVersionedWebSceneSchemaCDNUrl,a as validate,c as validateWebScene};
2
+ import n from"../../core/Error.js";import e from"../../core/Version.js";import r from"../../libs/ajv/ajv.bundle-wrapper.js";import{json as o}from"../../portal/schemas/webScene.js";import{convertAjvErrors as t}from"../../support/validationUtilsAjv.js";import{webSceneVersion as s}from"../version.js";let i=null;function a(n,e){d(e);const r=h();return r.validate(j(e),n)?[]:t(r.errors??[])}async function c(n){let r=e.parse(n.version||"","webscene");const o=s;if(r.major===o.major&&r.minor===o.minor)return a(n);r.lessThan(1,38)&&(r=new e(1,38,"webscene"));const i=h(),c=m(r);if(null==i.getSchema(c)){const n=await fetch(l(r));if(n.ok){const e=await n.json();i.addSchema(e,c)}}return i.validate(c,n)?[]:t(i.errors??[])}async function f(n){const e=await c(n);if(e.length)throw new p(e)}function m(n){return`webscene-schema-v${n.major}.${n.minor}.json`}function l(n){return`https://js.arcgis.com/webscene-spec/${m(n)}`}function u(n){const e=n?o.definitions[j(n)]:void 0;if(!e)throw new Error(`invalid schema name to validate against '${n}'`);const r={};for(const o in e)r[o]=e[o];return r.definitions=o.definitions,r}function d(n){const e=j(n),r=h();if(!r.getSchema(e)){const o=u(n);r.addSchema(o,e)}}function h(){return i||(i=new r({allErrors:!0,extendRefs:!0}),i.addSchema(o,j()),i)}function w(){i=null}function j(n){return n?`${n}_schema.json`:"webScene_schema.json"}class p extends n{constructor(n){super("webscene:validation-failed",`WebScene validation failed with ${n.length} ${1===n.length?"error":"errors"}.`,{errors:n})}}export{p as WebSceneValidationError,f as assertValidWebScene,w as clearValidator,l as getVersionedWebSceneSchemaCDNUrl,a as validate,c as validateWebScene};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"../core/Version.js";const o=new e(1,40,"webscene");export{o as webSceneVersion};