@arcgis/core 4.33.0-next.20250421 → 4.33.0-next.20250423
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/arcade/geometry/constructors.js +1 -1
- package/assets/components/assets/icon/mosaicMethodBlend16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodBlend24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodBlend32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodByAttribute32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToCenter32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodClosestToNadir32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodFirst32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLast32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodLockRaster32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMaximum32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMean32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodMinimum32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNone32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodNorthWest32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSeamline32.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum16.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum24.json +1 -0
- package/assets/components/assets/icon/mosaicMethodSum32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{b2f9f0767dadf185120c.js → 00612d6e05b1c8647668.js} +1 -1
- package/assets/esri/core/workers/chunks/{f54546c155fba2fd3a7e.js → 05d7d8ff3e4cbad32580.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 079434fe765c53d304f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{0eed612e82a279ac8d1e.js → 11b55e7e76e50fe11bbe.js} +1 -1
- package/assets/esri/core/workers/chunks/235efd948ae470a6f238.js +1 -0
- package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js → 30551c1d3e4fa7be86c1.js} +2 -2
- package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js.LICENSE.txt → 30551c1d3e4fa7be86c1.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/3293b4041c222299428f.js +1 -0
- package/assets/esri/core/workers/chunks/{78242f2bf742b33d99fa.js → 3795793643f4db64af0e.js} +1 -1
- package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js → 3cf001abca8ad933bccf.js} +2 -2
- package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js.LICENSE.txt → 3cf001abca8ad933bccf.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{a91f2d1deb950f46ad09.js → 4f8782b3b6ad414409e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js → 543eb46b55cacd6e1dbc.js} +2 -2
- package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js.LICENSE.txt → 543eb46b55cacd6e1dbc.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js → 577f24923fa4d08360e4.js} +2 -2
- package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js.LICENSE.txt → 577f24923fa4d08360e4.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{f46c4a69ef2f763e905b.js → 5d63dfa5a60c88e03b28.js} +1 -1
- package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +1 -0
- package/assets/esri/core/workers/chunks/{96cddbbeef61a4f33f29.js → 7c42281188b874ffcdad.js} +1 -1
- package/assets/esri/core/workers/chunks/82555a39a60110ca2713.js +1 -0
- package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +319 -0
- package/assets/esri/core/workers/chunks/{736a11e64e5f03e3936b.js → 9408a72968cbd985dd24.js} +53 -53
- package/assets/esri/core/workers/chunks/{c2f38c66fae2cdb57445.js → 96e5d192c8d23c1e324f.js} +1 -1
- package/assets/esri/core/workers/chunks/{796cf1c2ca9955595836.js → 9b2ab27159500315fbc1.js} +1 -1
- package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +1 -0
- package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js → ac9c6779771ec855da79.js} +2 -2
- package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js.LICENSE.txt → ac9c6779771ec855da79.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{ef6e805c49e1afdf966b.js → c054198c6438cb57f188.js} +1 -1
- package/assets/esri/core/workers/chunks/c5d786166a5609b85276.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{601fc99426f0213b0769.js → cbec01223d51cdb9ee79.js} +1 -1
- package/assets/esri/core/workers/chunks/{90c893959145827961ac.js → cd9343c78a7c3acdbbcd.js} +1 -1
- package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +1 -0
- package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js → d8dc922f7466300b668f.js} +2 -2
- package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js.LICENSE.txt → d8dc922f7466300b668f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/e524462c63834fae7e01.js +2 -0
- package/assets/esri/core/workers/chunks/{02176f84d6d57f1bc1c8.js.LICENSE.txt → e524462c63834fae7e01.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{e7e987558cf017c62458.js → ebfa4a0334401f5e004a.js} +1 -1
- package/assets/esri/core/workers/chunks/{60d3b329e69f3cddb7f4.js → fa8a3c75f9b41d31559b.js} +1 -1
- package/assets/esri/core/workers/chunks/fd36b7aaf0d8e0c84471.js +1 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Bufferer-CicaNej1.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +5 -0
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/chunks/relateOperator.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorSimplifyOGC.js +5 -0
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/simplifyOGCOperator.d.ts +6 -0
- package/geometry/operators/simplifyOGCOperator.js +5 -0
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/interfaces.d.ts +463 -55
- package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/package.json +2 -2
- package/smartMapping/renderers/size.d.ts +1 -0
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/referenceSizeUtils.js +1 -1
- package/smartMapping/renderers/support/regenerateUtils.js +1 -1
- package/smartMapping/renderers/support/rendererUtils.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/versionManagement/utils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/TileActionSynchronizer.js +5 -0
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.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/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +4 -0
- package/views/layers/LineOfSightLayerView.js +5 -0
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/formats.js +5 -0
- package/views/webgl/textureUtils.js +1 -1
- package/widgets/Print/CustomTemplate.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print/utils.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/02176f84d6d57f1bc1c8.js +0 -2
- package/assets/esri/core/workers/chunks/0a7cba60a5286ba621d4.js +0 -1
- package/assets/esri/core/workers/chunks/2cbab0c078d0b844934c.js +0 -1
- package/assets/esri/core/workers/chunks/38557792ff9516fc991b.js +0 -1
- package/assets/esri/core/workers/chunks/82353e59ac6d909dcf41.js +0 -1
- package/assets/esri/core/workers/chunks/873327fc41edd3830afa.js +0 -319
- package/assets/esri/core/workers/chunks/d28e2c9bdf514236b011.js +0 -1
- package/assets/esri/core/workers/chunks/daa54c8a317c27881763.js +0 -1
- package/assets/esri/core/workers/chunks/e15c612caadf7bac4ab9.js +0 -1
- package/views/3d/webgl/formats.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as C,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as N,InternalRenderCategory as D}from"../../webgl.js";import{debugFlags as y}from"../../support/debugFlags.js";import{ColorFormat as x,DepthRenderbuffer16f as H}from"../../webgl/formats.js";import{FBOCache as M,defaultWebGLFBO as L}from"../core/FBOCache.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as U,isColorOrColorEmission as v}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as G}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as q}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as j}from"../effects/RenderPluginManager.js";import{Blit as B}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as Q,renderHighlightBuffer as W}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as Y}from"./AnimationTimeStep.js";import{RenderRequestType as X}from"./basicInterfaces.js";import{BoundingInfo as K}from"./BoundingInfo.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as Z}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as $}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ee}from"./MainFramebuffer.js";import{RenderOccludedFlag as te}from"./Material.js";import{OITPass as re}from"./OITPass.js";import{RenderContext as ie,defaultRenderOccludedMask as se}from"./RenderContext.js";import{RendererBase as ae}from"./RendererBase.js";import{RendererTarget as ne}from"./rendererUtils.js";import{setupFeatureDefaults as he,RenderFeature as oe}from"./RenderFeature.js";import{RenderPluginInput as de}from"./RenderPluginInput.js";import{RenderSlot as _e}from"./RenderSlot.js";import{ShadowAccumulator as le}from"./ShadowAccumulator.js";import{ShadowMap as pe,SnapshotSlot as ue}from"./ShadowMap.js";import me from"./SliceHelper.js";import{Transparency as ce}from"./edgeRendering/interfaces.js";import{MergedRenderer as ge}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as fe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as be,PerformanceCategory as Ae}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Te}from"../../../support/RenderState.js";import{DepthStencilAttachment as Ee,PixelFormat as Pe,PixelType as Re,FramebufferBit as Se,ColorAttachment1 as Ie,ColorAttachment2 as Ce}from"../../../webgl/enums.js";let we=class extends ae{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new F,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=C(0,0,0,1),this._sliceHelper=new me,this._blit=null,this._oitblend=null,this._state=c(Te.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new Y,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new de,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new M(s),this._renderStateFeatures=c(he(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ee(this.fboCache),this.performanceInfo=new be(this._rctx),this._shadowMap=new pe(this.fboCache,e.viewingMode),this._shadowAccumulator=new le(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(U.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ie(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new j({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l((()=>e.view.state.camera),(()=>n()),p),l((()=>y.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ce.TRANSPARENT):()=>{},n()}),u),l((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):w;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),l((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=q),p),l((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),l((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),l((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),u)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,K.prune(),ge.prune(),O()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=he(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(oe.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(oe.WaterReflection))}get _hasHighlights(){return this._plugins.produces(U.Highlight,_e.OPAQUE_MATERIAL,_e.TRANSPARENT_MATERIAL,_e.DRAPED_MATERIAL,_e.HUD_MATERIAL,_e.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(U.Highlight,_e.HUD_MATERIAL,_e.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(oe.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(oe.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(oe.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ge(this.stage.view.resourceController)});return this.addHandles(l((()=>r.updating),(()=>this._requestRender()),m)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&A(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slicePlane(e){this._sliceHelper.plane!==e&&(this._sliceHelper.plane=e,this._requestRender())}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(U.Color,...Me),has.water=this._plugins.produces(U.Normal,_e.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ne.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new fe(this._pluginInput.get(N.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=$,l=this.stage.view,p=l.stateManager.camera,u=l.qualitySettings.fadeDuration,m=e===Te.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(_-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/u,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=ne.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===ne.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),_=this._nodes.produces(N.FINAL),l=this._nodes.require("emissive",D.TRANSPARENT_ENVIRONMENT,N.COMPOSITE,N.FINAL)>0&&this._plugins.hasEmissions,p=l?U.ColorEmission:U.Color;this._renderContext.time=t,this._renderContext.output=p,this._bindParameters.oitPass=re.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.slicePlane=this._sliceHelper.plane,this._bindParameters.viewshedEnabled=this._nodes.produces(D.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(U.Color,...xe);this._precompilePrepasses(),this.performanceInfo.advance(Ae.PREPARE);const f=this._computeDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,p),this._renderContext.output=p,u.bind(),this._bindParameters.mainDepth=u.depth.attachment;const b=this.plugins.produces(U.Color,...ye);b&&this._renderOpaqueGeometry(),u.update((e=>this._renderNodes(N.OPAQUE,e,b))),this.fboCache.debugCallback?.(N.OPAQUE,u.color.fbo),u.update((e=>this._renderNodes(D.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(D.OPAQUE_ENVIRONMENT,u.color.fbo),this._renderTerrainDepth(c),this._renderEdges(ce.OPAQUE),u.bind(),this._renderPlugins(_e.VOXEL,Ae.VOXEL),this._renderHiddenTransparentEdges(),g&&(this._oitEnabled?this._renderOIT(Oe.Geometry,p):this._renderTransparentGeometry()),u.update((e=>this._renderNodes(N.TRANSPARENT,e,g))),this.fboCache.debugCallback?.(N.TRANSPARENT,u.color.fbo),this._renderGeometryDepth(c),this._renderHUDVisibility(),c||this._plugins.render(this._pluginInput,_e.LINE_CALLOUTS),this._renderEdges(ce.TRANSPARENT);const A=this._hasTransparentTerrain?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(Ae.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(G.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,A.getTexture())),this._renderHUD(G.Occluded,u.color,p))),this._bindParameters.cullAboveTerrain=!1,A&&(u.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,A.getTexture()),A.release(),c&&(this._renderEdges(ce.OPAQUE),g&&(this._oitEnabled?this._renderOIT(Oe.Geometry,p):this._renderTransparentGeometry(),this.performanceInfo.advance(Ae.TRANSPARENT)),this._renderEdges(ce.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),c&&this._renderLineCallouts(G.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment(),this._pluginInput.set(D.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(D.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(D.VIEWSHED,e))),u.update((e=>this._renderNodes(D.LASERLINES,e))),u.update((e=>this._renderNodes(D.FOCUSAREA_COLOR,e))),u.update((e=>this._renderNodes(D.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const T=r===ne.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(N.COMPOSITE,e))),this._pluginInput.release(D.FOCUSAREA);const E=!(r!==ne.Default||_||o&&!i),P=this._pluginInput.get(N.COMPOSITE),R=E?L:this.fboCache.acquire(P.fbo.width,P.fbo.height,D.ANTIALIASING),S=this._nodes.produces(D.ANTIALIASING)?this._renderNodes(D.ANTIALIASING,R):this._blitFBO(P,R,!1);let I;this._pluginInput.set(D.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(G.NotOccluded,S,p),I=this._renderNodes(D.HIGHLIGHTS,S)):(I=this._renderNodes(D.HIGHLIGHTS,S),this._renderHUD(G.NotOccluded,I,p));const C=this._renderNodes(D.MAGNIFIER,I);return o&&!i&&r===ne.Default&&!_&&this._blitFBO(C),_?(C.attachDepth(u.depth),this._blitFBO(this._renderNodes(N.FINAL,C)),C.detachDepth()):this._pluginInput.set(N.FINAL,C),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ne.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new fe(this._pluginInput.get(N.FINAL),T)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(D.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=U.Depth,this._plugins.precompile(_e.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(_e.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(D.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(_e.OCCLUSION_PIXELS),this._plugins.precompile(_e.LINE_CALLOUTS),this._precompileHUD(G.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(D.VIEWSHED,D.LASERLINES,D.FOCUSAREA_COLOR,D.OCCLUDED,D.ANTIALIASING,D.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(G.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(U.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(N.COMPOSITE,D.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(_e.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){if(!this._nodes.produces(D.FOCUSAREA))return null;const{width:e,height:t}=this._framebufferSize;let r=this.fboCache.acquire(e,t,D.FOCUSAREA);return r=this._nodes.render(r,this._pluginInput),this.performanceInfo.advance(Ae.FOCUS_AREA_MASK),r}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(Ee),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Ae.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===X.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Pe.RGBA,Re.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Pe.RGBA,Re.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===ce.OPAQUE?Ae.OPAQUE_EDGES:Ae.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(Ae.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(oe.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(U.ShadowHighlight,this._shadowMap),i.moveSnapshot(ue.Highlight),this._renderShadowCascades(U.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(ue.ExcludeHighlight),this._renderShadowCascades(U.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(U.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(Ae.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(U.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");if(e){const t=this._needsDepth?e.getAttachment(Ee):null;t?.retain(),this._pluginInput.set(D.SSAO,this._renderSSAO()),this._renderGeometryWithoutNormalsDepth(t)}else this._renderAllGeometryDepth()}_renderGeometryWithoutNormalsDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=d(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth");r.attachDepth(e),e.release(),this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(Se.STENCIL),this._renderGeometryWithoutNormals(U.Depth),d(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(Ae.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth").acquireDepth(Ee);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(Se.DEPTH|Se.STENCIL),this.renderAllGeometry(U.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Ae.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=U.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(Ee);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(Se.DEPTH|Se.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth").acquireDepth(Ee);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(Se.DEPTH|Se.STENCIL),this._renderOpaqueAndTransparentGeometry(U.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeDepthRange(e){if(!this._needsDepthRange)return J.zero;const t=Z(e,this._plugins.plugins,this.stage.layers);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}get _normalsRequired(){const e=this._nodes.require("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,D.VIEWSHED,D.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(U.Normal),this._needsDepth&&this._precompileAllGeometry(U.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(U.ShadowHighlight),this._precompileShadowCascades(U.ShadowExcludeHighlight),this._precompileShadowCascades(U.ShadowHighlight)):this._precompileShadowCascades(U.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(U.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",x.RGBA8);r.acquireDepth(Ee),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._renderGeometryWithNormals(U.Normal);const i=this._nodes.optional("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,D.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Ae.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();L.setName(D.SSAO);const t=this._nodes.render(L,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(Ae.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(_e.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...He);this._renderContext.renderOccludedMask=se}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>te.Occlude&&this._plugins.render(this._pluginInput,_e.OCCLUDED_TERRAIN),this.renderSlots(e,...He),this._renderContext.renderOccludedMask=se}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,_e.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(U.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(U.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Ne),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...De)}_precompileOpaqueGeometry(){this._plugins.precompile(...ye)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...ye)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...xe)}get _hasTransparentTerrain(){return this._plugins.produces(U.Color,_e.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,_e.TRANSPARENT_TERRAIN);if(!v(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,w),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,_e.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",x.RGBA4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,_e.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Ae.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===G.Occluded){const e=()=>this._plugins.render(this._pluginInput,_e.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(H,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,_e.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=U.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&v(this._renderContext.output)?(this._bindParameters.oitPass=re.ColorAlpha,this._plugins.precompile(...Me),this._bindParameters.oitPass=re.FrontFace,this._plugins.precompile(...Me),this._bindParameters.oitPass=re.NONE):this._plugins.precompile(...Me),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(Oe.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===G.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(H,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(H),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===G.Occluded?Ae.HUD_OCCLUDED:Ae.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...Me)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(U.ShadowHighlight,_e.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>Q?x.RG8UI:x.R8UI);a.acquireDepth(Ee),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=U.Highlight,t.bindFramebuffer(a.fbo),W(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Ae.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Le),this._rctx.clear(Se.DEPTH),this._renderHUDElements(G.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(Ae.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&v(this._renderContext.output)?(this._bindParameters.oitPass=re.ColorAlpha,this._plugins.precompile(...xe),this._bindParameters.oitPass=re.FrontFace,this._plugins.precompile(...xe),this._bindParameters.oitPass=re.NONE):this._plugins.precompile(...xe)}_renderOIT(e,t,r=G.Both){const i=e===Oe.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=re.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",_=t===U.ColorEmission,l=this.fboCache.acquire(s.width,s.height,d,_?x.RGBA16F:x.RGBA16F_NEAREST);_&&l.acquireColor(Ie,x.RGBA16F,"emissive"),l.acquireColor(_?Ce:Ie,x.R16F),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,I),n(),l.detachDepth(),h.oitPass=re.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&p.acquireColor(Ie,x.RGBA16F,"emissive"),a?p.acquireDepth(H):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(w,!!a),n(),p.detachDepth(),h.oitPass=re.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Se.COLOR)):this._framebuffer.bind(),this._oitblend??=new k(this._techniques),this._oitblend.blend(this._rctx,l,p,h,_),a?.detachDepth(),p.release(),l.release(),this._renderContext.output=o,a}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Ae.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,_e.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Ae.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=L,r=!0){return this._blit??=new B(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(T(Ue,this._bindParameters.camera.viewMatrix),T(Fe,this._bindParameters.camera.projectionMatrix),E(ve,Ue,Fe),E(ve,this._renderContext.lastFrameCamera.viewMatrix,ve),E(ve,this._renderContext.lastFrameCamera.projectionMatrix,ve),this._reprojectionMatrix=ve);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(X.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var Oe;e([f({readOnly:!0})],we.prototype,"fullResolutionAtmosphere",null),e([f()],we.prototype,"_edgeView",void 0),e([f()],we.prototype,"updating",null),we=e([b("esri.views.3d.webgl-engine.lib.Renderer")],we),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Oe||(Oe={}));const Ne=[_e.INTEGRATED_MESH,_e.OPAQUE_TERRAIN,_e.OPAQUE_MATERIAL,_e.TRANSPARENT_MATERIAL],De=[_e.OPAQUE_MATERIAL_WITHOUT_NORMALS,_e.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],ye=[_e.INTEGRATED_MESH,_e.OPAQUE_TERRAIN,_e.OPAQUE_MATERIAL,_e.OPAQUE_MATERIAL_WITHOUT_NORMALS],xe=[_e.TRANSPARENT_MATERIAL,_e.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],He=[_e.OPAQUE_MATERIAL,_e.TRANSPARENT_MATERIAL,_e.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],Me=[_e.LINE_CALLOUTS_HUD_DEPTH,_e.HUD_MATERIAL,_e.LABEL_MATERIAL],Le=[_e.TRANSPARENT_MATERIAL,_e.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,_e.OPAQUE_MATERIAL,_e.OPAQUE_MATERIAL_WITHOUT_NORMALS,_e.TRANSPARENT_TERRAIN,_e.INTEGRATED_MESH,_e.OPAQUE_TERRAIN],Fe=R(),Ue=R(),ve=R();function Ge(e){return t=>e.immediate.schedule(t)}export{we as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as T,invert as E,multiply as A}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as R,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as C,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as N}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as O}from"../../webgl.js";import{debugFlags as y}from"../../support/debugFlags.js";import{FBOCache as x,defaultWebGLFBO as H}from"../core/FBOCache.js";import{RenderPassManager as L}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as M,isColorOrColorEmission as F}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as U}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as G}from"../effects/RenderNodes.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as Q}from"../effects/transparency/OITBlend.js";import{AnimationTimer as W}from"./AnimationTimer.js";import{AnimationTimeStep as k}from"./AnimationTimeStep.js";import{RenderRequestType as z}from"./basicInterfaces.js";import{BoundingInfo as X}from"./BoundingInfo.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as K}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as J}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as Z}from"./MainFramebuffer.js";import{RenderOccludedFlag as $}from"./Material.js";import{OITPass as ee}from"./OITPass.js";import{RenderContext as te,defaultRenderOccludedMask as re}from"./RenderContext.js";import{RendererBase as ie}from"./RendererBase.js";import{RendererTarget as se}from"./rendererUtils.js";import{setupFeatureDefaults as ae,RenderFeature as ne}from"./RenderFeature.js";import{RenderPluginInput as he}from"./RenderPluginInput.js";import{RenderSlot as oe}from"./RenderSlot.js";import{ShadowAccumulator as de}from"./ShadowAccumulator.js";import{ShadowMap as _e,SnapshotSlot as le}from"./ShadowMap.js";import pe from"./SliceHelper.js";import{Transparency as ue}from"./edgeRendering/interfaces.js";import{MergedRenderer as me}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ce}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ge,PerformanceCategory as fe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as be}from"../../../support/RenderState.js";import{PixelFormat as Te,PixelType as Ee,DepthStencilAttachment as Ae,FramebufferBit as Re,ColorAttachment1 as Pe,ColorAttachment2 as Se}from"../../../webgl/enums.js";import{DepthFormat as Ie,ColorFormat as Ce}from"../../../webgl/formats.js";let we=class extends ie{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new L,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=C(0,0,0,1),this._sliceHelper=new pe,this._blit=null,this._oitblend=null,this._state=c(be.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new k,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new he,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new x(s),this._renderStateFeatures=c(ae(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new Z(this.fboCache),this.performanceInfo=new ge(this._rctx),this._shadowMap=new _e(this.fboCache,e.viewingMode),this._shadowAccumulator=new de(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(M.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new te(this._rctx,this._shadowMap,r),this._nodes=new G(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l((()=>e.view.state.camera),(()=>n()),p),l((()=>y.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ue.TRANSPARENT):()=>{},n()}),u),l((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):w;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),l((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=v),p),l((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),l((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),l((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),u)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,X.prune(),me.prune(),N()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=ae(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(ne.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(ne.WaterReflection))}get _hasHighlights(){return this._plugins.produces(M.Highlight,oe.OPAQUE_MATERIAL,oe.TRANSPARENT_MATERIAL,oe.DRAPED_MATERIAL,oe.HUD_MATERIAL,oe.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(M.Highlight,oe.HUD_MATERIAL,oe.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(ne.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(ne.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(ne.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ge(this.stage.view.resourceController)});return this.addHandles(l((()=>r.updating),(()=>this._requestRender()),m)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&T(this._bindParameters.ssr.reprojectionMatrix,R)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slicePlane(e){this._sliceHelper.plane!==e&&(this._sliceHelper.plane=e,this._requestRender())}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(M.Color,...Le),has.water=this._plugins.produces(M.Normal,oe.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=se.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new ce(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=J,l=this.stage.view,p=l.stateManager.camera,u=l.qualitySettings.fadeDuration,m=e===be.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(_-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const T=t-this._lastFrameTime;this._lastFrameTime=t;const E=Math.max(1-r,Math.abs(r-i)),A=Math.min(E*T/u,n);A>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*A,this._requestRender())}_render(e,t,r=se.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===se.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),_=this._nodes.produces(D.FINAL),l=this._nodes.require("emissive",O.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,p=l?M.ColorEmission:M.Color;this._renderContext.time=t,this._renderContext.output=p,this._bindParameters.oitPass=ee.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.slicePlane=this._sliceHelper.plane,this._bindParameters.viewshedEnabled=this._nodes.produces(O.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(M.Color,...xe);this._precompilePrepasses(),this.performanceInfo.advance(fe.PREPARE);const f=this._computeDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,p),this._renderContext.output=p,u.bind(),this._bindParameters.mainDepth=u.depth.attachment;const b=this.plugins.produces(M.Color,...ye);b&&this._renderOpaqueGeometry(),u.update((e=>this._renderNodes(D.OPAQUE,e,b))),this.fboCache.debugCallback?.(D.OPAQUE,u.color.fbo),u.update((e=>this._renderNodes(O.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(O.OPAQUE_ENVIRONMENT,u.color.fbo),this._renderTerrainDepth(c),this._renderEdges(ue.OPAQUE),u.bind(),this._renderPlugins(oe.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),g&&(this._oitEnabled?this._renderOIT(Ne.Geometry,p):this._renderTransparentGeometry()),u.update((e=>this._renderNodes(D.TRANSPARENT,e,g))),this.fboCache.debugCallback?.(D.TRANSPARENT,u.color.fbo),this._renderGeometryDepth(c),this._renderHUDVisibility(),c||this._plugins.render(this._pluginInput,oe.LINE_CALLOUTS),this._renderEdges(ue.TRANSPARENT);const T=this._hasTransparentTerrain?this._renderTransparentTerrain():null;T&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(U.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,T.getTexture())),this._renderHUD(U.Occluded,u.color,p))),this._bindParameters.cullAboveTerrain=!1,T&&(u.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,T.getTexture()),T.release(),c&&(this._renderEdges(ue.OPAQUE),g&&(this._oitEnabled?this._renderOIT(Ne.Geometry,p):this._renderTransparentGeometry(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(ue.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),c&&this._renderLineCallouts(U.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment(),this._pluginInput.set(O.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(O.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(O.VIEWSHED,e))),u.update((e=>this._renderNodes(O.LASERLINES,e))),u.update((e=>this._renderNodes(O.FOCUSAREA_COLOR,e))),u.update((e=>this._renderNodes(O.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const E=r===se.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(D.COMPOSITE,e))),this._pluginInput.release(O.FOCUSAREA);const A=!(r!==se.Default||_||o&&!i),R=this._pluginInput.get(D.COMPOSITE),P=A?H:this.fboCache.acquire(R.fbo.width,R.fbo.height,O.ANTIALIASING),S=this._nodes.produces(O.ANTIALIASING)?this._renderNodes(O.ANTIALIASING,P):this._blitFBO(R,P,!1);let I;this._pluginInput.set(O.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(U.NotOccluded,S,p),I=this._renderNodes(O.HIGHLIGHTS,S)):(I=this._renderNodes(O.HIGHLIGHTS,S),this._renderHUD(U.NotOccluded,I,p));const C=this._renderNodes(O.MAGNIFIER,I);return o&&!i&&r===se.Default&&!_&&this._blitFBO(C),_?(C.attachDepth(u.depth),this._blitFBO(this._renderNodes(D.FINAL,C)),C.detachDepth()):this._pluginInput.set(D.FINAL,C),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==se.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new ce(this._pluginInput.get(D.FINAL),E)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(O.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=M.Depth,this._plugins.precompile(oe.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(oe.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(O.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(oe.OCCLUSION_PIXELS),this._plugins.precompile(oe.LINE_CALLOUTS),this._precompileHUD(U.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(O.VIEWSHED,O.LASERLINES,O.FOCUSAREA_COLOR,O.OCCLUDED,O.ANTIALIASING,O.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(U.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(M.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,O.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(oe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){if(!this._nodes.produces(O.FOCUSAREA))return null;const{width:e,height:t}=this._framebufferSize;let r=this.fboCache.acquire(e,t,O.FOCUSAREA);return r=this._nodes.render(r,this._pluginInput),this.performanceInfo.advance(fe.FOCUS_AREA_MASK),r}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(Ie.DEPTH24_STENCIL8_TEXTURE),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(fe.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===z.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Te.RGBA,Ee.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Te.RGBA,Ee.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===ue.OPAQUE?fe.OPAQUE_EDGES:fe.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(ne.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(M.ShadowHighlight,this._shadowMap),i.moveSnapshot(le.Highlight),this._renderShadowCascades(M.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(le.ExcludeHighlight),this._renderShadowCascades(M.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(M.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(fe.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(M.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");if(e){const t=this._needsDepth?e.getAttachment(Ae):null;t?.retain(),this._pluginInput.set(O.SSAO,this._renderSSAO()),this._renderGeometryWithoutNormalsDepth(t)}else this._renderAllGeometryDepth()}_renderGeometryWithoutNormalsDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=d(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth");r.attachDepth(e),e.release(),this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(Re.STENCIL),this._renderGeometryWithoutNormals(M.Depth),d(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",Ie.DEPTH24_STENCIL8_TEXTURE);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this.renderAllGeometry(M.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(fe.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=M.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",Ie.DEPTH24_STENCIL8_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",Ie.DEPTH24_STENCIL8_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(Re.DEPTH|Re.STENCIL),this._renderOpaqueAndTransparentGeometry(M.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeDepthRange(e){if(!this._needsDepthRange)return Y.zero;const t=K(e,this._plugins.plugins,this.stage.layers);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,O.VIEWSHED,O.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(M.Normal),this._needsDepth&&this._precompileAllGeometry(M.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(M.ShadowHighlight),this._precompileShadowCascades(M.ShadowExcludeHighlight),this._precompileShadowCascades(M.ShadowHighlight)):this._precompileShadowCascades(M.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(M.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",Ce.RGBA8);r.acquireDepth(Ie.DEPTH24_STENCIL8_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._renderGeometryWithNormals(M.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,O.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(fe.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();H.setName(O.SSAO);const t=this._nodes.render(H,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(oe.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...He);this._renderContext.renderOccludedMask=re}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>$.Occlude&&this._plugins.render(this._pluginInput,oe.OCCLUDED_TERRAIN),this.renderSlots(e,...He),this._renderContext.renderOccludedMask=re}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,oe.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(M.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(M.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...De),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Oe)}_precompileOpaqueGeometry(){this._plugins.precompile(...ye)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...ye)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...xe)}get _hasTransparentTerrain(){return this._plugins.produces(M.Color,oe.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,oe.TRANSPARENT_TERRAIN);if(!F(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,w),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,oe.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",Ce.RGBA4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,oe.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(fe.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===U.Occluded){const e=()=>this._plugins.render(this._pluginInput,oe.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(Ie.DEPTH16_RENDERBUFFER,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,oe.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=M.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&F(this._renderContext.output)?(this._bindParameters.oitPass=ee.ColorAlpha,this._plugins.precompile(...Le),this._bindParameters.oitPass=ee.FrontFace,this._plugins.precompile(...Le),this._bindParameters.oitPass=ee.NONE):this._plugins.precompile(...Le),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(Ne.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===U.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(Ie.DEPTH16_RENDERBUFFER,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(Ie.DEPTH16_RENDERBUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===U.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...Le)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(M.ShadowHighlight,oe.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>j?Ce.RG8UI:Ce.R8UI);a.acquireDepth(Ie.DEPTH24_STENCIL8_TEXTURE),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=M.Highlight,t.bindFramebuffer(a.fbo),B(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(fe.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Me),this._rctx.clear(Re.DEPTH),this._renderHUDElements(U.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(fe.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&F(this._renderContext.output)?(this._bindParameters.oitPass=ee.ColorAlpha,this._plugins.precompile(...xe),this._bindParameters.oitPass=ee.FrontFace,this._plugins.precompile(...xe),this._bindParameters.oitPass=ee.NONE):this._plugins.precompile(...xe)}_renderOIT(e,t,r=U.Both){const i=e===Ne.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ee.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",_=t===M.ColorEmission,l=this.fboCache.acquire(s.width,s.height,d,_?Ce.RGBA16F:Ce.RGBA16F_NEAREST);_&&l.acquireColor(Pe,Ce.RGBA16F,"emissive"),l.acquireColor(_?Se:Pe,Ce.R16F),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,I),n(),l.detachDepth(),h.oitPass=ee.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&p.acquireColor(Pe,Ce.RGBA16F,"emissive"),a?p.acquireDepth(Ie.DEPTH16_RENDERBUFFER):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(w,!!a),n(),p.detachDepth(),h.oitPass=ee.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Re.COLOR)):this._framebuffer.bind(),this._oitblend??=new Q(this._techniques),this._oitblend.blend(this._rctx,l,p,h,_),a?.detachDepth(),p.release(),l.release(),this._renderContext.output=o,a}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(fe.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,oe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(fe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=H,r=!0){return this._blit??=new V(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=R:(E(Ue,this._bindParameters.camera.viewMatrix),E(Fe,this._bindParameters.camera.projectionMatrix),A(ve,Ue,Fe),A(ve,this._renderContext.lastFrameCamera.viewMatrix,ve),A(ve,this._renderContext.lastFrameCamera.projectionMatrix,ve),this._reprojectionMatrix=ve);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=R,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(z.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var Ne;e([f({readOnly:!0})],we.prototype,"fullResolutionAtmosphere",null),e([f()],we.prototype,"_edgeView",void 0),e([f()],we.prototype,"updating",null),we=e([b("esri.views.3d.webgl-engine.lib.Renderer")],we),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ne||(Ne={}));const De=[oe.INTEGRATED_MESH,oe.OPAQUE_TERRAIN,oe.OPAQUE_MATERIAL,oe.TRANSPARENT_MATERIAL],Oe=[oe.OPAQUE_MATERIAL_WITHOUT_NORMALS,oe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],ye=[oe.INTEGRATED_MESH,oe.OPAQUE_TERRAIN,oe.OPAQUE_MATERIAL,oe.OPAQUE_MATERIAL_WITHOUT_NORMALS],xe=[oe.TRANSPARENT_MATERIAL,oe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],He=[oe.OPAQUE_MATERIAL,oe.TRANSPARENT_MATERIAL,oe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],Le=[oe.LINE_CALLOUTS_HUD_DEPTH,oe.HUD_MATERIAL,oe.LABEL_MATERIAL],Me=[oe.TRANSPARENT_MATERIAL,oe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,oe.OPAQUE_MATERIAL,oe.OPAQUE_MATERIAL_WITHOUT_NORMALS,oe.TRANSPARENT_TERRAIN,oe.INTEGRATED_MESH,oe.OPAQUE_TERRAIN],Fe=P(),Ue=P(),ve=P();function Ge(e){return t=>e.immediate.schedule(t)}export{we as Renderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as C,c as j,v as T,t as y,i as
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as C,c as j,v as T,t as y,i as D}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as v,t as S}from"../../../../chunks/vec42.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as E}from"../../../ViewingMode.js";import{CascadeCamera as O}from"./CascadeCamera.js";import{applyTextureResizeModulo as U}from"./textureUtils.js";import{assert as F,logWithBase as L,verify as Q,rayRay2D as V}from"./Util.js";import{TextureType as N,FramebufferBit as A}from"../../../webgl/enums.js";import{ColorFormat as B,DepthFormat as I}from"../../../webgl/formats.js";import{Texture as W}from"../../../webgl/Texture.js";var z;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(z||(z={}));class P{constructor(){this.camera=new O,this.lightMat=l()}}class q{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class G{constructor(t,s){this._fbos=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new q,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=R(),this._cascades=[new P,new P,new P,new P],this._lastOrigin=null,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture()}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return v(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)et[t]=this._cascades[t];return et.length=this._numCascades,et}start(t,s,e,i,a){F(this.enabled);const{near:r,far:h}=jt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){F(this.enabled),this._handle?.detachDepth()}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(it,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)at[16*s+t]=it[t]}}return at}moveSnapshot(t){F(this.enabled),this._handle?.detachDepth(),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){const s=this._handle?.getTexture()?.descriptor;if(!this.enabled||!s)return;this._snapshots[t]?.release();const{width:e,height:i}=s,a=t===z.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot";this._snapshots[t]=this._fbos.acquire(e,i,a,B.RGBA4);const r=this._fbos.rctx;this._bindFbo();const h=r.bindTexture(this._snapshots[t]?.getTexture(),W.TEXTURE_UNIT_FOR_UPDATES);r.gl.copyTexSubImage2D(N.TEXTURE_2D,0,0,0,0,0,e,i),r.bindTexture(h,W.TEXTURE_UNIT_FOR_UPDATES)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture():null}clear(){const t=this._fbos.rctx;this._ensureFbo(),this._bindFbo(),t.setClearColor(1,1,1,1),t.clear(A.COLOR|A.DEPTH)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return U(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(this._textureWidth,this._textureHeight,"shadow map",B.RGBA4)),this._handle?.acquireDepth(I.DEPTH16_RENDERBUFFER)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);F(c<l);for(let r=0;r<8;++r){v(k,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=J[r];S(t,k,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}T(st,J[0]),a.camera.viewMatrix=r(X,this._modelViewLight,st);for(let r=0;r<8;++r)y(J[r],J[r],a.camera.viewMatrix);let d=J[0][2],m=J[0][2];for(let r=1;r<8;++r)d=Math.min(d,J[r][2]),m=Math.max(m,J[r][2]);d-=200,m+=200,a.camera.near=-m,a.camera.far=-d,Ct(e,i,d,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===E.Global?t.eye:D(st,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(L(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const X=l(),k=R(),J=[];for(let Tt=0;Tt<8;++Tt)J.push(R());const K=M(),Y=M(),Z=M(),$=M(),tt=M(),st=H(),et=[],it=l(),at=c.concat(c,c,c,c),rt=M(),ht=M(),ot=[M(),M(),M(),M()],nt=M(),ct=M(),lt=M(),dt=M(),mt=M(),ut=M(),_t=M();function ft(t,s,e,i,a,r,h,o){d(rt,0,0);for(let d=0;d<4;++d)m(rt,rt,t[d]);u(rt,rt,.25),d(ht,0,0);for(let d=4;d<8;++d)m(ht,ht,t[d]);u(ht,ht,.25),_(ot[0],t[4],t[5],.5),_(ot[1],t[5],t[6],.5),_(ot[2],t[6],t[7],.5),_(ot[3],t[7],t[4],.5);let n=0,c=f(ot[0],rt);for(let d=1;d<4;++d){const t=f(ot[d],rt);t<c&&(c=t,n=d)}g(nt,ot[n],t[n+4]);const l=nt[0];let M,C;nt[0]=-nt[1],nt[1]=l,g(ct,ht,rt),p(ct,nt)<0&&x(nt,nt),_(nt,nt,ct,e),b(nt,nt),M=C=p(g(lt,t[0],rt),nt);for(let d=1;d<8;++d){const s=p(g(lt,t[d],rt),nt);s<M?M=s:s>C&&(C=s)}w(i,rt),u(lt,nt,M-s),m(i,i,lt);let j=-1,T=1,y=0,D=0;for(let d=0;d<8;++d){g(dt,t[d],i),b(dt,dt);const s=nt[0]*dt[1]-nt[1]*dt[0];s>0?s>j&&(j=s,y=d):s<T&&(T=s,D=d)}Q(j>0,"leftArea"),Q(T<0,"rightArea"),u(mt,nt,M),m(mt,mt,rt),u(ut,nt,C),m(ut,ut,rt),_t[0]=-nt[1],_t[1]=nt[0];const H=V(i,t[D],ut,m(lt,ut,_t),1,a),v=V(i,t[y],ut,lt,1,r),S=V(i,t[y],mt,m(lt,mt,_t),1,h),R=V(i,t[D],mt,lt,1,o);Q(H,"rayRay"),Q(v,"rayRay"),Q(S,"rayRay"),Q(R,"rayRay")}function gt(t,s){return 3*s+t}const pt=M();function xt(t,s){return d(pt,t[s],t[s+3]),pt}const bt=M(),wt=a();function Mt(t,s,e,i,a){g(bt,e,i),u(bt,bt,.5),wt[0]=bt[0],wt[1]=bt[1],wt[2]=0,wt[3]=bt[1],wt[4]=-bt[0],wt[5]=0,wt[6]=bt[0]*bt[0]+bt[1]*bt[1],wt[7]=bt[0]*bt[1]-bt[1]*bt[0],wt[8]=1,wt[gt(0,2)]=-p(xt(wt,0),t),wt[gt(1,2)]=-p(xt(wt,1),t);let r=p(xt(wt,0),e)+wt[gt(0,2)],h=p(xt(wt,1),e)+wt[gt(1,2)],o=p(xt(wt,0),i)+wt[gt(0,2)],n=p(xt(wt,1),i)+wt[gt(1,2)];r=-(r+o)/(h+n),wt[gt(0,0)]+=wt[gt(1,0)]*r,wt[gt(0,1)]+=wt[gt(1,1)]*r,wt[gt(0,2)]+=wt[gt(1,2)]*r,r=1/(p(xt(wt,0),e)+wt[gt(0,2)]),h=1/(p(xt(wt,1),e)+wt[gt(1,2)]),wt[gt(0,0)]*=r,wt[gt(0,1)]*=r,wt[gt(0,2)]*=r,wt[gt(1,0)]*=h,wt[gt(1,1)]*=h,wt[gt(1,2)]*=h,wt[gt(2,0)]=wt[gt(1,0)],wt[gt(2,1)]=wt[gt(1,1)],wt[gt(2,2)]=wt[gt(1,2)],wt[gt(1,2)]+=1,r=p(xt(wt,1),s)+wt[gt(1,2)],h=p(xt(wt,2),s)+wt[gt(2,2)],o=p(xt(wt,1),e)+wt[gt(1,2)],n=p(xt(wt,2),e)+wt[gt(2,2)],r=-.5*(r/h+o/n),wt[gt(1,0)]+=wt[gt(2,0)]*r,wt[gt(1,1)]+=wt[gt(2,1)]*r,wt[gt(1,2)]+=wt[gt(2,2)]*r,r=p(xt(wt,1),s)+wt[gt(1,2)],h=p(xt(wt,2),s)+wt[gt(2,2)],o=-h/r,wt[gt(1,0)]*=o,wt[gt(1,1)]*=o,wt[gt(1,2)]*=o,a[0]=wt[0],a[1]=wt[1],a[2]=0,a[3]=wt[2],a[4]=wt[3],a[5]=wt[4],a[6]=0,a[7]=wt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=wt[6],a[13]=wt[7],a[14]=0,a[15]=wt[8]}function Ct(t,s,i,a,r){const h=1/J[0][3],o=1/J[4][3];F(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,ft(J,n,c,K,Y,Z,$,tt),Mt(K,Y,$,tt,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function jt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{G as ShadowMap,z as SnapshotSlot};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as r,g as a,v as o,t as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as r,g as a,v as o,t as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as l}from"./ViewshedFaceCamera.js";import{FramebufferBit as u}from"../../../webgl/enums.js";import{ColorFormat as f,DepthFormat as m}from"../../../webgl/formats.js";class d{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function g(t){return!["top","bottom"].includes(t)}class _{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new d,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture()}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach((i=>{t[i]&&(e+=1)})),e}get faces(){const t=this._faces,e=[];for(const i of p){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map((t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height]))}get viewshedProjectionMatrices(){return this.faces.map((t=>t.projectionMatrix))}get viewshedViewMatrices(){return this.faces.map((t=>t.viewMatrix))}_setupFaceCamera(e,n,u,f){const{effectiveObserverRenderSpace:m,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:_,horizontalFieldOfView:x,verticalFieldOfView:b}=n,w=c();r(w,p,m);const M=c(),S=c(),z=(t,e)=>{const r=c(),o=s();return i(o,t,e),h(r,w,o),a(r,m,r),r};let F,T=d;const v=Math.min(90,x),j=Math.min(90,Math.max(0,(x-90)/2));let B=-45,O=45,R=-45,y=45;if(g(e)){const e=e=>t(e,-45,45);R=e(-b/2)-this.settings.toleranceBottomTop,y=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":F=p,B=-v/2,O=v/2;break;case"left":F=z(Math.PI/2,d),B=45-j;break;case"right":F=z(-Math.PI/2,d),O=-45+j;break;case"top":F=a(M,m,d),T=o(S,w);break;case"bottom":F=r(M,m,d),T=w;break;case"back":F=z(Math.PI,d)}const E=new l({center:F,eye:m,up:T,far:_});E.sectionAnglesDeg=[B-this.settings.toleranceSides,O+this.settings.toleranceSides,R,y],E.fovY=Math.PI/2;const k=E.setViewport(u,f);return this._faces[e]=E,k}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,a=s/2;return 0===i||0===s||(r<=45&&a>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),a>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,a){const o=s/t,h=this.settings.textureSizeModifier(r);return n(Math.max(e,i)*o*h,this._maxTextureSize/a)}_ensureFBO(t){const e=this._width,i=this._height;this._handle?.fbo?.width===e&&this._handle?.fbo?.height===i||(this._handle?.release(),this._handle=this._fbos.acquire(e,i,"viewshed shadow map",f.RGBA4));const s=t?m.DEPTH24_STENCIL8_TEXTURE:m.DEPTH16_RENDERBUFFER;this._handle.acquireDepth(s)}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(u.COLOR|u.DEPTH)}dispose(){this._handle=this._debugFBO?this._handle:e(this._handle)}start(t,e,i,s,r=!1){this._faces={};const a=this._computeActiveFaces(e),o=a.size;if(0===o)return!1;const h=this._computeBaseTextureSize(t,s,i,o);let c=0,n=0,l=0;return p.filter((t=>a.has(t))).forEach((t=>{const i=x(t,o);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)})),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=b(o)*h,this.clearFBO(r),!0}finish(){this._handle?.detachDepth()}get test(){}}function x(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function b(t){return t<4?1:2}export{_ as ViewshedShadowMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{on as o}from"../../core/events.js";import{destroyMaybe as n}from"../../core/maybe.js";import{watch as i,when as s,syncAndInitial as r,initial as c,sync as l}from"../../core/reactiveUtils.js";import{cloneScreenPoint as a,createScreenPoint as p}from"../../core/screenUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteModeClass as f}from"../../support/modeUtils.js";import{base as d}from"./tooltip/css.js";import{tooltipContentFactory as m}from"./tooltip/content/tooltipContentFactory.js";import{isRTL as v}from"../../widgets/support/widgetUtils.js";const y={base:`${d}`,ltr:`${d}--ltr`,rtl:`${d}--rtl`,debug:`${d}--debug`},g=20,_=16,C="bottom-end";let b=class extends e.EventedAccessor{constructor(t){super(t),this.info=null,this.options=null,this.position=null,this.content=null,this._focused=!1,this.outerContainer=document.createElement("div"),this.debug=!1,this._lastPosition=null,this._rtl=!1,this._prevXY=[0,0]}initialize(){const{outerContainer:t}=this;this.addHandles([i((()=>this.view.overlay?.surface),(e=>{t.remove(),e?.appendChild(t),this._rtl=v(e)}),r),i((()=>this.info),((e,o)=>{if(null!=this.content&&null!=e&&null!=o&&e.type===o.type)this.content.info=e;else{n(this.content);const o=m(this,e);o?(this.content=o,o.container&&t.appendChild(o.container),this.exitInputMode()):this.content=null}}),r),i((()=>({container:this.outerContainer,style:this._outerContainerStyle})),(({container:t,style:e})=>{Object.assign(t.style,e)}),c),i((()=>({outerContainer:this.outerContainer,placement:this.effectivePlacement,effectiveOffset:this._effectiveOffset,rtl:this._rtl,debug:this.debug})),(({outerContainer:t,placement:e,effectiveOffset:o,rtl:n,debug:i})=>{const{classList:s}=t;s.add(y.base),s.toggle(y.rtl,n),s.toggle(y.ltr,!n),s.toggle(y.debug,i),this.outerContainer.style.setProperty("--offset",`${o}px`),f(t),w(t,e)}),c),s((()=>"feedback"===this.mode),(()=>{this.position=null,this._clearOverride("effectivePlacement")}),l),o(this.outerContainer,"paste",(t=>{this.emit("paste",t)})),o(this.outerContainer,["focusin","focusout"],(()=>{
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{on as o}from"../../core/events.js";import{destroyMaybe as n}from"../../core/maybe.js";import{watch as i,when as s,syncAndInitial as r,initial as c,sync as l}from"../../core/reactiveUtils.js";import{cloneScreenPoint as a,createScreenPoint as p}from"../../core/screenUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteModeClass as f}from"../../support/modeUtils.js";import{base as d}from"./tooltip/css.js";import{tooltipContentFactory as m}from"./tooltip/content/tooltipContentFactory.js";import{isRTL as v}from"../../widgets/support/widgetUtils.js";const y={base:`${d}`,ltr:`${d}--ltr`,rtl:`${d}--rtl`,debug:`${d}--debug`},g=20,_=16,C="bottom-end";let b=class extends e.EventedAccessor{constructor(t){super(t),this.info=null,this.options=null,this.position=null,this.content=null,this._focused=!1,this.outerContainer=document.createElement("div"),this.debug=!1,this._lastPosition=null,this._rtl=!1,this._prevXY=[0,0]}initialize(){const{outerContainer:t}=this;this.addHandles([i((()=>this.view.overlay?.surface),(e=>{t.remove(),e?.appendChild(t),this._rtl=v(e)}),r),i((()=>this.info),((e,o)=>{if(null!=this.content&&null!=e&&null!=o&&e.type===o.type)this.content.info=e;else{n(this.content);const o=m(this,e);o?(this.content=o,o.container&&t.appendChild(o.container),this.exitInputMode()):this.content=null}}),r),i((()=>({container:this.outerContainer,style:this._outerContainerStyle})),(({container:t,style:e})=>{Object.assign(t.style,e)}),c),i((()=>({outerContainer:this.outerContainer,placement:this.effectivePlacement,effectiveOffset:this._effectiveOffset,rtl:this._rtl,debug:this.debug})),(({outerContainer:t,placement:e,effectiveOffset:o,rtl:n,debug:i})=>{const{classList:s}=t;s.add(y.base),s.toggle(y.rtl,n),s.toggle(y.ltr,!n),s.toggle(y.debug,i),this.outerContainer.style.setProperty("--offset",`${o}px`),f(t),w(t,e)}),c),s((()=>"feedback"===this.mode),(()=>{this.position=null,this._clearOverride("effectivePlacement")}),l),o(this.outerContainer,"paste",(t=>{this.emit("paste",t)})),o(this.outerContainer,["focusin","focusout"],(()=>{this._focused=this.content?.container?.contains(document.activeElement)??!1}))])}destroy(){this.info=null,this.content=n(this.content),this.outerContainer.remove()}get mode(){return this.content?.mode??"feedback"}get focused(){return this._focused}get visible(){return"none"!==this._outerContainerStyle.display}get contentContainer(){return this.content?.container}get effectivePlacement(){const t=this.options?.placement;return"auto"===t?"bottom-end":t??C}get _screenPoint(){const{inputManager:t}=this.view;return t?.multiTouchActive?null:t?.latestPointerLocation}get _effectiveOffset(){return this.options?.offset??g}get _outerContainerStyle(){const t=this.position??this._screenPoint;if(this._lastPosition=a(t),null!=t&&null!=this.content){return{display:"block",transform:`translate(${Math.round(t.x)}px, ${Math.round(t.y)}px)`}}return{display:"none",transform:"none"}}clear(){this.info=null}async enterInputMode(t){const e=this.position??this._lastPosition??this._screenPoint,o=this.position=a(e),{effectivePlacement:n}=this;this._override("effectivePlacement",n);const i=()=>{o&&(this.position=j(this.contentContainer,o,this._effectiveOffset,this.view),Object.assign(this.outerContainer.style,this._outerContainerStyle))};await(this.content?.enterInputMode(t,i))}async exitInputMode(t){await(this.content?.exitInputMode(t))}onDragStart(t,e){this._prevXY=[t,e]}onDrag(t,e){const o=t-this._prevXY[0],n=e-this._prevXY[1];this._prevXY=[t,e];const{position:i}=this;if(i){const{view:s}=this,r=t-s.position[0],c=e-s.position[1];if(r<0||r>s.width||c<0||c>s.height-_)return;this.position=p(i.x+o,i.y+n)}}onDragEnd(){this._prevXY=[0,0]}};function j(t,e,o,n){if(!t||!n.container)return e;const i=t.getBoundingClientRect(),{left:s,top:r}=n.container.getBoundingClientRect();let{x:c,y:l}=e;const a=i.left-s-o;a<0&&(c-=a);const u=i.right-s+o-n.width;u>0&&(c-=u);const h=i.top-r-o;h<0&&(l-=h);const f=i.bottom-r+o-n.height;return f>0&&(l-=f),p(c,l)}t([u({nonNullable:!0})],b.prototype,"view",void 0),t([u()],b.prototype,"info",void 0),t([u()],b.prototype,"options",void 0),t([u()],b.prototype,"position",void 0),t([u()],b.prototype,"content",void 0),t([u({readOnly:!0})],b.prototype,"mode",null),t([u()],b.prototype,"_focused",void 0),t([u({readOnly:!0})],b.prototype,"focused",null),t([u({readOnly:!0})],b.prototype,"outerContainer",void 0),t([u({readOnly:!0})],b.prototype,"contentContainer",null),t([u({readOnly:!0})],b.prototype,"effectivePlacement",null),t([u()],b.prototype,"debug",void 0),t([u()],b.prototype,"_lastPosition",void 0),t([u()],b.prototype,"_screenPoint",null),t([u()],b.prototype,"_rtl",void 0),t([u()],b.prototype,"_effectiveOffset",null),t([u()],b.prototype,"_outerContainerStyle",null),b=t([h("esri.views.interactive.Tooltip")],b);const P=["top","bottom","leading","trailing"].flatMap((t=>[O(`${t}-start`),O(t),O(`${t}-end`)]));function O(t){return`${y.base}--${t}`}function w({classList:t},e){P.forEach((e=>t.remove(e))),t.add(O(e))}const x=b;export{x as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{prefersReducedMotion as e}from"../../../../core/a11yUtils.js";import{on as o}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as s}from"../../../../core/memoize.js";import{throwIfNotAbortError as i,throwIfAborted as n,after as r}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as a,waitTick as l}from"../../../../core/scheduling.js";import{unitName as c}from"../../../../core/unitFormatUtils.js";import{defaultLengthUnit as p,defaultVerticalLengthUnit as d,defaultAreaUnit as u}from"../../../../core/unitUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{getDefaultUnitForView as f}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as g}from"../../keybindings.js";import{table as _,contentHeader as y,contentHeaderSpacer as b,contentHeaderActions as v,contentInputMode as w,content as I,helpMessageText as j,helpMessageIcon as k,helpMessage as A,drawContentHeaderActions as C}from"../css.js";import{getFormatters as U}from"../fields/parsingAndFormattingUtils.js";import M from"../../../../widgets/Widget.js";import{loadCalciteComponents as
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{prefersReducedMotion as e}from"../../../../core/a11yUtils.js";import{on as o}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as s}from"../../../../core/memoize.js";import{throwIfNotAbortError as i,throwIfAborted as n,after as r}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as a,waitTick as l}from"../../../../core/scheduling.js";import{unitName as c}from"../../../../core/unitFormatUtils.js";import{defaultLengthUnit as p,defaultVerticalLengthUnit as d,defaultAreaUnit as u}from"../../../../core/unitUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{getDefaultUnitForView as f}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as g}from"../../keybindings.js";import{table as _,contentHeader as y,contentHeaderSpacer as b,contentHeaderActions as v,contentInputMode as w,content as I,helpMessageText as j,helpMessageIcon as k,helpMessage as A,drawContentHeaderActions as C}from"../css.js";import{getFormatters as U}from"../fields/parsingAndFormattingUtils.js";import M from"../../../../widgets/Widget.js";import{loadCalciteComponents as D}from"../../../../widgets/support/componentsUtils.js";import{classes as F}from"../../../../widgets/support/widgetUtils.js";import{messageBundle as x}from"../../../../widgets/support/decorators/messageBundle.js";import{tsx as T,tsxFragment as H}from"../../../../widgets/support/jsxFactory.js";const E=Symbol("dragHandles");let S=class extends M{constructor(){super(...arguments),this._focusAbortController=new AbortController,this._transitionInfo=null,this._mode="feedback",this._getFormatters=s(U),this._onHeaderPointerDown=t=>{const e=t.target;e instanceof HTMLElement&&"calcite-button"!==e?.tagName?.toLowerCase()&&(this.removeHandles(E),t.preventDefault(),t.stopPropagation(),e.setPointerCapture(t.pointerId),this.tooltip.onDragStart(t.clientX,t.clientY),this.addHandles([o(e,"pointermove",(({clientX:t,clientY:e})=>{this.tooltip.onDrag(t,e)})),o(e,["pointerup","pointercancel"],(o=>{this.removeHandles(E),e.releasePointerCapture(t.pointerId),this.tooltip.onDragEnd()})),o(e,"touchstart",(t=>t.preventDefault()))],E))},this._onDiscard=()=>{this.destroyed||(this.tooltip.emit("discard"),this.info.clearInputValues(),this.exitInputMode())},this._onCommit=(t,e)=>{if(this.destroyed)return;if(this.tooltip.emit("commit",{type:e}),"commit-and-exit"===e)return void this.exitInputMode();if("commit-on-blur"===e)return;const o=this._getFocusableElements(),s=o.length,i=o.indexOf(t);if(-1===i)return void this.exitInputMode();const n=((i+("commit-and-next"===e?1:-1))%s+s)%s;L(o.at(n))},this._onKeyDown=t=>{switch(t.code){case g.next:return this._onNextKey(t);case g.discard:return t.stopPropagation(),this._onDiscard()}}}get mode(){return this._mode}get _displayUnits(){const{displayUnits:t}=this.info.sketchOptions.values,e=f(this.tooltip.view);return{length:t.length??e,verticalLength:t.verticalLength??e,area:t.area??e}}get _inputUnitInfos(){const t=this._messagesUnits,e=e=>({unit:e,abbreviation:c(t,e,"abbr")}),{inputUnits:o}=this.info.sketchOptions.values,s=f(this.tooltip.view),i=o.length??s,n=o.verticalLength??s,r=o.area??s;return{length:e(p(i)),verticalLength:e(d(n)),area:e(u(r)),angle:e("degrees")}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,sketchOptions:this.info.sketchOptions,onCommit:this._onCommit,onDiscard:this._onDiscard}}render(){const{visibleElements:t}=this.info.sketchOptions.tooltips,e=this._renderedContent,o=this._renderedActions,s=this._renderedHelpMessage,i=e.length>0,n=i||!!s,r="input"===this.mode;return T("div",{class:F(I,r&&w),onkeydown:this._onKeyDown,tabIndex:-1},r&&n&&t.header?T("div",{class:y,"data-testid":"tooltip-header",key:"header",onpointerdown:this._onHeaderPointerDown},T("calcite-button",{appearance:"transparent","data-testid":"tooltip-back-button",iconFlipRtl:"both",iconStart:"chevron-left",key:"discard-button",kind:"neutral",onclick:this._onDiscard,scale:"s",tabIndex:-1}),o.length>0?T(H,null,T("div",{class:b,key:"spacer"}),T("div",{class:v,key:"actions"},o)):null):null,i?T("div",{class:_,key:"content"},...e):null,s)}destroy(){this._focusAbortController.abort(),this._transitionInfo?.transition.skipTransition()}_renderActions(){return null}loadDependencies(){return D({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input")})}async enterInputMode(t,e){try{await this._transitionTo("input",e),await this._focusField(t)}catch(o){i(o)}}async exitInputMode({focusOnView:t=!0}={}){try{const{container:e,info:o}=this;o.clearInputValues();const s=t?e?.closest(".esri-view")?.querySelector(".esri-view-surface"):null;await this._transitionTo("feedback"),s instanceof HTMLElement&&s.focus()}catch(e){i(e)}}_onNextKey(t){const e=this._getFocusableElements(),o=e.at(0),s=e.at(-1);o&&s&&(t.shiftKey?document.activeElement===o&&(t.preventDefault(),t.stopPropagation(),L(s)):document.activeElement===s&&(t.preventDefault(),t.stopPropagation(),L(o)))}get _renderedContent(){return N(this._renderContent())}get _renderedActions(){return N(this._renderActions())}get _renderedHelpMessage(){const{sketchOptions:t,visibleElements:e}=this.info;if(!e.helpMessage)return null;const o=t.tooltips.helpMessage??this._defaultHelpMessage;if(!o)return null;const s=t.tooltips.helpMessageIcon??"information";return T("div",{class:A,key:"help-message"},s?T("calcite-icon",{class:k,icon:s,scale:"s"}):null,T("div",{class:j},o))}get _defaultHelpMessage(){const{helpMessage:t,viewType:e}=this.info;if(null==t)return null;const o="3d"===e?"helpMessages3d":"helpMessages2d";return this._messagesTooltip?.sketch?.[o]?.[t]}async _focusField(t){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const{signal:e}=this._focusAbortController;await this._waitForInputs(),n(e);const o=this._getFocusableInputs(),s=t?o.find((e=>e.getAttribute("data-field-name")===t)):o.at(0);await L(s)}async _transitionTo(t,o){if(this._mode===t&&!this._transitionInfo)return;if(this._transitionInfo?.mode===t)return this._transitionInfo.transition.finished;this._transitionInfo?.transition.skipTransition();const s=async()=>{this.destroyed||(this._mode=t,await l(),this.destroyed||(this.renderNow(),await l(),this.destroyed||o?.()))};if(!this.domNode?.firstChild||!document.startViewTransition||e())return void await s();this.autoRenderingEnabled=!1;const i=this._transitionInfo={transition:document.startViewTransition((async()=>{this.destroyed||i!==this._transitionInfo||(this.autoRenderingEnabled=!0,await s())})),mode:t};try{await i.transition.finished}finally{i===this._transitionInfo&&(this._transitionInfo=null)}}async _waitForInputs(){const t=()=>Array.from(this.domNode?.querySelectorAll("calcite-input")??[]);for(;0===t().length;)await r(O);await a()}_getFocusableInputs(){return Array.from(this.domNode?.querySelectorAll("calcite-input:not([read-only]):not([disabled])")??[])}_getFocusableElements(){const t=this.domNode?.querySelector(`.${C}`);return[...Array.from(t?.querySelectorAll(`.${v} calcite-button:not([disabled])`)??[]),...this._getFocusableInputs()]}};async function L(t){await(t?.setFocus())}function N(t){return(Array.isArray(t)?t:[t]).flat(10).filter((t=>!!t))}t([x("esri/core/t9n/Units"),h()],S.prototype,"_messagesUnits",void 0),t([x("esri/views/interactive/tooltip/t9n/Tooltip"),h()],S.prototype,"_messagesTooltip",void 0),t([h()],S.prototype,"info",void 0),t([h()],S.prototype,"tooltip",void 0),t([h()],S.prototype,"_mode",void 0),t([h()],S.prototype,"mode",null),t([h()],S.prototype,"_displayUnits",null),t([h()],S.prototype,"_inputUnitInfos",null),t([h()],S.prototype,"_formatters",null),t([h()],S.prototype,"fieldContext",null),t([h()],S.prototype,"_renderedContent",null),t([h()],S.prototype,"_renderedActions",null),t([h()],S.prototype,"_renderedHelpMessage",null),t([h()],S.prototype,"_defaultHelpMessage",null),S=t([m("esri.views.interactive.tooltip.content.TooltipContent")],S);const O=20;export{S as TooltipContent};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Collection.js";import{createAbortError as s}from"../../core/promiseUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";const o=o=>{let a=class extends o{constructor(...e){super(...e),this.layer=null}get interactive(){return this.analysisView?.interactive??!1}set interactive(e){null!=this.analysisView&&(this.analysisView.interactive=e)}get results(){return this.analysisView?.results??new r}async place(e){if(null!=this.analysisView)return await this.analysisView.place(e);throw s()}};return e([t()],a.prototype,"layer",void 0),e([t()],a.prototype,"interactive",null),e([t({readOnly:!0})],a.prototype,"results",null),a=e([i("esri.views.layers.LineOfSightLayerView")],a),a};export{o as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{BufferObject as i}from"./BufferObject.js";import{webglDebugEnabled as r}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,TextureType as h,FramebufferTarget as o,UnsizedDepthFormat as c,PixelType as a,Usage as u,BufferType as f,SizedStencilFormat as _,StencilAttachment as l,SizedDepthStencilFormat as d,DepthStencilAttachment as m,SizedDepthFormat as T,DepthAttachment as p}from"./enums.js";import{GLObjectType as x}from"./GLObjectType.js";import{Renderbuffer as E}from"./Renderbuffer.js";import{Texture as b}from"./Texture.js";const g=()=>t.getLogger("esri.views.webgl.FramebufferObject");class R{constructor(t,e,i=null){if(this._context=t,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,t.instanceCounter.increment(s.FramebufferObject,this),null!=e){const t=F(e)?e:new b(this._context,e);this._colorAttachments.set(n,t),this._validateTextureDescriptor(t.descriptor),this._validateColorAttachmentPoint(n)}if(null!=i)if(S(i))this._depthStencilTexture=F(i)?i:new b(this._context,i),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=A(i)?i:new E(this._context,i);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}dispose(){const{_colorAttachments:t,_glName:e}=this;if(0===t.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!e)return;const{_context:i}=this;i.temporaryBindFramebufferObject(null,(()=>{this._colorAttachments.forEach(((t,e)=>this.detachColorTexture(e)?.dispose())),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),e&&(i.gl.deleteFramebuffer(e),this._glName=null)})),i.instanceCounter.decrement(s.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){return this._colorAttachments.get(n)}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const t=this._colorAttachments.get(n);return t?.descriptor?.width??0}get height(){const t=this._colorAttachments.get(n);return t?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce(((t,[e,i])=>t+i.usedMemory),this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(t){const e=this._colorAttachments.get(t);return e&&F(e)?e:null}get colorAttachments(){return[...this._colorAttachments.keys()]}attachColorTexture(t,e=n){if(!t)return;this._validateColorAttachmentPoint(e);const i=t.descriptor;this._validateTextureDescriptor(i),this.detachColorTexture(e)?.dispose(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,e)),this._colorAttachments.set(e,t)}detachColorTexture(t=n){const e=this._colorAttachments.get(t);if(e)return this._initialized&&this._context.temporaryBindFramebufferObject(this,(()=>{this._framebufferTexture2D(null,t)})),this._colorAttachments.delete(t),e}setColorTextureTarget(t,e=n,i=0){const r=this._colorAttachments.get(e);r&&(t===h.TEXTURE_2D_ARRAY?this._framebufferTextureLayer(r.glName,e,o.FRAMEBUFFER,0,i):this._framebufferTexture2D(r.glName,e,t,o.FRAMEBUFFER,0))}attachDepthStencil(t){if(t)switch(t.type){case x.Texture:return this._attachDepthStencilTexture(t);case x.Renderbuffer:return this._attachDepthStencilBuffer(t)}}_attachDepthStencilTexture(t){if(null==t)return;const{descriptor:e}=t,{pixelFormat:i,dataType:r}=e;i===c.DEPTH_STENCIL||i===c.DEPTH_COMPONENT?i!==c.DEPTH_STENCIL||r===a.UNSIGNED_INT_24_8?i!==c.DEPTH_COMPONENT||r===a.UNSIGNED_INT||r===a.UNSIGNED_SHORT?(this._validateTextureDescriptor(e),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,U(i))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=t):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const t=this._depthStencilTexture;return t&&this._initialized&&this._context.temporaryBindFramebufferObject(this,(()=>{this._framebufferTexture2D(null,U(t.descriptor.pixelFormat))})),this._depthStencilTexture=null,t}_attachDepthStencilBuffer(t){if(null==t)return;const e=t.descriptor;if(this._validateRenderbufferDescriptor(e),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const i=this._context.gl,r=this._getGLAttachmentPoint(e);i.framebufferRenderbuffer(o.FRAMEBUFFER,r,i.RENDERBUFFER,t.glName)}this._depthStencilBuffer=t}detachDepthStencilBuffer(){const t=this._depthStencilBuffer;if(t&&this._initialized){const e=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this);const i=this._context.gl,r=this._getGLAttachmentPoint(t.descriptor);i.framebufferRenderbuffer(o.FRAMEBUFFER,r,i.RENDERBUFFER,null),this._context.bindFramebuffer(e)}return this._depthStencilBuffer=null,t}invalidateAttachments(t,e=!1){const i=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this,e),this._context.gl.invalidateFramebuffer(o.FRAMEBUFFER,t),this._context.bindFramebuffer(i)}copyToTexture(t,e,i,r,s,n,o){(t<0||e<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!");const c=o.descriptor;o.descriptor.target!==h.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(null==c?.width||null==c?.height||t+i>this.width||e+r>this.height||s+i>c.width||n+r>c.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const a=this._context,u=a.bindTexture(o,b.TEXTURE_UNIT_FOR_UPDATES);a.setActiveTexture(b.TEXTURE_UNIT_FOR_UPDATES),a.bindFramebuffer(this),a.gl.copyTexSubImage2D(h.TEXTURE_2D,0,s,n,t,e,i,r),a.bindTexture(u,b.TEXTURE_UNIT_FOR_UPDATES)}readPixels(t,e,i,r,s,n,h){(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(t,e,i,r,s,n,h)}async readPixelsAsync(t,e,r,s,n,h,o){const{gl:c}=this._context,a=i.createPixelPack(this._context,u.STREAM_READ,o.byteLength);this._context.bindBuffer(a);const _=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),c.readPixels(t,e,r,s,n,h,0),this._context.unbindBuffer(f.PIXEL_PACK_BUFFER),this._context.bindFramebuffer(_),await a.getSubDataAsync(o),a.dispose()}resize(t,e){if(this.width===t&&this.height===e)return;const i={width:t,height:e};N(i,this._context.parameters.maxTextureSize),this._colorAttachments.forEach((t=>t.resize(i.width,i.height))),this._depthStencilTexture?.resize(i.width,i.height),this._initialized&&(N(i,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(i.width,i.height),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1)}initializeAndBind(t=o.FRAMEBUFFER){const{gl:e}=this._context;if(this._initialized)return void e.bindFramebuffer(t,this.glName);this._glName&&e.deleteFramebuffer(this._glName);const i=e.createFramebuffer();if(e.bindFramebuffer(t,i),this._colorAttachments.forEach(((e,i)=>{const r=B(e);r===h.TEXTURE_2D_ARRAY?this._framebufferTextureLayer(e.glName,i,t,0,0):this._framebufferTexture2D(e.glName,i,r,t)})),this._depthStencilBuffer){const i=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(t,i,e.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const e=U(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,e,B(this._depthStencilTexture),t)}if(r()){e.checkFramebufferStatus(t)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=i,this._initialized=!0}_framebufferTexture2D(t,e=n,i=h.TEXTURE_2D,r=o.FRAMEBUFFER,s=0){this._context.gl.framebufferTexture2D(r,e,i,t,s)}_framebufferTextureLayer(t,e=n,i=o.FRAMEBUFFER,r=0,s=0){this._context.gl.framebufferTextureLayer(i,e,t,r,s)}_disposeDepthStencilAttachments(){const t=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const e=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(o.FRAMEBUFFER,e,t.RENDERBUFFER,null)}this._depthStencilBuffer=e(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,U(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=e(this._depthStencilTexture))}_validateTextureDescriptor(t){t.target!==h.TEXTURE_2D&&t.target!==h.TEXTURE_CUBE_MAP&&t.target!==h.TEXTURE_2D_ARRAY&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),N(t,this._context.parameters.maxTextureSize),this._validateBufferDimensions(t)}_validateRenderbufferDescriptor(t){N(t,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(t)}_validateBufferDimensions(t){t.width<=0&&(t.width=this.width),t.height<=0&&(t.height=this.height),this.width>0&&this.height>0&&(this.width===t.width&&this.height===t.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(t){switch(t.internalFormat){case T.DEPTH_COMPONENT16:case T.DEPTH_COMPONENT24:case T.DEPTH_COMPONENT32F:return p;case d.DEPTH24_STENCIL8:case d.DEPTH32F_STENCIL8:return m;case _.STENCIL_INDEX8:return l}}_validateColorAttachmentPoint(e){if(-1===R._MAX_COLOR_ATTACHMENTS){const{gl:t}=this._context;R._MAX_COLOR_ATTACHMENTS=t.getParameter(t.MAX_COLOR_ATTACHMENTS)}const i=e-n;i+1>R._MAX_COLOR_ATTACHMENTS&&t.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${i+1}. Implementation supports up to ${R._MAX_COLOR_ATTACHMENTS} color attachments`)}}function F(t){return null!=t&&"type"in t&&t.type===x.Texture}function A(t){return null!=t&&"type"in t&&t.type===x.Renderbuffer}function S(t){return F(t)||D(t)}function D(t){return null!=t&&"objectType"in t&&t.objectType===x.Texture}function N(t,e){const i=Math.max(t.width,t.height);if(i>e){g().warn(`Resizing FBO attachment size ${t.width}x${t.height} to device limit ${e}`);const r=e/i;return t.width=Math.round(t.width*r),t.height=Math.round(t.height*r),!1}return!0}function B(t){return t.descriptor.target===h.TEXTURE_CUBE_MAP?h.TEXTURE_CUBE_MAP_POSITIVE_X:t.descriptor.target===h.TEXTURE_2D_ARRAY?h.TEXTURE_2D_ARRAY:h.TEXTURE_2D}function U(t){return t===c.DEPTH_COMPONENT?p:m}export{R as FramebufferObject,N as ensureAttachmentMaxSize};
|
|
5
|
+
import"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,TextureType as h,FramebufferTarget as o,UnsizedDepthFormat as c,PixelType as a,Usage as u,BufferType as f,SizedStencilFormat as l,StencilAttachment as _,SizedDepthStencilFormat as d,DepthStencilAttachment as m,SizedDepthFormat as T,DepthAttachment as p}from"./enums.js";import{GLObjectType as E}from"./GLObjectType.js";import{Renderbuffer as x}from"./Renderbuffer.js";import{Texture as b}from"./Texture.js";const g=()=>t.getLogger("esri.views.webgl.FramebufferObject");class R{constructor(t,e,r){if(this._context=t,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,t.instanceCounter.increment(s.FramebufferObject,this),null!=e){const r=F(e)?e:new b(t,e);this._colorAttachments.set(n,r),this._validateTextureDescriptor(r.descriptor),this._validateColorAttachmentPoint(n)}if(null!=r)if(S(r))this._depthStencilTexture=F(r)?r:new b(t,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const e=A(r)?r:new x(t,r);this._depthStencilBuffer=e,this._validateRenderbufferDescriptor(e.descriptor)}}dispose(){const{_colorAttachments:t,_glName:e}=this;if(0===t.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!e)return;const{_context:r}=this;r.temporaryBindFramebufferObject(null,(()=>{this._colorAttachments.forEach(((t,e)=>this.detachColorTexture(e)?.dispose())),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),e&&(r.gl.deleteFramebuffer(e),this._glName=null)})),r.instanceCounter.decrement(s.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){return this._colorAttachments.get(n)}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const t=this._colorAttachments.get(n);return t?.descriptor?.width??0}get height(){const t=this._colorAttachments.get(n);return t?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce(((t,[e,r])=>t+r.usedMemory),this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(t){const e=this._colorAttachments.get(t);return e&&F(e)?e:null}get colorAttachments(){return[...this._colorAttachments.keys()]}attachColorTexture(t,e=n){if(!t)return;this._validateColorAttachmentPoint(e);const r=t.descriptor;this._validateTextureDescriptor(r),this.detachColorTexture(e)?.dispose(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,e)),this._colorAttachments.set(e,t)}detachColorTexture(t=n){const e=this._colorAttachments.get(t);if(e)return this._initialized&&this._context.temporaryBindFramebufferObject(this,(()=>{this._framebufferTexture2D(null,t)})),this._colorAttachments.delete(t),e}setColorTextureTarget(t,e=n,r=0){const i=this._colorAttachments.get(e);i&&(t===h.TEXTURE_2D_ARRAY?this._framebufferTextureLayer(i.glName,e,o.FRAMEBUFFER,0,r):this._framebufferTexture2D(i.glName,e,t,o.FRAMEBUFFER,0))}attachDepthStencil(t){if(t)switch(t.type){case E.Texture:return this._attachDepthStencilTexture(t);case E.Renderbuffer:return this._attachDepthStencilBuffer(t)}}_attachDepthStencilTexture(t){if(null==t)return;const{descriptor:e}=t,{pixelFormat:r,dataType:i}=e;r===c.DEPTH_STENCIL||r===c.DEPTH_COMPONENT?r!==c.DEPTH_STENCIL||i===a.UNSIGNED_INT_24_8?r!==c.DEPTH_COMPONENT||i===a.UNSIGNED_INT||i===a.UNSIGNED_SHORT?(this._validateTextureDescriptor(e),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,U(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=t):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const t=this._depthStencilTexture;return t&&this._initialized&&this._context.temporaryBindFramebufferObject(this,(()=>{this._framebufferTexture2D(null,U(t.descriptor.pixelFormat))})),this._depthStencilTexture=null,t}_attachDepthStencilBuffer(t){if(null==t)return;const e=t.descriptor;if(this._validateRenderbufferDescriptor(e),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const r=this._context.gl,i=this._getGLAttachmentPoint(e);r.framebufferRenderbuffer(o.FRAMEBUFFER,i,r.RENDERBUFFER,t.glName)}this._depthStencilBuffer=t}detachDepthStencilBuffer(){const t=this._depthStencilBuffer;if(t&&this._initialized){const{_context:e}=this,r=e.getBoundFramebufferObject();e.bindFramebuffer(this);const{gl:i}=e,s=this._getGLAttachmentPoint(t.descriptor);i.framebufferRenderbuffer(o.FRAMEBUFFER,s,i.RENDERBUFFER,null),e.bindFramebuffer(r)}return this._depthStencilBuffer=null,t}invalidateAttachments(t,e=!1){const r=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this,e),this._context.gl.invalidateFramebuffer(o.FRAMEBUFFER,t),this._context.bindFramebuffer(r)}copyToTexture(t,e,r,i,s,n,o){(t<0||e<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const c=o.descriptor;o.descriptor.target!==h.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(null==c?.width||null==c?.height||t+r>this.width||e+i>this.height||s+r>c.width||n+i>c.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const a=this._context,u=a.bindTexture(o,b.TEXTURE_UNIT_FOR_UPDATES);a.setActiveTexture(b.TEXTURE_UNIT_FOR_UPDATES),a.bindFramebuffer(this),a.gl.copyTexSubImage2D(h.TEXTURE_2D,0,s,n,t,e,r,i),a.bindTexture(u,b.TEXTURE_UNIT_FOR_UPDATES)}readPixels(t,e,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(t,e,r,i,s,n,h)}async readPixelsAsync(t,e,i,s,n,h,o){const{gl:c}=this._context,a=r.createPixelPack(this._context,u.STREAM_READ,o.byteLength);this._context.bindBuffer(a);const l=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),c.readPixels(t,e,i,s,n,h,0),this._context.unbindBuffer(f.PIXEL_PACK_BUFFER),this._context.bindFramebuffer(l),await a.getSubDataAsync(o),a.dispose()}resize(t,e){if(this.width===t&&this.height===e)return;const r={width:t,height:e};N(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach((t=>t.resize(r.width,r.height))),this._depthStencilTexture?.resize(r.width,r.height),this._initialized&&(N(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1)}initializeAndBind(t=o.FRAMEBUFFER){const{gl:e}=this._context;if(this._initialized)return void e.bindFramebuffer(t,this.glName);this._glName&&e.deleteFramebuffer(this._glName);const r=e.createFramebuffer();if(e.bindFramebuffer(t,r),this._colorAttachments.forEach(((e,r)=>{const i=B(e);i===h.TEXTURE_2D_ARRAY?this._framebufferTextureLayer(e.glName,r,t,0,0):this._framebufferTexture2D(e.glName,r,i,t)})),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(t,r,e.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const e=U(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,e,B(this._depthStencilTexture),t)}if(i()){e.checkFramebufferStatus(t)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=r,this._initialized=!0}_framebufferTexture2D(t,e=n,r=h.TEXTURE_2D,i=o.FRAMEBUFFER,s=0){this._context.gl.framebufferTexture2D(i,e,r,t,s)}_framebufferTextureLayer(t,e=n,r=o.FRAMEBUFFER,i=0,s=0){this._context.gl.framebufferTextureLayer(r,e,t,i,s)}_disposeDepthStencilAttachments(){const t=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const e=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(o.FRAMEBUFFER,e,t.RENDERBUFFER,null)}this._depthStencilBuffer=e(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,U(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=e(this._depthStencilTexture))}_validateTextureDescriptor(t){t.target!==h.TEXTURE_2D&&t.target!==h.TEXTURE_CUBE_MAP&&t.target!==h.TEXTURE_2D_ARRAY&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),N(t,this._context.parameters.maxTextureSize),this._validateBufferDimensions(t)}_validateRenderbufferDescriptor(t){N(t,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(t)}_validateBufferDimensions(t){t.width<=0&&(t.width=this.width),t.height<=0&&(t.height=this.height),this.width>0&&this.height>0&&(this.width===t.width&&this.height===t.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(t){switch(t.internalFormat){case T.DEPTH_COMPONENT16:case T.DEPTH_COMPONENT24:case T.DEPTH_COMPONENT32F:return p;case d.DEPTH24_STENCIL8:case d.DEPTH32F_STENCIL8:return m;case l.STENCIL_INDEX8:return _}}_validateColorAttachmentPoint(e){if(-1===R._MAX_COLOR_ATTACHMENTS){const{gl:t}=this._context;R._MAX_COLOR_ATTACHMENTS=t.getParameter(t.MAX_COLOR_ATTACHMENTS)}const r=e-n;r+1>R._MAX_COLOR_ATTACHMENTS&&t.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${R._MAX_COLOR_ATTACHMENTS} color attachments`)}}function F(t){return null!=t&&"type"in t&&t.type===E.Texture}function A(t){return null!=t&&"type"in t&&t.type===E.Renderbuffer}function S(t){return F(t)||D(t)}function D(t){return null!=t&&"objectType"in t&&t.objectType===E.Texture}function N(t,e){const r=Math.max(t.width,t.height);if(r>e){g().warn(`Resizing FBO attachment size ${t.width}x${t.height} to device limit ${e}`);const i=e/r;return t.width=Math.round(t.width*i),t.height=Math.round(t.height*i),!1}return!0}function B(t){return t.descriptor.target===h.TEXTURE_CUBE_MAP?h.TEXTURE_CUBE_MAP_POSITIVE_X:t.descriptor.target===h.TEXTURE_2D_ARRAY?h.TEXTURE_2D_ARRAY:h.TEXTURE_2D}function U(t){return t===c.DEPTH_COMPONENT?p:m}export{R as FramebufferObject,N as ensureAttachmentMaxSize};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"./enums.js";var R;!function(R){R[R.R8=164393]="R8",R[R.R8UI=164402]="R8UI",R[R.RG8=164395]="RG8",R[R.RG8UI=164408]="RG8UI",R[R.RGBA4=163926]="RGBA4",R[R.RGBA8=163928]="RGBA8",R[R.RGBA8_MIPMAP=173915]="RGBA8_MIPMAP",R[R.R16F=164397]="R16F",R[R.RGBA16F=165914]="RGBA16F",R[R.RGBA16F_NEAREST=175642]="RGBA16F_NEAREST"}(R||(R={}));const E=262144,T=393216;var _;!function(R){R[R.DEPTH24_STENCIL8_RENDERBUFFER=297200]="DEPTH24_STENCIL8_RENDERBUFFER",R[R.DEPTH24_STENCIL8_TEXTURE=428272]="DEPTH24_STENCIL8_TEXTURE",R[R.DEPTH16_RENDERBUFFER=295333]="DEPTH16_RENDERBUFFER",R[R.DEPTH16_TEXTURE=426405]="DEPTH16_TEXTURE"}(_||(_={}));export{R as ColorFormat,_ as DepthFormat,E as depthFormatRenderbufferDisambiguationOffset,T as depthFormatTextureDisambiguationOffset};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../core/Error.js";import
|
|
5
|
+
import t from"../../core/Error.js";import n from"../../core/Logger.js";import{SizedPixelFormat as e,SizedDepthFormat as r,SizedDepthStencilFormat as i,CompressedTextureFormat as o,TextureType as u,PixelType as a,PixelFormat as l,UnsizedDepthFormat as c}from"./enums.js";import{DepthFormat as h}from"./formats.js";const s=()=>n.getLogger("esri/views/webgl/textureUtils");function m(t){(null!=t.width&&t.width<0||null!=t.height&&t.height<0||null!=t.depth&&t.depth<0)&&s().error("Negative dimension parameters are not allowed!")}function f(t){return t in e}function d(t){return t in r}function E(t){return t in i}function T(t){return t in h}function p(t){return null!=t&&t in o}function g(t){return null!=t&&"type"in t&&"compressed"===t.type}function w(t){return p(t.descriptor.internalFormat)}function R(t){return null!=t&&"byteLength"in t}function F(t){return null!=t&&!g(t)&&!R(t)}function B(t){return t===u.TEXTURE_3D||t===u.TEXTURE_2D_ARRAY}function G(t,n,e,r=1){let i=Math.max(n,e);return t===u.TEXTURE_3D&&(i=Math.max(i,r)),Math.floor(Math.log2(i))+1}function N(n){if(null!=n.internalFormat)return n.internalFormat;switch(n.dataType){case a.FLOAT:switch(n.pixelFormat){case l.RGBA:return e.RGBA32F;case l.RGB:return e.RGB32F;default:throw new t("texture:unknown-format","Unable to derive format")}case a.UNSIGNED_BYTE:switch(n.pixelFormat){case l.RGBA:return e.RGBA8;case l.RGB:return e.RGB8}}const{pixelFormat:o}=n;return n.internalFormat=o===c.DEPTH_STENCIL?i.DEPTH24_STENCIL8:o===c.DEPTH_COMPONENT?r.DEPTH_COMPONENT24:o,n.internalFormat}function _(t){let n="width"in t?t.width:t.codedWidth,e="height"in t?t.height:t.codedHeight;const r=1;return t instanceof HTMLVideoElement&&(n=t.videoWidth,e=t.videoHeight),{width:n,height:e,depth:r}}export{G as calcMipmapLevels,N as deriveInternalFormat,_ as getDimensions,B as is3DTarget,R as isArrayBufferView,g as isCompressedData,p as isCompressedFormat,w as isCompressedTexture,T as isDepthAndOrStencilFormat,d as isSizedDepthFormat,E as isSizedDepthStencilFormat,f as isSizedPixelFormat,F as isTexImageSource,m as validateTexture};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{id as o}from"../../kernel.js";import e from"../../core/Error.js";import r from"../../core/JSONSupport.js";import{createMD5Hash as s}from"../../core/MD5.js";import{isAbortError as a}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../portal/PortalItem.js";import{formatJsonMap as u}from"../../rest/support/fileFormat.js";import{fromJSON as m}from"../../rest/support/layoutTemplate.js";import{fetchLayoutTemplateInfos as d}from"./utils.js";let
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{id as o}from"../../kernel.js";import e from"../../core/Error.js";import r from"../../core/JSONSupport.js";import{createMD5Hash as s}from"../../core/MD5.js";import{isAbortError as a}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../portal/PortalItem.js";import{formatJsonMap as u}from"../../rest/support/fileFormat.js";import{fromJSON as m}from"../../rest/support/layoutTemplate.js";import{valueUnitKebabDict as y,fetchLayoutTemplateInfos as d}from"./utils.js";let c=class extends r{constructor(t){super(t),this.description=null,this.format=null,this.state="not-loaded",this.label=null,this.layoutInfoTaskUrl=null,this.layout=null,this.layoutItem=null,this.layoutOptions=null,this.layoutTemplateInfo=null,this.type=null}get id(){return this.layoutItem?.id??`${this.layout}-${s(JSON.stringify(this.toJSON()))}`}get mapSurroundInfoOptions(){const t=this.layoutTemplateInfo?.layoutOptions?.mapSurroundInfos;if(!t)return null;const o={northArrow:[],scaleBar:[],legend:[]};for(const e of t)switch(e.type){case"CIMMarkerNorthArrow":o.northArrow.push(e);break;case"CIMScaleLine":o.scaleBar.push(e);break;case"CIMGroupElement":e.elements?.some((t=>"CIMScaleLine"===t.type))&&o.scaleBar.push(e);break;case"CIMLegend":o.legend.push(e)}return o}get pageUnits(){return y.fromJSON(this.layoutTemplateInfo?.pageUnits?.toLowerCase())}_updateLayoutOptions(t){const o=this.layoutOptions?.legend??t.layoutOptions?.hasLegend,e=this.layoutOptions?.northArrow??(this.mapSurroundInfoOptions?.northArrow.length?this.mapSurroundInfoOptions?.northArrow.some((({visible:t})=>t)):void 0),r=this.layoutOptions?.scaleBar??(this.mapSurroundInfoOptions?.scaleBar.length?this.mapSurroundInfoOptions?.scaleBar.some((({visible:t})=>t)):void 0);this._set("layoutOptions",{legend:o,northArrow:e,scaleBar:r})}async fetchLayoutItemTemplateInfo(t){const{layoutItem:r}=this;if(r?.id&&!this.layoutTemplateInfo&&"loaded"!==this.state)try{this._set("state","loading");const s=this.layoutInfoTaskUrl;if(!s)throw new e("print:invalid-layout-info-task-url","Can't fetch layout template info",{url:s});"public"!==r.access&&o&&await o.getCredential(s);const a={Layout_Item_ID:JSON.stringify({id:r.id})},i=(await d(s,a,t))[0];this.setLayoutTemplateInfo(i)}catch(s){this._set("state",a(s)?"not-loaded":"error")}}setLayoutTemplateInfo(t){this._set("layoutTemplateInfo",t),this._updateLayoutOptions(t),this._set("state","loaded")}};t([i({json:{write:!0}})],c.prototype,"description",void 0),t([n(u)],c.prototype,"format",void 0),t([i({readOnly:!0})],c.prototype,"id",null),t([i({readOnly:!0})],c.prototype,"state",void 0),t([i({json:{write:!0}})],c.prototype,"label",void 0),t([i()],c.prototype,"layoutInfoTaskUrl",void 0),t([i({json:{read:m,write:!0}})],c.prototype,"layout",void 0),t([i({type:p,json:{write:!0}})],c.prototype,"layoutItem",void 0),t([i({readOnly:!0,json:{write:!0}})],c.prototype,"layoutOptions",void 0),t([i({readOnly:!0})],c.prototype,"layoutTemplateInfo",void 0),t([i({readOnly:!0})],c.prototype,"mapSurroundInfoOptions",null),t([i({readOnly:!0})],c.prototype,"pageUnits",null),t([i()],c.prototype,"type",void 0),c=t([l("esri.widgets.Print.CustomTemplate")],c);const h=c;export{h as default};
|