@arcgis/core 5.2.0-next.41 → 5.2.0-next.42

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 (129) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/321dbc60f44819c2b4de.js +1 -0
  3. package/assets/esri/core/workers/chunks/399e23d777a043efa9f1.js +1 -0
  4. package/assets/esri/core/workers/chunks/5133083222588799493f.js +1 -0
  5. package/assets/esri/core/workers/chunks/{2b8909a488cf3b231eec.js → 590e977f8eeb379b86c8.js} +8 -8
  6. package/assets/esri/core/workers/chunks/{7ea65aa6d3e684e12082.js → 67468c50ecb1fbedda87.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{b45a013039bbd2614525.js → 7684f0c771d312e05bb4.js} +7 -7
  8. package/assets/esri/core/workers/chunks/{dd65c32ae55fcf1282fe.js → 934044f2ef6ce199b399.js} +1 -1
  9. package/assets/esri/core/workers/chunks/c1845682cc9a5aac8703.js +261 -0
  10. package/assets/esri/core/workers/chunks/{4056659d5c7698265129.js → d66d58ed5d66520ab1bf.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{aa0fb77c62a2d4eb20a5.js → e6b5c015205d38abe037.js} +1 -1
  12. package/assets/esri/core/workers/chunks/f4eda59ec1e816ecc827.js +1 -0
  13. package/assets/esri/core/workers/chunks/f8f0de841be17cd05c8f.js +1 -0
  14. package/assets/esri/themes/base/_core.scss +0 -6
  15. package/assets/esri/themes/dark/main.css +1 -1
  16. package/assets/esri/themes/light/main.css +1 -1
  17. package/assets/esri/themes/light/view.css +1 -1
  18. package/chunks/CutFillMinMaxDepth.glsl.js +2 -0
  19. package/chunks/CutFillTotalDepth.glsl.js +2 -0
  20. package/chunks/EdgeShader.glsl.js +9 -9
  21. package/chunks/GaussianSplat.glsl.js +1 -1
  22. package/chunks/cameraUtilsSpherical.js +1 -1
  23. package/config.js +1 -1
  24. package/editing/geometry/coordUtils.js +1 -1
  25. package/geohash/geohashUtils.js +1 -1
  26. package/geometry/support/aaBoundingRect.js +1 -1
  27. package/geometry/support/quantizationUtils.js +1 -1
  28. package/intl/date.js +1 -1
  29. package/kernel.js +1 -1
  30. package/layers/graphics/featureConversionUtils.js +1 -1
  31. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  32. package/layers/raster/formats/Lerc.js +1 -1
  33. package/layers/support/fieldUtils.js +1 -1
  34. package/package.json +1 -1
  35. package/support/revision.js +1 -1
  36. package/views/2d/engine/vectorTiles/GeometryUtils.js +1 -1
  37. package/views/2d/engine/webgl/Painter.js +1 -1
  38. package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
  39. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  40. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  41. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  42. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  43. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitBlitShader.js +2 -0
  44. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DebugOverlayShader.js +2 -0
  45. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HighlightShader.js +2 -0
  46. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/WorldExtentStencilShader.js +2 -0
  47. package/views/2d/engine/webgl/shaderGraph/techniques/utility/BitBlitTechnique.js +2 -0
  48. package/views/2d/engine/webgl/shaderGraph/techniques/utility/DebugOverlayTechnique.js +2 -0
  49. package/views/2d/engine/webgl/shaderGraph/techniques/utility/HighlightTechnique.js +2 -0
  50. package/views/2d/engine/webgl/shaderGraph/techniques/utility/WorldExtentClipTechnique.js +2 -0
  51. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  52. package/views/2d/layers/support/DebugOverlay.js +1 -1
  53. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  54. package/views/3d/layers/i3s/I3SNode.js +1 -1
  55. package/views/3d/layers/i3s/SphereCone.js +1 -1
  56. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  57. package/views/3d/support/cameraUtilsSpherical.js +1 -1
  58. package/views/3d/terrain/OverlayRenderer.js +1 -1
  59. package/views/3d/webgl/RenderCamera.js +1 -1
  60. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +2 -2
  61. package/views/3d/webgl-engine/core/shaderLibrary/util/emissionFilter.glsl.js +1 -1
  62. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  63. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  64. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  65. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  66. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  67. package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
  68. package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
  69. package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +2 -0
  70. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  71. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  72. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  73. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/AdjustProjectedPosition.glsl.js +1 -1
  74. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/DiscardNonSilhouetteEdges.glsl.js +1 -1
  75. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  76. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
  77. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/EdgeUtil.glsl.js +1 -1
  78. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/LineAmplitude.glsl.js +1 -1
  79. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/LineOffset.glsl.js +1 -1
  80. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/UnpackAttributes.glsl.js +1 -1
  81. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  82. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  83. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  84. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  85. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  86. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  87. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  88. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  89. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  90. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  91. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  92. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  93. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  94. package/views/3d/webgl-engine/shaders/CutFillMinMaxDepth.glsl.js +2 -0
  95. package/views/3d/webgl-engine/shaders/CutFillMinMaxDepthTechnique.js +2 -0
  96. package/views/3d/webgl-engine/shaders/{CutFillDepth.glsl.js → CutFillTotalDepth.glsl.js} +1 -1
  97. package/views/3d/webgl-engine/shaders/CutFillTotalDepthTechnique.js +2 -0
  98. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
  99. package/views/input/BrowserEventSource.js +1 -1
  100. package/views/input/InputManager.js +1 -1
  101. package/views/interactive/snapping/snappingUtils.js +1 -1
  102. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  103. package/views/webgl/VertexAttributeLayouts.js +1 -1
  104. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  105. package/widgets/BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js +1 -1
  106. package/widgets/Legend/support/relationshipRampUtils.js +1 -1
  107. package/widgets/OrientedImageryViewer/utils.js +1 -1
  108. package/assets/esri/core/workers/chunks/002356e675769d20e5c0.js +0 -1
  109. package/assets/esri/core/workers/chunks/06e71d52773eb656a4bf.js +0 -261
  110. package/assets/esri/core/workers/chunks/352d144d7651da8a29c9.js +0 -1
  111. package/assets/esri/core/workers/chunks/4f2a61dfae6ca8ed1ec8.js +0 -1
  112. package/assets/esri/core/workers/chunks/ea8f224da4c5c95a3547.js +0 -1
  113. package/assets/esri/core/workers/chunks/f30578843f4faefd53b4.js +0 -1
  114. package/assets/esri/themes/base/_colorVariables.scss +0 -1
  115. package/assets/esri/themes/base/widgets/_DatePicker.scss +0 -170
  116. package/assets/esri/themes/base/widgets/_FeatureUtilityNetworkAssociationList.scss +0 -13
  117. package/assets/esri/themes/base/widgets/_TimePicker.scss +0 -15
  118. package/chunks/CutFillDepth.glsl.js +0 -2
  119. package/core/PLRUCache.js +0 -2
  120. package/views/2d/engine/webgl/BitBlitRenderer.js +0 -2
  121. package/views/2d/engine/webgl/WorldExtentClipRenderer.js +0 -2
  122. package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +0 -2
  123. package/views/2d/engine/webgl/shaders/BitBlitPrograms.js +0 -2
  124. package/views/2d/engine/webgl/shaders/HighlightPrograms.js +0 -2
  125. package/views/2d/engine/webgl/shaders/StencilPrograms.js +0 -2
  126. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +0 -2
  127. package/views/3d/webgl-engine/shaders/CutFillDepthTechniqueConfiguration.js +0 -2
  128. package/views/support/euclideanAreaMeasurementUtils.js +0 -2
  129. package/widgets/ShadowCast/ShadowVisualizationType.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as b,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as I}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as O,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{computeShadowsEnabled as G}from"../../support/sunUtils.js";import{FBOCache as x}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as y}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as M}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as q}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as j}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}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 W}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{NavigationDepthCache as K}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as Z}from"./OrderIndependentTransparency.js";import{RenderContext as ee,defaultRenderOccludedMask as te}from"./RenderContext.js";import{RendererBase as se}from"./RendererBase.js";import{setupFeatureDefaults as ie}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne}from"./ShadowMap.js";import he from"./SliceHelper.js";import{MergedRenderer as oe}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as de}from"../parts/renderUtils.js";import{RendererPerformanceInfo as le,PerformanceCategory as ue}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as me,PixelType as _e,ColorAttachment2 as pe,ColorAttachment0 as ce,DrawBufferNone as fe}from"../../../webgl/enums.js";const be=has("disable-feature:async-navigation-3d-depth-readback");let ge=class extends se{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new he,this.sceneDepthRange=_(J.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Ne)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new x(i),this._compositor=new Y(i,s),this._renderStateFeatures=_(ie(e.view.qualityProfile));const a=new ne(this._fboCache,e.viewingMode);this._renderContext=new ee(this._rctx,a,s),this._framebuffer=new $(this._fboCache,this._bindParameters),this._performanceInfo=new le(this._rctx),this._blit=new U(s),this.navigationDepthCache=new K(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._shadowAccumulator=new ae(this.fboCache,s,e,(t,s,i)=>{const r=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,i,!0,r),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},r),this._nodes=new M(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new q({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;I(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},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)},m),d(()=>this._bindParameters.clouds.data?.state,()=>r(),m),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,z.prune(),oe.prune(),T()}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=ie(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){return this._plugins.emissions}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ye(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.reprojection.matrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}modifyShadowsEnabled(){const e=this.stage.view.environmentManager.referencePositionGeographic,t=null==e||G(e[2],this.stage.viewingMode),s=this.stage.view.environment.lighting.directShadowsEnabled&&t;this._bindParameters.shadowMap.enabled!==s&&(this._bindParameters.shadowMap.enabled=s,this._requestRender(1))}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Te),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new de(this._pluginInput.get(O.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),_=this._needsLastFrameColor;_?(m?.retain(_-1),m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Re),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._shadowAccumulator.fullyRecompute=!i,this._shadowAccumulator.updateCamera(r),this._hasTransparentGeometry=this._plugins.produces(0,...we),this._precompilePrepasses(),this.performanceInfo.advance(ue.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(R.CUTFILL_COMPUTATION,e)),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===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(O.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const f=this._hasTransparentGeometry?2:1,b=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,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.emissions=b,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(O.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),be||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(me))),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 de(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,R.OPAQUE_ENVIRONMENT,R.GAUSSIAN_SPLAT,R.OPAQUE_OCCLUSION_QUERY,R.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Ee),t.output=0,this._plugins.precompile(...Ee),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,R.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,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=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasOpaqueEmission,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(t.hasOpaqueEmission,O.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ue.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(R.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,R.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(R.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?ue.OPAQUE_EDGES:ue.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ue.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(R.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(R.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=t===this._bindParameters.shadowMap&&6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes();t.finish(e),this._bindParameters.output=s}_renderShadowNodes(){const e=this._bindParameters.shadowMap.renderTarget;e&&(this._renderNodes(R.SHADOWMAP,e),this._pluginInput.set(R.SHADOWMAP,null))}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._shadowAccumulator.requiresDepth+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(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(ue.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(ue.DEPTH)}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return J.Zero;const t=X(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),this._bindParameters.shadowMap.enabled&&t.union(this._nodes.queryDepthRange(R.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=J.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<j)return void(this.sceneDepthRange.value=J.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=X(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,Ie),this._needsDepth&&this._precompilePlugins(3,Ae)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,R.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&(this._shadowAccumulator.precompilePrepass(),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,i=this.fboCache.acquire(t,s,"normals",5);i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ie);const r=this._nodes.optional("normals",...S,R.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(ue.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ue.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const e=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?ue.AMBIENT_ILLUMINATION_HIGH_QUALITY:ue.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=h(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=h(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Ee),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,...Ce);this._renderContext.renderOccludedMask=te}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Ce),this._renderContext.renderOccludedMask=te}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Se[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){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,i=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=i}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,R.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ae)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...Pe),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...Pe)}_renderTransparentGeometry(){this._plugins.render(...we),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Ee)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Te),this._bindParameters.output=2,this._plugins.precompile(...Te),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Te)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(me);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?ue.HUD_OCCLUDED:ue.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>B?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),V(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ue.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Oe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){this._shadowAccumulator.updateDepthRange(e);const t=this._shadowAccumulator.requiresDepth;this._bindParameters.output=0,this._shadowAccumulator.renderAccumulation(this._bindParameters)&&this.performanceInfo.advance(ue.ACCUMULATED_SHADOWS),this._shadowAccumulator.updateMask(),t&&(this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){y(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...we)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(me,this.hasFloatBlend?7:0,"oit alpha"),m=h.hasEmission&&(0===e||1!==t);m&&u.acquireColor(pe,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(Z),m&&this._rctx.clearBuffer(2,Z),a(),u.detachDepth(),h.output=2;const _=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");m&&_.acquireColor(me,o,"oit front emissive"),s?_.acquireDepth(this._hudDepthFormat):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(C,s),a(),_.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?pe:me;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(f=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-ce,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,_,h,p,e,this._fboCache.debugCallback),f?.detachDepth(),s||(m&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),_.release(),u.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...Pe)||this.plugins.produces(5,...Pe)||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;t.update(t=>this._renderNodes(O.OPAQUE,t,e)),this.fboCache.debugCallback?.(O.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)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(R.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(R.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(R.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.VOXEL,e)),this.fboCache.debugCallback?.(R.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(O.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(O.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(R.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(R.TRANSPARENT_NO_DEPTH,e.color.fbo),this._renderTransparentMaterialWithoutDepth()}_renderTransparentMaterialWithoutDepth(){if(this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([fe,me]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(ue.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=w);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(b(Ge,t.viewMatrix),b(Fe,t.projectionMatrix),g(xe,Ge,Fe),g(xe,s.viewMatrix,xe),g(xe,s.projectionMatrix,xe),this._reprojectionMatrix=xe):this._reprojectionMatrix=w,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(He,s.viewMatrix,Ge),P(t,He)):P(t,w)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],ge.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],ge.prototype,"highResolutionAtmosphere",null),e([p()],ge.prototype,"_edgeView",void 0),e([p()],ge.prototype,"updating",null),ge=e([c("esri.views.3d.webgl-engine.lib.Renderer")],ge);const Pe=[0,1,2,3],we=[7,6,4,5],Ee=[7,6],Ie=[0,1,2,4,...Ee],Ae=[3,5],Ce=[2,4,8],Te=[16,12,14,13],Oe=[4,5,2,3,0,1,...Ee],Re=[4,8,5,11],Se={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Ee],Ne=["normals","highlights"],Fe=E(),Ge=E(),xe=E(),He=E();function ye(e){return t=>e.immediate.schedule(t)}export{ge as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as b,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as I}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as O,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{computeShadowsEnabled as G}from"../../support/sunUtils.js";import{FBOCache as H}from"../core/FBOCache.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{isColor as y}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as M}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as q}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as j}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}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 W}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{NavigationDepthCache as K}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as Z}from"./OrderIndependentTransparency.js";import{RenderContext as ee,defaultRenderOccludedMask as te}from"./RenderContext.js";import{RendererBase as se}from"./RendererBase.js";import{setupFeatureDefaults as ie}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne}from"./ShadowMap.js";import he from"./SliceHelper.js";import{MergedRenderer as oe}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as de}from"../parts/renderUtils.js";import{RendererPerformanceInfo as le,PerformanceCategory as ue}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as me,PixelType as _e,ColorAttachment2 as pe,ColorAttachment0 as ce,DrawBufferNone as fe}from"../../../webgl/enums.js";const be=has("disable-feature:async-navigation-3d-depth-readback");let ge=class extends se{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new x,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new he,this.sceneDepthRange=_(J.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Ne)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new H(i),this._compositor=new Y(i,s),this._renderStateFeatures=_(ie(e.view.qualityProfile));const a=new ne(this._fboCache,e.viewingMode);this._renderContext=new ee(this._rctx,a,s),this._framebuffer=new $(this._fboCache,this._bindParameters),this._performanceInfo=new le(this._rctx),this._blit=new U(s),this.navigationDepthCache=new K(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._shadowAccumulator=new ae(this.fboCache,s,e,(t,s,i)=>{const r=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,i,!0,r),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},r),this._nodes=new M(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new q({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;I(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},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)},m),d(()=>this._bindParameters.clouds.data?.state,()=>r(),m),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,z.prune(),oe.prune(),T()}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=ie(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){return this._plugins.emissions}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ye(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.reprojection.matrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}modifyShadowsEnabled(){const e=this.stage.view.environmentManager.referencePositionGeographic,t=null==e||G(e[2],this.stage.viewingMode),s=this.stage.view.environment.lighting.directShadowsEnabled&&t;this._bindParameters.shadowMap.enabled!==s&&(this._bindParameters.shadowMap.enabled=s,this._requestRender(1))}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Te),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new de(this._pluginInput.get(O.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),_=this._needsLastFrameColor;_?(m?.retain(_-1),m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Re),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._shadowAccumulator.fullyRecompute=!i,this._shadowAccumulator.updateCamera(r),this._hasTransparentGeometry=this._plugins.produces(0,...we),this._precompilePrepasses(),this.performanceInfo.advance(ue.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(R.CUTFILL_COMPUTATION,e)),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===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(O.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const f=this._hasTransparentGeometry?2:1,b=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,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.emissions=b,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(O.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),be||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(me))),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 de(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,R.OPAQUE_ENVIRONMENT,R.GAUSSIAN_SPLAT,R.OPAQUE_OCCLUSION_QUERY,R.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Ee),t.output=0,this._plugins.precompile(...Ee),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,R.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,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=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasOpaqueEmission,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(t.hasOpaqueEmission,O.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ue.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(R.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,R.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(R.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?ue.OPAQUE_EDGES:ue.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ue.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(R.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(R.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=t===this._bindParameters.shadowMap&&6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes();t.finish(e),this._bindParameters.output=s}_renderShadowNodes(){const e=this._bindParameters.shadowMap.renderTarget;e&&(this._renderNodes(R.SHADOWMAP,e),this._pluginInput.set(R.SHADOWMAP,null))}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._shadowAccumulator.requiresDepth+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(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(ue.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(ue.DEPTH)}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return J.Zero;const t=X(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),this._bindParameters.shadowMap.enabled&&t.union(this._nodes.queryDepthRange(R.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=J.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<j)return void(this.sceneDepthRange.value=J.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=X(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,Ie),this._needsDepth&&this._precompilePlugins(3,Ae)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,R.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5),this._nodes.precompile(!1,R.SHADOWMAP)),this._shadowAccumulator.active&&(this._shadowAccumulator.precompilePrepass(),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,i=this.fboCache.acquire(t,s,"normals",5);i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ie);const r=this._nodes.optional("normals",...S,R.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(ue.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ue.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const e=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?ue.AMBIENT_ILLUMINATION_HIGH_QUALITY:ue.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=h(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=h(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Ee),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,...Ce);this._renderContext.renderOccludedMask=te}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Ce),this._renderContext.renderOccludedMask=te}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Se[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){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,i=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=i}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,R.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ae)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...Pe),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...Pe)}_renderTransparentGeometry(){this._plugins.render(...we),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Ee)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Te),this._bindParameters.output=2,this._plugins.precompile(...Te),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Te)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(me);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?ue.HUD_OCCLUDED:ue.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>B?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),V(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ue.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Oe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){this._shadowAccumulator.updateDepthRange(e);const t=this._shadowAccumulator.requiresDepth;this._bindParameters.output=0,this._shadowAccumulator.renderAccumulation(this._bindParameters)&&this.performanceInfo.advance(ue.ACCUMULATED_SHADOWS),this._shadowAccumulator.updateMask(),t&&(this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){y(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...we),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...we)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(me,this.hasFloatBlend?7:0,"oit alpha"),m=h.hasEmission&&(0===e||1!==t);m&&u.acquireColor(pe,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(Z),m&&this._rctx.clearBuffer(2,Z),a(),u.detachDepth(),h.output=2;const _=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");m&&_.acquireColor(me,o,"oit front emissive"),s?_.acquireDepth(this._hudDepthFormat):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(C,s),a(),_.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?pe:me;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(f=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-ce,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,_,h,p,e,this._fboCache.debugCallback),f?.detachDepth(),s||(m&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),_.release(),u.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...Pe)||this.plugins.produces(5,...Pe)||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;t.update(t=>this._renderNodes(O.OPAQUE,t,e)),this.fboCache.debugCallback?.(O.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)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(R.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(R.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(R.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.VOXEL,e)),this.fboCache.debugCallback?.(R.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(O.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(O.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(R.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(R.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([fe,me]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(ue.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=w);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(b(Ge,t.viewMatrix),b(Fe,t.projectionMatrix),g(He,Ge,Fe),g(He,s.viewMatrix,He),g(He,s.projectionMatrix,He),this._reprojectionMatrix=He):this._reprojectionMatrix=w,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(xe,s.viewMatrix,Ge),P(t,xe)):P(t,w)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],ge.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],ge.prototype,"highResolutionAtmosphere",null),e([p()],ge.prototype,"_edgeView",void 0),e([p()],ge.prototype,"updating",null),ge=e([c("esri.views.3d.webgl-engine.lib.Renderer")],ge);const Pe=[0,1,2,3],we=[7,6,4,5],Ee=[7,6],Ie=[0,1,2,4,...Ee],Ae=[3,5],Ce=[2,4,8],Te=[16,12,14,13],Oe=[4,5,2,3,0,1,...Ee],Re=[4,8,5,11],Se={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Ee],Ne=["normals","highlights"],Fe=E(),Ge=E(),He=E(),xe=E();function ye(e){return t=>e.immediate.schedule(t)}export{ge as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{sliceEquals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as r,sync as a}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{property as n,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{copy as c,equals as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as m}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{F as _}from"../../../../chunks/FocusAreaMask.glsl.js";import{volumeToVao as d}from"../effects/focusArea/focusAreaMaskUtils.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as f}from"./DepthRange.js";import{createQuadVAO as g}from"./glUtil3D.js";import{ShadowCastRenderer as b}from"./ShadowCastRenderer.js";import{ShadowMap as v}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as S}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as w}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as A}from"../shaders/ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as x}from"../shaders/ShadowCastMaskTechnique.js";import{PrimitiveType as C,DepthStencilAttachment as R,PixelType as F}from"../../../webgl/enums.js";import{DisposableFramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{noParameters as V}from"../../../webgl/NoParameters.js";let H=class extends t{constructor(e,t,i,s,o){super({}),this._fbos=e,this._techniques=t,this._renderToShadowMap=s,this._requestRender=o,this.fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new w(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new w(1),()=>this._requestRenderIfEnabled()),this._passParameters=new m,this._maskParameters=new _,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=f.Zero,this._enabled=!1,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._bindParameters=new p(e.rctx,new v(e,i.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=g(e.rctx),this._accumulationRenderer=new b({view:i.view,data:this}),this._tmpReadFbo=new q(e.rctx),this.addHandles([r(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},a),r(()=>this._numActive,()=>this._numActiveChanged(),a)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._fboHandle=s(this._fboHandle),this._vao=s(this._vao),this._volumeVao=s(this._volumeVao),this._tmpReadFbo=s(this._tmpReadFbo),this._bindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this.fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&[...this._accumulationSets()].some(e=>e.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==f.Zero&&this._accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return[...this._accumulationSets()].every(e=>e.doneAccumulating)}get _numActive(){return[...this._accumulationSets()].reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=s(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const s of this._accumulationSets())s.configuration.useMask=t;if(!t)return;const i=e.geometryVolume,{vao:r,vertexCount:a}=d(this._rctx,i);this._volumeVao=r,this._volumeVertexCount=a}get requiresDepth(){return this.accumulating||null!=this._volumeVao}renderAccumulation(e){if(!this.active)return!1;if(this._bindParameters.contentCamera=e.contentCamera,this._bindParameters.depth=e.depth,this._passParameters.origin=this._bindParameters.camera.center,!this.canAccumulate)return this._bindParameters.depth=null,!1;if(this._renderAreaMask(this._bindParameters),!this.accumulating)return this._bindParameters.depth=null,!1;(this._previewing||this.fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._bindParameters);const t=this._accumulateSetsForRenderFrame(this._previewing&&!this.fullyRecompute,this._bindParameters);return this._bindParameters.depth=null,t}_renderAreaMask(e){const t=this._techniques.getCompiled(x),i=this._volumeVao,s=this._volumeVertexCount,r=this._fboHandle,a=this._analysisVolume;if(r?.detachDepth(),!t||!i||s<1||!r||!a)return;r.acquireDepth(14);const o=this._rctx,n=e,h=n.depth,c=this._tmpReadFbo;c.attachDepthStencil(h?.attachment),o.blitFramebuffer(c,r.fbo,256),c.detachDepthStencilTexture(),o.bindFramebuffer(r.fbo),o.setClearStencil(0),o.clear(1024),o.setViewport(0,0,n.camera.width,n.camera.height);const u=o.bindTechnique(t,n,V);this._maskParameters.origin=a.origin,u.bindDraw(n,V,this._maskParameters),o.bindVAO(i),o.drawArrays(C.TRIANGLES,0,s)}_clearBuffersOnAccumulationStart(e){if([...this._accumulationSets()].every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this._requestRender(),i}_accumulateSet(e,t,i){const s=t?Math.min(j,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}precompilePrepass(){if(this.accumulating){for(const e of this._accumulationSets())this._techniques.precompile(S,e.configuration),this._techniques.precompile(A,e.configuration);this._techniques.precompile(x)}}precompile(){this._accumulationRenderer.precompile()}updateMask(){this._accumulationRenderer.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,F.UNSIGNED_BYTE,P),P[0]/i)}updateCamera(e){if(!this.active)return;const t=this._bindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this._accumulationRenderer.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this._requestRender()}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=s(this._fboHandle),this._enabled=!1,this._requestRender())}_createFBO(e,t){return this._fbos.acquire(e,t,"shadow accumulation",this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this._renderToShadowMap(t,e.lightDirections[e.progress++],this._depthRange);const i=this._techniques.get(S,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get _rctx(){return this._fbos.rctx}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([n()],H.prototype,"_refining",null),e([n()],H.prototype,"active",null),e([n()],H.prototype,"_doneAccumulating",null),e([n()],H.prototype,"_numActive",null),e([n()],H.prototype,"_colorFormat",null),e([n()],H.prototype,"_depthRange",void 0),e([n()],H.prototype,"_enabled",void 0),e([n()],H.prototype,"_previewing",void 0),e([n()],H.prototype,"_accumulationRenderer",void 0),H=e([h("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const j=6,P=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=o(0),this._sampleCount=o(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,s=Math.min(y,e.length);if(!i(t,0,t.length,e,0,s,u)){t.length=s,this._sampleCount.value=s;for(let i=0;i<s;++i)t[i]=c(t[i]??l(),e[i]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(S,this.configuration),e.precompile(A,this.configuration)}}export{H as ShadowAccumulator};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{sliceEquals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as r,sync as a}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{property as n,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{copy as c,equals as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as m}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{F as _}from"../../../../chunks/FocusAreaMask.glsl.js";import{volumeToVao as d}from"../effects/focusArea/focusAreaMaskUtils.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as f}from"./DepthRange.js";import{createQuadVAO as g}from"./glUtil3D.js";import{ShadowCastRenderer as b}from"./ShadowCastRenderer.js";import{ShadowMap as v}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as S}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as w}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as A}from"../shaders/ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as x}from"../shaders/ShadowCastMaskTechnique.js";import{PrimitiveType as C,DepthStencilAttachment as R,PixelType as F}from"../../../webgl/enums.js";import{DisposableFramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{noParameters as V}from"../../../webgl/NoParameters.js";let H=class extends t{constructor(e,t,i,s,o){super({}),this._fbos=e,this._techniques=t,this._renderToShadowMap=s,this._requestRender=o,this.fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new w(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new w(1),()=>this._requestRenderIfEnabled()),this._passParameters=new m,this._maskParameters=new _,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=f.Zero,this._enabled=!1,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._bindParameters=new p(e.rctx,new v(e,i.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=g(e.rctx),this._accumulationRenderer=new b({view:i.view,data:this}),this._tmpReadFbo=new q(e.rctx),this.addHandles([r(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},a),r(()=>this._numActive,()=>this._numActiveChanged(),a)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._fboHandle=s(this._fboHandle),this._vao=s(this._vao),this._volumeVao=s(this._volumeVao),this._tmpReadFbo=s(this._tmpReadFbo),this._bindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this.fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&[...this._accumulationSets()].some(e=>e.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==f.Zero&&this._accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return[...this._accumulationSets()].every(e=>e.doneAccumulating)}get _numActive(){return[...this._accumulationSets()].reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=s(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const s of this._accumulationSets())s.configuration.useMask=t;if(!t)return;const i=e.geometryVolume,{vao:r,vertexCount:a}=d(this._rctx,i);this._volumeVao=r,this._volumeVertexCount=a}get requiresDepth(){return this.accumulating||null!=this._volumeVao}renderAccumulation(e){if(!this.active)return!1;if(this._bindParameters.contentCamera=e.contentCamera,this._bindParameters.depth=e.depth,this._passParameters.origin=this._bindParameters.camera.center,!this.canAccumulate)return this._bindParameters.depth=null,!1;if(this._renderAreaMask(),!this.accumulating)return this._bindParameters.depth=null,!1;(this._previewing||this.fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._bindParameters);const t=this._accumulateSetsForRenderFrame(this._previewing&&!this.fullyRecompute,this._bindParameters);return this._bindParameters.depth=null,t}_renderAreaMask(){const e=this._techniques.getCompiled(x),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(14);const a=this._rctx,o=this._bindParameters,n=o.depth,h=this._tmpReadFbo;h.attachDepthStencil(n?.attachment),a.blitFramebuffer(h,s.fbo,256),h.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const c=a.bindTechnique(e,o,V);this._maskParameters.origin=r.origin,c.bindDraw(o,V,this._maskParameters),a.bindVAO(t),a.drawArrays(C.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(e){if([...this._accumulationSets()].every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this._requestRender(),i}_accumulateSet(e,t,i){const s=t?Math.min(j,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}precompilePrepass(){if(this.accumulating){for(const e of this._accumulationSets())this._techniques.precompile(S,e.configuration),this._techniques.precompile(A,e.configuration);this._techniques.precompile(x)}}precompile(){this._accumulationRenderer.precompile()}updateMask(){this._accumulationRenderer.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,F.UNSIGNED_BYTE,P),P[0]/i)}updateCamera(e){if(!this.active)return;const t=this._bindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this._accumulationRenderer.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this._requestRender()}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=s(this._fboHandle),this._enabled=!1,this._requestRender())}_createFBO(e,t){return this._fbos.acquire(e,t,"shadow accumulation",this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this._renderToShadowMap(t,e.lightDirections[e.progress++],this._depthRange);const i=this._techniques.get(S,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get _rctx(){return this._fbos.rctx}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([n()],H.prototype,"_refining",null),e([n()],H.prototype,"active",null),e([n()],H.prototype,"_doneAccumulating",null),e([n()],H.prototype,"_numActive",null),e([n()],H.prototype,"_colorFormat",null),e([n()],H.prototype,"_depthRange",void 0),e([n()],H.prototype,"_enabled",void 0),e([n()],H.prototype,"_previewing",void 0),e([n()],H.prototype,"_accumulationRenderer",void 0),H=e([h("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const j=6,P=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=o(0),this._sampleCount=o(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,s=Math.min(y,e.length);if(!i(t,0,t.length,e,0,s,u)){t.length=s,this._sampleCount.value=s;for(let i=0;i<s;++i)t[i]=c(t[i]??l(),e[i]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(S,this.configuration),e.precompile(A,this.configuration)}}export{H as ShadowAccumulator};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as h}from"../../terrain/Intersector.js";import{ChangeSet as c,RenderGeometryUpdate as l}from"./ChangeSet.js";import{IntersectorResult as p}from"./IntersectorResult.js";import{RendererBase as u}from"./RendererBase.js";import{noBudget as g}from"../../../support/Scheduler.js";let m=class extends u{constructor(e){super(e),this._pending=new y,this._changes=new c,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,g,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new l;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere.center[0]-n.boundingSphere.radius<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere.center[0]+n.boundingSphere.radius>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],f[0]=t[0]-s,f[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,f,(t,s,o)=>{_(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],m.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],m.prototype,"rendererContext",void 0),e([o()],m.prototype,"updating",null),e([o()],m.prototype,"rctx",null),e([o()],m.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],m.prototype,"isEmpty",null),e([o()],m.prototype,"_geometries",void 0),m=e([d("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],m);class y{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function _(e,r,t,s,i,n,o){const d=new h(n,o,r),a=r=>{r.set(5,d,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&a(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&a(i.results.max),2===i.options.store){const e=new p(i.ray);a(e),i.results.all.push(e)}}const f=a();export{m as SortedRenderGeometryRenderer};
2
+ import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResult as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new _,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new m;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;if(o){const s=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);s[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),s[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)}i++}return i}*intersectScreenPolygon(e,r,t,s){for(const i of this._geometries.values()){if(!t(i))continue;this._intersectScreenPolygonRenderGeometry(i,r,0,e,s);const n=this.rendererContext.longitudeCyclical;if(n){const t=i.boundingSphere.center,o=this._effectiveGeometryRadius(i);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(i,r,n.range,e,s),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(i,r,-n.range,e,s)}s++,yield}return s}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||e.screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],G[0]=t[0]-s,G[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,G,(t,s,o)=>{f(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_intersectScreenPolygonRenderGeometry(e,r,t,s,i){if(!e.visible||!e.material.visible||!e.material.intersectScreenPolygonDraped)return;d(v,t+e.transformation[12],e.transformation[13]),e.screenToWorldRatio=this.rendererContext.screenToWorldRatio;const n=e.material.intersectScreenPolygonDraped(e,v,s,r);n&&R(r.distance,n.primitiveIndex,i,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class _{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function f(e,r,t,s,i,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&d(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&d(i.results.max),2===i.options.store){const e=new g(i.ray);d(e),i.results.all.push(e)}}function R(e,r,t,s,i,n,o){i.polygonResults.add(5,new c(n,o,r),e,t,s)}const G=h(),v=h(),C=128;export{y as SortedRenderGeometryRenderer};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromValues as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{IsNaN as r}from"../../../core/shaderLibrary/util/IsNaN.glsl.js";import{Float2BindUniform as e}from"../../../core/shaderModules/Float2BindUniform.js";import{glsl as a}from"../../../core/shaderModules/glsl.js";import{Matrix3PassUniform as s}from"../../../core/shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as t}from"../../../core/shaderModules/Matrix4BindUniform.js";const l=o(.5,-4e-4);function i(o,i){const c=o.vertex;c.include(r),c.constants.add("depthBias","vec2",l),c.uniforms.add(new e("inverseViewport",o=>o.inverseViewport)),i.legacy?(c.uniforms.add(new t("proj",o=>o.camera.projectionMatrix)),c.code.add(a`vec2 calculateProjectedBiasXY(vec4 projPos, vec3 globalNormal) {
2
+ import{fromValues as o}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{IsNaN as r}from"../../core/shaderLibrary/util/IsNaN.glsl.js";import{Float2BindUniform as e}from"../../core/shaderModules/Float2BindUniform.js";import{glsl as a}from"../../core/shaderModules/glsl.js";import{Matrix3PassUniform as s}from"../../core/shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as t}from"../../core/shaderModules/Matrix4BindUniform.js";const l=o(.5,-4e-4);function i(o,i){const c=o.vertex;c.include(r),c.constants.add("depthBias","vec2",l),c.uniforms.add(new e("inverseViewport",o=>o.inverseViewport)),i.legacy?(c.uniforms.add(new t("proj",o=>o.camera.projectionMatrix)),c.code.add(a`vec2 calculateProjectedBiasXY(vec4 projPos, vec3 globalNormal) {
3
3
  float offsetXY = depthBias.x;
4
4
  vec4 projNormal = proj * localView * vec4(globalNormal, 0.0);
5
5
  return offsetXY * projPos.w * 2.0 * inverseViewport * normalize(projNormal.xyz).xy;
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{glsl as e}from"../../../core/shaderModules/glsl.js";function o(o,l){const r=o.vertex;l.silhouette?(r.code.add(e`bool isSilhouetteEdge(vec3 viewDir, vec3 normalA, vec3 normalB) {
2
+ import{glsl as e}from"../../core/shaderModules/glsl.js";function o(o,l){const r=o.vertex;l.silhouette?(r.code.add(e`bool isSilhouetteEdge(vec3 viewDir, vec3 normalA, vec3 normalB) {
3
3
  float faceAVisible = dot(viewDir, normalA);
4
4
  float faceBVisible = dot(viewDir, normalB);
5
5
  return faceAVisible * faceBVisible < 0.0;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../../core/PooledArray.js";import{transpose as r,invert as t}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{set as i}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{debugFlags as o}from"../../../support/debugFlags.js";import{TwoVectorPosition as n}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as a}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as d}from"./EdgeShaderTechniqueConfiguration.js";import{isLegacyTransform as h}from"./LegacyTransform.js";import{PrimitiveType as c}from"../../../../webgl/enums.js";const m=8,f=128,g={type:0,hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0};class _{constructor(r,t,s){this.rctx=r,this._techniques=t,this._configuration=new d,this.refCount=0,this._renderables=new Set,this._sortedRenderables={0:{0:new e,1:new e},1:{0:new e,1:new e}},this._renderablesDirty=!1,this._drawParameters=new a,this._settings={...g,...s},this.key=_.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const i=this._settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:!o.ENABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.type=this._settings.type,this._configuration.silhouette=!1,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.spherical=s.spherical}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables();const t=this._sortedRenderables[r];t[0].forAll(e),t[1].forAll(e)}acquireTechnique(e,r){return this._lastOriginId=null,this._configuration.silhouette=r,this._techniques.get(l,this._configuration)}renderRegularEdges(e,r,t,s,i){this._render(e,r,r.regular.vao,t,s,i)}renderSilhouetteEdges(e,r,t,s,i){this._render(e,r,r.silhouette.vao,t,s,i)}get strokesTexture(){return this._settings.strokesTexture}_render(e,r,t,s,i,o){o>0&&(this._bindDraw(e,r,s,i),this.rctx.bindVAO(t),this.rctx.drawArraysInstanced(c.TRIANGLE_FAN,0,4,o))}_bindDraw(e,s,o,a){if(this._drawParameters.componentDataTextureBuffer=s.components.buffer.textureBuffer,h(s.transform)){const{origin:r}=s.transform,t=r.origin.id;this._lastOriginId!==t&&(e.setUniformMatrix4fv("localView",r.viewMatrix),this._lastOriginId=t),e.setUniformMatrix4fv("model",s.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=r.origin.vec3}else{const o=new n(s.transform.position),l=r(u,t(u,s.transform.rotationScale));e.setUniform3fv("transformWorldFromModelTL",o.low),e.setUniform3fv("transformWorldFromModelTH",o.high),e.setUniformMatrix3fv("transformWorldFromModelRS",s.transform.rotationScale),e.setUniformMatrix3fv("transformNormalGlobalFromModel",l);const d=a.camera.viewInverseTransposeMatrix;i(this._drawParameters.slicePlaneLocalOrigin,d[3],d[7],d[11])}e.bindDraw(a,o,this._drawParameters)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[0][0].clear(),this._sortedRenderables[0][1].clear(),this._sortedRenderables[1][0].clear(),this._sortedRenderables[1][1].clear(),this._renderables.forEach(e=>this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e));const e=(e,r)=>h(e.transform)?h(r.transform)?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[0][0].sort(e),this._sortedRenderables[0][1].sort(e),this._sortedRenderables[1][0].sort(e),this._sortedRenderables[1][1].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const u=s();export{_ as EdgeRenderer,f as extensionLengthOffset,m as lineWidthFractionFactor};
2
+ import e from"../../../../../core/PooledArray.js";import{transpose as r,invert as t}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{set as i}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{debugFlags as o}from"../../../support/debugFlags.js";import{TwoVectorPosition as n}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as a}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as d}from"./EdgeShaderTechniqueConfiguration.js";import{isLegacyTransform as h}from"./LegacyTransform.js";import{PrimitiveType as c}from"../../../../webgl/enums.js";const m=8,f=128,g={type:0,hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0};class _{constructor(r,t,s){this.rctx=r,this._techniques=t,this._configuration=new d,this.refCount=0,this._renderables=new Set,this._sortedRenderables={0:{0:new e,1:new e},1:{0:new e,1:new e}},this._renderablesDirty=!1,this._drawParameters=new a,this._settings={...g,...s},this.key=_.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const i=this._settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:!o.ENABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.type=this._settings.type,this._configuration.silhouette=!1,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.spherical=s.spherical}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables();const t=this._sortedRenderables[r];t[0].forAll(e),t[1].forAll(e)}acquireTechnique(e,r){return this._lastOriginId=null,this._configuration.silhouette=r,this._techniques.get(l,this._configuration)}renderRegularEdges(e,r,t,s,i){this._render(e,r,r.regular.vao,t,s,i)}renderSilhouetteEdges(e,r,t,s,i){this._render(e,r,r.silhouette.vao,t,s,i)}get strokesTexture(){return this._settings.strokesTexture}_render(e,r,t,s,i,o){o>0&&(this._bindDraw(e,r,s,i),this.rctx.bindVAO(t),this.rctx.drawArraysInstanced(c.TRIANGLE_FAN,0,4,o))}_bindDraw(e,s,o,a){if(this._drawParameters.componentData=s.components.buffer.textureBuffer,h(s.transform)){const{origin:r}=s.transform,t=r.origin.id;this._lastOriginId!==t&&(e.setUniformMatrix4fv("localView",r.viewMatrix),this._lastOriginId=t),e.setUniformMatrix4fv("model",s.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=r.origin.vec3}else{const o=new n(s.transform.position),l=r(u,t(u,s.transform.rotationScale));e.setUniform3fv("transformWorldFromModelTL",o.low),e.setUniform3fv("transformWorldFromModelTH",o.high),e.setUniformMatrix3fv("transformWorldFromModelRS",s.transform.rotationScale),e.setUniformMatrix3fv("transformNormalGlobalFromModel",l);const d=a.camera.viewInverseTransposeMatrix;i(this._drawParameters.slicePlaneLocalOrigin,d[3],d[7],d[11])}e.bindDraw(a,o,this._drawParameters)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[0][0].clear(),this._sortedRenderables[0][1].clear(),this._sortedRenderables[1][0].clear(),this._sortedRenderables[1][1].clear(),this._renderables.forEach(e=>this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e));const e=(e,r)=>h(e.transform)?h(r.transform)?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[0][0].sort(e),this._sortedRenderables[0][1].sort(e),this._sortedRenderables[1][0].sort(e),this._sortedRenderables[1][1].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const u=s();export{_ as EdgeRenderer,f as extensionLengthOffset,m as lineWidthFractionFactor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/Slice.glsl.js";import"../../core/shaderModules/Float2BindUniform.js";import"../../core/shaderModules/Float4BindUniform.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js";import"../../shaders/sources/edgeRenderer/DiscardNonSilhouetteEdges.glsl.js";import"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import"../../shaders/sources/edgeRenderer/LineAmplitude.glsl.js";import"../../shaders/sources/edgeRenderer/LineOffset.glsl.js";import"../../shaders/sources/edgeRenderer/UnpackAttributes.glsl.js";import"../../../../webgl/ShaderBuilder.js";import"../../../../webgl/Uniform.js";export{b as build}from"../../../../../chunks/EdgeShader.glsl.js";
2
+ import"../../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../core/shaderLibrary/Slice.glsl.js";import"../../core/shaderModules/Float2BindUniform.js";import"../../core/shaderModules/Float4BindUniform.js";import"../../core/shaderModules/FloatBindUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/glsl.js";import"./AdjustProjectedPosition.glsl.js";import"./DiscardNonSilhouetteEdges.glsl.js";import"./EdgeUtil.glsl.js";import"./LineAmplitude.glsl.js";import"./LineOffset.glsl.js";import"./UnpackAttributes.glsl.js";import"../../../../webgl/ShaderBuilder.js";import"../../../../webgl/Uniform.js";export{b as build}from"../../../../../chunks/EdgeShader.glsl.js";
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{TextureBackedBufferModule as o}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{NormalAttribute as e}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{DoublePrecision as r}from"../../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{Float3PassUniform as t}from"../../../core/shaderModules/Float3PassUniform.js";import{glsl as a}from"../../../core/shaderModules/glsl.js";import{Matrix3PassUniform as l}from"../../../core/shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as n}from"../../../core/shaderModules/Matrix4BindUniform.js";import{Texture2DUintDrawUniform as d}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{edgeViewTextureLayout as m}from"../../../lib/edgeRendering/bufferLayouts.js";import{Uniform as i}from"../../../../../webgl/Uniform.js";const s=new o({layout:m,itemIndexExpression:"componentIndex",bufferUniform:new d("componentTextureBuffer",o=>o.componentDataTextureBuffer?.texture)});function c(o,d){const{vertex:m}=o;o.include(e,d);const{silhouette:i,legacy:c,spherical:f}=d;o.attributes.add("componentIndex","uint");const w=s.createBuilder(o,d),p=8,x=128;m.constants.add("lineWidthFractionFactor","float",p),m.constants.add("extensionLengthOffset","float",x),m.code.add(a`
2
+ import{TextureBackedBufferModule as o}from"../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{NormalAttribute as e}from"../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{DoublePrecision as r}from"../../core/shaderLibrary/util/DoublePrecision.glsl.js";import{Float3PassUniform as t}from"../../core/shaderModules/Float3PassUniform.js";import{glsl as a}from"../../core/shaderModules/glsl.js";import{Matrix3PassUniform as l}from"../../core/shaderModules/Matrix3PassUniform.js";import{Matrix4BindUniform as n}from"../../core/shaderModules/Matrix4BindUniform.js";import{Texture2DUintDrawUniform as d}from"../../core/shaderModules/Texture2DUintDrawUniform.js";import{edgeViewTextureLayout as m}from"./bufferLayouts.js";import{Uniform as i}from"../../../../webgl/Uniform.js";const s=new o({layout:m,itemIndexExpression:"componentIndex",bufferUniform:new d("componentTextureBuffer",o=>o.componentData?.texture)});function c(o,d){const{vertex:m}=o;o.include(e,d);const{silhouette:i,legacy:c,spherical:f}=d;o.attributes.add("componentIndex","uint");const w=s.createBuilder(o,d),p=8,x=128;m.constants.add("lineWidthFractionFactor","float",p),m.constants.add("extensionLengthOffset","float",x),m.code.add(a`
3
3
  struct ComponentData {
4
4
  vec4 color;
5
5
  vec3 normal;
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FloatPassUniform as e}from"../../../core/shaderModules/FloatPassUniform.js";import{glsl as t}from"../../../core/shaderModules/glsl.js";import{UnpackAttributes as r}from"./UnpackAttributes.glsl.js";function s(s,a){const u=s.vertex;switch(s.include(r,a),a.type){case 0:u.code.add(t`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) {
2
+ import{FloatPassUniform as e}from"../../core/shaderModules/FloatPassUniform.js";import{glsl as t}from"../../core/shaderModules/glsl.js";import{UnpackAttributes as r}from"./UnpackAttributes.glsl.js";function s(s,a){const u=s.vertex;switch(s.include(r,a),a.type){case 0:u.code.add(t`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) {
3
3
  return 0.0;
4
4
  }`);break;case 1:u.uniforms.add(new e("strokesAmplitude",e=>e.strokesTexture.amplitude)).code.add(t`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) {
5
5
  return strokesAmplitude;
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FloatPassUniform as e}from"../../../core/shaderModules/FloatPassUniform.js";import{glsl as t}from"../../../core/shaderModules/glsl.js";import{Texture2DPassUniform as r}from"../../../core/shaderModules/Texture2DPassUniform.js";import{usesSketchLogic as s}from"./EdgeUtil.glsl.js";import{UnpackAttributes as a}from"./UnpackAttributes.glsl.js";import{NoParameters as u}from"../../../../../webgl/NoParameters.js";class c extends u{}function l(u,c){u.include(a,c);const{vertex:l,fragment:o}=u;switch(s(c.type)&&(u.varyings.add("vStrokeUV","vec2"),l.uniforms.add(new r("strokesTexture",e=>e.strokesTexture.texture),new e("strokesLog2Resolution",e=>Math.log2(e.strokesTexture.resolution)),new e("strokeVariants",e=>e.strokesTexture.variants)).code.add(t`void calculateStyleOutputsSketch(float lineLength, UnpackedAttributes unpackedAttributes) {
2
+ import{FloatPassUniform as e}from"../../core/shaderModules/FloatPassUniform.js";import{glsl as t}from"../../core/shaderModules/glsl.js";import{Texture2DPassUniform as r}from"../../core/shaderModules/Texture2DPassUniform.js";import{usesSketchLogic as s}from"./EdgeUtil.glsl.js";import{UnpackAttributes as a}from"./UnpackAttributes.glsl.js";import{NoParameters as u}from"../../../../webgl/NoParameters.js";class c extends u{}function l(u,c){u.include(a,c);const{vertex:l,fragment:o}=u;switch(s(c.type)&&(u.varyings.add("vStrokeUV","vec2"),l.uniforms.add(new r("strokesTexture",e=>e.strokesTexture.texture),new e("strokesLog2Resolution",e=>Math.log2(e.strokesTexture.resolution)),new e("strokeVariants",e=>e.strokesTexture.variants)).code.add(t`void calculateStyleOutputsSketch(float lineLength, UnpackedAttributes unpackedAttributes) {
3
3
  vec2 sidenessNorm = unpackedAttributes.sidenessNorm;
4
4
  float lineIndex = clamp(ceil(log2(lineLength)), 0.0, strokesLog2Resolution);
5
5
  vStrokeUV = vec2(exp2(lineIndex) * sidenessNorm.y, lineIndex * strokeVariants + variantStroke + 0.5) / vec2(textureSize(strokesTexture, 0));
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{If as e,glsl as t}from"../../../core/shaderModules/glsl.js";function n(n,s){const i=2===s.type,o=0===s.type;n.attributes.add("sideness","vec2"),n.vertex.code.add(t`
2
+ import{If as e,glsl as t}from"../../core/shaderModules/glsl.js";function n(n,s){const i=2===s.type,o=0===s.type;n.attributes.add("sideness","vec2"),n.vertex.code.add(t`
3
3
  struct UnpackedAttributes {
4
4
  vec2 sideness;
5
5
  vec2 sidenessNorm;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,distance as n,squaredDistance as o,set as r,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as u,getMax as a,getMin as c,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as y}from"./screenPolygonOverlapUtils.js";class v{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function N(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new v(4);let s;if(t.boundingInfo)s=P(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=x(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,u){const a=new v(4);for(const c of x(t,e,n,o,r,i,s,l,u,null,0))a.updateIfCloser(c);return a.valid?a:null}function j(t,e,n,o,r){const i=new v(4);for(const s of C(t,e,n,o,r))i.updateIfCloser(s);return i.valid?i:null}function*x(t,e,n,o,r,i,s,l,u,a=null,c=0){const f=(t,n,o,r)=>{const f=(a?.[r]??r)+c,m=null==a?f:r,p=3*f;return F(t,i,s,l,p+0,u,m,e),F(n,i,s,l,p+1,u,m,e),F(o,i,s,l,p+2,u,m,e),f};return yield*C(t,n,o,r,f)}function*C(t,e,o,r,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let u=o;u<r;++u){const t=i(S[0],S[1],S[2],u),o=B;let r;U.reset();for(const{list:i,count:u}of l.processTriangle(k,S)){const l=m(s.frustum[4],i,u,E,!1);if(!(l<3)){for(let t=0;t<l;t++)s.projectToScreen(E[t],Y[t]);V(e,Y,l)&&(w(s.eye,E,l,_),null==r&&(r=p(B,S[0],S[1],S[2])),U.updateIfCloserFromValues(n(s.eye,_),t,_,r?o:null))}}U.valid&&(yield U)}}function*P(t,e,n,o,r){const i=e.camera,s=null!=r?(l(A,t.bbMin),u(A,t.bbMax),r.applyToAabb(A),h(i,c(A,S[0]),a(A,S[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*P(t,e,n,o,r);return}}yield*x(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function F(t,e,n,o,s,l,u,a){const c=o*e[s],f=n[c+0],m=n[c+1],p=n[c+2];null!=l?l.applyToVertex(t,f,m,p,u):r(t,f,m,p),a&&i(t,t,a)}function V(t,e,n){for(let o=1;o<n-1;o++)if(y(t,e[0],e[o],e[o+1]))return!0;return!1}function w(t,n,r,i){let s=Number.POSITIVE_INFINITY;for(let l=1;l<r-1;l++){d(M,t,n[0],n[l],n[l+1]);const r=o(t,M);r<s&&(s=r,e(i,M))}}const A=f(),O=12,S=[s(),s(),s()],E=Array.from({length:O},()=>s()),Y=Array.from({length:O},()=>t()),_=s(),B=s(),M=s(),U=new v(4),k={list:[],count:0};export{v as Hit,x as forEachTriangleRangeScreenPolygonHit,C as forEachTriangleReaderRangeScreenPolygonHit,N as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon,j as intersectTriangleReaderRangeScreenPolygon};
2
+ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,distance as n,squaredDistance as o,set as r,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as u,getMax as c,getMin as a,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as v}from"./screenPolygonOverlapUtils.js";class y{constructor(t){this.primitiveIndex=t}}class N{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function x(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new N(4);let s;if(t.boundingInfo)s=F(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=C(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,u){const c=new N(4);for(const a of C(t,e,n,o,r,i,s,l,u,null,0))c.updateIfCloser(a);return c.valid?c:null}function j(t,e,n,o,r){const i=new N(4);for(const s of P(t,e,n,o,r))i.updateIfCloser(s);return i.valid?i:null}function*C(t,e,n,o,r,i,s,l,u,c=null,a=0){const f=(t,n,o,r)=>{const f=(c?.[r]??r)+a,m=null==c?f:r,p=3*f;return V(t,i,s,l,p+0,u,m,e),V(n,i,s,l,p+1,u,m,e),V(o,i,s,l,p+2,u,m,e),f};return yield*P(t,n,o,r,f)}function*P(t,e,o,r,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let u=o;u<r;++u){const t=i(E[0],E[1],E[2],u),o=M;let r;k.reset();for(const{list:i,count:u}of l.processTriangle(q,E)){const l=m(s.frustum[4],i,u,Y,!1);if(!(l<3)){for(let t=0;t<l;t++)s.projectToScreen(Y[t],_[t]);w(e,_,l)&&(A(s.eye,Y,l,B),null==r&&(r=p(M,E[0],E[1],E[2])),k.updateIfCloserFromValues(n(s.eye,B),t,B,r?o:null))}}k.valid&&(yield k)}}function*F(t,e,n,o,r){const i=e.camera,s=null!=r?(l(O,t.bbMin),u(O,t.bbMax),r.applyToAabb(O),h(i,a(O,E[0]),c(O,E[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*F(t,e,n,o,r);return}}yield*C(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function V(t,e,n,o,s,l,u,c){const a=o*e[s],f=n[a+0],m=n[a+1],p=n[a+2];null!=l?l.applyToVertex(t,f,m,p,u):r(t,f,m,p),c&&i(t,t,c)}function w(t,e,n){for(let o=1;o<n-1;o++)if(v(t,e[0],e[o],e[o+1]))return!0;return!1}function A(t,n,r,i){let s=Number.POSITIVE_INFINITY;for(let l=1;l<r-1;l++){d(U,t,n[0],n[l],n[l+1]);const r=o(t,U);r<s&&(s=r,e(i,U))}}const O=f(),S=12,E=[s(),s(),s()],Y=Array.from({length:S},()=>s()),_=Array.from({length:S},()=>t()),B=s(),M=s(),U=s(),k=new N(4),q={list:[],count:0};export{y as DrapedHit,N as Hit,C as forEachTriangleRangeScreenPolygonHit,P as forEachTriangleReaderRangeScreenPolygonHit,x as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon,j as intersectTriangleReaderRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{exactEquals as e,subtract as t,add as r,set as s,copy as i,normalize as a,length as o,scale as n,dot as l,transformMat3 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as h,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as f,setMax as d,getMax as x}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as T,isColor as g}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as v}from"../lib/GLTextureMaterial.js";import{Material as S}from"../lib/Material.js";import{intersectTriangleGeometry as b}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as M}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as y}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as C,applyPolygonOffsetToHit as R}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as w}from"./internal/MaterialUtil.js";import{getLayout as P,DefaultMaterialPassParameters as j,DefaultMaterialTechnique as V}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as I}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as _}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as A}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class D extends S{constructor(e,t){super(e,z),this.materialType="default",this.supportsEdges=!0,this.intersectRayDraped=void 0,this.produces=new Map([[2,e=>T(e)&&!this.transparent],[4,e=>T(e)&&this.transparent]]),this._layout=P(this.parameters),this._configuration=new I(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=B}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,g(e.output)?(r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=A(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao,r.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1,r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,r,s,i,a,o){const n=this._getMaterialVerticalOffset(r,s);null!=n&&(i=t(F,i,n),a=t(E,a,n)),o=C(o,this._configuration,i,a),b(e,s,i,a,y(s.verticalOffset),o)}intersectScreenPolygon(e,t,r,s){return R(M(e,r,t,s,this._createScreenPolygonVertexDisplacement(t,r)),this._configuration,r.camera.eye)}createGLMaterial(e){return new N(e)}createBufferWriter(){return new O(this._layout)}get transparent(){const{drivenOpacity:e,opacity:t,externalColor:r,layerOpacity:s,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:n}=this.parameters,l=r[3];return e||t<1&&"replace"!==n||l<1&&"ignore"!==n||s<1||(null!=i||null!=a)&&1!==o&&2!==o&&"replace"!==n}_createScreenPolygonVertexDisplacement(e,t){const s=this._getMaterialVerticalOffset(e,t);return null==s?null:{applyToVertex:(e,t,r,i)=>(e[0]=t+s[0],e[1]=r+s[1],e[2]=i+s[2],e),applyToAabb:e=>(p(e,r(W,f(e,W),s)),d(e,r(W,x(e,W),s)),e)}}_getMaterialVerticalOffset(e,r){if(null==this.parameters.verticalOffset)return null;const u=r.camera;s(G,e[12],e[13],e[14]);let h=null;switch(r.viewingMode){case 1:h=a(k,G);break;case 2:h=i(k,q)}const m=t(H,G,u.eye),p=o(m),f=n(m,m,1/p);let d=null;this.parameters.screenSizePerspective&&(d=l(h,f));const x=w(u,p,this.parameters.verticalOffset,d??0,this.parameters.screenSizePerspective,null);return n(h,h,x),c(L,h,r.transform.inverseRotation)}}class N extends v{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return s(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?_:V,e)}}class z extends j{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const F=h(),E=h(),q=m(0,0,1),k=h(),G=h(),H=h(),L=h(),W=h();export{N as DefaultGLMaterial,D as DefaultMaterial,z as DefaultMaterialParameters};
2
+ import{exactEquals as e,subtract as t,add as r,set as s,copy as i,normalize as a,length as o,scale as n,dot as l,transformMat3 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as h,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as d,setMax as f,getMax as x}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as g,isColor as T}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as v}from"../lib/GLTextureMaterial.js";import{Material as S}from"../lib/Material.js";import{intersectTriangleGeometry as b}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as M}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as y}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as C,applyPolygonOffsetToHit as P}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as R}from"./internal/MaterialUtil.js";import{getLayout as w,DefaultMaterialPassParameters as j,DefaultMaterialTechnique as V}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as I}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as _}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as A}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as D}from"../../../../webscene/support/AlphaCutoff.js";class B extends S{constructor(e,t){super(e,z),this.materialType="default",this.supportsEdges=!0,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,e=>g(e)&&!this.transparent],[4,e=>g(e)&&this.transparent]]),this._layout=w(this.parameters),this._configuration=new I(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=D}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,T(e.output)?(r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=A(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao,r.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1,r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,r,s,i,a,o){const n=this._getMaterialVerticalOffset(r,s);null!=n&&(i=t(F,i,n),a=t(E,a,n)),o=C(o,this._configuration,i,a),b(e,s,i,a,y(s.verticalOffset),o)}intersectScreenPolygon(e,t,r,s){return P(M(e,r,t,s,this._createScreenPolygonVertexDisplacement(t,r)),this._configuration,r.camera.eye)}createGLMaterial(e){return new N(e)}createBufferWriter(){return new O(this._layout)}get transparent(){const{drivenOpacity:e,opacity:t,externalColor:r,layerOpacity:s,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:n}=this.parameters,l=r[3];return e||t<1&&"replace"!==n||l<1&&"ignore"!==n||s<1||(null!=i||null!=a)&&1!==o&&2!==o&&"replace"!==n}_createScreenPolygonVertexDisplacement(e,t){const s=this._getMaterialVerticalOffset(e,t);return null==s?null:{applyToVertex:(e,t,r,i)=>(e[0]=t+s[0],e[1]=r+s[1],e[2]=i+s[2],e),applyToAabb:e=>(p(e,r(W,d(e,W),s)),f(e,r(W,x(e,W),s)),e)}}_getMaterialVerticalOffset(e,r){if(null==this.parameters.verticalOffset)return null;const u=r.camera;s(G,e[12],e[13],e[14]);let h=null;switch(r.viewingMode){case 1:h=a(k,G);break;case 2:h=i(k,q)}const m=t(H,G,u.eye),p=o(m),d=n(m,m,1/p);let f=null;this.parameters.screenSizePerspective&&(f=l(h,d));const x=R(u,p,this.parameters.verticalOffset,f??0,this.parameters.screenSizePerspective,null);return n(h,h,x),c(L,h,r.transform.inverseRotation)}}class N extends v{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return s(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?_:V,e)}}class z extends j{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const F=h(),E=h(),q=m(0,0,1),k=h(),G=h(),H=h(),L=h(),W=h();export{N as DefaultGLMaterial,B as DefaultMaterial,z as DefaultMaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as h,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as b,transformMat3 as x,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as R,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as D,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as j}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as U}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as M}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as T,isColor as _,isOIT as F}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as I}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as L,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{Material as B}from"../lib/Material.js";import{screenPolygonIntersectsBounds as H,screenPolygonIntersectsTriangle as W}from"../lib/screenPolygonOverlapUtils.js";import{Hit as N}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as G}from"../lib/screenSizePerspectiveUtils.js";import{assert as q}from"../lib/Util.js";import{writePosition as X,writeNormal as Y,writeColor as k,writeBufferVec2 as J,writeBufferFloat as K,writeBufferVec3 as Q,writeBufferZeros as Z,writeBufferVec4 as $,writeOlidColor as ee}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as te}from"./internal/MaterialUtil.js";import{a as se}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as ie,getInstanceLayout as re,HUDMaterialTechnique as ae}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ne}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as oe}from"../../../../webscene/support/AlphaCutoff.js";class le extends B{constructor(e,t,s=!1){super(e,We),this.produces=new Map([[12,e=>T(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>T(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>T(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&T(e)]]),this._visible=!0,this._configuration=new ne(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,i=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=i,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!i&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,_(e.output)&&(s.debugDrawLabelBorder=!!M.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&F(e.output)}intersectRay(e,t,s,i,r,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:f}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&f)for(const{renderScreenPosition:S,screenSize:b,pixelRatioTolerance:x,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(_e,e,t,f))if(pe(c,S[0],S[1],b,x,v,O,g,z)){const e=s.ray;if(xe[0]=c[0],xe[1]=c[1],xe[2]=S[2],f.unprojectFromRenderScreen(xe,ge)){const t=y();h(t,e.direction);const s=1/p(t);u(t,t,s);const i=d(e.origin,ge)*s,r=y();m(r,P,f.inverseViewMatrix),a(i,t,-1,r)}}}*_forEachScreenSpaceHUDInstance(e,t,s,r){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,Re),{scaleX:c,scaleY:f}=Ge(l,n,r.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,R=i(ye,s);q(p.size>=3);const C="screen"===n.centerOffsetUnits;for(let i=0;i<p.data.length/p.size;i++){const t=i*p.size;if(g(ge,p.data[t],p.data[t+1],p.data[t+2]),m(ge,ge,s),m(ge,ge,r.viewMatrix),y){const e=i*y.size;g(Pe,y.data[e],y.data[e+1],y.data[e+2])}else g(Pe,0,0,0);if(!C&&(ge[0]+=Pe[0],ge[1]+=Pe[1],0!==Pe[2])){const e=Pe[2];S(Pe,ge),b(ge,ge,u(Pe,Pe,e))}const o=i*O.size;g(Se,O.data[o],O.data[o+1],O.data[o+2]),x(Se,Se,R);const{normal:l,cosAngle:V}=he(Se,r,Ie),D=Xe(n,ge,V,r,me);if(v(ge,ge,l,D),r.applyProjection(ge,be),be[0]>-1){if(C&&(Pe[0]||Pe[1])&&(be[0]+=Pe[0]*r.pixelRatio,0!==Pe[1]&&(be[1]+=me.alignmentEvaluator.apply(Pe[1])*r.pixelRatio),r.unapplyProjection(be,ge)),be[0]+=n.screenOffset[0]*r.pixelRatio,be[1]+=n.screenOffset[1]*r.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]),Be[0]=P[0],Be[1]=P[1],null!=d){const e=i*d.size;Be[0]*=d.data[e],Be[1]*=d.data[e+1]}me.evaluator.applyVec2(Be,Be);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*Be[0])*r.pixelRatio/2}Be[0]*=c,Be[1]*=f,h(e.centerView,ge),g(e.renderScreenPosition,be[0],be[1],be[2]),a(e.screenSize,Be),e.pixelRatioTolerance=Le*r.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[i*z.size]:0),e.anchor=se(n),yield e}}}*_forEachDrapedHUDInstance(e,t){const s=t.attributes.get("position"),i=t.attributes.get("size"),r=t.attributes.get("rotation"),n=this.parameters,o=n.size,l=t.attributes.get("featureAttribute"),c=null==l?null:V(l.data,Re),{scaleX:f,scaleY:h}=Ge(c,n,t.screenToWorldRatio);e.pixelRatioTolerance=Ee*t.screenToWorldRatio,e.anchor=se(n);for(let p=0;p<s.data.length/s.size;p++){const l=p*s.size;if(e.x=s.data[l],e.y=s.data[l+1],Be[0]=o[0],Be[1]=o[1],null!=i){const e=p*i.size;Be[0]*=i.data[e],Be[1]*=i.data[e+1]}if(e.halfOutlineSize=0,n.textureIsSignedDistanceField){const s=Math.min(n.outlineSize,.5*Be[0]);e.halfOutlineSize=s*t.screenToWorldRatio/2}Be[0]*=f,Be[1]*=h,a(e.screenSize,Be),e.rotationAngle=n.rotation+(null!=r?r.data[p*r.size]:0),yield e}}intersectRayDraped(e,t,s,i,r){const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:f,rotationAngle:h,anchor:p}of this._forEachDrapedHUDInstance(Fe,e))pe(s,n,o,l,c,f,h,a,p)&&i(r.distance,r.normal,-1)}intersectScreenPolygon(e,t,s,i){const{options:{selectionMode:r,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!r||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new N(1),f=1/o.pixelRatio;for(const{renderScreenPosition:h,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:b,centerView:x}of this._forEachScreenSpaceHUDInstance(_e,e,t,o)){const e=m(ge,x,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=h[0]*f,r=(o.fullHeight-h[1])*f;if(Ue[0]=p[0]*f,Ue[1]=p[1]*f,ue(i,t,r,Ue,u*f,g*f,S,l,b)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new Ne(this.parameters)}applyShaderOffsets(e,t,s,r,a,n,o,l){x(ve,s,i(ye,r));const c=he(ve,o,Ie),f=qe(p(t),o),h=Xe(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,h+f),v(e,e,ve,h+f);const u=n+h;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,i,r,a){return this._applyCenterOffsetNDC(e,t,i,r),null!=a&&h(a,r),this._applyPolygonOffsetNDC(r,s,i,r),r}_applyPolygonOffsetView(t,s,i,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(i);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const c=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return u(a,t,l>0?f:1/f),a}_applyCenterOffsetView(e,t,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),i&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(Se,s),O(s,s,u(Se,Se,t[2])))),s}_applyCenterOffsetNDC(e,t,s,i){const r="screen"!==this.parameters.centerOffsetUnits;return i!==e&&h(i,e),r||(i[0]+=t[0]/s.fullWidth*2,i[1]+=t[1]/s.fullHeight*2),i}_applyPolygonOffsetNDC(e,t,s,i){const r=this.parameters.shaderPolygonOffset;if(e!==i&&h(i,e),r){const e=s.aboveGround?1:-1,a=e*Math.sign(t);i[2]-=(a||e)*r}return i}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,i=e[3]>=oe||t>=oe&&s[3]>=oe;return this._visible&&i}createGLMaterial(e){return new ce(e)}calculateRelativeScreenBounds(e,t,s=D()){return fe(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class ce extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ae,e)}}function fe(e,t,s,i){i[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,i[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function he(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,He),s}function pe(e,s,i,r,a,l,c,f,h){const p=de(s,i,r,a,l,f,h,Ce);return n(ze,s,i),o(Oe,e,ze,t(c)),Oe[0]>p[0]&&Oe[0]<p[2]&&Oe[1]>p[1]&&Oe[1]<p[3]}function ue(e,s,i,r,a,l,c,f,h){const p=de(s,i,r,a,l,f,h,Ce,!0);if(n(De,p[0],p[1]),n(we,p[2],p[1]),n(Ae,p[2],p[3]),n(je,p[0],p[3]),0!==c){const e=t(c);n(ze,s,i),o(De,De,ze,e),o(we,we,ze,e),o(Ae,Ae,ze,e),o(je,je,ze,e),w(p),A(p,De),A(p,we),A(p,Ae),A(p,je)}return!!H(e,p)&&(W(e,De,we,Ae)||W(e,De,Ae,je))}function de(e,t,s,i,r,a,n,o,l=!1){let c=e-i-s[0]*n[0],f=c+s[0]+2*i;const h=l?1-n[1]:n[1];let p=t-i-s[1]*h,u=p+s[1]+2*i;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),f-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=r,f+=r,p-=r,u+=r),o[0]=c,o[1]=p,o[2]=f,o[3]=u,o}const me=new G,ge=y(),Se=y(),be=C(),xe=s(),ve=y(),Oe=f(),ze=f(),ye=r(),Pe=y(),Ve=y(),Re=C(),Ce=D(),De=f(),we=f(),Ae=f(),je=f(),Ue=f();class Me{constructor(){this.renderScreenPosition=y(),this.screenSize=f(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}class Te{constructor(){this.x=0,this.y=0,this.screenSize=f(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}const _e=new Me,Fe=new Te,Ie={normal:y(),cosAngle:0},Le=1,Ee=2,Be=c(0,0),He=P(0,0,1);class We extends L{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=R,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=R,this.outlineSize=0,this.distanceFieldBoundingBox=C(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ne{constructor(e){this.baseInstanceLayout=ie,this.layout=re(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,i,r){if(null==r)return;const{buffer:a,offset:n}=r,{position:o,normal:l,color:c,size:f,rotation:h,centerOffset:p,groundDistance:u,featureAttribute:d,uvi:m}=a;X(s.get("position"),e,o,n),Y(s.get("normal"),t,l,n);const g=s.get("position").indices.length;if(m){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,i,r]=e;for(let e=0;e<g;++e){const a=n+e;m.setValues(a,t,s,i,r)}}}if(c&&k(s.get("color"),4,c,n),f&&J(s.get("size"),f,n),h&&K(s.get("rotation"),h,n),p&&(s.get("centerOffset")?Q(s.get("centerOffset"),p,n):Z(p,n,g)),s.get("groundDistance")?K(s.get("groundDistance"),u,n):Z(u,n,g),d&&(s.get("featureAttribute")?$(s.get("featureAttribute"),d,n):Z(d,n,g)),null!=i){const e=s.get("position")?.indices;if(e){const t=e.length,s=a.getField("olidColor",j);ee(i,s,t,n)}}}writeBaseInstance(e,t){const{uv0:s}=t;J(e.get("uv0"),s,0)}}function Ge(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(U(Ve,t,e),{scaleX:Ve[0]*s,scaleY:Ve[1]*s})}function qe(e,t){const s=t.computeRenderPixelSizeAtDist(e)*I;return(t.aboveGround?1:-1)*s}function Xe(e,t,s,i,r){if(!e.verticalOffset?.screenLength){const i=p(t);return r.update(s,i,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=te(i,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{le as HUDMaterial,We as Parameters};
2
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as h,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as x,transformMat3 as b,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as R,create as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as C,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as j}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as U}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as M}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as T,isColor as _,isOIT as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{Material as B}from"../lib/Material.js";import{screenPolygonIntersectsBounds as H,screenPolygonIntersectsTriangle as W}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as N,Hit as G}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as q}from"../lib/screenSizePerspectiveUtils.js";import{assert as X}from"../lib/Util.js";import{writePosition as Y,writeNormal as k,writeColor as J,writeBufferVec2 as K,writeBufferFloat as Q,writeBufferVec3 as Z,writeBufferZeros as $,writeBufferVec4 as ee,writeOlidColor as te}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as se}from"./internal/MaterialUtil.js";import{a as re}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as ie,getInstanceLayout as ae,HUDMaterialTechnique as ne}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as oe}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as le}from"../../../../webscene/support/AlphaCutoff.js";class ce extends B{constructor(e,t,s=!1){super(e,Ne),this.produces=new Map([[12,e=>T(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>T(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>T(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&T(e)]]),this._visible=!0,this._configuration=new oe(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,_(e.output)&&(s.debugDrawLabelBorder=!!M.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&L(e.output)}intersectRay(e,t,s,r,i,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:f}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&f)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:b,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(Le,e,t,f))if(ue(c,S[0],S[1],x,b,v,O,g,z)){const e=s.ray;if(ve[0]=c[0],ve[1]=c[1],ve[2]=S[2],f.unprojectFromRenderScreen(ve,Se)){const t=y();h(t,e.direction);const s=1/p(t);u(t,t,s);const r=d(e.origin,Se)*s,i=y();m(i,P,f.inverseViewMatrix),a(r,t,-1,i)}}}*_forEachScreenSpaceHUDInstance(e,t,s,i){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,De),{scaleX:c,scaleY:f}=qe(l,n,i.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,R=r(Pe,s);X(p.size>=3);const D="screen"===n.centerOffsetUnits;for(let r=0;r<p.data.length/p.size;r++){const t=r*p.size;if(g(Se,p.data[t],p.data[t+1],p.data[t+2]),m(Se,Se,s),m(Se,Se,i.viewMatrix),y){const e=r*y.size;g(Ve,y.data[e],y.data[e+1],y.data[e+2])}else g(Ve,0,0,0);if(!D&&(Se[0]+=Ve[0],Se[1]+=Ve[1],0!==Ve[2])){const e=Ve[2];S(Ve,Se),x(Se,Se,u(Ve,Ve,e))}const o=r*O.size;g(xe,O.data[o],O.data[o+1],O.data[o+2]),b(xe,xe,R);const{normal:l,cosAngle:V}=pe(xe,i,Ie),C=Ye(n,Se,V,i,ge);if(v(Se,Se,l,C),i.applyProjection(Se,be),be[0]>-1){if(D&&(Ve[0]||Ve[1])&&(be[0]+=Ve[0]*i.pixelRatio,0!==Ve[1]&&(be[1]+=ge.alignmentEvaluator.apply(Ve[1])*i.pixelRatio),i.unapplyProjection(be,Se)),be[0]+=n.screenOffset[0]*i.pixelRatio,be[1]+=n.screenOffset[1]*i.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]),He[0]=P[0],He[1]=P[1],null!=d){const e=r*d.size;He[0]*=d.data[e],He[1]*=d.data[e+1]}ge.evaluator.applyVec2(He,He);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*He[0])*i.pixelRatio/2}He[0]*=c,He[1]*=f,h(e.centerView,Se),g(e.renderScreenPosition,be[0],be[1],be[2]),a(e.screenSize,He),e.pixelRatioTolerance=Ee*i.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[r*z.size]:0),e.anchor=re(n),yield e}}}*_forEachDrapedHUDInstance(e,t){const s=t.attributes.get("position"),r=t.attributes.get("size"),i=t.attributes.get("rotation"),n=this.parameters,o=n.size,l=t.attributes.get("featureAttribute"),c=null==l?null:V(l.data,De),{scaleX:f,scaleY:h}=qe(c,n,t.screenToWorldRatio);e.pixelRatioTolerance=Be*t.screenToWorldRatio,e.anchor=re(n);for(let p=0;p<s.data.length/s.size;p++){const l=p*s.size;if(e.x=s.data[l],e.y=s.data[l+1],He[0]=o[0],He[1]=o[1],null!=r){const e=p*r.size;He[0]*=r.data[e],He[1]*=r.data[e+1]}if(e.halfOutlineSize=0,n.textureIsSignedDistanceField){const s=Math.min(n.outlineSize,.5*He[0]);e.halfOutlineSize=s*t.screenToWorldRatio/2}He[0]*=f,He[1]*=h,a(e.screenSize,He),e.rotationAngle=n.rotation+(null!=i?i.data[p*i.size]:0),yield e}}intersectRayDraped(e,t,s,r,i){const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:f,rotationAngle:h,anchor:p}of this._forEachDrapedHUDInstance(Fe,e))ue(s,n,o,l,c,f,h,a,p)&&r(i.distance,i.normal,-1)}intersectScreenPolygonDraped(e,t,s,r){if(!s.options.selectionMode||s.options.excludeLabels&&this.parameters.isLabel)return null;const i=this.parameters;for(const{x:a,y:n,screenSize:o,pixelRatioTolerance:l,halfOutlineSize:c,rotationAngle:f,anchor:h}of this._forEachDrapedHUDInstance(Fe,e))if(de(r,a+t[0],n+t[1],o,l,c,f,i,h,!1))return new N(-1);return null}intersectScreenPolygon(e,t,s,r){const{options:{selectionMode:i,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!i||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new G(1),f=1/o.pixelRatio;for(const{renderScreenPosition:h,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:b}of this._forEachScreenSpaceHUDInstance(Le,e,t,o)){const e=m(Se,b,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=h[0]*f,i=(o.fullHeight-h[1])*f;if(Me[0]=p[0]*f,Me[1]=p[1]*f,de(r,t,i,Me,u*f,g*f,S,l,x,!0)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new Ge(this.parameters)}applyShaderOffsets(e,t,s,i,a,n,o,l){b(Oe,s,r(Pe,i));const c=pe(Oe,o,Ie),f=Xe(p(t),o),h=Ye(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,h+f),v(e,e,Oe,h+f);const u=n+h;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&h(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const c=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/i.viewport[2];return u(a,t,l>0?f:1/f),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(xe,s),O(s,s,u(xe,xe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=le||t>=le&&s[3]>=le;return this._visible&&r}createGLMaterial(e){return new fe(e)}calculateRelativeScreenBounds(e,t,s=C()){return he(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class fe extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ne,e)}}function he(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function pe(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,We),s}function ue(e,s,r,i,a,l,c,f,h){const p=me(s,r,i,a,l,f,h,Ce);return n(ye,s,r),o(ze,e,ye,t(c)),ze[0]>p[0]&&ze[0]<p[2]&&ze[1]>p[1]&&ze[1]<p[3]}function de(e,s,r,i,a,l,c,f,h,p){const u=me(s,r,i,a,l,f,h,Ce,p);if(n(we,u[0],u[1]),n(Ae,u[2],u[1]),n(je,u[2],u[3]),n(Ue,u[0],u[3]),0!==c){const e=t(c);n(ye,s,r),o(we,we,ye,e),o(Ae,Ae,ye,e),o(je,je,ye,e),o(Ue,Ue,ye,e),w(u),A(u,we),A(u,Ae),A(u,je),A(u,Ue)}return!!H(e,u)&&(W(e,we,Ae,je)||W(e,we,je,Ue))}function me(e,t,s,r,i,a,n,o,l=!1){let c=e-r-s[0]*n[0],f=c+s[0]+2*r;const h=l?1-n[1]:n[1];let p=t-r-s[1]*h,u=p+s[1]+2*r;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),f-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=i,f+=i,p-=i,u+=i),o[0]=c,o[1]=p,o[2]=f,o[3]=u,o}const ge=new q,Se=y(),xe=y(),be=D(),ve=s(),Oe=y(),ze=f(),ye=f(),Pe=i(),Ve=y(),Re=y(),De=D(),Ce=C(),we=f(),Ae=f(),je=f(),Ue=f(),Me=f();class Te{constructor(){this.renderScreenPosition=y(),this.screenSize=f(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}class _e{constructor(){this.x=0,this.y=0,this.screenSize=f(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}const Le=new Te,Fe=new _e,Ie={normal:y(),cosAngle:0},Ee=1,Be=2,He=c(0,0),We=P(0,0,1);class Ne extends I{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=R,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=R,this.outlineSize=0,this.distanceFieldBoundingBox=D(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ge{constructor(e){this.baseInstanceLayout=ie,this.layout=ae(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i){if(null==i)return;const{buffer:a,offset:n}=i,{position:o,normal:l,color:c,size:f,rotation:h,centerOffset:p,groundDistance:u,featureAttribute:d,uvi:m}=a;Y(s.get("position"),e,o,n),k(s.get("normal"),t,l,n);const g=s.get("position").indices.length;if(m){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const a=n+e;m.setValues(a,t,s,r,i)}}}if(c&&J(s.get("color"),4,c,n),f&&K(s.get("size"),f,n),h&&Q(s.get("rotation"),h,n),p&&(s.get("centerOffset")?Z(s.get("centerOffset"),p,n):$(p,n,g)),s.get("groundDistance")?Q(s.get("groundDistance"),u,n):$(u,n,g),d&&(s.get("featureAttribute")?ee(s.get("featureAttribute"),d,n):$(d,n,g)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=a.getField("olidColor",j);te(r,s,t,n)}}}writeBaseInstance(e,t){const{uv0:s}=t;K(e.get("uv0"),s,0)}}function qe(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(U(Re,t,e),{scaleX:Re[0]*s,scaleY:Re[1]*s})}function Xe(e,t){const s=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*s}function Ye(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=p(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=se(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ce as HUDMaterial,Ne as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{writePosition as n,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class b extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends a{constructor(t){super(t,b),this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this._configuration=new p}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(r,s,i,a,n){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,m=f*f,p=o.data.length/o.size;for(let h=0;h<p;h++){const r=h*o.size,s=t(v,o.data[r],o.data[r+1]);e(s,i)<m&&a(n.distance,n.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new j(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class j{constructor(t){this.layout=t,this.baseInstanceLayout=m}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s,i){if(null==i)return;const{buffer:a,offset:u}=i;n(r.get("position"),t,a.position,u);const c="featureAttribute"in a?a.featureAttribute:null;c&&o(r.get("featureAttribute"),c,u)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const v=r();export{d as HeatmapDensityMaterial,b as Parameters};
2
+ import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{writePosition as n,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as p}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class d extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends a{constructor(t){super(t,d),this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this.intersectScreenPolygonDraped=void 0,this._configuration=new m}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(r,s,i,a,n){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,p=f*f,m=o.data.length/o.size;for(let h=0;h<m;h++){const r=h*o.size,s=t(y,o.data[r],o.data[r+1]);e(s,i)<p&&a(n.distance,n.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new v(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class v{constructor(t){this.layout=t,this.baseInstanceLayout=p}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s,i){if(null==i)return;const{buffer:a,offset:u}=i;n(r.get("position"),t,a.position,u);const c="featureAttribute"in a?a.featureAttribute:null;c&&o(r.get("featureAttribute"),c,u)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const y=r();export{b as HeatmapDensityMaterial,d as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as l,writeBufferVec3 as c,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectRayDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:l,hasSlicePlane:c,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${l}:${c}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s){if(null==s)return;const{buffer:n,offset:a}=s;o(r.get("position"),e,n.position,a),l(r.get("normal"),t,n.normal,a),c(r.get("centerOffset"),n.centerOffset,a),u(r.get("groundDistance"),n.groundDistance,a)}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
2
+ import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s){if(null==s)return;const{buffer:n,offset:a}=s;o(r.get("position"),e,n.position,a),c(r.get("normal"),t,n.normal,a),l(r.get("centerOffset"),n.centerOffset,a),u(r.get("groundDistance"),n.groundDistance,a)}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};