@arcgis/core 4.23.0-next.20220124 → 4.23.0-next.20220126
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/Graphic.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00c5bb5eecb0e89266df.js +1 -0
- package/assets/esri/core/workers/chunks/021a37e2b191298e80b7.js +1 -0
- package/assets/esri/core/workers/chunks/1370c92c40fd6271553c.js +1 -0
- package/assets/esri/core/workers/chunks/1fbcc8424452d0256bd6.js +1 -0
- package/assets/esri/core/workers/chunks/{fe864d01e72aa24574b6.js → 23b15e7c2f96d260e16c.js} +1 -1
- package/assets/esri/core/workers/chunks/{b2ae5fc4f787ea568b88.js → 2460f3b6ada6ae900dec.js} +1 -1
- package/assets/esri/core/workers/chunks/2792ca40f1e92849247c.js +1 -0
- package/assets/esri/core/workers/chunks/2a96f1bba9ce6883e5e0.js +1 -0
- package/assets/esri/core/workers/chunks/2e899ef5881b4ec6fa55.js +1 -0
- package/assets/esri/core/workers/chunks/3231ee3e090bb4cac3fc.js +1 -0
- package/assets/esri/core/workers/chunks/{0c3e3a5baf54bd5e210c.js → 36e250278b5622ccf068.js} +1 -1
- package/assets/esri/core/workers/chunks/395ba088d4864588ff66.js +1 -0
- package/assets/esri/core/workers/chunks/3cc77692b2eee27b9c9e.js +1 -0
- package/assets/esri/core/workers/chunks/3f343f792fd9f44d6f25.js +1 -0
- package/assets/esri/core/workers/chunks/422537fc3df707bb62c9.js +1 -0
- package/assets/esri/core/workers/chunks/{625d2663daa8e0cf64b0.js → 434b16731c6a81f868ef.js} +1 -1
- package/assets/esri/core/workers/chunks/4385a268c2a64281d1c1.js +1 -0
- package/assets/esri/core/workers/chunks/{44b01d42d4ec72913229.js → 438f0b5ae5c53ae4f06a.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d539878bfbd7c549e60.js → 46b4bb66a54bbd8e2e57.js} +1 -1
- package/assets/esri/core/workers/chunks/4c76146014dc15143ba3.js +1 -0
- package/assets/esri/core/workers/chunks/5d991b74d958005c26c4.js +1 -0
- package/assets/esri/core/workers/chunks/5dfe1f8d520025e2118b.js +1 -0
- package/assets/esri/core/workers/chunks/601e697dc7414bda128a.js +1 -0
- package/assets/esri/core/workers/chunks/{9cdaba126ac7fa5f33f0.js → 6cd5e4380d29b9a3c344.js} +1 -1
- package/assets/esri/core/workers/chunks/{a7b1b75643ed31489495.js → 6f50a9647f026a8d4729.js} +1 -1
- package/assets/esri/core/workers/chunks/7d661129a0d8c466eeec.js +1 -0
- package/assets/esri/core/workers/chunks/{64276aacaafa4c8a15bd.js → 7dcf52d3db3903c8eb9f.js} +1 -1
- package/assets/esri/core/workers/chunks/8070972c0efb78523b68.js +1 -0
- package/assets/esri/core/workers/chunks/94515fb3ef38067eeadd.js +1 -0
- package/assets/esri/core/workers/chunks/97a28641b3b2fd31bea2.js +1 -0
- package/assets/esri/core/workers/chunks/{d1454155ee1b8a421cbb.js → 97ec9eef0048760fa260.js} +1 -1
- package/assets/esri/core/workers/chunks/98986e6601b0366376b4.js +1 -0
- package/assets/esri/core/workers/chunks/9cdcf9309d6feda70185.js +1 -0
- package/assets/esri/core/workers/chunks/aa04b90b82bf70caaae4.js +1 -0
- package/assets/esri/core/workers/chunks/aace7e1fef256bb961c9.js +1 -0
- package/assets/esri/core/workers/chunks/{c080114a69fa95b88d22.js → af5694b4d278cf1db2d9.js} +1 -1
- package/assets/esri/core/workers/chunks/afbb4f802ca5774f0326.js +1 -0
- package/assets/esri/core/workers/chunks/b2c5f92e3d7606297ca9.js +1 -0
- package/assets/esri/core/workers/chunks/b2d2de935487257c568b.js +1 -0
- package/assets/esri/core/workers/chunks/b2ebe4f6d100e15b512d.js +1 -0
- package/assets/esri/core/workers/chunks/b8316c6469a543029bc6.js +1 -0
- package/assets/esri/core/workers/chunks/{4c9084a04948b6924749.js → ba5eb394f098968c22d2.js} +1 -1
- package/assets/esri/core/workers/chunks/bf0a65b4be31959f921d.js +1 -0
- package/assets/esri/core/workers/chunks/c890c7fca27170e3341f.js +1 -0
- package/assets/esri/core/workers/chunks/c976785f2391c77d8a30.js +1 -0
- package/assets/esri/core/workers/chunks/{d39b7983b68d6e5b404d.js → cdbc005eebec1503b99d.js} +1 -1
- package/assets/esri/core/workers/chunks/e4b84ca8ddfd48dd79b1.js +1 -0
- package/assets/esri/core/workers/chunks/e4e2036373166c1d5cf5.js +1 -0
- package/assets/esri/core/workers/chunks/e4f93c55eaefab4192b5.js +1 -0
- package/assets/esri/core/workers/chunks/e6165e17fbb07bfc40a1.js +1 -0
- package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +1 -0
- package/assets/esri/core/workers/chunks/{f678293de9a6d8f5b5db.js → ec89466f76d0ba22525e.js} +1 -1
- package/assets/esri/core/workers/chunks/ee45618c45806ab654cb.js +1 -0
- package/assets/esri/core/workers/chunks/f4baa5ea2e42b1317941.js +1 -0
- package/assets/esri/core/workers/chunks/f760a3e030b0f358a92a.js +1 -0
- package/assets/esri/core/workers/chunks/face43cf5abcd2f5bd9d.js +1 -0
- package/assets/esri/themes/base/_mixins.scss +4 -1
- package/assets/esri/themes/base/icons/style.scss +11 -2
- package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +13 -10
- package/assets/esri/themes/base/widgets/_CoordinateConversion.scss +4 -2
- package/assets/esri/themes/base/widgets/_Directions.scss +5 -3
- package/assets/esri/themes/base/widgets/_Editor.scss +5 -2
- package/assets/esri/themes/base/widgets/_ElevationProfile.scss +6 -4
- package/assets/esri/themes/base/widgets/_ItemList.scss +1 -1
- package/assets/esri/themes/base/widgets/_LayerList.scss +13 -9
- package/assets/esri/themes/base/widgets/_Popup.scss +4 -2
- package/assets/esri/themes/base/widgets/_Print.scss +24 -11
- package/assets/esri/themes/base/widgets/_Search.scss +4 -2
- package/assets/esri/themes/base/widgets/_TableList.scss +9 -7
- package/assets/esri/themes/base/widgets/_Weather.scss +12 -0
- package/assets/esri/themes/base/widgets/_Widget.scss +18 -9
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/dark-blue/main.css +1 -1
- package/assets/esri/themes/dark-green/main.css +1 -1
- package/assets/esri/themes/dark-purple/main.css +1 -1
- package/assets/esri/themes/dark-red/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/themes/light-blue/main.css +1 -1
- package/assets/esri/themes/light-green/main.css +1 -1
- package/assets/esri/themes/light-purple/main.css +1 -1
- package/assets/esri/themes/light-red/main.css +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_en.json +1 -1
- package/chunks/ComponentShader.glsl.js +19 -19
- package/chunks/Terrain.glsl.js +11 -11
- package/chunks/WaterSurface.glsl.js +21 -21
- package/chunks/pe.js +1 -1
- package/chunks/vec3.js +1 -1
- package/core/accessorSupport/read.js +1 -1
- package/core/accessorSupport/write.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/geometry/pe.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/interfaces.d.ts +36 -2
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/package.json +2 -2
- package/popup/content/AttachmentsContent.js +1 -1
- package/popup/content/support/mediaInfoTypes.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LabelSymbol3D.js +1 -1
- package/symbols/PointSymbol3D.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/Symbol3DVerticalOffset.js +1 -1
- package/symbols/support/previewCIMSymbol.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/previewWebStyleSymbol.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/symbols.js +1 -1
- package/views/2d/engine/webgl/brushes/raster/BrushRasterBitmap.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/environment/weather.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.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/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +21 -13
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
- 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/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/views/webgl/rasterUtils.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/FeatureForm/InputField.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/Slice/SliceViewModel.js +1 -1
- package/widgets/Slider/SliderViewModel.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/Weather/css.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
- package/widgets/support/InteractiveToolViewModel.js +1 -1
- package/assets/components/assets/calcite-icon/checkSquareF16.json +0 -1
- package/assets/components/assets/calcite-icon/checkSquareF24.json +0 -1
- package/assets/components/assets/calcite-icon/checkSquareF32.json +0 -1
- package/assets/components/assets/calcite-icon/lineSolid4.json +0 -1
- package/assets/components/assets/calcite-icon/squareF16.json +0 -1
- package/assets/components/assets/calcite-icon/squareF24.json +0 -1
- package/assets/components/assets/calcite-icon/squareF32.json +0 -1
- package/assets/components/assets/calcite-icon/xHexagon16.json +0 -1
- package/assets/components/assets/calcite-icon/xHexagon24.json +0 -1
- package/assets/components/assets/calcite-icon/xHexagon32.json +0 -1
- package/assets/components/assets/calcite-icon/xHexagonF16.json +0 -1
- package/assets/components/assets/calcite-icon/xHexagonF24.json +0 -1
- package/assets/components/assets/calcite-icon/xHexagonF32.json +0 -1
- package/assets/components/assets/calcite-icon/xOctagonF16.json +0 -1
- package/assets/components/assets/calcite-icon/xOctagonF24.json +0 -1
- package/assets/components/assets/calcite-icon/xOctagonF32.json +0 -1
- package/assets/esri/core/workers/chunks/09da224052976e290828.js +0 -1
- package/assets/esri/core/workers/chunks/0bf079e752ab79468478.js +0 -1
- package/assets/esri/core/workers/chunks/20411bb8e04703962ce6.js +0 -1
- package/assets/esri/core/workers/chunks/23745a5ab47c840dc452.js +0 -1
- package/assets/esri/core/workers/chunks/2416f8bf8bbd2ec786ab.js +0 -1
- package/assets/esri/core/workers/chunks/2e445a8735ea2adb641a.js +0 -1
- package/assets/esri/core/workers/chunks/32f8c4af7e70ebdcb19e.js +0 -1
- package/assets/esri/core/workers/chunks/390d9021169e65c10eb8.js +0 -1
- package/assets/esri/core/workers/chunks/3a9740dccda6a733313c.js +0 -1
- package/assets/esri/core/workers/chunks/43cdff2418325e163420.js +0 -1
- package/assets/esri/core/workers/chunks/5538639a49c7cc2eca63.js +0 -1
- package/assets/esri/core/workers/chunks/60371c0f750cde87656d.js +0 -1
- package/assets/esri/core/workers/chunks/67162b3e2cc1b5dc6818.js +0 -1
- package/assets/esri/core/workers/chunks/739e579150bf466d43ae.js +0 -1
- package/assets/esri/core/workers/chunks/74df1f3e1e2e524a89d2.js +0 -1
- package/assets/esri/core/workers/chunks/76eef4799f6c5fff7e2d.js +0 -1
- package/assets/esri/core/workers/chunks/7baf6b1f3f050aa67ae4.js +0 -1
- package/assets/esri/core/workers/chunks/8967288145f8fbd20e7d.js +0 -1
- package/assets/esri/core/workers/chunks/99a777693e4539f0b03b.js +0 -1
- package/assets/esri/core/workers/chunks/9cb2ae42a8e328b1d98d.js +0 -1
- package/assets/esri/core/workers/chunks/9d3c58a0ef634d95b7bd.js +0 -1
- package/assets/esri/core/workers/chunks/a6ff3db3493543df81bc.js +0 -1
- package/assets/esri/core/workers/chunks/a8c13529367c037cdd94.js +0 -1
- package/assets/esri/core/workers/chunks/a96afc176041f698c7a1.js +0 -1
- package/assets/esri/core/workers/chunks/ac8dca61ade28c542ae2.js +0 -1
- package/assets/esri/core/workers/chunks/afa6912454f2a5ffadce.js +0 -1
- package/assets/esri/core/workers/chunks/b2beb6e1fd2ee6503830.js +0 -1
- package/assets/esri/core/workers/chunks/bab1cfd0a901181622af.js +0 -1
- package/assets/esri/core/workers/chunks/be2b7cce79fd41627931.js +0 -1
- package/assets/esri/core/workers/chunks/c13dfdd548dcb1bdb294.js +0 -1
- package/assets/esri/core/workers/chunks/c6bd943fe8fd13bb4806.js +0 -1
- package/assets/esri/core/workers/chunks/c6f94b92e866b881d9b9.js +0 -1
- package/assets/esri/core/workers/chunks/cd7d83d127e085d52584.js +0 -1
- package/assets/esri/core/workers/chunks/d52108864136c5a8a618.js +0 -1
- package/assets/esri/core/workers/chunks/da1c2873bdbc0956dca0.js +0 -1
- package/assets/esri/core/workers/chunks/de03439ca2c9782bf325.js +0 -1
- package/assets/esri/core/workers/chunks/e079cb1d53aca15b7df2.js +0 -1
- package/assets/esri/core/workers/chunks/e6df9839b551569fbc62.js +0 -1
- package/assets/esri/core/workers/chunks/e97e986120aaadad7d4c.js +0 -1
- package/assets/esri/core/workers/chunks/f8e7755240a94b499e1f.js +0 -1
- package/assets/esri/core/workers/chunks/fd3e5d823dc7917f4b8f.js +0 -1
- package/views/3d/layers/graphics/IGraphics3DFeatureProcessor.js +0 -4
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{someMap as s}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as i,isSome as a,isNone as h,unwrap as o}from"../../../../core/maybe.js";import{Milliseconds as d}from"../../../../core/time.js";import{init as l}from"../../../../core/watchUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{v as c,j as m,a as u,m as g}from"../../../../chunks/mat4.js";import{I as f,c as T}from"../../../../chunks/mat4f64.js";import{a as R}from"../../../../chunks/vec2f64.js";import{MAXIMUM_ANIMATION_LOAD as E,MINIMUM_IDLE_ANIMATION_MS as A}from"../../support/animationUtils.js";import x from"../../support/debugFlags.js";import{RenderPassManager as C}from"../core/renderPasses/RenderPassManager.js";import{HUDTransparentRenderStyle as P}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AntiAliasingMode as b,TransparencyPassType as w,Decorations as S,RenderRequestType as H,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as O,union as L}from"./depthRange.js";import{depthRangeFromScene as I}from"./depthRangeUtils.js";import{createEmptyDepthTexture as y}from"./glUtil3D.js";import N from"./HighlightHelper.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as j}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as q}from"./rendererUtils.js";import{RenderPass as G}from"./RenderPass.js";import{RenderPluginManager as F}from"./RenderPluginManager.js";import{RenderSlot as V}from"./RenderSlot.js";import{ShadowAccumulator as B}from"./ShadowAccumulator.js";import{ShadowHighlightHelper as k}from"./ShadowHighlightHelper.js";import W from"./ShadowMap.js";import Q from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as X}from"./SSAOHelper.js";import{EdgeView as K}from"./edgeRendering/EdgeView.js";import{Transparency as Y}from"./edgeRendering/interfaces.js";import{SceneLighting as J}from"../lighting/SceneLighting.js";import{MergedRenderer as Z}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as $}from"../shaders/CompositingTechnique.js";import{HighlightShadowMapSlot as ee,DefaultSnapshotSlot as re}from"../shaders/ShadowHighlightTechnique.js";import{RendererPerformanceInfo as te,Statistics as se}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ie,PixelType as ae}from"../../../webgl/enums.js";import{startMeasurement as he}from"../../../webgl/Measurement.js";const oe=.9;let de=class extends r{constructor(e,r,s,n,i,a,h,o,_){super({}),this._materialRepository=e,this._shaderTechniqueRepository=s,this._rctx=n,this._compositingHelper=i,this._magnifierHelper=a,this._requestRender=h,this._stage=_,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasOccludees=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new te,this._antialiasing=b.SMAA,this._oitEnabled=!1,this._multipassTerrain=!0,this._opaqueTerrain=!0,this._lighting=new J,this._hasAnimations=!1,this._animationTimestep=d(0),this._handles=new t,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,s),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new U(this._rctx,this._compositingHelper),this._sliceHelper=new Q,this._shadowMap=new W(this._rctx,_.viewingMode,2),this._ssaoHelper=new X(s,this._rctx,(()=>this._requestRender())),this._highlightHelper=new N(s,this._rctx),this._shadowHighlightHelper=new k(this._rctx,_.viewingMode),this._shadowAccumulator=new B(this._rctx,s,_,((e,r)=>{this.renderPassManager.shadowCastingEnabled=!0,this._renderPlugins.prepareRender(e,r),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled}),((e,r,t,s)=>{e.start(t,r,s),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL,e),t.setGLViewport(this._rctx),this._ensureCameraBindParameters(t)}),(()=>this._requestRender())),this._bindParameters={slot:null,camera:null,inverseViewport:R(),shadowMap:this._shadowMap,shadowMappingEnabled:this._shadowMap.enabled,ssaoHelper:this._ssaoHelper,ssaoEnabled:this._ssaoHelper.enabled,origin:null,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:this._sliceHelper.plane,highlightDepthTexture:null,hasOccludees:!1,linearDepthTexture:null,terrainLinearDepthTexture:null,geometryLinearDepthTexture:null,multipassTerrainEnabled:!1,multipassGeometryEnabled:!1,cullAboveGround:!1,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1,lighting:this._lighting,highlightColorTexture:null},this._renderContext=new j(this._rctx,this._offscreenRendering,this._lighting,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderContext.multipassTerrainParams={camera:null,multipassTerrainEnabled:!1,cullAboveGround:!1,terrainLinearDepthTexture:null},this._renderContext.multipassGeometryParams={multipassGeometryEnabled:!1,geometryLinearDepthTexture:null},this._renderContext.ssrParams={camera:null,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1},this._renderPlugins=new F({renderContext:this._renderContext,shaderTechniqueRep:s,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:o}),this.renderPassManager=new C(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l(x,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Y.TRANSPARENT):()=>{},this._requestRender()})),l(this._stage,"camera",(()=>this._requestRender()),!0)])}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=i(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlightHelper.dispose(),this._shadowHighlightHelper.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing===b.SMAA&&this._smaaPass.updating||a(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return h(this._edgeView)&&(this._edgeView=new K({rctx:this._rctx,renderSR:this._stage.renderSR,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(this._edgeView.watch("updating",(()=>this._requestRender()),!0)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return null===this._bindParameters.reprojectionMatrix||c(this._bindParameters.reprojectionMatrix,f)}set _reprojectionMatrix(e){c(this._bindParameters.reprojectionMatrix,e)||(this._bindParameters.reprojectionMatrix=e,this.notifyChange("isCameraFinal"))}get hasShadowsEnabled(){var e;return!(null==(e=this._shadowMap)||!e.enabled)}setRenderParameters(e){const{renderPassManager:r,_shadowMap:t,_ssaoHelper:s}=this;void 0!==e.screenSpaceReflectionsEnabled&&r.screenSpaceReflectionsEnabled!==e.screenSpaceReflectionsEnabled&&(r.screenSpaceReflectionsEnabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0===e.shadowMap||t.enabled===e.shadowMap&&r.shadowCastingEnabled===e.shadowMap||(t.enabled=e.shadowMap,r.shadowCastingEnabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),void 0!==e.ssao&&s.enabled!==e.ssao&&(s.enabled=e.ssao,this._requestRender()),e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender());const n=e.antialiasingEnabled?b.SMAA:b.NONE;void 0!==e.antialiasingEnabled&&this._antialiasing!==n&&(this._antialiasing=n,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=o(e.slicePlane),this._requestRender()),void 0!==e.waterReflectionEnabled&&this._waterReflectionEnabled!==e.waterReflectionEnabled&&(this._waterReflectionEnabled=e.waterReflectionEnabled,this._requestRender()),void 0!==e.opaqueTerrain&&this._opaqueTerrain!==e.opaqueTerrain&&(this._opaqueTerrain=e.opaqueTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:n}=e;if(0===r.length&&0===t.length&&0===n.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const i=q(e);let a=!1;i.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new Z(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=s(this._materialRenderers,(e=>e.hasHighlights)),this._hasOccludees=s(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=s(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=s(this._materialRenderers,(e=>e.requiresSlot(V.TRANSPARENT_MATERIAL,G.MATERIAL))),this._hasHUDElements=s(this._materialRenderers,(e=>e.requiresSlot(V.LINE_CALLOUTS_HUD_DEPTH,G.MATERIAL)||e.requiresSlot(V.HUD_MATERIAL,G.MATERIAL)||e.requiresSlot(V.LABEL_MATERIAL,G.MATERIAL))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._lighting.groundLightingFactor=r,this._lighting.globalFactor=t,this._lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.lighting=this._lighting,this._renderContext.hasOccludees=this._hasOccludees,this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=w.NONE;const n=this._offscreenRendering;n.needLastFrameColorTexture=this.hasWaterReflection,n.advanceCurrentRenderTarget();const i=this._sliceHelper.plane;s===S.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this.needsShadowCast&&(this.renderPassManager.shadowCastingEnabled=!0),this._renderPlugins.prepareRender(r,t),this.performanceInfo.advance(se.Prepare);const o=this._computeDepthRange(r);this._renderShadowMap(e,r,this._lighting.lightingMainDirection,o),this.performanceInfo.advance(se.Shadowmap),n.initializeFrame(r),this._ensureBindParameters(r),this._renderLinearDepth(),this.performanceInfo.advance(se.Lineardepth),this._accumulateShadows(o,r,t),this._renderNormal(),this.performanceInfo.advance(se.Normals),this._ensureBindParametersSSR(),this._ssaoHelper.computeSSAO(r,n.linearDepthTexture,n.normalTexture),this.performanceInfo.advance(se.SSAO),this._renderContext.pass=G.MATERIAL,n.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.Opaque);const d=this._multipassTerrain&&!this._opaqueTerrain;this._renderTerrainLinearDepth(d),this._setMultipassFlags(d),this._setTerrainCulling(d),this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),this._renderHiddenTransparentEdges();const l=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderGeometryLinearDepth(d);const _=this._renderHUDVisibility();d||this._renderInternalSlot(V.LINE_CALLOUTS),this.performanceInfo.advance(se.Hudvisibility),this._renderEdges(Y.TRANSPARENT,d),this.performanceInfo.advance(se.TransparentEdges),this._renderSlot(V.VOXEL),this._renderTransparentTerrain(),!this._opaqueTerrain&&_&&(d?this._renderLineCallouts(P.OCCLUDED):n.compositeTransparentTerrainOntoHUDVisibility(),this._renderHUD(P.OCCLUDED,n.framebuffer),this.performanceInfo.advance(se.HudOccluded)),this.performanceInfo.advance(se.TransparentTerrain),this._setTerrainCulling(!1),this._opaqueTerrain||(n.compositeTransparentTerrainOntoMain(),d&&(this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderEdges(Y.TRANSPARENT),this.performanceInfo.advance(se.TransparentEdges))),d&&this._renderLineCallouts(P.NOTOCCLUDED),this._setMultipassFlags(!1),this._shadowAccumulator.render(),n.renderToTargets((()=>{this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(V.LASERLINES)}),n.currentColorTarget,n.mainDepth),this.performanceInfo.advance(se.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&n.renderTmpAndCompositeToMain((()=>this._renderSlot(V.LASERLINES_CONTRAST_CONTROL)),$.PremultipliedAlpha),this.performanceInfo.advance(se.Laserline),this._renderOccluded(),this.performanceInfo.advance(se.Occluded);const p=s===S.ON&&this._magnifierHelper.enabled,c=p&&h(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(c);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(this._antialiasing,m)&&a(m)&&this._compositingHelper.composite(m,$.None),this.performanceInfo.advance(se.Antialiasing),this._renderHUD(P.NOTOCCLUDED,c),this.performanceInfo.advance(se.HudNotoccluded),this._renderHighlights(c,this._bindParameters),this.performanceInfo.advance(se.Highlights),p&&this._magnifierHelper.render(this._rctx,this._bindParameters),c!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._offscreenRendering.tmpColorTexture,$.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._renderContext.camera),this._sliceHelper.plane=i,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=d(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/E;this._animationTimestep=d(Math.max(this._animationTimestep*oe+e*(1-oe),A))}}readDepthPixels(e,r,t,s,n,i){const a=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e),this._renderContext.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)}a.readPixels(r,t,s,n,ie.RGBA,ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassFlags(e){this._renderContext.multipassTerrainParams.multipassTerrainEnabled=this._bindParameters.multipassTerrainEnabled=e,this._renderContext.multipassGeometryParams.multipassGeometryEnabled=this._bindParameters.multipassGeometryEnabled=e}_setTerrainCulling(e){this._renderContext.multipassTerrainParams.cullAboveGround=this._bindParameters.cullAboveGround=e}_renderSlot(e){this._renderContext.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;a(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),$.Alpha,r)}_renderShadowMap(e,r,t,s){const n=this._shadowMap;n.enabled&&(n.start(r,t,s),this.needsShadowHighlight?(this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,this._shadowMap,(e=>n.takeCascadeSnapshotTo(e,ee))),n.clear(),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_DEFAULT,this._shadowMap,(e=>{n.takeCascadeSnapshotTo(e,re),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT)}))):this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL),n.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this.needsShadowHighlight||this.needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._renderContext.ssrParams.linearDepthTexture=this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_DEPTH,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._renderContext.multipassTerrainParams.terrainLinearDepthTexture=this._bindParameters.terrainLinearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.pass;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(G.MATERIAL_DEPTH)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._renderContext.multipassGeometryParams.geometryLinearDepthTexture=this._bindParameters.geometryLinearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this.needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_NORMAL)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get needsDepthRange(){return this._shadowMap.enabled||this.needsShadowCast}_computeDepthRange(e){if(!this.needsDepthRange)return O;const r=I(e,this._content,this._stage.layers);return L(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.pass=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.pass=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(V.INTEGRATED_MESH),this._renderSlot(V.OPAQUE_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL),this._renderSlot(V.OPAQUE_PLUGIN),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(V.TRANSPARENT_MATERIAL),this._renderSlot(V.TRANSPARENT_PLUGIN)}_renderTransparentTerrain(){this._renderSlot(V.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(V.OCCLUSION_PIXELS)}),this._multipassTerrain&&!this._opaqueTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===P.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(V.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(V.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._offscreenRendering.hudColorTexture,$.PremultipliedAlpha)):e===P.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(P.OCCLUDED)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(V.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(V.HUD_MATERIAL),this._renderInternalSlot(V.LABEL_MATERIAL)}get needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlightHelper.isVisible&&this.needsHighlight}_renderHighlights(e,r){if(!this.needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlightHelper,s=t.profilingCallback&&he(this._renderContext.rctx);this._renderContext.highlightDepthTexture=r.highlightDepthTexture;const n=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_HIGHLIGHT),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(P.BOTH)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=n.colorTexture,this.needsShadowHighlight&&this._shadowHighlightHelper.render(r,e),t.render(this._renderContext.camera,n,e),a(s)&&t.profilingCallback&&s.stop((e=>{t.profilingCallback&&t.profilingCallback(e)}))}get needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this.needsShadowCast&&(this._shadowAccumulator.setAccumulationDependencies(this._offscreenRendering.linearDepthTexture,e,r,t),this._shadowAccumulator.accumulateFixedSamples(),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._renderContext.transparencyPassType=t,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_ALPHA,t(w.Alpha),this._renderContext.pass=G.MATERIAL,t(w.Color),t(w.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(r),this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._renderContext.pass=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===v.OccludeAndTransparentStencil&&(e|=t.renderOccluded,pe.push(t))}));const r=this._offscreenRendering,t=(t,s,n,i,a)=>{0!=(e&s)&&(r.renderToTargets(n,r.tmpColor,r.mainDepth,[0,0,0,0],i,a),r.compositeOccludedOntoMain(t))};0!==pe.length&&(this._renderInternalSlot(V.OCCLUDER_MATERIAL,pe),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(V.TRANSPARENT_OCCLUDER_MATERIAL,pe)),!1,!1),pe.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===v.OccludeAndTransparent||t.renderOccluded===v.Transparent||t.renderOccluded===v.Opaque)&&(e|=t.renderOccluded,_e.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,s>v.Occlude&&this._renderSlot(V.OCCLUDED_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,_e),this._renderContext.resetRenderOccludedMask()};this._renderContext.pass=G.MATERIAL,t(.5,v.OccludeAndTransparent,(()=>n(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>n(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>n(v.Opaque)),!0,D.OutlineVisualElementMask),_e.length=0}_renderAntiAliasing(e,r){if(e===b.SMAA){if(this._smaaPass.enable((()=>this._requestRender()))&&a(r))return this._smaaPass.render(r),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e){this._renderContext.camera=e,this._bindParameters.camera=this._renderContext.camera,this._bindParameters.inverseViewport[0]=1/this._renderContext.camera.fullViewport[2],this._bindParameters.inverseViewport[1]=1/this._renderContext.camera.fullViewport[3]}_ensureBindParameters(e){var r;this._ensureCameraBindParameters(e);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.shadowMap=this._renderContext.shadowMap,this._bindParameters.shadowMappingEnabled=this._renderContext.shadowMap.enabled,this._bindParameters.ssaoHelper=this._renderContext.ssaoHelper,this._bindParameters.ssaoEnabled=this._renderContext.ssaoHelper.enabled,this._bindParameters.slicePlane=this._renderContext.sliceHelper.plane,this._bindParameters.hasOccludees=this._renderContext.hasOccludees,this._renderContext.multipassTerrainParams.camera=this._renderContext.camera,this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.highlightDepthTexture=null!=(r=t.depthTexture)?r:this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._renderContext.camera)?this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=f:(m(ce,this._renderContext.lastFrameCamera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),m(ue,this._renderContext.camera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),u(ue,ue),u(me,this._renderContext.camera.projectionMatrix),g(ge,ue,me),g(ge,ce,ge),g(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=ge),this._renderContext.ssrParams.camera=this._renderContext.camera,this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=null,this._renderContext.ssrParams.ssrEnabled=this._bindParameters.ssrEnabled=this.hasWaterReflection}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,a(r)?r.forEach((r=>{if(!r.shouldRender(this._renderContext))return;const s=this._materialRenderers.get(r);a(s)&&(t=s.render(e,this._renderContext.pass,this._bindParameters)||t)})):this._materialRenderers.forEach(((r,s)=>{s.shouldRender(this._renderContext)&&(t=r.render(e,this._renderContext.pass,this._bindParameters)||t)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=y(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){var e,r,t,s,n,i,a,h,o,d;return{offscreen:null!=(e=null==(r=this._offscreenRendering)?void 0:r.gpuMemoryUsage)?e:0,highlights:(null!=(t=null==(s=this._highlightHelper)?void 0:s.gpuMemoryUsage)?t:0)+(null!=(n=null==(i=this._shadowHighlightHelper)?void 0:i.gpuMemoryUsage)?n:0),shadows:null!=(a=null==(h=this._shadowMap)?void 0:h.gpuMemoryUsage)?a:0,ssao:null!=(o=null==(d=this._ssaoHelper)?void 0:d.gpuMemoryUsage)?o:0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlightHelper,lighting:this._lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{var t;switch(r){case le.Color:return e._offscreenRendering.colorTexture;case le.LinearDepth:return e._offscreenRendering.linearDepthTexture;case le.Normals:return e._offscreenRendering.normalTexture;case le.ShadowMap:return null==(t=e._shadowMap)?void 0:t.test.depthTexture;case le.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case le.Highlight:return e._offscreenRendering.highlightTexture}}}}};var le;e([_()],de.prototype,"_shadowAccumulator",void 0),e([_()],de.prototype,"_smaaPass",void 0),e([_()],de.prototype,"_antialiasing",void 0),e([_()],de.prototype,"_edgeView",void 0),e([_()],de.prototype,"updating",null),e([_()],de.prototype,"isCameraFinal",null),de=e([p("esri.views.3d.webgl-engine.lib.Renderer")],de),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(le||(le={}));const _e=[],pe=[],ce=T(),me=T(),ue=T(),ge=T();export{le as FramebufferId,de as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{someMap as s}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as i,isSome as a,isNone as h,unwrap as o}from"../../../../core/maybe.js";import{Milliseconds as d}from"../../../../core/time.js";import{init as l}from"../../../../core/watchUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{v as c,j as m,a as u,m as g}from"../../../../chunks/mat4.js";import{I as f,c as T}from"../../../../chunks/mat4f64.js";import{a as R}from"../../../../chunks/vec2f64.js";import{MAXIMUM_ANIMATION_LOAD as E,MINIMUM_IDLE_ANIMATION_MS as A}from"../../support/animationUtils.js";import C from"../../support/debugFlags.js";import{RenderPassManager as P}from"../core/renderPasses/RenderPassManager.js";import{HUDTransparentRenderStyle as x}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AntiAliasingMode as b,TransparencyPassType as w,Decorations as S,RenderRequestType as H,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as O,union as L}from"./depthRange.js";import{depthRangeFromScene as I}from"./depthRangeUtils.js";import{createEmptyDepthTexture as y}from"./glUtil3D.js";import N from"./HighlightHelper.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as j}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as q}from"./rendererUtils.js";import{RenderPass as G}from"./RenderPass.js";import{RenderPluginManager as F}from"./RenderPluginManager.js";import{RenderSlot as V}from"./RenderSlot.js";import{ShadowAccumulator as B}from"./ShadowAccumulator.js";import{ShadowHighlightHelper as k}from"./ShadowHighlightHelper.js";import W from"./ShadowMap.js";import Q from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as X}from"./SSAOHelper.js";import{EdgeView as K}from"./edgeRendering/EdgeView.js";import{Transparency as Y}from"./edgeRendering/interfaces.js";import{SceneLighting as J}from"../lighting/SceneLighting.js";import{MergedRenderer as Z}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as $}from"../shaders/CompositingTechnique.js";import{HighlightShadowMapSlot as ee,DefaultSnapshotSlot as re}from"../shaders/ShadowHighlightTechnique.js";import{RendererPerformanceInfo as te,Statistics as se}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ie,PixelType as ae}from"../../../webgl/enums.js";import{startMeasurement as he}from"../../../webgl/Measurement.js";const oe=.9;let de=class extends r{constructor(e,r,s,n,i,a,h,o,_){super({}),this._materialRepository=e,this._shaderTechniqueRepository=s,this._rctx=n,this._compositingHelper=i,this._magnifierHelper=a,this._requestRender=h,this._stage=_,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasOccludees=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new te,this._antialiasing=b.SMAA,this._oitEnabled=!1,this._multipassTerrain=!0,this._opaqueTerrain=!0,this._lighting=new J,this._hasAnimations=!1,this._animationTimestep=d(0),this._handles=new t,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,s),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new U(this._rctx,this._compositingHelper),this._sliceHelper=new Q,this._shadowMap=new W(this._rctx,_.viewingMode,2),this._ssaoHelper=new X(s,this._rctx,(()=>this._requestRender())),this._highlightHelper=new N(s,this._rctx),this._shadowHighlightHelper=new k(this._rctx,_.viewingMode),this._shadowAccumulator=new B(this._rctx,s,_,((e,r)=>{this.renderPassManager.shadowCastingEnabled=!0,this._renderPlugins.prepareRender(e,r),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled}),((e,r,t,s)=>{e.start(t,r,s),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL,e),t.setGLViewport(this._rctx),this._ensureCameraBindParameters(t)}),(()=>this._requestRender())),this._bindParameters={slot:null,camera:null,inverseViewport:R(),shadowMap:this._shadowMap,shadowMappingEnabled:this._shadowMap.enabled,ssaoHelper:this._ssaoHelper,ssaoEnabled:this._ssaoHelper.enabled,origin:null,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:this._sliceHelper.plane,highlightDepthTexture:null,hasOccludees:!1,linearDepthTexture:null,terrainLinearDepthTexture:null,geometryLinearDepthTexture:null,multipassTerrainEnabled:!1,multipassGeometryEnabled:!1,cullAboveGround:!1,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1,lighting:this._lighting,highlightColorTexture:null,cloudsCompositionParams:null},this._renderContext=new j(this._rctx,this._offscreenRendering,this._lighting,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderContext.multipassTerrainParams={camera:null,multipassTerrainEnabled:!1,cullAboveGround:!1,terrainLinearDepthTexture:null},this._renderContext.multipassGeometryParams={multipassGeometryEnabled:!1,geometryLinearDepthTexture:null},this._renderContext.ssrParams={camera:null,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1},this._renderPlugins=new F({renderContext:this._renderContext,shaderTechniqueRep:s,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:o}),this.renderPassManager=new P(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l(C,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Y.TRANSPARENT):()=>{},this._requestRender()})),l(this._stage,"camera",(()=>this._requestRender()),!0)])}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=i(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlightHelper.dispose(),this._shadowHighlightHelper.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing===b.SMAA&&this._smaaPass.updating||a(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return h(this._edgeView)&&(this._edgeView=new K({rctx:this._rctx,renderSR:this._stage.renderSR,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(this._edgeView.watch("updating",(()=>this._requestRender()),!0)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return null===this._bindParameters.reprojectionMatrix||c(this._bindParameters.reprojectionMatrix,f)}set _reprojectionMatrix(e){c(this._bindParameters.reprojectionMatrix,e)||(this._bindParameters.reprojectionMatrix=e,this.notifyChange("isCameraFinal"))}get hasShadowsEnabled(){var e;return!(null==(e=this._shadowMap)||!e.enabled)}setRenderParameters(e){const{renderPassManager:r,_shadowMap:t,_ssaoHelper:s}=this;void 0!==e.screenSpaceReflectionsEnabled&&r.screenSpaceReflectionsEnabled!==e.screenSpaceReflectionsEnabled&&(r.screenSpaceReflectionsEnabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0===e.shadowMap||t.enabled===e.shadowMap&&r.shadowCastingEnabled===e.shadowMap||(t.enabled=e.shadowMap,r.shadowCastingEnabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),void 0!==e.ssao&&s.enabled!==e.ssao&&(s.enabled=e.ssao,this._requestRender()),e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender());const n=e.antialiasingEnabled?b.SMAA:b.NONE;void 0!==e.antialiasingEnabled&&this._antialiasing!==n&&(this._antialiasing=n,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=o(e.slicePlane),this._requestRender()),void 0!==e.waterReflectionEnabled&&this._waterReflectionEnabled!==e.waterReflectionEnabled&&(this._waterReflectionEnabled=e.waterReflectionEnabled,this._requestRender()),void 0!==e.opaqueTerrain&&this._opaqueTerrain!==e.opaqueTerrain&&(this._opaqueTerrain=e.opaqueTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:n}=e;if(0===r.length&&0===t.length&&0===n.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const i=q(e);let a=!1;i.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new Z(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=s(this._materialRenderers,(e=>e.hasHighlights)),this._hasOccludees=s(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=s(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=s(this._materialRenderers,(e=>e.requiresSlot(V.TRANSPARENT_MATERIAL,G.MATERIAL))),this._hasHUDElements=s(this._materialRenderers,(e=>e.requiresSlot(V.LINE_CALLOUTS_HUD_DEPTH,G.MATERIAL)||e.requiresSlot(V.HUD_MATERIAL,G.MATERIAL)||e.requiresSlot(V.LABEL_MATERIAL,G.MATERIAL))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._lighting.groundLightingFactor=r,this._lighting.globalFactor=t,this._lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.lighting=this._lighting,this._renderContext.hasOccludees=this._hasOccludees,this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=w.NONE;const n=this._offscreenRendering;n.needLastFrameColorTexture=this.hasWaterReflection,n.advanceCurrentRenderTarget();const i=this._sliceHelper.plane;s===S.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this.needsShadowCast&&(this.renderPassManager.shadowCastingEnabled=!0),this._renderPlugins.prepareRender(r,t),this.performanceInfo.advance(se.Prepare);const o=this._computeDepthRange(r);this._renderShadowMap(e,r,this._lighting.lightingMainDirection,o),this.performanceInfo.advance(se.Shadowmap),n.initializeFrame(r),this._ensureBindParameters(r),this._renderLinearDepth(),this.performanceInfo.advance(se.Lineardepth),this._accumulateShadows(o,r,t),this._renderNormal(),this.performanceInfo.advance(se.Normals),this._ensureBindParametersSSR(),this._ensureBindParametersCloudsReflections(),this._ssaoHelper.computeSSAO(r,n.linearDepthTexture,n.normalTexture),this.performanceInfo.advance(se.SSAO),this._renderContext.pass=G.MATERIAL,n.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.Opaque);const d=this._multipassTerrain&&!this._opaqueTerrain;this._renderTerrainLinearDepth(d),this._setMultipassFlags(d),this._setTerrainCulling(d),this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),this._renderHiddenTransparentEdges();const l=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderGeometryLinearDepth(d);const _=this._renderHUDVisibility();d||this._renderInternalSlot(V.LINE_CALLOUTS),this.performanceInfo.advance(se.Hudvisibility),this._renderEdges(Y.TRANSPARENT,d),this.performanceInfo.advance(se.TransparentEdges),this._renderSlot(V.VOXEL),this._renderTransparentTerrain(),!this._opaqueTerrain&&_&&(d?this._renderLineCallouts(x.OCCLUDED):n.compositeTransparentTerrainOntoHUDVisibility(),this._renderHUD(x.OCCLUDED,n.framebuffer),this.performanceInfo.advance(se.HudOccluded)),this.performanceInfo.advance(se.TransparentTerrain),this._setTerrainCulling(!1),this._opaqueTerrain||(n.compositeTransparentTerrainOntoMain(),d&&(this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderEdges(Y.TRANSPARENT),this.performanceInfo.advance(se.TransparentEdges))),d&&this._renderLineCallouts(x.NOTOCCLUDED),this._setMultipassFlags(!1),this._shadowAccumulator.render(),n.renderToTargets((()=>{this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(V.LASERLINES)}),n.currentColorTarget,n.mainDepth),this.performanceInfo.advance(se.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&n.renderTmpAndCompositeToMain((()=>this._renderSlot(V.LASERLINES_CONTRAST_CONTROL)),$.PremultipliedAlpha),this.performanceInfo.advance(se.Laserline),this._renderOccluded(),this.performanceInfo.advance(se.Occluded);const p=s===S.ON&&this._magnifierHelper.enabled,c=p&&h(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(c);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(this._antialiasing,m)&&a(m)&&this._compositingHelper.composite(m,$.None),this.performanceInfo.advance(se.Antialiasing),this._renderHUD(x.NOTOCCLUDED,c),this.performanceInfo.advance(se.HudNotoccluded),this._renderHighlights(c,this._bindParameters),this.performanceInfo.advance(se.Highlights),p&&this._magnifierHelper.render(this._rctx,this._bindParameters),c!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._offscreenRendering.tmpColorTexture,$.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._renderContext.camera),this._sliceHelper.plane=i,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=d(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/E;this._animationTimestep=d(Math.max(this._animationTimestep*oe+e*(1-oe),A))}}readDepthPixels(e,r,t,s,n,i){const a=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e),this._renderContext.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)}a.readPixels(r,t,s,n,ie.RGBA,ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassFlags(e){this._renderContext.multipassTerrainParams.multipassTerrainEnabled=this._bindParameters.multipassTerrainEnabled=e,this._renderContext.multipassGeometryParams.multipassGeometryEnabled=this._bindParameters.multipassGeometryEnabled=e}_setTerrainCulling(e){this._renderContext.multipassTerrainParams.cullAboveGround=this._bindParameters.cullAboveGround=e}_renderSlot(e){this._renderContext.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;a(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),$.Alpha,r)}_renderShadowMap(e,r,t,s){const n=this._shadowMap;n.enabled&&(n.start(r,t,s),this.needsShadowHighlight?(this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,this._shadowMap,(e=>n.takeCascadeSnapshotTo(e,ee))),n.clear(),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_DEFAULT,this._shadowMap,(e=>{n.takeCascadeSnapshotTo(e,re),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT)}))):this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL),n.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this.needsShadowHighlight||this.needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._renderContext.ssrParams.linearDepthTexture=this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_DEPTH,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._renderContext.multipassTerrainParams.terrainLinearDepthTexture=this._bindParameters.terrainLinearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.pass;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(G.MATERIAL_DEPTH)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._renderContext.multipassGeometryParams.geometryLinearDepthTexture=this._bindParameters.geometryLinearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this.needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_NORMAL)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get needsDepthRange(){return this._shadowMap.enabled||this.needsShadowCast}_computeDepthRange(e){if(!this.needsDepthRange)return O;const r=I(e,this._content,this._stage.layers);return L(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.pass=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.pass=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(V.INTEGRATED_MESH),this._renderSlot(V.OPAQUE_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL),this._renderSlot(V.OPAQUE_PLUGIN),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(V.TRANSPARENT_MATERIAL),this._renderSlot(V.TRANSPARENT_PLUGIN)}_renderTransparentTerrain(){this._renderSlot(V.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(V.OCCLUSION_PIXELS)}),this._multipassTerrain&&!this._opaqueTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===x.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(V.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(V.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._offscreenRendering.hudColorTexture,$.PremultipliedAlpha)):e===x.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(x.OCCLUDED)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(V.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(V.HUD_MATERIAL),this._renderInternalSlot(V.LABEL_MATERIAL)}get needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlightHelper.isVisible&&this.needsHighlight}_renderHighlights(e,r){if(!this.needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlightHelper,s=t.profilingCallback&&he(this._renderContext.rctx);this._renderContext.highlightDepthTexture=r.highlightDepthTexture;const n=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_HIGHLIGHT),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(x.BOTH)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=n.colorTexture,this.needsShadowHighlight&&this._shadowHighlightHelper.render(r,e),t.render(this._renderContext.camera,n,e),a(s)&&t.profilingCallback&&s.stop((e=>{t.profilingCallback&&t.profilingCallback(e)}))}get needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this.needsShadowCast&&(this._shadowAccumulator.setAccumulationDependencies(this._offscreenRendering.linearDepthTexture,e,r,t),this._shadowAccumulator.accumulateFixedSamples(),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._renderContext.transparencyPassType=t,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_ALPHA,t(w.Alpha),this._renderContext.pass=G.MATERIAL,t(w.Color),t(w.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(r),this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._renderContext.pass=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===v.OccludeAndTransparentStencil&&(e|=t.renderOccluded,pe.push(t))}));const r=this._offscreenRendering,t=(t,s,n,i,a)=>{0!=(e&s)&&(r.renderToTargets(n,r.tmpColor,r.mainDepth,[0,0,0,0],i,a),r.compositeOccludedOntoMain(t))};0!==pe.length&&(this._renderInternalSlot(V.OCCLUDER_MATERIAL,pe),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(V.TRANSPARENT_OCCLUDER_MATERIAL,pe)),!1,!1),pe.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===v.OccludeAndTransparent||t.renderOccluded===v.Transparent||t.renderOccluded===v.Opaque)&&(e|=t.renderOccluded,_e.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,s>v.Occlude&&this._renderSlot(V.OCCLUDED_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,_e),this._renderContext.resetRenderOccludedMask()};this._renderContext.pass=G.MATERIAL,t(.5,v.OccludeAndTransparent,(()=>n(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>n(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>n(v.Opaque)),!0,D.OutlineVisualElementMask),_e.length=0}_renderAntiAliasing(e,r){if(e===b.SMAA){if(this._smaaPass.enable((()=>this._requestRender()))&&a(r))return this._smaaPass.render(r),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e){this._renderContext.camera=e,this._bindParameters.camera=this._renderContext.camera,this._bindParameters.inverseViewport[0]=1/this._renderContext.camera.fullViewport[2],this._bindParameters.inverseViewport[1]=1/this._renderContext.camera.fullViewport[3]}_ensureBindParameters(e){var r;this._ensureCameraBindParameters(e);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.shadowMap=this._renderContext.shadowMap,this._bindParameters.shadowMappingEnabled=this._renderContext.shadowMap.enabled,this._bindParameters.ssaoHelper=this._renderContext.ssaoHelper,this._bindParameters.ssaoEnabled=this._renderContext.ssaoHelper.enabled,this._bindParameters.slicePlane=this._renderContext.sliceHelper.plane,this._bindParameters.hasOccludees=this._renderContext.hasOccludees,this._renderContext.multipassTerrainParams.camera=this._renderContext.camera,this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.highlightDepthTexture=null!=(r=t.depthTexture)?r:this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._renderContext.camera)?this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=f:(m(ce,this._renderContext.lastFrameCamera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),m(ue,this._renderContext.camera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),u(ue,ue),u(me,this._renderContext.camera.projectionMatrix),g(ge,ue,me),g(ge,ce,ge),g(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=ge),this._renderContext.ssrParams.camera=this._renderContext.camera,this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=null,this._renderContext.ssrParams.ssrEnabled=this._bindParameters.ssrEnabled=this.hasWaterReflection}_ensureBindParametersCloudsReflections(){this._bindParameters.cloudsCompositionParams=this._renderContext.cloudsCompositionParams}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,a(r)?r.forEach((r=>{if(!r.shouldRender(this._renderContext))return;const s=this._materialRenderers.get(r);a(s)&&(t=s.render(e,this._renderContext.pass,this._bindParameters)||t)})):this._materialRenderers.forEach(((r,s)=>{s.shouldRender(this._renderContext)&&(t=r.render(e,this._renderContext.pass,this._bindParameters)||t)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=y(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){var e,r,t,s,n,i,a,h,o,d;return{offscreen:null!=(e=null==(r=this._offscreenRendering)?void 0:r.gpuMemoryUsage)?e:0,highlights:(null!=(t=null==(s=this._highlightHelper)?void 0:s.gpuMemoryUsage)?t:0)+(null!=(n=null==(i=this._shadowHighlightHelper)?void 0:i.gpuMemoryUsage)?n:0),shadows:null!=(a=null==(h=this._shadowMap)?void 0:h.gpuMemoryUsage)?a:0,ssao:null!=(o=null==(d=this._ssaoHelper)?void 0:d.gpuMemoryUsage)?o:0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlightHelper,lighting:this._lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{var t;switch(r){case le.Color:return e._offscreenRendering.colorTexture;case le.LinearDepth:return e._offscreenRendering.linearDepthTexture;case le.Normals:return e._offscreenRendering.normalTexture;case le.ShadowMap:return null==(t=e._shadowMap)?void 0:t.test.depthTexture;case le.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case le.Highlight:return e._offscreenRendering.highlightTexture}}}}};var le;e([_()],de.prototype,"_shadowAccumulator",void 0),e([_()],de.prototype,"_smaaPass",void 0),e([_()],de.prototype,"_antialiasing",void 0),e([_()],de.prototype,"_edgeView",void 0),e([_()],de.prototype,"updating",null),e([_()],de.prototype,"isCameraFinal",null),de=e([p("esri.views.3d.webgl-engine.lib.Renderer")],de),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(le||(le={}));const _e=[],pe=[],ce=T(),me=T(),ue=T(),ge=T();export{le as FramebufferId,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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as u,a as l}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as p}from"../../../../chunks/vec2f64.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{isNone as a,disposeMaybe as o}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as u,a as l}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as p}from"../../../../chunks/vec2f64.js";import{y as d,g}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{c as w}from"../../../../chunks/vec4f64.js";import v from"./Camera.js";import{ZERO as b}from"./depthRange.js";import{createQuadVAO as S}from"./glUtil3D.js";import{ShadowCastRenderer as j,shadowCastDisabledElevationThreshold as y,shadowCastDisableElevationMax as A,shadowCastDisableElevationMin as C}from"./ShadowCastRenderer.js";import R from"./ShadowMap.js";import{inverseProjectionInfo as T}from"./Util.js";import{S as D,s as F}from"../../../../chunks/ShadowCast.glsl.js";import{ShadowCastTechniqueConfiguration as E,ShadowCastTechnique as x}from"../shaders/ShadowCastTechnique.js";import{TaskPriority as M}from"../../../support/Scheduler.js";import{TargetType as P,DepthStencilTargetType as q,TextureType as U,PixelFormat as V,PixelType as I,TextureSamplingMode as k,TextureWrapMode as L,ClearBufferBit as O}from"../../../webgl/enums.js";import{FramebufferObject as N}from"../../../webgl/FramebufferObject.js";import{vertexCount as z}from"../../../webgl/Util.js";var B;let H=B=class extends t{constructor(e,t,i,r,o,c){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=c,this._progress=0,this._sampleCount=0,this._cachedCamera=new v,this._contentCamera=new v,this._enabled=!1,this._cachedLightDirections=[],this._depthRange=b,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._shadowMap=new R(e,i.viewingMode),this._shadowMap.enabled=!0,this._vao=S(e);const _={colorTarget:P.TEXTURE,depthStencilTarget:q.NONE,width:0,height:0},u={target:U.TEXTURE_2D,pixelFormat:V.RGBA,dataType:I.UNSIGNED_BYTE,samplingMode:k.LINEAR,wrapMode:L.CLAMP_TO_EDGE,width:0,height:0};this._fbo=new N(e,_,u),this._accumulationParams={camera:this._cachedCamera,linearDepthTexture:null,shadowMap:this._shadowMap,inverseView:m(),projInfo:w(),zScale:p()},this._accumulationRenderer=new j(t,e,this,c);const l=this._stage.resourceController.scheduler;this._handles.add(l.registerTask(M.SHADOW_ACCUMULATOR,this)),this._handles.add(n((()=>i.renderView),(e=>{this._handles.remove(B.renderViewHandleKey),a(e)||this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),B.renderViewHandleKey)}),h))}normalizeCtorArgs(){return{}}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get accumulationTechnique(){if(a(this._accumulationTechnique)){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode},t=new E;t.pass=D.Accumulate,this._accumulationTechnique=new x(e,t)}return this._accumulationTechnique}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._enabled&&this._sampleCount>0}get _canAccumulate(){return null!==this._accumulationParams.linearDepthTexture&&this._depthRange!==b&&this._opacityFromElevation>y}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,d))return;const s=e.length;t.length=s,this._sampleCount=Math.min(F,s);for(let i=0;i<s;++i){const s=e[i],r=t[i]||f();g(r,s),t[i]=r}this._invalidate()}get _projInfo(){return this._accumulationParams.projInfo}get _zScale(){return this._accumulationParams.zScale}get _inverseView(){return this._accumulationParams.inverseView}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this._canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._cachedCamera,this._contentCamera);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}accumulateFixedSamples(){if(!this.isAccumulating||!this._canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const e=this._cameraForcedForScreenshot?this._sampleCount:Math.min(B.previewSamples,this._sampleCount-this._progress);for(let t=0;t<e;++t)this._accumulateShadow();this._cameraForcedForScreenshot=!1}render(){this._accumulationRenderer.render()}dispose(){this._stop(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._shadowMap=o(this._shadowMap),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechnique=o(this._accumulationTechnique),this._cachedLightDirections.length=0,this._sampleCount=0}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.previewing&&this.setPreviewing(e.previewing),void 0!==e.lightDirections&&this.setLightDirections(e.lightDirections),this._accumulationRenderer.setOptions(e)}setPreviewing(e){this._previewing!==e&&(this._previewing=e,this._requestRenderIfEnabled())}setLightDirections(e){this._lightDirections=e}setAccumulationDependencies(e,t,i,s){this._accumulationParams.linearDepthTexture=e,this._depthRange=t,this._updateCamera(i),this._contentCamera=s,this.notifyChange("_canAccumulate")}readAccumulatedShadow(e,t){if(!this._isActive||this._progress<1||e<0||e>this._fbo.width||t<0||t>this._fbo.height)return 0;const i=G;return this._fbo.readPixels(e,t,1,1,V.RGBA,I.UNSIGNED_BYTE,i),i[0]/this._progress}_start(){this._progress=0,this._enabled=!0}_stop(){this._enabled=!1}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(O.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){const e=this._lightDirections[this._progress],t=this._cachedCamera;this._renderToShadowMap(this._shadowMap,e,t,this._depthRange),this._rctx.bindFramebuffer(this._fbo);const i=this.accumulationTechnique;this._rctx.useProgram(i.program),i.bindPipelineState(this._rctx),i.bindPass(this._accumulationParams),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,z(this._vao,"geometry")),this._progress++}_updateCamera(e){if(e.equals(this._cachedCamera))return;const{fullWidth:t,fullHeight:i,projectionMatrix:s,viewMatrix:a,center:o}=e;this._cachedCamera.copyFrom(e),this._fbo.resize(t,i),T(s,t,i,this._projInfo,this._zScale),u(this._inverseView,a,o),l(this._inverseView,this._inverseView),this._opacityFromElevation=1-r(C,A,e.relativeElevation)}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get test(){return{lightDirections:this._lightDirections,isDone:()=>this._isDoneAccumulating,isActive:()=>this._isActive}}};H.previewSamples=6,H.renderViewHandleKey="renderView",e([c()],H.prototype,"_progress",void 0),e([c()],H.prototype,"_sampleCount",void 0),e([c()],H.prototype,"_enabled",void 0),e([c()],H.prototype,"_depthRange",void 0),e([c()],H.prototype,"_previewing",void 0),e([c()],H.prototype,"_accumulationRenderer",void 0),e([c()],H.prototype,"_isRefining",null),e([c()],H.prototype,"_isActive",null),e([c()],H.prototype,"_canAccumulate",null),e([c()],H.prototype,"_isDoneAccumulating",null),e([c()],H.prototype,"_opacityFromElevation",null),e([c()],H.prototype,"running",null),H=B=e([_("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],H);const G=new Uint8Array(4);export{H 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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as
|
|
5
|
+
import{isNone as t,isSome as e}from"../../../../core/maybe.js";import i from"../../support/debugFlags.js";class s{constructor(t,e,i=2048){this.text=t,this._parameters=e,this.maxSize=i,this._lineWidths=new Array,this._renderPixelRatio=null,this._displayWidth=null,this._textHeight=null,this._baselinePosition=null,this.key=`${this._parameters.key}--${t}`,this._lines=t.split(/\r?\n/)}get displayWidth(){return Math.ceil(this._ensureTextWidth())}get displayHeight(){const t=this.lineSpacing*(this._lines.length-1),e=this.textHeight;return Math.ceil(t+e+2*this.haloSize)}get renderedWidth(){return Math.ceil(this._toRenderUnit(this.displayWidth))}get renderedHeight(){return Math.ceil(this._toRenderUnit(this.displayHeight))}get lineSpacing(){return(this.textHeight+this.linePadding)*this._parameters.definition.lineSpacingFactor}get textHeight(){return this._ensureHeightMetrics().textHeight}get linePadding(){return this.textHeight*l}get baselinePosition(){return this._ensureHeightMetrics().baselinePosition}get renderedFontSize(){return this._toRenderUnit(this.fontSize)}get fontSize(){return this._parameters.definition.size}get renderedHaloSize(){return this._toRenderUnit(this.haloSize)}get haloSize(){return this._parameters.haloSize}get renderPixelRatio(){if(t(this._renderPixelRatio)){const t=this._parameters.definition.pixelRatio;this.maxSize>0?this._renderPixelRatio=Math.min(t,Math.min(this.maxSize/(this.displayWidth*t),this.maxSize/(this.displayHeight*t))):this._renderPixelRatio=t}return this._renderPixelRatio}_getLineXOffset(t){return(this.displayWidth-this._lineWidths[t])/2}render(t,e=0,s=0){t.save();const h=e/=this.renderPixelRatio,r=s/=this.renderPixelRatio,o=n(t.textAlign,this.displayWidth)+this.haloSize,l=this.haloSize;s+=l+this.baselinePosition,e+=o,this.haloSize>0&&this._renderHalo(t,h,r,o,l),this._setFontProperties(t,this.renderedFontSize);for(let i=0;i<this._lines.length;++i){t.globalCompositeOperation="destination-out",t.fillStyle="rgb(0, 0, 0)";const n=this._lines[i],h=this._getLineXOffset(i);this._fillText(t,n,e+h,s),t.globalCompositeOperation="source-over",t.fillStyle=this._parameters.fillStyle,this._fillText(t,n,e+this._getLineXOffset(i),s),s+=this.lineSpacing}if(i.TEXT_SHOW_BASELINE){t.strokeStyle=d,t.setLineDash([2,2]),t.lineWidth=1;let e=r+l;for(let i=0;i<this._lines.length;++i){const i=e+this.baselinePosition;this._drawLine(t,[h,i],[h+this.displayWidth,i]),e+=this.lineSpacing}}i.TEXT_SHOW_BORDER&&(t.strokeStyle=d,t.setLineDash([]),t.lineWidth=1,this._drawBox(t,[h,r],[this.displayWidth,this.displayHeight])),t.restore()}_renderHalo(t,e,i,s,n){const h=this.renderedWidth,l=this.renderedHeight,d=r(o,Math.max(h,a),Math.max(l,a)),_=d.getContext("2d");_.clearRect(0,0,h,l),this._setFontProperties(_,this.renderedFontSize),_.fillStyle=this._parameters.haloStyle,_.strokeStyle=this._parameters.haloStyle;const g=this.renderedHaloSize<3;_.lineJoin=g?"miter":"round",g?this._renderHaloEmulated(_,s,n):this._renderHaloNative(_,s,n),t.globalAlpha=this._parameters.definition.halo.color[3],t.drawImage(d,0,0,h,l,this._toRenderUnit(e),this._toRenderUnit(i),h,l),t.globalAlpha=1}_renderHaloEmulated(t,e,i){i+=this.baselinePosition;for(let s=0;s<this._lines.length;++s){const n=this._lines[s],r=this._getLineXOffset(s);for(const[s,o]of h)this._fillText(t,n,e+r+this.haloSize*s,i+this.haloSize*o);i+=this.lineSpacing}}_renderHaloNative(t,e,i){const s=2*this.haloSize;i+=this.baselinePosition;for(let n=0;n<this._lines.length;++n){const h=this._lines[n],r=this._getLineXOffset(n),o=5,l=.1;for(let n=0;n<o;n++){const a=1-(o-1)*l+n*l;t.lineWidth=this._toRenderUnit(a*s),this._strokeText(t,h,e+r,i)}i+=this.lineSpacing}}_setFontProperties(t,e){t.font=this._parameters.fontString(e),t.textAlign="left",t.textBaseline="alphabetic"}_ensureTextWidth(){if(e(this._displayWidth))return this._displayWidth;const t=r(o,a,a).getContext("2d");this._setFontProperties(t,this.fontSize);let i=0,s=2*this.haloSize;this._lineWidths.length=0;const n=this._parameters.definition.font;("italic"===n.style||"oblique"===n.style||"string"==typeof n.weight&&("bold"===n.weight||"bolder"===n.weight)||"number"==typeof n.weight&&n.weight>600)&&(s+=.3*t.measureText("A").width);for(const e of this._lines){const n=t.measureText(e).width+s;this._lineWidths.push(n),i=Math.max(i,n)}return this._displayWidth=i,this._displayWidth}_ensureHeightMetrics(){if(t(this._textHeight)||t(this._baselinePosition)){const t=this.text+_,e=r(o,a,a).getContext("2d");this._setFontProperties(e,this.fontSize);const i=e.measureText(t),s=i.actualBoundingBoxAscent+i.actualBoundingBoxDescent;this._textHeight=s,this._baselinePosition=i.actualBoundingBoxAscent}return{textHeight:this._textHeight,baselinePosition:this._baselinePosition}}_toRenderUnit(t){return t*this.renderPixelRatio}_toRoundedRenderUnit(t){return Math.round(t*this.renderPixelRatio)}_fillText(t,e,i,s){t.fillText(e,this._toRenderUnit(i),this._toRenderUnit(s))}_strokeText(t,e,i,s){t.strokeText(e,this._toRenderUnit(i),this._toRenderUnit(s))}_drawLine(t,e,i){t.beginPath(),t.moveTo(this._toRoundedRenderUnit(e[0])+.5,this._toRoundedRenderUnit(e[1])+.5),t.lineTo(this._toRoundedRenderUnit(i[0])+.5,this._toRoundedRenderUnit(i[1])+.5),t.stroke()}_drawBox(t,e,i){const s=this._toRenderUnit(e[0]),n=this._toRenderUnit(e[1]),h=this._toRenderUnit(i[0]),r=this._toRenderUnit(i[1]),o=Math.floor(s)+.5,l=Math.ceil(s+h)-.5,a=Math.floor(n)+.5,d=Math.ceil(n+r)-.5;t.beginPath(),t.moveTo(o,a),t.lineTo(l,a),t.lineTo(l,d),t.lineTo(o,d),t.lineTo(o,a),t.stroke()}}function n(t,e){return"center"===t?.5*e:"right"===t?e:0}const h=[];{const t=16;for(let e=0;e<360;e+=360/t)h.push([Math.cos(Math.PI*e/180),Math.sin(Math.PI*e/180)])}function r(t,e,i){return t.canvas||(t.canvas=document.createElement("canvas")),t.canvas.width=e,t.canvas.height=i,t.canvas}const o={canvas:null},l=.2,a=512,d="rgb(255, 0, 255, 0.5)",_=(()=>{let t="";for(let e=32;e<127;e++)t+=String.fromCharCode(e);return t})();export{s as TextRenderer,s as default,r as getTextHelperCanvas};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{I as a,c as n}from"../../../../../chunks/mat4f64.js";import{a as i}from"../../../../../chunks/vec2f64.js";import{f as r,d as l,m as o}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec3f64.js";import{c as h}from"../../../../../chunks/vec4f64.js";import d from"../../../support/debugFlags.js";import{glLayout as u}from"../../../support/buffer/glUtil.js";import{bindOutputHighlight as _}from"../../core/shaderLibrary/output/OutputHighlight.glsl.js";import p from"../Camera.js";import{Default3D as m}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import{DepthOrder as g}from"../Octree.js";import{RenderPass as I}from"../RenderPass.js";import{RenderSlot as D}from"../RenderSlot.js";import{assert as v}from"../Util.js";import{InstanceData as y,StateFlags as E}from"./InstanceData.js";import{InstanceOctree as T}from"./InstanceOctree.js";import{LevelSelector as R}from"./LevelSelector.js";import{LodLevel as A}from"./LodLevel.js";import{RenderInstanceData as b}from"./RenderInstanceData.js";import{getInstanceBufferLayout as C}from"../../materials/DefaultMaterial.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as S}from"../../materials/renderers/utils.js";import{bindVertexBufferLayout as U,unbindVertexBufferLayout as x}from"../../../../webgl/Util.js";let P=function(e){const t=e.baseBoundingSphere.radius,s=e.levels.map((e=>e.minScreenSpaceRadius));return new R(t,s)};function O(e){P=e}class H{constructor(e,t,s,a){this.type=f.LOD,this.isGround=!1,this._inverseViewport=i(),this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new p,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[D.OPAQUE_PLUGIN,D.TRANSPARENT_PLUGIN],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=s,this._instanceBufferLayout=C({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=u(this._instanceBufferLayout,1),this._instanceData=new y(this._optionalFields,a),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=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 layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),this._highlightRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,s)=>{const a=this._defaultRenderInstanceData[s],n=this._highlightRenderInstanceData[s],i=a.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,a){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new b(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new b(n,this._instanceBufferLayout)),A.create(e,t,a))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(a)||r.length!==i.length){r.forEach((e=>e.destroy())),s(a);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=P(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(D.TRANSPARENT_MATERIAL)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e,t){if(d.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const e=t.equals(this._lastCamera);this._lastCamera.copyFrom(t),e||this._requestUpdateCycle()}const s=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(t,s),this.needsUpdates&&this._context.requestRender()}render(e){var t,s,n,i;const r=e.slot===D.OPAQUE_PLUGIN?D.OPAQUE_MATERIAL:e.slot===D.TRANSPARENT_PLUGIN?D.TRANSPARENT_MATERIAL:null;if(!r||!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleInPass(e.pass))return;const l=e.camera;this._inverseViewport[0]=1/l.fullViewport[2],this._inverseViewport[1]=1/l.fullViewport[3];const o={slot:r,origin:[0,0,0],camera:l,inverseViewport:this._inverseViewport,shadowMap:e.shadowMap,shadowMappingEnabled:e.shadowMap.enabled,ssaoHelper:e.ssaoHelper,ssaoEnabled:e.ssaoHelper.enabled,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:e.sliceHelper&&e.sliceHelper.plane,hudVisibilityTexture:null!=(t=null==(s=e.offscreenRenderingHelper)?void 0:s.hudVisibilityTexture)?t:null,highlightDepthTexture:null!=(n=null==(i=e.offscreenRenderingHelper)?void 0:i.depthTexture)?n:null,hasOccludees:!1,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:a,ssrEnabled:!1,lighting:e.scenelightingData,transparencyPassType:e.transparencyPassType,terrainLinearDepthTexture:e.multipassTerrainParams.terrainLinearDepthTexture,geometryLinearDepthTexture:e.multipassGeometryParams.geometryLinearDepthTexture,multipassTerrainEnabled:e.multipassTerrainParams.multipassTerrainEnabled,cullAboveGround:e.multipassTerrainParams.cullAboveGround,multipassGeometryEnabled:e.multipassGeometryParams.multipassGeometryEnabled,highlightColorTexture:null};e.rctx.bindVAO();const c=e.pass!==I.MATERIAL_HIGHLIGHT&&e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,h=e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_DEFAULT;c&&this._renderComponents(e,r,o,this._defaultRenderInstanceData),h&&this._renderComponents(e,r,o,this._highlightRenderInstanceData)}intersect(e,t,s,a){if(!this.baseMaterial.isVisible())return;const n=c();r(n,a,s);const i=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),o(G,s,e.transform.inverse),o(F,a,e.transform.inverse);const i=this._instanceData.getState(n),r=this._instanceData.getLodLevel(n);v(i&E.ACTIVE,"invalid instance state"),v(r>=0&&r<this._levels.length,"invaid lod level"),this._levels[r].intersect(e,t,G,F,n,this._metadata)};this.baseMaterial.parameters.verticalOffset?this.octree.forEach(i):this.octree.forEachAlongRay(s,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this.needsUpdates&&this._context.requestRender()}get needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get octree(){return this._octree||(this._octree=this._buildOctree()),this._octree}_invalidateOctree(){this._octree&&(this._octree.destroy(),this._octree=null)}_buildOctree(){const e=new T(this._instanceData,this.baseBoundingSphere),t=this._instanceData,s=t.view?t.view.state:null;for(let a=0;a<this._instanceData.capacity;++a){s.get(a)&E.ACTIVE&&e.addInstance(a)}return e}_queryDepthRangeOctree(e){const t=e.eye,s=e.viewForward,a=this.octree.findClosest(s,g.FRONT_TO_BACK,e.frustum),n=this.octree.findClosest(s,g.BACK_TO_FRONT,e.frustum);if(null!=a&&null!=n){this._instanceData.view.boundingSphere.getVec(a,j),r(j,j,t);const i=l(j,s)-j[3];this._instanceData.view.boundingSphere.getVec(n,j),r(j,j,t);const o=l(j,s)+j[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this.needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const s=this._enableLevelSelection,a=this._levelSelector;a.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,l=n.capacity;let o=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===o&&this._startUpdateCycle();const e=i.state.get(o);let r=0;if(!(e&E.ALLOCATED)){o=(o+1)%l,t++;continue}const c=i.lodLevel.get(o);if(e&E.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&E.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&E.REMOVE)n.freeInstance(o);else if(e&E.VISIBLE){let t=0;s&&(i.modelOrigin.getVec(o,w),t=a.selectLevel(w,n.getCombinedMedianScaleFactor(o))),r=e&~(E.ACTIVE|E.TRANSFORM_CHANGED),t>=0&&(e&E.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,o),r|=E.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,o),r|=E.DEFAULT_ACTIVE)),i.state.set(o,r),i.lodLevel.set(o,t)}else r=e&~(E.ACTIVE|E.TRANSFORM_CHANGED),i.state.set(o,r);if(this._octree){const t=!!(e&E.ACTIVE),s=!!(r&E.ACTIVE);!t&&s?this._octree.addInstance(o):t&&!s?this._octree.removeInstance(o):t&&s&&e&E.TRANSFORM_CHANGED&&(this._octree.removeInstance(o),this._octree.addInstance(o))}o=(o+1)%l}this._instanceIndex=o,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t,s,a){this.levels.forEach(((n,i)=>{n.components.forEach((n=>{this._renderComponent(e,t,s,a[i],n,i)}))}))}_renderComponent(t,s,a,n,i,r){if(0===n.size||!i.material.requiresSlot(s))return;const{rctx:l,pass:o}=t,c=i.glMaterials.load(l,o);if(e(c))return;const h=l.capabilities.instancing,u=c.beginSlot(a),p=u.program;u.bindPipelineState(l,s),l.useProgram(p),c.bind(a,u),l.bindVAO(i.vao),u.ensureAttributeLocations(i.vao),t.isHighlightPass&&_(p,a),u.bindDraw(a),d.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.pass===I.MATERIAL&&(p.setUniform4fv("externalColor",B[Math.min(r,B.length-1)]),p.setUniform1i("colorMixMode",L.replace));const f=n.capacity,g=n.headIndex,D=n.tailIndex,y=n.firstIndex,E=this._glInstanceBufferLayout,T=(e,t)=>{U(l,m,n.buffer,E,e),h.drawArraysInstanced(u.primitiveType,0,i.vertexCount,t-e),x(l,m,n.buffer,E)};i.material.parameters.transparent&&null!=y?g>D?(v(y>=D&&y<=g,"invalid firstIndex"),T(y,g),T(D,y)):g<D&&(y<=g?(v(y>=0&&y<=g,"invalid firstIndex"),T(y,g),T(D,f),T(0,y)):(v(y>=D&&y<=f,"invalid firstIndex"),T(y,f),T(0,g),T(D,y))):g>D?T(D,g):g<D&&(T(0,g),T(D,f)),l.bindVAO(null)}}function M(e,t,s){const a=e.allocateHead();V(t,s,e.view,a)}function V(e,t,s,a){S(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,a),s.model.copyFrom(a,e.model,t),s.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(a,e.color,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(a,e.featureAttribute,t)}const w=c(),j=h(),N=n(),G=c(),F=c(),B=[[1,0,1,1],[0,0,1,1],[0,1,0,1],[1,1,0,1],[1,0,0,1]];export{H as LodRenderer,O as setLevelSelectorFactory};
|
|
5
|
+
import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{I as a,c as n}from"../../../../../chunks/mat4f64.js";import{a as i}from"../../../../../chunks/vec2f64.js";import{f as r,d as l,m as o}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec3f64.js";import{c as h}from"../../../../../chunks/vec4f64.js";import d from"../../../support/debugFlags.js";import{glLayout as u}from"../../../support/buffer/glUtil.js";import{bindOutputHighlight as _}from"../../core/shaderLibrary/output/OutputHighlight.glsl.js";import m from"../Camera.js";import{Default3D as p}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import{DepthOrder as g}from"../Octree.js";import{RenderPass as I}from"../RenderPass.js";import{RenderSlot as D}from"../RenderSlot.js";import{assert as v}from"../Util.js";import{InstanceData as y,StateFlags as E}from"./InstanceData.js";import{InstanceOctree as T}from"./InstanceOctree.js";import{LevelSelector as R}from"./LevelSelector.js";import{LodLevel as A}from"./LodLevel.js";import{RenderInstanceData as C}from"./RenderInstanceData.js";import{getInstanceBufferLayout as b}from"../../materials/DefaultMaterial.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as S}from"../../materials/renderers/utils.js";import{bindVertexBufferLayout as U,unbindVertexBufferLayout as x}from"../../../../webgl/Util.js";let P=function(e){const t=e.baseBoundingSphere.radius,s=e.levels.map((e=>e.minScreenSpaceRadius));return new R(t,s)};function O(e){P=e}class H{constructor(e,t,s,a){this.type=f.LOD,this.isGround=!1,this._inverseViewport=i(),this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new m,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[D.OPAQUE_PLUGIN,D.TRANSPARENT_PLUGIN],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=s,this._instanceBufferLayout=b({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=u(this._instanceBufferLayout,1),this._instanceData=new y(this._optionalFields,a),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=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 layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),this._highlightRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,s)=>{const a=this._defaultRenderInstanceData[s],n=this._highlightRenderInstanceData[s],i=a.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,a){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new C(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new C(n,this._instanceBufferLayout)),A.create(e,t,a))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(a)||r.length!==i.length){r.forEach((e=>e.destroy())),s(a);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=P(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(D.TRANSPARENT_MATERIAL)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e,t){if(d.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const e=t.equals(this._lastCamera);this._lastCamera.copyFrom(t),e||this._requestUpdateCycle()}const s=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(t,s),this.needsUpdates&&this._context.requestRender()}render(e){var t,s,n,i;const r=e.slot===D.OPAQUE_PLUGIN?D.OPAQUE_MATERIAL:e.slot===D.TRANSPARENT_PLUGIN?D.TRANSPARENT_MATERIAL:null;if(!r||!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleInPass(e.pass))return;const l=e.camera;this._inverseViewport[0]=1/l.fullViewport[2],this._inverseViewport[1]=1/l.fullViewport[3];const o={slot:r,origin:[0,0,0],camera:l,inverseViewport:this._inverseViewport,shadowMap:e.shadowMap,shadowMappingEnabled:e.shadowMap.enabled,ssaoHelper:e.ssaoHelper,ssaoEnabled:e.ssaoHelper.enabled,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:e.sliceHelper&&e.sliceHelper.plane,hudVisibilityTexture:null!=(t=null==(s=e.offscreenRenderingHelper)?void 0:s.hudVisibilityTexture)?t:null,highlightDepthTexture:null!=(n=null==(i=e.offscreenRenderingHelper)?void 0:i.depthTexture)?n:null,hasOccludees:!1,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:a,ssrEnabled:!1,lighting:e.scenelightingData,transparencyPassType:e.transparencyPassType,terrainLinearDepthTexture:e.multipassTerrainParams.terrainLinearDepthTexture,geometryLinearDepthTexture:e.multipassGeometryParams.geometryLinearDepthTexture,multipassTerrainEnabled:e.multipassTerrainParams.multipassTerrainEnabled,cullAboveGround:e.multipassTerrainParams.cullAboveGround,multipassGeometryEnabled:e.multipassGeometryParams.multipassGeometryEnabled,highlightColorTexture:null,cloudsCompositionParams:null};e.rctx.bindVAO();const c=e.pass!==I.MATERIAL_HIGHLIGHT&&e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,h=e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_DEFAULT;c&&this._renderComponents(e,r,o,this._defaultRenderInstanceData),h&&this._renderComponents(e,r,o,this._highlightRenderInstanceData)}intersect(e,t,s,a){if(!this.baseMaterial.isVisible())return;const n=c();r(n,a,s);const i=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),o(G,s,e.transform.inverse),o(F,a,e.transform.inverse);const i=this._instanceData.getState(n),r=this._instanceData.getLodLevel(n);v(i&E.ACTIVE,"invalid instance state"),v(r>=0&&r<this._levels.length,"invaid lod level"),this._levels[r].intersect(e,t,G,F,n,this._metadata)};this.baseMaterial.parameters.verticalOffset?this.octree.forEach(i):this.octree.forEachAlongRay(s,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this.needsUpdates&&this._context.requestRender()}get needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get octree(){return this._octree||(this._octree=this._buildOctree()),this._octree}_invalidateOctree(){this._octree&&(this._octree.destroy(),this._octree=null)}_buildOctree(){const e=new T(this._instanceData,this.baseBoundingSphere),t=this._instanceData,s=t.view?t.view.state:null;for(let a=0;a<this._instanceData.capacity;++a){s.get(a)&E.ACTIVE&&e.addInstance(a)}return e}_queryDepthRangeOctree(e){const t=e.eye,s=e.viewForward,a=this.octree.findClosest(s,g.FRONT_TO_BACK,e.frustum),n=this.octree.findClosest(s,g.BACK_TO_FRONT,e.frustum);if(null!=a&&null!=n){this._instanceData.view.boundingSphere.getVec(a,j),r(j,j,t);const i=l(j,s)-j[3];this._instanceData.view.boundingSphere.getVec(n,j),r(j,j,t);const o=l(j,s)+j[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this.needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const s=this._enableLevelSelection,a=this._levelSelector;a.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,l=n.capacity;let o=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===o&&this._startUpdateCycle();const e=i.state.get(o);let r=0;if(!(e&E.ALLOCATED)){o=(o+1)%l,t++;continue}const c=i.lodLevel.get(o);if(e&E.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&E.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&E.REMOVE)n.freeInstance(o);else if(e&E.VISIBLE){let t=0;s&&(i.modelOrigin.getVec(o,w),t=a.selectLevel(w,n.getCombinedMedianScaleFactor(o))),r=e&~(E.ACTIVE|E.TRANSFORM_CHANGED),t>=0&&(e&E.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,o),r|=E.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,o),r|=E.DEFAULT_ACTIVE)),i.state.set(o,r),i.lodLevel.set(o,t)}else r=e&~(E.ACTIVE|E.TRANSFORM_CHANGED),i.state.set(o,r);if(this._octree){const t=!!(e&E.ACTIVE),s=!!(r&E.ACTIVE);!t&&s?this._octree.addInstance(o):t&&!s?this._octree.removeInstance(o):t&&s&&e&E.TRANSFORM_CHANGED&&(this._octree.removeInstance(o),this._octree.addInstance(o))}o=(o+1)%l}this._instanceIndex=o,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t,s,a){this.levels.forEach(((n,i)=>{n.components.forEach((n=>{this._renderComponent(e,t,s,a[i],n,i)}))}))}_renderComponent(t,s,a,n,i,r){if(0===n.size||!i.material.requiresSlot(s))return;const{rctx:l,pass:o}=t,c=i.glMaterials.load(l,o);if(e(c))return;const h=l.capabilities.instancing,u=c.beginSlot(a),m=u.program;u.bindPipelineState(l,s),l.useProgram(m),c.bind(a,u),l.bindVAO(i.vao),u.ensureAttributeLocations(i.vao),t.isHighlightPass&&_(m,a),u.bindDraw(a),d.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.pass===I.MATERIAL&&(m.setUniform4fv("externalColor",B[Math.min(r,B.length-1)]),m.setUniform1i("colorMixMode",L.replace));const f=n.capacity,g=n.headIndex,D=n.tailIndex,y=n.firstIndex,E=this._glInstanceBufferLayout,T=(e,t)=>{U(l,p,n.buffer,E,e),h.drawArraysInstanced(u.primitiveType,0,i.vertexCount,t-e),x(l,p,n.buffer,E)};i.material.parameters.transparent&&null!=y?g>D?(v(y>=D&&y<=g,"invalid firstIndex"),T(y,g),T(D,y)):g<D&&(y<=g?(v(y>=0&&y<=g,"invalid firstIndex"),T(y,g),T(D,f),T(0,y)):(v(y>=D&&y<=f,"invalid firstIndex"),T(y,f),T(0,g),T(D,y))):g>D?T(D,g):g<D&&(T(0,g),T(D,f)),l.bindVAO(null)}}function M(e,t,s){const a=e.allocateHead();V(t,s,e.view,a)}function V(e,t,s,a){S(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,a),s.model.copyFrom(a,e.model,t),s.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(a,e.color,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(a,e.featureAttribute,t)}const w=c(),j=h(),N=n(),G=c(),F=c(),B=[[1,0,1,1],[0,0,1,1],[0,1,0,1],[1,1,0,1],[1,0,0,1]];export{H as LodRenderer,O as setLevelSelectorFactory};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../../../chunks/tslib.es6.js";import{
|
|
5
|
+
import{_ as r}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/has.js";import{bindCloudsComposition as t}from"../../environment/CloudsComposition.js";import{ShaderOutput as o}from"../core/shaderLibrary/ShaderOutputOptions.js";import{bindSliceUniformsWithOrigin as i}from"../core/shaderLibrary/Slice.glsl.js";import{bindOutputHighlight as s}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{bindMultipassTerrainTexture as a}from"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{PBRMode as n}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{bindReadShadowMapUniforms as p}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{bindSSRUniforms as l}from"../core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js";import{bindWaterDistortionUniforms as u}from"../core/shaderLibrary/shading/WaterDistortion.glsl.js";import{bindProjectionMatrix as h,bindView as c,bindCameraPosition as d}from"../core/shaderLibrary/util/View.glsl.js";import{ReloadableShaderModule as m}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as g}from"../core/shaderTechnique/ShaderTechnique.js";import{parameter as f,ShaderTechniqueConfiguration as b}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TransparencyPassType as y}from"../lib/basicInterfaces.js";import{Default3D as v}from"../lib/DefaultVertexAttributeLocations.js";import{blendingDefault as T,oitBlending as S,oitDepthTest as j,oitDepthWrite as w,getOITPolygonOffset as P}from"../lib/OrderIndependentTransparency.js";import{Program as C}from"../lib/Program.js";import{W as E}from"../../../../chunks/WaterSurface.glsl.js";import{makePipelineState as x,defaultDepthWriteParams as O,defaultColorWriteParams as R}from"../../../webgl/renderState.js";class D extends g{constructor(r,e,t){super(r,e,t),this._textureRepository=r.waterTextureRepository}initializeProgram(r){const t=D.shader.get(),o=this.configuration,i=t.build({OITEnabled:o.transparencyPassType===y.Color,output:o.output,viewingMode:r.viewingMode,slicePlaneEnabled:o.slicePlaneEnabled,sliceHighlightDisabled:!1,sliceEnabledForVertexPrograms:!1,receiveShadows:o.receiveShadows,pbrMode:n.Water,useCustomDTRExponentForWater:!0,ssrEnabled:o.useSSR,cloudsReflectionsEnable:e("enable-feature:clouds-reflections"),highStepCount:!0,multipassTerrainEnabled:o.multipassTerrainEnabled,cullAboveGround:o.cullAboveGround});return new C(r.rctx,i,v)}bindPass(r,i){h(this.program,i.camera.projectionMatrix),i.multipassTerrainEnabled&&(this.program.setUniform2fv("cameraNearFar",i.camera.nearFar),this.program.setUniform2fv("inverseViewport",i.inverseViewport),a(this.program,i)),this.configuration.output===o.Color&&(i.lighting.setUniforms(this.program,!1),l(this.program,i),e("enable-feature:clouds-reflections")&&t(this.program,i.camera,i.cloudsCompositionParams)),this.configuration.output!==o.Color&&this.configuration.output!==o.Normal||(u(this.program,r),this._textureRepository.bind(this.program)),this.program.setUniform4fv("waterColor",r.color),this.configuration.output===o.Highlight&&s(this.program,i)}bindDraw(r){c(this.program,r),this.program.rebindTextures(),this.configuration.output!==o.Color&&this.configuration.output!==o.Alpha||d(this.program,r.origin,r.camera.viewInverseTransposeMatrix),this.configuration.output===o.Color&&p(this.program,r),this.configuration.output!==o.Color&&this.configuration.output!==o.Alpha&&this.configuration.output!==o.Highlight||i(this.program,this.configuration,r)}_setPipelineState(r){const e=this.configuration,t=r===y.NONE,i=r===y.FrontFace;return x({blending:e.output!==o.Normal&&e.output!==o.Highlight&&e.transparent?t?T:S(r):null,depthTest:{func:j(r)},depthWrite:t?e.writeDepth&&O:w(r),colorWrite:R,polygonOffset:t||i?null:P(e.enableOffset)})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}D.shader=new m(E,(()=>import("../shaders/WaterSurface.glsl.js")));class L extends b{constructor(){super(...arguments),this.output=o.Color,this.receiveShadows=!1,this.slicePlaneEnabled=!1,this.transparent=!1,this.enableOffset=!0,this.writeDepth=!1,this.useSSR=!1,this.isDraped=!1,this.transparencyPassType=y.NONE,this.multipassTerrainEnabled=!1,this.cullAboveGround=!1}}r([f({count:o.COUNT})],L.prototype,"output",void 0),r([f()],L.prototype,"receiveShadows",void 0),r([f()],L.prototype,"slicePlaneEnabled",void 0),r([f()],L.prototype,"transparent",void 0),r([f()],L.prototype,"enableOffset",void 0),r([f()],L.prototype,"writeDepth",void 0),r([f()],L.prototype,"useSSR",void 0),r([f()],L.prototype,"isDraped",void 0),r([f({count:y.COUNT})],L.prototype,"transparencyPassType",void 0),r([f()],L.prototype,"multipassTerrainEnabled",void 0),r([f()],L.prototype,"cullAboveGround",void 0);export{D as WaterTechnique,L as WaterTechniqueConfiguration};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/ShaderOutputOptions.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/output/ReadLinearDepth.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/Water.glsl.js";import"../core/shaderLibrary/shading/WaterDistortion.glsl.js";import"../core/shaderLibrary/util/AlphaDiscard.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/basicInterfaces.js";export{b as build}from"../../../../chunks/WaterSurface.glsl.js";
|
|
5
|
+
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/ShaderOutputOptions.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/output/ReadLinearDepth.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js";import"../core/shaderLibrary/shading/EvaluateMainLighting.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/Water.glsl.js";import"../core/shaderLibrary/shading/WaterDistortion.glsl.js";import"../core/shaderLibrary/util/AlphaDiscard.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/basicInterfaces.js";export{b as build}from"../../../../chunks/WaterSurface.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.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../geometry.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{isSome as r,isNone as o,unwrap as a}from"../../core/maybe.js";import{createScreenPoint as c}from"../../core/screenUtils.js";import{f as s}from"../../chunks/vec3f64.js";import{project as i}from"../../geometry/projection.js";import{ViewingMode as l}from"../ViewingMode.js";import{move as u}from"../draw/support/drawUtils.js";import m from"../../geometry/Point.js";function f(t,n){let e=null,a=null;return c=>{if("cancel"===c.action)return void(r(a)&&(a.execute({action:"cancel"}),e=null,a=null));const s={action:c.action,screenStart:c.start,screenEnd:c.screenPoint};"start"===c.action&&o(e)&&(e=new
|
|
5
|
+
import"../../geometry.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{isSome as r,isNone as o,unwrap as a}from"../../core/maybe.js";import{createScreenPoint as c}from"../../core/screenUtils.js";import{f as s}from"../../chunks/vec3f64.js";import{project as i}from"../../geometry/projection.js";import{ViewingMode as l}from"../ViewingMode.js";import{move as u}from"../draw/support/drawUtils.js";import m from"../../geometry/Point.js";function f(t,n){let e=null,a=null;return c=>{if("cancel"===c.action)return void(r(a)&&(a.execute({action:"cancel"}),e=null,a=null));const s={action:c.action,screenStart:c.start,screenEnd:c.screenPoint};"start"===c.action&&o(e)&&(e=new G,a=new G,n(t,e,a,c.pointerType,s)),r(e)&&e.execute(s),"end"===c.action&&r(e)&&(e=null,a=null)}}function p(t,n){return t.events.on("drag",f(t,n))}function y(n,e){const r=[];for(const t of n)r.push(p(t,e));return t(r)}function d(t,n){const e=[t.x,t.y,t.z],r=n,o=[Math.cos(r),Math.sin(r)],a=Math.sqrt(o[0]*o[0]+o[1]*o[1]);if(0===a)return null;o[0]/=a,o[1]/=a;const c=t=>{const n=(t.x-e[0])*o[0]+(t.y-e[1])*o[1];t.x=e[0]+n*o[0],t.y=e[1]+n*o[1]};return t=>(c(t.mapStart),c(t.mapEnd),t)}function x(t,n){let e=null;return r=>{if("start"===r.action&&(e=h(t,r.mapStart.spatialReference,n)),o(e))return null;const a=r.mapEnd.x-r.mapStart.x,c=r.mapEnd.y-r.mapStart.y,s=r.mapEnd.z-r.mapStart.z;return e.move(a,c,s),{...r,translationX:a,translationY:c,translationZ:s}}}function g(t,n){return o(t)?null:t.spatialReference.equals(n)?t.clone():i(t,n)}function h(t,n,e){const r=t.geometry;if(o(r))return null;if("mesh"===r.type)return E(t,r,n,e);const a=g(r,n),c=r.spatialReference;return o(a)?null:{move:(n,e,r)=>{const o=u(a.clone(),n,e,r);o.spatialReference.equals(c)?t.geometry=o:t.geometry=i(o,c)}}}function E(t,n,e,o){if(r(n.transform))return S(t,n,n.transform,e);if(!n.spatialReference.equals(e))return null;let a=0,c=0,s=0;return{move:(e,r,i)=>{const u=e-a,f=r-c,p=i-s;if(u||f||p){const y=new m(n.origin.x+u,n.origin.y+f,n.origin.z+p,n.origin.spatialReference);n.centerAt(y,{geographic:o===l.Global}),t.notifyGeometryChanged(),a=e,c=r,s=i}}}}function S(t,n,e,a){const c=g(e.getOriginPoint(n.spatialReference),a),l=n.spatialReference;return o(c)?null:{move:(n,o,a)=>{const m=u(c.clone(),n,o,a);if(m.spatialReference.equals(l))e.origin=s(m.x,m.y,m.z);else{const t=i(m,l);r(t)&&(e.origin=s(t.x,t.y,t.z))}t.notifyMeshTransformChanged(),t.notifyGeometryChanged()}}}function j(t,n=null,e){let a=null;const c=r(n)&&!t.spatialReference.equals(n)?t=>r(t)?i(t,n):t:t=>t,s={exclude:[],...e};return n=>{if("start"===n.action&&(a=c(t.toMap(n.screenStart,s))),o(a))return null;const e=c(t.toMap(n.screenEnd,s));return r(e)?{...n,mapStart:a,mapEnd:e}:null}}function R(t,n){const e=t.map((t=>a(x(t,n)))).filter((t=>r(t)));return t=>{const n=t.mapEnd.x-t.mapStart.x,r=t.mapEnd.y-t.mapStart.y,o=t.mapEnd.z-t.mapStart.z;return e.forEach((n=>n(t))),{...t,translationX:n,translationY:r,translationZ:o}}}function z(t,e){const r=new Map;for(const o of e)r.set(o,n(t[o]));return n=>(r.forEach(((n,e)=>{t[e]=n})),n)}function w(t){return r(t.geometry)&&"mesh"===t.geometry.type?v(t,t.geometry):z(t,["geometry"])}function v(t,n){const e=r(n.transform)?n.transform.clone():null,o=n.vertexAttributes.clonePositional();return r=>(n.transform=e,n.vertexAttributes=o,t.notifyGeometryChanged(),r)}function M(t){const n=t.map((t=>a(w(t)))).filter((t=>r(t)));return t=>(n.forEach((n=>n(t))),t)}function q(t){return z(t,["symbol"])}function D(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z);const o=r.mapEnd.x-t,a=r.mapEnd.y-n,c=r.mapEnd.z-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:o,mapDeltaY:a,mapDeltaZ:c,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function b(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,o=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:o}}}function C(t,n){let r=null,o=0,a=0;return s=>{if("start"===s.action&&(r=t.toScreen(n),r.x<0||r.x>t.width||r.y<0||r.y>t.height?r=null:(o=s.screenStart.x-r.x,a=s.screenStart.y-r.y)),null==r)return null;const i=e(s.screenEnd.x-o,0,t.width),l=e(s.screenEnd.y-a,0,t.height),u=c(i,l);return s.screenStart=r,s.screenEnd=u,s}}class G{constructor(){this.execute=()=>{}}next(t,n=new G){return r(t)&&(this.execute=e=>{const o=t(e);r(o)&&n.execute(o)}),n}}export{G as EventPipeline,D as addMapDelta,b as addScreenDelta,d as constrainToMapAxis,f as createDragEventPipelineCallback,p as createManipulatorDragEventPipeline,y as createManipulatorDragEventPipelineMany,C as dragAtLocation,x as dragGraphic,R as dragGraphicMany,w as resetGraphic,M as resetGraphicMany,z as resetProperties,q as resetSymbol,j as screenToMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{deg2rad as t}from"../../../../core/mathUtils.js";import{isSome as i,isNone as e}from"../../../../core/maybe.js";import{f as s,i as n,k as r}from"../../../../chunks/vec2.js";import{a as h}from"../../../../chunks/vec2f64.js";import{r as a,d as o,o as c,c as _,n as l,b as p,a as d,
|
|
5
|
+
import{deg2rad as t}from"../../../../core/mathUtils.js";import{isSome as i,isNone as e}from"../../../../core/maybe.js";import{f as s,i as n,k as r}from"../../../../chunks/vec2.js";import{a as h}from"../../../../chunks/vec2f64.js";import{r as a,d as o,o as c,c as _,n as l,b as p,a as d,y as g,g as f}from"../../../../chunks/vec3.js";import{c as u,f as m}from"../../../../chunks/vec3f64.js";import{create as D,fromPositionAndNormal as E,signedDistance as x,copy as b,intersectLine as I,normal as V}from"../../../../geometry/support/plane.js";import{angle as M,projectPointSignedLength as y}from"../../../../geometry/support/vector.js";import{intersectLineAndRay as N,LineType as P}from"../../../support/geometry2dUtils.js";class X{constructor(t,i,e,s=0,n=v.IMMEDIATE){this.helper=t,this.planeType=i,this.edge=e,this.distance=s,this._plane=D(),this._offsetPlane=D(),this._minDistance=-1/0,this._maxDistance=1/0,n===v.IMMEDIATE&&this._initialize()}get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){var t,i,e,s;const n=this._toXYZ(this.edge.leftVertex.pos),r=this._toXYZ(null==(t=this.edge.leftVertex.leftEdge)||null==(i=t.leftVertex)?void 0:i.pos),h=this._toXYZ(this.edge.rightVertex.pos),o=this._toXYZ(null==(e=this.edge.rightVertex.rightEdge)||null==(s=e.rightVertex)?void 0:s.pos);this._edgeDirection=a(u(),n,h),this._left=this._computeNeighbor(n,r,this._edgeDirection),this._right=this._computeNeighbor(h,o,this._edgeDirection)}_toXYZ(t){return i(t)?this.helper.toXYZ(t):null}_computeNeighbor(t,i,s){if(e(i))return{start:t,end:i,direction:m(-s[1],s[0],0),isOriginalDirection:!0};const n=a(u(),t,i),r=!this._passesBisectingAngleThreshold(n,s);return{start:t,end:i,direction:r?this._bisectVectorsPerpendicular(s,n):n,isOriginalDirection:!r}}_passesBisectingAngleThreshold(t,i){const e=Math.abs(M(i,t));return e>=Y&&e<=Math.PI-Y}_bisectVectorsPerpendicular(t,i){const e=o(t,i)<0?t:c(u(),t),s=Math.abs(o(e,i));if(!(s<.001||s>.999))return this._bisectDirection(e,i);const n=_(u(),e,[0,0,1]);return l(n,n)}_bisectDirection(t,i){const e=p(u(),t,i);return l(e,e)}_initializePlane(){const t=this._computeNormalDirection(this._left),i=this._computeNormalDirection(this._right);o(t,i)<0&&c(i,i),E(this._left.start,this._bisectDirection(t,i),this._plane)}_computeNormalDirection(t){const i=_(u(),t.direction,this._edgeDirection);l(i,i);const e=_(u(),this._edgeDirection,i);return this.planeType===T.XY&&(e[2]=0),l(e,e)}_initializeDistanceConstraints(){i(this._left.end)&&!this.requiresSplitEdgeLeft&&this._updateDistanceConstraint(x(this._plane,this._left.end)),i(this._right.end)&&!this.requiresSplitEdgeRight&&this._updateDistanceConstraint(x(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(t){t<=0&&(this._minDistance=Math.max(this._minDistance,t)),t>=0&&(this._maxDistance=Math.min(this._maxDistance,t))}_updateIntersectDistanceConstraint(t){const i=V(t),e=this._edgeDirection,a=p(u(),this._left.start,this._left.direction),o=p(u(),this._right.start,this._right.direction),c=this._pointInBasis2D(h(),i,e,this._left.start),_=this._pointInBasis2D(h(),i,e,a),l=this._pointInBasis2D(h(),i,e,this._right.start),g=this._pointInBasis2D(h(),i,e,o),[f]=N({start:_,end:c,type:P.LINE},{start:g,end:l,type:P.LINE});if(!f)return;const m=s(h(),c,_);n(m,m);const D=s(h(),f,_),E=r(m,D),b=p(u(),a,d(u(),this._left.direction,-E)),I=x(t,b);this._updateDistanceConstraint(I)}_pointInBasis2D(t,i,e,s){return t[0]=y(i,s),t[1]=y(e,s),t}_offset(t,e){Number.isFinite(this._minDistance)&&(e=Math.max(this._minDistance,e)),Number.isFinite(this._maxDistance)&&(e=Math.min(this._maxDistance,e)),b(this._plane,this._offsetPlane),this._offsetPlane[3]-=e;const s=(t,e,s)=>i(e)&&I(this._offsetPlane,t,p(u(),t,e),s),n=u();(t===this.edge.leftVertex?s(this._left.start,this._left.direction,n):s(this._right.start,this._right.direction,n))&&this.helper.copy(this.helper.fromXYZ(n,void 0,this.helper.getM(t.pos)),t.pos)}signedDistanceToPoint(t){return x(this.plane,this.helper.toXYZ(this.helper.pointToVector(t)))}apply(t){this._offset(t,this.distance)}undo(t){this._offset(t,0)}canAccumulate(t){return t instanceof X&&this.edge.leftVertex.index===t.edge.leftVertex.index&&this.edge.rightVertex.index===t.edge.rightVertex.index&&this.edge.component===t.edge.component&&this._maybeEqualsVec3(this._left.direction,t._left.direction)&&this._maybeEqualsVec3(this._right.direction,t._right.direction)&&g(V(this._plane),V(t._plane))}accumulate(t,i){const e=this._plane[3]-i._plane[3]+i.distance;this._offset(t,e)}accumulateParams(t){const i=t.distance-t._plane[3];this.distance=i+this._plane[3]}clone(){const t=new X(this.helper,this.planeType,this.edge,this.distance,v.DEFERRED);return b(this._plane,t._plane),b(this._offsetPlane,t._offsetPlane),t._maxDistance=this._maxDistance,t._minDistance=this._minDistance,t._left=this._cloneNeighbor(this._left),t._right=this._cloneNeighbor(this._right),t._edgeDirection=f(u(),this._edgeDirection),t}_maybeEqualsVec3(t,s){return e(t)&&e(s)||i(t)&&i(s)&&g(t,s)}_cloneNeighbor({start:t,end:e,direction:s,isOriginalDirection:n}){return{start:f(u(),t),end:i(e)?f(u(),e):null,direction:f(u(),s),isOriginalDirection:n}}}const Y=t(15);var T,v;!function(t){t[t.XYZ=0]="XYZ",t[t.XY=1]="XY"}(T||(T={})),function(t){t[t.IMMEDIATE=0]="IMMEDIATE",t[t.DEFERRED=1]="DEFERRED"}(v||(v={}));export{X as OffsetEdgeVertex,T as PlaneType};
|
package/views/webgl/Program.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import{isSome as t,isNone as o}from"../../core/maybe.js";import{webglValidateShadersEnabled as i}from"./checkWebGLError.js";import{ContextType as n}from"./context-util.js";import{ShaderType as r,ResourceType as e}from"./enums.js";import{transpileShader as s}from"./ShaderTranspiler.js";const m=4294967295;class
|
|
5
|
+
import"../../core/has.js";import{isSome as t,isNone as o}from"../../core/maybe.js";import{webglValidateShadersEnabled as i}from"./checkWebGLError.js";import{ContextType as n}from"./context-util.js";import{ShaderType as r,ResourceType as e}from"./enums.js";import{transpileShader as s}from"./ShaderTranspiler.js";const m=4294967295;class f{constructor(t,o,i,n,s=new Map){this._context=t,this._locations=n,this._uniformBlockBindings=s,this._refCount=1,this._nameToUniformLocation={},this._nameToUniform1={},this._nameToUniform1v={},this._nameToUniform2={},this._nameToUniform3={},this._nameToUniform4={},this._nameToUniformMatrix3={},this._nameToUniformMatrix4={},t||console.error("RenderingContext isn't initialized!"),0===o.length&&console.error("Shaders source should not be empty!"),this._vShader=h(this._context,r.VERTEX_SHADER,o),this._fShader=h(this._context,r.FRAGMENT_SHADER,i),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(e.Shader,this)}get glName(){if(t(this._glName))return this._glName;if(o(this._vShader))return null;const r=this._context.gl,s=r.createProgram();if(r.attachShader(s,this._vShader),r.attachShader(s,this._fShader),this._locations.forEach(((t,o)=>r.bindAttribLocation(s,t,o))),r.linkProgram(s),i()&&!r.getProgramParameter(s,r.LINK_STATUS)&&console.error(`Could not link shader\nvalidated: ${r.getProgramParameter(s,r.VALIDATE_STATUS)}, gl error ${r.getError()}, vertex: ${r.getShaderParameter(this._vShader,r.COMPILE_STATUS)}, fragment: ${r.getShaderParameter(this._fShader,r.COMPILE_STATUS)}, info log: ${r.getProgramInfoLog(s)}`),this._context.type===n.WEBGL2){const t=r;for(const[o,i]of this._uniformBlockBindings){const n=t.getUniformBlockIndex(s,o);n<m&&t.uniformBlockBinding(s,n,i)}}return this._glName=s,this._context.instanceCounter.increment(e.Program,this),s}get hasGLName(){return t(this._glName)}dispose(){if(--this._refCount>0)return;const t=this._context.gl;this._vShader&&(t.deleteShader(this._vShader),this._vShader=null,this._context.instanceCounter.decrement(e.Shader,this)),this._fShader&&(t.deleteShader(this._fShader),this._fShader=null),this._glName&&(t.deleteProgram(this._glName),this._glName=null,this._context.instanceCounter.decrement(e.Program,this))}ref(){++this._refCount}_getUniformLocation(t){return void 0===this._nameToUniformLocation[t]&&(this._nameToUniformLocation[t]=this._context.gl.getUniformLocation(this.glName,t)),this._nameToUniformLocation[t]}hasUniform(t){return null!==this._getUniformLocation(t)}setUniform1i(t,o){const i=this._nameToUniform1[t];if(void 0===i||o!==i){this._context.gl.uniform1i(this._getUniformLocation(t),o),this._nameToUniform1[t]=o}}setUniform1iv(t,o){const i=this._nameToUniform1v[t];if(a(i,o)){this._context.gl.uniform1iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform1v[t]=Array.from(o):g(o,i)}}setUniform2iv(t,o){const i=this._nameToUniform2[t];if(a(i,o)){this._context.gl.uniform2iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform2[t]=Array.from(o):g(o,i)}}setUniform3iv(t,o){const i=this._nameToUniform3[t];if(a(i,o)){this._context.gl.uniform3iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform3[t]=Array.from(o):g(o,i)}}setUniform4iv(t,o){const i=this._nameToUniform4[t];if(a(i,o)){this._context.gl.uniform4iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform4[t]=Array.from(o):g(o,i)}}setUniform1f(t,o){const i=this._nameToUniform1[t];if(void 0===i||o!==i){this._context.gl.uniform1f(this._getUniformLocation(t),o),this._nameToUniform1[t]=o}}setUniform1fv(t,o){const i=this._nameToUniform1v[t];if(a(i,o)){this._context.gl.uniform1fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform1v[t]=Array.from(o):g(o,i)}}setUniform2f(t,o,i){const n=this._nameToUniform2[t];if(void 0===n||o!==n[0]||i!==n[1]){this._context.gl.uniform2f(this._getUniformLocation(t),o,i),void 0===n?this._nameToUniform2[t]=[o,i]:(n[0]=o,n[1]=i)}}setUniform2fv(t,o){const i=this._nameToUniform2[t];if(a(i,o)){this._context.gl.uniform2fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform2[t]=Array.from(o):g(o,i)}}setUniform3f(t,o,i,n){const r=this._nameToUniform3[t];if(void 0===r||o!==r[0]||i!==r[1]||n!==r[2]){this._context.gl.uniform3f(this._getUniformLocation(t),o,i,n),void 0===r?this._nameToUniform3[t]=[o,i,n]:(r[0]=o,r[1]=i,r[2]=n)}}setUniform3fv(t,o){const i=this._nameToUniform3[t];if(a(i,o)){this._context.gl.uniform3fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform3[t]=Array.from(o):g(o,i)}}setUniform4f(t,o,i,n,r){const e=this._nameToUniform4[t];if(void 0===e||o!==e[0]||i!==e[1]||n!==e[2]||r!==e[3]){this._context.gl.uniform4f(this._getUniformLocation(t),o,i,n,r),void 0===e?this._nameToUniform4[t]=[o,i,n,r]:(e[0]=o,e[1]=i,e[2]=n,e[3]=r)}}setUniform4fv(t,o){const i=this._nameToUniform4[t];if(a(i,o)){this._context.gl.uniform4fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform4[t]=Array.from(o):g(o,i)}}setUniformMatrix3fv(t,o,i=!1){const n=this._nameToUniformMatrix3[t];if(l(n,o)){this._context.gl.uniformMatrix3fv(this._getUniformLocation(t),i,o),void 0===n?this._nameToUniformMatrix3[t]=Array.from(o):g(o,n)}}setUniformMatrix4fv(t,o,i=!1){const n=this._nameToUniformMatrix4[t];if(U(n,o)){this._context.gl.uniformMatrix4fv(this._getUniformLocation(t),i,o),void 0===n?this._nameToUniformMatrix4[t]=Array.from(o):g(o,n)}}stop(){}}function a(t,i){if(o(t)||t.length!==i.length)return!0;for(let o=0;o<t.length;++o)if(t[o]!==i[o])return!0;return!1}function h(t,o,e){const m=t.type===n.WEBGL2?s(e,o):e,f=t.gl,a=f.createShader(o);return f.shaderSource(a,m),f.compileShader(a),i()&&!f.getShaderParameter(a,f.COMPILE_STATUS)&&(console.error("Compile error in ".concat(o===r.VERTEX_SHADER?"vertex":"fragment"," shader")),console.error(f.getShaderInfoLog(a)),console.error(c(m)),t.type===n.WEBGL2&&(console.log("Shader source before transpilation:"),console.log(e))),a}function c(t){let o=2;return t.replace(/\n/g,(()=>"\n"+_(o++)+":"))}function _(t){return t>=1e3?t.toString():(" "+t).slice(-3)}function g(t,o){for(let i=0;i<t.length;++i)o[i]=t[i]}function l(t,i){return!!o(t)||(9!==t.length?a(t,i):9!==t.length||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[7]!==i[7]||t[8]!==i[8])}function U(t,i){return!!o(t)||(16!==t.length?a(t,i):16!==t.length||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[7]!==i[7]||t[8]!==i[8]||t[9]!==i[9]||t[10]!==i[10]||t[11]!==i[11]||t[12]!==i[12]||t[13]!==i[13]||t[14]!==i[14]||t[15]!==i[15])}export{f as Program};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ContextType as e}from"./context-util.js";import{PixelType as t,TextureType as n,PixelFormat as a,SizedPixelFormat as
|
|
5
|
+
import{ContextType as e}from"./context-util.js";import{PixelType as t,TextureType as n,PixelFormat as a,SizedPixelFormat as r,TextureSamplingMode as i,TextureWrapMode as o,TargetType as s,DepthStencilTargetType as u,UniformType as f}from"./enums.js";import{FramebufferObject as l}from"./FramebufferObject.js";import{Texture as m}from"./Texture.js";function c(s,u,f="nearest",l=!1){var c;const _=!(l&&"u8"===u.pixelType),p=_?t.FLOAT:t.UNSIGNED_BYTE,E=null==u.pixels||0===u.pixels.length?null:_?u.getAsRGBAFloat():u.getAsRGBA(),T=null==(c=s.capabilities.textureFloat)?void 0:c.textureFloatLinear,g={width:u.width,height:u.height,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:s.type===e.WEBGL2&&_?r.RGBA32F:a.RGBA,samplingMode:!T||"bilinear"!==f&&"cubic"!==f?i.NEAREST:i.LINEAR,dataType:p,wrapMode:o.CLAMP_TO_EDGE,flipped:!1};return new m(s,g,E)}function _(e,r,f,c){const _=c?t.UNSIGNED_BYTE:t.FLOAT,p={width:r,height:f,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,samplingMode:i.NEAREST,dataType:_,wrapMode:o.CLAMP_TO_EDGE,flipped:!1},E=new m(e,p);return new l(e,{colorTarget:s.TEXTURE,depthStencilTarget:u.DEPTH_STENCIL_RENDER_BUFFER,width:r,height:f},E)}function p(s,u){const{spacing:f,offsets:l,coefficients:c,size:[_,p]}=u,E=f[0]>1,T={width:E?4*_:_,height:p,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:s.type===e.WEBGL2?r.RGBA32F:a.RGBA,dataType:t.FLOAT,samplingMode:i.NEAREST,wrapMode:o.CLAMP_TO_EDGE,flipped:!1},g=new Float32Array(E?_*p*16:2*l.length);if(E)for(let e=0,t=0;e<c.length;e++)g[t++]=c[e],e%3==2&&(g[t++]=1);else for(let e=0;e<p;e++)for(let t=0;t<_;t++){const n=4*(e*_+t),a=2*(t*p+e);g[n]=l[a],g[n+1]=l[a+1],g[n+3]=-1===l[a]?0:1}return new m(s,T,g)}function E(e,r){const s={width:r.length/4,height:1,target:n.TEXTURE_2D,pixelFormat:a.RGBA,internalFormat:a.RGBA,dataType:t.UNSIGNED_BYTE,samplingMode:i.NEAREST,wrapMode:o.CLAMP_TO_EDGE,flipped:!1};return new m(e,s,r)}function T(e,t,n,a=1,r=!0,i=!1){return{u_flipY:r,u_isFloatTexture:i,u_applyTransform:!!e,u_opacity:a,u_transformSpacing:e?e.spacing:null,u_transformGridSize:e?e.size:null,u_targetImageSize:t,u_srcImageSize:n}}function g(e,t){return{u_colormapOffset:t||0,u_colormapMaxIndex:e?e.length/4-1:null}}function A(e,t){return{u_scale:e,u_offset:t}}function h(e){return{u_bandCount:e.bandCount,u_minOutput:e.outMin,u_maxOutput:e.outMax,u_minCutOff:e.minCutOff,u_maxCutOff:e.maxCutOff,u_factor:e.factor,u_useGamma:e.useGamma,u_gamma:e.gamma,u_gammaCorrection:e.gammaCorrection}}function d(e){return{u_hillshadeType:e.hillshadeType,u_sinZcosAs:e.sinZcosAs,u_sinZsinAs:e.sinZsinAs,u_cosZs:e.cosZs,u_weights:e.weights,u_factor:e.factor,u_minValue:e.minValue,u_maxValue:e.maxValue}}function O(e,t){const n=e.gl,a=t.glName,r=n.getProgramParameter(a,n.ACTIVE_UNIFORMS),i=new Map;let o;for(let s=0;s<r;s++)o=n.getActiveUniform(a,s),o&&i.set(o.name,{location:n.getUniformLocation(a,o.name),info:o});return i}function F(e,t,n){Object.keys(n).forEach((a=>{const r=t.get(a)||t.get(a+"[0]");r&&U(e,a,n[a],r)}))}function R(e,t,n,a){n.length===a.length&&(a.some((e=>null==e))||n.some((e=>null==e))||n.forEach(((n,r)=>{t.setUniform1i(n,r),e.bindTexture(a[r],r)})))}function U(e,t,n,a){if(null===a||null==n)return!1;const{info:r}=a;switch(r.type){case f.FLOAT:r.size>1?e.setUniform1fv(t,n):e.setUniform1f(t,n);break;case f.FLOAT_VEC2:e.setUniform2fv(t,n);break;case f.FLOAT_VEC3:e.setUniform3fv(t,n);break;case f.FLOAT_VEC4:e.setUniform4fv(t,n);break;case f.FLOAT_MAT3:e.setUniformMatrix3fv(t,n);break;case f.FLOAT_MAT4:e.setUniformMatrix4fv(t,n);break;case f.INT:r.size>1?e.setUniform1iv(t,n):e.setUniform1i(t,n);break;case f.BOOL:e.setUniform1i(t,n?1:0);break;case f.INT_VEC2:case f.BOOL_VEC2:e.setUniform2iv(t,n);break;case f.INT_VEC3:case f.BOOL_VEC3:e.setUniform3iv(t,n);break;case f.INT_VEC4:case f.BOOL_VEC4:e.setUniform4iv(t,n);break;default:return!1}return!0}export{E as createColormapTexture,_ as createFrameBuffer,c as createRasterTexture,p as createTransformTexture,A as getBasicGridUniforms,g as getColormapUniforms,T as getCommonUniforms,d as getShadedReliefUniforms,h as getStretchUniforms,O as getUniformLocationInfos,R as setTextures,F as setUniforms};
|
package/widgets/Attachments.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.23/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import e from"../core/Error.js";import{formatFileSize as s}from"../core/unitFormatUtils.js";import{on as i,init as a}from"../core/watchUtils.js";import{aliasOf as n}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import m from"./Widget.js";import d from"./Attachments/AttachmentsViewModel.js";import{isSupportedImage as c,getIconPath as h}from"./Attachments/support/attachmentUtils.js";import{storeNode as u,discardNode as p,isRTL as b}from"./support/widgetUtils.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as _}from"./support/jsxFactory.js";const f={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},v={base:"esri-attachments",loaderContainer:"esri-attachments__loader-container",loader:"esri-attachments__loader",fadeIn:"esri-attachments--fade-in",container:"esri-attachments__container",containerList:"esri-attachments__container--list",containerPreview:"esri-attachments__container--preview",actions:"esri-attachments__actions",deleteButton:"esri-attachments__delete-button",addAttachmentButton:"esri-attachments__add-attachment-button",errorMessage:"esri-attachments__error-message",items:"esri-attachments__items",item:"esri-attachments__item",itemButton:"esri-attachments__item-button",itemMask:"esri-attachments__item-mask",itemMaskIcon:"esri-attachments__item-mask--icon",itemImage:"esri-attachments__image",itemImageResizable:"esri-attachments__image--resizable",itemLabel:"esri-attachments__label",itemFilename:"esri-attachments__filename",itemChevronIcon:"esri-attachments__item-chevron-icon",itemLink:"esri-attachments__item-link",itemLinkOverlay:"esri-attachments__item-link-overlay",itemLinkOverlayIcon:"esri-attachments__item-link-overlay-icon",itemEditIcon:"esri-attachments__item-edit-icon",itemAddIcon:"esri-attachments__item-add-icon",itemAddButton:"esri-attachments__item-add-button",formNode:"esri-attachments__form-node",fileFieldset:"esri-attachments__file-fieldset",fileLabel:"esri-attachments__file-label",fileName:"esri-attachments__file-name",fileInput:"esri-attachments__file-input",metadata:"esri-attachments__metadata",metadataFieldset:"esri-attachments__metadata-fieldset",progressBar:"esri-attachments__progress-bar",esriWidget:"esri-widget",esriButton:"esri-button",buttonDisabled:"esri-button--disabled",esriButtonSecondary:"esri-button--secondary",esriButtonTertiary:"esri-button--tertiary",esriButtonThird:"esri-button--third",esriButtonSmall:"esri-button--small",esriButtonHalf:"esri-button--half",empty:"esri-widget__content--empty",iconExternalLink:"esri-icon-link-external",iconEdit:"esri-icon-edit",iconRight:"esri-icon-right",iconLeft:"esri-icon-left",iconPlus:"esri-icon-plus"},y=window.CSS;let B=class extends m{constructor(t,e){super(t,e),this.abilities=null,this.displayType="auto",this.graphic=null,this.label=void 0,this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=new d,this.visibleElements={...f},this._supportsImageOrientation=y&&y.supports&&y.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}initialize(){this.own(i(this,"viewModel.attachmentInfos","change",(()=>this.scheduleRender())),a(this,"viewModel.mode",(()=>this._modeChanged())))}get effectiveDisplayType(){return"auto"===this.displayType?this.viewModel.supportsResizeAttachments?"preview":"list":this.displayType}castVisibleElements(t){return{...f,...t}}addAttachment(){const{_addAttachmentForm:t,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(t).then((t=>(this._set("submitting",!1),this._set("error",null),s.mode="view",t))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:add-attachment",this.messages.addErrorMessage,t)),t}))}deleteAttachment(t){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(t).then((t=>(this._set("submitting",!1),this._set("error",null),s.mode="view",t))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:delete-attachment",this.messages.deleteErrorMessage,t)),t}))}updateAttachment(){const{viewModel:t}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),t.updateAttachment(s).then((e=>(this._set("submitting",!1),this._set("error",null),t.mode="view",e))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:update-attachment",this.messages.updateErrorMessage,t)),t}))}render(){const{submitting:t,viewModel:e}=this,{state:s}=e;return _("div",{class:this.classes(v.base,v.esriWidget)},t?this.renderProgressBar():null,"loading"===s?this.renderLoading():this.renderAttachments(),this.renderErrorMessage())}renderErrorMessage(){const{error:t,visibleElements:e}=this;return t&&e.errorMessage?_("div",{key:"error-message",class:v.errorMessage},t.message):null}renderAttachments(){const{mode:t,activeAttachmentInfo:e}=this.viewModel;return"add"===t?this.renderAddForm():"edit"===t?this.renderDetailsForm(e):this.renderAttachmentContainer()}renderLoading(){return _("div",{class:v.loaderContainer,key:"loader"},_("div",{class:v.loader}))}renderProgressBar(){return this.visibleElements.progressBar?_("div",{class:v.progressBar,key:"progress-bar"}):null}renderAddForm(){const{submitting:t,selectedFile:e}=this,s=t||!e,i=this.visibleElements.cancelAddButton?_("button",{type:"button",bind:this,disabled:t,onclick:this._cancelForm,class:this.classes(v.esriButton,v.esriButtonTertiary,v.esriButtonSmall,v.esriButtonHalf,t&&v.buttonDisabled)},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?_("button",{type:"submit",disabled:s,class:this.classes(v.esriButton,v.esriButtonSecondary,v.esriButtonSmall,v.esriButtonHalf,{[v.buttonDisabled]:s})},this.messages.add):null,n=e?_("span",{key:"file-name",class:v.fileName},e.name):null,r=_("form",{bind:this,afterCreate:u,afterRemoved:p,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},_("fieldset",{class:v.fileFieldset},n,_("label",{class:this.classes(v.fileLabel,v.esriButton,v.esriButtonSecondary)},e?this.messages.changeFile:this.messages.selectFile,_("input",{class:v.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))),a,i);return _("div",{key:"add-form-container",class:v.formNode},r)}renderDetailsForm(t){const{visibleElements:e,viewModel:i,selectedFile:a,submitting:n}=this,{contentType:r,size:o,url:l}=t,{abilities:m}=i,d=n||!a,c=m.editing&&m.operations.delete&&e.deleteButton?_("button",{key:"delete-button",type:"button",disabled:n,bind:this,onclick:e=>this._submitDeleteAttachment(e,t),class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonTertiary,v.deleteButton,{[v.buttonDisabled]:n})},this.messages.delete):null,h=m.editing&&m.operations.update&&e.updateButton?_("button",{disabled:d,key:"update-button",type:"submit",class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonThird,{[v.buttonDisabled]:d})},this.messages.update):null,b=this.visibleElements.cancelUpdateButton?_("button",{disabled:n,key:"cancel-button",type:"button",bind:this,onclick:this._cancelForm,class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonTertiary,v.esriButtonThird,{[v.buttonDisabled]:n})},this.messages.cancel):null,g=a?_("span",{key:"file-name",class:v.fileName},a.name):null,f=m.editing&&m.operations.update?_("fieldset",{key:"file",class:v.fileFieldset},g,_("label",{class:this.classes(v.fileLabel,v.esriButton,v.esriButtonSecondary)},this.messages.changeFile,_("input",{class:v.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))):null,y=_("fieldset",{key:"size",class:v.metadataFieldset},_("label",null,s(this.messagesUnits,o))),B=_("fieldset",{key:"content-type",class:v.metadataFieldset},_("label",null,r)),A=_("form",{bind:this,afterCreate:u,afterRemoved:p,"data-node-ref":"_updateAttachmentForm",onsubmit:this._submitUpdateAttachment},_("div",{class:v.metadata},y,B),f,_("div",{class:v.actions},c,b,h));return _("div",{key:"edit-form-container",class:v.formNode},_("a",{class:v.itemLink,href:l,rel:"noreferrer",target:"_blank"},this.renderImageMask({attachmentInfo:t,size:400}),_("div",{class:v.itemLinkOverlay},_("span",{class:v.itemLinkOverlayIcon},_("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32"},_("path",{d:"M28 13h1v16H3V3h16v1H4v24h24zm-5-9h4.293L15.646 15.638l.707.707L28 4.707V9h1V3h-6z"}),_("path",{fill:"none",d:"M0 0h32v32H0z"}))))),A)}renderImageMask({attachmentInfo:t,size:e}){const{supportsResizeAttachments:s}=this.viewModel,{contentType:i,name:a,url:n}=t,r=s&&c(i),o=this._getCSSTransform(t,r),l=o?{transform:o,"image-orientation":"none"}:{},m=-1===n.indexOf("?")?"?":"&",d=r?`${n}${m}w=${e}`:h(i),u={[v.itemMaskIcon]:!r},p={[v.itemImageResizable]:s};return _("div",{class:this.classes(u,v.itemMask)},_("img",{styles:l,alt:a,src:d,class:this.classes(p,v.itemImage)}))}renderAttachmentInfo({attachmentInfo:t,displayType:e}){const{viewModel:s}=this,{abilities:i}=s,{name:a,url:n}=t,r=this.renderImageMask({attachmentInfo:t,size:"list"===e?48:400}),o=i.editing?_("span",{"aria-hidden":"true",class:this.classes(v.itemChevronIcon,b(this.container)?v.iconLeft:v.iconRight)}):null,l=[r,_("label",{class:v.itemLabel},_("span",{class:v.itemFilename},a||this.messages.noTitle),o)],m=i.editing?_("button",{key:"details-button",bind:this,class:v.itemButton,title:this.messages.attachmentDetails,"aria-label":this.messages.attachmentDetails,"data-attachment-info-id":t.id,onclick:()=>this._startEditAttachment(t),type:"button"},l):_("a",{key:"details-link",class:v.itemButton,href:n,target:"_blank"},l);return _("li",{class:v.item,key:t},m)}renderAttachmentContainer(){const{effectiveDisplayType:t,viewModel:e,visibleElements:s}=this,{attachmentInfos:i,abilities:a}=e,n=i&&i.length,r={[v.containerList]:"preview"!==t,[v.containerPreview]:"preview"===t},o=a.editing&&a.operations.add&&s.addButton?_("button",{bind:this,onclick:()=>this._startAddAttachment(),class:this.classes(v.esriButton,v.esriButtonTertiary,v.addAttachmentButton),type:"button"},_("span",{"aria-hidden":"true",class:this.classes(v.itemAddIcon,v.iconPlus)}),this.messages.add):null,l=n?_("ul",{class:v.items},i.toArray().map((e=>this.renderAttachmentInfo({attachmentInfo:e,displayType:t})))):_("div",{class:v.empty},this.messages.noAttachments);return _("div",{key:"attachments-container",class:this.classes(v.container,r)},l,o)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(t){const e=t.target,s=e&&e.files&&e.files.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(t,e){t.preventDefault(),this.deleteAttachment(e)}_submitAddAttachment(t){t.preventDefault(),this.addAttachment()}_submitUpdateAttachment(t){t.preventDefault(),this.updateAttachment()}_startEditAttachment(t){const{viewModel:e}=this;e.activeAttachmentInfo=t,e.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(t){t.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(t,e){const{orientationInfo:s}=t;return!this._supportsImageOrientation&&e&&s?[s.rotation?`rotate(${s.rotation}deg)`:"",s.mirrored?"scaleX(-1)":""].join(" "):""}};t([n("viewModel.abilities")],B.prototype,"abilities",void 0),t([o()],B.prototype,"displayType",void 0),t([o({readOnly:!0})],B.prototype,"effectiveDisplayType",null),t([n("viewModel.graphic")],B.prototype,"graphic",void 0),t([o({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],B.prototype,"label",void 0),t([o(),g("esri/widgets/Attachments/t9n/Attachments")],B.prototype,"messages",void 0),t([o(),g("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),t([o({readOnly:!0})],B.prototype,"selectedFile",void 0),t([o({readOnly:!0})],B.prototype,"submitting",void 0),t([o({readOnly:!0})],B.prototype,"error",void 0),t([o({type:d})],B.prototype,"viewModel",void 0),t([o()],B.prototype,"visibleElements",void 0),t([r("visibleElements")],B.prototype,"castVisibleElements",null),B=t([l("esri.widgets.Attachments")],B);const A=B;export{A as default};
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import e from"../core/Error.js";import{formatFileSize as s}from"../core/unitFormatUtils.js";import{on as i,init as a}from"../core/watchUtils.js";import{aliasOf as n}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import m from"./Widget.js";import d from"./Attachments/AttachmentsViewModel.js";import{isSupportedImage as c,getIconPath as h}from"./Attachments/support/attachmentUtils.js";import{storeNode as u,discardNode as p,isRTL as b}from"./support/widgetUtils.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as _}from"./support/jsxFactory.js";const f={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},v={base:"esri-attachments",loaderContainer:"esri-attachments__loader-container",loader:"esri-attachments__loader",fadeIn:"esri-attachments--fade-in",container:"esri-attachments__container",containerList:"esri-attachments__container--list",containerPreview:"esri-attachments__container--preview",actions:"esri-attachments__actions",deleteButton:"esri-attachments__delete-button",addAttachmentButton:"esri-attachments__add-attachment-button",errorMessage:"esri-attachments__error-message",items:"esri-attachments__items",item:"esri-attachments__item",itemButton:"esri-attachments__item-button",itemMask:"esri-attachments__item-mask",itemMaskIcon:"esri-attachments__item-mask--icon",itemImage:"esri-attachments__image",itemImageResizable:"esri-attachments__image--resizable",itemLabel:"esri-attachments__label",itemFilename:"esri-attachments__filename",itemChevronIcon:"esri-attachments__item-chevron-icon",itemLink:"esri-attachments__item-link",itemLinkOverlay:"esri-attachments__item-link-overlay",itemLinkOverlayIcon:"esri-attachments__item-link-overlay-icon",itemEditIcon:"esri-attachments__item-edit-icon",itemAddIcon:"esri-attachments__item-add-icon",itemAddButton:"esri-attachments__item-add-button",formNode:"esri-attachments__form-node",fileFieldset:"esri-attachments__file-fieldset",fileLabel:"esri-attachments__file-label",fileName:"esri-attachments__file-name",fileInput:"esri-attachments__file-input",metadata:"esri-attachments__metadata",metadataFieldset:"esri-attachments__metadata-fieldset",progressBar:"esri-attachments__progress-bar",esriWidget:"esri-widget",esriButton:"esri-button",buttonDisabled:"esri-button--disabled",esriButtonSecondary:"esri-button--secondary",esriButtonTertiary:"esri-button--tertiary",esriButtonThird:"esri-button--third",esriButtonSmall:"esri-button--small",esriButtonHalf:"esri-button--half",empty:"esri-widget__content--empty",iconExternalLink:"esri-icon-link-external",iconEdit:"esri-icon-edit",iconRight:"esri-icon-right",iconLeft:"esri-icon-left",iconPlus:"esri-icon-plus"},y=window.CSS;let B=class extends m{constructor(t,e){super(t,e),this.abilities=null,this.displayType="auto",this.graphic=null,this.label=void 0,this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=new d,this.visibleElements={...f},this._supportsImageOrientation=y&&y.supports&&y.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}initialize(){this.own(i(this,"viewModel.attachmentInfos","change",(()=>this.scheduleRender())),a(this,"viewModel.mode",(()=>this._modeChanged())))}get effectiveDisplayType(){const{displayType:t}=this;return t&&"auto"!==t?t:this.viewModel.supportsResizeAttachments?"preview":"list"}castVisibleElements(t){return{...f,...t}}addAttachment(){const{_addAttachmentForm:t,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(t).then((t=>(this._set("submitting",!1),this._set("error",null),s.mode="view",t))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:add-attachment",this.messages.addErrorMessage,t)),t}))}deleteAttachment(t){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(t).then((t=>(this._set("submitting",!1),this._set("error",null),s.mode="view",t))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:delete-attachment",this.messages.deleteErrorMessage,t)),t}))}updateAttachment(){const{viewModel:t}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),t.updateAttachment(s).then((e=>(this._set("submitting",!1),this._set("error",null),t.mode="view",e))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:update-attachment",this.messages.updateErrorMessage,t)),t}))}render(){const{submitting:t,viewModel:e}=this,{state:s}=e;return _("div",{class:this.classes(v.base,v.esriWidget)},t?this.renderProgressBar():null,"loading"===s?this.renderLoading():this.renderAttachments(),this.renderErrorMessage())}renderErrorMessage(){const{error:t,visibleElements:e}=this;return t&&e.errorMessage?_("div",{key:"error-message",class:v.errorMessage},t.message):null}renderAttachments(){const{mode:t,activeAttachmentInfo:e}=this.viewModel;return"add"===t?this.renderAddForm():"edit"===t?this.renderDetailsForm(e):this.renderAttachmentContainer()}renderLoading(){return _("div",{class:v.loaderContainer,key:"loader"},_("div",{class:v.loader}))}renderProgressBar(){return this.visibleElements.progressBar?_("div",{class:v.progressBar,key:"progress-bar"}):null}renderAddForm(){const{submitting:t,selectedFile:e}=this,s=t||!e,i=this.visibleElements.cancelAddButton?_("button",{type:"button",bind:this,disabled:t,onclick:this._cancelForm,class:this.classes(v.esriButton,v.esriButtonTertiary,v.esriButtonSmall,v.esriButtonHalf,t&&v.buttonDisabled)},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?_("button",{type:"submit",disabled:s,class:this.classes(v.esriButton,v.esriButtonSecondary,v.esriButtonSmall,v.esriButtonHalf,{[v.buttonDisabled]:s})},this.messages.add):null,n=e?_("span",{key:"file-name",class:v.fileName},e.name):null,r=_("form",{bind:this,afterCreate:u,afterRemoved:p,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},_("fieldset",{class:v.fileFieldset},n,_("label",{class:this.classes(v.fileLabel,v.esriButton,v.esriButtonSecondary)},e?this.messages.changeFile:this.messages.selectFile,_("input",{class:v.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))),a,i);return _("div",{key:"add-form-container",class:v.formNode},r)}renderDetailsForm(t){const{visibleElements:e,viewModel:i,selectedFile:a,submitting:n}=this,{contentType:r,size:o,url:l}=t,{abilities:m}=i,d=n||!a,c=m.editing&&m.operations.delete&&e.deleteButton?_("button",{key:"delete-button",type:"button",disabled:n,bind:this,onclick:e=>this._submitDeleteAttachment(e,t),class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonTertiary,v.deleteButton,{[v.buttonDisabled]:n})},this.messages.delete):null,h=m.editing&&m.operations.update&&e.updateButton?_("button",{disabled:d,key:"update-button",type:"submit",class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonThird,{[v.buttonDisabled]:d})},this.messages.update):null,b=this.visibleElements.cancelUpdateButton?_("button",{disabled:n,key:"cancel-button",type:"button",bind:this,onclick:this._cancelForm,class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonTertiary,v.esriButtonThird,{[v.buttonDisabled]:n})},this.messages.cancel):null,g=a?_("span",{key:"file-name",class:v.fileName},a.name):null,f=m.editing&&m.operations.update?_("fieldset",{key:"file",class:v.fileFieldset},g,_("label",{class:this.classes(v.fileLabel,v.esriButton,v.esriButtonSecondary)},this.messages.changeFile,_("input",{class:v.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))):null,y=_("fieldset",{key:"size",class:v.metadataFieldset},_("label",null,s(this.messagesUnits,o))),B=_("fieldset",{key:"content-type",class:v.metadataFieldset},_("label",null,r)),A=_("form",{bind:this,afterCreate:u,afterRemoved:p,"data-node-ref":"_updateAttachmentForm",onsubmit:this._submitUpdateAttachment},_("div",{class:v.metadata},y,B),f,_("div",{class:v.actions},c,b,h));return _("div",{key:"edit-form-container",class:v.formNode},_("a",{class:v.itemLink,href:l,rel:"noreferrer",target:"_blank"},this.renderImageMask({attachmentInfo:t,size:400}),_("div",{class:v.itemLinkOverlay},_("span",{class:v.itemLinkOverlayIcon},_("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32"},_("path",{d:"M28 13h1v16H3V3h16v1H4v24h24zm-5-9h4.293L15.646 15.638l.707.707L28 4.707V9h1V3h-6z"}),_("path",{fill:"none",d:"M0 0h32v32H0z"}))))),A)}renderImageMask({attachmentInfo:t,size:e}){const{supportsResizeAttachments:s}=this.viewModel,{contentType:i,name:a,url:n}=t,r=s&&c(i),o=this._getCSSTransform(t,r),l=o?{transform:o,"image-orientation":"none"}:{},m=-1===n.indexOf("?")?"?":"&",d=r?`${n}${m}w=${e}`:h(i),u={[v.itemMaskIcon]:!r},p={[v.itemImageResizable]:s};return _("div",{class:this.classes(u,v.itemMask)},_("img",{styles:l,alt:a,src:d,class:this.classes(p,v.itemImage)}))}renderAttachmentInfo({attachmentInfo:t,displayType:e}){const{viewModel:s}=this,{abilities:i}=s,{name:a,url:n}=t,r=this.renderImageMask({attachmentInfo:t,size:"list"===e?48:400}),o=i.editing?_("span",{"aria-hidden":"true",class:this.classes(v.itemChevronIcon,b(this.container)?v.iconLeft:v.iconRight)}):null,l=[r,_("label",{class:v.itemLabel},_("span",{class:v.itemFilename},a||this.messages.noTitle),o)],m=i.editing?_("button",{key:"details-button",bind:this,class:v.itemButton,title:this.messages.attachmentDetails,"aria-label":this.messages.attachmentDetails,"data-attachment-info-id":t.id,onclick:()=>this._startEditAttachment(t),type:"button"},l):_("a",{key:"details-link",class:v.itemButton,href:n,target:"_blank"},l);return _("li",{class:v.item,key:t},m)}renderAttachmentContainer(){const{effectiveDisplayType:t,viewModel:e,visibleElements:s}=this,{attachmentInfos:i,abilities:a}=e,n=i&&i.length,r={[v.containerList]:"preview"!==t,[v.containerPreview]:"preview"===t},o=a.editing&&a.operations.add&&s.addButton?_("button",{bind:this,onclick:()=>this._startAddAttachment(),class:this.classes(v.esriButton,v.esriButtonTertiary,v.addAttachmentButton),type:"button"},_("span",{"aria-hidden":"true",class:this.classes(v.itemAddIcon,v.iconPlus)}),this.messages.add):null,l=n?_("ul",{class:v.items},i.toArray().map((e=>this.renderAttachmentInfo({attachmentInfo:e,displayType:t})))):_("div",{class:v.empty},this.messages.noAttachments);return _("div",{key:"attachments-container",class:this.classes(v.container,r)},l,o)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(t){const e=t.target,s=e&&e.files&&e.files.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(t,e){t.preventDefault(),this.deleteAttachment(e)}_submitAddAttachment(t){t.preventDefault(),this.addAttachment()}_submitUpdateAttachment(t){t.preventDefault(),this.updateAttachment()}_startEditAttachment(t){const{viewModel:e}=this;e.activeAttachmentInfo=t,e.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(t){t.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(t,e){const{orientationInfo:s}=t;return!this._supportsImageOrientation&&e&&s?[s.rotation?`rotate(${s.rotation}deg)`:"",s.mirrored?"scaleX(-1)":""].join(" "):""}};t([n("viewModel.abilities")],B.prototype,"abilities",void 0),t([o()],B.prototype,"displayType",void 0),t([o({readOnly:!0})],B.prototype,"effectiveDisplayType",null),t([n("viewModel.graphic")],B.prototype,"graphic",void 0),t([o({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],B.prototype,"label",void 0),t([o(),g("esri/widgets/Attachments/t9n/Attachments")],B.prototype,"messages",void 0),t([o(),g("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),t([o({readOnly:!0})],B.prototype,"selectedFile",void 0),t([o({readOnly:!0})],B.prototype,"submitting",void 0),t([o({readOnly:!0})],B.prototype,"error",void 0),t([o({type:d})],B.prototype,"viewModel",void 0),t([o()],B.prototype,"visibleElements",void 0),t([r("visibleElements")],B.prototype,"castVisibleElements",null),B=t([l("esri.widgets.Attachments")],B);const A=B;export{A as default};
|