@arcgis/core 4.31.0-next.20240605 → 4.31.0-next.20240607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/functions/centroid.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/04d84f7c9c5b5a6bdf47.js +1 -0
- package/assets/esri/core/workers/chunks/17e4d9be754e9ce2cec4.js +1 -0
- package/assets/esri/core/workers/chunks/1a64e0020d12c251ad4b.js +1 -0
- package/assets/esri/core/workers/chunks/{3ec2ed6b4d2f373ed0dc.js → 1ece003ccf1c03fb42d9.js} +1 -1
- package/assets/esri/core/workers/chunks/2ee7d91cc6c1ae7f3698.js +1 -0
- package/assets/esri/core/workers/chunks/423abec9211aa6ab6502.js +1 -0
- package/assets/esri/core/workers/chunks/493851fc4b07de3fe924.js +1 -0
- package/assets/esri/core/workers/chunks/66b835a5edfcdcf21c06.js +1 -0
- package/assets/esri/core/workers/chunks/{24a02d266749a77c8ae1.js → 7866b86ebe02adf5e874.js} +17 -17
- package/assets/esri/core/workers/chunks/{d1c4d0d53614055bc173.js → c406e673d2dd7e702af0.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5f467805178686b7240.js → c70683b7183458b338f8.js} +1 -1
- package/assets/esri/core/workers/chunks/fa5e171c8ce844363b6c.js +1 -0
- package/assets/esri/themes/base/widgets/_BuildingDisciplinesTree.scss +5 -138
- package/assets/esri/themes/base/widgets/_BuildingExplorer.scss +1 -9
- package/assets/esri/themes/base/widgets/_BuildingLevelPicker.scss +5 -39
- package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +2 -17
- package/assets/esri/themes/base/widgets/_Editor.scss +8 -0
- package/assets/esri/themes/base/widgets/_Sketch.scss +8 -0
- package/assets/esri/themes/base/widgets/_SketchTooltipControls.scss +1 -0
- package/assets/esri/themes/base/widgets/_SnappingControls.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ColorMaterial.glsl.js +1 -1
- package/chunks/ComponentShader.glsl.js +1 -1
- package/chunks/CypherLexer.js +5 -0
- package/chunks/CypherListener.js +5 -0
- package/chunks/CypherParser.js +5 -0
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/HUDMaterial.glsl.js +32 -32
- package/chunks/ImageMaterial.glsl.js +1 -1
- package/chunks/LineMarker.glsl.js +1 -1
- package/chunks/NativeLine.glsl.js +1 -1
- package/chunks/OITCompositing.glsl.js +12 -9
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/RealisticTree.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +1 -1
- package/chunks/ShadedColorMaterial.glsl.js +1 -1
- package/chunks/WaterSurface.glsl.js +1 -1
- package/chunks/antlr4.web.js +5 -0
- package/layers/LinkChartLayer.js +1 -1
- package/layers/knowledgeGraph/antlr/BindParamsListener.js +5 -0
- package/layers/knowledgeGraph/antlr/SimpleErrorListener.js +5 -0
- package/layers/knowledgeGraph/cypherUtils.js +5 -0
- package/layers/knowledgeGraph/supportUtils.js +1 -1
- package/layers/support/rasterFunctions/AspectFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/layers/support/rasterFunctions/RemapFunction.js +1 -1
- package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/support/HighlightOptions.js +1 -1
- package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/support/HighlightOptions.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileAgent.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/terrain/tileUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlphaBlend.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +1 -1
- package/views/support/HighlightDefaults.js +5 -0
- package/views/support/HighlightOptions.js +5 -0
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesViewModel.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/css.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/css.js +5 -0
- package/widgets/BuildingExplorer/support/LayerTreeNode.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/support/legacyIcon.js +1 -1
- package/assets/esri/core/workers/chunks/3841ef7007eda2f3a7a4.js +0 -1
- package/assets/esri/core/workers/chunks/4ccf7a2b36e0b8b26736.js +0 -1
- package/assets/esri/core/workers/chunks/a111eb0ae78a9f5be981.js +0 -1
- package/assets/esri/core/workers/chunks/b57a5055b9956433dac2.js +0 -1
- package/assets/esri/core/workers/chunks/b9e4e2451108cad75bfd.js +0 -1
- package/assets/esri/core/workers/chunks/f9774ba48f3aa3b8fac4.js +0 -1
- package/assets/esri/core/workers/chunks/fa8b00135363c450de16.js +0 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightDefaults.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{releaseMaybe as t}from"../../../../../../core/maybe.js";import{invert as r,transpose as o}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as s}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{I as a}from"../../../../../../chunks/vec32.js";import{fromArray as i,fromValues as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as h}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as p}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as d}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as c,IntegratedMeshMode as m}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as g}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as x}from"./shader/VertexDiscardByOpacity.glsl.js";import{MaterialBase as y,parameter as b,parameterBlock as f,MaterialParameterBlock as v}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as T}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as M}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as w}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as O}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as C}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{defaultMaskAlphaCutoff as S}from"../../../core/shaderLibrary/util/AlphaCutoff.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as N,CullFaceOptions as q}from"../../../lib/basicInterfaces.js";import{TransparencyPassType as D}from"../../../lib/TransparencyPassType.js";import{defaultAdvancedMRRFactors as A}from"../../../materials/pbrUtils.js";class R extends y{constructor(e,t){super(),this.toMapSpace=t,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=i(A),this.emissiveFactor=l(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new E,this.componentParameters=new W,this.textureAlphaCutoff=S,this.alphaDiscardMode=N.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new c;const a=new j(e.position),n=s(e.rotationScale);r(n,n),o(n,n),this.transformNormalGlobalFromModel=n,this.transformWorldFromModelTL=a.low,this.transformWorldFromModelTH=a.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return null!=this.baseColorTexture?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return null!=this.metallicRoughnessTexture?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return null!=this.emissionTexture?this.emissionTexture.glTexture:null}get textureOcclusion(){return null!=this.occlusionTexture?this.occlusionTexture.glTexture:null}get textureNormal(){return null!=this.normalTexture?this.normalTexture.glTexture:null}prepareTechnique(e,t,r,o){const s=this._techniqueConfiguration;s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasEmissionTexture=null!=this.emissionTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.transparencyPassType=t.identifier===T.Material&&null!=r.transparencyPassType?r.transparencyPassType:D.NONE,s.multipassEnabled=t.identifier===T.Material&&r.multipassEnabled,s.cullAboveGround=t.identifier===T.Material&&r.multipassTerrain.cullAboveGround,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?O.View:O.None,s.hasColorTexture=null!=this.baseColorTexture;const a=this._computeWhichMaterialPass();if(s.blendingEnabled=a===F.Transparent||a===F.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?L(r)?B(r)?m.ColorOverlayWithWater:m.ColorOverlay:m.NoOverlay:m.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===m.ColorOverlayWithWater?C.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.needsNormals&&this.isIntegratedMesh?C.Disabled:C.Schematic:C.Normal:C.Disabled,s.normalType=o.needsNormals?s.hasNormals?w.Compressed:w.ScreenDerivative:w.Ground,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,t.identifier===T.ShadowMap)s.output=M.Shadow,s.vertexDiscardMode=x.None;else if(t.identifier===T.ViewshedShadowMap)s.output=M.ViewshedShadow,s.vertexDiscardMode=x.None;else if(t.identifier===T.Highlight)s.output=M.Highlight,s.vertexDiscardMode=x.None;else{switch(a===F.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?x.Opaque:x.Transparent:s.vertexDiscardMode=x.None,s.output=t.output,s.receiveAmbientOcclusion=!1,s.receiveShadows=!1,t.output){case M.Color:s.receiveAmbientOcclusion=null!=r.ssao,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.hasScreenSpaceReflections=null!=r.ssr.lastFrameColor,s.hasCloudsReflections=null!=r.cloudsFade.data;break;case M.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}return this._technique=e.releaseAndAcquire(d,s,this._technique),this._setClean(),this._technique}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}submit(e,t,r){if(0===this.objectOpacity)return;const o=r.renderable.geometry,s=r.components,a=r.renderable.meta.cameraDepthSquared,i=s.geometryRanges,l=s.highlightRanges,n=s.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case F.Opaque:e.materialOpaque.submitDraw(this,o,i,a);break;case F.Transparent:e.materialTransparent.submitDraw(this,o,i,a);break;case F.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,o,i,a),e.materialTransparent.submitDraw(this,o,i,a);break;case F.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,o,i,a),k(t)&&e.highlightIntegratedMesh.submitDraw(this,o,i,a)}const u=this.componentParameters.castShadows!==I.None;u&&e.shadowMap.submitDraw(this,o,i,a),null!=l&&(e.highlight.submitDraw(this,o,l,a),u&&e.highlightShadowMap.submitDraw(this,o,l,a)),t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,o,i,a),u&&null!=n&&e.defaultShadowMap.submitDraw(this,o,n,a)}_computeWhichMaterialPass(){return this.isIntegratedMesh?F.IntegratedMesh:this.objectOpacity<1?F.Transparent:this.componentParameters.opaqueOverride===I.All?F.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===N.Blend||this.alphaDiscardMode===N.MaskBlend?F.Transparent:this.componentParameters.transparent===I.None?F.Opaque:this.componentParameters.transparent===I.All?F.Transparent:F.OpaqueAndTransparent}}var F,I;e([b({vectorOps:n})],R.prototype,"baseColor",void 0),e([b()],R.prototype,"usePBR",void 0),e([b()],R.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:a})],R.prototype,"mrrFactors",void 0),e([b({vectorOps:a})],R.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],R.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],R.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],R.prototype,"emissionTexture",void 0),e([b({dispose:!0})],R.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],R.prototype,"normalTexture",void 0),e([b()],R.prototype,"objectOpacity",void 0),e([f()],R.prototype,"commonMaterialParameters",void 0),e([f()],R.prototype,"componentParameters",void 0),e([b()],R.prototype,"textureAlphaCutoff",void 0),e([b()],R.prototype,"alphaDiscardMode",void 0),e([b()],R.prototype,"isIntegratedMesh",void 0),e([b()],R.prototype,"polygonOffsetEnabled",void 0),e([b()],R.prototype,"ellipsoidMode",void 0),e([b()],R.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(F||(F={}));class E extends v{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=q.Back,this.hasSlicePlane=!0}}e([b()],E.prototype,"doubleSided",void 0),e([b()],E.prototype,"cullFace",void 0),e([b()],E.prototype,"hasSlicePlane",void 0);class W extends v{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=h.Multiply,this.castShadows=I.All}get transparent(){return this.externalColor[3]<1?I.All:I.None}get opaqueOverride(){return this.externalColorMixMode===h.Replace&&1===this.externalColor[3]?I.All:I.None}get visible(){return this.externalColor[3]>0?I.All:I.None}get type(){return g.Uniform}}e([b({vectorOps:n})],W.prototype,"externalColor",void 0),e([b()],W.prototype,"externalColorMixMode",void 0),e([b()],W.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(I||(I={}));class _ extends v{constructor(){super(...arguments),this.texture=null,this.transparent=I.None,this.opaqueOverride=I.None,this.castShadows=I.None}get type(){return g.Varying}}function k(e){return null!=e.overlay?.getTexture(p.Highlight)}function B(e){return null!=e.overlay?.getTexture(p.WaterNormal)}function L(e){return null!=e.overlay?.getTexture(p.ColorNoRasterImage)}e([b()],_.prototype,"texture",void 0),e([b()],_.prototype,"transparent",void 0),e([b()],_.prototype,"opaqueOverride",void 0),e([b()],_.prototype,"castShadows",void 0);export{E as CommonMaterialParameters,R as ComponentMaterial,I as ComponentParameterSummary,W as ComponentParametersUniform,_ as ComponentParametersVarying};
|
|
5
|
+
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{releaseMaybe as t}from"../../../../../../core/maybe.js";import{invert as r,transpose as o}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as s}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{I as a}from"../../../../../../chunks/vec32.js";import{fromArray as i,fromValues as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as h}from"../../../../layers/support/symbolColorUtils.js";import{OverlayContent as p}from"../../../../terrain/OverlayContent.js";import{ComponentTechnique as d}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as c,IntegratedMeshMode as m}from"./ComponentTechniqueConfiguration.js";import{ComponentDataType as g}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as x}from"./shader/VertexDiscardByOpacity.glsl.js";import{MaterialBase as y,parameter as b,parameterBlock as f,MaterialParameterBlock as v}from"../../../core/material/MaterialBase.js";import{RenderPassIdentifier as T}from"../../../core/renderPasses/AllRenderPasses.js";import{ShaderOutput as M}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as w}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as O}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as C}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{alphaCutoff as S}from"../../../core/shaderLibrary/util/AlphaCutoff.js";import{EllipsoidMode as P}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{TwoVectorPosition as j}from"../../../core/util/TwoVectorPosition.js";import{AlphaDiscardMode as N,CullFaceOptions as q}from"../../../lib/basicInterfaces.js";import{TransparencyPassType as D}from"../../../lib/TransparencyPassType.js";import{defaultAdvancedMRRFactors as A}from"../../../materials/pbrUtils.js";class R extends y{constructor(e,t){super(),this.toMapSpace=t,this.baseColor=u(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=i(A),this.emissiveFactor=l(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new E,this.componentParameters=new W,this.textureAlphaCutoff=S,this.alphaDiscardMode=N.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=P.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new c;const a=new j(e.position),n=s(e.rotationScale);r(n,n),o(n,n),this.transformNormalGlobalFromModel=n,this.transformWorldFromModelTL=a.low,this.transformWorldFromModelTH=a.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this._technique=t(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return null!=this.baseColorTexture?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return null!=this.metallicRoughnessTexture?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return null!=this.emissionTexture?this.emissionTexture.glTexture:null}get textureOcclusion(){return null!=this.occlusionTexture?this.occlusionTexture.glTexture:null}get textureNormal(){return null!=this.normalTexture?this.normalTexture.glTexture:null}prepareTechnique(e,t,r,o){const s=this._techniqueConfiguration;s.hasVertexColors=o.colors,s.hasNormals=o.hasNormals,s.textureCoordinateType=o.textureCoordinates,s.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,s.hasEmissionTexture=null!=this.emissionTexture,s.hasOcclusionTexture=null!=this.occlusionTexture,s.hasNormalTexture=null!=this.normalTexture,s.transparencyPassType=t.identifier===T.Material&&null!=r.transparencyPassType?r.transparencyPassType:D.NONE,s.multipassEnabled=t.identifier===T.Material&&r.multipassEnabled,s.cullAboveGround=t.identifier===T.Material&&r.multipassTerrain.cullAboveGround,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?O.View:O.None,s.hasColorTexture=null!=this.baseColorTexture;const a=this._computeWhichMaterialPass();if(s.blendingEnabled=a===F.Transparent||a===F.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?L(r)?B(r)?m.ColorOverlayWithWater:m.ColorOverlay:m.NoOverlay:m.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===m.ColorOverlayWithWater?C.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?o.needsNormals&&this.isIntegratedMesh?C.Disabled:C.Schematic:C.Normal:C.Disabled,s.normalType=o.needsNormals?s.hasNormals?w.Compressed:w.ScreenDerivative:w.Ground,s.hasSlicePlane=null!=r.slicePlane&&this.commonMaterialParameters.hasSlicePlane,t.identifier===T.ShadowMap)s.output=M.Shadow,s.vertexDiscardMode=x.None;else if(t.identifier===T.ViewshedShadowMap)s.output=M.ViewshedShadow,s.vertexDiscardMode=x.None;else if(t.identifier===T.Highlight)s.output=M.Highlight,s.vertexDiscardMode=x.None;else{switch(a===F.OpaqueAndTransparent?s.vertexDiscardMode=t.transparent?x.Opaque:x.Transparent:s.vertexDiscardMode=x.None,s.output=t.output,s.receiveAmbientOcclusion=!1,s.receiveShadows=!1,t.output){case M.Color:s.receiveAmbientOcclusion=null!=r.ssao,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.hasScreenSpaceReflections=null!=r.ssr.lastFrameColor,s.hasCloudsReflections=null!=r.cloudsFade.data;break;case M.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}return this._technique=e.releaseAndAcquire(d,s,this._technique),this._setClean(),this._technique}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}submit(e,t,r){if(0===this.objectOpacity)return;const o=r.renderable.geometry,s=r.components,a=r.renderable.meta.cameraDepthSquared,i=s.geometryRanges,l=s.highlightRanges,n=s.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case F.Opaque:e.materialOpaque.submitDraw(this,o,i,a);break;case F.Transparent:e.materialTransparent.submitDraw(this,o,i,a);break;case F.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,o,i,a),e.materialTransparent.submitDraw(this,o,i,a);break;case F.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,o,i,a),k(t)&&e.highlightIntegratedMesh.submitDraw(this,o,i,a)}const u=this.componentParameters.castShadows!==I.None;u&&e.shadowMap.submitDraw(this,o,i,a),null!=l&&(e.highlight.submitDraw(this,o,l,a),u&&e.highlightShadowMap.submitDraw(this,o,l,a)),t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,o,i,a),u&&null!=n&&e.defaultShadowMap.submitDraw(this,o,n,a)}_computeWhichMaterialPass(){return this.isIntegratedMesh?F.IntegratedMesh:this.objectOpacity<1?F.Transparent:this.componentParameters.opaqueOverride===I.All?F.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===N.Blend||this.alphaDiscardMode===N.MaskBlend?F.Transparent:this.componentParameters.transparent===I.None?F.Opaque:this.componentParameters.transparent===I.All?F.Transparent:F.OpaqueAndTransparent}}var F,I;e([b({vectorOps:n})],R.prototype,"baseColor",void 0),e([b()],R.prototype,"usePBR",void 0),e([b()],R.prototype,"hasParametersFromSource",void 0),e([b({vectorOps:a})],R.prototype,"mrrFactors",void 0),e([b({vectorOps:a})],R.prototype,"emissiveFactor",void 0),e([b({dispose:!0})],R.prototype,"baseColorTexture",void 0),e([b({dispose:!0})],R.prototype,"metallicRoughnessTexture",void 0),e([b({dispose:!0})],R.prototype,"emissionTexture",void 0),e([b({dispose:!0})],R.prototype,"occlusionTexture",void 0),e([b({dispose:!0})],R.prototype,"normalTexture",void 0),e([b()],R.prototype,"objectOpacity",void 0),e([f()],R.prototype,"commonMaterialParameters",void 0),e([f()],R.prototype,"componentParameters",void 0),e([b()],R.prototype,"textureAlphaCutoff",void 0),e([b()],R.prototype,"alphaDiscardMode",void 0),e([b()],R.prototype,"isIntegratedMesh",void 0),e([b()],R.prototype,"polygonOffsetEnabled",void 0),e([b()],R.prototype,"ellipsoidMode",void 0),e([b()],R.prototype,"hasOccludees",void 0),function(e){e[e.Opaque=0]="Opaque",e[e.Transparent=1]="Transparent",e[e.OpaqueAndTransparent=2]="OpaqueAndTransparent",e[e.IntegratedMesh=3]="IntegratedMesh"}(F||(F={}));class E extends v{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=q.Back,this.hasSlicePlane=!0}}e([b()],E.prototype,"doubleSided",void 0),e([b()],E.prototype,"cullFace",void 0),e([b()],E.prototype,"hasSlicePlane",void 0);class W extends v{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=h.Multiply,this.castShadows=I.All}get transparent(){return this.externalColor[3]<1?I.All:I.None}get opaqueOverride(){return this.externalColorMixMode===h.Replace&&1===this.externalColor[3]?I.All:I.None}get visible(){return this.externalColor[3]>0?I.All:I.None}get type(){return g.Uniform}}e([b({vectorOps:n})],W.prototype,"externalColor",void 0),e([b()],W.prototype,"externalColorMixMode",void 0),e([b()],W.prototype,"castShadows",void 0),function(e){e[e.All=0]="All",e[e.Some=1]="Some",e[e.None=2]="None"}(I||(I={}));class _ extends v{constructor(){super(...arguments),this.texture=null,this.transparent=I.None,this.opaqueOverride=I.None,this.castShadows=I.None}get type(){return g.Varying}}function k(e){return null!=e.overlay?.getTexture(p.Highlight)}function B(e){return null!=e.overlay?.getTexture(p.WaterNormal)}function L(e){return null!=e.overlay?.getTexture(p.ColorNoRasterImage)}e([b()],_.prototype,"texture",void 0),e([b()],_.prototype,"transparent",void 0),e([b()],_.prototype,"opaqueOverride",void 0),e([b()],_.prototype,"castShadows",void 0);export{E as CommonMaterialParameters,R as ComponentMaterial,I as ComponentParameterSummary,W as ComponentParametersUniform,_ as ComponentParametersVarying};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{alphaCutoff as o}from"./AlphaCutoff.js";import{glsl as r}from"../../shaderModules/interfaces.js";function d(d){d.fragment.code.add(r`
|
|
6
6
|
#define discardOrAdjustAlpha(color) { if (color.a < ${r.float(o)}) { discard; } }
|
|
7
7
|
`)}export{d as DiscardOrAdjustAlphaBlend};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ColorFormat as t}from"../../../webgl/formats.js";import n from"../../../webgl/RenderNode.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ColorFormat as t}from"../../../webgl/formats.js";import n from"../../../webgl/RenderNode.js";import{alphaCutoff as i}from"../../core/shaderLibrary/util/AlphaCutoff.js";import{glsl as s}from"../../core/shaderModules/interfaces.js";import{Default3D as a}from"../../lib/DefaultVertexAttributeLocations.js";import{ClearBufferBit as c,ColorAttachment as l,BlendFactor as u,SizedPixelFormat as p,PixelFormat as d,DataType as f}from"../../../../webgl/enums.js";let h=class extends n{constructor(e){super(e),this.destroyedCB=null,this.produces="final-color",this.consumes={required:["final-color"]},this._focusedFBOType=0,this._program=new Array}destroy(){this._program.forEach((e=>e.dispose())),this._program.length=0,this.destroyedCB()}render(e){const r=e.find((({name:e})=>"final-color"===e));if(!this._focusedFBO)return r;const o=this.renderingContext;o.bindFramebuffer(r.fbo),o.setClearColor(0,0,0,0),o.clear(c.COLOR_BUFFER_BIT);const t=this._ensureShader(o,!1);return o.useProgram(t),o.bindTexture(this._focusedFBO.getTexture(),0),t.setUniform1i("colorTex",0),t.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&t.setUniform2fv("nearFar",this.camera.nearFar),o.screen.draw(),r}getReplacingFBO(e,r,o,n,i){r===m.ON&&(n=e.width,i=e.height);const s=this.renderingContext,a=e.depthStencilTexture,d=this._ensureShader(s,null!=a),f=this.fboCache.acquire(n,i,"fbo visualizer"),h=!e.colorTexture?.descriptor.hasMipmap;h&&e.colorTexture?.generateMipmap(),s.useProgram(d),s.unbindTexture(f.fbo?.colorTexture),s.bindFramebuffer(f.fbo),a&&(s.bindTexture(a,1),d.setUniform1i("depthTex",1),f.acquireColor(l.COLOR_ATTACHMENT1,t.RGBA),s.gl.drawBuffers([l.COLOR_ATTACHMENT0,l.COLOR_ATTACHMENT1]));const T=s.getViewport();s.setViewport(0,0,n,i),s.setClearColor(0,0,0,0),s.clear(c.COLOR_BUFFER_BIT),s.setBlendingEnabled(!0),s.setBlendFunction(u.ONE,u.ONE_MINUS_SRC_ALPHA),s.bindTexture(e.colorTexture,0),d.setUniform1i("colorTex",0);const F="linear-depth"===o||o.includes("shadow"),v=e.colorTexture?.descriptor.internalFormat,g=F?3:v===p.R16F||v===p.R32F||v===p.R8?1:v===p.RG8?2:v===p.RGBA16F?4:0;return d.setUniform1i("inputType",g),F&&d.setUniform2fv("nearFar",this.camera.nearFar),s.screen.draw(),s.gl.drawBuffers([l.COLOR_ATTACHMENT0]),s.bindFramebuffer(null),s.setViewport(T.x,T.y,T.width,T.height),r===m.ON&&(this._focusedFBO=f,this._focusedFBOType=g),h&&e.colorTexture?.clearMipmap(),f}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,o,t){if(!o)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(0,0,0,0),n.clear(c.COLOR_BUFFER_BIT),n.setBlendingEnabled(!0),n.setBlendFunction(u.ONE,u.ONE_MINUS_SRC_ALPHA),n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1);n.useProgram(s),n.bindTexture(o.getColorTexture(t),0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,d.RGBA,f.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),n.bindFramebuffer(null),i?.release(),a}_ensureShader(e,r){const o=r?1:0;if(this._program[o])return this._program[o];const t="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",n=`#version 300 es\n precision highp float;\n\n in vec2 uv;\n uniform sampler2D colorTex;\n layout(location = 0) out vec4 fragColor;\n ${r?"\n layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;\n ":""}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgba2float(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgba2float(depth));\n }\n\n float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }\n\n void main() {\n vec4 color;\n if(inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if(inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if(inputType == 3) {\n float depth = 1.0 - (-linearDepthFromTexture(colorTex, uv) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if(inputType == 4) {\n color = texture(colorTex, uv);\n color = vec4(color.rgb / color.a, color.a);\n } else {\n color = texture(colorTex, uv);\n }\n\n\n if(color.a < ${s.float(i)})\n discard;\n else {\n fragColor = color;\n ${r?"\n float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);\n ":""}\n }\n }`;return this._program[o]=e.programCache.acquire(t,n,a),this._program[o]}};var m;e([r()],h.prototype,"destroyedCB",void 0),e([r()],h.prototype,"produces",void 0),e([r()],h.prototype,"consumes",void 0),h=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],h),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(m||(m={}));export{m as FocusState,h as RenderNodeVisualizerNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as r}from"../../../../../core/colorUtils.js";import has from"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ColorFormat as c}from"../../../webgl/formats.js";import n from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as m}from"./HighlightBlurTechnique.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as r}from"../../../../../core/colorUtils.js";import has from"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as l}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ColorFormat as c}from"../../../webgl/formats.js";import n from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as m}from"./HighlightBlurTechnique.js";import{HighlightDownsampleTechnique as p}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as g}from"./HighlightPassParameters.js";import{RenderRequestType as d,Decorations as b}from"../../lib/basicInterfaces.js";import{Default3D as f}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos2Tex as _}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{H as T}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as P,g as v}from"../../../../../chunks/HighlightDownsample.glsl.js";import{defaultColor as q,defaultHaloOpacity as C,defaultFillOpacity as y}from"../../../../support/HighlightDefaults.js";import{BufferObject as j}from"../../../../webgl/BufferObject.js";import{ClearBufferBit as x,Usage as O}from"../../../../webgl/enums.js";import{vertexCount as D}from"../../../../webgl/Util.js";let R=class extends n{constructor(e){super(e),this.produces="highlight-color",this.consumes={required:["highlight-color","highlights"]},this._passParameters=new g,this._downsampleDrawParameters=new P,this._blurDrawParameters=new T,this._blurColorFormat=has("mac")?c.RGBA:c.RGBA4,this._grid={coverage:null,vao:null,verticalCellCount:0,horizontalCellCount:0,viewportWidth:0,viewportHeight:0},this._blurTechnique=e.techniques.acquire(m),this._downsampleTechnique=e.techniques.acquire(p),this._applyTechnique=e.techniques.acquire(u)}initialize(){this.addHandles([s((()=>this.view.highlightOptions.color),(e=>{this._passParameters.color=r(e??q),this.view.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this.requestRender(d.UPDATE)}),o),s((()=>this.view.highlightOptions.haloColor),(e=>{this._passParameters.haloColor=null!=e?r(e):this._passParameters.color,this.requestRender(d.UPDATE)}),o),s((()=>this.view.highlightOptions.haloOpacity),(e=>{this._passParameters.haloOpacity=e??C,this._passParameters.haloOpacityOccluded=.25*this._passParameters.haloOpacity,this.requestRender(d.UPDATE)}),o),s((()=>this.view.highlightOptions.fillOpacity),(e=>{this._passParameters.fillOpacity=e??y,this._passParameters.fillOpacityOccluded=.25*this._passParameters.fillOpacity,this.requestRender(d.UPDATE)}),o)])}destroy(){this._blurTechnique.release(),this._downsampleTechnique.release(),this._applyTechnique.release(),this._grid.coverage=t(this._grid.coverage),this._grid.vao=i(this._grid.vao)}render(e){if(this.bindParameters.decorations===b.OFF)return e.find((({name:e})=>"highlight-color"===e));if(!(this._blurTechnique.compiled&&this._downsampleTechnique.compiled&&this._applyTechnique.compiled))return this.requestRender(d.UPDATE),e.find((({name:e})=>"highlight-color"===e));const r=e.find((({name:e})=>"highlights"===e)).getTexture(),t=this.bindParameters.camera,i=t.fullWidth,s=t.fullHeight,o=t.pixelRatio,a=Math.ceil(i/o),h=Math.ceil(s/o),c=this.renderingContext;this._gridUpdateResources(r),this._gridComputeCoverage(r,this.bindParameters),this._passParameters.highlightTexture=r,this._passParameters.coverageTexture=this._grid.coverage?.getTexture();const{width:n,height:u}=r.descriptor;l(this._passParameters.coverageRounding,n/(Math.ceil(n/v)*v),u/(Math.ceil(u/v)*v));const m=this._grid.vao;c.bindVAO(m);const p=this.fboCache.acquire(a,h,"highlight blur",this._blurColorFormat);c.unbindTexture(p.fbo?.colorTexture),c.bindFramebuffer(p.fbo),c.setClearColor(0,0,0,0),c.clear(x.COLOR_BUFFER_BIT),c.setViewport(0,0,a,h),this._blurDrawParameters.blurInputTexture=r,l(this._blurDrawParameters.blurSize,1/a,0);const g=c.bindTechnique(this._blurTechnique,this.bindParameters,this._passParameters,this._blurDrawParameters);c.drawArrays(this._blurTechnique.primitiveType,0,D(m,"geometry"));const f=this.fboCache.acquire(a,h,"highlight blur",this._blurColorFormat);c.unbindTexture(f.fbo?.colorTexture),c.bindFramebuffer(f.fbo),c.setClearColor(0,0,0,0),c.clear(x.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=p.getTexture(),l(this._blurDrawParameters.blurSize,0,1/h),g.bindDraw(this._blurDrawParameters,this.bindParameters,this._passParameters),c.drawArrays(this._blurTechnique.primitiveType,0,D(m,"geometry"));const _=e.find((({name:e})=>"highlight-color"===e));return c.bindFramebuffer(_.fbo),c.setViewport4fv(t.fullViewport),this._passParameters.blurTexture=f.getTexture(),c.bindTechnique(this._applyTechnique,this.bindParameters,this._passParameters),c.drawArrays(this._applyTechnique.primitiveType,0,D(m,"geometry")),p.release(),f.release(),_}_gridUpdateResources(e){const r=this.renderingContext,t=this._grid,i=Math.ceil(e.descriptor.height/v),s=Math.ceil(e.descriptor.width/v);if(t.vao&&t.verticalCellCount===i&&t.horizontalCellCount===s)return;t.verticalCellCount=i,t.horizontalCellCount=s;const o=i+1,a=s+1,h=1/i,l=1/s,c=new Float32Array(6*4*o*a);let n=0;for(let u=0;u<o;u++)for(let e=0;e<a;e++)c[n++]=(e-.5)*l*2-1,c[n++]=(u-.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e+.5)*l*2-1,c[n++]=(u-.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e-.5)*l*2-1,c[n++]=(u+.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e-.5)*l*2-1,c[n++]=(u+.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e+.5)*l*2-1,c[n++]=(u-.5)*h*2-1,c[n++]=e*l,c[n++]=u*h,c[n++]=(e+.5)*l*2-1,c[n++]=(u+.5)*h*2-1,c[n++]=e*l,c[n++]=u*h;t.vao?.dispose(),t.vao=new w(r,f,{geometry:_},{geometry:j.createVertex(r,O.STATIC_DRAW,c)})}_gridComputeCoverage(e,r){const t=this.renderingContext,i=this._grid,s=e.descriptor,o=Math.ceil(s.width/v),a=Math.ceil(s.height/v);this._downsampleDrawParameters.input=e,i.coverage?.release(),i.coverage=this.fboCache.acquire(o,a,"highlight coverage",c.RG),t.unbindTexture(i.coverage.fbo?.colorTexture),t.bindFramebuffer(i.coverage.fbo),t.bindTechnique(this._downsampleTechnique,r,this._passParameters,this._downsampleDrawParameters),t.setViewport(0,0,o,a),t.screen.draw()}get test(){}};e([a()],R.prototype,"produces",void 0),e([a()],R.prototype,"consumes",void 0),e([a({constructOnly:!0})],R.prototype,"techniques",void 0),R=e([h("esri.views.3d.webgl-engine.effects.highlight.Highlight")],R);export{R as Highlight};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import{smoothstep as s,clamp as i}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,s as p,m as n}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import l from"../../../webgl/RenderNode.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import{smoothstep as s,clamp as i}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,s as p,m as n}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import l from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as u,ShadowHighlightTechnique as g}from"./ShadowHighlightTechnique.js";import{RenderRequestType as f}from"../../lib/basicInterfaces.js";import{defaultShadowOpacity as _,defaultShadowDifference as w,defaultShadowColor as y}from"../../../../support/HighlightDefaults.js";const O=1/512,v=4e4,P=5e4;let b=class extends l{constructor(e){super(e),this.produces="composite-color",this.consumes={required:["composite-color","highlights"]},this._passParameters=new u,this._maxOpacity=1,this._shadowDifference=.2,this._technique=e.techniques.acquire(g)}initialize(){this.addHandles([r((()=>this.view.highlightOptions.shadowOpacity),(e=>{this._passParameters.shadowOpacity=e??_,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),a),r((()=>this.view.highlightOptions.shadowDifference),(e=>{this._shadowDifference=e??w,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),a),r((()=>this.view.highlightOptions.shadowColor),(e=>{this._passParameters.shadowColor=t(e??y),this._updateMaxOpacity()}),a)])}destroy(){this._technique.release()}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_updateMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3]}render(e){const t=e.find((({name:e})=>"composite-color"===e)),s=this.bindParameters;if(!s.shadowHighlightsVisible||!s.depth||!this._ensureIfVisible(s.camera,s.lighting.mainLight.direction))return t;if(!this._technique.compiled)return this.requestRender(f.UPDATE),t;this._passParameters.highlight=e.find((({name:e})=>"highlights"===e))?.getTexture(),this._passParameters.origin=s.camera.center;const i=this.renderingContext;return i.bindFramebuffer(t.fbo),i.bindTechnique(this._technique,s,this._passParameters),i.screen.draw(),t}_ensureIfVisible(e,t){this._passParameters.opacityElevation=1-s(v,P,e.relativeElevation);const r=this.viewingMode===m.Global?c(j,e.center):p(j,0,0,1),a=n(r,t);return this._passParameters.dayNightTerminator=s(0,1,i(30*a,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=O}};e([o()],b.prototype,"produces",void 0),e([o()],b.prototype,"consumes",void 0),e([o({constructOnly:!0})],b.prototype,"viewingMode",void 0),e([o({constructOnly:!0})],b.prototype,"techniques",void 0),b=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],b);const j=d();export{b as ShadowHighlight};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import{releaseMaybe as t}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/vec42.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as i,DepthFormat as h}from"../../webgl/formats.js";import{RendererTarget as s}from"./rendererUtils.js";import{TransparencyPassType as o}from"./TransparencyPassType.js";import{ColorAttachment as c,ClearBufferBit as a}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as l}from"../../../webgl/FramebufferObject.js";class f{constructor(t,e){this._fbos=t,this.compositingHelper=e,this._width=4,this._height=4,this._clearColor=r()}dispose(){this._color=t(this._color),this.releaseBuffers()}get framebuffer(){return this.color.attachDepth(this.depth),this.color.fbo}get colorTexture(){return this.color.getTexture()}get depthTexture(){return this.depth.attachment}initializeFrame(t,r,i){this._fbos.interactive=i===s.Default;const h=this._fbos.rctx;this._width=t.fullWidth,this._height=t.fullHeight,l(this,h.parameters.maxTextureSize);const o=this._color;return this._color=null,this.releaseBuffers(),e(this._clearColor,r),o}releaseBuffers(){this._color?.detachDepth(),this._depth=t(this._depth)}renderHUDVisibility(t,e,r){return t?.fbo?.width===this._width&&t?.fbo?.height===this._height||(t?.release(),t=this._fbos.acquire(this._width,this._height,"hud visibility",i.RGBA4)),t.attachDepth(r||this.depth),this._fbos.rctx.bindFramebuffer(t.fbo),this._fbos.rctx.clearFramebuffer(_),e(),t.detachDepth(),t}compositeToHUDVisibility(t,e){this._fbos.rctx.bindFramebuffer(t.hudVisibility?.fbo),this.compositingHelper.compositeHUD(t,e)}renderOIT(t,e,r){const{_width:s,_height:a,_fbos:l}=this,f=l.rctx;t.transparencyPassType=o.ColorAlpha;const _=this._fbos.acquire(s,a,r?"oit hud color alpha":"oit color alpha",i.RGBA16F);_.acquireColor(c.COLOR_ATTACHMENT1,i.R16F),r||_.attachDepth(this.depth),f.bindFramebuffer(_.fbo),f.clearFramebuffer([0,0,0,1]),e(),_.detachDepth(),t.transparencyPassType=o.FrontFace;const b=this._fbos.acquire(s,a,r?"oit hud front":"oit front");r?b.acquireDepth(h.DEPTH16_BUFFER):b.attachDepth(this.depth),f.bindFramebuffer(b.fbo),f.clearFramebuffer([0,0,0,0],!!r),e(),b.detachDepth(),t.transparencyPassType=o.NONE,this._compositeOIT(t,_,b,r),r?.detachDepth(),b.release(),_.release()}compositeToFramebuffer(t,e,r,i){this.bindFbo(),this.compositingHelper.composite(t,e,r,i)}_compositeOIT(t,e,r,i){i?(this._fbos.rctx.bindFramebuffer(i.fbo),this._fbos.rctx.setClearColor(0,0,0,1e-13),this._fbos.rctx.clear(a.COLOR_BUFFER_BIT)):this.bindFbo(),this.compositingHelper.compositeOIT(t,e.getTexture(),e.getTexture(c.COLOR_ATTACHMENT1),r.getTexture())}renderDepthDetached(t){this._bindTarget(this.color),t(),this._bindTarget(this.color,this.depth)}renderToCachedFBO(e,r,s,o,c=i.RGBA,a=h.DEPTH16_BUFFER,l=this._width,f=this._height,_=null){return e?.fbo?.width===l&&e?.fbo?.height===f||(e=t(e)),e=e??this._fbos.acquire(l,f,r,c),_?.forEach((t=>e.acquireColor(t.attachment,t.format))),null!=a&&e.acquireDepth(a),this._fbos.rctx.bindFramebuffer(e.fbo),this._fbos.rctx.clearFramebuffer(o,!0,!0),s(),e}renderToTargets(t,e,r,i,h=!1,s=!1){this._bindTarget(e,r),this._fbos.rctx.clearFramebuffer(i,h,s),t(),e.detachDepth()}bindFbo(){const t=null==this._color;if(this._bindTarget(this.color,this.depth),t){const t=this._fbos.rctx;t.setClearStencil(0),t.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),t.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT|a.STENCIL_BUFFER_BIT)}}_bindTarget(t,e){t.attachDepth(e),this._fbos.rctx.bindFramebuffer(t.fbo)}get width(){return this._width}get height(){return this._height}get color(){return this._ensureColor()}_ensureColor(){return this._color||(this._color=this._fbos.acquire(this._width,this._height,"composite-color")),this._color}updateColor(t){const e=this._ensureColor();e.attachDepth(this.depth),this._color=t(e)}get depth(){return this._depth||(this._depth=this._fbos.acquireDepth(h.DEPTH_STENCIL_TEXTURE,this._width,this._height,"depth")),this._depth}}const _=[0,1,0,1];export{f as OffscreenRendering};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{throwIfAborted as d}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as _,initial as p,sync as u}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as f,invert as g,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as A}from"../../../../chunks/vec42.js";import{fromValues as P,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as S}from"../../../../chunks/boundedPlane.js";import{RenderCategory as C,InternalRenderCategory as w}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as O}from"../../terrain/TerrainRenderer.js";import{DepthFormat as y,ColorFormat as N}from"../../webgl/formats.js";import{FBOCache as D,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as v}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as H}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as F}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as U}from"../effects/RenderPlugin.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{AnimationTimeStep as j}from"./AnimationTimeStep.js";import{Decorations as G,RenderRequestType as B,StencilBits as Q}from"./basicInterfaces.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{zero as W,union as X}from"./depthRange.js";import{depthRangeFromScene as Y}from"./depthRangeUtils.js";import{RenderOccludedFlag as z}from"./Material.js";import{OffscreenRendering as J}from"./OffscreenRendering.js";import{RenderContext as K,defaultRenderOccludedMask as Z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as $,RendererTarget as ee}from"./rendererUtils.js";import{setupFeatureDefaults as te,RenderFeature as re}from"./RenderFeature.js";import{RenderPluginInput as se}from"./RenderPluginInput.js";import{RenderSlot as ie}from"./RenderSlot.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne,SnapshotSlot as he}from"./ShadowMap.js";import oe from"./SliceHelper.js";import{TransparencyPassType as de}from"./TransparencyPassType.js";import{Viewshed as le}from"./Viewshed.js";import{Transparency as _e}from"./edgeRendering/interfaces.js";import{MergedRenderer as pe}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ue}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as ce}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as me,PerformanceCategory as fe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ge}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as be,PixelType as Ee,ClearBufferBit as Ae}from"../../../webgl/enums.js";class Pe{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=P(0,0,0,1),this._sliceHelper=new oe,this._blit=null,this._state=c(ge.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=O.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new j,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new se,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new D(i),this._renderStateFeatures=c(te(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._offscreen=new J(this.fboCache,this._compositingHelper),this.performanceInfo=new me(this._rctx),this._shadowMap=new ne(this.fboCache,e.viewingMode),this._viewshed=new le({fboCache:this.fboCache,view:e.view},((e,t,r)=>{t.setGLViewport(this._rctx);const{camera:s,contentCamera:i}=e;this._ensureBindParametersCamera(t,t),this._renderAllGeometry(r),this._ensureBindParametersCamera(s,i),e.camera.setGLViewport(this._rctx)})),this._shadowAccumulator=new ae(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(L.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new K(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._nodes=new F(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new x,this._plugins.add(this.renderPassManager),this._plugins.add(this._viewshed),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),_),l((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),p),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):R;A(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),_),l((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=H}),_)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._offscreen.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=a(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),k.prune()}get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=te(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(re.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(re.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(L.Highlight,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL,ie.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(re.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(re.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(re.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._viewshed.viewshedShadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");d(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this._stage.view.resourceController)});return this._handles.push(l((()=>r.updating),(()=>this._requestRender()),u)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;const a=$(e);let n=!1;a.forEach(((r,s)=>{if(t.done)return;let i=this._plugins.getMaterialRenderer(s);if(null==i&&r.adds.length>0){const e=new pe({material:s});e.initializeRenderContext(this._plugins._context),i=e,this._plugins.add(i)}i&&(i.modify(r),0===i.numGeometries&&(n=!0)),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),n&&this._plugins.removeEmptyMaterialRenderers(),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(L.Color,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),has.water=this._plugins.produces(L.Normal,ie.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ee.Default,s=G.ON){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frameStart(),this._disposeBindBuffers();const i=this._offscreen,{camera:a,contentCamera:n,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=de.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainColor=this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._viewshed.enabled;const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),p=S(this._sliceHelper.plane);s===G.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const u=i.initializeFrame(a,this._backgroundColor,r);this.hasReflections?this._bindParameters.ssr.lastFrameColor=u:u?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===G.ON;const c=this._plugins.produces(L.Color,ie.OPAQUE_TERRAIN)&&(this._terrainTransparency===O.Semitransparent||this._terrainTransparency===O.TransparentWithDraped),m=this._highQualityTransparency&&c,f=this._plugins.produces(L.Color,...Ie);this._prepareShaders(m,f),this.performanceInfo.advance(fe.PREPARE);const g=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,g),this._ensureBindParametersCamera(a,n);let T=this._renderNormals();if(this._pluginInput.set("normals",T),T){let e=null;this._needsDepth&&(e=T.getAttachment(Te),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(e),T=null}else this._renderAllGeometryDepth();this._renderShadowAccumulation(g,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=L.Color,i.bindFbo(),this._bindParameters.mainColor=i.colorTexture,this._bindParameters.mainDepth=i.depthTexture;const b=this.plugins.produces(L.Color,...we);b&&this._renderOpaqueGeometry(),this._offscreen.updateColor((e=>this._renderNodes(C.OPAQUE,e,b))),this.fboCache.debugCallback?.("opaque-color",this._offscreen.color.fbo),this._renderPlugins(ie.OPAQUE_ENVIRONMENT,fe.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(m),this._setMultipassTerrain(m),this._renderEdges(_e.OPAQUE),i.bindFbo(),this._renderPlugins(ie.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(Re.Geometry):this._renderTransparentMaterial()),this._offscreen.updateColor((e=>this._renderNodes(C.TRANSPARENT,e,f))),this.fboCache.debugCallback?.("transparent-color",this._offscreen.color.fbo),this._renderMultipassGeometryDepth(m),this._renderHUDVisibility(),m||this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS);const E=r===ee.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const A=c?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(v.Occluded):i.compositeToHUDVisibility(this._bindParameters,A.getTexture()),this._renderHUD(v.Occluded,i.color))),this._setTerrainCulling(!1),A&&(i.compositeToFramebuffer(this._bindParameters,A.getTexture(),ue.PremultipliedAlpha,1),A.release(),m&&(this._renderEdges(_e.OPAQUE),f&&(this._oitEnabled?this._renderOITPass(Re.Geometry):this._renderTransparentMaterial(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(v.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),this._renderViewshed(),this._renderLaserlines(),this._renderOccluded(),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._offscreen.updateColor((e=>this._renderNodes(C.COMPOSITE,e)));const P=this._nodes.produces("aa-color"),R=!(r!==ee.Default||_||l&&s===G.ON&&r===ee.Default),I=this._pluginInput.get("composite-color"),y=R?M:this.fboCache.acquire(I.fbo.width,I.fbo.height,"aa-color"),N=P?this._renderNodes(w.ANTIALIASING,y):this._blitToDefault(I,y,!1);this._pluginInput.set(w.ANTIALIASING,N),this._renderHUD(v.NotOccluded,N);const D=this._renderNodes(w.HIGHLIGHTS,N);let x=this._renderNodes(w.MAGNIFIER,D);return l&&s===G.ON&&r===ee.Default&&!_&&(x=this._blitToDefault(x)),_?(x.attachDepth(i.depth),this._blitToDefault(this._renderNodes(C.FINAL,x)),x.detachDepth()):this._pluginInput.set(C.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=p,this._isRendering=!1,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ee.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:E}}_prepareShaders(e,t){this._renderContext.output=L.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ie.LINE_CALLOUTS),t&&this._prepareTransparencySlots(),this._plugins.prepare(ie.VIEWSHED,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT,ie.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oid");return t.acquireDepth(y.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(t.fbo),this.fboCache.rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(L.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(t.fbo),this.fboCache.rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=v.NotOccluded,this._plugins.render(this._pluginInput,ie.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(fe.OBJECT_AND_LAYER_ID_COLOR),t}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===B.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0,s=t?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){if(!this._bindParameters.mainDepth)return;const{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"linear-depth");this._rctx.bindFramebuffer(i.fbo),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,this._bindParameters.mainDepth),i.fbo?.readPixels(e[0],e[1],e[2],e[3],be.RGBA,Ee.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,be.RGBA,Ee.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const{width:r,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(r,s,"edges"),n=()=>t.render(this._bindParameters,e),h=this._bindParameters.multipassGeometry.depth;this._offscreen.renderToTargets(n,a,h??i,Ce),this._offscreen.compositeToFramebuffer(this._bindParameters,a.getTexture(),ue.Alpha,1),a.release(),this.performanceInfo.advance(e===_e.OPAQUE?fe.OPAQUE_EDGES:fe.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(re.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(L.ShadowHighlight,this._shadowMap),s.moveSnapshot(he.Highlight),this._renderShadowCascades(L.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(he.ExcludeHighlight),this._renderShadowCascades(L.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(L.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(fe.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this._renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(L.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=h(this._bindParameters.depth));const{width:t,height:r}=this._offscreen,s=this.fboCache.acquire(t,r,"depth");s.attachDepth(e),e.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(L.Depth),h(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=h(this._bindParameters.depth));const{width:e,height:t}=this._offscreen,r=this.fboCache.acquire(e,t,"depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(L.Depth),h(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(fe.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=L.Depth;const{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"terrain depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"geometry depth").acquireDepth(y.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(L.Depth),this._renderContext.output=t,h(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=i.obtainDepthTexture(),i.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const t=Y(e,this._plugins.plugins,this._stage.layers);return X(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(L.Normal)),[0,0,0,0],N.RGBA,y.DEPTH_STENCIL_TEXTURE),s=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color");return r.retain(t+s-1),this.performanceInfo.advance(fe.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();const t=this._nodes.render("ssao",this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.OPAQUE_NO_SSAO_DEPTH,ie.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...we,ie.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...we)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ie.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ie.TRANSPARENT_TERRAIN);if(e!==L.Color)return void t();const{width:r,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(r,s,"transparent terrain");return this._offscreen.renderToTargets(t,a,i,[0,0,0,0]),a}_renderHUDVisibility(){this._plugins.produces(this._renderContext.output,ie.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._plugins.render(this._pluginInput,ie.OCCLUSION_PIXELS)),this._bindParameters.multipassGeometry.depth),this._offscreen.bindFbo(),this.performanceInfo.advance(fe.HUD_VISIBILITY)):this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===v.Occluded){const e=()=>this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS),{width:t,height:r,color:s}=this._offscreen,i=this.fboCache.acquireDepth(y.DEPTH16_BUFFER,t,r,"line callouts");this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS)}_renderLaserlines(){const e=this._plugins.produces(this._renderContext.output,ie.LASERLINES_CONTRAST_CONTROL);if(this._plugins.produces(this._renderContext.output,ie.LASERLINES)||e){if(this._plugins.render(this._pluginInput,ie.LASERLINES),e){const e=this._offscreen,{width:t,height:r,depth:s}=e,i=this.fboCache.acquire(t,r,"laser lines"),a=()=>this._plugins.render(this._pluginInput,ie.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Ce),e.compositeToFramebuffer(this._bindParameters,i.getTexture(),ue.PremultipliedAlpha,1),i.release()}this.performanceInfo.advance(fe.LASER_LINES)}}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(Re.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),ue.PremultipliedAlpha),r.release()}else if(e===v.Occluded){this._renderContext.output=L.Color;const t=()=>this._renderHUDElements(e),{width:r,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(y.DEPTH16_BUFFER,r,s,"hud");this._offscreen.renderToTargets(t,i,a,void 0,!0,!0),a.release()}else this._renderContext.output=L.Color,t.acquireDepth(y.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===v.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(L.ShadowHighlight,ie.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const e=()=>{this._renderAllGeometry(L.Highlight),this._rctx.clear(Ae.DEPTH_BUFFER_BIT),this._renderHUDElements(v.Both)},t=this._offscreen.renderToCachedFBO(null,"highlights",e,[0,0,0,0],N.RGBA4,y.DEPTH_STENCIL_TEXTURE);return t.detachDepth(),t}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(fe.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(){this._renderContext.output=L.Color,this._bindParameters.transparencyPassType=de.ColorAlpha,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=de.FrontFace,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=de.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t=v.Both){const r=e===Re.HUD,s=r?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oit hud composite"):null,i=r?()=>this._renderHUDElements(t):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=L.Color,this._bindParameters.transparencyPassType=de.ColorAlpha;const n=this._offscreen.renderOITPass(i,de.ColorAlpha,r);this._bindParameters.transparencyPassType=de.FrontFace;const h=this._offscreen.renderOITPass(i,de.FrontFace,r);return this._offscreen.compositeOIT(this._bindParameters,n,h,s),s?.detachDepth(),h.release(),n.release(),this._bindParameters.transparencyPassType=de.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;Oe.clear(),this._plugins.plugins.forAll((t=>{if(!t.materialReference)return;t.queryRenderOccludedState(z.OccludeAndTransparentStencil)&&(e|=z.OccludeAndTransparentStencil,Oe.push(t))}));const t=this._offscreen,r=(r,s,i,a,n)=>{if(!(e&s))return;const{width:h,height:o,depth:d}=t,l=this.fboCache.acquire(h,o,"tmp color");t.renderToTargets(i,l,d,[0,0,0,0],a,n),t.compositeToFramebuffer(this._bindParameters,l.getTexture(),ue.PremultipliedAlpha,r),l.release()},s=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(U(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==Oe.length&&(s(ie.OCCLUDER_MATERIAL,Oe),r(.5,z.OccludeAndTransparentStencil,(()=>s(ie.TRANSPARENT_OCCLUDER_MATERIAL,Oe)),!1,!1));const i=Oe.length>0;Oe.clear(),this._plugins.plugins.forAll((t=>{if(!t.materialReference)return;const r=t.queryRenderOccludedState(z.OccludeAndTransparent),s=t.queryRenderOccludedState(z.Transparent),i=t.queryRenderOccludedState(z.Opaque);(r||s||i)&&(e|=r?z.OccludeAndTransparent:s?z.Transparent:z.Opaque,Oe.push(t))}));const a=this._plugins.renderOccludedFlags;if(e|=a,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,a>z.Occlude&&this._plugins.render(this._pluginInput,ie.OCCLUDED_TERRAIN),s(ie.OPAQUE_MATERIAL,Oe),s(ie.TRANSPARENT_MATERIAL,Oe),s(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Oe),this._renderContext.renderOccludedMask=Z};this._renderContext.output=L.Color,r(.5,z.OccludeAndTransparent,(()=>n(z.OccludeAndTransparent)),!0,Q.OutlineVisualElementMask),r(.5,z.Transparent,(()=>n(z.Transparent)),!0,Q.OutlineVisualElementMask),r(1,z.Opaque,(()=>n(z.Opaque)),!0,Q.OutlineVisualElementMask),(i||Oe.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),Oe.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._offscreen.bindFbo(),this._plugins.render(this._pluginInput,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(fe.TRANSPARENT_ENVIRONMENT)}_renderViewshed(){this._plugins.produces(this._renderContext.output,ie.VIEWSHED)&&(this._viewshed.renderHighQuality=this.isFeatureEnabled(re.HighResolutionViewshed),this._plugins.render(this._pluginInput,ie.VIEWSHED),this.performanceInfo.advance(fe.VIEWSHED))}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;t.setName(e),this._pluginInput.set(e,t);const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitToDefault(e,t=M,r=!0){this._blit||(this._blit=new V(this._techniques));const s=this._blit.render(this._rctx,e,t,this._bindParameters,this._requestRender);return this._pluginInput.set(e.name,s),r&&e.release(),s}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(g(Ne,this._bindParameters.camera.viewMatrix),g(ye,this._bindParameters.camera.projectionMatrix),T(De,Ne,ye),T(De,this._renderContext.lastFrameCamera.viewMatrix,De),T(De,this._renderContext.lastFrameCamera.projectionMatrix,De),this._reprojectionMatrix=De);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}get test(){}}var Re,Se;e([m({readOnly:!0})],Pe.prototype,"fullResolutionAtmosphere",null),e([m()],Pe.prototype,"_edgeView",void 0),e([m()],Pe.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Re||(Re={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility",e[e.ViewshedShadowMap=4]="ViewshedShadowMap"}(Se||(Se={}));const Ce=[0,0,0,0],we=[ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.OPAQUE_NO_SSAO_DEPTH],Ie=[ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH],Oe=new o,ye=E(),Ne=E(),De=E();function Me(e){return t=>e.immediate.schedule(t)}export{Se as FramebufferId,Pe as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{throwIfAborted as d}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as _,initial as p,sync as u}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as f,invert as g,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as A}from"../../../../chunks/vec42.js";import{fromValues as R,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as S}from"../../../../chunks/boundedPlane.js";import{RenderCategory as C,InternalRenderCategory as w}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as O}from"../../terrain/TerrainRenderer.js";import{DepthFormat as N,ColorFormat as y}from"../../webgl/formats.js";import{FBOCache as D,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as x}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as v}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as H}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as F}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as U}from"../effects/RenderPlugin.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{AnimationTimeStep as j}from"./AnimationTimeStep.js";import{Decorations as G,RenderRequestType as B,StencilBits as Q}from"./basicInterfaces.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{zero as W,union as X}from"./depthRange.js";import{depthRangeFromScene as Y}from"./depthRangeUtils.js";import{RenderOccludedFlag as z}from"./Material.js";import{OffscreenRendering as J}from"./OffscreenRendering.js";import{RenderContext as K,defaultRenderOccludedMask as Z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as $,RendererTarget as ee}from"./rendererUtils.js";import{setupFeatureDefaults as te,RenderFeature as re}from"./RenderFeature.js";import{RenderPluginInput as se}from"./RenderPluginInput.js";import{RenderSlot as ie}from"./RenderSlot.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne,SnapshotSlot as he}from"./ShadowMap.js";import oe from"./SliceHelper.js";import{TransparencyPassType as de}from"./TransparencyPassType.js";import{Viewshed as le}from"./Viewshed.js";import{Transparency as _e}from"./edgeRendering/interfaces.js";import{MergedRenderer as pe}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ue}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as ce}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as me,PerformanceCategory as fe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ge}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as be,PixelType as Ee,ClearBufferBit as Ae}from"../../../webgl/enums.js";class Re{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=R(0,0,0,1),this._sliceHelper=new oe,this._blit=null,this._state=c(ge.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=O.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new j,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new se,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new D(i),this._renderStateFeatures=c(te(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._offscreen=new J(this.fboCache,this._compositingHelper),this.performanceInfo=new me(this._rctx),this._shadowMap=new ne(this.fboCache,e.viewingMode),this._viewshed=new le({fboCache:this.fboCache,view:e.view},((e,t,r)=>{t.setGLViewport(this._rctx);const{camera:s,contentCamera:i}=e;this._ensureBindParametersCamera(t,t),this._renderAllGeometry(r),this._ensureBindParametersCamera(s,i),e.camera.setGLViewport(this._rctx)})),this._shadowAccumulator=new ae(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(L.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new K(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._nodes=new F(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new x,this._plugins.add(this.renderPassManager),this._plugins.add(this._viewshed),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),_),l((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),p),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):P;A(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),_),l((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=H}),_)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._offscreen.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=a(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),k.prune()}get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=te(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(re.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(re.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(L.Highlight,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL,ie.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(re.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(re.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(re.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._viewshed.viewshedShadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");d(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this._stage.view.resourceController)});return this._handles.push(l((()=>r.updating),(()=>this._requestRender()),u)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;const a=$(e);let n=!1;a.forEach(((r,s)=>{if(t.done)return;let i=this._plugins.getMaterialRenderer(s);if(null==i&&r.adds.length>0){const e=new pe({material:s});e.initializeRenderContext(this._plugins._context),i=e,this._plugins.add(i)}i&&(i.modify(r),0===i.numGeometries&&(n=!0)),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),n&&this._plugins.removeEmptyMaterialRenderers(),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(L.Color,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),has.water=this._plugins.produces(L.Normal,ie.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ee.Default,s=G.ON){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frameStart(),this._disposeBindBuffers();const i=this._offscreen,{camera:a,contentCamera:n,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=de.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainColor=this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._viewshed.enabled;const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),p=S(this._sliceHelper.plane);s===G.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const u=i.initializeFrame(a,this._backgroundColor,r);this.hasReflections?this._bindParameters.ssr.lastFrameColor=u:u?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===G.ON;const c=this._plugins.produces(L.Color,ie.OPAQUE_TERRAIN)&&(this._terrainTransparency===O.Semitransparent||this._terrainTransparency===O.TransparentWithDraped),m=this._highQualityTransparency&&c,f=this._plugins.produces(L.Color,...Ie);this._prepareShaders(m,f),this.performanceInfo.advance(fe.PREPARE);const g=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,g),this._ensureBindParametersCamera(a,n);let T=this._renderNormals();if(this._pluginInput.set("normals",T),T){let e=null;this._needsDepth&&(e=T.getAttachment(Te),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(e),T=null}else this._renderAllGeometryDepth();this._renderShadowAccumulation(g,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=L.Color,i.bindFbo(),this._bindParameters.mainColor=i.colorTexture,this._bindParameters.mainDepth=i.depthTexture;const b=this.plugins.produces(L.Color,...we);b&&this._renderOpaqueGeometry(),this._offscreen.updateColor((e=>this._renderNodes(C.OPAQUE,e,b))),this.fboCache.debugCallback?.("opaque-color",this._offscreen.color.fbo),this._renderPlugins(ie.OPAQUE_ENVIRONMENT,fe.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(m),this._setMultipassTerrain(m),this._renderEdges(_e.OPAQUE),i.bindFbo(),this._renderPlugins(ie.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(Pe.Geometry):this._renderTransparentMaterial()),this._offscreen.updateColor((e=>this._renderNodes(C.TRANSPARENT,e,f))),this.fboCache.debugCallback?.("transparent-color",this._offscreen.color.fbo),this._renderMultipassGeometryDepth(m),this._renderHUDVisibility(),m||this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS);const E=r===ee.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const A=c?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(v.Occluded):i.compositeToHUDVisibility(this._bindParameters,A.getTexture()),this._renderHUD(v.Occluded,i.color))),this._setTerrainCulling(!1),A&&(i.compositeToFramebuffer(this._bindParameters,A.getTexture(),ue.PremultipliedAlpha,1),A.release(),m&&(this._renderEdges(_e.OPAQUE),f&&(this._oitEnabled?this._renderOITPass(Pe.Geometry):this._renderTransparentMaterial(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(v.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),this._renderViewshed(),this._renderLaserlines(),this._renderOccluded(),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._offscreen.updateColor((e=>this._renderNodes(C.COMPOSITE,e)));const R=this._nodes.produces("aa-color"),P=!(r!==ee.Default||_||l&&s===G.ON&&r===ee.Default),I=this._pluginInput.get("composite-color"),N=P?M:this.fboCache.acquire(I.fbo.width,I.fbo.height,"aa-color"),y=R?this._renderNodes(w.ANTIALIASING,N):this._blitToDefault(I,N,!1);this._pluginInput.set(w.ANTIALIASING,y),this._renderHUD(v.NotOccluded,y);const D=this._renderNodes(w.HIGHLIGHTS,y);let x=this._renderNodes(w.MAGNIFIER,D);return l&&s===G.ON&&r===ee.Default&&!_&&(x=this._blitToDefault(x)),_?(x.attachDepth(i.depth),this._blitToDefault(this._renderNodes(C.FINAL,x)),x.detachDepth()):this._pluginInput.set(C.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=p,this._isRendering=!1,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ee.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:E}}_prepareShaders(e,t){this._renderContext.output=L.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ie.LINE_CALLOUTS),t&&this._prepareTransparencySlots(),this._plugins.prepare(ie.VIEWSHED,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT,ie.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oid");return t.acquireDepth(N.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(t.fbo),this.fboCache.rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(L.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(t.fbo),this.fboCache.rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=v.NotOccluded,this._plugins.render(this._pluginInput,ie.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(fe.OBJECT_AND_LAYER_ID_COLOR),t}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===B.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0,s=t?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){if(!this._bindParameters.mainDepth)return;const{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"linear-depth");this._rctx.bindFramebuffer(i.fbo),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,this._bindParameters.mainDepth),i.fbo?.readPixels(e[0],e[1],e[2],e[3],be.RGBA,Ee.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,be.RGBA,Ee.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const{width:r,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(r,s,"edges"),n=()=>t.render(this._bindParameters,e),h=this._bindParameters.multipassGeometry.depth;this._offscreen.renderToTargets(n,a,h??i,Ce),this._offscreen.compositeToFramebuffer(this._bindParameters,a.getTexture(),ue.Alpha,1),a.release(),this.performanceInfo.advance(e===_e.OPAQUE?fe.OPAQUE_EDGES:fe.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(re.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(L.ShadowHighlight,this._shadowMap),s.moveSnapshot(he.Highlight),this._renderShadowCascades(L.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(he.ExcludeHighlight),this._renderShadowCascades(L.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(L.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(fe.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this._renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(L.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=h(this._bindParameters.depth));const{width:t,height:r}=this._offscreen,s=this.fboCache.acquire(t,r,"depth");s.attachDepth(e),e.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(L.Depth),h(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=h(this._bindParameters.depth));const{width:e,height:t}=this._offscreen,r=this.fboCache.acquire(e,t,"depth").acquireDepth(N.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(L.Depth),h(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(fe.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=L.Depth;const{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"terrain depth").acquireDepth(N.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,{width:r,height:s}=this._offscreen,i=this.fboCache.acquire(r,s,"geometry depth").acquireDepth(N.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(L.Depth),this._renderContext.output=t,h(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=i.obtainDepthTexture(),i.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const t=Y(e,this._plugins.plugins,this._stage.layers);return X(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(L.Normal)),[0,0,0,0],y.RGBA,N.DEPTH_STENCIL_TEXTURE),s=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color");return r.retain(t+s-1),this.performanceInfo.advance(fe.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();const t=this._nodes.render("ssao",this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.OPAQUE_NO_SSAO_DEPTH,ie.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...we,ie.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...we)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ie.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ie.TRANSPARENT_TERRAIN);if(e!==L.Color)return void t();const{width:r,height:s,depth:i}=this._offscreen,a=this.fboCache.acquire(r,s,"transparent terrain");return this._offscreen.renderToTargets(t,a,i,[0,0,0,0]),a}_renderHUDVisibility(){this._plugins.produces(this._renderContext.output,ie.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._plugins.render(this._pluginInput,ie.OCCLUSION_PIXELS)),this._bindParameters.multipassGeometry.depth),this._offscreen.bindFbo(),this.performanceInfo.advance(fe.HUD_VISIBILITY)):this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===v.Occluded){const e=()=>this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS),{width:t,height:r,color:s}=this._offscreen,i=this.fboCache.acquireDepth(N.DEPTH16_BUFFER,t,r,"line callouts");this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS)}_renderLaserlines(){const e=this._plugins.produces(this._renderContext.output,ie.LASERLINES_CONTRAST_CONTROL);if(this._plugins.produces(this._renderContext.output,ie.LASERLINES)||e){if(this._plugins.render(this._pluginInput,ie.LASERLINES),e){const e=this._offscreen,{width:t,height:r,depth:s}=e,i=this.fboCache.acquire(t,r,"laser lines"),a=()=>this._plugins.render(this._pluginInput,ie.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Ce),e.compositeToFramebuffer(this._bindParameters,i.getTexture(),ue.PremultipliedAlpha,1),i.release()}this.performanceInfo.advance(fe.LASER_LINES)}}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(Pe.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),ue.PremultipliedAlpha),r.release()}else if(e===v.Occluded){this._renderContext.output=L.Color;const t=()=>this._renderHUDElements(e),{width:r,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(N.DEPTH16_BUFFER,r,s,"hud");this._offscreen.renderToTargets(t,i,a,void 0,!0,!0),a.release()}else this._renderContext.output=L.Color,t.acquireDepth(N.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===v.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(L.ShadowHighlight,ie.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const e=()=>{this._renderAllGeometry(L.Highlight),this._rctx.clear(Ae.DEPTH_BUFFER_BIT),this._renderHUDElements(v.Both)},t=this._offscreen.renderToCachedFBO(null,"highlights",e,[0,0,0,0],y.RGBA4,N.DEPTH_STENCIL_TEXTURE);return t.detachDepth(),t}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(fe.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(){this._renderContext.output=L.Color,this._bindParameters.transparencyPassType=de.ColorAlpha,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=de.FrontFace,this._plugins.prepare(...Ie),this._bindParameters.transparencyPassType=de.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t=v.Both){const r=e===Pe.HUD,s=r?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oit hud composite"):null,i=r?()=>this._renderHUDElements(t):()=>this._renderTransparentMaterial(),a=this._renderContext.output;return this._renderContext.output=L.Color,this._offscreen.renderOIT(this._bindParameters,i,s),this._renderContext.output=a,s}_renderOccluded(){let e=0;Oe.clear(),this._plugins.plugins.forAll((t=>{if(!t.materialReference)return;t.queryRenderOccludedState(z.OccludeAndTransparentStencil)&&(e|=z.OccludeAndTransparentStencil,Oe.push(t))}));const t=this._offscreen,r=(r,s,i,a,n)=>{if(!(e&s))return;const{width:h,height:o,depth:d}=t,l=this.fboCache.acquire(h,o,"tmp color");t.renderToTargets(i,l,d,[0,0,0,0],a,n),t.compositeToFramebuffer(this._bindParameters,l.getTexture(),ue.PremultipliedAlpha,r),l.release()},s=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(U(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==Oe.length&&(s(ie.OCCLUDER_MATERIAL,Oe),r(.5,z.OccludeAndTransparentStencil,(()=>s(ie.TRANSPARENT_OCCLUDER_MATERIAL,Oe)),!1,!1));const i=Oe.length>0;Oe.clear(),this._plugins.plugins.forAll((t=>{if(!t.materialReference)return;const r=t.queryRenderOccludedState(z.OccludeAndTransparent),s=t.queryRenderOccludedState(z.Transparent),i=t.queryRenderOccludedState(z.Opaque);(r||s||i)&&(e|=r?z.OccludeAndTransparent:s?z.Transparent:z.Opaque,Oe.push(t))}));const a=this._plugins.renderOccludedFlags;if(e|=a,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,a>z.Occlude&&this._plugins.render(this._pluginInput,ie.OCCLUDED_TERRAIN),s(ie.OPAQUE_MATERIAL,Oe),s(ie.TRANSPARENT_MATERIAL,Oe),s(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Oe),this._renderContext.renderOccludedMask=Z};this._renderContext.output=L.Color,r(.5,z.OccludeAndTransparent,(()=>n(z.OccludeAndTransparent)),!0,Q.OutlineVisualElementMask),r(.5,z.Transparent,(()=>n(z.Transparent)),!0,Q.OutlineVisualElementMask),r(1,z.Opaque,(()=>n(z.Opaque)),!0,Q.OutlineVisualElementMask),(i||Oe.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),Oe.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._offscreen.bindFbo(),this._plugins.render(this._pluginInput,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(fe.TRANSPARENT_ENVIRONMENT)}_renderViewshed(){this._plugins.produces(this._renderContext.output,ie.VIEWSHED)&&(this._viewshed.renderHighQuality=this.isFeatureEnabled(re.HighResolutionViewshed),this._plugins.render(this._pluginInput,ie.VIEWSHED),this.performanceInfo.advance(fe.VIEWSHED))}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;t.setName(e),this._pluginInput.set(e,t);const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitToDefault(e,t=M,r=!0){this._blit||(this._blit=new V(this._techniques));const s=this._blit.render(this._rctx,e,t,this._bindParameters,this._requestRender);return this._pluginInput.set(e.name,s),r&&e.release(),s}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(g(ye,this._bindParameters.camera.viewMatrix),g(Ne,this._bindParameters.camera.projectionMatrix),T(De,ye,Ne),T(De,this._renderContext.lastFrameCamera.viewMatrix,De),T(De,this._renderContext.lastFrameCamera.projectionMatrix,De),this._reprojectionMatrix=De);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}get test(){}}var Pe,Se;e([m({readOnly:!0})],Re.prototype,"fullResolutionAtmosphere",null),e([m()],Re.prototype,"_edgeView",void 0),e([m()],Re.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Pe||(Pe={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility",e[e.ViewshedShadowMap=4]="ViewshedShadowMap"}(Se||(Se={}));const Ce=[0,0,0,0],we=[ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.OPAQUE_NO_SSAO_DEPTH],Ie=[ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH],Oe=new o,Ne=E(),ye=E(),De=E();function Me(e){return t=>e.immediate.schedule(t)}export{Se as FramebufferId,Re 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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromArray as e,fromValues as t,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as s}from"../../../ViewingMode.js";import{ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as a}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttributeType as l}from"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexNormalPassParameters as n,VertexNormalDrawParameters as c}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{
|
|
5
|
+
import{fromArray as e,fromValues as t,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as s}from"../../../ViewingMode.js";import{ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as a}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttributeType as l}from"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexNormalPassParameters as n,VertexNormalDrawParameters as c}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{alphaCutoff as h}from"../core/shaderLibrary/util/AlphaCutoff.js";import{ReloadableShaderModule as u}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as m}from"../core/shaderTechnique/ShaderTechnique.js";import{CullFaceOptions as p,DepthTestFunction as d,AlphaDiscardMode as f}from"../lib/basicInterfaces.js";import{Default3D as b}from"../lib/DefaultVertexAttributeLocations.js";import{RenderOccludedFlag as g}from"../lib/Material.js";import{blendingDefault as y,oitBlending as x,oitDepthTest as T,oitDrawBuffers as j,getOITPolygonOffset as P}from"../lib/OrderIndependentTransparency.js";import{Program as S}from"../lib/Program.js";import{stencilWriteMaskOn as O,stencilToolMaskBaseParams as v,stencilBaseAllZerosParams as C}from"../lib/StencilUtils.js";import{TransparencyPassType as L}from"../lib/TransparencyPassType.js";import{defaultAdvancedMRRFactors as M}from"../materials/pbrUtils.js";import{D as w}from"../../../../chunks/DefaultMaterial.glsl.js";import{SpecialDrawBuffers as A,CompareFunction as D}from"../../../webgl/enums.js";import{makePipelineState as N,cullingParams as F,defaultDepthWriteParams as _,defaultColorWriteParams as k}from"../../../webgl/renderState.js";class q extends n{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=e(M),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=p.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveFactor=t(0,0,0),this.instancedDoublePrecision=!1,this.normalType=a.Attribute,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.externalColor=r(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=i(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.transparent=!1,this.writeDepth=!0,this.customDepthTest=d.Less,this.textureAlphaMode=f.Blend,this.textureAlphaCutoff=h,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=g.Occlude,this.isDecoration=!1}}class z extends c{constructor(){super(...arguments),this.origin=i(),this.slicePlaneLocalOrigin=this.origin}}class E extends m{initializeConfiguration(e,t){t.spherical=e.viewingMode===s.Global,t.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result,t.textureCoordinateType=t.hasColorTexture||t.hasMetallicRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture||t.hasNormalTexture?l.Default:l.None,t.objectAndLayerIdColorInstanced=t.instanced}initializeProgram(e){return this._initializeProgram(e,E.shader)}_initializeProgram(e,t){return new S(e.rctx,t.get().build(this.configuration),b)}_makePipeline(e,t){const i=this.configuration,r=e===L.NONE,s=e===L.FrontFace;return N({blending:i.output===o.Color&&i.transparent?r?y:x(e):null,culling:R(i)?F(i.cullFace):null,depthTest:{func:T(e,I(i.customDepthTest))},depthWrite:(r||s)&&i.writeDepth?_:null,drawBuffers:i.output===o.Depth?{buffers:[A.NONE]}:j(e),colorWrite:k,stencilWrite:i.hasOccludees?O:null,stencilTest:i.hasOccludees?t?v:C:null,polygonOffset:r||s?null:P(i.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._makePipeline(this.configuration.transparencyPassType,!0),this._makePipeline(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}function I(e){return e===d.Lequal?D.LEQUAL:D.LESS}function R(e){return e.cullFace!==p.None||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}E.shader=new u(w,(()=>import("./DefaultMaterial.glsl.js")));export{z as DefaultMaterialDrawParameters,q as DefaultMaterialPassParameters,E as DefaultMaterialTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";export{O as OITCompositingPassParameters,b as build}from"../../../../chunks/OITCompositing.glsl.js";
|
|
5
|
+
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";export{O as OITCompositingPassParameters,b as build}from"../../../../chunks/OITCompositing.glsl.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import o from"../../Color.js";const r=new o([0,255,255]),e=1,n=.25,t=new o([0,0,0]),m=.4,p=.2;export{r as defaultColor,n as defaultFillOpacity,e as defaultHaloOpacity,t as defaultShadowColor,p as defaultShadowDifference,m as defaultShadowOpacity};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../Color.js";import t from"../../core/Accessor.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{defaultColor as p,defaultHaloOpacity as l,defaultFillOpacity as c}from"./HighlightDefaults.js";let e=class extends t{constructor(){super(...arguments),this.color=p.clone(),this.haloOpacity=l,this.fillOpacity=c}equals(o){return this.color.equals(o.color)&&(this.haloColor||this.color).equals(o.haloColor||o.color)&&this.haloOpacity===o.haloOpacity&&this.fillOpacity===o.fillOpacity}};o([s({type:r})],e.prototype,"color",void 0),o([s({type:r})],e.prototype,"haloColor",void 0),o([s()],e.prototype,"haloOpacity",void 0),o([s()],e.prototype,"fillOpacity",void 0),e=o([i("esri.views.support.HighlightOptions")],e);const a=e;export{a as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import s from"../../Widget.js";import{LayerTreeNode as o}from"../support/LayerTreeNode.js";import{loadCalciteComponents as l}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{tsx as r}from"../../support/jsxFactory.js";var c;const n={expand:"expand",collapse:"collapse",hideSublayer:"hideSublayer",showSublayer:"showSublayer"},a="esri-building-disciplines-tree-node",p={base:a,label:`${a}__label`,level:e=>`${a}--level-${e}`};let d=c=class extends s{constructor(e){super(e),this.messages=n,this.toggleSiblingsVisibility=!1,this._toggledAll=!1,this._onCheckboxClick=e=>{e.stopPropagation();(e.metaKey||e.ctrlKey)&&this.toggleSiblingsVisibility&&(this.node.toggleAllSiblingsVisibility(),this._toggledAll=!0)},this._onCheckboxToggle=e=>{this._toggledAll?this._toggledAll=!1:this.node.toggleVisibility(e.target.checked)}}loadDependencies(){return l({checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),tree:()=>import("@esri/calcite-components/dist/components/calcite-tree.js"),"tree-item":()=>import("@esri/calcite-components/dist/components/calcite-tree-item.js")})}render(){const{node:e,messages:i}=this;if(e.isDiscipline&&!e.hasChildren)return r("div",{key:`${e.id}-empty`});const t=e.visible,s=!0===t,o=null===t,l=s?i?.hideSublayer:i?.showSublayer;return r("div",{class:p.base,key:e.id},r("calcite-tree-item",null,r("calcite-label",{class:p.label,layout:"inline"},r("calcite-checkbox",{checked:s,indeterminate:o,label:l,onclick:this._onCheckboxClick,title:l,onCalciteCheckboxChange:this._onCheckboxToggle}),e.title),this._renderedChildren))}get _renderedChildren(){const{node:e}=this;if(!e.hasChildren)return null;const{messages:i}=this,{toggleSiblingsVisibility:t}=this;return r("calcite-tree",{slot:"children"},this.node.children.toArray().reverse().map((e=>r(c,{messages:i,node:e,toggleSiblingsVisibility:t}))))}};e([i({type:o})],d.prototype,"node",void 0),e([i()],d.prototype,"messages",void 0),e([i({nonNullable:!0})],d.prototype,"toggleSiblingsVisibility",void 0),e([i()],d.prototype,"_renderedChildren",null),d=c=e([t("esri.widgets.BuildingExplorer.BuildingDisciplinesTree.BuildingDisciplinesNode")],d);const g=d;export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../Widget.js";import r from"./BuildingDisciplinesNode.js";import{loadCalciteComponents as t}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{tsx as p}from"../../support/jsxFactory.js";const l={expand:"expand",collapse:"collapse",hideSublayer:"hideSublayer",showSublayer:"showSublayer"},c={base:"esri-building-disciplines-tree"};let n=class extends o{constructor(e){super(e),this.toggleSiblingsVisibility=!1}loadDependencies(){return t({tree:()=>import("@esri/calcite-components/dist/components/calcite-tree.js")})}render(){const{vm:e}=this,s=this.toggleSiblingsVisibility,i=this.messages??l;return p("div",{class:c.base},p("calcite-tree",{scale:"s",selectionMode:"none"},e.root.children.toArray().reverse().map((e=>p(r,{messages:i,node:e,toggleSiblingsVisibility:s})))))}};e([s()],n.prototype,"vm",void 0),e([s()],n.prototype,"messages",void 0),e([s()],n.prototype,"toggleSiblingsVisibility",void 0),n=e([i("esri.widgets.BuildingExplorer.BuildingDisciplinesTree.BuildingDisciplinesTree")],n);const a=n;export{a as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import t from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import{isAbortError as o}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{findFullModelSublayer as l}from"./support/buildingLayerUtils.js";import{LayerTreeNode as d}from"./support/LayerTreeNode.js";import{createLoadLayersFunction as n}from"./support/layerUtils.js";let p=class extends s{constructor(e){super(e),this.root=new d,this.state="disabled",this._loadLayers=n(),this.layers=new t}initialize(){this.addHandles(this.layers.on("change",(()=>this._onLayersChange()))),this._onLayersChange()}destroy(){this._set("state","disabled"),this.root.destroy()}set layers(e){const s=this._get("layers");this._set("layers",r(e,s))}_updateLayerTree(){this.root.destroy(),this._set("root",new d
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import t from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import{isAbortError as o}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{findFullModelSublayer as l}from"./support/buildingLayerUtils.js";import{LayerTreeNode as d}from"./support/LayerTreeNode.js";import{createLoadLayersFunction as n}from"./support/layerUtils.js";let p=class extends s{constructor(e){super(e),this.root=new d,this.state="disabled",this._loadLayers=n(),this.layers=new t}initialize(){this.addHandles(this.layers.on("change",(()=>this._onLayersChange()))),this._onLayersChange()}destroy(){this._set("state","disabled"),this.root.destroy()}set layers(e){const s=this._get("layers");this._set("layers",r(e,s))}_updateLayerTree(){this.root.destroy(),this._set("root",new d);const e=new Map,s=this.layers.length>1?"modelName":"id";return this.layers.forEach((t=>{const r=l(t);this._addNodesForSublayers(r??t,this.root,e,s)})),this}_addNodeForLayer(e,s,t,r){const o=String(e[r]).toLowerCase();if(null==o||e.isEmpty)return;const i=`${s.id}/${o}`;let a=t.get(i);a||(a=new d({id:o,level:s.level+1}),t.set(i,a)),a.layers.push(e),s.children.push(a),this._addNodesForSublayers(e,a,t,r)}_addNodesForSublayers(e,s,t,r){("building-scene"===e.type||"building-group"===e.type&&!e.isEmpty)&&e.sublayers.forEach((e=>this._addNodeForLayer(e,s,t,r)))}async _onLayersChange(){if(this._set("state","loading"),0!==this.layers.length)try{await this._loadLayers(this.layers),this._updateLayerTree(),this._set("state","ready")}catch(e){o(e)||this._set("state","failed")}}};e([i({readOnly:!0})],p.prototype,"root",void 0),e([i({type:t,nonNullable:!0})],p.prototype,"layers",null),e([i({readOnly:!0,nonNullable:!0})],p.prototype,"state",void 0),p=e([a("esri.widgets.BuildingExplorer.BuildingDisciplinesViewModel")],p);const y=p;export{y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{on as t}from"../../../core/events.js";import{clamp as s}from"../../../core/mathUtils.js";import{watch as i,initial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../Widget.js";import{l as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{on as t}from"../../../core/events.js";import{clamp as s}from"../../../core/mathUtils.js";import{watch as i,initial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../Widget.js";import{l as a,a as h,b as v,c as d,d as _,e as c,f as p,g,h as u,i as m,j as L}from"../../../chunks/constants.js";import{css as y}from"./css.js";import{Label as P}from"./Label.js";import{LevelItem as C}from"./LevelItem.js";import{loadCalciteComponents as f}from"../../support/componentsUtils.js";import{globalCss as w}from"../../support/globalCss.js";import"../../support/widgetUtils.js";import{tsx as x}from"../../support/jsxFactory.js";const b={selectLevel:"selectLevel",clearLevel:"clearLevel",nextLevel:"nextLevel",previousLevel:"previousLevel",currentLevel:"{{value}}"};let W=class extends r{constructor(e,t){super(e,t),this._levelHandlesKey="levelHandles",this._levelEventHandlesKey="levelEventHandles",this._levelWidgets=[],this._labelWidget=new P({onClear:()=>this.vm.clear()}),this._hoveredLevel=null,this._expandedLevelsHeight=void 0,this._normalizedPointerPosition=0,this._hovering=!1,this._containerPosTop=null,this._levelsContainer=null,this._onKeyDown=e=>{switch(e.key){case"ArrowDown":case"ArrowLeft":e.preventDefault(),e.stopPropagation(),this.vm.previous(),this._focusCurrentLevel();break;case"ArrowUp":case"ArrowRight":e.preventDefault(),e.stopPropagation(),this.vm.next(),this._focusCurrentLevel()}},this._onFocus=()=>{this._hoveredLevel=this._levels.length>0?this._levels[0]:null},this._onArrowUpClick=()=>{this.vm.next()},this._onArrowDownClick=()=>{this.vm.previous()},this._onPointerUp=()=>{if(window.getSelection()?.removeAllRanges(),null==this._hoveredLevel)return;const{vm:e}=this;e.enabled&&this._hoveredLevel===e.value?e.clear():e.select(this._hoveredLevel)},this._onPointerEnter=()=>{this._hovering||null==this._levelsContainer||(this._hovering=!0,this._containerPosTop=this._levelsContainer.getBoundingClientRect().top??0)},this._onPointerLeave=()=>{this._hovering&&(this._normalizedPointerPosition=0,this._hoveredLevel=null,this._hovering=!1)},this._onPointerMove=e=>{if(!this._hovering)return!1;if(window.getSelection()?.removeAllRanges(),null!=this._containerPosTop){const t=this._containerPosTop,s=_*L,i=this._expandedLevelsMargin;let l=this._levelsHeight,o=t+s+i;const n=this._levelHeight/2;o+=n,l-=n;let r=(e.clientY-o)/l;r+=g,this._normalizedPointerPosition=r}return!1}}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js")})}postInitialize(){this.addHandles([i((()=>this._levelsContainer),(()=>this._onContainerChange()),l),i((()=>this._levels),(()=>this._createLevelWidgets()),l),i((()=>this.messages),(()=>{this._labelWidget.messages=this.messages??b}),l)])}destroy(){this._levelWidgets.forEach((e=>e.destroy())),this._labelWidget.destroy()}get _levels(){return this.vm.allowedValues}get _numLevels(){return this._levels.length}get _levelsHeight(){return Math.round(this._levelHeight*this._numLevels)}get _expandedLevelsMargin(){return Math.round(((this._expandedLevelsHeight??0)-this._levelsHeight)/2)}get _levelWidth(){const{levelWidthNominator:e,levelWidthConstant:t}=u,i=e/Math.sqrt(this._numLevels)+t;return Math.round(s(i,h,a))}get _levelHeight(){const e=m,t=2*e/Math.sqrt(this._numLevels);return Math.round(s(t,2,e))}get _gaussianFactor(){const e=this._numLevels;return e/Math.log(v*e)*d}get _levelClosestToPointer(){if(!this._hovering)return null;const e=this._numLevels-1,t=this._normalizedPointerPosition;return e>=0&&null!=t?this._levels[Math.round((1-t)*e)]:null}render(){const e=this._levelWidgets.length,t=e>1?this._levelWidgets.map((e=>e.render())):null,s=_*L,i=-s/L,l=this._levelsHeight,o=l+2*s;return x("div",{class:this.classes(w.widget,y.container,{[y.animateLevel]:!this._hovering,[y.noLevel]:e<2}),key:this,onkeydown:this._onKeyDown},this._renderLabelContainer(),x("div",{afterCreate:e=>this._levelsContainer=e,class:y.levelsContainer,"data-node-ref":"",onfocus:this._onFocus,styles:{height:`${o}px`,marginBlockStart:`${i}px`,marginBlockEnd:`${i}px`}},x("div",{class:y.innerLevelsContainer,styles:{height:`${l}px`,margin:"0",marginBlockStart:_-this._expandedLevelsMargin+"px"}},t)))}_renderLabelContainer(){const{hasPrevious:e,hasNext:t}=this.vm,s=this.messages??b,i=s.previousLevel,l=s.nextLevel;return x("div",{class:y.labelContainer,tabIndex:0},H({className:y.arrowUp,disabled:!t,icon:"chevron-up",onClick:this._onArrowUpClick,text:l}),this._labelWidget.render(),H({className:y.arrowDown,disabled:!e,icon:"chevron-down",onClick:this._onArrowDownClick,text:i}))}_updateComponents(){const e=this.messages??b,t=this.vm.enabled?this.vm.value:null,s=null!=this._hoveredLevel?this._hoveredLevel:t;this._levelWidgets.forEach((s=>{const i=this.vm.getValueLabel(s.level);s.label=null!=i?i:e.currentLevel?.replace("{{level}}",String(s.level)),s.active=s.level===t,s.hovering=s.level===this._hoveredLevel})),this._labelWidget.level=s,this._labelWidget.active=s===t,this._labelWidget.hovering=null!=this._hoveredLevel}_createLevelWidgets(){this._levelWidgets.forEach((e=>e.destroy())),this._levelWidgets=this._levels.map((e=>new C({level:e,onSelect:()=>this._onLevelToggle(e)}))),this.removeHandles(this._levelHandlesKey),this.addHandles([i((()=>{const{vm:e}=this;return[this.messages,e?.value,e?.enabled,this._hoveredLevel,this._hovering]}),(()=>this._updateComponents()),l),i((()=>[this._normalizedPointerPosition,this._hovering]),(()=>this._onPointerPositionChange()),l),i((()=>this._levelWidth),(e=>this._levelWidgets.forEach((t=>t.width=e))),l)],this._levelHandlesKey)}_onContainerChange(){const e=this._levelsContainer;null!=e&&(this.removeHandles(this._levelEventHandlesKey),this.addHandles([t(e,"pointerenter",this._onPointerEnter),t(e,"pointerover",this._onPointerEnter),t(e,"pointerleave",this._onPointerLeave),t(e,"pointerup",this._onPointerUp),t(e,"pointermove",this._onPointerMove)],this._levelEventHandlesKey))}_focusCurrentLevel(){const e=this._levelWidgets.find((e=>e.level===this.vm.value));e?.focus()}_onLevelToggle(e){const{vm:t}=this;t.enabled&&t.value===e?t.clear():t.select(e)}_onPointerPositionChange(){let e=0;this._levelWidgets.forEach(((t,s)=>{const{width:i,height:l}=this._getLevelWidgetSize(s);t.height=l,t.width=i,e+=l})),this._hoveredLevel=this._levelClosestToPointer;const t=this._expandedLevelsHeight;(null==t||Math.abs(t-e)>30)&&(this._expandedLevelsHeight=e)}_getLevelWidgetSize(e){const t={width:this._levelWidth,height:this._levelHeight};if(this._hovering){const s=this._getGaussianFactor(e,this._normalizedPointerPosition);t.width+=c*s,t.height+=p*s}return t}_getGaussianFactor(e,t){const s=this._numLevels-1,i=(s-e)/s,l=this._gaussianFactor*(i-t);return Math.exp(-(l**2))}};function H(e){return x("calcite-action",{appearance:"transparent",class:e.className,disabled:e.disabled,icon:e.icon,key:e.className,onclick:e.onClick,scale:"s",text:e.text,textEnabled:!1,title:e.text})}e([o()],W.prototype,"vm",void 0),e([o()],W.prototype,"messages",void 0),e([o()],W.prototype,"_levelWidgets",void 0),e([o()],W.prototype,"_labelWidget",void 0),e([o()],W.prototype,"_hoveredLevel",void 0),e([o()],W.prototype,"_levels",null),e([o()],W.prototype,"_numLevels",null),e([o({readOnly:!0})],W.prototype,"_levelsHeight",null),e([o()],W.prototype,"_expandedLevelsHeight",void 0),e([o({readOnly:!0})],W.prototype,"_expandedLevelsMargin",null),e([o({readOnly:!0})],W.prototype,"_levelWidth",null),e([o({readOnly:!0})],W.prototype,"_levelHeight",null),e([o({readOnly:!0})],W.prototype,"_gaussianFactor",null),e([o({readOnly:!0})],W.prototype,"_levelClosestToPointer",null),e([o({type:Number,range:{min:0,max:1}})],W.prototype,"_normalizedPointerPosition",void 0),e([o()],W.prototype,"_hovering",void 0),e([o()],W.prototype,"_containerPosTop",void 0),e([o()],W.prototype,"_levelsContainer",void 0),W=e([n("esri.widgets.BuildingExplorer.BuildingLevelPicker.BuildingLevelPicker")],W);const j=W;export{j as default};
|