@arcgis/core 4.34.0-next.15 → 4.34.0-next.17
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/analysis/Analysis.js +1 -1
- package/analysis/AreaMeasurementAnalysis.js +1 -1
- package/analysis/DimensionAnalysis.js +1 -1
- package/analysis/DimensionSimpleStyle.js +1 -1
- package/analysis/DirectLineMeasurementAnalysis.js +1 -1
- package/analysis/LengthDimension.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/analysis/SlicePlane.js +1 -1
- package/analysis/ViewshedAnalysis.js +1 -1
- package/applications/Components/sanitizerUtils.d.ts +3 -0
- package/applications/Components/sanitizerUtils.js +5 -0
- package/applications/MapViewer/layerUtils.d.ts +3 -0
- package/applications/MapViewer/layerUtils.js +5 -0
- package/applications/SceneViewer/layerUtils.d.ts +2 -2
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{a08ce98672ab94d19613.js → 04e558a970c6a77f243e.js} +1 -1
- package/assets/esri/core/workers/chunks/0d99579d8cdeddc0fc9c.js +1 -0
- package/assets/esri/core/workers/chunks/1443520c9fb23381f8d5.js +1 -0
- package/assets/esri/core/workers/chunks/1a7570bd2b79194ff94b.js +42 -0
- package/assets/esri/core/workers/chunks/{0ed4ec00ef16aa58a33d.js → 254c4f7e277ae9915dce.js} +1 -1
- package/assets/esri/core/workers/chunks/2d51d0a24cdc89bafa1c.js +1 -0
- package/assets/esri/core/workers/chunks/2d89e354eeadadca4f7f.js +1 -0
- package/assets/esri/core/workers/chunks/3f8cc157b65a9d570921.js +1 -0
- package/assets/esri/core/workers/chunks/{2254989ca3ff3960f2fe.js → 400a4c9fa62964f8fa1d.js} +1 -1
- package/assets/esri/core/workers/chunks/{58f403f956b7b3467344.js → 42da01bd3f401a017c0f.js} +1 -1
- package/assets/esri/core/workers/chunks/445ddf57d2f503a0b98b.js +1 -0
- package/assets/esri/core/workers/chunks/513dc2467e9b8b8c6df4.js +1 -0
- package/assets/esri/core/workers/chunks/52239e958a82ebcd2e7a.js +1 -0
- package/assets/esri/core/workers/chunks/{e980a81c4d1e05f07141.js → 53e43798d08ad2075c1f.js} +1 -1
- package/assets/esri/core/workers/chunks/55ce214a10fb6fc2e901.js +1 -0
- package/assets/esri/core/workers/chunks/{a6bcae413e62cd879b46.js → 5859e425c9bca96b6c80.js} +1 -1
- package/assets/esri/core/workers/chunks/5bfccd5dffda74740aa4.js +1 -0
- package/assets/esri/core/workers/chunks/66c8816e91e3f9e214d4.js +346 -0
- package/assets/esri/core/workers/chunks/{948c5454881e661c3bdc.js → 78a57f5aeb277b84b3da.js} +1 -1
- package/assets/esri/core/workers/chunks/7c56740cac444419e5b4.js +1 -0
- package/assets/esri/core/workers/chunks/{7f14d6cb754c7e94748c.js → 827919fe23e06e40a330.js} +139 -115
- package/assets/esri/core/workers/chunks/8599df135928d73da4a3.js +1 -0
- package/assets/esri/core/workers/chunks/87986f31061c426e761b.js +1 -0
- package/assets/esri/core/workers/chunks/{7ae88c141a5d85e5bb88.js → 87a743df7d8556d5e253.js} +1 -1
- package/assets/esri/core/workers/chunks/8855f1a6224ffbd0bb66.js +1 -0
- package/assets/esri/core/workers/chunks/885e8e90dfe5dbd5053d.js +1 -0
- package/assets/esri/core/workers/chunks/93e66d9c49eaeb503bff.js +1 -0
- package/assets/esri/core/workers/chunks/974c6b0e3a1f1dd523fa.js +1 -0
- package/assets/esri/core/workers/chunks/aeabe203da7bcdd580cf.js +1 -0
- package/assets/esri/core/workers/chunks/beb01d400f1aa089d2dc.js +1 -0
- package/assets/esri/core/workers/chunks/c1a72e1dbd1ba7b41965.js +1 -0
- package/assets/esri/core/workers/chunks/c4065934637b820cad5b.js +1 -0
- package/assets/esri/core/workers/chunks/cc1328cacc4ac07eb548.js +1 -0
- package/assets/esri/core/workers/chunks/{05f2133f05f86266d8c7.js → d2139307f62ea8bf999a.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f58da371633967a61ca.js → ddb66fe6fcd0764daa7a.js} +1 -1
- package/assets/esri/core/workers/chunks/{70e5848aa372475fc8fa.js → eac7af86166c09c6a9be.js} +1 -1
- package/assets/esri/core/workers/chunks/{243eb8a317333ec2715b.js → f3e179b48bca50c94538.js} +1 -1
- package/assets/esri/core/workers/chunks/{7317346ed8d7c5bb859d.js → f537a02dc2fc9e6435a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{7e1906d35a764f7f10b0.js → fe1129f03476825a7344.js} +1 -1
- package/chunks/DefaultMaterial.glsl.js +30 -28
- package/chunks/RealisticTree.glsl.js +25 -22
- package/chunks/aiServices.js +1 -1
- package/config.js +1 -1
- package/core/LRUCache.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/urlUtils.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/core/workers/WorkerHandle.js +1 -1
- package/interfaces.d.ts +69 -25
- package/kernel.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/support/arcgisLayers.js +1 -1
- package/layers/support/fetchService.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/package.json +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/loadUtils.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToDataModelFactories.js +1 -1
- package/rest/support/TranslateParameters.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/WaterSymbol3DLayer.js +1 -1
- package/symbols/support/jsonUtils.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
- package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SLodHandling.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/makeScheduleFunction.js +1 -1
- package/views/3d/layers/support/symbolColorUtils.js +1 -1
- package/views/3d/state/controllers/FovController.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstanceColor.glsl.js +11 -0
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/MaskedColor.glsl.js +18 -0
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +40 -26
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +35 -24
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +12 -8
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +3 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +26 -8
- package/views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4sPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatDrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatsPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix3DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix3PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4sDrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4sPassUniform.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/LineOfSight/LineOfSightTarget.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/support/ItemList.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.js +1 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/widgets/support/symbolPreviewUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0dbb350ce651bc236ec8.js +0 -1
- package/assets/esri/core/workers/chunks/0ff6f15d46d7ddf6fe4d.js +0 -1
- package/assets/esri/core/workers/chunks/1f559f1e7f0bc0f4bf20.js +0 -346
- package/assets/esri/core/workers/chunks/462cc6966d060be59c7c.js +0 -1
- package/assets/esri/core/workers/chunks/4a805e7a57d25c4b595f.js +0 -66
- package/assets/esri/core/workers/chunks/58f92100b1b2343111c6.js +0 -1
- package/assets/esri/core/workers/chunks/5dcc8fa321f0a7c49f36.js +0 -1
- package/assets/esri/core/workers/chunks/5e539ce4751bcfa57145.js +0 -1
- package/assets/esri/core/workers/chunks/6194636638b0439fccd8.js +0 -1
- package/assets/esri/core/workers/chunks/622c0552ca3cd674d46c.js +0 -1
- package/assets/esri/core/workers/chunks/632d1a1287dde980479e.js +0 -1
- package/assets/esri/core/workers/chunks/64f5f27e7c5649d79cbc.js +0 -1
- package/assets/esri/core/workers/chunks/658e82c9b722852e02d0.js +0 -1
- package/assets/esri/core/workers/chunks/679d7baea233faf3fdbc.js +0 -1
- package/assets/esri/core/workers/chunks/7aef81778155be373d3e.js +0 -1
- package/assets/esri/core/workers/chunks/8b93cd4132934b0d7d39.js +0 -1
- package/assets/esri/core/workers/chunks/95507ff0a243e451b99e.js +0 -1
- package/assets/esri/core/workers/chunks/97b69fec3e87f11210ba.js +0 -1
- package/assets/esri/core/workers/chunks/a250a5c6e055e33bd25c.js +0 -1
- package/assets/esri/core/workers/chunks/b4273381dc069f4e1fa2.js +0 -1
- package/assets/esri/core/workers/chunks/b72137c63b7f2a525d9e.js +0 -1
- package/assets/esri/core/workers/chunks/c2264451d12f1fbaad22.js +0 -1
- package/assets/esri/core/workers/chunks/c6c86cbe65a58c3093ae.js +0 -1
- package/assets/esri/core/workers/chunks/fe3703ec198cbfebec30.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/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 l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}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 R,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as w,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as N}from"../../webgl.js";import{innerAtmosphereFadeStart as H}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as y}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthFormat as v,ColorFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as G,isColorOrColorEmission as q}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as V}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as j}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as B}from"../effects/RenderNodes.js";import{RenderPluginManager as Q}from"../effects/RenderPluginManager.js";import{Blit as W}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as k,renderHighlightBuffer as z}from"../effects/highlight/Highlight.js";import{OITBlend as Y}from"../effects/transparency/OITBlend.js";import{AnimationTimer as X}from"./AnimationTimer.js";import{AnimationTimeStep as K}from"./AnimationTimeStep.js";import{RenderRequestType as J}from"./basicInterfaces.js";import{BoundingInfo as Z}from"./BoundingInfo.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as ee,DepthRangeMode as te}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as re}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ie}from"./MainFramebuffer.js";import{RenderOccludedFlag as se}from"./Material.js";import{OITPass as ae}from"./OITPass.js";import{RenderContext as ne,defaultRenderOccludedMask as he}from"./RenderContext.js";import{RendererBase as oe}from"./RendererBase.js";import{RendererTarget as de}from"./rendererUtils.js";import{setupFeatureDefaults as le,RenderFeature as _e}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as pe}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as me,SnapshotSlot as ge}from"./ShadowMap.js";import fe from"./SliceHelper.js";import{Transparency as be}from"./edgeRendering/interfaces.js";import{MergedRenderer as Ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Te}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Ee,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Pe}from"../../../support/RenderState.js";import{PixelFormat as Se,PixelType as Ce,FramebufferBit as we,ColorAttachment1 as Ie,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let De=class extends oe{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=w(0,0,0,1),this._sliceHelper=new fe,this._blit=null,this._oitblend=null,this.sceneDepthRange=m($.infinite),this._state=m(Pe.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new K,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=m(le(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ie(this.fboCache),this.performanceInfo=new Ee(this._rctx),this._shadowMap=new me(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(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(G.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ne(this._rctx,this._shadowMap,r),this._nodes=new B(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([_((()=>e.view.state.camera),(()=>n()),u),_((()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(be.TRANSPARENT):()=>{},n()}),p),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):I;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=j),u),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),c),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),c),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),p)])}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,Z.prune(),Ae.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=le(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(_e.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(_e.WaterReflection))}get _hasHighlights(){return this._plugins.produces(G.Highlight,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.DRAPED_MATERIAL,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(G.Highlight,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(_e.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(_e.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(_e.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");l(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:Ve(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),c)),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,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){if(null!=e.environment.weather){const t=e.environment.weather;this._bindParameters.weather=t,this._bindParameters.snowCover=!!e.weatherVisible&&null!=t&&"snowy"===t.type&&"enabled"===t.snowCover}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 slice(e){this._sliceHelper.update(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)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&0!==(this.plugins.renderOccludedFlags&se.OccludeAndTransparentStencil)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(G.Color,pe.INTEGRATED_MESH)&&this._plugins.produces(G.Color,pe.OCCLUDED_GROUND)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(G.Color,...ve),has.water=this._plugins.produces(G.Normal,pe.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new X(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=de.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 Te(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=re,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,c=e===Pe.IDLE?r:i,m=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,c,m),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=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/p,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=de.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===de.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),d=this._nodes.produces(D.FINAL),l=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,_=l?G.ColorEmission:G.Color;this._renderContext.time=t,this._renderContext.output=_,this._bindParameters.oitPass=ae.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const u=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(),s.setGLViewport(this._rctx);const p=this._framebuffer,c=p.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(G.Color,...Le);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a,r===de.Screenshot),this._ensureBindParametersSSR(t),this._precompileShaders(m,g,_),this._renderContext.output=_,p.bind(),this._bindParameters.mainDepth=p.depth.attachment,this._renderOpaque(m),this._renderTransparent(g,m,_),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),p.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),p.update((e=>this._renderNodes(N.VIEWSHED,e))),p.update((e=>this._renderNodes(N.LASERLINES,e))),p.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),this._pluginInput.release(N.FOCUSAREA),p.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(s,this._bindParameters.lighting.mainLight.direction,f);const b=r===de.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;p.update((e=>this._renderNodes(D.COMPOSITE,e))),this._shadowMap.disposeOffscreenBuffers();const A=!(r!==de.Default||d||o&&!i),T=this._pluginInput.get(D.COMPOSITE),E=A?M:this.fboCache.acquire(T.fbo.width,T.fbo.height,N.ANTIALIASING),R=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,E):this._blitFBO(T,E,!1);let P;this._pluginInput.set(N.ANTIALIASING,R),this._hasHUDHighlights?(this._renderHUD(V.NotOccluded,R,_),P=this._renderNodes(N.HIGHLIGHTS,R)):(P=this._renderNodes(N.HIGHLIGHTS,R),this._renderHUD(V.NotOccluded,P,_));const S=this._renderNodes(N.MAGNIFIER,P);return o&&!i&&r===de.Default&&!d&&this._blitFBO(S),d?(S.attachDepth(p.depth),this._blitFBO(this._renderNodes(D.FINAL,S)),S.detachDepth()):this._pluginInput.set(D.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),p.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==de.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Te(this._pluginInput.get(D.FINAL),b)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=G.Depth,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(pe.OCCLUSION_PIXELS),this._plugins.precompile(pe.LINE_CALLOUTS),this._precompileHUD(V.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(V.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(G.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(N.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(Re.FOCUS_AREA_MASK),e}_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(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===J.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(I),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],Se.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Se.RGBA,Ce.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,I),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===be.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(G.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ge.ExcludeHighlight),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(G.Shadow),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap),s.moveSnapshot(ge.Highlight),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.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){t.bindFbo();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(G.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(N.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(we.STENCIL),this._renderGeometryWithoutNormals(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(Re.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_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",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this.renderAllGeometry(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.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=G.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(we.DEPTH|we.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",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderOpaqueAndTransparentGeometry(G.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.zero;const t=ee(e,this._plugins.plugins,this.stage.layers,te.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<H)return void(this.sceneDepthRange.value=$.infinite);const t=e.clone();t.near=y,t.far=1e10;const r=ee(t,this._plugins.plugins,this.stage.layers,te.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(G.Normal),this._needsDepth&&this._precompileAllGeometry(G.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(G.ShadowHighlight),this._precompileShadowCascades(G.ShadowExcludeHighlight),this._precompileShadowCascades(G.ShadowHighlight)):this._precompileShadowCascades(G.Shadow)),this._shadowAccumulator.active&&this._precompileAllGeometry(G.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",U.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._renderGeometryWithNormals(G.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(N.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(pe.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,...Me);this._renderContext.renderOccludedMask=he}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>se.Occlude&&this._plugins.render(pe.OCCLUDED_GROUND),this.renderSlots(e,...Me),this._renderContext.renderOccludedMask=he}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(pe.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(G.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(G.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(...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ye)}_precompileOpaqueGeometry(){this._plugins.precompile(...xe)}_renderOpaqueGeometry(){this._plugins.render(...xe)}_renderTransparentGeometry(){this._plugins.render(...Le)}get _hasTransparentTerrain(){return this._plugins.produces(G.Color,pe.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(pe.TRANSPARENT_TERRAIN);if(!q(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,I),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,pe.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",U.RGBA4UNORM),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(pe.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===V.Occluded){const e=()=>this._plugins.render(pe.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(v.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(pe.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=G.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...ve),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===V.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(v.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(v.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===V.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...ve)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(G.ShadowHighlight,pe.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>k?U.RG8UINT:U.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=G.Highlight,t.bindFramebuffer(a.fbo),z(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ue),this._rctx.clear(we.DEPTH),this._renderHUDElements(V.Both)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...Le)}_renderOIT(e,t,r=V.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=ae.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,U.RGBA16FLOAT),_=t===G.ColorEmission;_&&l.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ie,U.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,C),n(),l.detachDepth(),h.oitPass=ae.FrontFace;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),a?u.acquireDepth(v.DEPTH16):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(I,!!a),n(),u.detachDepth(),h.oitPass=ae.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(we.COLOR)):this._framebuffer.bind(),this._oitblend??=new Y(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(G.Color,...xe);if(t){this._plugins.render(pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN);const e=this._framebuffer;e.update((e=>this._renderNodes(N.OPAQUE_TERRAIN,e))),e.bind(),this._plugins.render(pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS)}const r=this._framebuffer;r.update((e=>this._renderNodes(D.OPAQUE,e,t))),this.fboCache.debugCallback?.(D.OPAQUE,r.color.fbo),r.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(be.OPAQUE)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(pe.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry()),i.update((t=>this._renderNodes(D.TRANSPARENT,t,e))),this.fboCache.debugCallback?.(D.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(pe.LINE_CALLOUTS),this._renderEdges(be.TRANSPARENT);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(V.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(V.Occluded,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(be.OPAQUE),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(be.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(V.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(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=M,r=!0){return this._blit??=new W(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:(T(Ge,this._bindParameters.camera.viewMatrix),T(Fe,this._bindParameters.camera.projectionMatrix),E(qe,Ge,Fe),E(qe,this._renderContext.lastFrameCamera.viewMatrix,qe),E(qe,this._renderContext.lastFrameCamera.projectionMatrix,qe),this._reprojectionMatrix=qe);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(J.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})],De.prototype,"fullResolutionAtmosphere",null),e([f()],De.prototype,"_edgeView",void 0),e([f()],De.prototype,"updating",null),De=e([b("esri.views.3d.webgl-engine.lib.Renderer")],De),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ne||(Ne={}));const He=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL],ye=[pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],xe=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS],Le=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],ve=[pe.LINE_CALLOUTS_HUD_DEPTH,pe.HUD_MATERIAL,pe.LABEL_MATERIAL],Ue=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_TERRAIN,pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN],Fe=P(),Ge=P(),qe=P();function Ve(e){return t=>e.immediate.schedule(t)}export{De 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 l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}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 R,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as w,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as N}from"../../webgl.js";import{innerAtmosphereFadeStart as H}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as y}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthFormat as v,ColorFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as G,isColorOrColorEmission as q}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as V}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as j}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as B}from"../effects/RenderNodes.js";import{RenderPluginManager as Q}from"../effects/RenderPluginManager.js";import{Blit as W}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as k,renderHighlightBuffer as z}from"../effects/highlight/Highlight.js";import{OITBlend as Y}from"../effects/transparency/OITBlend.js";import{AnimationTimer as X}from"./AnimationTimer.js";import{AnimationTimeStep as K}from"./AnimationTimeStep.js";import{RenderRequestType as J}from"./basicInterfaces.js";import{BoundingInfo as Z}from"./BoundingInfo.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as ee,DepthRangeMode as te}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as re}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ie}from"./MainFramebuffer.js";import{RenderOccludedFlag as se}from"./Material.js";import{OITPass as ae}from"./OITPass.js";import{RenderContext as ne,defaultRenderOccludedMask as he}from"./RenderContext.js";import{RendererBase as oe}from"./RendererBase.js";import{RendererTarget as de}from"./rendererUtils.js";import{setupFeatureDefaults as le,RenderFeature as _e}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as pe}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as me,SnapshotSlot as ge}from"./ShadowMap.js";import fe from"./SliceHelper.js";import{Transparency as be}from"./edgeRendering/interfaces.js";import{MergedRenderer as Ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Te}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Ee,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Pe}from"../../../support/RenderState.js";import{PixelFormat as Se,PixelType as Ce,FramebufferBit as we,ColorAttachment1 as Ie,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let De=class extends oe{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=w(0,0,0,1),this._sliceHelper=new fe,this._blit=null,this._oitblend=null,this.sceneDepthRange=m($.infinite),this._state=m(Pe.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new K,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=m(le(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ie(this.fboCache),this.performanceInfo=new Ee(this._rctx),this._shadowMap=new me(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(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(G.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ne(this._rctx,this._shadowMap,r),this._nodes=new B(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([_((()=>e.view.state.camera),(()=>n()),u),_((()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(be.TRANSPARENT):()=>{},n()}),p),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):I;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=j),u),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),c),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),c),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._shadowAccumulator=null,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,Z.prune(),Ae.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=le(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(_e.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(_e.WaterReflection))}get _hasHighlights(){return this._plugins.produces(G.Highlight,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.DRAPED_MATERIAL,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(G.Highlight,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(_e.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(_e.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(_e.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");l(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:Ve(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),c)),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,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){if(null!=e.environment.weather){const t=e.environment.weather;this._bindParameters.weather=t,this._bindParameters.snowCover=!!e.weatherVisible&&null!=t&&"snowy"===t.type&&"enabled"===t.snowCover}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 slice(e){this._sliceHelper.update(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)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&0!==(this.plugins.renderOccludedFlags&se.OccludeAndTransparentStencil)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(G.Color,pe.INTEGRATED_MESH)&&this._plugins.produces(G.Color,pe.OCCLUDED_GROUND)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(G.Color,...ve),has.water=this._plugins.produces(G.Normal,pe.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new X(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=de.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 Te(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=re,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,c=e===Pe.IDLE?r:i,m=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,c,m),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=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/p,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=de.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===de.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),d=this._nodes.produces(D.FINAL),l=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,_=l?G.ColorEmission:G.Color;this._renderContext.time=t,this._renderContext.output=_,this._bindParameters.oitPass=ae.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const u=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(),s.setGLViewport(this._rctx);const p=this._framebuffer,c=p.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(G.Color,...Le);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a,r===de.Screenshot),this._ensureBindParametersSSR(t),this._precompileShaders(m,g,_),this._renderContext.output=_,p.bind(),this._bindParameters.mainDepth=p.depth.attachment,this._renderOpaque(m),this._renderTransparent(g,m,_),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),p.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),p.update((e=>this._renderNodes(N.VIEWSHED,e))),p.update((e=>this._renderNodes(N.LASERLINES,e))),p.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),this._pluginInput.release(N.FOCUSAREA),p.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(s,this._bindParameters.lighting.mainLight.direction,f);const b=r===de.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;p.update((e=>this._renderNodes(D.COMPOSITE,e))),this._shadowMap.disposeOffscreenBuffers();const A=!(r!==de.Default||d||o&&!i),T=this._pluginInput.get(D.COMPOSITE),E=A?M:this.fboCache.acquire(T.fbo.width,T.fbo.height,N.ANTIALIASING),R=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,E):this._blitFBO(T,E,!1);let P;this._pluginInput.set(N.ANTIALIASING,R),this._hasHUDHighlights?(this._renderHUD(V.NotOccluded,R,_),P=this._renderNodes(N.HIGHLIGHTS,R)):(P=this._renderNodes(N.HIGHLIGHTS,R),this._renderHUD(V.NotOccluded,P,_));const S=this._renderNodes(N.MAGNIFIER,P);return o&&!i&&r===de.Default&&!d&&this._blitFBO(S),d?(S.attachDepth(p.depth),this._blitFBO(this._renderNodes(D.FINAL,S)),S.detachDepth()):this._pluginInput.set(D.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),p.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==de.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Te(this._pluginInput.get(D.FINAL),b)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=G.Depth,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(pe.OCCLUSION_PIXELS),this._plugins.precompile(pe.LINE_CALLOUTS),this._precompileHUD(V.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(V.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(G.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(N.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(Re.FOCUS_AREA_MASK),e}_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(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===J.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(I),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],Se.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Se.RGBA,Ce.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,I),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===be.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(G.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ge.ExcludeHighlight),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(G.Shadow),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap),s.moveSnapshot(ge.Highlight),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.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){t.bindFbo();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(G.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(N.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(we.STENCIL),this._renderGeometryWithoutNormals(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(Re.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_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",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this.renderAllGeometry(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.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=G.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(we.DEPTH|we.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",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderOpaqueAndTransparentGeometry(G.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.zero;const t=ee(e,this._plugins.plugins,this.stage.layers,te.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<H)return void(this.sceneDepthRange.value=$.infinite);const t=e.clone();t.near=y,t.far=1e10;const r=ee(t,this._plugins.plugins,this.stage.layers,te.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(G.Normal),this._needsDepth&&this._precompileAllGeometry(G.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(G.ShadowHighlight),this._precompileShadowCascades(G.ShadowExcludeHighlight),this._precompileShadowCascades(G.ShadowHighlight)):this._precompileShadowCascades(G.Shadow)),this._shadowAccumulator.active&&this._precompileAllGeometry(G.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",U.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._renderGeometryWithNormals(G.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(N.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(pe.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,...Me);this._renderContext.renderOccludedMask=he}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>se.Occlude&&this._plugins.render(pe.OCCLUDED_GROUND),this.renderSlots(e,...Me),this._renderContext.renderOccludedMask=he}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(pe.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(G.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(G.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(...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ye)}_precompileOpaqueGeometry(){this._plugins.precompile(...xe)}_renderOpaqueGeometry(){this._plugins.render(...xe)}_renderTransparentGeometry(){this._plugins.render(...Le)}get _hasTransparentTerrain(){return this._plugins.produces(G.Color,pe.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(pe.TRANSPARENT_TERRAIN);if(!q(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,I),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,pe.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",U.RGBA4UNORM),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(pe.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===V.Occluded){const e=()=>this._plugins.render(pe.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(v.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(pe.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=G.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...ve),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===V.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(v.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(v.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===V.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...ve)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(G.ShadowHighlight,pe.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>k?U.RG8UINT:U.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=G.Highlight,t.bindFramebuffer(a.fbo),z(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ue),this._rctx.clear(we.DEPTH),this._renderHUDElements(V.Both)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...Le)}_renderOIT(e,t,r=V.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=ae.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,U.RGBA16FLOAT),_=t===G.ColorEmission;_&&l.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ie,U.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,C),n(),l.detachDepth(),h.oitPass=ae.FrontFace;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),a?u.acquireDepth(v.DEPTH16):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(I,!!a),n(),u.detachDepth(),h.oitPass=ae.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(we.COLOR)):this._framebuffer.bind(),this._oitblend??=new Y(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(G.Color,...xe);if(t){this._plugins.render(pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN);const e=this._framebuffer;e.update((e=>this._renderNodes(N.OPAQUE_TERRAIN,e))),e.bind(),this._plugins.render(pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS)}const r=this._framebuffer;r.update((e=>this._renderNodes(D.OPAQUE,e,t))),this.fboCache.debugCallback?.(D.OPAQUE,r.color.fbo),r.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(be.OPAQUE)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(pe.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry()),i.update((t=>this._renderNodes(D.TRANSPARENT,t,e))),this.fboCache.debugCallback?.(D.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(pe.LINE_CALLOUTS),this._renderEdges(be.TRANSPARENT);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(V.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(V.Occluded,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(be.OPAQUE),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(be.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(V.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(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=M,r=!0){return this._blit??=new W(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:(T(Ge,this._bindParameters.camera.viewMatrix),T(Fe,this._bindParameters.camera.projectionMatrix),E(qe,Ge,Fe),E(qe,this._renderContext.lastFrameCamera.viewMatrix,qe),E(qe,this._renderContext.lastFrameCamera.projectionMatrix,qe),this._reprojectionMatrix=qe);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(J.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})],De.prototype,"fullResolutionAtmosphere",null),e([f()],De.prototype,"_edgeView",void 0),e([f()],De.prototype,"updating",null),De=e([b("esri.views.3d.webgl-engine.lib.Renderer")],De),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ne||(Ne={}));const He=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL],ye=[pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],xe=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS],Le=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],ve=[pe.LINE_CALLOUTS_HUD_DEPTH,pe.HUD_MATERIAL,pe.LABEL_MATERIAL],Ue=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_TERRAIN,pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN],Fe=P(),Ge=P(),qe=P();function Ve(e){return t=>e.immediate.schedule(t)}export{De 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as u,G as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as A}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as F,ShadowCastAccumulateIndex as R}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as C}from"../../../support/Scheduler.js";import{SizedPixelFormat as j,PixelFormat as P,PixelType as q,TextureWrapMode as D,FramebufferBit as T}from"../../../webgl/enums.js";import{FramebufferObject as E}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as O}from"../../../webgl/TextureDescriptor.js";import{vertexCount as M}from"../../../webgl/Util.js";let B=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new I(new F(R.PRIMARY),(()=>this._requestRenderIfEnabled())),this._contextSet=new I(new F(R.CONTEXT),(()=>this._requestRenderIfEnabled())),this._passParameters=new _,this._depthRange=d.zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(C.SHADOW_ACCUMULATOR,this),o((()=>this._previewing),(()=>this._requestRenderIfEnabled()),a),o((()=>2===this._numActive),(()=>this._numActiveChanged()),a),o((()=>this._depthRange),(()=>this._invalidateAccumulationSets()),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some((t=>t.active))}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every((t=>t.doneAccumulating))}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce(((t,e)=>t+(e.active?1:0)),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:P.RG,internalFormat:j.RG8}:{pixelFormat:P.RED,internalFormat:j.R8}}get running(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some((t=>t.running))}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every((t=>0===t.progress)))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(L,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,P.RGBA,q.UNSIGNED_BYTE,U),U[R.PRIMARY]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new O;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=D.CLAMP_TO_EDGE,new E(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(T.COLOR))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,M(this._vao,"geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,M(this._vao,"geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],B.prototype,"_fbo",void 0),t([h()],B.prototype,"_depthRange",void 0),t([h()],B.prototype,"_previewing",void 0),t([h()],B.prototype,"_accumulationRenderer",void 0),t([h()],B.prototype,"_refining",null),t([h()],B.prototype,"active",null),t([h()],B.prototype,"canAccumulate",null),t([h()],B.prototype,"_doneAccumulating",null),t([h()],B.prototype,"_opacityFromElevation",null),t([h()],B.prototype,"_numActive",null),t([h()],B.prototype,"_pixelFormat",null),t([h()],B.prototype,"running",null),B=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],B);const L=6,U=new Uint8Array(4);class I{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(A,this.configuration),t.precompile(x,this.configuration)}}export{B as ShadowAccumulator};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as u,G as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as A}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as F,ShadowCastAccumulateIndex as R}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as C}from"../../../support/Scheduler.js";import{SizedPixelFormat as j,PixelFormat as P,PixelType as q,TextureWrapMode as D,FramebufferBit as T}from"../../../webgl/enums.js";import{FramebufferObject as E}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as O}from"../../../webgl/TextureDescriptor.js";import{vertexCount as M}from"../../../webgl/Util.js";let B=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new I(new F(R.PRIMARY),(()=>this._requestRenderIfEnabled())),this._contextSet=new I(new F(R.CONTEXT),(()=>this._requestRenderIfEnabled())),this._passParameters=new _,this._depthRange=d.zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(C.SHADOW_ACCUMULATOR,this),o((()=>this._previewing),(()=>this._requestRenderIfEnabled()),a),o((()=>2===this._numActive),(()=>this._numActiveChanged()),a),o((()=>this._depthRange),(()=>this._invalidateAccumulationSets()),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy();this._contextSet=null,this._primarySet=null,this._bindParameters.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some((t=>t.active))}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every((t=>t.doneAccumulating))}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce(((t,e)=>t+(e.active?1:0)),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:P.RG,internalFormat:j.RG8}:{pixelFormat:P.RED,internalFormat:j.R8}}get running(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some((t=>t.running))}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every((t=>0===t.progress)))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(L,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,P.RGBA,q.UNSIGNED_BYTE,U),U[R.PRIMARY]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new O;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=D.CLAMP_TO_EDGE,new E(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(T.COLOR))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,M(this._vao,"geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,M(this._vao,"geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],B.prototype,"_fbo",void 0),t([h()],B.prototype,"_depthRange",void 0),t([h()],B.prototype,"_previewing",void 0),t([h()],B.prototype,"_accumulationRenderer",void 0),t([h()],B.prototype,"_refining",null),t([h()],B.prototype,"active",null),t([h()],B.prototype,"canAccumulate",null),t([h()],B.prototype,"_doneAccumulating",null),t([h()],B.prototype,"_opacityFromElevation",null),t([h()],B.prototype,"_numActive",null),t([h()],B.prototype,"_pixelFormat",null),t([h()],B.prototype,"running",null),B=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],B);const L=6,U=new Uint8Array(4);class I{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(A,this.configuration),t.precompile(x,this.configuration)}}export{B as ShadowAccumulator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/has.js";import{someMap as r}from"../../../../core/MapUtils.js";import t from"../../../../core/PooledArray.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as o}from"../../../../chunks/sphere.js";import{OverlayTarget as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/has.js";import{someMap as r}from"../../../../core/MapUtils.js";import t from"../../../../core/PooledArray.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as o}from"../../../../chunks/sphere.js";import{OverlayTarget as d}from"../../terrain/Intersector.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{ChangeSet as h}from"./ChangeSet.js";import{StoreResults as c}from"./IntersectorInterfaces.js";import{IntersectorResult as l}from"./IntersectorResult.js";import{IntersectorType as p}from"./IntersectorType.js";import{RenderOccludedFlag as m}from"./Material.js";import{DirtyOperation as u,DirtyState as g}from"./ModelDirtyTypes.js";import{RendererBase as y}from"./RendererBase.js";import{RenderSlot as _}from"./RenderSlot.js";import{noBudget as f}from"../../../support/Scheduler.js";let R=class extends y{constructor(e){super(e),this._pending=new G,this._changes=new h,this._sortedRenderers=new t,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.clear(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return r(this.renderers,(r=>r.hasHighlight(e)))}get hasWater(){return this._hasWater}get rendersOccludedDraped(){for(const e of this.renderers.values())if(0!==e.numGeometries&&e.renderOccludedFlags&~m.Occlude)return!0;return!1}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,f,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=r(this.renderers,(e=>{const r=e.produces.get(_.DRAPED_MATERIAL);return!!r&&r(a.Highlight)})),this._hasWater=r(this.renderers,(e=>{const r=e.produces.get(_.DRAPED_WATER);return!!r&&r(a.Normal)}))),this.notifyChange("updating"),!0)}rendererAdded(){this._sortedRenderers.clear()}rendererRemoved(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);s&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=this._changes.updates.pushNew();e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case g.TRANSFORMATION:case g.GEOMETRY:return this._notifyGraphicGeometryChanged(e);case g.VISIBILITY:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll((t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r)),r}precompile(e){return this._sortedRenderers.reduce(((r,t)=>t.precompile(e)||r),!1)}render(e){this._sortedRenderers.forAll((r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)}))}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere[0]-n.boundingSphere[3]<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere[0]+n.boundingSphere[3]>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort(((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0)))}}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes)),this._changes.updates.filterInPlace((({renderGeometry:e})=>!this._pending.has(e))),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],C[0]=t[0]-s,C[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectDraped(e,i,C,((t,s,o)=>{v(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)}),r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(o(e.boundingSphere))),e}get test(){}};e([s({constructOnly:!0})],R.prototype,"drapeSource",void 0),e([s({constructOnly:!0})],R.prototype,"rendererContext",void 0),e([s()],R.prototype,"updating",null),e([s()],R.prototype,"rctx",null),e([s()],R.prototype,"_localOriginFactory",null),e([s({readOnly:!0})],R.prototype,"isEmpty",null),e([s()],R.prototype,"_geometries",void 0),R=e([i("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],R);class G{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function v(e,r,t,s,i,n,o){const a=new d(n,o,r),h=r=>{r.set(p.OVERLAY,a,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&h(i.results.min),i.options.store!==c.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&h(i.results.max),i.options.store===c.ALL){const e=new l(i.ray);h(e),i.results.all.push(e)}}const C=n();export{R as SortedRenderGeometryRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,e as u,t as m}from"../../../../../chunks/vec32.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as A}from"../IntersectorType.js";import b from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=A.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDataMap.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlight(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=t===C.ShadowHighlight,a=!n&&!s,i=t!==C.ShadowExcludeHighlight;if(a)return i?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDataMap:o}=this;if(i){if(n){const e=r.highlight?.name;if(!e)return null;const t=o.get(e);return t?[t]:null}const e=o.get(V);return s?e?[e]:null:Array.from(o.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=p();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(0!==(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,b.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,b.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDataMap:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let p=0;if(!(m&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const f=o.lodLevel.get(h);if(m&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[f].freeTail(),m&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[f].freeTail(),t.every((e=>e.isEmpty))&&(t.forEach((e=>e.destroy())),u.delete(e))}}if(m&j.REMOVE)i.freeInstance(h);else if(m&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(m&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}p|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),p|=j.DEFAULT_ACTIVE;o.state.set(h,p),o.lodLevel.set(h,e)}else p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,p);if(null!=this._octreeCached){const e=!!(m&j.ACTIVE),t=!!(p&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&m&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d===0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("colorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=p(),Q=f(),Z=h(),$=p(),X=p(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,e as u,t as m}from"../../../../../chunks/vec32.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as b}from"../IntersectorType.js";import A from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=b.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDataMap.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlight(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=t===C.ShadowHighlight,a=!n&&!s,i=t!==C.ShadowExcludeHighlight;if(a)return i?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDataMap:o}=this;if(i){if(n){const e=r.highlight?.name;if(!e)return null;const t=o.get(e);return t?[t]:null}const e=o.get(V);return s?e?[e]:null:Array.from(o.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=p();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(0!==(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,A.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,A.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDataMap:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let p=0;if(!(m&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const f=o.lodLevel.get(h);if(m&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[f].freeTail(),m&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[f].freeTail(),t.every((e=>e.isEmpty))&&(t.forEach((e=>e.destroy())),u.delete(e))}}if(m&j.REMOVE)i.freeInstance(h);else if(m&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(m&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}p|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),p|=j.DEFAULT_ACTIVE;o.state.set(h,p),o.lodLevel.set(h,e)}else p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,p);if(null!=this._octreeCached){const e=!!(m&j.ACTIVE),t=!!(p&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&m&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d===0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("symbolColorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=p(),Q=f(),Z=h(),$=p(),X=p(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{q as e,i as r,c as t,n as s,d as a,l as i,g as o,e as n,o as l}from"../../../../chunks/vec32.js";import{ZEROS as c,create as m,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{EmissiveSourceMode as h}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{newLayout as d}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as f,isShadowRelatedOutput as T,is3DGeometryOutput as v,ShaderOutput as x,isColorOrColorEmission as g,isColorEmission as b}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as S}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as O}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as M}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as y}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{DepthTestFunction as R,CullFaceOptions as A,AlphaDiscardMode as I}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as P}from"../lib/Material.js";import{OITPolygonOffsetLimit as j}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as E}from"../lib/RayIntersections.js";import{RenderSlot as L}from"../lib/RenderSlot.js";import{VertexAttribute as
|
|
5
|
+
import{q as e,i as r,c as t,n as s,d as a,l as i,g as o,e as n,o as l}from"../../../../chunks/vec32.js";import{ZEROS as c,create as m,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{EmissiveSourceMode as h}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{newLayout as d}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as f,isShadowRelatedOutput as T,is3DGeometryOutput as v,ShaderOutput as x,isColorOrColorEmission as g,isColorEmission as b}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as S}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as O}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as M}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as y}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{DepthTestFunction as R,CullFaceOptions as A,AlphaDiscardMode as I}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as P}from"../lib/Material.js";import{OITPolygonOffsetLimit as j}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as E}from"../lib/RayIntersections.js";import{RenderSlot as L}from"../lib/RenderSlot.js";import{VertexAttribute as N}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as D}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as B}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as _}from"./internal/MaterialUtil.js";import{DefaultMaterialPassParameters as V,DefaultMaterialTechnique as z}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as U}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as q}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as k}from"../../../../webscene/support/AlphaCutoff.js";class W extends P{constructor(e,r){super(e,H),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[L.OPAQUE_MATERIAL,e=>(f(e)||T(e))&&!this.transparent],[L.TRANSPARENT_MATERIAL,e=>(f(e)||T(e))&&this.transparent&&this.parameters.writeDepth],[L.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(v(e)||T(e))&&this.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=F(this.parameters),this._configuration=new U(r.spherical)}isVisibleForOutput(e){return e!==x.Shadow&&e!==x.ShadowExcludeHighlight&&e!==x.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=k}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,c)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===h.Emissive&&this._hasEmissiveBase||this.parameters.emissiveSource===h.Color)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=!a&&!!t.normalTextureId,s.hasColorTexture=!!t.textureId,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.isInstanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.vvSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?S.Attribute:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??R.Less,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?A.None:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?M.WindingOrder:i&&"normal"===o?M.View:i&&"winding-order"===o?M.WindingOrder:M.None,s.instancedColor=t.hasInstancedColor,g(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.vvColor=!!t.vvColor,s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?y.Schematic:y.Normal:y.Disabled,s.hasMetallicRoughnessTexture=!a&&!!t.metallicRoughnessTextureId,s.emissionSource=a?O.None:null!=t.emissiveTextureId&&t.emissiveSource===h.Emissive?O.Texture:t.usePBR?t.emissiveSource===h.Emissive?O.EmissiveColor:O.SymbolColor:O.None,s.hasOcclusionTexture=!a&&!!t.occlusionTextureId,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.camera.relativeElevation<j,s.snowCover=r.snowCover,s.hasBloom=b(e),s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,c,m,u,h,d){if(null!=this.parameters.verticalOffset){const e=m.camera;r($,c[12],c[13],c[14]);let d=null;switch(m.viewingMode){case p.Global:d=s(X,$);break;case p.Local:d=t(X,K)}let f=0;const T=a(ee,$,e.eye),v=i(T),x=o(T,T,1/v);let g=null;this.parameters.screenSizePerspective&&(g=n(d,x)),f+=_(e,v,this.parameters.verticalOffset,g??0,this.parameters.screenSizePerspective),o(d,d,f),l(Z,d,m.transform.inverseRotation),u=a(Y,u,Z),h=a(J,h,Z)}E(e,m,u,h,D(m.verticalOffset),d)}createGLMaterial(e){return new G(e)}createBufferWriter(){return new B(this._vertexBufferLayout)}get transparent(){return Q(this.parameters)}}class G extends w{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?q:z,e)}}class H extends V{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function F(e){const r=d().vec3f(N.POSITION);e.normalType===S.Compressed?r.vec2i16(N.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(N.NORMAL),e.hasVertexTangents&&r.vec4f(N.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f16(N.UV0),e.hasVertexColors&&r.vec4u8(N.COLOR),e.hasSymbolColors&&r.vec4u8(N.SYMBOLCOLOR),C()&&r.vec4u8(N.OLIDCOLOR),r}function Q(e){const{drivenOpacity:r,opacity:t,externalColor:s,layerOpacity:a,texture:i,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,c=s[3];return r||t<1&&"replace"!==l||c<1&&"ignore"!==l||a<1||(null!=i||null!=o)&&n!==I.Opaque&&n!==I.Mask&&"replace"!==l}const Y=m(),J=m(),K=u(0,0,1),X=m(),Z=m(),$=m(),ee=m();export{G as DefaultGLMaterial,W as DefaultMaterial,H as DefaultMaterialParameters,Q as isTransparent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{unpackFloatRGBA as r}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as n}from"../../../../core/maybe.js";import{watch as o,initial as a,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as m,isMars as u}from"../../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{ChapmanAtmosphere as _}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as g}from"../../environment/CloudsComposition.js";import{Fog as w}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import v from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as j}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as y}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as b}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{BloomRenderNode as R}from"../effects/bloom/BloomRenderNode.js";import{ObjectAndLayerIDRenderNode as A}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as S}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as T}from"../effects/haze/Haze.js";import{Highlight as O}from"../effects/highlight/Highlight.js";import{ShadowHighlight as U}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as q}from"../effects/magnifier/Magnifier.js";import{SMAA as D}from"../effects/smaa/SMAA.js";import{SSAO as L}from"../effects/ssao/SSAO.js";import{Stars as M}from"../effects/stars/Stars.js";import{RenderRequestType as k}from"../lib/basicInterfaces.js";import E from"../lib/CompositingHelper.js";import{GLMaterialRepository as B}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as W}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as F}from"../lib/Renderer.js";import{RenderingContext as H}from"../lib/RenderingContext.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as P}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as N}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as I}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as z}from"./contextCache.js";import{removeLoadedShaderModules as K}from"./renderUtils.js";import{ScreenshotManager as V,ScreenshotContext as X}from"./ScreenshotManager.js";import{contextCache as Q}from"./testUtils.js";import{RenderState as J}from"../../../support/RenderState.js";import{noBudget as Y}from"../../../support/Scheduler.js";import{checkWebGLError as Z}from"../../../webgl/checkWebGLError.js";let $=class extends t{constructor(e){super(e),this.waterTextures=new I,this.olidRenderHelper=C()?new W:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.bloom=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:r}=t.view.resourceController;this.stippleTextures=N(this._rctx,r),this.markerTextures=P(this._rctx,r),this._techniques=new b(new y(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e))));const s=new B(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender()));this._compositingHelper=new E(this._rctx,this._techniques),this.renderer=new F(t,s,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),this.addHandles([o((()=>t.view.ready),(e=>{e&&this._createRenderNodes()}),a),o((()=>this.waterTextures?.updating),(()=>this.requestRender()),a),o((()=>t.view.qualityProfile),(e=>this.renderer?.updateRenderFeatures(e)),h)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new V(this._rctx,i,(e=>t.view.basemapTerrain.overlayManager.updateOverlays(Y,e.camera,k.BACKGROUND))),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=i(this._frameTask),this._techniques=n(this._techniques),this._componentObjects=n(this._componentObjects),this._screenshotManager=n(this._screenshotManager),n(this.renderer),this._textures=n(this._textures),n(this.waterTextures),n(this.markerTextures),n(this.stippleTextures),this._canvas=null,this._rctx=n(this._rctx)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new M({view:e}),m(e.spatialReference)||(t===f.Local?(new x({view:e}),this.bloom=new R({view:e})):u(e.spatialReference)?(new v({view:e}),this.bloom=new R({view:e})):(new _({view:e}),new g({view:e}),this.bloom=new R({view:e}),new T({view:e}),new w({view:e}))),new L({view:e,isEnabled:()=>this.renderer.hasSSAO}),new D({view:e,isEnabled:()=>this.renderer.hasSMAA}),new q({view:e}),new O({view:e}),new U({view:e,viewingMode:t}),new S({view:e}),C()&&new A({view:e})}requestRender(e=k.UPDATE){this._needsRender=!0,e===k.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,s,i,n,o=n){const a=i.constrainWindowSize(t,s,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const p=(e,t,s)=>r(t,e)*(s[1]-s[0])+s[0];let d=Number.MAX_VALUE;for(let r=0;r<a[2]*a[3];r++){const e=p(4*r,h,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(e){const r=e.pickDepth(t*i.pixelRatio,s*i.pixelRatio,i);null!=r&&d>r&&r!==i.nearFar[0]&&r!==i.nearFar[1]&&(d=r)}return d===Number.MAX_VALUE?void 0:d}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){K(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=k.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?k.UPDATE:k.BACKGROUND,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(k.BACKGROUND),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(k.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new X(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(t.mode===J.IDLE?s:k.UPDATE),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const i={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",i);if(null==n)return void s.getLogger(this).error("A WebGL2 context could not be created.");Z(n,!0),this._rctx=ee(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&s.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new j(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){this.test&&null!=this.test.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=d(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.stage.view.qualitySettings.maxTexturePixels})}};function ee(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,maxPreferredTexturePixels:t.view.qualitySettings.maxTexturePixels,newCache:r};if(Q.enabled){let t=te.get(e);return t?(t.configure(s),t.ref(),t):(t=new H(e,s),te.set(e,t),t.ref(),t)}return new H(e,s)}e([c({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([c({constructOnly:!0})],$.prototype,"stage",void 0),e([c()],$.prototype,"_rctx",void 0),e([c()],$.prototype,"_canvas",void 0),e([c()],$.prototype,"stippleTextures",void 0),e([c()],$.prototype,"markerTextures",void 0),e([c()],$.prototype,"waterTextures",void 0),e([c({readOnly:!0})],$.prototype,"olidRenderHelper",void 0),e([c()],$.prototype,"_textures",void 0),e([c({readOnly:!0})],$.prototype,"renderer",void 0),e([c()],$.prototype,"_screenshotManager",void 0),e([c()],$.prototype,"componentObjectCollection",null),e([c()],$.prototype,"_componentObjects",void 0),e([c()],$.prototype,"_needsUpdate",void 0),e([c()],$.prototype,"_needsWaterReflectionUpdate",void 0),$=e([l("esri.views.3d.webgl-engine.parts.RenderView")],$);const te=z();export{$ as RenderView};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{unpackFloatRGBA as r}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as n}from"../../../../core/maybe.js";import{watch as o,initial as a,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as m,isMars as u}from"../../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{ChapmanAtmosphere as _}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as g}from"../../environment/CloudsComposition.js";import{Fog as w}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import v from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as j}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as y}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as b}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{BloomRenderNode as R}from"../effects/bloom/BloomRenderNode.js";import{ObjectAndLayerIDRenderNode as A}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as S}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as T}from"../effects/haze/Haze.js";import{Highlight as O}from"../effects/highlight/Highlight.js";import{ShadowHighlight as U}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as q}from"../effects/magnifier/Magnifier.js";import{SMAA as D}from"../effects/smaa/SMAA.js";import{SSAO as L}from"../effects/ssao/SSAO.js";import{Stars as M}from"../effects/stars/Stars.js";import{RenderRequestType as k}from"../lib/basicInterfaces.js";import E from"../lib/CompositingHelper.js";import{GLMaterialRepository as B}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as W}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as F}from"../lib/Renderer.js";import{RenderingContext as H}from"../lib/RenderingContext.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as P}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as N}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as I}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as z}from"./contextCache.js";import{removeLoadedShaderModules as K}from"./renderUtils.js";import{ScreenshotManager as V,ScreenshotContext as X}from"./ScreenshotManager.js";import{contextCache as Q}from"./testUtils.js";import{RenderState as J}from"../../../support/RenderState.js";import{noBudget as Y}from"../../../support/Scheduler.js";import{checkWebGLError as Z}from"../../../webgl/checkWebGLError.js";let $=class extends t{constructor(e){super(e),this.waterTextures=new I,this.olidRenderHelper=C()?new W:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.bloom=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:r}=t.view.resourceController;this.stippleTextures=N(this._rctx,r),this.markerTextures=P(this._rctx,r),this._techniques=new b(new y(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e))));const s=new B(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender()));this._compositingHelper=new E(this._rctx,this._techniques),this.renderer=new F(t,s,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),this.addHandles([o((()=>t.view.ready),(e=>{e&&this._createRenderNodes()}),a),o((()=>this.waterTextures?.updating),(()=>this.requestRender()),a),o((()=>t.view.qualityProfile),(e=>this.renderer?.updateRenderFeatures(e)),h)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new V(this._rctx,i,(e=>t.view.basemapTerrain.overlayManager.updateOverlays(Y,e.camera,k.BACKGROUND))),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=i(this._frameTask),this._techniques=n(this._techniques),this._componentObjects=n(this._componentObjects),this._screenshotManager=n(this._screenshotManager),n(this.renderer),this._textures=n(this._textures),n(this.waterTextures),n(this.markerTextures),n(this.stippleTextures),this._canvas=null,this._rctx=n(this._rctx),this._set("renderer",null)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new M({view:e}),m(e.spatialReference)||(t===f.Local?(new x({view:e}),this.bloom=new R({view:e})):u(e.spatialReference)?(new v({view:e}),this.bloom=new R({view:e})):(new _({view:e}),new g({view:e}),this.bloom=new R({view:e}),new T({view:e}),new w({view:e}))),new L({view:e,isEnabled:()=>this.renderer.hasSSAO}),new D({view:e,isEnabled:()=>this.renderer.hasSMAA}),new q({view:e}),new O({view:e}),new U({view:e,viewingMode:t}),new S({view:e}),C()&&new A({view:e})}requestRender(e=k.UPDATE){this._needsRender=!0,e===k.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,s,i,n,o=n){const a=i.constrainWindowSize(t,s,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const p=(e,t,s)=>r(t,e)*(s[1]-s[0])+s[0];let d=Number.MAX_VALUE;for(let r=0;r<a[2]*a[3];r++){const e=p(4*r,h,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(e){const r=e.pickDepth(t*i.pixelRatio,s*i.pixelRatio,i);null!=r&&d>r&&r!==i.nearFar[0]&&r!==i.nearFar[1]&&(d=r)}return d===Number.MAX_VALUE?void 0:d}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){K(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=k.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?k.UPDATE:k.BACKGROUND,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(k.BACKGROUND),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(k.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new X(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(t.mode===J.IDLE?s:k.UPDATE),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const i={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",i);if(null==n)return void s.getLogger(this).error("A WebGL2 context could not be created.");Z(n,!0),this._rctx=ee(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&s.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new j(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){this.test&&null!=this.test.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=d(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.stage.view.qualitySettings.maxTexturePixels})}};function ee(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,maxPreferredTexturePixels:t.view.qualitySettings.maxTexturePixels,newCache:r};if(Q.enabled){let t=te.get(e);return t?(t.configure(s),t.ref(),t):(t=new H(e,s),te.set(e,t),t.ref(),t)}return new H(e,s)}e([c({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([c({constructOnly:!0})],$.prototype,"stage",void 0),e([c()],$.prototype,"_rctx",void 0),e([c()],$.prototype,"_canvas",void 0),e([c()],$.prototype,"stippleTextures",void 0),e([c()],$.prototype,"markerTextures",void 0),e([c()],$.prototype,"waterTextures",void 0),e([c({readOnly:!0})],$.prototype,"olidRenderHelper",void 0),e([c()],$.prototype,"_textures",void 0),e([c({readOnly:!0})],$.prototype,"renderer",void 0),e([c()],$.prototype,"_screenshotManager",void 0),e([c()],$.prototype,"componentObjectCollection",null),e([c()],$.prototype,"_componentObjects",void 0),e([c()],$.prototype,"_needsUpdate",void 0),e([c()],$.prototype,"_needsWaterReflectionUpdate",void 0),$=e([l("esri.views.3d.webgl-engine.parts.RenderView")],$);const te=z();export{$ as RenderView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"
|
|
5
|
+
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstanceColor.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/MaskedColor.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/TextureTransformUV.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../effects/weather/SnowCover.glsl.js";import"../lib/VertexAttribute.js";import"../materials/internal/MaterialUtil.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/DefaultMaterial.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ZEROS as e,freeze as t,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as r}from"../../../../symbols/support/materialUtils.js";import{isColorOrColorEmission as l}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as o}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{VertexNormalPassParameters as a,VertexNormalDrawParameters as n}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShaderModule as c}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as h,depthOnlyOutputBuffersOr as u}from"../core/shaderTechnique/ShaderTechnique.js";import{CullFaceOptions as m,DepthTestFunction as p,AlphaDiscardMode as d}from"../lib/basicInterfaces.js";import{RenderOccludedFlag as f}from"../lib/Material.js";import{oitPolygonOffset as b,getDrawBuffers as S,depthWrite as g,oitDepthTest as j,blending as v}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as y,stencilBaseAllZerosParams as P,stencilWriteMaskOn as x}from"../lib/StencilUtils.js";import{advancedMRRFactors as T}from"../materials/pbrUtils.js";import{D as O}from"../../../../chunks/DefaultMaterial.glsl.js";import{CompareFunction as
|
|
5
|
+
import{ZEROS as e,freeze as t,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as r}from"../../../../symbols/support/materialUtils.js";import{isColorOrColorEmission as l}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as o}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{VertexNormalPassParameters as a,VertexNormalDrawParameters as n}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShaderModule as c}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as h,depthOnlyOutputBuffersOr as u}from"../core/shaderTechnique/ShaderTechnique.js";import{CullFaceOptions as m,DepthTestFunction as p,AlphaDiscardMode as d}from"../lib/basicInterfaces.js";import{RenderOccludedFlag as f}from"../lib/Material.js";import{oitPolygonOffset as b,getDrawBuffers as S,depthWrite as g,oitDepthTest as j,blending as v}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as y,stencilBaseAllZerosParams as P,stencilWriteMaskOn as x}from"../lib/StencilUtils.js";import{advancedMRRFactors as T}from"../materials/pbrUtils.js";import{D as O}from"../../../../chunks/DefaultMaterial.glsl.js";import{CompareFunction as A}from"../../../webgl/enums.js";import{makePipelineState as C,cullingParams as M,defaultColorWrite as D}from"../../../webgl/renderState.js";import{alphaCutoff as L}from"../../../../webscene/support/AlphaCutoff.js";class w extends a{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=T,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=m.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrength=0,this.emissiveSource=r.Color,this.emissiveBaseColor=e,this.instancedDoublePrecision=!1,this.normalType=o.Attribute,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.externalColor=s(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=i(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=p.Less,this.textureAlphaMode=d.Blend,this.textureAlphaCutoff=L,this.textureAlphaPremultiplied=!1,this.renderOccluded=f.Occlude,this.isDecoration=!1}}class k extends n{constructor(){super(...arguments),this.origin=i(),this.slicePlaneLocalOrigin=this.origin}}class B extends h{constructor(e,t,i=new c(O,(()=>import("./DefaultMaterial.glsl.js")))){super(e,t,i),this.type="DefaultMaterialTechnique"}_makePipeline(e,t){const{oitPass:i,output:s,transparent:r,cullFace:o,customDepthTest:a,hasOccludees:n}=e;return C({blending:l(s)&&r?v(i):null,culling:I(e)?M(o):null,depthTest:{func:j(i,q(a))},depthWrite:g(e),drawBuffers:u(s,S(i,s)),colorWrite:D,stencilWrite:n?x:null,stencilTest:n?t?y:P:null,polygonOffset:b(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}function q(e){return e===p.Lequal?A.LEQUAL:A.LESS}function I(e){return e.cullFace!==m.None||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}export{k as DefaultMaterialDrawParameters,w as DefaultMaterialPassParameters,B as DefaultMaterialTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/RealisticTree.glsl.js";
|
|
5
|
+
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstanceColor.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/MaskedColor.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"../materials/internal/MaterialUtil.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/RealisticTree.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as e}from"../../core/maybe.js";import{
|
|
5
|
+
import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as e}from"../../core/maybe.js";import{throwIfAborted as n,isAbortError as i,onAbort as a}from"../../core/promiseUtils.js";import{watch as r,syncAndInitial as l,on as s,whenOnce as c}from"../../core/reactiveUtils.js";function u(t,n){t.interactive=!0;const{tool:i,view:r}=t;r.activeTool=i;let l=a(n,(()=>{r.activeTool===i&&(r.activeTool=null)}));return o((async o=>{await c((()=>!t.tool?.active),o),l=e(l)}),n)}function m(o,t){return r((()=>o.interactive),(()=>p(o,t)),l)}function p(o,t){o.interactive?v(o,t):f(o)}function v(o,t){f(o);const{view:e,analysis:n}=o,i=new t({view:e,analysis:n,analysisViewData:o});return o.tool=i,e.tools.add(i),i}function f(o){const{view:t,tool:e}=o;null!=e&&(t.tools.remove(e),o.tool=null)}function y(e,a){const r=e.userOperation,l=o((async o=>{if(r){const t=r.promise.catch((()=>{}));r?.abort(),await t,n(o)}const l=u(e,{signal:o}),c=a?.shouldRejectOnCancel??(()=>!0),m=t([s((()=>e.tool),"cancel",(()=>{c()&&l.abort()}))]),{tool:p}=e;try{p&&(p.resetCreated(),a?.onToolActivated?.(p)),await l.promise,n(o)}catch(v){if(o.aborted||!i(v)||c())throw v}finally{m?.remove()}}),{signal:a?.abortOptions?.signal});return e.userOperation=l,l.promise.finally((()=>{e.userOperation===l&&(e.userOperation=null)}))}function d(o,t){const e=o.analysis.clone();return y(o,{abortOptions:t?.placementOptions,onToolActivated:t?.onToolActivated,shouldRejectOnCancel:()=>{const{analysis:t}=o;return!t.valid||t.equals(e)}})}export{u as activateAnalysisViewTool,m as connectAnalysisViewToTool,f as removeAnalysisViewTool,y as startExclusiveInteractiveOperation,d as startPlaceOperation};
|