@arcgis/core 6.0.0-next.19 → 6.0.0-next.20
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.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{e4af2a1ea01df7226ace.js → 3c277a0f099d67090d07.js} +1 -1
- package/assets/esri/core/workers/chunks/{eebbde81e56d69dc602f.js → 44f90e75c1dc3d726a95.js} +1 -1
- package/assets/esri/core/workers/chunks/{94baa354e50c03b82b25.js → 597db9c90f19092d8d66.js} +1 -1
- package/assets/esri/core/workers/chunks/768389f7f8dba6080df7.js +2 -0
- package/assets/esri/core/workers/chunks/{ae0563d573baf91e01f7.js → 8e4206068c6953bb7df2.js} +1 -1
- package/assets/esri/core/workers/chunks/{bc0f54a2c15502b630ec.js → 949bee7b304e625a7891.js} +1 -1
- package/assets/esri/core/workers/chunks/{d62afb71f4ece4283994.js → 9bc3afe7013ef4ae737b.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1df76f098a3cc924832.js → b5df193c93e9c19f9700.js} +1 -1
- package/assets/esri/core/workers/chunks/d678828726371243d5eb.js +1 -0
- package/assets/esri/core/workers/chunks/{02f8654852d389583891.js → e04fb83ab2634bc15cc7.js} +1 -1
- package/assets/esri/core/workers/chunks/e35641a3a4da8cfbcf54.js +1 -0
- package/assets/esri/core/workers/chunks/{f3cd610084e3f4d8656b.js → fc76aff0f7d95e517d8f.js} +1 -1
- package/config.js +1 -1
- package/core/mapCollectionUtils.js +1 -1
- package/form/elements.d.ts +46 -8
- package/form/elements.js +1 -1
- package/geometry/support/Indices.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/package.json +3 -3
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/DragZoom.js +1 -1
- package/views/3d/input/handlers/MouseWheelFov.js +1 -1
- package/views/3d/layers/graphics/extrudePolygon.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/state/controllers/FovController.js +1 -1
- package/views/3d/state/controllers/GroundNavigationController.js +1 -1
- package/views/3d/state/controllers/momentum/GroundNavigationMomentumController.js +1 -1
- package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TextureReference.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/DOMContainer.d.ts +8 -6
- package/views/VideoView.d.ts +8 -6
- package/views/View.d.ts +4 -3
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/operations/RotateVertex.js +1 -1
- package/views/interactive/editGeometry/operations/ScaleVertex.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRanges.d.ts +3 -0
- package/widgets/ScaleRangeSlider/types.d.ts +3 -3
- package/widgets/Search/LocatorSearchSource.d.ts +22 -1
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +2 -0
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/ItemBase.d.ts +2 -0
- package/widgets/support/SelectionList/ItemBase.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/assets/esri/core/workers/chunks/792c90a67e63b98394c8.js +0 -1
- package/assets/esri/core/workers/chunks/b686cd74975da09b9c91.js +0 -2
- package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +0 -1
- /package/assets/esri/core/workers/chunks/{b686cd74975da09b9c91.js.LICENSE.txt → 768389f7f8dba6080df7.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as D}from"../effects/highlight/Highlight.js";import{OITBlend as me}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Te,PerformanceCategory as I}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Ee,ColorAttachment0 as L,ColorAttachment1 as R,ColorAttachment2 as z,DrawBufferNone as De}from"../../../webgl/enums.js";const Oe=has(`disable-feature:async-navigation-3d-depth-readback`);let B=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new Te(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(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,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new me(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),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._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.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||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=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:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}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&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...q),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,n=!1){try{return this._isRendering=!0,this._render(e,t,n)}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(J),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...H),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(I.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),Oe||c!==2&&c!==0||this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...U),t.output=0,this._plugins.precompile(...U),this._hasTransparentGeometry){let 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(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.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=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(I.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Ee.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?I.OPAQUE_EDGES:I.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(I.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?I.AMBIENT_ILLUMINATION_HIGH_QUALITY:I.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(L);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,L),n?.release(),this.performanceInfo.advance(I.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(I.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.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||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,W),this._needsDepth&&this._precompilePlugins(3,G)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...W),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(I.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...U),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...K);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let 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,...K),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...G)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...V),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...V)}_renderTransparentGeometry(){this._plugins.render(...H),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...U)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...q),this._bindParameters.output=2,this._plugins.precompile(...q),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...q)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(R);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?I.HUD_OCCLUDED:I.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),D(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(I.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...ke),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(I.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...H)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(R,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(z,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(R,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?z:R;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-L,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...V)||this.plugins.produces(5,...V)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([De,R]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(R)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_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(){this.stage.viewingMode===1&&(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(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],B.prototype,`highResolutionAtmosphere`,null),e([m()],B.prototype,`_edgeView`,void 0),e([m()],B.prototype,`updating`,null),B=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],B);const V=[0,1,2,3],H=[7,6,4,5],U=[7,6],W=[0,1,2,4,...U],G=[3,5],K=[2,4,8],q=[16,12,14,13],ke=[4,5,2,3,0,1,...U],J=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...U],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{B as Renderer};
|
|
2
|
+
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as D}from"../effects/highlight/Highlight.js";import{OITBlend as me}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Te,PerformanceCategory as I}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Ee,ColorAttachment0 as L,ColorAttachment1 as R,ColorAttachment2 as z,DrawBufferNone as De}from"../../../webgl/enums.js";const Oe=has(`disable-feature:async-navigation-3d-depth-readback`);let B=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new Te(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(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,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new me(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),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._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.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||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=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:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}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&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...q),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,n=!1){try{this._isRendering=!0,this._needsOffscreenPrepass(e.camera,t)&&this._render(e,3,n).color?.release();let r=this._render(e,t,n);return t!==0&&this._disposeOffscreenBuffers(),r}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_needsOffscreenPrepass(e,t){return(t===1||t===2)&&(this.hasGlobalIllumination||this.hasReflections)&&(!this._framebuffer.hasColor||!this._bindParameters.reprojection.lastFrameCamera.equals(e))}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(J),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...H),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(I.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),Oe||c!==2&&c!==0||this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...U),t.output=0,this._plugins.precompile(...U),this._hasTransparentGeometry){let 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(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.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=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(I.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Ee.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?I.OPAQUE_EDGES:I.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(I.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?I.AMBIENT_ILLUMINATION_HIGH_QUALITY:I.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(L);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,L),n?.release(),this.performanceInfo.advance(I.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(I.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.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||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,W),this._needsDepth&&this._precompilePlugins(3,G)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...W),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(I.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...U),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...K);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let 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,...K),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...G)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...V),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...V)}_renderTransparentGeometry(){this._plugins.render(...H),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...U)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...q),this._bindParameters.output=2,this._plugins.precompile(...q),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...q)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(R);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?I.HUD_OCCLUDED:I.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),D(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(I.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...ke),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(I.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...H)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(R,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(z,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(R,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?z:R;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-L,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...V)||this.plugins.produces(5,...V)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([De,R]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(R)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_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(){this.stage.viewingMode===1&&(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(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],B.prototype,`highResolutionAtmosphere`,null),e([m()],B.prototype,`_edgeView`,void 0),e([m()],B.prototype,`updating`,null),B=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],B);const V=[0,1,2,3],H=[7,6,4,5],U=[7,6],W=[0,1,2,4,...U],G=[3,5],K=[2,4,8],q=[16,12,14,13],ke=[4,5,2,3,0,1,...U],J=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...U],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{B as Renderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{equals as n,binaryIndexOf as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as a}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as s}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as u,subclass as d}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as f,transpose as p,invert as m}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as _,copy as v,sub as ee,dot as y}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b,clone as te}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as x}from"../../../../../core/support/UpdatingHandles.js";import{c as S}from"../../../../../chunks/vec32.js";import{TwoVectorPosition as C}from"../../core/util/TwoVectorPosition.js";import{Attribute as w}from"../Attribute.js";import{GridLocalOriginFactory as T}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as E}from"../localOriginHelper.js";import{LocalOriginManager as D}from"../LocalOriginManager.js";import{Object3D as O}from"../Object3D.js";import{VertexArrayObject as k}from"../VertexArrayObject.js";import{VertexLayout as ne,glVertexLayout as re,edgeViewTextureLayout as ie,EdgeInputBufferLayout as A,RegularEdgeInstancesGLLayout as ae,SilhouetteEdgeInstancesGLLayout as oe}from"./bufferLayouts.js";import{EdgeRenderer as j,lineWidthFractionFactor as M,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as P}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{LegacyTransform as I,isLegacyTransform as L}from"./LegacyTransform.js";import{generateStrokesTexture as R}from"./strokes.js";import{determineRendererType as z,determineEdgeTransparency as B,determineObjectTransparency as V,fillComponentBufferIndices as H}from"./util.js";import{BufferManager as U}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as W}from"../../../../webgl/VertexBuffer.js";let G=class extends t{constructor(e){super(e),this._updatingHandles=new x,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=b(),this._localOrigins=new D(new T(e.renderSR));let t=ne.createBuffer(4);for(let e=0;e<4;e++)t.sideness.set(e,0,e===0||e===3?0:1),t.sideness.set(e,1,e===0||e===1?0:1);this._vertexBuffer=new W(e.rctx,re,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new U(this.rctx,ie)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=s(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set(`schedule`,he))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,n,r,i,a,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let s,c=new q(null,new Promise(e=>s=e),e.obb.getCenter(ge),e.obb.radius);this._objectEntries.set(e,c);let l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,n,r,i,a,o));return this.setNeedsRender(),s(),l}async addOrUpdateObject3D(e,t,n,r){if(this.destroyed){i.getLogger(this).warn(`Attempt to add an object to a destroyed instance`);return}let a=new AbortController,o,{center:s,radius:l}=e.boundingVolumeWorldSpace.sphere,u=new q(a,new Promise(e=>o=e),s,l),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,u);try{let i=[];if(e.geometries.length>1&&se(e))i.push(this._addObjectMergedGeometries(e,u,t,n,r));else for(let a of e.geometries)a.material.supportsEdges&&i.push(this._addGeometry(e,u,a,t,n,r));await this._updatingHandles.addPromise(Promise.all(i)),this._removePendingDeletion(e)}catch(t){c(t)?this._discardObjectEntry(u):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){let t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){let t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){let t=this._objectEntries.get(e);if(!t)throw Error(`no object`);return await t.loaded,t.loaded==null?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;let t=this._objectEntries.get(e);if(!t)return!1;let{geometries:n}=e,{renderables:r}=t;if(n.length===0||r.length===0)return!0;if(r.length>1)return!1;let[i]=r,a=i.transform;if(!(a instanceof I))return!1;let[o]=n;if(o.localOrigin!==a.origin.origin)return!1;let s=g(),c=this._computeModelTransformWithLocalOrigin(e,o,s);return i.transform=new I(s,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(n==null)return;let r=Array.isArray(t)?e=>t[e]:()=>t;n.renderables.forEach(e=>{let{meta:t,buffer:n}=e.components,i=t.length,a=n.textureBuffer.getScalarField(`opacity`);for(let e=0;e<i;e++){let n=r(e),i=t[e],o=i.index;i.material.opacity=n,a.set(o,n)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){let t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,n,r){let i=e instanceof O,a=z(t),o=j.getKey(a,n,i),s=await this._updatingHandles.addPromise(this._getObjectEntry(e));s!=null&&(s.renderables.forEach(e=>{if(o!==e.rendererKey){let t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(a,n,i);t.removeRenderable(e),--t.refCount,e.rendererKey=o,r.addRenderable(e)}if(Array.isArray(t))for(let n=0;n<t.length;n++)e.components.meta[n].material=t[n];else e.components.meta[0].material=t;r&&Y(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n!=null&&this._updateAllVerticalOffsets(n,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{let n=e.components.meta;for(let r=0;r<n.length;r++)e.components.meta[r].verticalOffset=t?.[r]??0;Y(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n&&(n.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(this._componentColorManager==null)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);let n=e.camera.viewInverseTransposeMatrix,r=b(),i=new C,a=0,o=0;if(this._renderers.forEach(n=>{n.refCount===0?this._renderers.delete(n.key):(++this.techniques.precompiling,n.forEachRenderable(t=>{t.visible&&(a+=t.statistics.averageEdgeLength,o++,t.regular&&n.acquireTechnique(e,!1),t.silhouette&&n.acquireTechnique(e,!0))},t),--this.techniques.precompiling)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),o===0)return;let s=40*a/o,c=new P(s,t);_(r,n[3],n[7],n[11]),i.set(r),v(c.transformWorldFromViewTH,i.high),v(c.transformWorldFromViewTL,i.low),f(c.transformViewFromCameraRelativeRS,e.camera.viewMatrix),p($,c.transformViewFromCameraRelativeRS),m(c.transformNormalViewFromGlobal,$),this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{de(t,e,c),fe(t,e,c)})}_updateTransparency(e){let t=B(e.components.meta),n=V(e.components.meta);(t!==e.edgeTransparency||n!==e.objectTransparency)&&(e.edgeTransparency=t,e.objectTransparency=n,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,n){e.getCombinedShaderTransformation(t,n);let r=t.localOrigin==null?this._localOrigins.acquire(_(this._tmpModelPosition,n[12],n[13],n[14])):this._localOrigins.register(t.localOrigin);return t.localOrigin=r.origin,E(r.origin.vec3,n),r}_createComponentBuffers(e){if(this._componentColorManager==null)return null;let t=[],n=this._componentColorManager.getBuffer(e.length),r=n.acquireIndices(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[n];t.push({index:a,verticalOffset:0,material:i})}let i=new ce(n,t);return Y(i),i}_extractEdges(e,t,n,r,i,a,o=a.length){return o<128&&(i=!0),this._workerHandle.process({data:n,indices:a,indicesLength:o,writerSettings:t,skipDeduplicate:r},e,i)}_createRenderable(e,t,n,r,i){let a=t=>new le(new k(this.rctx,new Map([[`vertices`,this._vertexBuffer],[`instances`,t===0?new W(this.rctx,ae,e.regular.instancesData.buffer):new W(this.rctx,oe,e.silhouette.instancesData.buffer)]])),t===0?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?a(0):null,s=e.silhouette.lodInfo.lengths.length>0?a(1):null,c=(o?.vao.usedMemory??0)+(s?.vao.usedMemory??0);return new J(o,s,{gpuMemoryUsage:c,externalMemoryUsage:i,averageEdgeLength:e.averageEdgeLength},n,B(t.meta),V(t.meta),t,r)}async _addGeometry(e,t,n,r,i,a){if(n.edgeIndicesLength<=0)return;let o=n.positionAttribute,s=n.primitivePositionIndices,c=s===o.indices?o:new w(o.data,s,o.size,!1,o.stride),l=g(),u=this._computeModelTransformWithLocalOrigin(e,n,l),d=new Q(c,l,u);return this._addPositionData(t,d,n.edgeIndicesLength,r,i,a)}async _addPositionData(e,t,n,r,i,a=!1){if(e.loaded==null)return;let o=this._createComponentBuffers([r]);if(o==null)return;let s=this._acquireRenderer(r.type,i,!0),{modelTransform:c,origin:l}=t,u=t.position.indices,d=t.position,f=d.data.length/d.size,p=A.createBuffer(f);for(let e=0;e<f;e++)p.position.set(e,0,d.data[e*d.size]),p.position.set(e,1,d.data[e*d.size+1]),p.position.set(e,2,d.data[e*d.size+2]);H(o.meta,[0,p.componentIndex.count],p.componentIndex);let m=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,s.writerSettings,p,!1,a,u,n));if(e.loaded==null)return;let h=this._createRenderable(m,o,new I(c,l),s.key,!1);e.renderables.push(h),s.addRenderable(h),this._gpuMemoryUsage+=h.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,n,r,i,a,o,s){if(t.loaded==null)return 0;let c=this._createComponentBuffers(a);if(c==null)return 0;let l=z(a),u=this._acquireRenderer(l,o||!1,!1),d=A.createBuffer(n.length/3);S(d.position.typedBuffer,n,d.position.typedBufferStride,3),H(c.meta,i,d.componentIndex,r);let f=u.writerSettings,p=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,f,d,!0,!1,r));if(t.loaded==null)return 0;let m=this._createRenderable(p,c,e,u.key,!0);return t.renderables.push(m),u.addRenderable(m),this._updateAllVerticalOffsets(t,s),m.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,n,r,i){let a=new Map,o=0,s=0,c=null,l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);let t=e.positionAttribute;return s+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(l.length===0)return;let u=o?new(s>=65536?Uint32Array:Uint16Array)(o):null,d=[],f=0;l.forEach(e=>{let t=e.positionAttribute,n=e.primitivePositionIndices,r=a.get(t.data);if(r==null){r=d.length/3;for(let e=0;e<t.data.length;e+=t.size)d.push(t.data[e]),d.push(t.data[e+1]),d.push(t.data[e+2]);a.set(t.data,r)}for(let t=0;t<e.edgeIndicesLength;t++)u[f++]=r+n[t]});let p=c||e.geometries[0],m=g(),h=this._computeModelTransformWithLocalOrigin(e,p,m);for(let t=0;t<e.geometries.length;t++)e.geometries[t].localOrigin=h.origin;let _=new Q(new w(d,u,3),m,h);await this._updatingHandles.addPromise(this._addPositionData(t,_,u.length,n,r,i))}_acquireRenderer(e,t,n){let r=j.getKey(e,t,n),i=this._renderers.get(r);return this._strokesTexture??=R(this.rctx),i||(i=new j(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:n,spherical:this.viewingMode===1}),this._renderers.set(r,i)),++i.refCount,i}_removeRenderable(e){K(e.regular),K(e.silhouette);let t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,L(e.transform)&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(let t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){let t=e.camera.eye,n=e.camera.viewForward,r=b(),i=e=>{ee(r,e.center,t);let i=y(r,n),a=e.radius,o=i<-a?1/0:i<a?0:i-a;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(i),this._pendingDeletions.forEach(i)}get test(){}};e([u({constructOnly:!0})],G.prototype,`rctx`,void 0),e([u({constructOnly:!0})],G.prototype,`renderSR`,void 0),e([u({constructOnly:!0})],G.prototype,`viewingMode`,void 0),e([u({constructOnly:!0})],G.prototype,`techniques`,void 0),e([u({constructOnly:!0})],G.prototype,`setNeedsRender`,void 0),e([u({constructOnly:!0})],G.prototype,`schedule`,void 0),e([u({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([u({readOnly:!0})],G.prototype,`updating`,null),G=e([d(`esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView`)],G);function K(e){e?.vao&&(e.vao.buffer(`instances`)?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,r=null;for(let i of e.geometries)if(i.material.supportsEdges){if(!t)t=i.transformation;else if(!n(t,i.transformation))return!1;if(!r&&i.localOrigin!=null)r=i;else if(r?.localOrigin!=null&&i.localOrigin!=null&&r.localOrigin.id!==i.localOrigin.id)return!1}return!0}class q{constructor(e,t,n,r){this.abort=e,this.radius=r,this.renderables=[];let i=e?l(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{this.loaded!=null&&(this.loaded=!0),this.abort=null,i?.remove()}),this.center=te(n)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class J{constructor(e,t,n,r,i,a,o,s){this.regular=e,this.silhouette=t,this.statistics=n,this.transform=r,this.edgeTransparency=i,this.objectTransparency=a,this.components=o,this.rendererKey=s,this.distanceToCamera=0,this.visible=!0}}class ue extends J{}function Y(e){let{meta:t,buffer:n}=e,r=n.textureBuffer,i=r.getVec4Field(`color`),o=r.getScalarField(`lineWidth`),s=r.getScalarField(`extensionLength`),c=r.getScalarField(`materialType`),l=r.getScalarField(`opacity`),u=r.getScalarField(`elevationOffset`);for(let e=0;e<t.length;e++){let n=t[e].material,r=t[e].index,d=a(Math.round(n.size*M),0,255),f=a(n.extensionLength,-N,255-N)+N;i.setArray(r,n.color),o.set(r,d),s.set(r,f),c.set(r,n.type),l.set(r,n.opacity),u.set(r,t[e].verticalOffset)}}function de(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!X(a)||!a.visible)return;r??=e.acquireTechnique(t,!1),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.regular.lod.lengths,a.distanceToCamera,o);e.renderRegularEdges(i,a,n,t,s)},a)}function fe(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!me(a)||!a.visible)return;r??=e.acquireTechnique(t,!0),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.silhouette.lod.lengths,a.distanceToCamera,o);e.renderSilhouetteEdges(i,a,n,t,s)},a)}function X(e){return e.regular!=null}class pe extends J{}function me(e){return e.silhouette!=null}function Z(e,t,n){let i=t*n,a=r(e,i,!0);return a===-1?i<e[0]?e.length:0:e.length-a}class Q{constructor(e,t,n){this.position=e,this.modelTransform=t,this.origin=n}}const he=()=>Promise.reject(),$=h(),ge=b();export{G as EdgeView,ue as RegularRenderable,J as Renderable,pe as SilhouetteRenderable};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{binaryIndexOf as n}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as a,destroyMaybe as o}from"../../../../../core/maybe.js";import{isAbortError as s,onAbortOrThrow as c}from"../../../../../core/promiseUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as d,transpose as f,invert as p}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as g,copy as _,sub as ee,dot as v}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,clone as b}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as x}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import{c as C}from"../../../../../chunks/vec32.js";import{TwoVectorPosition as w}from"../../core/util/TwoVectorPosition.js";import{Attribute as T}from"../Attribute.js";import{GridLocalOriginFactory as E}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as D}from"../localOriginHelper.js";import{LocalOriginManager as O}from"../LocalOriginManager.js";import{Object3D as k}from"../Object3D.js";import{VertexArrayObject as te}from"../VertexArrayObject.js";import{VertexLayout as ne,glVertexLayout as re,edgeViewTextureLayout as ie,EdgeInputBufferLayout as A,RegularEdgeInstancesGLLayout as ae,SilhouetteEdgeInstancesGLLayout as oe}from"./bufferLayouts.js";import{EdgeRenderer as j,lineWidthFractionFactor as M,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as P}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{LegacyTransform as I,isLegacyTransform as L}from"./LegacyTransform.js";import{generateStrokesTexture as R}from"./strokes.js";import{determineRendererType as z,determineEdgeTransparency as B,determineObjectTransparency as V,fillComponentBufferIndices as H}from"./util.js";import{BufferManager as U}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as W}from"../../../../webgl/VertexBuffer.js";let G=class extends t{constructor(e){super(e),this._updatingHandles=new S,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=y(),this._localOrigins=new O(new E(e.renderSR));let t=ne.createBuffer(4);for(let e=0;e<4;e++)t.sideness.set(e,0,e===0||e===3?0:1),t.sideness.set(e,1,e===0||e===1?0:1);this._vertexBuffer=new W(e.rctx,re,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new U(this.rctx,ie)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=a(this._strokesTexture),this._componentColorManager=o(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set(`schedule`,he))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,n,r,i,a,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let s,c=new q(null,new Promise(e=>s=e),e.obb.getCenter(ge),e.obb.radius);this._objectEntries.set(e,c);let l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,n,r,i,a,o));return this.setNeedsRender(),s(),l}async addOrUpdateObject3D(e,t,n,i){if(this.destroyed){r.getLogger(this).warn(`Attempt to add an object to a destroyed instance`);return}let a=new AbortController,o,{center:c,radius:l}=e.boundingVolumeWorldSpace.sphere,u=new q(a,new Promise(e=>o=e),c,l),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,u);try{let r=[];if(e.geometries.length>1&&se(e))r.push(this._addObjectMergedGeometries(e,u,t,n,i));else for(let a of e.geometries)a.material.supportsEdges&&r.push(this._addGeometry(e,u,a,t,n,i));await this._updatingHandles.addPromise(Promise.all(r)),this._removePendingDeletion(e)}catch(t){s(t)?this._discardObjectEntry(u):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){let t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){let t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){let t=this._objectEntries.get(e);if(!t)throw Error(`no object`);return await t.loaded,t.loaded==null?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;let t=this._objectEntries.get(e);if(!t)return!1;let{geometries:n}=e,{renderables:r}=t;if(n.length===0||r.length===0)return!0;if(r.length>1)return!1;let[i]=r,a=i.transform;if(!(a instanceof I))return!1;let[o]=n;if(o.localOrigin!==a.origin.origin)return!1;let s=h(),c=this._computeModelTransformWithLocalOrigin(e,o,s);return i.transform=new I(s,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(n==null)return;let r=Array.isArray(t)?e=>t[e]:()=>t;n.renderables.forEach(e=>{let{meta:t,buffer:n}=e.components,i=t.length,a=n.textureBuffer.getScalarField(`opacity`);for(let e=0;e<i;e++){let n=r(e),i=t[e],o=i.index;i.material.opacity=n,a.set(o,n)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){let t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,n,r){let i=e instanceof k,a=z(t),o=j.getKey(a,n,i),s=await this._updatingHandles.addPromise(this._getObjectEntry(e));s!=null&&(s.renderables.forEach(e=>{if(o!==e.rendererKey){let t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(a,n,i);t.removeRenderable(e),--t.refCount,e.rendererKey=o,r.addRenderable(e)}if(Array.isArray(t))for(let n=0;n<t.length;n++)e.components.meta[n].material=t[n];else e.components.meta[0].material=t;r&&Y(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n!=null&&this._updateAllVerticalOffsets(n,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{let n=e.components.meta;for(let r=0;r<n.length;r++)e.components.meta[r].verticalOffset=t?.[r]??0;Y(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n&&(n.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(this._componentColorManager==null)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);let n=e.camera.viewInverseTransposeMatrix,r=y(),i=new w,a=0,o=0;if(this._renderers.forEach(n=>{n.refCount===0?this._renderers.delete(n.key):(++this.techniques.precompiling,n.forEachRenderable(t=>{t.visible&&(a+=t.statistics.averageEdgeLength,o++,t.regular&&n.acquireTechnique(e,!1),t.silhouette&&n.acquireTechnique(e,!0))},t),--this.techniques.precompiling)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),o===0)return;let s=40*a/o,c=new P(s,t);g(r,n[3],n[7],n[11]),i.set(r),_(c.transformWorldFromViewTH,i.high),_(c.transformWorldFromViewTL,i.low),d(c.transformViewFromCameraRelativeRS,e.camera.viewMatrix),f($,c.transformViewFromCameraRelativeRS),p(c.transformNormalViewFromGlobal,$),this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{de(t,e,c),fe(t,e,c)})}_updateTransparency(e){let t=B(e.components.meta),n=V(e.components.meta);(t!==e.edgeTransparency||n!==e.objectTransparency)&&(e.edgeTransparency=t,e.objectTransparency=n,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,n){e.getCombinedShaderTransformation(t,n);let r=t.localOrigin==null?this._localOrigins.acquire(g(this._tmpModelPosition,n[12],n[13],n[14])):this._localOrigins.register(t.localOrigin);return t.localOrigin=r.origin,D(r.origin.vec3,n),r}_createComponentBuffers(e){if(this._componentColorManager==null)return null;let t=[],n=this._componentColorManager.getBuffer(e.length),r=n.acquireIndices(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[n];t.push({index:a,verticalOffset:0,material:i})}let i=new ce(n,t);return Y(i),i}_extractEdges(e,t,n,r,i,a,o=a.length){return o<128&&(i=!0),this._workerHandle.process({data:n,indices:a,indicesLength:o,writerSettings:t,skipDeduplicate:r},e,i)}_createRenderable(e,t,n,r,i){let a=t=>new le(new te(this.rctx,new Map([[`vertices`,this._vertexBuffer],[`instances`,t===0?new W(this.rctx,ae,e.regular.instancesData.buffer):new W(this.rctx,oe,e.silhouette.instancesData.buffer)]])),t===0?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?a(0):null,s=e.silhouette.lodInfo.lengths.length>0?a(1):null,c=(o?.vao.usedMemory??0)+(s?.vao.usedMemory??0);return new J(o,s,{gpuMemoryUsage:c,externalMemoryUsage:i,averageEdgeLength:e.averageEdgeLength},n,B(t.meta),V(t.meta),t,r)}async _addGeometry(e,t,n,r,i,a){if(n.edgeIndicesLength<=0)return;let o=n.positionAttribute,s=n.primitivePositionIndices,c=s===o.indices?o:new T(o.data,s,o.size,!1,o.stride),l=h(),u=this._computeModelTransformWithLocalOrigin(e,n,l),d=new Q(c,l,u);return this._addPositionData(t,d,n.edgeIndicesLength,r,i,a)}async _addPositionData(e,t,n,r,i,a=!1){if(e.loaded==null)return;let o=this._createComponentBuffers([r]);if(o==null)return;let s=this._acquireRenderer(r.type,i,!0),{modelTransform:c,origin:l}=t,u=t.position.indices,d=t.position,f=d.data.length/d.size,p=A.createBuffer(f);for(let e=0;e<f;e++)p.position.set(e,0,d.data[e*d.size]),p.position.set(e,1,d.data[e*d.size+1]),p.position.set(e,2,d.data[e*d.size+2]);H(o.meta,[0,p.componentIndex.count],p.componentIndex);let m=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,s.writerSettings,p,!1,a,u,n));if(e.loaded==null)return;let h=this._createRenderable(m,o,new I(c,l),s.key,!1);e.renderables.push(h),s.addRenderable(h),this._gpuMemoryUsage+=h.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,n,r,i,a,o,s){if(t.loaded==null)return 0;let c=this._createComponentBuffers(a);if(c==null)return 0;let l=z(a),u=this._acquireRenderer(l,o||!1,!1),d=A.createBuffer(n.length/3);C(d.position.typedBuffer,n,d.position.typedBufferStride,3),H(c.meta,i,d.componentIndex,r);let f=u.writerSettings,p=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,f,d,!0,!1,r));if(t.loaded==null)return 0;let m=this._createRenderable(p,c,e,u.key,!0);return t.renderables.push(m),u.addRenderable(m),this._updateAllVerticalOffsets(t,s),m.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,n,r,i){let a=new Map,o=0,s=0,c=null,l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);let t=e.positionAttribute;return s+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(l.length===0)return;let u=o?new(s>=65536?Uint32Array:Uint16Array)(o):null,d=[],f=0;l.forEach(e=>{let t=e.positionAttribute,n=e.primitivePositionIndices,r=a.get(t.data);if(r==null){r=d.length/3;for(let e=0;e<t.data.length;e+=t.size)d.push(t.data[e]),d.push(t.data[e+1]),d.push(t.data[e+2]);a.set(t.data,r)}for(let t=0;t<e.edgeIndicesLength;t++)u[f++]=r+n[t]});let p=c||e.geometries[0],m=h(),g=this._computeModelTransformWithLocalOrigin(e,p,m);for(let t=0;t<e.geometries.length;t++)e.geometries[t].localOrigin=g.origin;let _=new Q(new T(d,u,3),m,g);await this._updatingHandles.addPromise(this._addPositionData(t,_,u.length,n,r,i))}_acquireRenderer(e,t,n){let r=j.getKey(e,t,n),i=this._renderers.get(r);return this._strokesTexture??=R(this.rctx),i||(i=new j(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:n,spherical:this.viewingMode===1}),this._renderers.set(r,i)),++i.refCount,i}_removeRenderable(e){K(e.regular),K(e.silhouette);let t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,L(e.transform)&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(let t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){let t=e.camera.eye,n=e.camera.viewForward,r=y(),i=e=>{ee(r,e.center,t);let i=v(r,n),a=e.radius,o=i<-a?1/0:i<a?0:i-a;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(i),this._pendingDeletions.forEach(i)}get test(){}};e([l({constructOnly:!0})],G.prototype,`rctx`,void 0),e([l({constructOnly:!0})],G.prototype,`renderSR`,void 0),e([l({constructOnly:!0})],G.prototype,`viewingMode`,void 0),e([l({constructOnly:!0})],G.prototype,`techniques`,void 0),e([l({constructOnly:!0})],G.prototype,`setNeedsRender`,void 0),e([l({constructOnly:!0})],G.prototype,`schedule`,void 0),e([l({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([l({readOnly:!0})],G.prototype,`updating`,null),G=e([u(`esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView`)],G);function K(e){e?.vao&&(e.vao.buffer(`instances`)?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,n=null;for(let r of e.geometries)if(r.material.supportsEdges){if(!t)t=r.transformation;else if(!x(t,r.transformation))return!1;if(!n&&r.localOrigin!=null)n=r;else if(n?.localOrigin!=null&&r.localOrigin!=null&&n.localOrigin.id!==r.localOrigin.id)return!1}return!0}class q{constructor(e,t,n,r){this.abort=e,this.radius=r,this.renderables=[];let i=e?c(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{this.loaded!=null&&(this.loaded=!0),this.abort=null,i?.remove()}),this.center=b(n)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class J{constructor(e,t,n,r,i,a,o,s){this.regular=e,this.silhouette=t,this.statistics=n,this.transform=r,this.edgeTransparency=i,this.objectTransparency=a,this.components=o,this.rendererKey=s,this.distanceToCamera=0,this.visible=!0}}class ue extends J{}function Y(e){let{meta:t,buffer:n}=e,r=n.textureBuffer,a=r.getVec4Field(`color`),o=r.getScalarField(`lineWidth`),s=r.getScalarField(`extensionLength`),c=r.getScalarField(`materialType`),l=r.getScalarField(`opacity`),u=r.getScalarField(`elevationOffset`);for(let e=0;e<t.length;e++){let n=t[e].material,r=t[e].index,d=i(Math.round(n.size*M),0,255),f=i(n.extensionLength,-N,255-N)+N;a.setArray(r,n.color),o.set(r,d),s.set(r,f),c.set(r,n.type),l.set(r,n.opacity),u.set(r,t[e].verticalOffset)}}function de(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!X(a)||!a.visible)return;r??=e.acquireTechnique(t,!1),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.regular.lod.lengths,a.distanceToCamera,o);e.renderRegularEdges(i,a,n,t,s)},a)}function fe(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!me(a)||!a.visible)return;r??=e.acquireTechnique(t,!0),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.silhouette.lod.lengths,a.distanceToCamera,o);e.renderSilhouetteEdges(i,a,n,t,s)},a)}function X(e){return e.regular!=null}class pe extends J{}function me(e){return e.silhouette!=null}function Z(e,t,r){let i=t*r,a=n(e,i,!0);return a===-1?i<e[0]?e.length:0:e.length-a}class Q{constructor(e,t,n){this.position=e,this.modelTransform=t,this.origin=n}}const he=()=>Promise.reject(),$=m(),ge=y();export{G as EdgeView,ue as RegularRenderable,J as Renderable,pe as SilhouetteRenderable};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{resampleHermite as t}from"../../../support/screenshotUtils.js";import{DataType as n}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as r}from"../../../webgl/FramebufferObject.js";import{createEmptyImageData as i}from"../../../../core/imageUtils.js";class a{constructor(e,t,n){this.parameters=e,this.fbos=t,this.isGlobalIlluminationAccumulating=n}}class o{constructor(e,t,n){this._rctx=e,this._renderFunctions=t,this._forceCameraHook=n,this.supersample=!0,this._screenshotQueue=[]}destroy(){this._rctx=null}async takeScreenshot(e){await this._renderFunctions.prepareOverlay(),this._renderFunctions.requestRenderScene(0);let t=Promise.withResolvers();return this._screenshotQueue.push({settings:e,resolver:t}),t.promise}update(e,t){for(let n of this._screenshotQueue){if(this._rctx==null){n.resolver.reject();continue}let r={...n.settings,pixelRatio:n.settings.pixelRatio*e.parameters.camera.pixelRatio},i=this._renderScreenshot(e,r,t);n.resolver.resolve(i)}this._screenshotQueue.length=0}_renderScreenshotOverlay(e,t,n){e.width=t.width,e.height=t.height;let r=e.getContext(`2d`,{willReadFrequently:!0}),i=n.pixelRatio;return r.save(),r.translate(0,t.height),r.scale(1,-1),n.region&&r.translate(-n.region.x,-n.region.y),r.scale(i,i),t=this._renderFunctions.renderOverlay(e,n.disableDecorations,t),r.restore(),t}_readbackScreenshot(e,t){return e.resample?this._readbackScreenshotResampled({...e,resample:e.resample},t):this._readbackScreenshotImmediate(e,t)}_readbackScreenshotResampled(e,r){let{framebufferWidth:a,framebufferHeight:o,region:s,resample:c}=e,l=this._ensureScreenshotEncodeCanvas(),u=i(a,o,l);this._rctx.gl.readPixels(0,0,a,o,6408,n.UNSIGNED_BYTE,new Uint8Array(u.data.buffer)),r(),u=this._renderScreenshotOverlay(l,u,{...e,region:void 0});let d=i(s.width,s.height,l);return t(u,d,!0,c.region.x,o-(c.region.y+c.region.height),c.region.width,c.region.height)}_readbackScreenshotImmediate(e,t){let{framebufferHeight:r,region:a}=e,o=this._ensureScreenshotEncodeCanvas(),s=i(a.width,a.height,o);return this._rctx.gl.readPixels(a.x,r-(a.y+a.height),a.width,a.height,6408,n.UNSIGNED_BYTE,new Uint8Array(s.data.buffer)),t(),this._renderScreenshotOverlay(o,s,e)}_renderScreenshot(t,n,i){let a=t.parameters.camera,{framebufferWidth:o,framebufferHeight:s,ignorePadding:c,pixelRatio:l,disableDecorations:u,olidColor:d}=n,f={width:o,height:s};r(f,Math.min(this._rctx.parameters.maxTextureSize,this._rctx.parameters.maxRenderbufferSize));let p
|
|
2
|
+
import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{resampleHermite as t}from"../../../support/screenshotUtils.js";import{DataType as n}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as r}from"../../../webgl/FramebufferObject.js";import{createEmptyImageData as i}from"../../../../core/imageUtils.js";class a{constructor(e,t,n){this.parameters=e,this.fbos=t,this.isGlobalIlluminationAccumulating=n}}class o{constructor(e,t,n){this._rctx=e,this._renderFunctions=t,this._forceCameraHook=n,this.supersample=!0,this._screenshotQueue=[]}destroy(){this._rctx=null}async takeScreenshot(e){await this._renderFunctions.prepareOverlay(),this._renderFunctions.requestRenderScene(0);let t=Promise.withResolvers();return this._screenshotQueue.push({settings:e,resolver:t}),t.promise}update(e,t){for(let n of this._screenshotQueue){if(this._rctx==null){n.resolver.reject();continue}let r={...n.settings,pixelRatio:n.settings.pixelRatio*e.parameters.camera.pixelRatio},i=this._renderScreenshot(e,r,t);n.resolver.resolve(i)}this._screenshotQueue.length=0}_renderScreenshotOverlay(e,t,n){e.width=t.width,e.height=t.height;let r=e.getContext(`2d`,{willReadFrequently:!0}),i=n.pixelRatio;return r.save(),r.translate(0,t.height),r.scale(1,-1),n.region&&r.translate(-n.region.x,-n.region.y),r.scale(i,i),t=this._renderFunctions.renderOverlay(e,n.disableDecorations,t),r.restore(),t}_readbackScreenshot(e,t){return e.resample?this._readbackScreenshotResampled({...e,resample:e.resample},t):this._readbackScreenshotImmediate(e,t)}_readbackScreenshotResampled(e,r){let{framebufferWidth:a,framebufferHeight:o,region:s,resample:c}=e,l=this._ensureScreenshotEncodeCanvas(),u=i(a,o,l);this._rctx.gl.readPixels(0,0,a,o,6408,n.UNSIGNED_BYTE,new Uint8Array(u.data.buffer)),r(),u=this._renderScreenshotOverlay(l,u,{...e,region:void 0});let d=i(s.width,s.height,l);return t(u,d,!0,c.region.x,o-(c.region.y+c.region.height),c.region.width,c.region.height)}_readbackScreenshotImmediate(e,t){let{framebufferHeight:r,region:a}=e,o=this._ensureScreenshotEncodeCanvas(),s=i(a.width,a.height,o);return this._rctx.gl.readPixels(a.x,r-(a.y+a.height),a.width,a.height,6408,n.UNSIGNED_BYTE,new Uint8Array(s.data.buffer)),t(),this._renderScreenshotOverlay(o,s,e)}_renderScreenshot(t,n,i){let a=t.parameters.camera,{framebufferWidth:o,framebufferHeight:s,ignorePadding:c,pixelRatio:l,disableDecorations:u,olidColor:d}=n,f={width:o,height:s};r(f,Math.min(this._rctx.parameters.maxTextureSize,this._rctx.parameters.maxRenderbufferSize));let p=f.width!==a.fullWidth||f.height!==a.fullHeight,m=c&&a.pixelRatio!==l,h=p||u||m||d||t.isGlobalIlluminationAccumulating,g=null,_=null;if(h){let t=a.clone();if(c){let n=e(t.padding);for(let e=0;e<4;e++)n[e]=Math.round(n[e]/t.pixelRatio*l);t.padding=n}t.fullWidth=f.width,t.fullHeight=f.height,t.pixelRatio=l;let n=a.fovX-t.fovX,r=a.fovY-t.fovY;n<0&&n<r?t.fovX=a.fovX:r<0&&r<n&&(t.fovY=a.fovY);let o={camera:t,contentCamera:t,mode:2,alignPixelEnabled:!0,contentPixelRatio:t.pixelRatio};this._forceCameraHook(o);let s=this._renderFunctions.renderScene(o,i,d?2:1,u);_=s.color,g=s.olid,this._renderFunctions.requestRenderScene(0)}let v=()=>{this._rctx.bindFramebuffer(null),_?.release()};this._rctx.bindFramebuffer(_?.fbo);let y=this._readbackScreenshot(n,v),b=null;if(d&&(this._rctx.bindFramebuffer(g?.fbo),b=this._readbackScreenshot(n,()=>{this._rctx.bindFramebuffer(null),g?.release()}),this._rctx.bindFramebuffer(null)),h&&!this._rctx.contextAttributes.alpha)for(let e=3;e<y.data.length;e+=4)y.data[e]=255;if(b&&!this._rctx.contextAttributes.alpha)for(let e=3;e<b.data.length;e+=4)b.data[e]=255;return h&&this._forceCameraHook(t.parameters),[y,b]}_ensureScreenshotEncodeCanvas(){return this._screenshotEncodeCanvas??=document.createElement(`canvas`),this._screenshotEncodeCanvas}}export{a as ScreenshotContext,o as ScreenshotManager};
|
package/views/DOMContainer.d.ts
CHANGED
|
@@ -20,12 +20,13 @@ export interface DOMContainerProperties extends Partial<Pick<DOMContainer, "aria
|
|
|
20
20
|
*/
|
|
21
21
|
container?: HTMLDivElement | string | null;
|
|
22
22
|
/**
|
|
23
|
-
* Enables the keyboard shortcut for showing the focus region.
|
|
24
|
-
* this only when they handle focus-region selection. When false, the shortcut does not change
|
|
25
|
-
* focus-region visibility.
|
|
23
|
+
* Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible) property.
|
|
26
24
|
*
|
|
27
25
|
* @default false
|
|
28
26
|
* @since 5.2
|
|
27
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
|
|
28
|
+
* @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible)
|
|
29
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
29
30
|
*/
|
|
30
31
|
focusRegionShortcutEnabled?: boolean;
|
|
31
32
|
/**
|
|
@@ -142,12 +143,13 @@ export abstract class DOMContainer {
|
|
|
142
143
|
*/
|
|
143
144
|
get focusRegion(): ScreenRect | null;
|
|
144
145
|
/**
|
|
145
|
-
* Enables the keyboard shortcut for showing the focus region.
|
|
146
|
-
* this only when they handle focus-region selection. When false, the shortcut does not change
|
|
147
|
-
* focus-region visibility.
|
|
146
|
+
* Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible) property.
|
|
148
147
|
*
|
|
149
148
|
* @default false
|
|
150
149
|
* @since 5.2
|
|
150
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
|
|
151
|
+
* @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible)
|
|
152
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
151
153
|
*/
|
|
152
154
|
accessor focusRegionShortcutEnabled: boolean;
|
|
153
155
|
/**
|
package/views/VideoView.d.ts
CHANGED
|
@@ -12,12 +12,13 @@ import type { NavigationProperties } from "./navigation/Navigation.js";
|
|
|
12
12
|
|
|
13
13
|
export interface VideoViewProperties extends DOMContainerProperties, Partial<Pick<VideoView, "layer" | "map" | "operationalDataVisible" | "scale">> {
|
|
14
14
|
/**
|
|
15
|
-
* Enables the keyboard shortcut for showing the focus region.
|
|
16
|
-
* this only when they handle focus-region selection. When false, the shortcut does not change
|
|
17
|
-
* focus-region visibility.
|
|
15
|
+
* Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [DOMContainer.focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [DOMContainer.focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible) property.
|
|
18
16
|
*
|
|
19
17
|
* @internal
|
|
20
18
|
* @since 5.2
|
|
19
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
|
|
20
|
+
* @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible)
|
|
21
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
21
22
|
*/
|
|
22
23
|
focusRegionShortcutEnabled?: boolean;
|
|
23
24
|
/**
|
|
@@ -96,12 +97,13 @@ export default class VideoView extends VideoViewSuperclass {
|
|
|
96
97
|
*/
|
|
97
98
|
get focusRegion(): ScreenRect | null;
|
|
98
99
|
/**
|
|
99
|
-
* Enables the keyboard shortcut for showing the focus region.
|
|
100
|
-
* this only when they handle focus-region selection. When false, the shortcut does not change
|
|
101
|
-
* focus-region visibility.
|
|
100
|
+
* Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [DOMContainer.focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [DOMContainer.focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible) property.
|
|
102
101
|
*
|
|
103
102
|
* @internal
|
|
104
103
|
* @since 5.2
|
|
104
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
|
|
105
|
+
* @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionVisible)
|
|
106
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
105
107
|
*/
|
|
106
108
|
accessor focusRegionShortcutEnabled: boolean;
|
|
107
109
|
/**
|
package/views/View.d.ts
CHANGED
|
@@ -421,12 +421,13 @@ export default abstract class View<TLayerView extends LayerView = LayerView> ext
|
|
|
421
421
|
*/
|
|
422
422
|
get focusRegion(): ScreenRect | null;
|
|
423
423
|
/**
|
|
424
|
-
* Enables the keyboard shortcut for showing the focus region.
|
|
425
|
-
* this only when they handle focus-region selection. When false, the shortcut does not change
|
|
426
|
-
* focus-region visibility.
|
|
424
|
+
* Enables the `Shift` + `Alt`/`Option` + `O` keyboard shortcut for showing the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegion). Applications should enable this only when handling custom selection of the focus region with the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event. When `false`, the shortcut does not change the [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegionVisible) property.
|
|
427
425
|
*
|
|
428
426
|
* @default false
|
|
429
427
|
* @since 5.2
|
|
428
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegion)
|
|
429
|
+
* @see [focusRegionVisible](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegionVisible)
|
|
430
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
430
431
|
*/
|
|
431
432
|
accessor focusRegionShortcutEnabled: boolean;
|
|
432
433
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{numbersEquals as e,pushIfSome as t}from"../../../core/arrayUtils.js";import{Evented as n}from"../../../core/Evented.js";import r from"../../../geometry/Multipoint.js";import i from"../../../geometry/Polygon.js";import a from"../../../geometry/Polyline.js";import{getEndpoint as o,isCoordinate as s,isBezierCurve as c,isCircularArc as l,isEllipticArc4 as u}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as d}from"../coordinateHelper.js";import{unnormalize as f}from"../../support/unnormalizationUtils.js";class p{constructor(e){this.part=e,this.leftSegment=null,this.rightSegment=null,this.type=`vertex`,this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.part.unnormalizeVertexPositions()}}class m{constructor(e,t,n){this.part=e,this.leftVertex=t,this.rightVertex=n,this.type=`line`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class h{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`bezier`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class g{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`circular-arc`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{interiorPoint:t}=this.curveDefinition;return{c:[[...e],[...t]]}}}class _{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-4`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r}=this.curveDefinition;return{a:[[...e],[...t],n,r]}}}class v{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-7`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r,rotation:i,semiMajorAxisLength:a,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...e],t,n,r,i,a,o]}}}class y{constructor(e,t,n=!1){this._spatialReference=e,this._viewingMode=t,this.autoClose=n,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||this._viewingMode===1&&f(this.vertices,this._spatialReference)}updateVertexIndex(e,t){let{vertices:n}=this;if(n.length===0)return;let r=n[0],i=null,a=e,o=t;do i=a,i.index=o++,a=i.rightSegment?i.rightSegment.rightVertex:null;while(a!=null&&a!==r);i.leftSegment&&i!==n[n.length-1]&&this.swapVertices(n.indexOf(i),n.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return this.getFirstVertex()?.leftSegment!=null}swapVertices(e,t){let{vertices:n}=this,r=n[e];n[e]=n[t],n[t]=r}*iterateVertices(){let e=this.getFirstVertex(),t=e;if(t)do yield t,t=t.rightSegment?.rightVertex;while(t!==e&&t!=null)}}class b extends n{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case`point`:this._geometry=this._toPoint();break;case`multipoint`:this._geometry=this._toMultipoint();break;case`polyline`:this._geometry=this._toPolyline();break;case`polygon`:this._geometry=this._toPolygon();break;case`mesh`:break;default:this.type}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(let e of this.parts)for(let t of e.vertices)yield t}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(let e of this.parts)yield*e.iterateVertices()}notifyChanges(e){this._dirty=!0,this.emit(`change`,e)}getPartialGeometry(e,t,n){let{parts:r,hasCurves:i}=w(this,{startingVertex:e,endingVertexInclusive:t,geometryType:n});return C(r,i,n,this.coordinateHelper)}_toPoint(){let{parts:e,coordinateHelper:t}=this;return e.at(0)?.vertices.length?t.vectorToPoint(e[0].vertices[0].pos):null}_toMultipoint(){let e=[],{coordinateHelper:t,parts:n,spatialReference:i}=this;for(let r of n){let n=r.getFirstVertex();n&&e.push(t.arrayToVector(n.pos))}return new r({hasM:t.hasM(),hasZ:t.hasZ(),spatialReference:i,points:e})}_toPolyline(){let e=[],t=!1;for(let n of this.parts){if(n.vertices.length<1)continue;let r=n.vertices[0],i=[];i.push(r.pos);let a=r.rightSegment;for(;a;)t||=a.type!==`line`,i.push(a.toCurveOrCoordinate()),a=a.rightVertex.rightSegment;e.push(i)}return new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){let t=[],n=!1;for(let r of this.parts){if(r.vertices.length<1)continue;let i=r.vertices[0],a=[];a.push(i.pos);let c=i.rightSegment;for(;c&&(n||=c.type!==`line`,a.push(c.toCurveOrCoordinate()),c=c.rightVertex.rightSegment,c?.leftVertex!==i););if(r.autoClose&&a.length>1){let t=a.at(-1),n=o(a[0]),r=o(t);a.length===2&&s(t)||e(n,r)||a.push(n)}t.push(a)}return new i({rings:n?void 0:t,curveRings:n?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t,n){let r=e.spatialReference,i=d(e.hasZ,e.hasM,r),a=new b(e.type,i);switch(e.type){case`polygon`:T(a,e,t,n?.allowCurves??!1);break;case`polyline`:E(a,e,t,n?.allowCurves??!1);break;case`point`:D(a,e,t);break;case`multipoint`:O(a,e,t);break;case`mesh`:D(a,e.origin,t),a._geometry=e,a._dirty=!1}return a}}function x(e,t,n,r){let i=new p(e);e.vertices.push(i);let a=o(r);return i.pos=t.arrayToVector(a),i.index=e.vertices.length-1,n&&e.segments.push(S(e,n,i,r)),i}function S(e,t,n,r){if(s(r))return new m(e,t,n);if(c(r)){let[,i,a]=r.b;return new h(e,t,n,{controlPoint1:[...i],controlPoint2:[...a]})}if(l(r)){let[,i]=r.c;return new g(e,t,n,{interiorPoint:[...i]})}if(u(r)){let[,i,a,o]=r.a;return new _(e,t,n,{centerPoint:[...i],sweep:a,orientation:o})}let[,i,a,o,d,f,p]=r.a;return new v(e,t,n,{centerPoint:[...i],sweep:a,orientation:o,rotation:d,semiMajorAxisLength:f,minorMajorAxisRatio:p})}function C(e,t,n,s){let{spatialReference:c}=s;if(n===`point`){let t=e.at(0)?.at(0);return t?s.arrayToPoint(o(t)):null}return n===`polygon`?new i({rings:t?void 0:e,curveRings:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()}):n===`multipoint`?new r({spatialReference:c,points:e.flatMap(e=>e.map(e=>o(e))),hasM:s.hasM(),hasZ:s.hasZ()}):new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()})}function w(n,r){let i=(r?.geometryType??n.type)===`polygon`,a=[],c=!1,l=!1,u=!1;for(let d of n.parts){let n=null;if(u)break;if(d.vertices.length<1)continue;if(r?.startingVertex){if(d!==r.startingVertex.part&&!l)continue;l=!0}let f=d===r?.startingVertex?.part?r.startingVertex:d.vertices.at(0),p=[];if(t(p,f?.pos),f===r?.endingVertexInclusive){u=!0,n=f,a.push(p);break}let m=f?.rightSegment;for(;m;){if(c||=m.type!==`line`,p.push(m.toCurveOrCoordinate()),n=m.rightVertex,m.rightVertex===r?.endingVertexInclusive){u=!0;break}if(m=m.rightVertex.rightSegment,m?.leftVertex===f)break}let h=p.at(-1),g=d.getFirstVertex(),_=d.getLastVertex();i&&d.autoClose&&h&&n===_&&f===g&&(p.length>2||p.length===2&&!s(h))&&f?.pos&&!e(o(h),f.pos)&&p.push([...f.pos]),a.push(p)}return{parts:a,hasCurves:c}}function T(t,n,r,i){let a=n.spatialReference,s=t.coordinateHelper,{rings:c,curveRings:l}=n,u=l&&i?l:c;for(let n=0;n<u.length;++n){let i=u[n],c=new y(a,r);if(c.index=n,t.parts.push(c),i.length<1)continue;let l=null,d=null;for(let e=0;e<i.length-1;++e)d=x(c,s,d,i[e]),l??=d;i.length>1&&e(o(i[i.length-1]),l?.pos)?d&&l&&c.segments.push(S(c,d,l,i[i.length-1])):d=x(c,s,d,i[i.length-1])}}function E(e,t,n,r){let i=t.spatialReference,a=e.coordinateHelper,{curvePaths:o,paths:s}=t,c=o&&r?o:s;for(let t=0;t<c.length;++t){let r=c[t],o=new y(i,n);if(o.index=t,e.parts.push(o),r.length<1)continue;let s=null;for(let e=0;e<r.length;++e)s=x(o,a,s,r[e])}}function D(e,t,n){let r=t.spatialReference,i=e.coordinateHelper,a=new y(r,n);a.index=0;let o=new p(a);o.index=0,o.pos=i.pointToVector(t),a.vertices.push(o),e.parts.push(a)}function O(e,t,n){let r=t.spatialReference,{coordinateHelper:i,parts:a}=e,o=t.points.map(e=>i.arrayToVector(e));for(let e=0;e<o.length;e++){let t=new y(r,n);t.index=e,a.push(t);let i=new p(t);i.pos=o[e],i.index=0,t.vertices.push(i)}}function k(e){return e.type===`mesh`}function A(e,t){if(e.type!==t.type||e.parts.length!==t.parts.length)return!1;for(let n=0;n<e.parts.length;n++){let r=e.parts[n],i=t.parts[n];if(r.vertices.length!==i.vertices.length)return!1}let n=e.allVertices,r=t.allVertices;for(let e=0;e<n.length;e++)if(n[e].leftSegment?.type!==r[e].leftSegment?.type)return!1;return!0}export{h as BezierSegment,g as CircularArcSegment,b as EditGeometry,_ as EllipticArc4Segment,v as EllipticArc7Segment,m as LineSegment,y as Part,p as Vertex,x as addVertexAndConnectingSegment,S as createConnectingSegment,A as haveCompatibleTopologies,k as isMeshEditGeometry,C as partialCoordsToGeometry,w as toPartialCoords};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{rotate as e,exactEquals as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{rotateEllipticArc as n}from"../../../../geometry/support/curves/rotate.js";class r{constructor(e,t,n=0){this.origin=e,this.angle=t,this._accumulationType=n}_rotate(t,n){e(t.pos,t.pos,this.origin,n),i(t.leftSegment,this.origin,n)}apply(e){this._rotate(e,this.angle)}undo(e){this._rotate(e,-this.angle)}canAccumulate(e){return e instanceof r&&t(this.origin,e.origin)}accumulate(e,t){let n=t._accumulationType===1;this._rotate(e,n?t.angle-this.angle:t.angle)}accumulateParams(e){let t=e._accumulationType===1;this.angle=t?e.angle:this.angle+e.angle}}function i(t,r,i){switch(t?.type){case null:case void 0:case`line`:return;case`bezier`:{let{controlPoint1:n,controlPoint2:a}=t.curveDefinition;e(n,n,r,i),e(a,a,r,i);return}case`circular-arc`:{let{interiorPoint:n}=t.curveDefinition;e(n,n,r,i);return}case`elliptic-arc-4`:case`elliptic-arc-7`:{let a=t.leftVertex.pos,o=e([0,0],[a[0],a[1]],r,-i),s=t.toCurveOrCoordinate(),[,c,l,u,d,f,p]=n(o,s,r,i).a;if(t.type===`elliptic-arc-4`){let e=t.curveDefinition;e.centerPoint=[...c],e.sweep=l,e.orientation=u}else{let e=t.curveDefinition;e.centerPoint=[...c],e.sweep=l,e.orientation=u,e.rotation=d,e.semiMajorAxisLength=f,e.minorMajorAxisRatio=p}}}}export{r as RotateVertex};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{projectAndScale as t,exactEquals as n,transformMat3 as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{EllipticArc7Segment as s}from"../EditGeometry.js";import{getScaleTransform as c,scaleArc as l}from"./curveOperationUtils.js";class u{constructor(e,t,n,r,a=0){this.origin=e,this.axis1=t,this.factor1=n,this.factor2=r,this._accumulationType=a,this.axis2=i(t[1],-t[0])}_scale({pos:e,leftSegment:n},r,i){let a=n?.toCurveOrCoordinate(),{origin:o,axis1:s,axis2:c}=this;t(e,e,o,s,r),t(e,e,o,c,i),d(n,o,s,c,r,i,a)}apply(e){this._scale(e,this.factor1,this.factor2)}undo(e){this._scale(e,1/this.factor1,1/this.factor2)}canAccumulate(e){return e instanceof u&&n(this.origin,e.origin)&&n(this.axis1,e.axis1)}accumulate(e,t){t._accumulationType===1?this._scale(e,t.factor1/this.factor1,t.factor2/this.factor2):this._scale(e,t.factor1,t.factor2)}accumulateParams(e){let t=e._accumulationType===1;this.factor1=t?e.factor1:this.factor1*e.factor1,this.factor2=t?e.factor2:this.factor2*e.factor2}}function d(n,i,u,d,f,p,m){switch(n?.type){case null:case void 0:case`line`:return;case`bezier`:{let{controlPoint1:e,controlPoint2:r}=n.curveDefinition;t(e,e,i,u,f),t(e,e,i,d,p),t(r,r,i,u,f),t(r,r,i,d,p);break}case`circular-arc`:case`elliptic-arc-4`:case`elliptic-arc-7`:{if(!m)return;let t=n.leftVertex.pos,h=c(i[0],i[1],u[0],u[1],d[0],d[1],f,p),g=o(e(),h),_=g?r(a(),[t[0],t[1]],g):t,[,v,y,b,x,S,C]=l(m,[_[0],_[1]],n,i,u,d,f,p).a;if(n.type===`elliptic-arc-7`){let e=n.curveDefinition;e.centerPoint=v,e.sweep=y,e.orientation=b,e.rotation=x,e.semiMajorAxisLength=S,e.minorMajorAxisRatio=C}else{let e=new s(n.part,n.leftVertex,n.rightVertex,{centerPoint:v,sweep:y,orientation:b,rotation:x,semiMajorAxisLength:S,minorMajorAxisRatio:C});n.part.segments.splice(n.part.segments.indexOf(n),1,e)}return}}}export{u as ScaleVertex};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{numbersEquals as e}from"../../../../core/arrayUtils.js";import{notDeepEqual as t}from"../../../../core/object.js";class n{constructor(e,t){this._editGeometry=e,this._newPositions=[],this._newSegments=[];for(let{pos:e,leftSegment:n}of t.allVertices)this._newPositions.push(e),this._newSegments.push(r(n))}apply(){let e=this._originalPositions==null?`apply`:`redo`;if(!this._originalPositions){let e=this._editGeometry.coordinateHelper;this._originalPositions=[],this._originalSegments=[];for(let{pos:t,leftSegment:n}of this._editGeometry.iterateVertices())this._originalPositions.push(e.clone(t)),this._originalSegments.push(r(n))}this._apply(e,this._newPositions,this._newSegments)}undo(){this._originalPositions&&this._originalSegments&&this._apply(`undo`,this._originalPositions,this._originalSegments)}accumulate(e){return e instanceof n&&(this._newPositions=e._newPositions,this._newSegments=e._newSegments,this._apply(`apply`,this._newPositions,this._newSegments),!0)}_apply(t,n,a){let o=this._editGeometry.coordinateHelper,s=this._editGeometry.allVertices,c=[];for(let t=0;t<s.length;t++){let l=s[t],u=n[t],d=a[t];e(l.pos,u)&&i(r(l.leftSegment),d)||(c.push(s[t]),o.copy(u,l.pos),l.leftSegment&&`curveDefinition`in l.leftSegment&&d&&(l.leftSegment.curveDefinition={...d}))}this._editGeometry.parts.forEach(e=>e.unnormalizeVertexPositions()),c.length&&this._editGeometry.notifyChanges({operation:t,updatedVertices:c})}}function r(e){if(e&&e.type!==`line`)return{...e.curveDefinition}}function i(e,n){return e==null&&n==null||!!e&&!!n&&!t(e,n)}export{n as SetAllVertexPositions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as n}from"../../../core/arrayUtils.js";import{destroyHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as i}from"../../../core/mapCollectionUtils.js";import{allSettledValues as a,throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as n}from"../../../core/arrayUtils.js";import{destroyHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as i}from"../../../core/mapCollectionUtils.js";import{allSettledValues as a,throwIfAborted as o,onAbort as s}from"../../../core/promiseUtils.js";import{watch as c,sync as l}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as u,getMetersPerVerticalUnitForSR as d}from"../../../core/units.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{squaredDistance as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as h,squaredDistance as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as v}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as b}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as x,isLine as S,isDrapedLine as C}from"../sketch/constraints.js";import{fromAnyMapPoint as w,asVec2 as T,markAsTarget as E}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as D}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as O}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as k}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as A}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as j}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as M}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as N}from"../support/viewUtils.js";import{screenDistance as P}from"../../../core/screenUtils.js";let F=class extends t{get updating(){return this._snappingSources.some(e=>e?.valid==null||e.valid===!0&&e.snappingSource?.updating===!0)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new y,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){let e=i(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([r(e),c(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(n)}),({rulesEnabled:e,sources:t})=>{for(let n of t)n.attributeRulesEnabled=e},l)])}destroy(){this._set(`options`,null),this._updatingHandles.destroy()}async fetchCandidates(e,t,n,r){if(!(t&this._domain)||this.options==null||!this.options.effectiveFeatureEnabled)return[];let i=[],s=this._computeScreenSizeDistanceParameters(e,n);for(let t of this._snappingSources){if(!t?.valid||!t.snappingSource?.layerSource?.enabled||t.layerView?.suspended)continue;let a=t.getFetchCandidatesParameters(e,n,s);for(let e of a)i.push(t.snappingSource.fetchCandidates(e,r).then(e=>this._processCandidatesFromSource(t,e,n)))}let c=(await a(i)).flat();return this._addRightAngleCandidates(c,e,s,n),o(r),O(e,c),c}_addRightAngleCandidates(e,t,n,r){let i=r.vertexHandle==null?r.editGeometryOperations!=null&&r.editGeometryOperations.data.type===`polygon`?r.editGeometryOperations.data.parts[0]?.getFirstVertex()?.pos:null:r.vertexHandle.rightSegment?.rightVertex?.pos,a=r.vertexHandle==null?r.editGeometryOperations==null?null:r.editGeometryOperations.data.parts[0]?.getLastVertex()?.pos:r.vertexHandle.leftSegment?.leftVertex?.pos,{view:o}=this,s=w(i,o,r),c=w(a,o,r),l=e.length;for(let r=0;r<l;r++)this._addRightAngleCandidate(e[r],c,t,n,e),this._addRightAngleCandidate(e[r],s,t,n,e)}_addRightAngleCandidate(e,t,n,r,i){if(t==null||!I(e))return;let a=e.constraint.closestTo(t),o=(a[0]-n[0])/r.x,s=(a[1]-n[1])/r.y,{start:c,end:l}=e.constraint;if(o*o+s*s<=1){let n=m(T(a),T(c))>m(T(a),T(l))?c:l,r=new M({targetPoint:E(a),otherVertex:t,otherVertexType:0,previousVertex:n,constraint:new x(t,a),objectId:e.objectId,isDraped:e.isDraped,domain:1});i.push(r)}}_computeScreenSizeDistanceParameters(e,t){let n=this.options==null?0:this.options.distance*(t.pointer===`touch`?this.options.touchSensitivityMultiplier:1);return this.view==null?{x:n,y:n,z:n,distance:n}:this.view.type===`2d`?(n*=this.view.resolution,{x:n,y:n,z:n,distance:n}):this._computeScreenSizeDistanceParameters3D(e,n,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,n,r){let{spatialReference:i}=r;n.renderCoordsHelper.toRenderCoords(e,i,z);let a=n.state.camera.computeScreenPixelSizeAt(z),o=a*n.renderCoordsHelper.unitInMeters,s=o/u(i),c=o/d(i),l=t*s,f=t*c,p=N(e,i,b,n),m=p?R(p,e,s,0,0,n,r):0,h=p?R(p,e,0,s,0,n,r):0,g=p?R(p,e,0,0,c,n,r):0;return{x:m===0?0:l/m,y:h===0?0:l/h,z:g===0?0:f/g,distance:a*t}}_processCandidatesFromSource(e,t,n){let r=[];for(let i of t)e.snappingSource&&!this._candidateIsExcluded(e.snappingSource,i,n.excludeFeature)&&(i instanceof j&&(i.layer=e.layer),r.push(i));return r}_candidateIsExcluded(e,t,n){if(n==null)return!1;let r=this._getCandidateObjectId(t);if(r==null)return!1;let i=e.layerSource.layer;return i.type===`graphics`?n.uid===r:n.sourceLayer!==i||!n.attributes||!(`objectIdField`in i)?!1:n.attributes[i.objectIdField]===r}_getCandidateObjectId(e){return e instanceof j?e.objectId:null}async _createSourceInfo(e,t){let n=e.layer;n.loaded||(await n.load(),o(t));let{view:r}=this,i=await this._createFeatureSnappingSourceType(e,t);return o(t),i==null?new D({}):new D({snappingSource:i,view:r,layer:n})}_handleSourceAbort(e,t){let n=s(t,()=>e.destroy());return n&&e.addHandles(n),e}async _createFeatureSnappingSourceType(e,t){switch(e.layer.type){case`feature`:case`geojson`:case`csv`:case`oriented-imagery`:case`subtype-group`:case`wfs`:return this._createFeatureSnappingSourceFeatureLayer(e,t);case`graphics`:case`sketch`:return this._createFeatureSnappingSourceGraphicsLayer(e,t);case`map-notes`:return this._createFeatureSnappingSourceMapNotesLayer(e,t);case`scene`:case`building-scene`:return this._createFeatureSnappingSourceSceneLayer(e,t)}return null}async _createFeatureSnappingSourceSceneLayer(e,t){let{view:n}=this;if(n==null||n.type!==`3d`)return null;let r=await this._getSourceModule(`scene`);return o(t),this._handleSourceAbort(new r.SceneLayerSnappingSource({layerSource:e,view:n}),t)}async _createFeatureSnappingSourceFeatureLayer(e,t){switch(e.layer.source?.type){case`feature-layer`:case`oriented-imagery`:{let n=await this._getSourceModule(`featureService`);return o(t),this._handleSourceAbort(new n.FeatureServiceSnappingSource({spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}case`memory`:case`csv`:case`geojson`:case`wfs`:{if(e.layer.geometryType===`mesh`)return null;let n=await this._getSourceModule(`featureCollection`);return o(t),this._handleSourceAbort(new n.FeatureCollectionSnappingSource({layerSource:e,view:this.view}),t)}}return null}async _createFeatureSnappingSourceGraphicsLayer(e,t){let n=await this._getSourceModule(`graphics`);return o(t),this._handleSourceAbort(new n.GraphicsSnappingSource({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}async _createFeatureSnappingSourceMapNotesLayer(e,t){let n=await this._getSourceModule(`notes`);return o(t),this._handleSourceAbort(new n.GraphicsSnappingSource({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}async _getSourceModule(e){let t=this._sourceModules[e];if(t.loader==null){let t=this._loadSourceModule(e),n={module:null,loader:t};this._sourceModules[e]=n;let r=await t,i={module:r,loader:t};return this._sourceModules[e]=i,r}return t.module==null?t.loader:t.module}_loadSourceModule(e){let t=this._updatingHandles;switch(e){case`featureService`:return t.addPromise(import(`./featureSources/FeatureServiceSnappingSource.js`));case`featureCollection`:return t.addPromise(import(`./featureSources/FeatureCollectionSnappingSource.js`));case`graphics`:return t.addPromise(import(`./featureSources/GraphicsSnappingSource.js`));case`notes`:return t.addPromise(import(`./featureSources/GraphicsSnappingSource.js`));case`scene`:return t.addPromise(import(`./featureSources/SceneLayerSnappingSource.js`))}}get test(){}};e([f({constructOnly:!0})],F.prototype,`spatialReference`,void 0),e([f({constructOnly:!0})],F.prototype,`view`,void 0),e([f()],F.prototype,`options`,void 0),e([f({readOnly:!0})],F.prototype,`updating`,null),e([f()],F.prototype,`_snappingSources`,void 0),F=e([p(`esri.views.interactive.snapping.FeatureSnappingEngine`)],F);function I(e){let t=e instanceof A||e instanceof k,n=S(e.constraint)||C(e.constraint);return t&&n&&!L(e.constraint)}function L({start:e,end:t}){let n=g(e,t),r=m(T(e),T(t));return n<v()||r/n<V}function R(e,t,n,r,i,a,{spatialReference:o}){let s=h(B,t);s[0]+=n,s[1]+=r,s[2]+=i;let c=N(s,o,b,a);return c?P(c,e):1/0}const z=_(),B=_(),V=1e-4;export{F as FeatureSnappingEngine};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type Accessor from "../../core/Accessor.js";
|
|
2
2
|
import type { ScaleRange } from "../../layers/types.js";
|
|
3
3
|
|
|
4
|
+
/** @deprecated since 5.2. Use the [arcgis-slider-scale-range](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/) component directly instead. */
|
|
4
5
|
export interface ScaleRangesProperties {}
|
|
5
6
|
|
|
6
7
|
/** Lists the recommended scales for each named scale range. */
|
|
@@ -56,9 +57,11 @@ export interface NamedScaleRange extends ScaleRange {
|
|
|
56
57
|
* The ScaleRanges class represents the ranges of scales for the
|
|
57
58
|
* [ScaleRangeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleRangeSlider/) widget.
|
|
58
59
|
*
|
|
60
|
+
* @deprecated since 5.2. Use the [arcgis-slider-scale-range](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/) component directly instead.
|
|
59
61
|
* @since 4.13
|
|
60
62
|
* @see [ScaleRangeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleRangeSlider/)
|
|
61
63
|
* @see [ScaleRangeSliderViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel/)
|
|
64
|
+
* @see [Scale Range Slider component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/)
|
|
62
65
|
*/
|
|
63
66
|
export default class ScaleRanges extends Accessor {
|
|
64
67
|
/** The recommended scales at each of the named scale ranges. */
|
|
@@ -77,19 +77,19 @@
|
|
|
77
77
|
* | `VI` | U.S. Virgin Islands|
|
|
78
78
|
* | `ZA` | South Africa|
|
|
79
79
|
*
|
|
80
|
-
* @deprecated since 5.2. Use the [Scale Range Slider](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/)
|
|
80
|
+
* @deprecated since 5.2. Use the [Scale Range Slider component SupportedRegion](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/spriteSheetsUtils/#SupportedRegion) instead.
|
|
81
81
|
* @since 5.0
|
|
82
82
|
*/
|
|
83
83
|
export type SupportedRegion = LowerCaseRegion | UpperCaseRegion;
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* @deprecated since 5.2. Use the [Scale Range Slider](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/)
|
|
86
|
+
* @deprecated since 5.2. Use the [Scale Range Slider component LowerCaseRegion](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/spriteSheetsUtils/#LowerCaseRegion) instead.
|
|
87
87
|
* @since 5.0
|
|
88
88
|
*/
|
|
89
89
|
export type LowerCaseRegion = "ae" | "ar" | "at" | "au" | "be" | "bg" | "bo" | "br" | "ca" | "ch" | "ci" | "cl" | "cn" | "co" | "cr" | "cz" | "de" | "dk" | "ee" | "eg" | "es" | "fi" | "fr" | "gb" | "gl" | "gr" | "gt" | "hk" | "id" | "ie" | "il" | "in" | "iq" | "is" | "it" | "jp" | "ke" | "kr" | "kw" | "li" | "lt" | "lu" | "lv" | "ma" | "mg" | "ml" | "mo" | "mx" | "my" | "ni" | "nl" | "no" | "nz" | "pe" | "pl" | "pr" | "pt" | "ro" | "ru" | "rw" | "se" | "sg" | "sk" | "sr" | "sv" | "th" | "tn" | "tw" | "us" | "ve" | "vi" | "za";
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* @deprecated since 5.2. Use the [Scale Range Slider](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/)
|
|
92
|
+
* @deprecated since 5.2. Use the [Scale Range Slider component UpperCaseRegion](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-slider-scale-range/spriteSheetsUtils/#UpperCaseRegion) instead.
|
|
93
93
|
* @since 5.0
|
|
94
94
|
*/
|
|
95
95
|
export type UpperCaseRegion = Uppercase<LowerCaseRegion>;
|