@arcgis/core 5.1.0-next.57 → 5.1.0-next.59

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 (199) hide show
  1. package/applications/Components/SelectionOperation.d.ts +2 -2
  2. package/applications/Components/SelectionOperation.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/04ea806b933d4dd41609.js +1 -0
  5. package/assets/esri/core/workers/chunks/{278eecd729bed2832702.js → 0622e238693c257abacb.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{05bc675c029ed311427f.js → 155c741a9839d24f04a2.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1ae4e43a399e1974f106.js +1 -0
  8. package/assets/esri/core/workers/chunks/1f8e22df08c2f5fbb8c8.js +1 -0
  9. package/assets/esri/core/workers/chunks/{2327b368673a974dee8b.js → 2339465190c9d5ede25f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/23f6d24bf850bc3280ec.js +1 -0
  11. package/assets/esri/core/workers/chunks/2541ac6e0ed1184edc9b.js +1 -0
  12. package/assets/esri/core/workers/chunks/34207774bc371e95ba3c.js +1 -0
  13. package/assets/esri/core/workers/chunks/{01777e91cd4e0bf04fd0.js → 35217befc8f9882d139e.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{40bcfc4f8efe7de7ec9d.js → 3de17e89973160b42923.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{992e74570b76f3f9e52e.js → 48d289db3145ce6c02bb.js} +1 -1
  16. package/assets/esri/core/workers/chunks/4c73c2f4331351e2a50c.js +1 -0
  17. package/assets/esri/core/workers/chunks/{2757cf54656b5d318b11.js → 55a0b69cf034ac32fc25.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{4d54beab8ae5ff31e7b0.js → 5a9f5a49dc68b42762bb.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{7cec3252e3ee56424b9e.js → 5c6e5f22450dd0583074.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{b39b4db86a1049f0b901.js → 6be9d00839002f24fafd.js} +1 -1
  21. package/assets/esri/core/workers/chunks/6c886f19875291d02407.js +1 -0
  22. package/assets/esri/core/workers/chunks/75e28458e08b0738b35a.js +2 -0
  23. package/assets/esri/core/workers/chunks/{c460ca93ed8e20d8b53a.js → 86a6dd19903fa5023cc7.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4afddb66242438b38df0.js → 8ccf2f65d8ed3c48ffff.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{fcfaaced184f8da3e28d.js → 9b53aa2429573f1b977f.js} +1 -1
  26. package/assets/esri/core/workers/chunks/9d580b5bcd59857a5702.js +1405 -0
  27. package/assets/esri/core/workers/chunks/a37697ef360e2425768a.js +1 -0
  28. package/assets/esri/core/workers/chunks/{a787fe09d3df9d4254ba.js → ab3183f2327ff26e2b45.js} +1 -1
  29. package/assets/esri/core/workers/chunks/b0f2ce61d3cad413898e.js +1 -0
  30. package/assets/esri/core/workers/chunks/{53c149bca42595b7dd1e.js → bbdf27bc34fadbe8e6fe.js} +1 -1
  31. package/assets/esri/core/workers/chunks/be42fe0b7ba0e27030b2.js +1 -0
  32. package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +1 -0
  33. package/assets/esri/core/workers/chunks/{5a573fa1012092328b88.js → d816d1a4220d827faf63.js} +1 -1
  34. package/assets/esri/core/workers/chunks/e26894655823849947f4.js +1 -0
  35. package/assets/esri/core/workers/chunks/e59f5dc8c85bcea66e98.js +1 -0
  36. package/assets/esri/core/workers/chunks/{ccf845ac0ac354507a25.js → ec1b2eb05410848081c9.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{851dd71d28681d4eccfd.js → f7af90c5f9d371eb7009.js} +1 -1
  38. package/assets/esri/core/workers/chunks/fa6e1ad099b43a6f5501.js +1 -0
  39. package/assets/esri/core/workers/chunks/{4a6186001323b47c23a4.js → fee1d873127dca02459f.js} +1 -1
  40. package/chunks/GlobalIllumination.glsl.js +101 -0
  41. package/chunks/GlobalIlluminationBlur.glsl.js +68 -0
  42. package/chunks/ScreenSpaceShadowHighlight.glsl.js +6 -0
  43. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  44. package/chunks/ShadowHighlight.glsl.js +15 -8
  45. package/config.js +1 -1
  46. package/geometry/Mesh.js +1 -1
  47. package/geometry/support/polygonUtils.js +1 -1
  48. package/geometry/support/{triangulationUtils.js → triangulationUtilsDeprecated.js} +1 -1
  49. package/kernel.js +1 -1
  50. package/layers/support/SceneModification.js +1 -1
  51. package/networks/support/jsonTypes.d.ts +6 -0
  52. package/package.json +2 -2
  53. package/renderers/ClassBreaksRenderer.js +1 -1
  54. package/renderers/DictionaryRenderer.js +1 -1
  55. package/renderers/DotDensityRenderer.js +1 -1
  56. package/renderers/HeatmapRenderer.js +1 -1
  57. package/renderers/PieChartRenderer.js +1 -1
  58. package/renderers/Renderer.js +1 -1
  59. package/renderers/SimpleRenderer.js +1 -1
  60. package/renderers/UniqueValueRenderer.js +1 -1
  61. package/renderers/support/AttributeColorInfo.js +1 -1
  62. package/renderers/support/ClassBreakInfo.d.ts +6 -0
  63. package/renderers/support/ClassBreakInfo.js +1 -1
  64. package/renderers/support/UniqueValueClass.d.ts +12 -0
  65. package/renderers/support/UniqueValueClass.js +1 -1
  66. package/renderers/support/UniqueValueInfo.d.ts +12 -0
  67. package/renderers/support/UniqueValueInfo.js +1 -1
  68. package/renderers/visualVariables/ColorVariable.js +1 -1
  69. package/renderers/visualVariables/OpacityVariable.js +1 -1
  70. package/renderers/visualVariables/SizeVariable.js +1 -1
  71. package/renderers/visualVariables/VisualVariable.js +1 -1
  72. package/rest/networks/support/FunctionResult.d.ts +6 -0
  73. package/rest/networks/support/FunctionResult.js +1 -1
  74. package/support/revision.js +1 -1
  75. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  76. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  77. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  78. package/views/2d/engine/webgl/GlyphSource.js +1 -1
  79. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  81. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  82. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  84. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  85. package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
  86. package/views/2d/engine/webgl/util/MapMatcher.js +1 -1
  87. package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
  88. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  89. package/views/3d/FocusAreasView.js +1 -1
  90. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  91. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  92. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  93. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  94. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  95. package/views/3d/layers/Lyr3DWorker.js +1 -1
  96. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  97. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  98. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  99. package/views/3d/layers/graphics/extrudeUtils.js +1 -1
  100. package/views/3d/layers/graphics/extrudeUtilsDeprecated.js +2 -0
  101. package/views/3d/layers/graphics/tessellationUtils.js +2 -0
  102. package/views/3d/layers/i3s/PointCloudHighlights.js +1 -1
  103. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  104. package/views/3d/layers/i3s/PointCloudRendererNode.js +1 -1
  105. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  106. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  107. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  108. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  109. package/views/3d/support/renderInfoUtils/line.js +1 -1
  110. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  111. package/views/3d/support/renderInfoUtils/polygonDeprecated.js +2 -0
  112. package/views/3d/terrain/OverlayRenderer.js +1 -1
  113. package/views/3d/terrain/TerrainRenderer.js +1 -1
  114. package/views/3d/terrain/TerrainSurface.js +1 -1
  115. package/views/3d/webgl/RenderNode.js +1 -1
  116. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  117. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  118. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  119. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  120. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  121. package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
  122. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  123. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  124. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  125. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +6 -5
  126. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js +4 -0
  127. package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +7 -0
  128. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +6 -6
  129. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +93 -72
  130. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +46 -22
  131. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +20 -0
  132. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +18 -13
  133. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +23 -9
  134. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +1 -1
  135. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +1 -1
  136. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  137. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  138. package/views/3d/webgl-engine/effects/emissive/emissions.js +2 -0
  139. package/views/3d/webgl-engine/effects/globalIllumination/BlueNoise.js +2 -0
  140. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +2 -0
  141. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +2 -0
  142. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +2 -0
  143. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +2 -0
  144. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlight.glsl.js +2 -0
  145. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightRenderNode.js +2 -0
  146. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightTechnique.js +2 -0
  147. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  148. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  149. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  150. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  151. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  152. package/views/3d/webgl-engine/lib/Material.js +1 -1
  153. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  154. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  155. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  156. package/views/3d/webgl-engine/lib/ReprojectionUniforms.js +1 -1
  157. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  158. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  159. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  160. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  165. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  166. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  167. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  168. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  169. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  170. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  171. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  172. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  173. package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +2 -0
  174. package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +2 -0
  175. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  176. package/views/3d/webgl-engine/shaders/MeasurementArrowTechniqueConfiguration.js +1 -1
  177. package/views/3d/webgl-engine/shaders/ReceiveShadowsConfiguration.js +1 -1
  178. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  179. package/views/3d/webgl.js +1 -1
  180. package/views/selection/SelectionOperation.d.ts +190 -0
  181. package/views/selection/SelectionOperation.js +2 -0
  182. package/views/selection/types.d.ts +146 -1
  183. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  184. package/assets/esri/core/workers/chunks/009db7b459b18f6a668b.js +0 -1
  185. package/assets/esri/core/workers/chunks/0fc60b4c44c4e865b699.js +0 -2
  186. package/assets/esri/core/workers/chunks/34484afe767d60f85982.js +0 -1
  187. package/assets/esri/core/workers/chunks/55bb5b7817c2963c8bfa.js +0 -1
  188. package/assets/esri/core/workers/chunks/572fcd33ae3648ed4f9c.js +0 -1
  189. package/assets/esri/core/workers/chunks/66a4d764937918a2779f.js +0 -1
  190. package/assets/esri/core/workers/chunks/6b56c8ba978ec6edd6b8.js +0 -1
  191. package/assets/esri/core/workers/chunks/9806cc96414065ae0afe.js +0 -1
  192. package/assets/esri/core/workers/chunks/9b365a6242b0287f8727.js +0 -1
  193. package/assets/esri/core/workers/chunks/a029db48079af4b5cccd.js +0 -1
  194. package/assets/esri/core/workers/chunks/ea068f75397c3b3337ec.js +0 -1034
  195. package/assets/esri/core/workers/chunks/ec91d5081f423755cb07.js +0 -1
  196. package/assets/esri/core/workers/chunks/f9fe89ced41b49608667.js +0 -1
  197. package/assets/esri/core/workers/chunks/fce30184f354fb7d11af.js +0 -1
  198. package/widgets/support/Selector2D/SelectionOperation.js +0 -2
  199. /package/assets/esri/core/workers/chunks/{0fc60b4c44c4e865b699.js.LICENSE.txt → 75e28458e08b0738b35a.js.LICENSE.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as s,isAbortError as i}from"../../../../../core/promiseUtils.js";import{watch as a,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as n,subclass as m}from"../../../../../core/accessorSupport/decorators.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{requestImage as u}from"../../../../../request/image.js";import{InternalRenderCategory as h}from"../../../webgl.js";import c from"../../../webgl/RenderNode.js";import{GlobalIlluminationBlurTechnique as p}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as d}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as f}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as b}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as _}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{DepthStencilAttachment as g,SizedPixelFormat as w}from"../../../../webgl/enums.js";import T from"../../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../../webgl/TextureDescriptor.js";const P=1;let I=class extends c{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=h.AMBIENT_ILLUMINATION,this._passParameters=new b,this._drawParameters=new _,this._accumulatedFrames=0,this._maxFrames=255,this._configuration=new f,this._resetBuffer=!1}async initialize(){this._abortController=new AbortController;const e=this._abortController.signal;try{const t=(await import("./BlueNoise.js")).data;s(e),await this._loadBlueNoiseTexture(t,e),s(e)}catch(r){i(r)||t.getLogger(this).errorOnce("Failed to load blue noise texture:",r)}this.addHandles(a(()=>this.view.stage.renderer.hasAmbientIllumination,e=>{e&&this.resetAccumulation(),this.requestRender(1)},o))}precompile(){const{hasEmission:e,reprojection:t}=this.bindParameters;this._configuration.hasEmission=e&&!!t.lastFrameEmission?.attachment,this.techniques.precompile(d,this._configuration),this.techniques.precompile(p)}destroy(){this._passParameters.noiseTexture=r(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(g),i=this.bindParameters,a=i.globalIllumination,{lastFrameEmission:o,lastFrameDepth:n}=i.reprojection;if(!r||!s)return this._emptyOutput;if(!this._passParameters.noiseTexture||i.hasEmission&&!o||!n||!a||this._resetBuffer)return this._resetBuffer=!1,this.requestRender(1),this._emptyOutput;this._configuration.hasEmission=i.hasEmission&&!!o?.attachment;const m=this.techniques.get(d,this._configuration),u=this.techniques.get(p);if(!m.compiled||!u.compiled)return this.requestRender(1),this._emptyOutput;this.view.stage.renderView.updating&&this.resetAccumulation();const c=this.renderingContext,{camera:f}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.globalIllumination=a.getTexture(),this._passParameters.projScale=1/f.computeScreenPixelSizeAtDist(1);const{fullWidth:b,fullHeight:_}=f,w=this.fboCache.acquire(b,_,"global illumination input");c.bindFramebuffer(w.fbo),c.setViewport(0,0,b,_),c.bindTechnique(m,i,this._passParameters,this._drawParameters),c.screen.draw();const T=Math.round(b/P),x=Math.round(_/P),I=this.fboCache.acquire(T,x,"global illumination blur");c.bindFramebuffer(I.fbo),this._drawParameters.colorTexture=w.getTexture(),l(this._drawParameters.blurSize,0,P/_),c.bindTechnique(u,i,this._passParameters,this._drawParameters),c.setViewport(0,0,T,x),c.screen.draw(),w.release();const j=this.fboCache.acquire(b,_,h.AMBIENT_ILLUMINATION);return c.bindFramebuffer(j.fbo),c.setViewport(0,0,b,_),c.setClearColor(1,1,1,0),c.clear(16384),this._drawParameters.colorTexture=I.getTexture(),l(this._drawParameters.blurSize,P/b,0),c.bindTechnique(u,i,this._passParameters,this._drawParameters),c.setViewport(0,0,T,x),c.screen.draw(),c.setViewport4fv(f.fullViewport),I.release(),this._passParameters.frameCount=(this._passParameters.frameCount+1)%64,++this._accumulatedFrames,this._accumulatedFrames<this._maxFrames&&this.requestRender(1),j}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,h.AMBIENT_ILLUMINATION);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.setClearColor(0,0,0,1),e.clear(16384),s}async _loadBlueNoiseTexture(e,t){s(t);const r=await u(e,{signal:t});if(s(t),!r)return;const i=new x;i.internalFormat=w.RGBA8,i.wrapMode=10497,i.isImmutable=!0,this._passParameters.noiseTexture=new T(this.renderingContext,i,r)}resetAccumulation(){this._accumulatedFrames=0}get test(){}};e([n()],I.prototype,"consumes",void 0),e([n()],I.prototype,"produces",void 0),e([n()],I.prototype,"_abortController",void 0),I=e([m("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],I);export{I as GlobalIllumination,P as blurSizePixels};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{makePipelineState as s,defaultColorWrite as t}from"../../../../webgl/renderState.js";let a=class extends l{constructor(){super(...arguments),this.shader=new o(i,()=>import("../../shaders/GlobalIlluminationBlur.glsl.js"))}initializePipeline(){return s({colorWrite:t})}};a=e([r("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIlluminationBlurTechnique")],a);export{a as GlobalIlluminationBlurTechnique};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as l}from"../../../../../chunks/GlobalIllumination.glsl.js";import{makePipelineState as s,defaultColorWrite as t}from"../../../../webgl/renderState.js";let a=class extends i{constructor(){super(...arguments),this.shader=new o(l,()=>import("../../shaders/GlobalIllumination.glsl.js"))}initializePipeline(){return s({colorWrite:t})}};a=e([r("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIlluminationTechnique")],a);export{a as GlobalIlluminationTechnique};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as o}from"tslib";import{parameter as s,ShaderTechniqueConfiguration as i}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class r extends i{constructor(){super(...arguments),this.hasEmission=!1}}o([s()],r.prototype,"hasEmission",void 0);export{r as GlobalIlluminationTechniqueConfiguration};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js";import"../../core/shaderLibrary/shading/ShadowmapFiltering.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DShadowBindUniform.js";import"../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../chunks/ScreenSpaceShadowHighlight.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as r,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{ReadShadowMapPassParameters as a}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{ScreenSpaceShadowHighlightTechnique as h}from"./ScreenSpaceShadowHighlightTechnique.js";let n=class extends o{get requireGeometryDepth(){return this.bindParameters.hasShadowHighlights}constructor(e){super(e),this.produces=i.SCREEN_SPACE_SHADOW_HIGHLIGHT,this._passParameters=new a}precompile(){this.bindParameters.hasShadowHighlights&&this.techniques.precompile(h)}render(){const e=this.bindParameters,r=e.hasShadowHighlights,t=null!=e.depth,o=null!=e.shadowMap.getOutput(6);if(!(r&&t&&o))return;const a=this.techniques.getCompiled(h);if(!a)return void this.requestRender(1);const{camera:n}=e,c=this.fboCache.acquire(n.fullWidth,n.fullHeight,i.SCREEN_SPACE_SHADOW_HIGHLIGHT,0);this._passParameters.origin=n.center;const d=this.renderingContext;return d.bindFramebuffer(c.fbo),d.clearFramebuffer(s),n.setGLViewport(d),d.bindTechnique(a,e,this._passParameters),d.screen.draw(),c}};e([r()],n.prototype,"produces",void 0),n=e([t("esri.views.3d.webgl-engine.effects.highlight.ScreenSpaceShadowHighlightRenderNode")],n);export{n as ScreenSpaceShadowHighlightRenderNode};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as i}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{S as s}from"../../../../../chunks/ScreenSpaceShadowHighlight.glsl.js";import{PrimitiveType as t}from"../../../../webgl/enums.js";import{makePipelineState as h}from"../../../../webgl/renderState.js";let c=class extends o{constructor(){super(...arguments),this.shader=new i(s,()=>import("./ScreenSpaceShadowHighlight.glsl.js")),this.primitiveType=t.TRIANGLE_STRIP}initializePipeline(){return h({colorWrite:{r:!0,g:!1,b:!1,a:!1}})}};c=e([r("esri.views.3d.webgl-engine.effects.highlight.ScreenSpaceShadowHighlightTechnique")],c);export{c as ScreenSpaceShadowHighlightTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{smoothstep as t,clamp as i}from"../../../../../core/mathUtils.js";import{watch as s,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{normalize as o,set as c,dot as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderNodeOutput as d}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as l,ShadowHighlightTechnique as u}from"./ShadowHighlightTechnique.js";import{defaultShadowOpacity as g,defaultShadowDifference as f,defaultShadowColor as _}from"../../../../support/HighlightDefaults.js";const w=1/512,O=4e4,y=5e4;let P=class extends m{constructor(e){super(e),this.produces=d.COMPOSITE,this.consumes={required:[d.COMPOSITE,"highlights"]},this._passParameters=new l,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([s(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??g,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),s(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),s(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??_).toUnitRGBA(),this._ensureMaxOpacity()},a)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>e===d.COMPOSITE),i=this.bindParameters;if(!this._ensureIfVisible())return t;const s=this.techniques.getCompiled(u);if(!s)return this.requestRender(1),t;this._passParameters.highlightTexture=e.find(({name:e})=>"highlights"===e)?.getTexture(),this._passParameters.origin=i.camera.center;const a=this.renderingContext,r=t.obtainDepthTexture();return a.bindFramebuffer(t.fbo),a.bindTechnique(s,i,this._passParameters),a.screen.draw(),t.attachDepth(r),r?.release(),t}_ensureIfVisible(){const e=this.bindParameters;if(!e.hasShadowHighlights||!e.mainDepth)return!1;const{camera:s,lighting:a}=e;this._passParameters.opacityElevation=1-t(O,y,s.relativeElevation);const r=1===this.viewingMode?o(b,s.center):c(b,0,0,1),h=n(r,a.mainLight.direction);return this._passParameters.dayNightTerminator=t(0,1,i(30*h,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=w}};e([r()],P.prototype,"produces",void 0),e([r()],P.prototype,"consumes",void 0),e([r({constructOnly:!0})],P.prototype,"viewingMode",void 0),P=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],P);const b=p();export{P as ShadowHighlight};
2
+ import{__decorate as e}from"tslib";import{smoothstep as t,clamp as i}from"../../../../../core/mathUtils.js";import{watch as s,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{normalize as o,set as c,dot as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderNodeOutput as d}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as l,ShadowHighlightTechnique as u}from"./ShadowHighlightTechnique.js";import{defaultShadowOpacity as g,defaultShadowDifference as f,defaultShadowColor as w}from"../../../../support/HighlightDefaults.js";const _=1/512,O=4e4,y=5e4;let P=class extends m{constructor(e){super(e),this.produces=d.COMPOSITE,this.consumes={required:[d.COMPOSITE,"highlights"]},this._passParameters=new l,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([s(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??g,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),s(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),s(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??w).toUnitRGBA(),this._ensureMaxOpacity()},a)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>e===d.COMPOSITE),i=this.bindParameters;if(!this._ensureIfVisible())return t;const s=this.techniques.getCompiled(u);if(!s)return this.requestRender(1),t;this._passParameters.highlightTexture=e.find(({name:e})=>"highlights"===e)?.getTexture(),this._passParameters.origin=i.camera.center;const a=this.renderingContext,r=t.obtainDepthTexture();return a.bindFramebuffer(t.fbo),a.bindTechnique(s,i,this._passParameters),a.screen.draw(),t.attachDepth(r),r?.release(),t}_ensureIfVisible(){const e=this.bindParameters;if(!e.hasShadowHighlights||!e.mainDepth||!e.screenSpaceShadowHighlightFbo?.getTexture())return!1;const{camera:s,lighting:a}=e;this._passParameters.opacityElevation=1-t(O,y,s.relativeElevation);const r=1===this.viewingMode?o(b,s.center):c(b,0,0,1),h=n(r,a.mainLight.direction);return this._passParameters.dayNightTerminator=t(0,1,i(30*h,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=_}};e([r()],P.prototype,"produces",void 0),e([r()],P.prototype,"consumes",void 0),e([r({constructOnly:!0})],P.prototype,"viewingMode",void 0),P=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],P);const b=p();export{P as ShadowHighlight};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as s,add as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromRay as a,getStart as l,getEnd as h,create as o}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as c}from"../../../../../geometry/support/frustum.js";import{copy as d}from"../../../../../geometry/support/lineSegment.js";import{wrap as p}from"../../../../../geometry/support/ray.js";import{InternalRenderCategory as u}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{Blit as _}from"../blit/Blit.js";import{LaserlinePathData as g}from"./LaserlinePathData.js";import{LaserlinePathPassParameters as b,LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as P}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlineTechnique as E}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as q}from"./LaserlineTechniqueConfiguration.js";import{updateParameters as L}from"../../materials/internal/MaterialUtil.js";let V=class extends m{constructor(e){super(e),this.isDecoration=!0,this.produces=u.LASERLINES,this.consumes={required:[u.LASERLINES,"normals"]},this.requireGeometryDepth=!0,this._configuration=new q,this._pathTechniqueConfiguration=new P,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._passParameters=new b;const t=e.view.stage.renderView.techniques,i=new P;i.contrastControlEnabled=e.contrastControlEnabled,t.precompile(f,i)}initialize(){this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._pathTechniqueConfiguration.spherical=1===this.view.state.viewingMode,this._pathTechniqueConfiguration.contrastControlEnabled=this.contrastControlEnabled,this._techniques.precompile(f,this._pathTechniqueConfiguration),this._blit=new _(this._techniques,2)}destroy(){this._pathVerticalPlaneData=t(this._pathVerticalPlaneData),this._blit=null}get _techniques(){return this.view.stage.renderView.techniques}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(1))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){s(this._passParameters.heightManifoldTarget,e),this.requestRender(1)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(1))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){s(this._passParameters.pointDistanceTarget,e),this.requestRender(1)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){s(this._passParameters.pointDistanceOrigin,e),this.requestRender(1)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(1))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){d(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(1)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(1))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){d(e,this._passParameters.intersectsLineSegment),this.requestRender(1)}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(1))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(1))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new g(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new g(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}setParameters(e){L(this._passParameters,e)&&this.requestRender(1)}precompile(){this._acquireTechnique(),this._blit?.precompile(),this.pathVerticalPlaneEnabled&&this._pathVerticalPlaneData&&this._techniques.precompile(f,this._pathTechniqueConfiguration)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this.isDecoration&&!this.bindParameters.decorations||null==this._blit)return t;const i=this.renderingContext,n=e.find(({name:e})=>"normals"===e);if(this._passParameters.normals=n?.getTexture(),!this.contrastControlEnabled)return i.bindFramebuffer(t.fbo),this._renderLaserLines(),t;this._passParameters.colors=t.getTexture();const s=this.fboCache.acquire(t.fbo.width,t.fbo.height,"laser lines");return i.bindFramebuffer(s.fbo),i.setClearColor(0,0,0,0),i.clear(16640),this._renderLaserLines(),i.unbindTexture(t.getTexture()),this._blit.blend(i,s,t,this.bindParameters)||this.requestRender(1),s.release(),t}_renderLaserLines(){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(),this.pathVerticalPlaneEnabled&&this._renderPath()}_acquireTechnique(){return this._configuration.heightManifoldEnabled=this.heightManifoldEnabled,this._configuration.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._configuration.pointDistanceEnabled=this.pointDistanceEnabled,this._configuration.intersectsLineEnabled=this.intersectsLineEnabled,this._configuration.contrastControlEnabled=this.contrastControlEnabled,this._configuration.spherical=1===this.view.state.viewingMode,this._techniques.getCompiled(E,this._configuration)}_renderUnified(){if(!this._updatePassParameters())return;const e=this._acquireTechnique();if(e){const t=this.renderingContext;t.bindTechnique(e,this.bindParameters,this._passParameters),t.screen.draw()}else this.requestRender(1)}_renderPath(){if(null==this._pathVerticalPlaneData)return;const e=this._techniques.get(f,this._pathTechniqueConfiguration);if(e.compiled){const t=this.renderingContext;this._passParameters.origin=this._pathVerticalPlaneData.origin,t.bindTechnique(e,this.bindParameters,this._passParameters),this._pathVerticalPlaneData.draw(t)}else this.requestRender(1)}_updatePassParameters(){if(!this._intersectsLineEnabled)return!0;const e=this.bindParameters.camera,t=this._passParameters;if(this._intersectsLineInfinite){if(a(p(t.intersectsLineSegment.origin,t.intersectsLineSegment.vector),D),D.c0=-Number.MAX_VALUE,!c(e.frustum,D))return!1;l(D,t.lineStartWorld),h(D,t.lineEndWorld)}else s(t.lineStartWorld,t.intersectsLineSegment.origin),r(t.lineEndWorld,t.intersectsLineSegment.origin,t.intersectsLineSegment.vector);return!0}get test(){}};e([i({constructOnly:!0})],V.prototype,"contrastControlEnabled",void 0),e([i()],V.prototype,"isDecoration",void 0),e([i()],V.prototype,"produces",void 0),e([i()],V.prototype,"consumes",void 0),V=e([n("esri.views.3d.webgl-engine.effects.laserlines.LaserLineRenderer")],V);const D=o();export{V as LaserLineRenderer};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as s,add as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromRay as a,getStart as l,getEnd as h,create as o}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as c}from"../../../../../geometry/support/frustum.js";import{copy as d}from"../../../../../geometry/support/lineSegment.js";import{wrap as p}from"../../../../../geometry/support/ray.js";import{InternalRenderCategory as u}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{Blit as _}from"../blit/Blit.js";import{LaserlinePathData as g}from"./LaserlinePathData.js";import{LaserlinePathPassParameters as b,LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as P}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlineTechnique as E}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as q}from"./LaserlineTechniqueConfiguration.js";import{updateParameters as L}from"../../materials/internal/MaterialUtil.js";let V=class extends m{get requireGeometryDepth(){return!0}constructor(e){super(e),this.isDecoration=!0,this.produces=u.LASERLINES,this.consumes={required:[u.LASERLINES,"normals"]},this._configuration=new q,this._pathTechniqueConfiguration=new P,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._passParameters=new b;const t=e.view.stage.renderView.techniques,i=new P;i.contrastControlEnabled=e.contrastControlEnabled,t.precompile(f,i)}initialize(){this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._pathTechniqueConfiguration.spherical=1===this.view.state.viewingMode,this._pathTechniqueConfiguration.contrastControlEnabled=this.contrastControlEnabled,this._techniques.precompile(f,this._pathTechniqueConfiguration),this._blit=new _(this._techniques,2)}destroy(){this._pathVerticalPlaneData=t(this._pathVerticalPlaneData),this._blit=null}get _techniques(){return this.view.stage.renderView.techniques}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(1))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){s(this._passParameters.heightManifoldTarget,e),this.requestRender(1)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(1))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){s(this._passParameters.pointDistanceTarget,e),this.requestRender(1)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){s(this._passParameters.pointDistanceOrigin,e),this.requestRender(1)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(1))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){d(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(1)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(1))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){d(e,this._passParameters.intersectsLineSegment),this.requestRender(1)}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(1))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(1))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new g(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new g(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}setParameters(e){L(this._passParameters,e)&&this.requestRender(1)}precompile(){this._acquireTechnique(),this._blit?.precompile(),this.pathVerticalPlaneEnabled&&this._pathVerticalPlaneData&&this._techniques.precompile(f,this._pathTechniqueConfiguration)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this.isDecoration&&!this.bindParameters.decorations||null==this._blit)return t;const i=this.renderingContext,n=e.find(({name:e})=>"normals"===e);if(this._passParameters.normals=n?.getTexture(),!this.contrastControlEnabled)return i.bindFramebuffer(t.fbo),this._renderLaserLines(),t;this._passParameters.colors=t.getTexture();const s=this.fboCache.acquire(t.fbo.width,t.fbo.height,"laser lines");return i.bindFramebuffer(s.fbo),i.setClearColor(0,0,0,0),i.clear(16640),this._renderLaserLines(),i.unbindTexture(t.getTexture()),this._blit.blend(i,s,t,this.bindParameters)||this.requestRender(1),s.release(),t}_renderLaserLines(){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(),this.pathVerticalPlaneEnabled&&this._renderPath()}_acquireTechnique(){return this._configuration.heightManifoldEnabled=this.heightManifoldEnabled,this._configuration.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._configuration.pointDistanceEnabled=this.pointDistanceEnabled,this._configuration.intersectsLineEnabled=this.intersectsLineEnabled,this._configuration.contrastControlEnabled=this.contrastControlEnabled,this._configuration.spherical=1===this.view.state.viewingMode,this._techniques.getCompiled(E,this._configuration)}_renderUnified(){if(!this._updatePassParameters())return;const e=this._acquireTechnique();if(e){const t=this.renderingContext;t.bindTechnique(e,this.bindParameters,this._passParameters),t.screen.draw()}else this.requestRender(1)}_renderPath(){if(null==this._pathVerticalPlaneData)return;const e=this._techniques.get(f,this._pathTechniqueConfiguration);if(e.compiled){const t=this.renderingContext;this._passParameters.origin=this._pathVerticalPlaneData.origin,t.bindTechnique(e,this.bindParameters,this._passParameters),this._pathVerticalPlaneData.draw(t)}else this.requestRender(1)}_updatePassParameters(){if(!this._intersectsLineEnabled)return!0;const e=this.bindParameters.camera,t=this._passParameters;if(this._intersectsLineInfinite){if(a(p(t.intersectsLineSegment.origin,t.intersectsLineSegment.vector),D),D.c0=-Number.MAX_VALUE,!c(e.frustum,D))return!1;l(D,t.lineStartWorld),h(D,t.lineEndWorld)}else s(t.lineStartWorld,t.intersectsLineSegment.origin),r(t.lineEndWorld,t.intersectsLineSegment.origin,t.intersectsLineSegment.vector);return!0}get test(){}};e([i({constructOnly:!0})],V.prototype,"contrastControlEnabled",void 0),e([i()],V.prototype,"isDecoration",void 0),e([i()],V.prototype,"produces",void 0),e([i()],V.prototype,"consumes",void 0),V=e([n("esri.views.3d.webgl-engine.effects.laserlines.LaserLineRenderer")],V);const D=o();export{V as LaserLineRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as a,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as m}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{distanceFadeEnd as c,distanceFadeStart as h}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{g as l}from"../../../../../chunks/SSAO.glsl.js";import{SSAOBlurTechnique as u}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{DepthStencilAttachment as T}from"../../../../webgl/enums.js";import _ from"../../../../webgl/Texture.js";import{TextureDescriptor as P}from"../../../../webgl/TextureDescriptor.js";const S=2;let g=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=m.AMBIENT_ILLUMINATION,this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),e=>e.charCodeAt(0)),r=new P(32);r.wrapMode=33071,r.pixelFormat=6407,r.wrapMode=10497,r.hasMipmap=!0,this._passParameters.noiseTexture=new _(this.renderingContext,r,e),this.addHandles(s(()=>this.isEnabled(),()=>this._enableTime=i(0)))}destroy(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture)}precompile(){this.techniques.precompile(w),this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),a=t?.getTexture(T);if(!s||!a)return;const o=this.techniques.getCompiled(w),p=this.techniques.getCompiled(u);if(!o||!p)return this._enableTime=i(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=i(performance.now()));const d=this.renderingContext,f=this.view.qualitySettings.fadeDuration,b=this.bindParameters,_=b.camera,P=_.relativeElevation,g=r((c-P)/(c-h),0,1),j=f>0?Math.min(f,performance.now()-this._enableTime)/f:1,q=j*g;this._passParameters.normalTexture=s,this._passParameters.depthTexture=a,this._passParameters.projScale=1/_.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*x/l(_)**6*q;const A=_.fullViewport[2],v=_.fullViewport[3],C=this.fboCache.acquire(A,v,"ssao input",2);d.bindFramebuffer(C.fbo),d.setViewport(0,0,A,v),d.bindTechnique(o,b,this._passParameters,this._drawParameters),d.screen.draw();const y=Math.round(A/S),M=Math.round(v/S),O=this.fboCache.acquire(y,M,"ssao blur",0);d.bindFramebuffer(O.fbo),this._drawParameters.colorTexture=C.getTexture(),n(this._drawParameters.blurSize,0,S/v),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,y,M),d.screen.draw(),C.release();const I=this.fboCache.acquire(y,M,m.AMBIENT_ILLUMINATION,0);return d.bindFramebuffer(I.fbo),d.setViewport(0,0,A,v),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.colorTexture=O.getTexture(),n(this._drawParameters.blurSize,S/A,0),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,y,M),d.screen.draw(),d.setViewport4fv(_.fullViewport),O.release(),j<1&&this.requestRender(2),I}};e([a()],g.prototype,"consumes",void 0),e([a()],g.prototype,"produces",void 0),e([a({constructOnly:!0})],g.prototype,"isEnabled",void 0),g=e([o("esri.views.3d.webgl-engine.effects.ssao.SSAO")],g);const x=.5;export{g as SSAO,S as blurSizePixels};
2
+ import{__decorate as e}from"tslib";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as a,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{InternalRenderCategory as n}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{distanceFadeEnd as h,distanceFadeStart as c}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{g as u}from"../../../../../chunks/SSAO.glsl.js";import{SSAOBlurTechnique as l}from"./SSAOBlurTechnique.js";import{noiseData as d}from"./SSAONoiseData.js";import{SSAOPassParameters as f,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as w}from"./SSAOTechnique.js";import{DepthStencilAttachment as T}from"../../../../webgl/enums.js";import _ from"../../../../webgl/Texture.js";import{TextureDescriptor as P}from"../../../../webgl/TextureDescriptor.js";const g=2;let S=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=n.AMBIENT_ILLUMINATION,this._enableTime=i(0),this._passParameters=new f,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(d),e=>e.charCodeAt(0)),r=new P(32);r.wrapMode=33071,r.pixelFormat=6407,r.wrapMode=10497,r.hasMipmap=!0,this._passParameters.noiseTexture=new _(this.renderingContext,r,e),this.addHandles(s(()=>this.view.stage.renderer.hasAmbientIllumination,()=>this._enableTime=i(0)))}destroy(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture)}precompile(){this.techniques.precompile(w),this.techniques.precompile(l)}render(e){const t=e.find(({name:e})=>"normals"===e),s=t?.getTexture(),a=t?.getTexture(T);if(!s||!a)return;const o=this.techniques.getCompiled(w),p=this.techniques.getCompiled(l);if(!o||!p)return this._enableTime=i(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=i(performance.now()));const d=this.renderingContext,f=this.view.qualitySettings.fadeDuration,b=this.bindParameters,_=b.camera,P=_.relativeElevation,S=r((h-P)/(h-c),0,1),j=f>0?Math.min(f,performance.now()-this._enableTime)/f:1,q=j*S;this._passParameters.normalTexture=s,this._passParameters.depthTexture=a,this._passParameters.projScale=1/_.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*x/u(_)**6*q;const A=_.fullViewport[2],v=_.fullViewport[3],C=this.fboCache.acquire(A,v,"ssao input",2);d.bindFramebuffer(C.fbo),d.setViewport(0,0,A,v),d.bindTechnique(o,b,this._passParameters,this._drawParameters),d.screen.draw();const M=Math.round(A/g),I=Math.round(v/g),y=this.fboCache.acquire(M,I,"ssao blur",0);d.bindFramebuffer(y.fbo),this._drawParameters.colorTexture=C.getTexture(),m(this._drawParameters.blurSize,0,g/v),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,M,I),d.screen.draw(),C.release();const N=this.fboCache.acquire(M,I,n.AMBIENT_ILLUMINATION,0);return d.bindFramebuffer(N.fbo),d.setViewport(0,0,A,v),d.setClearColor(1,1,1,0),d.clear(16384),this._drawParameters.colorTexture=y.getTexture(),m(this._drawParameters.blurSize,g/A,0),d.bindTechnique(p,b,this._passParameters,this._drawParameters),d.setViewport(0,0,M,I),d.screen.draw(),d.setViewport4fv(_.fullViewport),y.release(),j<1&&this.requestRender(2),N}};e([a()],S.prototype,"consumes",void 0),e([a()],S.prototype,"produces",void 0),S=e([o("esri.views.3d.webgl-engine.effects.ssao.SSAO")],S);const x=.5;export{S as SSAO,g as blurSizePixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{O as e}from"../../../../../chunks/OITBlend.glsl.js";import{OITBlendTechnique as t}from"./OITBlendTechnique.js";import{OITBlendTechniqueConfiguration as i}from"./OITBlendTechniqueConfiguration.js";import{OITDimTechnique as s}from"./OITDimTechnique.js";import{ColorAttachment2 as r,ColorAttachment1 as n,DrawBufferNone as o}from"../../../../webgl/enums.js";class a{constructor(t){this._techniques=t,this._parameters=new e,this._configuration=new i}precompile({useFloatBlend:e,hasEmission:i},r,n){this._configuration.useFloatBlend=e.value,this._configuration.hasEmission=i,this._configuration.computeHudOcclusion=r,this._configuration.frontFaceMask=1===n,this._techniques.precompile(t,this._configuration),i&&1!==n&&this._techniques.precompile(s)}blend(e,i,a,u,c,h,m){if(this._configuration.useFloatBlend=u.useFloatBlend.value,this._configuration.hasEmission=c,this._configuration.computeHudOcclusion=h,this._configuration.frontFaceMask=1===m,this._parameters.colorTexture=i.getTexture(),this._parameters.alphaTexture=i.getTexture(c?r:n),this._parameters.frontFaceTexture=a.getTexture(),c){if(1!==m){const t=this._techniques.get(s);e.bindTechnique(t,u,this._parameters);const i=e.setDrawBuffers([o,n]);e.screen.draw(),e.setDrawBuffers(i)}this._parameters.emissionTexture=i.getTexture(n),this._parameters.emissionFrontFaceTexture=a.getTexture(n)}const f=this._techniques.get(t,this._configuration);e.bindTechnique(f,u,this._parameters),e.screen.draw()}}export{a as OITBlend};
2
+ import{O as e}from"../../../../../chunks/OITBlend.glsl.js";import{OITBlendTechnique as t}from"./OITBlendTechnique.js";import{OITBlendTechniqueConfiguration as i}from"./OITBlendTechniqueConfiguration.js";import{OITDimTechnique as s}from"./OITDimTechnique.js";import{ColorAttachment2 as n,ColorAttachment1 as r,DrawBufferNone as o}from"../../../../webgl/enums.js";class a{constructor(t){this._techniques=t,this._parameters=new e,this._configuration=new i}precompile({useFloatBlend:e,hasEmission:i,emissions:n},r,o){this._configuration.useFloatBlend=e.value,this._configuration.hasEmission=i,this._configuration.computeHudOcclusion=r,this._configuration.frontFaceMask=1===o,this._techniques.precompile(t,this._configuration),0!==n&&2!==n&&1!==o&&this._techniques.precompile(s)}blend(e,i,a,u,c,h,m){if(this._configuration.useFloatBlend=u.useFloatBlend.value,this._configuration.hasEmission=c,this._configuration.computeHudOcclusion=h,this._configuration.frontFaceMask=1===m,this._parameters.colorTexture=i.getTexture(),this._parameters.alphaTexture=i.getTexture(c?n:r),this._parameters.frontFaceTexture=a.getTexture(),c){if(1!==m&&2!==u.emissions){const t=this._techniques.get(s);e.bindTechnique(t,u,this._parameters);const i=e.setDrawBuffers([o,r]);e.screen.draw(),e.setDrawBuffers(i)}this._parameters.emissionTexture=i.getTexture(r),this._parameters.emissionFrontFaceTexture=a.getTexture(r)}const f=this._techniques.get(t,this._configuration);e.bindTechnique(f,u,this._parameters),e.screen.draw()}}export{a as OITBlend};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import h from"../../webgl/RenderCamera.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as r}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as n}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as l}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as o}from"../lighting/SceneLighting.js";class g{constructor(t,i){this.width=t,this.height=i}}const a=5e5;class c{constructor(t,s){this._rctx=t,this.shadowMap=s,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.hasEmission=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=new h,this._inverseViewport=e(),this._oldLighting=new o,this._newLighting=new o,this._fadedLighting=new o,this._lighting=this._newLighting,this.screenSpaceReflections=new l,this.reprojection=new n,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=e(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new r,this.hasShadowHighlights=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=t(this.depth),this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.terrainDepth=null,this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return 1===this.output&&this.camera.relativeElevation<a}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,e,h){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=e,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===h&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return s(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}export{c as BindParameters,g as ViewportSize};
2
+ import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import s from"../../webgl/RenderCamera.js";import{isColor as h}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as r}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as n}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as o}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as l}from"../lighting/SceneLighting.js";class g{constructor(t,i){this.width=t,this.height=i}}const a=5e5;class c{constructor(t,h){this._rctx=t,this.shadowMap=h,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.emissions=0,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=new s,this._inverseViewport=e(),this._oldLighting=new l,this._newLighting=new l,this._fadedLighting=new l,this._lighting=this._newLighting,this.screenSpaceReflections=new o,this.reprojection=new n,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightMixOrigin=e(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new r,this.hasShadowHighlights=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=t(this.depth),this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.screenSpaceShadowHighlightFbo=t(this.screenSpaceShadowHighlightFbo),this.terrainDepth=null,this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get hasEmission(){return 0!==this.emissions}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return 1===this.output&&this.camera.relativeElevation<a}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,e,s){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=e,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===s&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return h(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}export{c as BindParameters,g as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{generateUID as r}from"../../../../core/uid.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import{updateParameters as t}from"../materials/internal/MaterialUtil.js";import{NoParameters as s}from"../../../webgl/NoParameters.js";class i{constructor(e,s){this.id=r(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new s,t(this._parameters,e),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(r){return!1}setParameters(r,e=!0){t(this._parameters,r)&&(this.validateParameters(this._parameters),e&&this._parametersChanged())}validateParameters(r){}shouldRender(r){return this.visible&&this.isVisibleForOutput(r.output)&&(!this.parameters.isDecoration||r.bind.decorations)&&0!==(this.parameters.renderOccluded&r.renderOccludedMask)}isVisibleForOutput(r){return!0}get renderPriority(){return this._renderPriority}set renderPriority(r){r!==this._renderPriority&&(this._renderPriority=r,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(r){return this.updateConfiguration(r),this._configuration}updateConfiguration(r){this._configuration.output=r.output,this._configuration.hasEmission=r.hasEmission&&e(r.output),this._configuration.hasHighlightMixTexture=10===r.output&&null!=r.highlightMixTexture,this._configuration.useFloatBlend=r.useFloatBlend.value}}class a extends s{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}}export{i as Material,a as MaterialParameters};
2
+ import{generateUID as r}from"../../../../core/uid.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import{updateParameters as t}from"../materials/internal/MaterialUtil.js";import{NoParameters as s}from"../../../webgl/NoParameters.js";class i{constructor(e,s){this.id=r(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new s,t(this._parameters,e),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(r){return!1}setParameters(r,e=!0){t(this._parameters,r)&&(this.validateParameters(this._parameters),e&&this._parametersChanged())}validateParameters(r){}shouldRender(r){return this.visible&&this.isVisibleForOutput(r.output)&&(!this.parameters.isDecoration||r.bind.decorations)&&0!==(this.parameters.renderOccluded&r.renderOccludedMask)}isVisibleForOutput(r){return!0}get renderPriority(){return this._renderPriority}set renderPriority(r){r!==this._renderPriority&&(this._renderPriority=r,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return 0}getConfiguration(r){return this.updateConfiguration(r),this._configuration}updateConfiguration(r){this._configuration.output=r.output,this._configuration.hasEmission=r.hasEmission&&e(r.output),this._configuration.hasHighlightMixTexture=10===r.output&&null!=r.highlightMixTexture,this._configuration.useFloatBlend=r.useFloatBlend.value}}class a extends s{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}}export{i as Material,a as MaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{sub as n,set as t,copy as i,cross as o,normalize as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as s,setMax as r,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{assert as u}from"./Util.js";class a{constructor(n=0,t=!1,i=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=i}}const l=f();function h(t,i,o,e,c,s){if(!t.visible)return;const r=n(E,e,o),{tolerance:f}=i,l=new a(f,!1,i.options.normalRequired);if(t.boundingInfo)u(0===t.type),p(t.boundingInfo,o,r,f,c,l,s);else{const n=t.positionAttribute,i=t.primitivePositionIndices;T(o,r,0,i.length/3,i,n.data,n.stride,c,l,s)}}const m=c();function p(n,t,i,o,e,c,f){if(null==n)return;const u=C(i,m);if(s(l,n.bbMin),r(l,n.bbMax),null!=e&&e.applyToAabb(l),U(l,t,u,o)){const{primitiveIndices:s,position:r}=n,u=s?s.length:r.indices.length/3;if(u>z){const s=n.getChildren();if(void 0!==s){for(const n of s)p(n,t,i,o,e,c,f);return}}q(t,i,0,u,r.indices,r.data,r.stride,s,e,c,f)}}const b=c();function M(t,i,o,e,c,s,r,f,u){const{data:a,stride:l}=s;T(t,n(E,i,t),o,e,c,a,l,r,f,u)}function d(n,t,i,o){if(!i.visible)return;const{boundingInfo:e}=i;if(e){const{bbMin:i,bbMax:o}=e;if(n<i[0]||n>o[0]||t<i[1]||t>o[1])return}const c=i.positionAttribute,s=i.primitivePositionIndices;x(n,t,0,s.length/3,s,c,o)}function x(n,t,i,o,e,c,s){const{data:r,stride:f}=c;for(let u=i;u<o;++u){const i=3*u,o=f*e[i],c=f*e[i+1],a=f*e[i+2],l=r[o+0]-n,h=r[o+1]-t,m=r[c+0]-n,p=r[c+1]-t,b=r[a+0]-n,M=r[a+1]-t,d=b*p-M*m,x=l*M-h*b,g=m*h-p*l;(d<0||x<0||g<0)&&(d>0||x>0||g>0)||s(0,null,u)}}function g(n,t,i,o,e,c,s,r,f,u=null,a=0){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2];for(let x=i;x<o;++x){const n=a+(u?.[x]??x),t=3*n,i=s*e[t],o=c[i],g=c[i+1],y=c[i+2],v=s*e[t+1],q=c[v],T=c[v+1],V=c[v+2],I=s*e[t+2],R=q-o,A=T-g,B=V-y,P=c[I]-o,w=c[I+1]-g,C=c[I+2]-y,U=M*C-w*d,k=d*P-C*p,z=p*w-P*M,E=R*U+A*k+B*z;if(Math.abs(E)<=D)continue;const F=l-o,G=h-g,H=m-y,J=F*U+G*k+H*z;if(E>0){if(J<0||J>E)continue}else if(J>0||J<E)continue;const K=G*B-A*H,L=H*R-B*F,N=F*A-R*G,O=p*K+M*L+d*N;if(E>0){if(O<0||J+O>E)continue}else if(O>0||J+O<E)continue;const Q=(P*K+w*L+C*N)/E;if(Q>=0){f(Q,r?j(R,A,B,P,w,C,b):null,n)}}}function y(n,t,i,o,e,c,s,r){const f=n[0],u=n[1],a=n[2],l=t[0],h=t[1],m=t[2];for(let p=i;p<o;++p){const n=3*p,t=n+1,i=n+2,o=c*n,M=e[o],d=e[o+1],x=e[o+2],g=c*t,y=c*i,v=e[g]-M,q=e[g+1]-d,T=e[g+2]-x,V=e[y]-M,I=e[y+1]-d,R=e[y+2]-x,A=h*R-I*m,B=m*V-R*l,P=l*I-V*h,w=v*A+q*B+T*P;if(Math.abs(w)<=D)continue;const C=f-M,U=u-d,k=a-x,z=C*A+U*B+k*P;if(w>0){if(z<0||z>w)continue}else if(z>0||z<w)continue;const E=U*T-q*k,F=k*v-T*C,G=C*q-v*U,H=l*E+h*F+m*G;if(w>0){if(H<0||z+H>w)continue}else if(H>0||z+H<w)continue;const J=(V*E+I*F+R*G)/w;if(J>=0){r(J,s?j(v,q,T,V,I,R,b):null,p)}}}function v(n,t,i,o,e,c,s,r,f,u,a,l=null,h=0){const m=n[0],p=n[1],M=n[2],d=t[0],x=t[1],g=t[2];for(let y=i;y<o;++y){const n=h+(l?.[y]??y),t=3*n,i=s*e[t],o=c[i],v=c[i+1],q=c[i+2],T=s*e[t+1],V=c[T],I=c[T+1],R=c[T+2],A=s*e[t+2],B=c[A],P=c[A+1],w=c[A+2],C=q-f,U=r/Math.sqrt(o*o+v*v+C*C),k=o+o*U,z=v+v*U,E=q+C*U,F=R-f,G=r/Math.sqrt(V*V+I*I+F*F),H=V+V*G,J=I+I*G,K=R+F*G,L=w-f,N=r/Math.sqrt(B*B+P*P+L*L),O=H-k,Q=J-z,S=K-E,W=B+B*N-k,X=P+P*N-z,Y=w+L*N-E,Z=x*Y-X*g,$=g*W-Y*d,_=d*X-W*x,nn=O*Z+Q*$+S*_;if(Math.abs(nn)<=D)continue;const tn=m-k,on=p-z,en=M-E,cn=tn*Z+on*$+en*_;if(nn>0){if(cn<0||cn>nn)continue}else if(cn>0||cn<nn)continue;const sn=on*S-Q*en,rn=en*O-S*tn,fn=tn*Q-O*on,un=d*sn+x*rn+g*fn;if(nn>0){if(un<0||cn+un>nn)continue}else if(un>0||cn+un<nn)continue;const an=(W*sn+X*rn+Y*fn)/nn;if(an>=0){a(an,u?j(O,Q,S,W,X,Y,b):null,n)}}}function q(n,t,i,o,e,c,s,r,f,u,a){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2],{normalRequired:x}=u;for(let g=i;g<o;++g){const n=r[g],t=3*n,i=s*e[t];let o=c[i],u=c[i+1],y=c[i+2];const v=s*e[t+1];let q=c[v],T=c[v+1],V=c[v+2];const I=s*e[t+2];let R=c[I],A=c[I+1],B=c[I+2];null!=f&&([o,u,y]=f.applyToVertex(o,u,y,g),[q,T,V]=f.applyToVertex(q,T,V,g),[R,A,B]=f.applyToVertex(R,A,B,g));const P=q-o,w=T-u,C=V-y,U=R-o,k=A-u,z=B-y,E=M*z-k*d,F=d*U-z*p,G=p*k-U*M,H=P*E+w*F+C*G;if(Math.abs(H)<=D)continue;const J=l-o,K=h-u,L=m-y,N=J*E+K*F+L*G;if(H>0){if(N<0||N>H)continue}else if(N>0||N<H)continue;const O=K*C-w*L,Q=L*P-C*J,S=J*w-P*K,W=p*O+M*Q+d*S;if(H>0){if(W<0||N+W>H)continue}else if(W>0||N+W<H)continue;const X=(U*O+k*Q+z*S)/H;if(X>=0){a(X,x?j(P,w,C,U,k,z,b):null,n)}}}function T(o,e,c,s,r,f,u,a,l,h){const m=e,p=F,b=Math.abs(m[0]),M=Math.abs(m[1]),d=Math.abs(m[2]),x=b>=M?b>=d?0:2:M>=d?1:2,g=x,y=m[g]<0?2:1,v=(x+y)%3,q=(x+(3-y))%3,T=m[v]/m[g],j=m[q]/m[g],B=1/m[g],P=V,w=I,C=R,{normalRequired:U}=l;for(let V=c;V<s;++V){const e=3*V,c=u*r[e];t(p[0],f[c+0],f[c+1],f[c+2]);const s=u*r[e+1];t(p[1],f[s+0],f[s+1],f[s+2]);const l=u*r[e+2];t(p[2],f[l+0],f[l+1],f[l+2]),a&&(i(p[0],a.applyToVertex(p[0][0],p[0][1],p[0][2],V)),i(p[1],a.applyToVertex(p[1][0],p[1][1],p[1][2],V)),i(p[2],a.applyToVertex(p[2][0],p[2][1],p[2][2],V))),n(P,p[0],o),n(w,p[1],o),n(C,p[2],o);const m=P[v]-T*P[g],b=P[q]-j*P[g],M=w[v]-T*w[g],d=w[q]-j*w[g],x=C[v]-T*C[g],y=C[q]-j*C[g],I=x*d-y*M,R=m*y-b*x,k=M*b-d*m;if((I<0||R<0||k<0)&&(I>0||R>0||k>0))continue;const z=I+R+k;if(0===z)continue;const D=I*(B*P[g])+R*(B*w[g])+k*(B*C[g]);if(D*Math.sign(z)<0)continue;const E=D/z;if(E>=0){h(E,U?A(p):null,V)}}}const V=c(),I=c(),R=c();function j(n,i,c,s,r,f,u){return t(B,n,i,c),t(P,s,r,f),o(u,B,P),e(u,u),u}function A(t){return n(B,t[1],t[0]),n(P,t[2],t[0]),o(b,B,P),e(b,b),b}const B=c(),P=c();function w(n,i,o){return t(o,1/(i[0]-n[0]),1/(i[1]-n[1]),1/(i[2]-n[2]))}function C(n,i){return t(i,1/n[0],1/n[1],1/n[2])}function U(n,t,i,o){return k(n,t,i,o,1/0)}function k(n,t,i,o,e){const c=(n[0]-o-t[0])*i[0],s=(n[3]+o-t[0])*i[0];let r=Math.min(c,s),f=Math.max(c,s);const u=(n[1]-o-t[1])*i[1],a=(n[4]+o-t[1])*i[1];if(f=Math.min(f,Math.max(u,a)),f<0)return!1;if(r=Math.max(r,Math.min(u,a)),r>f)return!1;const l=(n[2]-o-t[2])*i[2],h=(n[5]+o-t[2])*i[2];return f=Math.min(f,Math.max(l,h)),!(f<0)&&(r=Math.max(r,Math.min(l,h)),!(r>f)&&r<e)}const z=1e3,D=1e-7,E=c(),F=[c(),c(),c()];export{a as MeshIntersectionOptions,w as computeInvDir,C as computeInvDirFromDirection,j as computeNormalFromBarycentric,U as intersectAabbInvDir,k as intersectAabbInvDirBefore,g as intersectRayTriangles,T as intersectRayTrianglesWithDisplacementWatertight,v as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,h as intersectTriangleGeometry,d as intersectTriangleGeometry2D,M as intersectTriangles,x as intersectTriangles2d,D as triangleRayParallelTolerance};
2
+ import{sub as n,set as t,copy as i,cross as o,normalize as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as s,setMax as r,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{assert as u}from"./Util.js";class a{constructor(n=0,t=!1,i=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=i}}const l=f();function h(t,i,o,e,c,s){if(!t.visible)return;const r=n(F,e,o),{tolerance:f}=i,l=new a(f,!1,i.options.normalRequired);if(t.boundingInfo)u(0===t.type),p(t.boundingInfo,o,r,f,c,l,s);else{const n=t.positionAttribute,i=t.primitivePositionIndices;T(o,r,0,i.length/3,i,n.data,n.stride,c,l,s)}}const m=c();function p(n,t,i,o,e,c,f){if(null==n)return;const u=C(i,m);if(s(l,n.bbMin),r(l,n.bbMax),null!=e&&e.applyToAabb(l),U(l,t,u,o)){const{primitiveIndices:s,position:r}=n,u=s?s.length:r.indices.length/3;if(u>z){const s=n.getChildren();if(void 0!==s){for(const n of s)p(n,t,i,o,e,c,f);return}}q(t,i,0,u,r.indices,r.data,r.stride,s,e,c,f)}}const b=c();function M(t,i,o,e,c,s,r,f,u){const{data:a,stride:l}=s;T(t,n(F,i,t),o,e,c,a,l,r,f,u)}function d(n,t,i,o){if(!i.visible)return;const{boundingInfo:e}=i;if(e){const{bbMin:i,bbMax:o}=e;if(n<i[0]||n>o[0]||t<i[1]||t>o[1])return}const c=i.positionAttribute,s=i.primitivePositionIndices;x(n,t,0,s.length/3,s,c,o)}function x(n,t,i,o,e,c,s){const{data:r,stride:f}=c;for(let u=i;u<o;++u){const i=3*u,o=f*e[i],c=f*e[i+1],a=f*e[i+2],l=r[o+0]-n,h=r[o+1]-t,m=r[c+0]-n,p=r[c+1]-t,b=r[a+0]-n,M=r[a+1]-t,d=b*p-M*m,x=l*M-h*b,g=m*h-p*l;(d<0||x<0||g<0)&&(d>0||x>0||g>0)||s(0,null,u)}}function g(n,t,i,o,e,c,s,r,f,u=null,a=0){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2];for(let x=i;x<o;++x){const n=a+(u?.[x]??x),t=3*n,i=s*e[t],o=c[i],g=c[i+1],y=c[i+2],v=s*e[t+1],q=c[v],T=c[v+1],V=c[v+2],I=s*e[t+2],R=q-o,A=T-g,B=V-y,P=c[I]-o,w=c[I+1]-g,C=c[I+2]-y,U=M*C-w*d,k=d*P-C*p,z=p*w-P*M,D=R*U+A*k+B*z,F=D*D;if(F<=E)continue;const G=l-o,H=h-g,J=m-y,K=(G*U+H*k+J*z)*D;if(K<0||K>F)continue;const L=H*B-A*J,N=J*R-B*G,O=G*A-R*H,Q=(p*L+M*N+d*O)*D;if(Q<0||K+Q>F)continue;const S=(P*L+w*N+C*O)/D;if(S>=0){f(S,r?j(R,A,B,P,w,C,b):null,n)}}}function y(n,t,i,o,e,c,s,r){const f=n[0],u=n[1],a=n[2],l=t[0],h=t[1],m=t[2];for(let p=i;p<o;++p){const n=3*p,t=n+1,i=n+2,o=c*n,M=e[o],d=e[o+1],x=e[o+2],g=c*t,y=c*i,v=e[g]-M,q=e[g+1]-d,T=e[g+2]-x,V=e[y]-M,I=e[y+1]-d,R=e[y+2]-x,A=h*R-I*m,B=m*V-R*l,P=l*I-V*h,w=v*A+q*B+T*P;if(Math.abs(w)<=D)continue;const C=f-M,U=u-d,k=a-x,z=C*A+U*B+k*P;if(w>0){if(z<0||z>w)continue}else if(z>0||z<w)continue;const E=U*T-q*k,F=k*v-T*C,G=C*q-v*U,H=l*E+h*F+m*G;if(w>0){if(H<0||z+H>w)continue}else if(H>0||z+H<w)continue;const J=(V*E+I*F+R*G)/w;if(J>=0){r(J,s?j(v,q,T,V,I,R,b):null,p)}}}function v(n,t,i,o,e,c,s,r,f,u,a,l=null,h=0){const m=n[0],p=n[1],M=n[2],d=t[0],x=t[1],g=t[2];for(let y=i;y<o;++y){const n=h+(l?.[y]??y),t=3*n,i=s*e[t],o=c[i],v=c[i+1],q=c[i+2],T=s*e[t+1],V=c[T],I=c[T+1],R=c[T+2],A=s*e[t+2],B=c[A],P=c[A+1],w=c[A+2],C=q-f,U=r/Math.sqrt(o*o+v*v+C*C),k=o+o*U,z=v+v*U,E=q+C*U,F=R-f,G=r/Math.sqrt(V*V+I*I+F*F),H=V+V*G,J=I+I*G,K=R+F*G,L=w-f,N=r/Math.sqrt(B*B+P*P+L*L),O=H-k,Q=J-z,S=K-E,W=B+B*N-k,X=P+P*N-z,Y=w+L*N-E,Z=x*Y-X*g,$=g*W-Y*d,_=d*X-W*x,nn=O*Z+Q*$+S*_;if(Math.abs(nn)<=D)continue;const tn=m-k,on=p-z,en=M-E,cn=tn*Z+on*$+en*_;if(nn>0){if(cn<0||cn>nn)continue}else if(cn>0||cn<nn)continue;const sn=on*S-Q*en,rn=en*O-S*tn,fn=tn*Q-O*on,un=d*sn+x*rn+g*fn;if(nn>0){if(un<0||cn+un>nn)continue}else if(un>0||cn+un<nn)continue;const an=(W*sn+X*rn+Y*fn)/nn;if(an>=0){a(an,u?j(O,Q,S,W,X,Y,b):null,n)}}}function q(n,t,i,o,e,c,s,r,f,u,a){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2],{normalRequired:x}=u;for(let g=i;g<o;++g){const n=r[g],t=3*n,i=s*e[t];let o=c[i],u=c[i+1],y=c[i+2];const v=s*e[t+1];let q=c[v],T=c[v+1],V=c[v+2];const I=s*e[t+2];let R=c[I],A=c[I+1],B=c[I+2];null!=f&&([o,u,y]=f.applyToVertex(o,u,y,g),[q,T,V]=f.applyToVertex(q,T,V,g),[R,A,B]=f.applyToVertex(R,A,B,g));const P=q-o,w=T-u,C=V-y,U=R-o,k=A-u,z=B-y,E=M*z-k*d,F=d*U-z*p,G=p*k-U*M,H=P*E+w*F+C*G;if(Math.abs(H)<=D)continue;const J=l-o,K=h-u,L=m-y,N=J*E+K*F+L*G;if(H>0){if(N<0||N>H)continue}else if(N>0||N<H)continue;const O=K*C-w*L,Q=L*P-C*J,S=J*w-P*K,W=p*O+M*Q+d*S;if(H>0){if(W<0||N+W>H)continue}else if(W>0||N+W<H)continue;const X=(U*O+k*Q+z*S)/H;if(X>=0){a(X,x?j(P,w,C,U,k,z,b):null,n)}}}function T(o,e,c,s,r,f,u,a,l,h){const m=e,p=G,b=Math.abs(m[0]),M=Math.abs(m[1]),d=Math.abs(m[2]),x=b>=M?b>=d?0:2:M>=d?1:2,g=x,y=m[g]<0?2:1,v=(x+y)%3,q=(x+(3-y))%3,T=m[v]/m[g],j=m[q]/m[g],B=1/m[g],P=V,w=I,C=R,{normalRequired:U}=l;for(let V=c;V<s;++V){const e=3*V,c=u*r[e];t(p[0],f[c+0],f[c+1],f[c+2]);const s=u*r[e+1];t(p[1],f[s+0],f[s+1],f[s+2]);const l=u*r[e+2];t(p[2],f[l+0],f[l+1],f[l+2]),a&&(i(p[0],a.applyToVertex(p[0][0],p[0][1],p[0][2],V)),i(p[1],a.applyToVertex(p[1][0],p[1][1],p[1][2],V)),i(p[2],a.applyToVertex(p[2][0],p[2][1],p[2][2],V))),n(P,p[0],o),n(w,p[1],o),n(C,p[2],o);const m=P[v]-T*P[g],b=P[q]-j*P[g],M=w[v]-T*w[g],d=w[q]-j*w[g],x=C[v]-T*C[g],y=C[q]-j*C[g],I=x*d-y*M,R=m*y-b*x,k=M*b-d*m;if((I<0||R<0||k<0)&&(I>0||R>0||k>0))continue;const z=I+R+k;if(0===z)continue;const D=I*(B*P[g])+R*(B*w[g])+k*(B*C[g]);if(D*Math.sign(z)<0)continue;const E=D/z;if(E>=0){h(E,U?A(p):null,V)}}}const V=c(),I=c(),R=c();function j(n,i,c,s,r,f,u){return t(B,n,i,c),t(P,s,r,f),o(u,B,P),e(u,u),u}function A(t){return n(B,t[1],t[0]),n(P,t[2],t[0]),o(b,B,P),e(b,b),b}const B=c(),P=c();function w(n,i,o){return t(o,1/(i[0]-n[0]),1/(i[1]-n[1]),1/(i[2]-n[2]))}function C(n,i){return t(i,1/n[0],1/n[1],1/n[2])}function U(n,t,i,o){return k(n,t,i,o,1/0)}function k(n,t,i,o,e){const c=(n[0]-o-t[0])*i[0],s=(n[3]+o-t[0])*i[0];let r=Math.min(c,s),f=Math.max(c,s);const u=(n[1]-o-t[1])*i[1],a=(n[4]+o-t[1])*i[1];if(f=Math.min(f,Math.max(u,a)),f<0)return!1;if(r=Math.max(r,Math.min(u,a)),r>f)return!1;const l=(n[2]-o-t[2])*i[2],h=(n[5]+o-t[2])*i[2];return f=Math.min(f,Math.max(l,h)),!(f<0)&&(r=Math.max(r,Math.min(l,h)),!(r>f)&&r<e)}const z=1e3,D=1e-7,E=D*D,F=c(),G=[c(),c(),c()];export{a as MeshIntersectionOptions,w as computeInvDir,C as computeInvDirFromDirection,j as computeNormalFromBarycentric,U as intersectAabbInvDir,k as intersectAabbInvDirBefore,g as intersectRayTriangles,T as intersectRayTrianglesWithDisplacementWatertight,v as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,h as intersectTriangleGeometry,d as intersectTriangleGeometry2D,M as intersectTriangles,x as intersectTriangles2d,D as triangleRayParallelTolerance};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{NestedMap as e}from"../../../../core/NestedMap.js";function t(t){const f=new e;if(f.set(2,1,!0),f.set(2,4,!0),f.set(2,5,!0),f.set(2,0,!0),f.set(2,3,!0),f.set(2,2,!0),f.set(2,9,!0),"low"!==t&&(f.set(2,6,!0),f.set(2,7,!0)),"medium"===t)for(const e of s)f.set(0,e,!0),f.set(1,e,!0),f.set(2,e,!0);else if("high"===t)for(const e of o)f.set(0,e,!0),f.set(1,e,!0),f.set(2,e,!0);return f}const s=[10,8,1],o=[...s,0,3,4,5];export{t as setupFeatureDefaults};
2
+ import has from"../../../../core/has.js";import{NestedMap as t}from"../../../../core/NestedMap.js";function e(e){const r=new t;if(r.set(2,1,!0),r.set(2,5,!0),r.set(2,0,!0),r.set(2,3,!0),r.set(2,2,!0),r.set(2,9,!0),r.set(2,4,!0),has("global-illumination")&&(r.set(0,4,!0),r.set(1,4,!0)),"low"!==e&&(r.set(2,6,!0),r.set(2,7,!0)),"medium"===e)for(const t of s)r.set(0,t,!0),r.set(1,t,!0),r.set(2,t,!0);else if("high"===e)for(const t of o)r.set(0,t,!0),r.set(1,t,!0),r.set(2,t,!0);return r}const s=[10,8,1],o=[...s,0,3,4,5];export{e as setupFeatureDefaults};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{removeMaybe as s,abortMaybe as i,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 _,sync as u}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as g,multiply as b}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as T}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 A}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as D,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as I}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as F}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as N}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{hasOit8Bit as H,hasEmissive8Bit as M}from"../effects/fboFormatUtils.js";import{RenderNodes as G}from"../effects/RenderNodes.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as V}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as Z,defaultRenderOccludedMask as X}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ie}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{PixelType as le,ColorAttachment1 as _e,ColorAttachment2 as ue,ColorAttachment0 as pe}from"../../../webgl/enums.js";let me=class extends ee{constructor(e,t,r,s,i){super({stage:e}),this._techniques=r,this._rctx=s,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new ae,this.sceneDepthRange=p($.Infinite),this._state=p(2),this._hasOit8Bit=H(),this._hasEmissive8Bit=M(),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Re)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new F(s),this._compositor=new Y(s,r),this._renderStateFeatures=p(te(e.view.qualityProfile));const a=new ie(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,r),this._framebuffer=new K(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new j(r),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,r,s)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,s,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new G(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>i(),l),d(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),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]),i()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>i(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=s(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),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(),A()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new k(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(s=>s.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(5),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasEmissive8Bit||this.hasFloatBlend)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatBlend||this._hasOit8Bit}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const r=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:xe(this.stage.view.resourceController)});return this.addHandles(d(()=>r.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),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&&f(this._bindParameters.reprojection.matrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),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)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(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,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?s(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,r,s=!1){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(D.FINAL),null)}_render(e,t,r,s){const i=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:l}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const _=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=_?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,o),this._ensureBindParametersWeatherFader(this._renderContext.time),this._plugins.sortTestsTransparentOrderedSlots(Ce),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._hasTransparentGeometry=this._plugins.produces(0,...fe),this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const m=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,m),this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowAccumulation(m,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(),this._bindParameters.output=0,this._renderOpaque(),this._renderTransparent(),this._bindParameters.reprojection.lastFrameColor=n(this._bindParameters.reprojection.lastFrameColor),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(R.VIEWSHED,e)),u.update(e=>this._renderNodes(R.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.GROUND_DEPTH),u.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(D.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const f=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let g;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(R.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.hasEmission=this._hasEmission,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(D.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),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(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,R.OPAQUE_ENVIRONMENT,R.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...ge),this._bindParameters.output=0,this._plugins.precompile(...ge),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,R.FOCUSAREA);const r=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,r,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,R.TRANSPARENT_ENVIRONMENT,R.VIEWSHED,R.CUTFILL_COMPUTATION,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,D.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:r}=this._framebuffer.size;let s=this.fboCache.acquire(t,r,"olid");return s.acquireDepth(13),s=this._nodes.render(s,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,s}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readMainDepth(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),s.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,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,le.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquire(r,s,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,C),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.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,r){if(!this.shadowsEnabled)return;const s=this._bindParameters.shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(7,s),s.clear(),this._renderShadowCascades(6,s)):this._renderShadowCascades(5),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(R.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const r=this._bindParameters.output;t.bindFramebuffer();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=r}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.AMBIENT_ILLUMINATION,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.hasSSAO&&this._pluginInput.release("normals")}else this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=s.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),s.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"terrain",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=s.obtainDepthTexture(),s.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(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=$.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=$.Infinite);const t=e.clone();t.near=O,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",...S,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,be),this._needsDepth&&this._precompilePlugins(3,Pe)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"normals",5);s.acquireDepth(13),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...be);const i=this._nodes.optional("normals",...S,R.VIEWSHED);return s.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ge),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Te);this._renderContext.renderOccludedMask=X}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,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(10),this.renderSlots(e,...Te),this._renderContext.renderOccludedMask=X}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const r=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=r}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=s}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._bindParameters.output=s}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,R.GROUND_DEPTH,13);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,r.fbo,256),this._framebuffer.bind(),r}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Pe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ce),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ce)}_renderTransparentGeometry(){this._plugins.render(...fe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"transparent terrain"),s=()=>this._plugins.render(6);return this._renderToTargets(s,r,this._framebuffer.depth,C),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),r}_renderTransparentGround(){this._plugins.render(...ge)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquireDepth(this._hudDepthFormat,t,r,"line callouts");this._renderToTargets(e,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,r=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...Ee)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=r}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const s=!!t.getTexture(_e);this._compositor.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),s),r.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,r,s,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return 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:r}=this,{width:s,height:i}=this._framebuffer.size,{highlights:a}=r,n=a.length>B?3:1,h=e.acquire(s,i,"highlights",n);h.acquireDepth(13);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),V(t,e,s,i,r,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...I)+this._nodes.optional("highlights",...I)-1),h}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){this.oitEnabled&&N(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...fe)}_renderOIT(e,t=2){const r=1===e,{width:s,height:i}=this._framebuffer.size,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=r?"oit hud":"oit",_=this.fboCache.acquire(s,i,l,o),u=h.hasEmission&&(0===e||1!==t);u&&_.acquireColor(_e,o,"oit emissive");const p=u?ue:_e;_.acquireColor(p,this.hasFloatBlend?7:0,"oit alpha"),r||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,C),a(),_.detachDepth(),h.output=2;const m=this.fboCache.acquire(s,i,r?"oit hud front":"oit front");u&&m.acquireColor(_e,o,"oit emissive front"),r?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(C,r),a(),m.detachDepth();const c=this._pluginsHas.occludedHudElements&&!r;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,r?(f=this.fboCache.acquire(s,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(p,0,"hud occlusion"),this._rctx.clearBuffer(p-pe,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,_,m,h,u,c,e),f?.detachDepth(),r||(this._rctx.bindFramebuffer(m.fbo),this._framebuffer.bind(),c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(p))),m.release(),_.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ce)||this.plugins.produces(5,...ce)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(R.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(D.OPAQUE,t,e)),this.fboCache.debugCallback?.(D.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(R.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(R.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(D.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(D.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),r=t?.getTexture();r&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,r&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,r=!1){const s=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(s,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersSSR(e){const{screenSpaceReflections:t,reprojection:r,camera:s}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e),r.lastFrameCamera.equals(s)?this._reprojectionMatrix=P:(g(Ie,s.viewMatrix),g(Se,s.projectionMatrix),b(Oe,Ie,Se),b(Oe,r.lastFrameCamera.viewMatrix,Oe),b(Oe,r.lastFrameCamera.projectionMatrix,Oe),this._reprojectionMatrix=Oe);const i=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=i>0?Math.min(i,e-this._ssrEnableTime)/i:1,t.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,s){this._bindParameters.updateLighting(e,t,r,s),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}};e([m({readOnly:!0})],me.prototype,"highResolutionAtmosphere",null),e([m()],me.prototype,"_edgeView",void 0),e([m()],me.prototype,"updating",null),me=e([c("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,3],fe=[8,7,4,5],ge=[6,8,7],be=[0,1,2,4,...ge],Pe=[3,5],Te=[2,4,9],Ee=[17,13,15,14],we=[4,5,2,3,0,1,...ge],Ce=[4,9,5,12],Ae={0:[14],1:[13],2:[14,13],3:[14,13]},De=[0,1,...ge],Re=["normals","highlights"],Se=T(),Ie=T(),Oe=T();function xe(e){return t=>e.immediate.schedule(t)}export{me 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 r,abortMaybe as i,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 _,sync as u}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 T,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as w}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as D,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as F}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as N}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as H}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{hasOit8Bit as G,hasEmissive8Bit as M}from"../effects/fboFormatUtils.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as j}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as B}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as V,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as W}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{Compositor as $}from"./Compositor.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as K}from"./depthRangeUtils.js";import{MainFramebuffer as Z}from"./MainFramebuffer.js";import{RenderContext as X,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as _e,PixelType as ue,ColorAttachment2 as me,ColorAttachment0 as pe}from"../../../webgl/enums.js";let ce=class extends te{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this.sceneDepthRange=m(J.Infinite),this._state=m(2),this._hasGlobalIlluminationFlag=!!has("global-illumination"),this._hasOit8Bit=G(),this._hasEmissive8Bit=M(),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Re)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new N(r),this._compositor=new $(r,s),this._renderStateFeatures=m(se(e.view.qualityProfile));const a=new ae(this._fboCache,e.viewingMode);this._renderContext=new X(this._rctx,a,s),this._framebuffer=new Z(this._fboCache,this._bindParameters),this._performanceInfo=new de(this._rctx),this._blit=new U(s),this._shadowAccumulator=new ie(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new q(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new j({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>i(),l),d(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():I;w(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>i(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),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,Y.prune(),he.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new W(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(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(5),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasAmbientIllumination(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get _hasGlobalIllumination(){return this.hasAmbientIllumination&&this._hasGlobalIlluminationFlag}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmissions(){return this._hasEmissive8Bit||this.hasFloatBlend?this._plugins.hasEmissions:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatBlend||this._hasOit8Bit}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null,this._bindParameters.screenSpaceShadowHighlightFbo=n(this._bindParameters.screenSpaceShadowHighlightFbo)}_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._shadowAccumulator.readyToRun||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:Ne(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),u)),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,T)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),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)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(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,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...we),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(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?r(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,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(D.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:l}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.emissions=this._hasEmissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const _=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=_?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParameters(a,o,t),this._plugins.sortTestsTransparentOrderedSlots(Ie),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!r,this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(0,...fe),this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const p=this._computeShadowDepthRange(a);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(a,o,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(),this._bindParameters.output=0,this._renderOpaque(),this._renderTransparent(),this._bindParameters.reprojection.lastFrameColor=n(this._bindParameters.reprojection.lastFrameColor),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(R.VIEWSHED,e)),u.update(e=>this._renderNodes(R.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.GROUND_DEPTH),u.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===s?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(D.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.screenSpaceShadowHighlightFbo=n(this._bindParameters.screenSpaceShadowHighlightFbo),this._hasGlobalIllumination&&this._hasEmissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(_e)),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const b=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let f;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(R.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=this._hasEmissions,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(D.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),this._hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),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||(f=u.color,f.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new oe(f,c)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,R.OPAQUE_ENVIRONMENT,R.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...ge),this._bindParameters.output=0,this._plugins.precompile(...ge),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,R.FOCUSAREA);const s=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,R.TRANSPARENT_ENVIRONMENT,R.VIEWSHED,R.CUTFILL_COMPUTATION,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.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=this._hasEmissions,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,D.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,r}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 r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(I),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),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,I),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,s,r){if(!this.shadowsEnabled)return;const i=this._bindParameters.shadowMap;if(i.start(e,s,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.screenSpaceShadowHighlightFbo=this._nodes.produce(R.SCREEN_SPACE_SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}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(le.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(R.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=s}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this._hasGlobalIllumination+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.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(le.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return J.Zero;const t=K(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(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=J.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<B)return void(this.sceneDepthRange.value=J.Infinite);const t=e.clone();t.near=O,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",...S,R.VIEWSHED,R.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,Pe),this._needsDepth&&this._precompilePlugins(3,Te)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,R.SCREEN_SPACE_SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._bindParameters.output=4,this._plugins.render(...Pe);const i=this._nodes.optional("normals",...S,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasAmbientIllumination&&e)return this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(le.AMBIENT_ILLUMINATION),this._bindParameters.ssao}_renderGlobalIllumination(){if(!this.hasAmbientIllumination)return void this._releaseGlobalIlluminationBuffers();const e=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this.performanceInfo.advance(le.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){this._bindParameters.reprojection.lastFrameDepth=h(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=h(this._bindParameters.reprojection.lastFrameEmission),this._bindParameters.globalIllumination=h(this._bindParameters.globalIllumination)}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ge),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(10),this.renderSlots(e,...Ee),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){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){const{camera:t,contentCamera:s}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=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=r}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,R.GROUND_DEPTH,13);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(...Te)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...be),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...be)}_renderTransparentGeometry(){this._plugins.render(...fe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,I),this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...ge)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(this._hudDepthFormat,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(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._bindParameters.output=0,this._plugins.precompile(...we)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...we)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const r=!!t.getTexture(_e);this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),r),s.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.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:r,height:i}=this._framebuffer.size,{highlights:a}=s,n=a.length>V?3:1,h=e.acquire(r,i,"highlights",n);h.acquireDepth(13);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),k(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(le.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...F)+this._nodes.optional("highlights",...F)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ae),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){this.oitEnabled&&H(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...fe)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=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",_=this.fboCache.acquire(r,i,l,o),u=h.hasEmission&&(0===e||1!==t);u&&_.acquireColor(_e,o,"oit emissive");const m=u?me:_e;_.acquireColor(m,this.hasFloatBlend?7:0,"oit alpha"),s||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,I),a(),_.detachDepth(),h.output=2;const p=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");u&&p.acquireColor(_e,o,"oit emissive front"),s?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(I,s),a(),p.detachDepth();const c=this._pluginsHas.occludedHudElements&&!s;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(m,0,"hud occlusion"),this._rctx.clearBuffer(m-pe,I)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,_,p,h,u,c,e),b?.detachDepth(),s||(this._rctx.bindFramebuffer(p.fbo),this._framebuffer.bind(),c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(m))),p.release(),_.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...be)||this.plugins.produces(5,...be)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(R.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(D.OPAQUE,t,e)),this.fboCache.debugCallback?.(D.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(R.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(R.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(D.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(D.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),s=t?.getTexture();s&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,s&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const r=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParameters(e,t,s){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(s),this._ensureBindParametersScreenSpaceReflections(s),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(e){const{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(){const{reprojection:e,camera:t}=this._bindParameters;if(!(this.hasReflections||this._hasGlobalIllumination))return void(this._reprojectionMatrix=T);const{lastFrameCamera:s}=e,r=!s.equals(t);if(r?(f(Fe,t.viewMatrix),f(Se,t.projectionMatrix),g(Oe,Fe,Se),g(Oe,s.viewMatrix,Oe),g(Oe,s.projectionMatrix,Oe),this._reprojectionMatrix=Oe):this._reprojectionMatrix=T,this._hasGlobalIllumination){const{viewMatrix:t}=e;r?(g(xe,s.viewMatrix,Fe),P(t,xe)):P(t,T)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,a=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,a),e(),t.detachDepth()}get test(){}};e([p()],ce.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],ce.prototype,"hasAmbientIllumination",null),e([p({readOnly:!0})],ce.prototype,"highResolutionAtmosphere",null),e([p()],ce.prototype,"_edgeView",void 0),e([p()],ce.prototype,"updating",null),ce=e([c("esri.views.3d.webgl-engine.lib.Renderer")],ce);const be=[0,1,2,3],fe=[8,7,4,5],ge=[6,8,7],Pe=[0,1,2,4,...ge],Te=[3,5],Ee=[2,4,9],we=[17,13,15,14],Ae=[4,5,2,3,0,1,...ge],Ie=[4,9,5,12],Ce={0:[14],1:[13],2:[14,13],3:[14,13]},De=[0,1,...ge],Re=["normals","highlights"],Se=E(),Fe=E(),Oe=E(),xe=E();function Ne(e){return t=>e.immediate.schedule(t)}export{ce as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import t from"../../webgl/RenderCamera.js";class a{constructor(){this.lastFrameCamera=new t,this.matrix=r()}}export{a as ReprojectionUniforms};
2
+ import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import t from"../../webgl/RenderCamera.js";class a{constructor(){this.lastFrameCamera=new t,this.matrix=r(),this.viewMatrix=r()}}export{a as ReprojectionUniforms};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{glLayout as e}from"../../../support/buffer/glUtil.js";import{GLMaterialLoader as t}from"../GLMaterialLoader.js";import{VertexArrayObject as r}from"../VertexArrayObject.js";import{VertexBuffer as o}from"../../../../webgl/VertexBuffer.js";class s{constructor(s,i){this.geometry=i;const n=s.renderContext.rctx,a=i.renderGeometry,{material:m,layout:u,buffer:l}=a;this._materials=s.materials,m.setParameters({instancedDoublePrecision:!0}),this.glMaterialLoader=new t(m,this._materials),this.vbo=new o(n,e(u),l),this.vao=new r(n,this.vbo)}destroy(){this.glMaterialLoader.dispose(),this.vbo.dispose(),this.vao.dispose()}get material(){return this.geometry.renderGeometry.material}get layout(){return this.geometry.renderGeometry.layout}get boundingInfo(){return this.geometry.boundingInfo}get numTriangles(){return this.numVertices/3}get numVertices(){return this.geometry.renderGeometry.numVertices}get usedMemory(){return 128+this.vbo.usedMemory+this.vao.usedMemory}intersect(e,t,r,o,s,i,n,a){return this.geometry.intersect(e,t,r,o,s,i,n,a)}}export{s as LodComponentData};
2
+ import{glLayout as e}from"../../../support/buffer/glUtil.js";import{GLMaterialLoader as t}from"../GLMaterialLoader.js";import{VertexArrayObject as r}from"../VertexArrayObject.js";import{VertexBuffer as s}from"../../../../webgl/VertexBuffer.js";class i{constructor(i,o){this.geometry=o;const a=i.renderContext.rctx,n=o.renderGeometry,{material:m,layout:u,buffer:h}=n;this._materials=i.materials,m.setParameters({instancedDoublePrecision:!0}),this.glMaterialLoader=new t(m,this._materials),this.vbo=new s(a,e(u),h),this.vao=new r(a,this.vbo)}destroy(){this.glMaterialLoader.dispose(),this.vbo.dispose(),this.vao.dispose()}get material(){return this.geometry.renderGeometry.material}get hasEmissions(){return this.material.hasEmissions}get layout(){return this.geometry.renderGeometry.layout}get boundingInfo(){return this.geometry.boundingInfo}get numTriangles(){return this.numVertices/3}get numVertices(){return this.geometry.renderGeometry.numVertices}get usedMemory(){return 128+this.vbo.usedMemory+this.vao.usedMemory}intersect(e,t,r,s,i,o,a,n){return this.geometry.intersect(e,t,r,s,i,o,a,n)}}export{i as LodComponentData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{isSome as o}from"../../../../../core/arrayUtils.js";import{isAborted as n,throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as r,expandWithVec3 as i,center as s,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{LodComponentData as u}from"./LodComponentData.js";class a{static async create(e,r,i){const s=await Promise.allSettled(r.components.map(o=>e.controller.schedule(()=>new u(e,o.geometry),i))),c=s.map(o=>"fulfilled"===o.status?o.value:null).filter(o);if(n(i)||c.length!==s.length){c.forEach(o=>o.destroy()),t(i);for(const o of s)if("rejected"===o.status)throw o.reason}return new a(r.minScreenSpaceRadius,c)}constructor(o,n){this.minScreenSpaceRadius=o,this.components=n}destroy(){this.components.forEach(o=>o.destroy())}intersect(o,n,t,e,r,i,s){this.components.forEach(c=>c.intersect(o,n,t,e,r,i,this.boundingSphere,s))}get boundingBox(){if(null==this._boundingBox){const o=r();this.components.forEach(n=>{null!=n.boundingInfo&&(i(o,n.boundingInfo.bbMin),i(o,n.boundingInfo.bbMax))}),this._boundingBox=o}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const o=this.boundingBox,n=e();s(o,n),this._boundingSphere={center:n,radius:.5*c(o)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((o,n)=>o+n.numTriangles,0)}}export{a as LodLevel};
2
+ import{isSome as o}from"../../../../../core/arrayUtils.js";import{isAborted as n,throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithVec3 as r,center as i,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{LodComponentData as u}from"./LodComponentData.js";class a{static async create(e,s,r){const i=await Promise.allSettled(s.components.map(o=>e.controller.schedule(()=>new u(e,o.geometry),r))),c=i.map(o=>"fulfilled"===o.status?o.value:null).filter(o);if(n(r)||c.length!==i.length){c.forEach(o=>o.destroy()),t(r);for(const o of i)if("rejected"===o.status)throw o.reason}return new a(s.minScreenSpaceRadius,c)}constructor(o,n){this.minScreenSpaceRadius=o,this.components=n}destroy(){this.components.forEach(o=>o.destroy())}intersect(o,n,t,e,s,r,i){this.components.forEach(c=>c.intersect(o,n,t,e,s,r,this.boundingSphere,i))}get boundingBox(){if(null==this._boundingBox){const o=s();this.components.forEach(n=>{null!=n.boundingInfo&&(r(o,n.boundingInfo.bbMin),r(o,n.boundingInfo.bbMax))}),this._boundingBox=o}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const o=this.boundingBox,n=e();i(o,n),this._boundingSphere={center:n,radius:.5*c(o)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((o,n)=>o+n.numTriangles,0)}get hasEmissions(){let o=0;for(const n of this.components){const t=n.hasEmissions;if(2===t&&1===o||1===t&&2===o?o=3:0!==t&&0===o&&(o=t),3===o)return o}return o}}export{a as LodLevel};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as s,getOrCreateMapValue as n}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as d,dot as u,transformMat4 as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,freeze as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{isColor as b}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as I}from"../../effects/RenderPlugin.js";import{DepthRange as C}from"../DepthRange.js";import{assert as D}from"../Util.js";import{InstanceData as R}from"./InstanceData.js";import{InstanceOctree as E}from"./InstanceOctree.js";import{LevelSelector as x}from"./LevelSelector.js";import{LodLevel as S}from"./LodLevel.js";import{getRenderInstanceDataLayout as w,RenderInstanceData as L}from"./RenderInstanceData.js";import{colorMixModes as j}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as O}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as T}from"../../../../support/HighlightDefaults.js";import{TaskPriority as A,noBudget as M}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as q}from"../../../../webgl/Util.js";import{fromLayout as B}from"../../../../webgl/VertexAttributeLocations.js";const F=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map(e=>e.minScreenSpaceRadius);return new x(t,r)};let V=class extends I{constructor(e,t){super(e),this.type=3,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new R({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(A.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=w(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==T&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmitters(){return this._levels.some(e=>e.components.some(e=>e.material.hasEmissions))}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,r)=>{const s=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,n=e.triangleCount;t.push({renderedInstances:s,renderedTriangles:s*n,trianglesPerInstance:n})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new L(e,this._instanceBufferLayout))}async initializeRenderContext(e,r){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const s=await Promise.allSettled(this.symbol.levels.map(t=>S.create(e,t,r))),n=s.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(r)||n.length!==s.length){n.forEach(e=>e.destroy()),o(r);for(const e of s)if("rejected"===e.status)throw e.reason}this._levels=n,this._levelSelector=F(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return s(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(10!==e||this.hasHighlights())&&(6!==e||this.hasHighlight(T))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(M),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,s=this.levels;return t.forEach(t=>s.forEach(({components:s},n)=>s.forEach(s=>r.push(this._beginComponent(e,t[n],s))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let s=0;const n=this.levels;r.forEach(r=>n.forEach(({components:n},a)=>n.forEach(n=>this._renderComponent(e,t[s++],r[a],n,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:r}=e,s=10===t,n=6===t,a=7!==t;if(!s&&!n)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(s){const e=r.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(T);return n?e?[e]:null:Array.from(i.values())}return null}intersect(e,t,r,s){if(!this.baseMaterial.visible||null==this._octree)return;const n=f();d(n,s,r);const a=n=>{this._instanceData.getCombinedModelTransform(n,G),e.transform.set(G),m(W,r,e.transform.inverse),m(k,s,e.transform.inverse);const a=this._instanceData.getState(n),i=this._instanceData.getLodLevel(n),o=this._levels.length;4&a&&(D(!!(18&a),"invalid instance state"),D(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,W,k,n,this.metadata,o))};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,n,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new E(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)18&t.get(r)&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new C;const t=e.viewForward,r=this._octree.findClosest(t,1,e.frustum),s=this._octree.findClosest(t,-1,e.frustum);if(null==r||null==s)return new C;const n=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,N),d(N,N,n);const i=u(N,t)-N[3];a.boundingSphere.getVec(s,N),d(N,N,n);const o=u(N,t)+N[3];return new C(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:s,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const _=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[_].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[_].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,z),e=a.selectLevel(z,i.getCombinedMedianScaleFactor(h),s)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const s=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=n(u,t,s);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);H(a[e],o,h)}f|=16}else H(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);const p=!!(18&m),g=!!(18&f);null!=this._octreeCached&&(!p&&g?this._octreeCached.addInstance(h):p&&!g?this._octreeCached.removeInstance(h):p&&g&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))),h=h+1===c?0:h+1,h%d===0&&e.madeProgress(),p!==g&&this.metadata.notifyGraphicVisibilityChanged(h),g&&64&m&&this.metadata.notifyGraphicGeometryChanged(h)}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const s=r.glMaterialLoader.load(e.rctx,e.bind.slot,e.output);return s?.beginSlot(e.bind)}_renderComponent(e,t,r,s,n){if(!t)return;const{bind:a,rctx:i}=e,o=i.bindTechnique(t,a,s.material.parameters,Z),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(s.vao,B(l)),i.bindVAO(s.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&b(e.output)&&(o.setUniform4fv("externalColor",Y[Math.min(n,Y.length-1)]),o.setUniform1i("symbolColorMixMode",j.replace));const c=r.capacity,h=r.headIndex,d=r.tailIndex,u=r.firstIndex,m=(e,n)=>{q(i,o.locations,r.buffer,e),i.drawArraysInstanced(t.primitiveType,0,s.numVertices,n-e)};s.material.transparent&&null!=u?h>d?(D(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(D(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(D(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function H(e,t,r){const s=e.allocateHead();P(t,r,e.view,s)}function P(e,t,r,s){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,s),r.model.copyFrom(s,e.model,t),r.modelNormal.copyFrom(s,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(s,e.color,t),e.olidColor&&r.olidColor&&r.olidColor.copyFrom(s,e.olidColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(s,e.featureAttribute,t)}e([l({constructOnly:!0})],V.prototype,"symbol",void 0),e([l({constructOnly:!0})],V.prototype,"metadata",void 0),e([l({constructOnly:!0})],V.prototype,"shaderTransformation",void 0),e([l()],V.prototype,"_instanceData",void 0),e([l()],V.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],V.prototype,"_enableLevelSelection",null),e([l()],V.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],V.prototype,"readyToRun",null),V=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],V);const z=f(),N=_(),G=h(),W=f(),k=f(),Y=[p(1,0,1,1),p(0,0,1,1),p(0,1,0,1),p(1,1,0,1),p(1,0,0,1)],Z=new O;export{V as LodRenderer};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as d,dot as u,transformMat4 as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,freeze as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{isColor as b}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as I}from"../../effects/RenderPlugin.js";import{DepthRange as C}from"../DepthRange.js";import{assert as D}from"../Util.js";import{InstanceData as R}from"./InstanceData.js";import{InstanceOctree as E}from"./InstanceOctree.js";import{LevelSelector as x}from"./LevelSelector.js";import{LodLevel as S}from"./LodLevel.js";import{getRenderInstanceDataLayout as w,RenderInstanceData as L}from"./RenderInstanceData.js";import{colorMixModes as j}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as O}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as T}from"../../../../support/HighlightDefaults.js";import{TaskPriority as A,noBudget as M}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as q}from"../../../../webgl/Util.js";import{fromLayout as B}from"../../../../webgl/VertexAttributeLocations.js";const F=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map(e=>e.minScreenSpaceRadius);return new x(t,r)};let V=class extends I{constructor(e,t){super(e),this.type=3,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new R({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(A.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=w(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==T&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){let e=0;for(const t of this._levels){const r=t.hasEmissions;if(2===r&&1===e||1===r&&2===e?e=3:0!==r&&0===e&&(e=r),3===e)return e}return e}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new L(e,this._instanceBufferLayout))}async initializeRenderContext(e,r){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const n=await Promise.allSettled(this.symbol.levels.map(t=>S.create(e,t,r))),s=n.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(r)||s.length!==n.length){s.forEach(e=>e.destroy()),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=F(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return n(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(10!==e||this.hasHighlights())&&(6!==e||this.hasHighlight(T))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(M),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach(t=>n.forEach(({components:n},s)=>n.forEach(n=>r.push(this._beginComponent(e,t[s],n))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;const s=this.levels;r.forEach(r=>s.forEach(({components:s},a)=>s.forEach(s=>this._renderComponent(e,t[n++],r[a],s,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:r}=e,n=10===t,s=6===t,a=7!==t;if(!n&&!s)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(n){const e=r.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(T);return s?e?[e]:null:Array.from(i.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=f();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,G),e.transform.set(G),m(W,r,e.transform.inverse),m(k,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;4&a&&(D(!!(18&a),"invalid instance state"),D(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,W,k,s,this.metadata,o))};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new E(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)18&t.get(r)&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new C;const t=e.viewForward,r=this._octree.findClosest(t,1,e.frustum),n=this._octree.findClosest(t,-1,e.frustum);if(null==r||null==n)return new C;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,N),d(N,N,s);const i=u(N,t)-N[3];a.boundingSphere.getVec(n,N),d(N,N,s);const o=u(N,t)+N[3];return new C(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const _=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[_].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[_].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,z),e=a.selectLevel(z,i.getCombinedMedianScaleFactor(h),n)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);H(a[e],o,h)}f|=16}else H(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);const p=!!(18&m),g=!!(18&f);null!=this._octreeCached&&(!p&&g?this._octreeCached.addInstance(h):p&&!g?this._octreeCached.removeInstance(h):p&&g&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))),h=h+1===c?0:h+1,h%d===0&&e.madeProgress(),p!==g&&this.metadata.notifyGraphicVisibilityChanged(h),g&&64&m&&this.metadata.notifyGraphicGeometryChanged(h)}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterialLoader.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e,o=i.bindTechnique(t,a,n.material.parameters,Z),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(n.vao,B(l)),i.bindVAO(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&b(e.output)&&(o.setUniform4fv("externalColor",Y[Math.min(s,Y.length-1)]),o.setUniform1i("symbolColorMixMode",j.replace));const c=r.capacity,h=r.headIndex,d=r.tailIndex,u=r.firstIndex,m=(e,s)=>{q(i,o.locations,r.buffer,e),i.drawArraysInstanced(t.primitiveType,0,n.numVertices,s-e)};n.material.transparent&&null!=u?h>d?(D(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(D(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(D(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function H(e,t,r){const n=e.allocateHead();P(t,r,e.view,n)}function P(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.olidColor&&r.olidColor&&r.olidColor.copyFrom(n,e.olidColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}e([l({constructOnly:!0})],V.prototype,"symbol",void 0),e([l({constructOnly:!0})],V.prototype,"metadata",void 0),e([l({constructOnly:!0})],V.prototype,"shaderTransformation",void 0),e([l()],V.prototype,"_instanceData",void 0),e([l()],V.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],V.prototype,"_enableLevelSelection",null),e([l()],V.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],V.prototype,"readyToRun",null),V=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],V);const z=f(),N=_(),G=h(),W=f(),k=f(),Y=[p(1,0,1,1),p(0,0,1,1),p(0,1,0,1),p(1,1,0,1),p(1,0,0,1)],Z=new O;export{V as LodRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOLID as e,isDepth as r,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class m extends n{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>e(t)&&this.transparent&&this.parameters.writeDepth],[5,t=>r(t)&&this.transparent&&this.parameters.writeDepth],[9,t=>e(t)&&this.transparent&&!this.parameters.writeDepth],[19,t=>s(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.discardInvisibleFragments=this.transparent&&!this._isOpaquePass(t.output)&&this.parameters.discardInvisibleFragments,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.terrainDepthTest=t.terrainDepthTest&&i(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=l}get transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get hasEmissions(){return this.parameters.emissiveStrength>0}_isOpaquePass(t){return i(t)||this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 10===t||e(t)&&!this.transparent}_isOpaqueNoSSAODepthPass(t){return r(t)&&this.parameters.writeDepth&&!this.transparent}createGLMaterial(t){return new f(t)}createBufferWriter(){return new o(p(this.parameters))}}class f extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1,this.emissiveStrength=0,this.useIndexing=!1}}export{m as ColorMaterial,g as Parameters};
2
+ import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOLID as e,isDepth as r,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class m extends n{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>e(t)&&this.transparent&&this.parameters.writeDepth],[5,t=>r(t)&&this.transparent&&this.parameters.writeDepth],[9,t=>e(t)&&this.transparent&&!this.parameters.writeDepth],[19,t=>s(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.discardInvisibleFragments=this.transparent&&!this._isOpaquePass(t.output)&&this.parameters.discardInvisibleFragments,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.terrainDepthTest=t.terrainDepthTest&&i(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=l}get transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get hasEmissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}_isOpaquePass(t){return i(t)||this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 10===t||e(t)&&!this.transparent}_isOpaqueNoSSAODepthPass(t){return r(t)&&this.parameters.writeDepth&&!this.transparent}createGLMaterial(t){return new f(t)}createBufferWriter(){return new o(p(this.parameters))}}class f extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1,this.emissiveStrength=0,this.useIndexing=!1}}export{m as ColorMaterial,g as Parameters};