@arcgis/core 4.31.0-next.20240619 → 4.31.0-next.20240621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3a74d3fc690177a703f5.js → 019ce38b02e3bf517125.js} +1 -1
- package/assets/esri/core/workers/chunks/{222807cfaa2e17d0efea.js → 6745cedf6f82c8917904.js} +1 -1
- package/assets/esri/core/workers/chunks/7b6cd976367a0dd297d6.js +1 -0
- package/assets/esri/core/workers/chunks/{d7c0728bdd9a7fd1d701.js → 9d677af08238d9e09e72.js} +36 -25
- package/assets/esri/core/workers/chunks/bedf60888f07b78b314d.js +1 -0
- package/assets/esri/core/workers/chunks/c39237c00c1d588dc107.js +1 -0
- package/assets/esri/core/workers/chunks/cf1530abe2842f3d8eb0.js +1 -0
- package/assets/esri/core/workers/chunks/de7fa31d86a65ccdffc1.js +1 -0
- package/assets/esri/core/workers/chunks/{8ee8f3c54b2cce217845.js → f13fb6b712e364bbf48c.js} +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ar.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bg.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bs.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ca.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_cs.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_da.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_de.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_el.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_es.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_et.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fi.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_he.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hu.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_id.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_it.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ja.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ko.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lt.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lv.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nb.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-BR.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-PT.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ro.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ru.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sk.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sv.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_th.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_tr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_uk.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_vi.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-CN.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-HK.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-TW.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nb.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
- package/chunks/CheckerBoard.glsl.js +9 -6
- package/chunks/ComponentShader.glsl.js +23 -23
- package/chunks/HUDMaterial.glsl.js +29 -33
- package/chunks/HighlightApply.glsl.js +150 -23
- package/chunks/HighlightDownsample.glsl.js +25 -12
- package/chunks/ImageMaterial.glsl.js +1 -2
- package/chunks/LineMarker.glsl.js +30 -30
- package/chunks/RibbonLine.glsl.js +42 -42
- package/chunks/ShadowHighlight.glsl.js +15 -6
- package/chunks/Terrain.glsl.js +6 -3
- package/interfaces.d.ts +50 -14
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/support/ExportStrategy.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/Highlights.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/support/HighlightOptions.js +1 -1
- package/views/3d/support/HighlightOptionsBase.js +5 -0
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +1 -2
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +18 -7
- package/views/3d/webgl-engine/core/shaderModules/Integer2PassUniform.js +5 -0
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightPassParameters.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/interfaces.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/util.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/support/HighlightDefaults.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/constants.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/24484bd0185ea0f79760.js +0 -1
- package/assets/esri/core/workers/chunks/4f2be9fd4ff5b3ad3110.js +0 -1
- package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +0 -1
- package/assets/esri/core/workers/chunks/986520dd0de64105dbff.js +0 -1
- package/assets/esri/core/workers/chunks/ad0a87dba95785ad6171.js +0 -1
- package/chunks/HighlightBlur.glsl.js +0 -25
- package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.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{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};
|
|
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 c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as d,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 f,parameterBlock as b,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 d;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(c,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{components:o,renderable:s}=r,{geometry:a}=s,i=s.meta.cameraDepthSquared,{geometryRanges:l,highlightRanges:n,defaultShadowMapRanges:u}=o;switch(this._computeWhichMaterialPass()){case F.Opaque:e.materialOpaque.submitDraw(this,a,l,i);break;case F.Transparent:e.materialTransparent.submitDraw(this,a,l,i);break;case F.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,a,l,i),e.materialTransparent.submitDraw(this,a,l,i);break;case F.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,a,l,i),k(t)&&e.highlightIntegratedMesh.submitDraw(this,a,l,i)}const h=this.componentParameters.castShadows!==I.None;if(h&&e.shadowMap.submitDraw(this,a,l,i),null!=n)for(const p of n)e.highlight.submitDraw(this,a,p[1],i,p[0]),h&&e.highlightShadowMap.submitDraw(this,a,p[1],i,p[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,a,l,i),h&&null!=u&&e.defaultShadowMap.submitDraw(this,a,u,i)}_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([f({vectorOps:n})],R.prototype,"baseColor",void 0),e([f()],R.prototype,"usePBR",void 0),e([f()],R.prototype,"hasParametersFromSource",void 0),e([f({vectorOps:a})],R.prototype,"mrrFactors",void 0),e([f({vectorOps:a})],R.prototype,"emissiveFactor",void 0),e([f({dispose:!0})],R.prototype,"baseColorTexture",void 0),e([f({dispose:!0})],R.prototype,"metallicRoughnessTexture",void 0),e([f({dispose:!0})],R.prototype,"emissionTexture",void 0),e([f({dispose:!0})],R.prototype,"occlusionTexture",void 0),e([f({dispose:!0})],R.prototype,"normalTexture",void 0),e([f()],R.prototype,"objectOpacity",void 0),e([b()],R.prototype,"commonMaterialParameters",void 0),e([b()],R.prototype,"componentParameters",void 0),e([f()],R.prototype,"textureAlphaCutoff",void 0),e([f()],R.prototype,"alphaDiscardMode",void 0),e([f()],R.prototype,"isIntegratedMesh",void 0),e([f()],R.prototype,"polygonOffsetEnabled",void 0),e([f()],R.prototype,"ellipsoidMode",void 0),e([f()],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([f()],E.prototype,"doubleSided",void 0),e([f()],E.prototype,"cullFace",void 0),e([f()],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([f({vectorOps:n})],W.prototype,"externalColor",void 0),e([f()],W.prototype,"externalColorMixMode",void 0),e([f()],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([f()],_.prototype,"texture",void 0),e([f()],_.prototype,"transparent",void 0),e([f()],_.prototype,"opaqueOverride",void 0),e([f()],_.prototype,"castShadows",void 0);export{E as CommonMaterialParameters,R as ComponentMaterial,I as ComponentParameterSummary,W as ComponentParametersUniform,_ as ComponentParametersVarying};
|
|
@@ -25,7 +25,6 @@ return vec2(coordX, coordY) + 0.5;
|
|
|
25
25
|
${s?l`
|
|
26
26
|
void forwardObjectAndLayerIdColor() {
|
|
27
27
|
vec2 textureCoordinates = getComponentTextureCoordinates(componentIndex, 2.0);
|
|
28
|
-
|
|
29
28
|
vObjectAndLayerIdColor = texelFetch(componentColorTex, ivec2(textureCoordinates), 0);
|
|
30
29
|
}`:l`void forwardObjectAndLayerIdColor() {}`}
|
|
31
30
|
|
|
@@ -66,6 +65,6 @@ return externalColor;
|
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
void outputObjectAndLayerIdColor() {
|
|
69
|
-
${c?l`fragColor = vec4(0,0,0,0);`:""}
|
|
68
|
+
${c?l`fragColor = vec4(0, 0, 0, 0);`:""}
|
|
70
69
|
}
|
|
71
70
|
`)}export{m as ComponentData,s as ComponentDataType,C as encodeElevationOffset,x as maxElevationOffset};
|
|
@@ -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{ColorFormat as e,DepthFormat as t}from"../../webgl/formats.js";import{ManagedColorAttachment as r}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as a}from"../../webgl/ManagedDepthAttachment.js";import c from"../../webgl/ManagedFBO.js";import{AttachmentType as
|
|
5
|
+
import{ColorFormat as e,DepthFormat as t}from"../../webgl/formats.js";import{ManagedColorAttachment as r}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as a}from"../../webgl/ManagedDepthAttachment.js";import c from"../../webgl/ManagedFBO.js";import{AttachmentType as i}from"../../webgl/ManagedFBObject.js";import{FBOPool as h}from"./FBOPool.js";import{PixelFormat as o,SizedPixelFormat as s,TextureWrapMode as n,PixelType as _,TextureSamplingMode as d,RenderbufferFormat as l,ColorAttachment as m}from"../../../webgl/enums.js";import{FramebufferObject as p}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as u}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as w}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as E}from"../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../webgl/TextureDescriptor.js";class f{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new h(e.newCache,"FBOCache"),this._depthCache=new h(e.newCache,"DepthAttachmentCache"),this._colorCache=new h(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback&&this.debugCallback()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===i.FBO&&e(t.name,t.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+("getTexture"in t?t.getTexture()?.usedMemory??0:t.usedMemory)),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(r,a,i,h=e.RGBA){const o=b(h,r,a);let s=this._cache.pop(o);if(s){s.retain(),s.setName(i);const e=this.rctx.getBoundFramebufferObject();this.rctx.bindFramebuffer(s.fbo),this.rctx.setDrawBuffers([m.COLOR_ATTACHMENT0]),this.rctx.bindFramebuffer(e)}else s=new c(o,i,new p(this.rctx,{...O[h],width:r,height:a}),(e=>{e??=t.DEPTH_STENCIL_TEXTURE;const r=this._acquireDepth(e,s.fbo.width,s.fbo.height,`${s.name} depth`);return s.attachDepth(r),r.release(),s}),((t,c)=>{c??=e.RGBA;const i=this._acquireColor(c,r,a,`${s.name} color ${t}`);return s.attachColor(i,t),i.release(),s}),(()=>{this.debugCallback&&this.debugCallback(s.name,s.fbo),this._acquired.delete(s),s.detachAll(),this._cache.put(s)}));return this._trackHandle(s)}acquireDepth(e,t,r,a){return this._acquireDepth(e,t,r,a)}_acquireDepth(e,r,c,i){const h=b(e,r,c),o=this._depthCache.pop(h);if(o)return o.retain(),o.name=i,this._trackHandle(o);const s=e===t.DEPTH_STENCIL_TEXTURE?new a(h,new E(this.rctx,{...N[e],width:r,height:c}),(()=>{this._acquired.delete(s),this._depthCache.put(s)})):new a(h,new u(this.rctx,{...N[e],width:r,height:c}),(()=>{this._acquired.delete(s),this._depthCache.put(s)}));return s.name=i,this._trackHandle(s)}_acquireColor(e,t,a,c){const i=b(e,t,a),h=this._colorCache.pop(i);if(h)return h.retain(),h.name=c,this._trackHandle(h);const o=new r(i,new E(this.rctx,{...O[e],width:t,height:a}),(()=>{this._acquired.delete(o),this._colorCache.put(o)}));return o.name=c,this._trackHandle(o)}_trackHandle(e){return this._acquired.add(e),e}}const T=new c("default","default",null,(()=>T),(()=>T),(()=>{}));function b(e,t,r){return`${e}x${t}x${r}`}const A=new C;A.pixelFormat=o.RED,A.internalFormat=s.R8,A.wrapMode=n.CLAMP_TO_EDGE;const g=new C;g.pixelFormat=o.RG,g.internalFormat=s.RG8,g.wrapMode=n.CLAMP_TO_EDGE;const M=new C;M.internalFormat=s.RGBA4,M.dataType=_.UNSIGNED_SHORT_4_4_4_4,M.wrapMode=n.CLAMP_TO_EDGE;const R=new C;R.wrapMode=n.CLAMP_TO_EDGE;const F=new C;F.wrapMode=n.CLAMP_TO_EDGE,F.samplingMode=d.LINEAR_MIPMAP_LINEAR,F.hasMipmap=!0,F.maxAnisotropy=8;const D=new C;D.pixelFormat=o.RED,D.dataType=_.HALF_FLOAT,D.internalFormat=s.R16F,D.samplingMode=d.NEAREST;const x=new C;x.dataType=_.HALF_FLOAT,x.internalFormat=s.RGBA16F,x.samplingMode=d.NEAREST;const O={[e.RED]:A,[e.RG]:g,[e.RGBA4]:M,[e.RGBA]:R,[e.RGBA_MIPMAP]:F,[e.R16F]:D,[e.RGBA16F]:x},G=new C;G.pixelFormat=o.DEPTH_STENCIL,G.dataType=_.UNSIGNED_INT_24_8,G.samplingMode=d.NEAREST,G.wrapMode=n.CLAMP_TO_EDGE,G.internalFormat=o.DEPTH24_STENCIL8;const N={[t.DEPTH_STENCIL_TEXTURE]:G,[t.DEPTH16_BUFFER]:new w(l.DEPTH_COMPONENT16,4)};export{f as FBOCache,T as defaultWebGLFBO};
|
|
@@ -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 e from"../../../../../core/PooledArray.js";import{
|
|
5
|
+
import e from"../../../../../core/PooledArray.js";import{RenderPassIdentifier as t}from"./AllRenderPasses.js";import{TransparencyPassType as r}from"../../lib/TransparencyPassType.js";import{DataType as i}from"../../../../webgl/enums.js";var s;!function(e){e[e.FrontToBack=0]="FrontToBack",e[e.BackToFront=1]="BackToFront"}(s||(s={}));class n{constructor(t,r,i=s.FrontToBack){this._rctx=t,this._techniques=r,this._sorting=i,this._draws=new e({initialSize:32,allocator:e=>e||{material:null,geometry:null,geometryRanges:null,bindDrawParams:null,depthSquaredHint:0,indexType:0}}),this._previouslyBoundDraw=new Map}submitDraw(e,t,r,i,s){const n=this._draws.pushNew();n.geometry=t,n.geometryRanges=r,n.material=e,n.depthSquaredHint=i,n.indexType=(t.indexed?t.vao.indexBuffer.indexType:null)??0,n.highlightGroup=s}prepare(e,t){return this._draws.map((r=>r.material.prepareTechnique(this._techniques,e,t,r.geometry.parameters)))}dispatch(e,i,s){const n=this._rctx;this._previouslyBoundDraw.clear();let a=null;const h=this._draws.length;for(let l=0;l<h;l++){const h=this._draws.data[l];if(e.identifier===t.Highlight){const{highlightGroup:e}=h;if(void 0!==e){if((i.highlightGroupMap.get(e)??0)!==i.highlightLevel)continue}}const p=s[l];p===a&&p.configuration.transparencyPassType===r.NONE||(n.bindTechnique(p,i,e),a=p);const{geometryRanges:c,indexType:d,geometry:u,material:g}=h;n.bindVAO(u.vao),this._previouslyBoundDraw.get(p)!==g&&(p.program.bindDraw(g,i,e),this._previouslyBoundDraw.set(p,g));const m=c.length,{primitiveType:y}=u;for(let e=0;e<m;e+=2){const t=c[e],r=c[e+1];if(0!==d){const e=o.get(d);n.drawElements(y,r,d,t*e)}else n.drawArrays(y,t,r)}}}prepareSubmit(){this._draws.clear()}finishSubmit(){const e=this._sorting===s.FrontToBack?1:-1;this._draws.sort(((t,r)=>{const i=e*(t.depthSquaredHint-r.depthSquaredHint);return 0!==i?i:t.geometry.vao.byteSize-r.geometry.vao.byteSize}))}get count(){return this._draws.length}}const o=new Map;o.set(i.UNSIGNED_BYTE,1),o.set(i.UNSIGNED_SHORT,2),o.set(i.UNSIGNED_INT,4);export{n as RenderPass,s as RenderPassSorting};
|
|
@@ -2,11 +2,22 @@
|
|
|
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{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import{IntegerPassUniform as e}from"../../shaderModules/IntegerPassUniform.js";import{glsl as i}from"../../shaderModules/interfaces.js";import{Texture2DPassUniform as t}from"../../shaderModules/Texture2DPassUniform.js";function h(h){h.fragment.uniforms.add(new t("depthTexture",((e,i)=>i.mainDepth))),h.fragment.uniforms.add(new t("highlightTexture",((e,i)=>i.highlightTexture))),h.fragment.uniforms.add(new e("highlightLevel",((e,i)=>i.highlightLevel))),h.fragment.code.add(i`void outputHighlightNet(bool occluded) {
|
|
6
|
+
int ll = highlightLevel & 3;
|
|
7
|
+
int newI = 0;
|
|
8
|
+
newI |= 1 << (ll*2);
|
|
9
|
+
if (occluded) { newI |= 2 << (ll*2); }
|
|
10
|
+
vec4 prevHighlight = texelFetch(highlightTexture, ivec2(gl_FragCoord.xy), 0);
|
|
11
|
+
int li = (highlightLevel >> 2) & 3;
|
|
12
|
+
int prevI = int(prevHighlight[li] * 255.0);
|
|
13
|
+
int cI = newI | prevI;
|
|
14
|
+
float cf = float(cI) / 255.0;
|
|
15
|
+
vec4 combinedHighlight = prevHighlight;
|
|
16
|
+
combinedHighlight[li] = cf;
|
|
17
|
+
fragColor = combinedHighlight;
|
|
11
18
|
}
|
|
12
|
-
|
|
19
|
+
void outputHighlight() {
|
|
20
|
+
float sceneDepth = texelFetch(depthTexture, ivec2(gl_FragCoord.xy), 0).x;
|
|
21
|
+
bool occluded = gl_FragCoord.z > sceneDepth + 5e-5;
|
|
22
|
+
outputHighlightNet(occluded);
|
|
23
|
+
}`)}export{h as OutputHighlight};
|
|
@@ -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{Uniform as r}from"./Uniform.js";import{BindType as s}from"../shaderTechnique/BindType.js";class e extends r{constructor(r,e){super(r,"ivec2",s.Pass,((s,o,i)=>s.setUniform2iv(r,e(o,i))))}}export{e as Integer2PassUniform};
|
|
@@ -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 e from"../../../../core/Accessor.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";const t={required:[]},s={required:[r.Depth]};class n extends e{consumes(){return t}get usedMemory(){return 0}get isDecoration(){return!1}get running(){return!1}modify(e){}get numGeometries(){return 0}get hasOccludees(){return!1}queryRenderOccludedState(e){return!1}}class u extends n{}class c extends n{constructor(){super(...arguments),this.drapedPriority=0}}class o extends n{}class i extends n{}class d extends n{}function a(e){return"prepareTechnique"in e}function p(e){return"prepareTechniques"in e}export{d as ASyncPreparesRenderPlugin,i as AsyncRenderPlugin,s as ConsumesDepth,t as ConsumesNone,c as SyncPrepareRenderPlugin,o as SyncPreparesRenderPlugin,u as SyncRenderPlugin,a as isPrepareRenderPlugin,p as isPreparesRenderPlugin};
|
|
5
|
+
import e from"../../../../core/Accessor.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";const t={required:[]},s={required:[r.Depth]};class n extends e{consumes(){return t}get usedMemory(){return 0}get isDecoration(){return!1}get running(){return!1}modify(e){}get numGeometries(){return 0}get hasOccludees(){return!1}forEachGeometry(e){}queryRenderOccludedState(e){return!1}}class u extends n{}class c extends n{constructor(){super(...arguments),this.drapedPriority=0}}class o extends n{}class i extends n{}class d extends n{}function a(e){return"prepareTechnique"in e}function p(e){return"prepareTechniques"in e}export{d as ASyncPreparesRenderPlugin,i as AsyncRenderPlugin,s as ConsumesDepth,t as ConsumesNone,c as SyncPrepareRenderPlugin,o as SyncPreparesRenderPlugin,u as SyncRenderPlugin,a as isPrepareRenderPlugin,p as isPreparesRenderPlugin};
|
|
@@ -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
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as h}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 n}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 p from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as g}from"./HighlightApplyTechnique.js";import{HighlightDownsampleTechnique as m}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as u}from"./HighlightPassParameters.js";import{RenderRequestType as d,Decorations as f}from"../../lib/basicInterfaces.js";import{Default3D as _}from"../../lib/DefaultVertexAttributeLocations.js";import{NoVertex as T}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{H as b,g as v}from"../../../../../chunks/HighlightDownsample.glsl.js";import{defaultColor as C,defaultHaloOpacity as P,defaultFillOpacity as x}from"../../../../support/HighlightDefaults.js";import{BufferObject as O}from"../../../../webgl/BufferObject.js";import{checkWebGLError as j}from"../../../../webgl/checkWebGLError.js";import{PixelFormat as q,TextureSamplingMode as y,DataType as D,Usage as A}from"../../../../webgl/enums.js";import{Texture as R}from"../../../../webgl/Texture.js";import{TextureDescriptor as U}from"../../../../webgl/TextureDescriptor.js";let E=class extends p{constructor(e){super(e),this.produces="highlight-color",this.consumes={required:["highlight-color","highlights"]},this._optionsTexture=null,this._downsampleDrawParameters=new b,this._passParameters=new u,this._grid=new S,this._downsampleTechnique=e.techniques.acquire(m),this._applyTechnique=e.techniques.acquire(g)}initialize(){const{view:e}=this;this.addHandles([o((()=>e.highlightOptions.color),(i=>{this._passParameters.color=t(i??C),e.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this.requestRender(d.UPDATE)}),h),o((()=>e.highlightOptions.haloColor),(e=>{this._passParameters.haloColor=null!=e?t(e):this._passParameters.color,this.requestRender(d.UPDATE)}),h),o((()=>e.highlightOptions.haloOpacity),(e=>{this._passParameters.haloOpacity=e??P,this.requestRender(d.UPDATE)}),h),o((()=>e.highlightOptions.fillOpacity),(e=>{this._passParameters.fillOpacity=e??x,this.requestRender(d.UPDATE)}),h),o((()=>M(e.highlightOrder,e.highlights,e.highlightOptions)),(()=>{const t=H(e.highlightOrder,e.highlights,e.highlightOptions);this._updateOptionsTexture(t),this.requestRender(d.UPDATE)}),h),o((()=>this.view.highlightOrder),(()=>{this.requestRender(d.UPDATE)}),h),this.view.highlightOrder.on("after-changes",(()=>{this.requestRender(d.UPDATE)}))])}destroy(){this._downsampleTechnique.release(),this._applyTechnique.release(),this._passParameters&&(this._passParameters.highlightOptionsTexture=null),this._grid.coverage=r(this._grid.coverage),this._grid.vao=s(this._grid.vao),this._optionsTexture=r(this._optionsTexture)}_updateOptionsTexture(e){const t=this.renderingContext;let i=this._optionsTexture;if(null==i){const e=new U(16,2);e.internalFormat=q.RGBA,e.samplingMode=y.NEAREST,i=new R(t,e,null),this._optionsTexture=i}i.setData(e),j(t.gl),this._passParameters.highlightOptionsTexture=i}render(e){if(this.bindParameters.decorations===f.OFF)return e.find((({name:e})=>"highlight-color"===e));if(!this._downsampleTechnique.compiled||!this._applyTechnique.compiled)return this.requestRender(d.UPDATE),e.find((({name:e})=>"highlight-color"===e));const t=e.find((({name:e})=>"highlights"===e)).getTexture(),r=this.bindParameters.camera;this._passParameters.highlightOptionsTexture=this._optionsTexture;const{pixelRatio:s}=r;this._passParameters.pixelRatio=s;const o=this.renderingContext;this._gridUpdateResources(t),this._gridComputeCoverage(t,this.bindParameters);const{_grid:h}=this;this._passParameters.highlightTexture=t,this._passParameters.coverageTexture=h.coverage?.getTexture();const{width:a,height:n}=t.descriptor;l(this._passParameters.coverageRounding,a/(Math.ceil(a/v)*v),n/(Math.ceil(n/v)*v)),this._passParameters.verticalCellCount=h.verticalCellCount,this._passParameters.horizontalCellCount=h.horizontalCellCount,this._passParameters.maxHighlightLevel=i(this.view.highlightOrder.length,1,15);const c=h.vao;o.bindVAO(c);const p=e.find((({name:e})=>"highlight-color"===e));o.bindFramebuffer(p.fbo),o.setViewport4fv(r.fullViewport),o.bindTechnique(this._applyTechnique,this.bindParameters,this._passParameters);const g=(h.verticalCellCount+1)*(h.horizontalCellCount+1);return o.drawElementsInstanced(this._applyTechnique.primitiveType,6,D.UNSIGNED_BYTE,0,g),p}_gridUpdateResources(e){const t=this.renderingContext,i=this._grid,r=Math.ceil(e.descriptor.height/v),s=Math.ceil(e.descriptor.width/v);if(i.verticalCellCount=r,i.horizontalCellCount=s,i.vao)return;for(let h=0;h<6;++h)V[h]=z[h];const o=O.createIndex(t,A.STATIC_DRAW,V);i.vao=new w(t,_,{geometry:T},{geometry:O.createVertex(t,A.STATIC_DRAW)},o)}_gridComputeCoverage(e,t){const i=this.renderingContext,r=this._grid,s=e.descriptor,o=Math.ceil(s.width/v),h=Math.ceil(s.height/v);this._downsampleDrawParameters.input=e,r.coverage?.release();const a=this.fboCache.acquire(o,h,"highlight coverage",c.RG);r.coverage=a,i.unbindTexture(a.fbo?.colorTexture),i.bindFramebuffer(a.fbo),i.bindTechnique(this._downsampleTechnique,t,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,o,h),i.screen.draw()}get test(){}};e([a()],E.prototype,"produces",void 0),e([a()],E.prototype,"consumes",void 0),e([a({constructOnly:!0})],E.prototype,"techniques",void 0),E=e([n("esri.views.3d.webgl-engine.effects.highlight.Highlight")],E);class S{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function H(e,t,i){const r=new Uint8Array(128),s=(e,t)=>{r[e]=t},o=(e,t)=>{const i=4*e,r=4*e+64,{color:o}=t,h=t.haloColor??o;s(i+0,o.r),s(i+1,o.g),s(i+2,o.b),s(i+3,255*t.fillOpacity),s(r+0,h.r),s(r+1,h.g),s(r+2,h.b),s(r+3,255*t.haloOpacity)},h=Math.min(16,e.length);for(let a=0;a<h;++a){const r=e.at(a);o(a,(r?t.get(r):void 0)??i)}return r}function M(e,t,i){let r="";r+="|order:";for(const o of e)r+=`"${o}"`;const s=e=>{r+=e.color.toString()+e.fillOpacity.toString()+e.haloColor?.toString()+e.haloOpacity.toString()};return r+="|shadowDifference:"+i.shadowDifference.toString(),r+="|options:",s(i),t.forEach(s),r}const V=new Uint8Array(6),z=[0,1,2,2,1,3];export{E 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{fromValues as
|
|
5
|
+
import{fromValues as t}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{NoParameters as i}from"../../core/shaderModules/interfaces.js";import{defaultHaloOpacity as s,defaultFillOpacity as r,defaultOccludedFactor as e}from"../../../../support/HighlightDefaults.js";class l extends i{constructor(){super(...arguments),this.color=o(1,0,1,1),this.haloColor=o(1,0,1,1),this.haloOpacity=s,this.fillOpacity=r,this.occludedFactor=e,this.maxHighlightLevel=1,this.coverageRounding=t(1,1),this.verticalCellCount=0,this.horizontalCellCount=0,this.pixelRatio=1}}export{l as HighlightPassParameters};
|
|
@@ -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{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{CloudsParameters as e}from"../../environment/CloudsParameters.js";import s from"../../webgl/RenderCamera.js";import{HUDRenderStyle as r}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{MultipassGeometryUniforms as h}from"../core/shaderLibrary/shading/MultipassGeometryTest.glsl.js";import{MultipassTerrainUniforms as n}from"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{Decorations as a}from"./basicInterfaces.js";import{RenderSlot as
|
|
5
|
+
import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{CloudsParameters as e}from"../../environment/CloudsParameters.js";import s from"../../webgl/RenderCamera.js";import{HUDRenderStyle as r}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{MultipassGeometryUniforms as h}from"../core/shaderLibrary/shading/MultipassGeometryTest.glsl.js";import{MultipassTerrainUniforms as n}from"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{Decorations as a}from"./basicInterfaces.js";import{RenderSlot as g}from"./RenderSlot.js";import{TransparencyPassType as o}from"./TransparencyPassType.js";import{Update as l}from"./Update.js";import{SceneLighting as d}from"../lighting/SceneLighting.js";class c{constructor(i,l){this.shadowMap=i,this.slicePlane=l,this.slot=g.OPAQUE_MATERIAL,this.hasOccludees=!1,this.enableFillLights=!0,this.transparencyPassType=o.NONE,this.alignPixelEnabled=!1,this.decorations=a.ON,this.overlayStretch=1,this.viewshedEnabled=!1,this._camera=new s,this._inverseViewport=t(),this._oldLighting=new d,this._newLighting=new d,this._fadedLighting=new d,this._lighting=this._newLighting,this.ssr=new m,this.multipassEnabled=!1,this.multipassTerrain=new n,this.multipassGeometry=new h,this.highlightTexture=null,this.highlightGroup=null,this.highlightGroupMap=new Map,this.highlightLevel=0,this.hudRenderStyle=r.Occluded,this.cloudsFade=new e,this.shadowHighlightsVisible=!1}get camera(){return this._camera}set camera(i){this._camera=i,this._inverseViewport[0]=1/i.fullViewport[2],this._inverseViewport[1]=1/i.fullViewport[3]}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}get weatherFading(){return this._lighting===this._fadedLighting}fadeLighting(i){const{_oldLighting:t,_newLighting:e}=this;i>=1?this._lighting=e:(this._fadedLighting.lerpLighting(t,e,i),this._lighting=this._fadedLighting)}updateLighting(i,t,e,s){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=e,this._newLighting.set(i);const r=this.weatherFading?this.cloudsFade.fadeFactor:s===l.Faded?0:1;this.fadeLighting(r)}}class m{constructor(){this.fadeFactor=1,this.reprojectionMatrix=i()}}export{c as BindParameters};
|
|
@@ -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{VertexAttribute as e}from"./VertexAttribute.js";import{DataType as r}from"../../../webgl/enums.js";import{VertexElementDescriptor as t}from"../../../webgl/VertexElementDescriptor.js";const O=[new t(e.POSITION,3,r.FLOAT,0,12)],
|
|
5
|
+
import{VertexAttribute as e}from"./VertexAttribute.js";import{DataType as r}from"../../../webgl/enums.js";import{VertexElementDescriptor as t}from"../../../webgl/VertexElementDescriptor.js";const O=[],o=[new t(e.POSITION,3,r.FLOAT,0,12)],m=[new t(e.POSITION,2,r.FLOAT,0,8)],n=[new t(e.POSITION,2,r.FLOAT,0,16),new t(e.UV0,2,r.FLOAT,8,16)];export{O as NoVertex,m as Pos2,n as Pos2Tex,o as Pos3};
|
|
@@ -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{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{NoParameters as t}from"../core/shaderModules/interfaces.js";import{Parameters as r}from"./AnimationTimer.js";import{Decorations as s}from"./basicInterfaces.js";import{ContentObject as i}from"./ContentObject.js";import{ContentObjectType as a}from"./ContentObjectType.js";import{Default3D as n}from"./DefaultVertexAttributeLocations.js";import{copyParameters as o,updateParameters as p}from"../materials/internal/MaterialUtil.js";class c extends i{constructor(t,r){super(),this.type=a.Material,this.supportsEdges=!1,this.
|
|
5
|
+
import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{NoParameters as t}from"../core/shaderModules/interfaces.js";import{Parameters as r}from"./AnimationTimer.js";import{Decorations as s}from"./basicInterfaces.js";import{ContentObject as i}from"./ContentObject.js";import{ContentObjectType as a}from"./ContentObjectType.js";import{Default3D as n}from"./DefaultVertexAttributeLocations.js";import{copyParameters as o,updateParameters as p}from"../materials/internal/MaterialUtil.js";class c extends i{constructor(t,r){super(),this.type=a.Material,this.supportsEdges=!1,this._renderPriority=0,this._vertexAttributeLocations=n,this._pp0=e(0,0,1),this._pp1=e(0,0,0),this._parameters=o(t,r),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){p(this._parameters,e)&&(this.validateParameters(this._parameters),t&&this.parametersChanged())}validateParameters(e){}shouldRender(e){return this.visible&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bindParameters.decorations===s.ON)&&!!(this.parameters.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}get visible(){return!0}parametersChanged(){this.repository?.materialChanged(this)}queryRenderOccludedState(e){return this.visible&&this.parameters.renderOccluded===e}intersectDraped(e,t,r,s,i,a){return this._pp0[0]=this._pp1[0]=s[0],this._pp0[1]=this._pp1[1]=s[1],this.intersect(e,t,r,this._pp0,this._pp1,i)}}class d extends r{constructor(e,t,r){super(t,r),this.camera=e}}var u;!function(e){e[e.None=0]="None",e[e.Occlude=1]="Occlude",e[e.Transparent=2]="Transparent",e[e.OccludeAndTransparent=4]="OccludeAndTransparent",e[e.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",e[e.Opaque=16]="Opaque"}(u||(u={}));class h extends t{constructor(){super(...arguments),this.renderOccluded=u.Occlude,this.isDecoration=!1}}export{c as Material,h as MaterialParameters,u as RenderOccludedFlag,d as UpdateParameters};
|
|
@@ -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 t from"../../../../core/PooledArray.js";import{webglDebugEnabled as e}from"../../../webgl/checkWebGLError.js";class r{constructor(r,i,s){this._context=r,this._locations=s,this._textures=new Map,this._freeTextureUnits=new t({deallocator:null}),this._glProgram=r.programCache.acquire(i.generate("vertex"),i.generate("fragment"),s),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bindPass=i.generateBindPass(this),this.bindDraw=i.generateBindDraw(this),this._fragmentUniforms=e()?i.fragmentUniforms:null}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,e){this._glProgram.setUniform1i(t,e?1:0)}setUniform1i(t,e){this._glProgram.setUniform1i(t,e)}setUniform1f(t,e){this._glProgram.setUniform1f(t,e)}setUniform2fv(t,e){this._glProgram.setUniform2fv(t,e)}setUniform3fv(t,e){this._glProgram.setUniform3fv(t,e)}setUniform4fv(t,e){this._glProgram.setUniform4fv(t,e)}setUniformMatrix3fv(t,e){this._glProgram.setUniformMatrix3fv(t,e)}setUniformMatrix4fv(t,e){this._glProgram.setUniformMatrix4fv(t,e)}setUniform1fv(t,e){this._glProgram.setUniform1fv(t,e)}setUniform1iv(t,e){this._glProgram.setUniform1iv(t,e)}setUniform2iv(t,e){this._glProgram.
|
|
5
|
+
import t from"../../../../core/PooledArray.js";import{webglDebugEnabled as e}from"../../../webgl/checkWebGLError.js";class r{constructor(r,i,s){this._context=r,this._locations=s,this._textures=new Map,this._freeTextureUnits=new t({deallocator:null}),this._glProgram=r.programCache.acquire(i.generate("vertex"),i.generate("fragment"),s),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bindPass=i.generateBindPass(this),this.bindDraw=i.generateBindDraw(this),this._fragmentUniforms=e()?i.fragmentUniforms:null}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,e){this._glProgram.setUniform1i(t,e?1:0)}setUniform1i(t,e){this._glProgram.setUniform1i(t,e)}setUniform1f(t,e){this._glProgram.setUniform1f(t,e)}setUniform2fv(t,e){this._glProgram.setUniform2fv(t,e)}setUniform3fv(t,e){this._glProgram.setUniform3fv(t,e)}setUniform4fv(t,e){this._glProgram.setUniform4fv(t,e)}setUniformMatrix3fv(t,e){this._glProgram.setUniformMatrix3fv(t,e)}setUniformMatrix4fv(t,e){this._glProgram.setUniformMatrix4fv(t,e)}setUniform1fv(t,e){this._glProgram.setUniform1fv(t,e)}setUniform1iv(t,e){this._glProgram.setUniform1iv(t,e)}setUniform2iv(t,e){this._glProgram.setUniform2iv(t,e)}setUniform3iv(t,e){this._glProgram.setUniform3iv(t,e)}setUniform4iv(t,e){this._glProgram.setUniform4iv(t,e)}assertCompatibleVertexAttributeLocations(t){t.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(t,e){if(null==e?.glName){const e=this._textures.get(t);return e&&(this._context.bindTexture(null,e.unit),this._freeTextureUnit(e),this._textures.delete(t)),null}let r=this._textures.get(t);return null==r?(r=this._allocTextureUnit(e),this._textures.set(t,r)):r.texture=e,this._context.useProgram(this),this.setUniform1i(t,r.unit),this._context.bindTexture(e,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEach(((t,e)=>{this._context.bindTexture(t.texture,t.unit),this.setUniform1i(e,t.unit)})),this._fragmentUniforms?.forEach((t=>{"sampler2D"!==t.type&&"samplerCube"!==t.type||this._textures.has(t.name)||console.error(`Texture sampler ${t.name} has no bound texture`)}))}_allocTextureUnit(t){return{texture:t,unit:0===this._freeTextureUnits.length?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(t){this._freeTextureUnits.push(t.unit)}}export{r as Program};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.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 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/TransparencyMode.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 L}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as x}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._renderers=new Map,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(x.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 L,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(),this._renderers.clear(),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(x.Highlight,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL,ie.DRAPED_MATERIAL)}get hasLaserlines(){return this._plugins.produces(this._renderContext.output,ie.LASERLINES,ie.LASERLINES_CONTRAST_CONTROL)}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}getMaterialRenderer(e){return this._renderers.get(e)}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;$(e).forEach(((r,s)=>{if(t.done)return;let i=this._renderers.get(s);null==i&&r.adds.length>0&&(i=new pe({material:s}),i.initializeRenderContext(this._plugins._context),this._plugins.add(i),this._renderers.set(s,i)),i&&(i.modify(r),0===i.numGeometries&&(this._renderers.delete(i.material),this._plugins.remove(i),i.destroy())),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()})),this.updateHasFlags(),this._requestRender()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(x.Color,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),has.water=this._plugins.produces(x.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(x.Color,ie.OPAQUE_TERRAIN)&&(this._terrainTransparency===O.Semitransparent||this._terrainTransparency===O.TransparentWithDraped),m=this._highQualityTransparency&&c,f=this._plugins.produces(x.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=x.Color,i.bindFbo(),this._bindParameters.mainColor=i.colorTexture,this._bindParameters.mainDepth=i.depthTexture;const b=this.plugins.produces(x.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 L=this._renderNodes(w.MAGNIFIER,D);return l&&s===G.ON&&r===ee.Default&&!_&&(L=this._blitToDefault(L)),_?(L.attachDepth(i.depth),this._blitToDefault(this._renderNodes(C.FINAL,L)),L.detachDepth()):this._pluginInput.set(C.FINAL,L),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=x.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(x.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(x.ShadowHighlight,this._shadowMap),s.moveSnapshot(he.Highlight),this._renderShadowCascades(x.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(he.ExcludeHighlight),this._renderShadowCascades(x.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(x.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(x.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(x.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(x.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=x.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(x.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)+(this.hasLaserlines?1:0)+e;if(0===t)return;const r=this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(x.Normal)),[0,0,0,0],y.RGBA,N.DEPTH_STENCIL_TEXTURE),s=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color")+(this._viewshedEnabled?1:0);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!==x.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(){if(!this.hasLaserlines)return;this._plugins.render(this._pluginInput,ie.LASERLINES);if(this._plugins.produces(this._renderContext.output,ie.LASERLINES_CONTRAST_CONTROL)){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._pluginInput.release("normals"),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=x.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=x.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(x.ShadowHighlight,ie.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const e=()=>{this._renderAllGeometry(x.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=x.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=x.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.material)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.material)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=x.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._viewshedEnabled&&(this._viewshed.renderHighQuality=this.isFeatureEnabled(re.HighResolutionViewshed),this._plugins.render(this._pluginInput,ie.VIEWSHED),this._pluginInput.release("normals"),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 _viewshedEnabled(){return this._viewshed.enabled&&this._plugins.produces(this._renderContext.output,ie.VIEWSHED)}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};
|
|
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 u,sync as p}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/TransparencyMode.js";import{DepthFormat as N,ColorFormat as y}from"../../webgl/formats.js";import{FBOCache as D,defaultWebGLFBO as x}from"../core/FBOCache.js";import{RenderPassManager as M}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 ue}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as pe}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,TextureType as Re}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._renderers=new Map,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 M,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()}),u),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(),this._renderers.clear(),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 hasLaserlines(){return this._plugins.produces(this._renderContext.output,ie.LASERLINES,ie.LASERLINES_CONTRAST_CONTROL)}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),this._pluginInput.release("highlight mix")}_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()),p)),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}getMaterialRenderer(e){return this._renderers.get(e)}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;$(e).forEach(((r,s)=>{if(t.done)return;let i=this._renderers.get(s);null==i&&r.adds.length>0&&(i=new ue({material:s}),i.initializeRenderContext(this._plugins._context),this._plugins.add(i),this._renderers.set(s,i)),i&&(i.modify(r),0===i.numGeometries&&(this._renderers.delete(i.material),this._plugins.remove(i),i.destroy())),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()})),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"),u=S(this._sliceHelper.plane);s===G.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=i.initializeFrame(a,this._backgroundColor,r);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.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,...Oe);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,...Ie);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(Se.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(),pe.PremultipliedAlpha,1),A.release(),m&&(this._renderEdges(_e.OPAQUE),f&&(this._oitEnabled?this._renderOITPass(Se.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?x: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 M=this._renderNodes(w.MAGNIFIER,D);return l&&s===G.ON&&r===ee.Default&&!_&&(M=this._blitToDefault(M)),_?(M.attachDepth(i.depth),this._blitToDefault(this._renderNodes(C.FINAL,M)),M.detachDepth()):this._pluginInput.set(C.FINAL,M),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,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,we),this._offscreen.compositeToFramebuffer(this._bindParameters,a.getTexture(),pe.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)+(this.hasLaserlines?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")+(this._viewshedEnabled?1:0);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(...Ie,ie.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...Oe)}_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(){if(!this.hasLaserlines)return;this._plugins.render(this._pluginInput,ie.LASERLINES);if(this._plugins.produces(this._renderContext.output,ie.LASERLINES_CONTRAST_CONTROL)){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,we),e.compositeToFramebuffer(this._bindParameters,i.getTexture(),pe.PremultipliedAlpha,1),i.release()}this._pluginInput.release("normals"),this.performanceInfo.advance(fe.LASER_LINES)}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(Se.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),pe.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{width:e,height:t}=this._offscreen,{fboCache:r,_rctx:s,_bindParameters:i}=this;let a=this._pluginInput.get("highlight mix");null==a&&(a=r.acquire(e,t,"highlight mix",y.RGBA),this._pluginInput.set("highlight mix",a),i.highlightTexture=a.getTexture()),s.bindFramebuffer(a.fbo);const n=[0,0,0,0];s.clearFramebuffer(n);const h=a.getTexture(),o=r.acquire(e,t,"highlights",y.RGBA);o.acquireDepth(N.DEPTH16_BUFFER),s.bindFramebuffer(o.fbo),s.clearFramebuffer(n,!0);const{highlightOrder:d}=this._stage.view,l=Math.min(16,d.length),{highlightGroupMap:_}=i;_.clear();for(let u=0;u<l;++u){const e=d.at(u);e&&_.set(e,u)}for(let u=0;u<l;++u)this._bindParameters.highlightLevel=u,this._bindParameters.highlightGroup=d.at(u),s.bindFramebuffer(o.fbo),s.clearFramebuffer(void 0,!0),this._renderAllGeometry(L.Highlight),0===u&&(s.clear(Ae.DEPTH_BUFFER_BIT),this._renderHUDElements(v.Both)),s.clear(Ae.DEPTH_BUFFER_BIT),s.bindTexture(h,0),s.gl.copyTexImage2D(Re.TEXTURE_2D,0,be.RGBA,0,0,e,t,0);return o}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(...Oe),this._bindParameters.transparencyPassType=de.FrontFace,this._plugins.prepare(...Oe),this._bindParameters.transparencyPassType=de.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t=v.Both){const r=e===Se.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;Ne.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;t.queryRenderOccludedState(z.OccludeAndTransparentStencil)&&(e|=z.OccludeAndTransparentStencil,Ne.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(),pe.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!==Ne.length&&(s(ie.OCCLUDER_MATERIAL,Ne),r(.5,z.OccludeAndTransparentStencil,(()=>s(ie.TRANSPARENT_OCCLUDER_MATERIAL,Ne)),!1,!1));const i=Ne.length>0;Ne.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)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,Ne.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,Ne),s(ie.TRANSPARENT_MATERIAL,Ne),s(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Ne),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||Ne.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),Ne.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._viewshedEnabled&&(this._viewshed.renderHighQuality=this.isFeatureEnabled(re.HighResolutionViewshed),this._plugins.render(this._pluginInput,ie.VIEWSHED),this._pluginInput.release("normals"),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=x,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(De,this._bindParameters.camera.viewMatrix),g(ye,this._bindParameters.camera.projectionMatrix),T(xe,De,ye),T(xe,this._renderContext.lastFrameCamera.viewMatrix,xe),T(xe,this._renderContext.lastFrameCamera.projectionMatrix,xe),this._reprojectionMatrix=xe);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 _viewshedEnabled(){return this._viewshed.enabled&&this._plugins.produces(this._renderContext.output,ie.VIEWSHED)}get test(){}}var Se,Ce;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"}(Se||(Se={})),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"}(Ce||(Ce={}));const we=[0,0,0,0],Ie=[ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.OPAQUE_NO_SSAO_DEPTH],Oe=[ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH],Ne=new o,ye=E(),De=E(),xe=E();function Me(e){return t=>e.immediate.schedule(t)}export{Ce as FramebufferId,Pe 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"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{VaoCache as s}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class o extends i{constructor(s,t){super(s,t),this.gl=s,this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this.screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,r){const t=
|
|
5
|
+
import"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{VaoCache as s}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class o extends i{constructor(s,t){super(s,t),this.gl=s,this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this.screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,r){const t=Array.from(e.keys()).map((r=>`${r}:${e.get(r)}`)).join("."),i=JSON.stringify(r),o=this._vaoCaches.get(t,i);if(o)return o;const a=new s(this,e,r);return this._vaoCaches.set(t,i,a),a}bindTechnique(e,r,s,t,i){return this.useProgram(e.program),this.setPipelineState(e.getPipeline(!!i)),e.program.bindPass(s,r),t&&e.program.bindDraw(t,r,s),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get test(){}}export{o as RenderingContext};
|
|
@@ -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 t from"../../../../core/Collection.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as r,
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Collection.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{property as n}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{translate as h,fromTranslation as d,scale as c,mul as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{z as p}from"../../../../chunks/vec32.js";import{create as m,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ShaderOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as _,ConsumesDepth as v,ConsumesNone as g}from"../effects/RenderPlugin.js";import{RenderSlot as M}from"./RenderSlot.js";import{ViewshedShadowMap as S}from"./ViewshedShadowMap.js";import{V as x}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as b}from"../shaders/ViewshedTechnique.js";import{ViewshedTechniqueConfiguration as j}from"../shaders/ViewshedTechniqueConfiguration.js";let C=class extends _{get viewshedShadowMap(){return this._viewshedShadowMap}get enabled(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}constructor(e,i){super(e),this._pluginContext=null,this.renderHighQuality=!1,this._parameters=new x,this._configuration=new j,this._viewsheds=new t,this.produces=new Map([[M.VIEWSHED,()=>!0]]),this._renderShadowMap=i}initialize(){this.addHandles([r((()=>this.view.resolutionScale),(e=>{const t=this._viewshedShadowMap;null!=t&&(t.settings.textureSizeQuality=e)}),o)])}destroy(){this.uninitializeRenderContext()}consumes(){return this.enabled?v:g}initializeRenderContext(e){this._pluginContext=e,this._viewshedShadowMap=new S(this.fboCache),this._viewshedShadowMap.enabled=!0}renderNode(e,t,i){const{bindParameters:s,rctx:r}=e;if(!this.enabled||!s.depth||null==i)return;const o=this._setupNormals(i);if(null!=this._technique&&this._configuration.useNormalMap===o||(this._configuration.useNormalMap=o,this._technique=this._pluginContext?.techniques.acquire(b,this._configuration)),this._technique?.compiled)for(const n of this._viewsheds){const t=e.rctx.getBoundFramebufferObject(),i=this._renderViewshedShadowCubeMap(s,n),o=this._viewshedShadowMap;i&&null!=o?.depthTexture&&!o.isTextureZero&&(this._setPassParameters(n),e.rctx.bindFramebuffer(t),r.bindTechnique(this._technique,s,this._parameters),r.screen.draw())}else this._pluginContext?.requestRender()}uninitializeRenderContext(){this._pluginContext=null,this._viewshedShadowMap?.dispose(),this._technique=s(this._technique)}updateViewsheds(e){const i=this._viewsheds,s=e.removes;null!=s&&(t.isCollection(s)?i.removeMany(s):i.remove(s));const r=e.adds;if(null!=r)if(t.isCollection(r)){const e=r.filter((e=>!i.includes(e)));i.addMany(e)}else i.includes(r)||i.add(r)}_renderViewshedShadowCubeMap(e,t){const i=this._viewshedShadowMap;if(!i?.enabled)return!1;const s=i.start(e.camera,t,this.renderHighQuality,this._contentPixelRatio);if(s)for(const r of i.faces)this._renderShadowMap(e,r,f.ViewshedShadow);return i.finish(),s}_setPassParameters(e){const t=this._parameters,s=this._viewshedShadowMap;if(null==s)return;const r=e.observerRenderSpace;t.localOrigin=r,t.fovs=[i(e.horizontalFieldOfView),i(e.verticalFieldOfView)],t.headingAndTilt=[i(e.heading),i(e.tiltParallelToSurface)],t.upVector=e.tiltedUpVector;const o=V(e.targetRenderSpace,r);t.targetVector=o,t.shadowMap=s;const n=[],a=[];for(let i=0;i<s.numActiveFaces;i++)h(R,s.viewshedViewMatrices[i],r),n.push(...R.flat()),y(s.viewshedProjectionMatrices[i],R,q),a.push(...q.flat());t.viewMatrices=n,t.projectionMatrices=a}_setupNormals(e){const t=e.get("normals"),i=t?.getTexture();return this._parameters.normalTexture=i,null!=i}get test(){return{viewsheds:this._viewsheds,shadowMap:this.viewshedShadowMap}}};function V(e,t){const i=m();return p(i,e,t)}function y(e,t,i){const s=w(.5,.5,.5);return d(i,s),c(i,i,s),l(i,i,e),l(i,i,t),i}e([n()],C.prototype,"_pluginContext",void 0),e([n()],C.prototype,"fboCache",void 0),e([n()],C.prototype,"view",void 0),e([n()],C.prototype,"viewshedShadowMap",null),e([n()],C.prototype,"_contentPixelRatio",null),C=e([a("esri.views.3d.webgl-engine.lib.Viewshed")],C);const R=u(),q=u();export{C as Viewshed};
|
|
@@ -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 has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{z as r,g as a,k as o,h}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ColorFormat as c,DepthFormat as u}from"../../webgl/formats.js";import{applyTextureResizeFloorModulo as l,applyTextureResizeModulo as f}from"./textureUtils.js";import{ViewshedFaceCamera as d}from"./ViewshedFaceCamera.js";import{ClearBufferBit as m}from"../../../webgl/enums.js";class x{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function _(t){return!["top","bottom"].includes(t)}class g{constructor(t){this._fbos=t,this._enabled=!1,this._faces={},this._textureWidth=0,this._textureHeight=0,this.settings=new x,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture()}get enabled(){return this._enabled}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get isTextureZero(){return 0===this._textureWidth||0===this._textureHeight}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach((s=>{t[s]&&(e+=1)})),e}get faces(){const t=this._faces,e=[];for(const s of p){const i=t[s];i&&e.push(i)}return e}get atlasRegions(){return this.faces.map((t=>[t.x/this._textureWidth,(t.x+t.width)/this._textureWidth,t.y/this._textureHeight,(t.y+t.height)/this._textureHeight]))}get viewshedProjectionMatrices(){return this.faces.map((t=>t.projectionMatrix))}get viewshedViewMatrices(){return this.faces.map((t=>t.viewMatrix))}_setupFaceCamera(e,c,u,l){const{observerRenderSpace:f,tiltedUpVector:m,targetRenderSpace:x,farDistanceRenderSpace:p,horizontalFieldOfView:g,verticalFieldOfView:b}=c,M=n();r(M,x,f);const F=n(),S=n(),w=(t,e)=>{const r=n(),o=i();return s(o,t,e),h(r,M,o),a(r,f,r),r};let z,B=m;const T=Math.min(90,g),O=Math.min(90,Math.max(0,(g-90)/2));let j=-45,v=45,y=-45,R=45;if(_(e)){const e=e=>t(e,-45,45);y=e(-b/2)-this.settings.toleranceBottomTop,R=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=x,j=-T/2,v=T/2;break;case"left":z=w(Math.PI/2,m),j=45-O;break;case"right":z=w(-Math.PI/2,m),v=-45+O;break;case"top":z=a(F,f,m),B=o(S,M);break;case"bottom":z=r(F,f,m),B=M;break;case"back":z=w(Math.PI,m)}const k=new d({center:z,eye:f,up:B,far:p});k.sectionAnglesDeg=[j-this.settings.toleranceSides,v+this.settings.toleranceSides,y,R],k.fovY=Math.PI/2;const H=k.setViewport(u,l);return this._faces[e]=k,H}_bindFBO(){const t=this._fbos.rctx;t.unbindTexture(this.depthTexture),t.bindFramebuffer(this._handle?.fbo)}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:s,verticalFieldOfView:i}=t,r=-i/2,a=i/2;return 0===s||0===i||(r<=45&&a>=-45&&e.add("front"),s>90&&(e.add("left"),e.add("right")),s>270&&e.add("back"),a>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize(t,e,s,i){const r=e/t.pixelRatio,a=this.settings.textureSizeModifier(s),o=Math.max(t.fullWidth,t.fullHeight),h=f(Math.floor(o*r*a)),n=Math.floor(this._maxTextureSize/i),c=Math.min(n,h);return l(c)}_ensureFBO(){const t=this._textureWidth,e=this._textureHeight;this._handle?.fbo?.width===t&&this._handle?.fbo?.height===e||(this._handle?.release(),this._handle=this._fbos.acquire(t,e,"viewshed shadow map",c.RGBA4)),this._handle.acquireDepth(u.DEPTH16_BUFFER)}clearFBO(){const t=this._fbos.rctx;this._ensureFBO(),this._bindFBO(),t.setClearColor(1,1,1,1),t.clear(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}disposeOffscreenBuffers(){this._handle=e(this._handle)}start(t,e,s,i){if(this._faces={},!this.enabled)return!1;const r=this._computeActiveFaces(e),a=r.size;if(0===a)return!1;const o=this._computeBaseTextureSize(t,i,s,a);if(0===o)return!1;let h=0,n=0,c=0;return p.filter((t=>r.has(t))).forEach((t=>{const s=b(t,a);s>n&&(c=Math.max(c,h),h=0),n=s;const i=s*o;h+=this._setupFaceCamera(t,e,[h,i],o)})),c=Math.max(c,h),this._textureWidth=this.settings.textureResizeModulo(c),this._textureHeight=M(a)*o,this.clearFBO(),!0}finish(){this._handle?.detachDepth()}get test(){return{faces:this._faces,faceTypes:p}}}function b(t,e){if(e<4)return 0;const s="front"===t||"left"===t;return 4===e?s?0:1:s||"right"===t?0:1}function M(t){return t<4?1:2}export{g as ViewshedShadowMap};
|