@arcgis/core 5.1.0-next.80 → 5.1.0-next.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/ShadowCast/DiscreteOptions.d.ts +12 -0
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +12 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/040884cec4b84dd1bb17.js +1 -0
- package/assets/esri/core/workers/chunks/05c5f68e117fc58ae801.js +1 -0
- package/assets/esri/core/workers/chunks/074f5e6aaeafca13bf72.js +1 -0
- package/assets/esri/core/workers/chunks/{7bd1d624f4f4a11a31e8.js → 086d7cdfa92a649c9f7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{0eed2b1b06355ab89013.js → 0c074c46d106ca4d3bad.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7324a00ed576e7a37b1.js → 1768f1a7e3caa6074d91.js} +1 -1
- package/assets/esri/core/workers/chunks/{85d3475667c503ec4fc6.js → 186bfde8c552e3b42302.js} +1 -1
- package/assets/esri/core/workers/chunks/1a35121a0c2595a41fdb.js +1 -0
- package/assets/esri/core/workers/chunks/1ab66600579fa4232d7b.js +1 -0
- package/assets/esri/core/workers/chunks/{d5fd99ee40bba9b48a54.js → 1e2c0c6d724f7639d4c1.js} +27 -27
- package/assets/esri/core/workers/chunks/1e3fe89970c57a883fe5.js +1 -0
- package/assets/esri/core/workers/chunks/{824051af00e7a1f05ed0.js → 230e0e43f8e771950397.js} +1 -1
- package/assets/esri/core/workers/chunks/26f804c92077c11c626d.js +1 -0
- package/assets/esri/core/workers/chunks/28a45bd26eb5c9b3ec7c.js +1 -0
- package/assets/esri/core/workers/chunks/38f1a86b8dd9ee684ee5.js +596 -0
- package/assets/esri/core/workers/chunks/{c1d4110aa494a1dba3c4.js → 455d08294e0f5c5509ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{71fe127734f33d020a44.js → 475394218caaa4cd3e86.js} +1 -1
- package/assets/esri/core/workers/chunks/475409026288f0981ce2.js +1 -0
- package/assets/esri/core/workers/chunks/4e206957b28253ddc1a3.js +1 -0
- package/assets/esri/core/workers/chunks/{87d2021e91d025a2a142.js → 5c7ba4b8a9ec2e2e02b5.js} +1 -1
- package/assets/esri/core/workers/chunks/5cc38ac051d3d0557920.js +1 -0
- package/assets/esri/core/workers/chunks/{992cd87ba0ab6346f692.js → 64e268ebac0b62076f81.js} +1 -1
- package/assets/esri/core/workers/chunks/{003fd7745966fe03510c.js → 65ac73de5bb133c6bf89.js} +1 -1
- package/assets/esri/core/workers/chunks/6675d56f49d07a97dc40.js +1 -0
- package/assets/esri/core/workers/chunks/{1f82a0f134ea912fc686.js → 66fe1634c6e8f72fc653.js} +1 -1
- package/assets/esri/core/workers/chunks/{96b13b6042cdf5833d39.js → 67abbe81c16de26f61d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{484d6c1b0fe1633515b7.js → 72f8f4cfa0842d325fb0.js} +1 -1
- package/assets/esri/core/workers/chunks/{283d39dfb1625b5a74db.js → 747e258f57f0543c836e.js} +1 -1
- package/assets/esri/core/workers/chunks/{dd4f431511edd975a53b.js → 7acf82763aeba44049d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d8e944b192aad4cf986.js → 7b505112c7e6d9b7a239.js} +1 -1
- package/assets/esri/core/workers/chunks/7b8466f892a38a53c600.js +1 -0
- package/assets/esri/core/workers/chunks/{6a0352d20596ca3f4b64.js → 88eb1e4320c4ada01711.js} +1 -1
- package/assets/esri/core/workers/chunks/{77dd719516138afb1a2a.js → 8af9a78cf316581ea482.js} +1 -1
- package/assets/esri/core/workers/chunks/97719271a3e4c9f2b2c9.js +1 -0
- package/assets/esri/core/workers/chunks/988e91cc6cf88c34c2de.js +1 -0
- package/assets/esri/core/workers/chunks/9c402657f63a4d5668d0.js +1 -0
- package/assets/esri/core/workers/chunks/9cac70164d8528c283af.js +1 -0
- package/assets/esri/core/workers/chunks/9ea23cd4b2664c08b670.js +1 -0
- package/assets/esri/core/workers/chunks/9f51a69b8f1937a8794a.js +1 -0
- package/assets/esri/core/workers/chunks/a28124bba6b43efd74cc.js +1 -0
- package/assets/esri/core/workers/chunks/ac5999c88c27b49cd760.js +1 -0
- package/assets/esri/core/workers/chunks/af762422a65c551dcd54.js +1 -0
- package/assets/esri/core/workers/chunks/{056fd7847caaff2c9514.js → af8bc56cf1404afc3028.js} +1 -1
- package/assets/esri/core/workers/chunks/b811d62284be95f4beb6.js +1 -0
- package/assets/esri/core/workers/chunks/b9e163f4a898e50cc854.js +1 -0
- package/assets/esri/core/workers/chunks/{444f0f51b3ee0b9845a5.js → bb2f6b0fcdfb8b158e26.js} +1 -1
- package/assets/esri/core/workers/chunks/{3b9100c59a8050f4834e.js → bbc27d9285162696d089.js} +1 -1
- package/assets/esri/core/workers/chunks/{5da2051f548c2942e01a.js → bc8a74da48b08309875f.js} +1 -1
- package/assets/esri/core/workers/chunks/bd8cb64b6e08839398f3.js +1 -0
- package/assets/esri/core/workers/chunks/{026d3fa331caec1ea3d2.js → bf4dd8e50704e4040966.js} +1 -1
- package/assets/esri/core/workers/chunks/c19e3f6027b6526de359.js +1 -0
- package/assets/esri/core/workers/chunks/c8ef80a7c46d7d2c5172.js +1 -0
- package/assets/esri/core/workers/chunks/cbf1a03f54bd8d2a2b47.js +1 -0
- package/assets/esri/core/workers/chunks/ce4dfc3a470230ddc9e4.js +1 -0
- package/assets/esri/core/workers/chunks/{8ea4584e07ccc85caabd.js → d11de13537b623739e14.js} +1 -1
- package/assets/esri/core/workers/chunks/d897412b99b9fba44bb4.js +1 -0
- package/assets/esri/core/workers/chunks/d9c3f14eee4db7a7137b.js +1 -0
- package/assets/esri/core/workers/chunks/{035dbb0217f83108fa89.js → db86a1119e4e58ecfbda.js} +1 -1
- package/assets/esri/core/workers/chunks/dcb7a3ff59677b1cf0f1.js +1 -0
- package/assets/esri/core/workers/chunks/{5fe97253f80c797fad7f.js → df8a3d3cac454d42e14d.js} +1 -1
- package/assets/esri/core/workers/chunks/dfe1139124fda0d6c059.js +1 -0
- package/assets/esri/core/workers/chunks/{8b8f391f27774aec6db9.js → e0b27bceb397482bd0e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb9e3e7cd532ac4353f1.js → e89dc473f46a5584d2ef.js} +32 -32
- package/assets/esri/core/workers/chunks/{01ee18782a50279f907e.js → f4220b6eab0865318033.js} +1 -1
- package/assets/esri/core/workers/chunks/{42336e0d1ef88737b078.js → f468c6ea2818a1f97e19.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f242f8d092f601c3abf.js → f77d23ee60c876b01e4b.js} +1 -1
- package/assets/esri/core/workers/chunks/fce2306a1b31c6680f90.js +1 -0
- package/assets/esri/core/workers/chunks/fcf51697c361e0075cc2.js +1 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +15 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
- package/chunks/ShadowCastVisualize.glsl.js +33 -15
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/config.js +1 -1
- package/core/workers/registry.js +1 -1
- package/form/elements/inputs/MultipleChoiceInput.d.ts +6 -6
- package/form/elements/inputs/MultipleChoiceInput.js +1 -1
- package/form/elements/inputs.js +1 -1
- package/geometry/SpatialReference.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/BaseDynamicLayer.js +1 -1
- package/layers/BaseTileLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/FeatureLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/WMTSLayer.js +1 -1
- package/layers/WebTileLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/mixins/TiledImagery.js +1 -1
- package/layers/support/imageBitmapUtils.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/package.json +1 -1
- package/request/process.js +1 -1
- package/rest/knowledgeGraph/CreateReplicaResponse.d.ts +37 -0
- package/rest/knowledgeGraph/CreateReplicaResponse.js +2 -0
- package/rest/knowledgeGraph/ReplicaDefinition.d.ts +91 -0
- package/rest/knowledgeGraph/ReplicaDefinition.js +2 -0
- package/rest/knowledgeGraph/ReplicasInformationResponse.d.ts +24 -0
- package/rest/knowledgeGraph/ReplicasInformationResponse.js +2 -0
- package/rest/knowledgeGraph/UnregisterReplicaResponse.d.ts +44 -0
- package/rest/knowledgeGraph/UnregisterReplicaResponse.js +2 -0
- package/rest/knowledgeGraph/wasmInterface/replicaToWasmEncodedFactories.js +2 -0
- package/rest/knowledgeGraph/wasmInterface/wasmToReplicaFactories.js +2 -0
- package/rest/knowledgeGraphService.d.ts +50 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/WMSLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/layers/ElevationLayerView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerWorker.js +2 -0
- package/views/3d/layers/IntegratedMesh3DTilesLayerWorkerHandle.js +2 -0
- package/views/3d/layers/TileLayerView3D.js +1 -1
- package/views/3d/layers/WMTSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/layers/support/IntegratedMesh3DTilesVertexProcessing.js +2 -0
- package/views/3d/layers/support/makeScheduleFunction.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.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/ComponentMaterialInitParameters.js +2 -0
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/StencilUtils.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/materials/VisualVariablePassParameters.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +2 -0
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/colorRampParameters.js +2 -0
- package/views/VideoView.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPen.js +2 -0
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/input/types.d.ts +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/support/TextureCompressionWorkerHandle.js +1 -1
- package/views/support/unnormalizationUtils.js +2 -0
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/renderState.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/ElevationProfile/support/profileUtils.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/css.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/05c3146d87d917606193.js +0 -1
- package/assets/esri/core/workers/chunks/0b77c124b743067e4155.js +0 -1
- package/assets/esri/core/workers/chunks/11241781baaed346af52.js +0 -1
- package/assets/esri/core/workers/chunks/1d9560eb8b21b9e76616.js +0 -1
- package/assets/esri/core/workers/chunks/2c87c3112a43db8624f6.js +0 -1
- package/assets/esri/core/workers/chunks/2da62687ff678b690839.js +0 -1
- package/assets/esri/core/workers/chunks/3a58708217a9c11836ab.js +0 -1
- package/assets/esri/core/workers/chunks/3bbf684ee2484eb44c9f.js +0 -1
- package/assets/esri/core/workers/chunks/49fb9c47070641bce9a9.js +0 -1
- package/assets/esri/core/workers/chunks/4eed175277eb0df3c821.js +0 -1
- package/assets/esri/core/workers/chunks/4f9d027055f3a616173c.js +0 -1
- package/assets/esri/core/workers/chunks/5417308eba30e668b1ee.js +0 -1
- package/assets/esri/core/workers/chunks/62b3e933f548ce354b99.js +0 -1
- package/assets/esri/core/workers/chunks/63381d81adce0a0d2089.js +0 -1
- package/assets/esri/core/workers/chunks/6dbddf5ab1867ac2ac80.js +0 -1
- package/assets/esri/core/workers/chunks/6e70e922331704b92a08.js +0 -1
- package/assets/esri/core/workers/chunks/7c7c11c0fde8b63e330b.js +0 -1
- package/assets/esri/core/workers/chunks/7f55eef696e9ed717bfc.js +0 -1
- package/assets/esri/core/workers/chunks/89dbea6f436d45a3b185.js +0 -1
- package/assets/esri/core/workers/chunks/8f6f5dad52747d252aac.js +0 -596
- package/assets/esri/core/workers/chunks/99c189e1de2b1f14799b.js +0 -1
- package/assets/esri/core/workers/chunks/9aa6b32cb65fbaa93218.js +0 -1
- package/assets/esri/core/workers/chunks/9d216e30d04ea21fc8a2.js +0 -1
- package/assets/esri/core/workers/chunks/9d434360dfce1e49b7b9.js +0 -1
- package/assets/esri/core/workers/chunks/a5d8d6f3c0c8de474efd.js +0 -1
- package/assets/esri/core/workers/chunks/a809b811121099a87a98.js +0 -1
- package/assets/esri/core/workers/chunks/c02ba921c0a32d2021e3.js +0 -1
- package/assets/esri/core/workers/chunks/c3c19b62d948d53118a8.js +0 -1
- package/assets/esri/core/workers/chunks/c46a4adea39636a96d03.js +0 -1
- package/assets/esri/core/workers/chunks/c5507480344176fad241.js +0 -1
- package/assets/esri/core/workers/chunks/c6030271bd6d39b6e1db.js +0 -1
- package/assets/esri/core/workers/chunks/d1a7d13e1d48abcd7bf1.js +0 -1
- package/assets/esri/core/workers/chunks/dcbc4072c18278c2b67d.js +0 -1
- package/assets/esri/core/workers/chunks/e610d24539a675fb054b.js +0 -1
- package/assets/esri/core/workers/chunks/ecb7ede6a8e6c05e4c6c.js +0 -1
- package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +0 -1
- package/assets/esri/core/workers/chunks/fb5a2205f05afc396119.js +0 -1
- package/request/ImageWithType.js +0 -2
- package/views/3d/layers/support/fetchTile.js +0 -2
- package/views/interactive/editGeometry/unnormalizationHelper.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{nextPowerOfTwo as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as r}from"../../../../core/maybe.js";import{property as s,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{ortho as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UNIT_X as c,ZEROS as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as d,InternalRenderCategory as p}from"../../webgl.js";import{Frustum as _}from"../../state/Frustum.js";import{glLayout as m}from"../../support/buffer/glUtil.js";import{newLayout as f}from"../../support/buffer/InterleavedLayout.js";import g from"../../webgl/RenderCamera.js";import C from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as F}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as w}from"./VertexArrayObject.js";import{C as x}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as R}from"../shaders/CutFillDepthTechnique.js";import{CutFillDepthTechniqueConfiguration as T}from"../shaders/CutFillDepthTechniqueConfiguration.js";import{C as P}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as y}from"../shaders/CutFillReductionTechnique.js";import{CutFillReductionTechniqueConfiguration as b}from"../shaders/CutFillReductionTechniqueConfiguration.js";import{C as B}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as D}from"../shaders/CutFillTargetDepthTechnique.js";import{ImmediateTask as j,TaskPriority as E}from"../../../support/Scheduler.js";import{Yield as S}from"../../../support/Yield.js";import{PrimitiveType as q,DataType as O}from"../../../webgl/enums.js";import{Sync as v}from"../../../webgl/Sync.js";import{VertexBuffer as V}from"../../../webgl/VertexBuffer.js";let A=class extends C{constructor(t){super(t),this.consumes={required:[d.TRANSPARENT]},this.produces=p.CUTFILL_COMPUTATION,this._cutFillTargetDepthConfiguration=new F,this._cutFillDepthConfiguration=new T,this._cutFillReductionConfiguration=new b,this._cutFillTargetDepthParameters=new B,this._cutFillDepthParameters=new x,this._cutFillReductionParameters=new P,this.needsRender=!1,this.readyToRun=!1,this.done=!0,this._frameTask=j,this._result=new k,this._localOrigin=u(),this._maxTextureSize=512,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=13,this._colorFormat=10,this._numChannels=2,this._targetGeometryVao=null,this._numReductions=3,this._reductionPasses=0,this._pixelBufferSize=0,this._pixelBufferOffset=0,this._perReductionPixelBufferSize=0}initialize(){this._frameTask=this.view.resourceController.scheduler.registerTask(E.VOLUME_MEASUREMENT,this),this.addHandles(this._frameTask),this._maxTextureSize=Math.min(this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=9,this._frustum=new _(this.view.renderCoordsHelper)}destroy(){this._targetGeometryVao=i(this._targetGeometryVao);const t=this.gl;this._sync=r(this._sync),this._pixelBuffer&&(t.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0)}precompile(){this.view.stage.renderer.precompileCutFillOrthographicReferenceDepth()}render(t){const e=t.find(({name:t})=>t===this.produces);if(!this._orthographicCamera||!this._targetGeometryVao||!this.needsRender||this._sync)return e;const i=this.techniques.getCompiled(D,this._cutFillTargetDepthConfiguration);this._cutFillDepthConfiguration.preparePass=0;const r=this.techniques.getCompiled(R,this._cutFillDepthConfiguration);this._cutFillDepthConfiguration.preparePass=1;const s=this.techniques.getCompiled(R,this._cutFillDepthConfiguration);this._cutFillReductionConfiguration.reductionPass=0;const h=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=1;const o=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=2;const n=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);if(!(i&&r&&s&&h&&o&&n))return this.requestRender(1),e;this.needsRender=!1;const a=this.renderingContext,u=this.fboCache,d=this.gl,p=a.getViewport(),_=u.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);a.bindFramebuffer(_.fbo),a.setViewport(0,0,this._width,this._height),a.clear(1280),this.view.stage.renderer.renderCutFillOrthographicReferenceDepth(this._orthographicCamera);const m=u.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);a.bindFramebuffer(m.fbo),a.setViewport(0,0,this._width,this._height),a.setClearDepth(1),a.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,a.bindTechnique(i,this.bindParameters,this._cutFillTargetDepthParameters),a.bindVAO(this._targetGeometryVao),a.drawArrays(q.TRIANGLES,0,this._targetGeometryVao.vertexCount("geometry"));const f=u.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),g=u.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);return this._cutFillDepthParameters.referenceDepthTexture=_.depthTexture,this._cutFillDepthParameters.targetDepthTexture=m.depthTexture,this._pixelBuffer||(this._pixelBuffer=d.createBuffer()),d.bindBuffer(d.PIXEL_PACK_BUFFER,this._pixelBuffer),d.bufferData(d.PIXEL_PACK_BUFFER,this._pixelBufferSize,d.STREAM_READ),this._prepareFBO(f,this.width,this.height),a.bindTechnique(r,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(f,g,h),this._prepareFBO(f,this.width,this.height,c),a.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(f,g,o),this._prepareFBO(f,this.width,this.height,l),a.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),a.screen.draw(),this._runPyramidReduction(f,g,n),_.release(),m.release(),f.release(),g.release(),d.bindBuffer(d.PIXEL_PACK_BUFFER,null),a.setViewport(p.x,p.y,p.width,p.height),this._sync=new v(d),setTimeout(()=>this.readyToRun=!0,0),e}update(t,i){if(!this.done)return;this.done=!1;const r=this.renderingContext,{cameraDimensions:{width:s,height:h},localOriginRenderSpace:o}=t,n=this._maxTextureSize,a=h/s,u=s>h?n:n/a,c=s>h?n*a:n;this._width=e(u),this._height=e(c);const l=[this._width,this._height];this._orthographicCamera=this._createCamera(t,l),this._frustum?.update(this._orthographicCamera),this._updateTargetVao(r,i),this._localOrigin=o,this._reductionPasses=Math.ceil(Math.log2(Math.min(this._width,this._height))),this._reducedWidth=Math.ceil(this._width/2**this._reductionPasses),this._reducedHeight=Math.ceil(this._height/2**this._reductionPasses),this._perReductionPixelBufferSize=this._reducedWidth*this._reducedHeight*this._numChannels*4,this._pixelBufferSize=this._perReductionPixelBufferSize*this._numReductions,this._pixelBufferOffset=0,this.needsRender=!0,this.requestRender(1)}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return S}catch(e){return this.readyToRun=!1,void(this._sync=r(this._sync))}this.readyToRun=!1,this._sync=r(this._sync);const t=this.gl;this._cpuBuffer=new Float32Array(this._pixelBufferSize/4),t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this._updateResults(this._cpuBuffer),this.done=!0}getResult(){return this._result}get frustum(){return this._frustum}get width(){return this._width}get height(){return this._height}get updating(){return this.readyToRun||!this.done||this._frameTask.updating}_runPyramidReduction(t,e,i){const r=this.renderingContext,s=this.gl;let h=this._width,o=this._height;for(let n=0;n<this._reductionPasses;n++)h=Math.ceil(h/2),o=Math.ceil(o/2),this._cutFillReductionParameters.depthTexture=t.getTexture(),this._prepareFBO(e,h,o),r.bindTechnique(i,this.bindParameters,this._cutFillReductionParameters),r.screen.draw(),[t,e]=[e,t];s.readPixels(0,0,h,o,33319,O.FLOAT,this._pixelBufferOffset),this._pixelBufferOffset+=this._perReductionPixelBufferSize}_updateResults(t){const e=new U(0,1,a()),i=new U(0,0,a());for(let r=0;r<this._reducedWidth;r++)for(let s=0;s<this._reducedHeight;s++){let h=(r+s*this._reducedWidth)*this._numChannels;const o=this._reducedWidth*this._reducedHeight*this._numChannels;e.totalDepth+=t[h],i.totalDepth+=t[h+1],h+=o;const n=t[h];n<e.depthExtremum&&(e.depthExtremum=n,M(e.depthExtremumCoords,t[h+1],this._width)),h+=o;const a=t[h];a>i.depthExtremum&&(i.depthExtremum=a,M(i.depthExtremumCoords,t[h+1],this._width))}this._result=new k(this._width,this._height,e,i)}_prepareFBO(t,e,i,r=l){const s=this.renderingContext;s.bindFramebuffer(t.fbo),s.setViewport(0,0,e,i),s.setClearColor(r[0],r[1],r[2],r[3]),s.clear(16384)}_createCamera(t,e){const{cameraPositionRenderSpace:i,localOriginRenderSpace:r,northVector:s,cameraDimensions:{width:h,height:n},cameraNearFar:{near:a,far:u}}=t,c=new g({eye:i,center:r,up:s,near:a,far:u});return c.viewport=[0,0,e[0],e[1]],o(c.projectionMatrix,-h/2,h/2,-n/2,n/2,a,u),c}_updateTargetVao(t,e){this._targetGeometryVao=i(this._targetGeometryVao);const r=e.indices.length,s=z.createBuffer(r),h=s.position,{positions:o,indices:n}=e;for(let i=0;i<n.length;++i){const t=3*n[i];h.set(i,0,o[t]),h.set(i,1,o[t+1]),h.set(i,2,o[t+2])}const a=new V(t,m(z),s.buffer);this._targetGeometryVao=new w(t,a)}};t([s()],A.prototype,"consumes",void 0),t([s()],A.prototype,"produces",void 0),t([s()],A.prototype,"needsRender",void 0),t([s()],A.prototype,"readyToRun",void 0),t([s()],A.prototype,"done",void 0),t([s()],A.prototype,"updating",null),t([s()],A.prototype,"_frameTask",void 0),A=t([h("esri.views.3d.webgl-engine.lib.CutFillComputationRenderNode")],A);const z=f().vec3f("position").freeze();function M(t,e,i){const r=e%i,s=Math.floor(e/i);n(t,r,s)}class L{constructor(t,e){this.positions=t,this.indices=e}}class U{constructor(t,e,i){this.totalDepth=t,this.depthExtremum=e,this.depthExtremumCoords=i}}class k{constructor(t=0,e=0,i=new U(0,1,a()),r=new U(0,0,a())){this.width=t,this.height=e,this.cut=i,this.fill=r}}export{A as CutFillComputationRenderNode,k as CutFillComputationResult,U as CutFillDepthResult,L as TargetGeometryRenderInfo};
|
|
2
|
+
import{__decorate as t}from"tslib";import{nextPowerOfTwo as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as r}from"../../../../core/maybe.js";import{property as s,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{ortho as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UNIT_X as c,ZEROS as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as d,InternalRenderCategory as p}from"../../webgl.js";import{Frustum as _}from"../../state/Frustum.js";import{glLayout as f}from"../../support/buffer/glUtil.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import g from"../../webgl/RenderCamera.js";import C from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as F}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as R}from"./VertexArrayObject.js";import{C as w}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as x}from"../shaders/CutFillDepthTechnique.js";import{CutFillDepthTechniqueConfiguration as P}from"../shaders/CutFillDepthTechniqueConfiguration.js";import{C as T}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as y}from"../shaders/CutFillReductionTechnique.js";import{CutFillReductionTechniqueConfiguration as b}from"../shaders/CutFillReductionTechniqueConfiguration.js";import{C as B}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as D}from"../shaders/CutFillTargetDepthTechnique.js";import{ImmediateTask as j,TaskPriority as q}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";import{PrimitiveType as S,DataType as O}from"../../../webgl/enums.js";import{Sync as v}from"../../../webgl/Sync.js";import{VertexBuffer as V}from"../../../webgl/VertexBuffer.js";let A=class extends C{constructor(t){super(t),this.consumes={required:[d.TRANSPARENT]},this.produces=p.CUTFILL_COMPUTATION,this._cutFillTargetDepthConfiguration=new F,this._cutFillDepthConfiguration=new P,this._cutFillReductionConfiguration=new b,this._cutFillTargetDepthParameters=new B,this._cutFillDepthParameters=new w,this._cutFillReductionParameters=new T,this.needsRender=!1,this.readyToRun=!1,this.done=!0,this._frameTask=j,this._result=new k,this._localOrigin=a(),this._maxTextureSize=512,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=13,this._colorFormat=10,this._numChannels=2,this._targetGeometryVao=null,this._numReductions=3,this._reductionPasses=0,this._pixelBufferSize=0,this._pixelBufferOffset=0,this._perReductionPixelBufferSize=0}initialize(){this._frameTask=this.view.resourceController.scheduler.registerTask(q.VOLUME_MEASUREMENT,this),this.addHandles(this._frameTask),this._maxTextureSize=Math.min(this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=9,this._frustum=new _(this.view.renderCoordsHelper)}destroy(){this._targetGeometryVao=i(this._targetGeometryVao);const t=this.gl;this._sync=r(this._sync),this._pixelBuffer&&(t.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null,this._pixelBufferSize=0)}precompile(){this.techniques.precompile(D,this._cutFillTargetDepthConfiguration),this._cutFillDepthConfiguration.preparePass=0,this.techniques.precompile(x,this._cutFillDepthConfiguration),this._cutFillDepthConfiguration.preparePass=1,this.techniques.precompile(x,this._cutFillDepthConfiguration),this._cutFillReductionConfiguration.reductionPass=0,this.techniques.precompile(y,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=1,this.techniques.precompile(y,this._cutFillReductionConfiguration),this._cutFillReductionConfiguration.reductionPass=2,this.techniques.precompile(y,this._cutFillReductionConfiguration),this.view.stage.renderer.precompileCutFillOrthographicReferenceDepth()}render(t){const e=t.find(({name:t})=>t===this.produces);if(!this._orthographicCamera||!this._targetGeometryVao||!this.needsRender||this._sync)return e;const i=this.techniques.getCompiled(D,this._cutFillTargetDepthConfiguration);this._cutFillDepthConfiguration.preparePass=0;const r=this.techniques.getCompiled(x,this._cutFillDepthConfiguration);this._cutFillDepthConfiguration.preparePass=1;const s=this.techniques.getCompiled(x,this._cutFillDepthConfiguration);this._cutFillReductionConfiguration.reductionPass=0;const h=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=1;const o=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);this._cutFillReductionConfiguration.reductionPass=2;const n=this.techniques.getCompiled(y,this._cutFillReductionConfiguration);if(!(i&&r&&s&&h&&o&&n))return this.requestRender(1),e;this.needsRender=!1;const u=this.renderingContext,a=this.fboCache,d=this.gl,p=u.getViewport(),_=a.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);u.bindFramebuffer(_.fbo),u.setViewport(0,0,this._width,this._height),u.clear(1280),this.view.stage.renderer.renderCutFillOrthographicReferenceDepth(this._orthographicCamera);const f=a.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);u.bindFramebuffer(f.fbo),u.setViewport(0,0,this._width,this._height),u.setClearDepth(1),u.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,u.bindTechnique(i,this.bindParameters,this._cutFillTargetDepthParameters),u.bindVAO(this._targetGeometryVao),u.drawArrays(S.TRIANGLES,0,this._targetGeometryVao.vertexCount("geometry"));const m=a.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),g=a.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);return this._cutFillDepthParameters.referenceDepthTexture=_.depthTexture,this._cutFillDepthParameters.targetDepthTexture=f.depthTexture,this._pixelBuffer||(this._pixelBuffer=d.createBuffer()),d.bindBuffer(d.PIXEL_PACK_BUFFER,this._pixelBuffer),d.bufferData(d.PIXEL_PACK_BUFFER,this._pixelBufferSize,d.STREAM_READ),this._prepareFBO(m,this.width,this.height),u.bindTechnique(r,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,h),this._prepareFBO(m,this.width,this.height,c),u.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,o),this._prepareFBO(m,this.width,this.height,l),u.bindTechnique(s,this.bindParameters,this._cutFillDepthParameters),u.screen.draw(),this._runPyramidReduction(m,g,n),_.release(),f.release(),m.release(),g.release(),d.bindBuffer(d.PIXEL_PACK_BUFFER,null),u.setViewport(p.x,p.y,p.width,p.height),this._sync=new v(d),setTimeout(()=>this.readyToRun=!0,0),e}update(t,i){if(!this.done)return;this.done=!1;const r=this.renderingContext,{cameraDimensions:{width:s,height:h},localOriginRenderSpace:o}=t,n=this._maxTextureSize,u=h/s,a=s>h?n:n/u,c=s>h?n*u:n;this._width=e(a),this._height=e(c);const l=[this._width,this._height];this._orthographicCamera=this._createCamera(t,l),this._frustum?.update(this._orthographicCamera),this._updateTargetVao(r,i),this._localOrigin=o,this._reductionPasses=Math.ceil(Math.log2(Math.min(this._width,this._height))),this._reducedWidth=Math.ceil(this._width/2**this._reductionPasses),this._reducedHeight=Math.ceil(this._height/2**this._reductionPasses),this._perReductionPixelBufferSize=this._reducedWidth*this._reducedHeight*this._numChannels*4,this._pixelBufferSize=this._perReductionPixelBufferSize*this._numReductions,this._pixelBufferOffset=0,this.needsRender=!0,this.requestRender(1)}runTask(){if(!this._sync)return void(this.readyToRun=!1);try{if(!this._sync.poll())return E}catch(e){return this.readyToRun=!1,void(this._sync=r(this._sync))}this.readyToRun=!1,this._sync=r(this._sync);const t=this.gl;this._cpuBuffer=new Float32Array(this._pixelBufferSize/4),t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this._updateResults(this._cpuBuffer),this.done=!0}getResult(){return this._result}get frustum(){return this._frustum}get width(){return this._width}get height(){return this._height}get updating(){return this.readyToRun||!this.done||this._frameTask.updating}_runPyramidReduction(t,e,i){const r=this.renderingContext,s=this.gl;let h=this._width,o=this._height;for(let n=0;n<this._reductionPasses;n++)h=Math.ceil(h/2),o=Math.ceil(o/2),this._cutFillReductionParameters.depthTexture=t.getTexture(),this._prepareFBO(e,h,o),r.bindTechnique(i,this.bindParameters,this._cutFillReductionParameters),r.screen.draw(),[t,e]=[e,t];s.readPixels(0,0,h,o,33319,O.FLOAT,this._pixelBufferOffset),this._pixelBufferOffset+=this._perReductionPixelBufferSize}_updateResults(t){const e=new U(0,1,u()),i=new U(0,0,u());for(let r=0;r<this._reducedWidth;r++)for(let s=0;s<this._reducedHeight;s++){let h=(r+s*this._reducedWidth)*this._numChannels;const o=this._reducedWidth*this._reducedHeight*this._numChannels;e.totalDepth+=t[h],i.totalDepth+=t[h+1],h+=o;const n=t[h];n<e.depthExtremum&&(e.depthExtremum=n,M(e.depthExtremumCoords,t[h+1],this._width)),h+=o;const u=t[h];u>i.depthExtremum&&(i.depthExtremum=u,M(i.depthExtremumCoords,t[h+1],this._width))}this._result=new k(this._width,this._height,e,i)}_prepareFBO(t,e,i,r=l){const s=this.renderingContext;s.bindFramebuffer(t.fbo),s.setViewport(0,0,e,i),s.setClearColor(r[0],r[1],r[2],r[3]),s.clear(16384)}_createCamera(t,e){const{cameraPositionRenderSpace:i,localOriginRenderSpace:r,northVector:s,cameraDimensions:{width:h,height:n},cameraNearFar:{near:u,far:a}}=t,c=new g({eye:i,center:r,up:s,near:u,far:a});return c.viewport=[0,0,e[0],e[1]],o(c.projectionMatrix,-h/2,h/2,-n/2,n/2,u,a),c}_updateTargetVao(t,e){this._targetGeometryVao=i(this._targetGeometryVao);const r=e.indices.length,s=z.createBuffer(r),h=s.position,{positions:o,indices:n}=e;for(let i=0;i<n.length;++i){const t=3*n[i];h.set(i,0,o[t]),h.set(i,1,o[t+1]),h.set(i,2,o[t+2])}const u=new V(t,f(z),s.buffer);this._targetGeometryVao=new R(t,u)}};t([s()],A.prototype,"consumes",void 0),t([s()],A.prototype,"produces",void 0),t([s()],A.prototype,"needsRender",void 0),t([s()],A.prototype,"readyToRun",void 0),t([s()],A.prototype,"done",void 0),t([s()],A.prototype,"updating",null),t([s()],A.prototype,"_frameTask",void 0),A=t([h("esri.views.3d.webgl-engine.lib.CutFillComputationRenderNode")],A);const z=m().vec3f("position").freeze();function M(t,e,i){const r=e%i,s=Math.floor(e/i);n(t,r,s)}class L{constructor(t,e){this.positions=t,this.indices=e}}class U{constructor(t,e,i){this.totalDepth=t,this.depthExtremum=e,this.depthExtremumCoords=i}}class k{constructor(t=0,e=0,i=new U(0,1,u()),r=new U(0,0,u())){this.width=t,this.height=e,this.cut=i,this.fill=r}}export{A as CutFillComputationRenderNode,k as CutFillComputationResult,U as CutFillDepthResult,L as TargetGeometryRenderInfo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import c from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as h}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as d}from"../shaders/CutFillCompositionTechnique.js";import{C as f}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as p}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as C,DefaultMaterialDrawParameters as _,DefaultMaterialTechnique as b}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as g}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as V,PrimitiveType as v}from"../../../webgl/enums.js";import{noParameters as T}from"../../../webgl/NoParameters.js";import{VertexBuffer as w}from"../../../webgl/VertexBuffer.js";let F=class extends c{constructor(e){super(e),this.consumes={required:[l.CUTFILL_COLOR,l.GROUND_DEPTH]},this.produces=l.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._maskParameters=new f,this._cutVolumeParameters=new C,this._fillVolumeParameters=new C,this._compositeParameters=new h,this._drawParameters=new _;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new g(t),this._cutVolumeConfiguration.customDepthTest=2,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new g(t),this._fillVolumeConfiguration.customDepthTest=1,this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}
|
|
2
|
+
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import c from"../../webgl/RenderNode.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as h}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as d}from"../shaders/CutFillCompositionTechnique.js";import{C as f}from"../../../../chunks/CutFillMask.glsl.js";import{CutFillMaskTechnique as p}from"../shaders/CutFillMaskTechnique.js";import{DefaultMaterialPassParameters as C,DefaultMaterialDrawParameters as _,DefaultMaterialTechnique as b}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as g}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{DepthStencilAttachment as V,PrimitiveType as v}from"../../../webgl/enums.js";import{noParameters as T}from"../../../webgl/NoParameters.js";import{VertexBuffer as w}from"../../../webgl/VertexBuffer.js";let F=class extends c{constructor(e){super(e),this.consumes={required:[l.CUTFILL_COLOR,l.GROUND_DEPTH]},this.produces=l.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._maskParameters=new f,this._cutVolumeParameters=new C,this._fillVolumeParameters=new C,this._compositeParameters=new h,this._drawParameters=new _;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new g(t),this._cutVolumeConfiguration.customDepthTest=2,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new g(t),this._fillVolumeConfiguration.customDepthTest=1,this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}precompile(){"cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0),this.techniques.precompile(b,this._cutVolumeConfiguration),this.techniques.precompile(b,this._fillVolumeConfiguration),this.techniques.precompile(p),this.techniques.precompile(d)}render(e){const t=this.techniques.getCompiled(b,this._cutVolumeConfiguration),i=this.techniques.getCompiled(b,this._fillVolumeConfiguration),s=this.techniques.getCompiled(p),o=this.techniques.getCompiled(d),r=e.find(({name:e})=>e===this.produces);if(!this._vaoCut||!this._vaoFill)return r;const a=this._vaoCut.vertexCount("geometry"),u=this._vaoFill.vertexCount("geometry");if(!(t&&i&&s&&o))return this.requestRender(1),r;const n=this.bindParameters,c=n.camera,m=c.fullViewport[2],h=c.fullViewport[3],f=this.renderingContext,C=this.fboCache,_=e.find(({name:e})=>e===l.GROUND_DEPTH),g=C.acquire(m,h,"cutfill color mask",2);g.attachDepth(_.getAttachment(V)),f.bindFramebuffer(g.fbo),f.setClearColor(0,0,0,1),f.clear(17408),f.setViewport(0,0,m,h),f.bindTechnique(s,n,T,this._maskParameters),f.setFaceCullingEnabled(!1),f.setStencilTestEnabled(!0),f.setStencilOpSeparate(1028,7680,34055,7680),f.setStencilOpSeparate(1029,7680,34056,7680),f.setDepthWriteEnabled(!1),f.bindVAO(this._vaoCut),f.setDepthTestEnabled(!0),f.setStencilWriteMask(255),f.setStencilFunction(519,0,255),f.setColorMask(!1,!1,!1,!1),f.drawArrays(v.TRIANGLES,0,a),f.setDepthTestEnabled(!1),f.setStencilWriteMask(0),f.setStencilFunction(517,0,255),f.setColorMask(!0,!1,!1,!1),f.drawArrays(v.TRIANGLES,0,a),f.bindVAO(this._vaoFill),f.setDepthTestEnabled(!0),f.setStencilWriteMask(255),f.setStencilFunction(519,0,255),f.setColorMask(!1,!0,!1,!1),f.drawArrays(v.TRIANGLES,0,u);const w=C.acquire(m,h,"cutfill color cut volume",5);w.acquireDepth(13),f.blitFramebuffer(r.fbo,w.fbo,256),f.bindFramebuffer(w.fbo),f.setClearColor(0,0,0,0),f.clear(16384),f.setColorMask(!0,!0,!0,!0),f.bindTechnique(t,this.bindParameters,this._cutVolumeParameters,this._drawParameters),f.bindVAO(this._vaoCut),f.drawArrays(v.TRIANGLES,0,a);const F=C.acquire(m,h,"cutfill color fill volume",5);F.acquireDepth(13),f.blitFramebuffer(r.fbo,F.fbo,256),f.bindFramebuffer(F.fbo),f.setClearColor(0,0,0,0),f.clear(16384),f.setColorMask(!0,!0,!0,!0),f.bindTechnique(i,this.bindParameters,this._fillVolumeParameters,this._drawParameters),f.bindVAO(this._vaoFill),f.drawArrays(v.TRIANGLES,0,u);const P=this.fboCache.acquire(m,h,this.produces);return f.bindFramebuffer(P.fbo),this._compositeParameters.color=r.getTexture(),this._compositeParameters.cutVolume=w.getTexture(),this._compositeParameters.fillVolume=F.getTexture(),this._compositeParameters.cutFillMask=g.getTexture(),this._compositeParameters.sceneDepth=r.getTexture(V),this._compositeParameters.referenceDepth=_.getTexture(V),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor),f.bindTechnique(o,n,this._compositeParameters),f.screen.draw(),g.release(),w.release(),F.release(),P.attachDepth(r.getAttachment(V)),P}enable(){this.produces=l.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,a(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const{vertices:t,normals:i,indicesBottom:s,indicesExtruded:o}=e,r=s.length+o.length,a=this.renderingContext,l=P.createBuffer(r),{position:n,normal:c}=l;let h=0;for(let u=0;u<s.length;u++){const e=3*s[u];n.set(h,0,t[e]),n.set(h,1,t[e+1]),n.set(h,2,t[e+2]),c.set(h,0,i[e]),c.set(h,1,i[e+1]),c.set(h,2,i[e+2]),h++}for(let u=0;u<o.length;u++){const e=3*o[u];n.set(h,0,t[e]),n.set(h,1,t[e+1]),n.set(h,2,t[e+2]),c.set(h,0,i[e]),c.set(h,1,i[e+1]),c.set(h,2,i[e+2]),h++}const d=new w(a,u(P),l.buffer);return new m(a,d)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],F.prototype,"consumes",void 0),e([o()],F.prototype,"produces",void 0),e([o()],F.prototype,"cutColor",void 0),e([o()],F.prototype,"fillColor",void 0),e([o()],F.prototype,"borderColor",void 0),e([o()],F.prototype,"measureType",void 0),F=e([r("esri.views.3d.webgl-engine.lib.CutFillVisualizationRenderNode")],F);const P=n().vec3f("position").vec3f("normal").freeze();class q{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{F as CutFillVisualizationRenderNode,q as VolumeGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,set as o,scale as n,floor as h,subtract as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,set as
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,set as o,scale as n,floor as h,subtract as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,set as c,positiveInfinity as u,equals as d}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as _}from"../../webgl.js";import g from"../../webgl/RenderNode.js";import{G as f}from"../../../../chunks/GaussianSplat.glsl.js";import{G as P}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as C}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as b}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as S}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as v}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as x}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as E,PrimitiveType as T}from"../../../webgl/enums.js";var D;let y=class extends g{static{D=this}constructor(e){super(e),this.produces=_.GAUSSIAN_SPLAT,this.consumes={required:[_.GAUSSIAN_SPLAT]},this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new f,this._compositionPassParameters=new P,this._depthCompositionPassParameters=new S,this._compositionConfiguration=new b,this._clipBox=m(),this._previousCameraDirection=p(),this._previousSortRequestCameraDirection=p(),this._sortRequestDirectionEpsilon=.01,this._directionChangeEpsilon=.001,this._configuration=new q(e.view.state.isGlobal),c(this._clipBox,u)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>2===this.view.state.mode,()=>this.requestRender(1))])}precompile(){this._updateTechniqueConfiguration(),this.techniques.precompile(x,this._configuration),this._compositionConfiguration.hasEmission=this.bindParameters.hasEmission,this.techniques.precompile(C,this._compositionConfiguration),this.techniques.precompile(v)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return t;const i=t.getAttachment(w);this._compositionConfiguration.hasEmission=null!=i;const s=this.techniques.getCompiled(x,this._configuration),a=this.techniques.getCompiled(C,this._compositionConfiguration),r=this.techniques.getCompiled(v);if(!s||!r||!a)return this.requestRender(1),t;const{fullWidth:o,fullHeight:n}=this.bindParameters.camera;this._prepareParameters(n,o);const h=this.renderingContext,l=this.fboCache,p=l.acquire(o,n,"gaussian color output"),m=t.getAttachment(E);p.attachDepth(m),this._renderGaussianColorAndDepth(p,s);const c=l.acquire(o,n,this.produces);return this._depthCompositionPassParameters.splatDepth=p.getTexture(w),c.attachDepth(t.getAttachment(E)),h.bindFramebuffer(c.fbo),h.bindTechnique(r,this.bindParameters,this._depthCompositionPassParameters),h.screen.draw(),this._compositionPassParameters.color=t.getTexture(),this._compositionPassParameters.splatColor=p.getTexture(),i?(c.acquireColor(w,8,"emissive"),this._compositionPassParameters.emission=t.getTexture(w)):this._compositionPassParameters.emission=null,h.bindFramebuffer(c.fbo),h.bindTechnique(a,this.bindParameters,this._compositionPassParameters),h.screen.draw(),p.release(),c}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const t=e||u;this._hasSameClipBox(t)||(c(this._clipBox,t),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get _clippingEnabled(){return!d(this._clipBox,u,(e,t)=>e===t)}get _fragmentShadowsEnabled(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _fadeHelper(){return this.layerView.fadeHelper}_updateTechniqueConfiguration(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.fragmentShadows=this._configuration.receiveShadows&&this._fragmentShadowsEnabled,this._configuration.hasShadowHighlights=this._configuration.fragmentShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}destroy(){super.destroy()}_onCameraChange(){const e=this.view.state.camera.ray.direction;if(!this._directionChanged(e))return;if(r(this._previousCameraDirection,e),!this._shouldRequestSort(e))return;this._data.requestSort()&&r(this._previousSortRequestCameraDirection,e)}_directionChanged(e){return Math.abs(e[0]-this._previousCameraDirection[0])>this._directionChangeEpsilon||Math.abs(e[1]-this._previousCameraDirection[1])>this._directionChangeEpsilon||Math.abs(e[2]-this._previousCameraDirection[2])>this._directionChangeEpsilon}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_prepareParameters(e,t){this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const i=Math.tan(.5*this.camera.fovY),s=i/e*t;a(this._passParameters.tanFov,s,i),this._passParameters.focalLength=e/(2*i);const o=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=o*Math.sqrt(t*e)/Math.sqrt(2073600),r(this._passParameters.origin,this.bindParameters.camera.eye),this._prepareHighPrecisionCameraPosition(),this._updateSlicePlaneLocalOrigin(),this._updateClipUniforms()}_updateClipUniforms(){if(this._clippingEnabled){const[e,t,i,s,a,r]=this._clipBox,[n,h,l]=this.camera.eye;o(this._passParameters.clipMinCameraRelative,e-n,t-h,i-l),o(this._passParameters.clipMaxCameraRelative,s-n,a-h,r-l)}}_updateSlicePlaneLocalOrigin(){this._passParameters.slicePlaneLocalOrigin=this.camera.eye}_hasSameClipBox(e){return d(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){const i=this.renderingContext;e.acquireColor(w,5,"gaussian depth output"),i.bindFramebuffer(e.fbo),i.setClearColor(0,0,0,0),i.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(T.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_prepareHighPrecisionCameraPosition(){n(this._passParameters.tileCameraPosition,this.camera.eye,1/D.tileSize),h(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),n(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,D.tileSize),l(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this._fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this._fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};e([i()],y.prototype,"produces",void 0),e([i()],y.prototype,"consumes",void 0),e([i({constructOnly:!0})],y.prototype,"layerView",void 0),y=D=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],y);export{y as GaussianSplatRenderNode};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as m,sync as u}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as I}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as R,InternalRenderCategory as S,AllRenderNodeOutputs as O,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as G}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as x}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as H}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as y}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as q}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as V}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{RenderContext as J,defaultRenderOccludedMask as K}from"./RenderContext.js";import{RendererBase as Z}from"./RendererBase.js";import{setupFeatureDefaults as ee}from"./RenderFeature.js";import{RenderPluginInput as te}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ie}from"./ShadowMap.js";import re from"./SliceHelper.js";import{MergedRenderer as ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ne}from"../parts/renderUtils.js";import{RendererPerformanceInfo as he,PerformanceCategory as oe}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as de,PixelType as le,ColorAttachment2 as me,ColorAttachment0 as ue,DrawBufferNone as _e}from"../../../webgl/enums.js";let pe=class extends Z{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new re,this.sceneDepthRange=_(Y.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("global-illumination"),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new te,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Re)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new x(i),this._compositor=new z(i,s),this._renderStateFeatures=_(ee(e.view.qualityProfile));const a=new ie(this._fboCache,e.viewingMode);this._renderContext=new J(this._rctx,a,s),this._framebuffer=new $(this._fboCache,this._bindParameters),this._performanceInfo=new he(this._rctx),this._blit=new U(s),this._shadowAccumulator=new se(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,s,i)=>{const r=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,i,!0,r),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},r),this._nodes=new v(this._renderContext),this._plugins=new M({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>G.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},m),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;I(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=y,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>r(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},m),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ae.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new V(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=ee(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmissions(){return this._plugins.hasEmissions}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ge(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),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&&b(this._bindParameters.reprojection.matrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?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,s,i=!1){try{return this._isRendering=!0,this._render(e,t,s,i)}catch(r){console.error(`Exception during rendering: ${r}:\n${r.stack}`)}finally{this._isRendering=!1}return new ne(this._pluginInput.get(R.FINAL),null)}_render(e,t,s,i){const r=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:l}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.emissions=this._hasEmissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const m=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=m?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(S.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(S.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(S.CUTFILL_COLOR),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,_=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(_?.retain(p-1),_?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=_):_?.release(),this._ensureBindParameters(a,o,t),this._plugins.sortTestsTransparentOrderedSlots(Ae),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!i,this._hasTransparentGeometry=this._plugins.produces(0,...be),this._precompilePrepasses(),this.performanceInfo.advance(oe.PREPARE);const c=this._computeShadowDepthRange(a);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(a,o,this._bindParameters.lighting.mainLight.direction,c),this._renderShadowAccumulation(c,!r),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0;this._bindParameters.hasOpaqueEmissions||0===this._bindParameters.emissions?(this._renderOpaque(),this._renderPreTransparent()):(this._bindParameters.emissions=0,this._renderOpaque(),this._renderPreTransparent(),this._bindParameters.emissions=2),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(S.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(S.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(S.VIEWSHED,e)),u.update(e=>this._renderNodes(S.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(S.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(S.CUTFILL_COLOR,e)),this._pluginInput.release(S.FOCUSAREA),this._pluginInput.release(S.GROUND_DEPTH),u.update(e=>this._renderNodes(S.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const b=2===s?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),this.hasGlobalIllumination&&this._hasEmissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(de)),u.update(e=>this._renderNodes(S.ANTIALIASING,e));const f=this._hasTransparentGeometry?2:1;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(S.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.emissions=this._hasEmissions,u.update(e=>this._renderNodes(S.MAGNIFIER,e)),u.update(e=>this._renderNodes(R.FINAL,e)),r&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),r||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new ne(g,b)}_precompileShaders(e){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const t=this._bindParameters,s=t.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(s,S.OPAQUE_ENVIRONMENT,S.GAUSSIAN_SPLAT,S.OPAQUE_OCCLUSION_QUERY,S.VOXEL);if(2===this._bindParameters.emissions&&(this._bindParameters.emissions=0,this._precompileOpaqueGeometry(),this._bindParameters.emissions=2),this._bindParameters.output=3,this._plugins.precompile(...fe),this._bindParameters.output=0,this._plugins.precompile(...fe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1),this._precompileTransparentGeometry()}this._nodes.precompile(s,S.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(s,S.TRANSPARENT_ENVIRONMENT,S.VIEWSHED,S.CUTFILL_COMPUTATION,S.CUTFILL_COLOR,S.LASERLINES,S.FOCUSAREA_COLOR,S.OCCLUDED,S.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=this._hasEmissions,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(s,S.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(s,R.COMPOSITE,S.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),s&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(S.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(oe.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,"olid");return i.acquireDepth(13),i=this._nodes.render(i,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(oe.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,le.UNSIGNED_BYTE,t),r.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?oe.OPAQUE_EDGES:oe.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(oe.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(S.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(oe.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(S.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output;t.bindFramebuffer();for(const i of t.cascades)i.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(i.camera,i.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=s}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(S.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(oe.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(oe.DEPTH)}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=X(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<q)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=F,t.far=1e10;const s=X(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...O,S.VIEWSHED,S.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,ge),this._needsDepth&&this._precompilePlugins(3,Pe)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,S.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,S.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals",5);i.acquireDepth(13),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...ge);const r=this._nodes.optional("normals",...O,S.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(oe.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(S.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(oe.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const e=this._nodes.produce(S.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(oe.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor),this._bindParameters.reprojection.lastFrameDepth=h(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=h(this._bindParameters.reprojection.lastFrameEmission),this._bindParameters.globalIllumination=h(this._bindParameters.globalIllumination),this._bindParameters.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...fe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...we);this._renderContext.renderOccludedMask=K}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...we),this._renderContext.renderOccludedMask=K}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,Te)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Te),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,S.GROUND_DEPTH,13);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Pe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ce),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ce)}_renderTransparentGeometry(){this._plugins.render(...be),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...fe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(de);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?oe.HUD_OCCLUDED:oe.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>j?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),B(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(oe.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ie),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(oe.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){H(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...be),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...be),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...be)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",m=this.fboCache.acquire(i,r,l,o),u=h.hasEmission&&(0===e||1!==t);u&&m.acquireColor(de,o,"oit emissive");const _=u?me:de;m.acquireColor(_,this.hasFloatBlend?7:0,"oit alpha"),s||m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,C),a(),m.detachDepth(),h.output=2;const p=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");u&&p.acquireColor(de,o,"oit front emissive"),s?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(C,s),a(),p.detachDepth();const c=this._pluginsHas.occludedHudElements&&!s;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(_,0,"hud occlusion"),this._rctx.clearBuffer(_-ue,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,m,p,h,u,c,e),b?.detachDepth(),s||c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(_)),p.release(),m.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ce)||this.plugins.produces(5,...ce)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(S.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(R.OPAQUE,t,e)),this.fboCache.debugCallback?.(R.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(S.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(S.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(S.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(S.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(S.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(S.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(S.VOXEL,e)),this.fboCache.debugCallback?.(S.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;2===this._bindParameters.emissions&&e.ensureEmissionAttachment(),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(R.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(R.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),this._renderTransparentEnvironment()}_renderTransparentEnvironment(){if(this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(oe.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([_e,de]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(oe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const i=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(i,t.fbo);const r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),r}_ensureBindParameters(e,t,s){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(s),this._ensureBindParametersScreenSpaceReflections(s),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(e){const{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=w);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Oe,t.viewMatrix),f(Se,t.projectionMatrix),g(De,Oe,Se),g(De,s.viewMatrix,De),g(De,s.projectionMatrix,De),this._reprojectionMatrix=De):this._reprojectionMatrix=w,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Fe,s.viewMatrix,Oe),P(t,Fe)):P(t,w)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],pe.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([p()],pe.prototype,"_edgeView",void 0),e([p()],pe.prototype,"updating",null),pe=e([c("esri.views.3d.webgl-engine.lib.Renderer")],pe);const ce=[0,1,2,3],be=[7,6,4,5],fe=[7,6],ge=[0,1,2,4,...fe],Pe=[3,5],we=[2,4,8],Ee=[16,12,14,13],Ie=[4,5,2,3,0,1,...fe],Ae=[4,8,5,11],Ce={0:[13],1:[12],2:[13,12],3:[13,12]},Te=[0,1,...fe],Re=["normals","highlights"],Se=E(),Oe=E(),De=E(),Fe=E();function Ge(e){return t=>e.immediate.schedule(t)}export{pe as Renderer};
|
|
2
|
+
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as m,sync as u}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as w,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as I}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as R,InternalRenderCategory as S,AllRenderNodeOutputs as O,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as G}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as x}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as H}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as y}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as q}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as V}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as $}from"./MainFramebuffer.js";import{RenderContext as J,defaultRenderOccludedMask as K}from"./RenderContext.js";import{RendererBase as Z}from"./RendererBase.js";import{setupFeatureDefaults as ee}from"./RenderFeature.js";import{RenderPluginInput as te}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ie}from"./ShadowMap.js";import re from"./SliceHelper.js";import{MergedRenderer as ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ne}from"../parts/renderUtils.js";import{RendererPerformanceInfo as he,PerformanceCategory as oe}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as de,PixelType as le,ColorAttachment2 as me,ColorAttachment0 as ue,DrawBufferNone as _e}from"../../../webgl/enums.js";let pe=class extends Z{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new re,this.sceneDepthRange=_(Y.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("global-illumination"),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new te,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Re)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new x(i),this._compositor=new z(i,s),this._renderStateFeatures=_(ee(e.view.qualityProfile));const a=new ie(this._fboCache,e.viewingMode);this._renderContext=new J(this._rctx,a,s),this._framebuffer=new $(this._fboCache,this._bindParameters),this._performanceInfo=new he(this._rctx),this._blit=new U(s),this._shadowAccumulator=new se(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,s,i)=>{const r=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,i,!0,r),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},r),this._nodes=new v(this._renderContext),this._plugins=new M({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>G.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},m),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;I(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=y,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>r(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},m),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ae.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new V(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=ee(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmissions(){return this._plugins.hasEmissions}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ge(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),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&&b(this._bindParameters.reprojection.matrix,w)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?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,s,i=!1){try{return this._isRendering=!0,this._render(e,t,s,i)}catch(r){console.error(`Exception during rendering: ${r}:\n${r.stack}`)}finally{this._isRendering=!1}return new ne(this._pluginInput.get(R.FINAL),null)}_render(e,t,s,i){const r=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:l}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.emissions=this._hasEmissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const m=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=m?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(S.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(S.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(S.CUTFILL_COLOR),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,_=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(_?.retain(p-1),_?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=_):_?.release(),this._ensureBindParameters(a,o,t),this._plugins.sortTestsTransparentOrderedSlots(Ae),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!i,this._hasTransparentGeometry=this._plugins.produces(0,...be),this._precompilePrepasses(),this.performanceInfo.advance(oe.PREPARE);const c=this._computeShadowDepthRange(a);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(a,o,this._bindParameters.lighting.mainLight.direction,c),this._renderShadowAccumulation(c,!r),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0;this._bindParameters.hasOpaqueEmissions||0===this._bindParameters.emissions?(this._renderOpaque(),this._renderPreTransparent()):(this._bindParameters.emissions=0,this._renderOpaque(),this._renderPreTransparent(),this._bindParameters.emissions=2),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(S.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(S.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(S.VIEWSHED,e)),u.update(e=>this._renderNodes(S.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(S.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(S.CUTFILL_COLOR,e)),this._pluginInput.release(S.FOCUSAREA),this._pluginInput.release(S.GROUND_DEPTH),u.update(e=>this._renderNodes(S.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const b=2===s?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),this.hasGlobalIllumination&&this._hasEmissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(de)),u.update(e=>this._renderNodes(S.ANTIALIASING,e));const f=this._hasTransparentGeometry?2:1;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(S.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.emissions=this._hasEmissions,u.update(e=>this._renderNodes(S.MAGNIFIER,e)),u.update(e=>this._renderNodes(R.FINAL,e)),r&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),r||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new ne(g,b)}_precompileShaders(e){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const t=this._bindParameters,s=t.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(s,S.OPAQUE_ENVIRONMENT,S.GAUSSIAN_SPLAT,S.OPAQUE_OCCLUSION_QUERY,S.VOXEL);if(2===this._bindParameters.emissions&&(this._bindParameters.emissions=0,this._precompileOpaqueGeometry(),this._bindParameters.emissions=2),this._bindParameters.output=3,this._plugins.precompile(...fe),this._bindParameters.output=0,this._plugins.precompile(...fe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1),this._precompileTransparentGeometry()}this._nodes.precompile(s,S.FOCUSAREA),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(s,S.TRANSPARENT_ENVIRONMENT,S.VIEWSHED,S.CUTFILL_COMPUTATION,S.CUTFILL_COLOR,S.LASERLINES,S.FOCUSAREA_COLOR,S.OCCLUDED,S.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=this._hasEmissions,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(s,S.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(s,R.COMPOSITE,S.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),s&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(S.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(oe.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,"olid");return i.acquireDepth(13),i=this._nodes.render(i,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(oe.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,le.UNSIGNED_BYTE,t),r.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?oe.OPAQUE_EDGES:oe.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(oe.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(S.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(oe.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(S.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output;t.bindFramebuffer();for(const i of t.cascades)i.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(i.camera,i.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=s}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(S.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(oe.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(oe.DEPTH)}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=X(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<q)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=F,t.far=1e10;const s=X(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...O,S.VIEWSHED,S.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,ge),this._needsDepth&&this._precompilePlugins(3,Pe)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,S.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&(this._shadowAccumulator.precompilePrepass(),this._precompileAllGeometry(5)),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,S.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals",5);i.acquireDepth(13),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...ge);const r=this._nodes.optional("normals",...O,S.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(oe.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(S.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(oe.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const e=this._nodes.produce(S.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(oe.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor),this._bindParameters.reprojection.lastFrameDepth=h(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=h(this._bindParameters.reprojection.lastFrameEmission),this._bindParameters.globalIllumination=h(this._bindParameters.globalIllumination),this._bindParameters.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...fe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...we);this._renderContext.renderOccludedMask=K}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...we),this._renderContext.renderOccludedMask=K}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,Te)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Te),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,S.GROUND_DEPTH,13);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Pe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ce),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ce)}_renderTransparentGeometry(){this._plugins.render(...be),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...fe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(de);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?oe.HUD_OCCLUDED:oe.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>j?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),B(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(oe.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ie),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(oe.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){H(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...be),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...be),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...be)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",m=this.fboCache.acquire(i,r,l,o),u=h.hasEmission&&(0===e||1!==t);u&&m.acquireColor(de,o,"oit emissive");const _=u?me:de;m.acquireColor(_,this.hasFloatBlend?7:0,"oit alpha"),s||m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,C),a(),m.detachDepth(),h.output=2;const p=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");u&&p.acquireColor(de,o,"oit front emissive"),s?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(C,s),a(),p.detachDepth();const c=this._pluginsHas.occludedHudElements&&!s;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(_,0,"hud occlusion"),this._rctx.clearBuffer(_-ue,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,m,p,h,u,c,e),b?.detachDepth(),s||c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(_)),p.release(),m.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ce)||this.plugins.produces(5,...ce)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(S.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(R.OPAQUE,t,e)),this.fboCache.debugCallback?.(R.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(S.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(S.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(S.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(S.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(S.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(S.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(S.VOXEL,e)),this.fboCache.debugCallback?.(S.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;2===this._bindParameters.emissions&&e.ensureEmissionAttachment(),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(R.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(R.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),this._renderTransparentEnvironment()}_renderTransparentEnvironment(){if(this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(oe.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([_e,de]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(oe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const i=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(i,t.fbo);const r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),r}_ensureBindParameters(e,t,s){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(s),this._ensureBindParametersScreenSpaceReflections(s),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(e){const{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=w);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Oe,t.viewMatrix),f(Se,t.projectionMatrix),g(De,Oe,Se),g(De,s.viewMatrix,De),g(De,s.projectionMatrix,De),this._reprojectionMatrix=De):this._reprojectionMatrix=w,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Fe,s.viewMatrix,Oe),P(t,Fe)):P(t,w)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],pe.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([p()],pe.prototype,"_edgeView",void 0),e([p()],pe.prototype,"updating",null),pe=e([c("esri.views.3d.webgl-engine.lib.Renderer")],pe);const ce=[0,1,2,3],be=[7,6,4,5],fe=[7,6],ge=[0,1,2,4,...fe],Pe=[3,5],we=[2,4,8],Ee=[16,12,14,13],Ie=[4,5,2,3,0,1,...fe],Ae=[4,8,5,11],Ce={0:[13],1:[12],2:[13,12],3:[13,12]},Te=[0,1,...fe],Re=["normals","highlights"],Se=E(),Oe=E(),De=E(),Fe=E();function Ge(e){return t=>e.immediate.schedule(t)}export{pe as Renderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{sliceEquals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as s}from"../../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as a}from"../../../../core/maybe.js";import{watch as o,sync as n}from"../../../../core/reactiveUtils.js";import{signal as h}from"../../../../core/signal.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{copy as u,equals as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as d}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{F as p}from"../../../../chunks/FocusAreaMask.glsl.js";import{FocusAreaMaskTechnique as f}from"../effects/focusArea/FocusAreaMaskTechnique.js";import{volumeToVao as g}from"../effects/focusArea/focusAreaMaskUtils.js";import{BindParameters as b}from"./BindParameters.js";import{DepthRange as v}from"./DepthRange.js";import{createQuadVAO as S}from"./glUtil3D.js";import{ShadowCastRenderer as y,shadowCastDisabledElevationThreshold as w,shadowCastDisableElevationMax as A,shadowCastDisableElevationMin as F}from"./ShadowCastRenderer.js";import{ShadowMap as x}from"./ShadowMap.js";import{S as C}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as R}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as P}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as q}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{PrimitiveType as H,PixelType as T}from"../../../webgl/enums.js";import{DisposableFramebufferObject as V}from"../../../webgl/FramebufferObject.js";import{noParameters as D}from"../../../webgl/NoParameters.js";let E=class extends t{constructor(e,t,i,s,a,h){super({}),this._fbos=e,this._techniques=t,this._stage=i,this._prepareForShadowMapPass=s,this._renderToShadowMap=a,this._requestRender=h,this._analysisVolumeGeometry=null,this._primarySet=new O(new P(0),()=>this._requestRenderIfEnabled()),this._contextSet=new O(new P(1),()=>this._requestRenderIfEnabled()),this._passParameters=new d,this._maskParameters=new p,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=v.Zero,this._enabled=!1,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._bindParameters=new b(e.rctx,new x(e,i.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=S(e.rctx),this._accumulationRenderer=new y(t,e.rctx,this,h),this._tmpReadFbo=new V(e.rctx);const c=this._stage.view.resourceController.scheduler;this.addHandles([c.registerTask(j.SHADOW_ACCUMULATOR,this),o(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},n),o(()=>this._numActive,()=>this._numActiveChanged(),n),o(()=>this._depthRange,()=>this._invalidateAccumulationSets(),n),o(()=>this.readyToRun,e=>{e||(this._bindParameters.depth=r(this._bindParameters.depth),this.notifyChange("canAccumulate"))}),o(()=>this.accumulating&&this.canAccumulate,()=>this._precompile(),{sync:!0,once:!0})],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=a(this._accumulationRenderer),this._fboHandle=a(this._fboHandle),this._vao=a(this._vao),this._volumeVao=a(this._volumeVao),this._tmpReadFbo=a(this._tmpReadFbo),this._bindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&[...this._accumulationSets()].some(e=>e.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==v.Zero&&this._opacityFromElevation>w}get _doneAccumulating(){return[...this._accumulationSets()].every(e=>e.doneAccumulating)}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get _numActive(){return[...this._accumulationSets()].reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get readyToRun(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some(e=>e.running)}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;if(this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=a(this._volumeVao),this._volumeVertexCount=0,null==e)return;const t=e.geometryVolume,{vao:i,vertexCount:s}=g(this._rctx,t);this._volumeVao=i,this._volumeVertexCount=s}runTask(e){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let t=!1;for(const i of this._accumulationSets())this._runTaskForSet(i,e)&&(t=!0);t&&this._requestRender()}_runTaskForSet(e,t){let i=!1;for(;!t.done&&!e.doneAccumulating;)this._accumulateShadow(e),t.madeProgress(),i=!0;return i}_precompile(){for(const e of this._accumulationSets())this._techniques.precompile(R,e.configuration),this._techniques.precompile(q,e.configuration);this._techniques.precompile(f)}renderAccumulation(e,t){return this._updateCamera(e.camera),this._bindParameters.contentCamera=e.contentCamera,e.depth?.retain(),this._bindParameters.depth?.release(),this._bindParameters.depth=e.depth,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||t?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._renderAreaMask(),this._accumulateSetsForRenderFrame(t))}_renderAreaMask(){const e=this._techniques.getCompiled(f),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(13);const a=this._rctx,o=this._bindParameters,n=o.depth,h=this._tmpReadFbo;h.attachDepthStencil(n?.attachment),a.blitFramebuffer(h,s.fbo,256),h.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const c=a.bindTechnique(e,o);a.setFaceCullingEnabled(!1),a.setStencilTestEnabled(!0),a.setStencilOpSeparate(1028,7680,34055,7680),a.setStencilOpSeparate(1029,7680,34056,7680),a.setDepthWriteEnabled(!1),this._maskParameters.origin=r.origin,c.bindDraw(o,D,this._maskParameters),a.bindVAO(t),a.setDepthTestEnabled(!0),a.setStencilWriteMask(255),a.setStencilFunction(519,0,255),a.setColorMask(!1,!1,!1,!1),a.drawArrays(H.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every(e=>0===e.progress))this._clearFramebuffer();else for(const e of this._accumulationSets())0===e.progress&&this._clearFramebufferForSet(this._fboHandle,e)}_accumulateSetsForRenderFrame(e){let t=!1;for(const i of this._accumulationSets())this._accumulateSetForRenderFrame(i,e)&&(t=!0);return t&&this._requestRender(),t}_accumulateSetForRenderFrame(e,t){let i=t?e.sampleCount:Math.min(M,e.sampleCount);i-=e.progress;for(let s=0;s<i;++s)this._accumulateShadow(e);return i>0}precompile(){this._accumulationRenderer.precompile()}render(e){this._accumulationRenderer.render(e)}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,T.UNSIGNED_BYTE,k),k[0]/i)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this._requestRender()}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=a(this._fboHandle),this._enabled=!1,this._requestRender())}_createFBO(e,t){return this._fbos.acquire(e,t,"shadow accumulation",this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t){if(!e)return;const i=this._techniques.get(q,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(i,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e){this._renderToShadowMap(this._bindParameters,e.lightDirections[e.progress++],this._depthRange);const t=this._techniques.get(R,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(t,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.setStencilTestEnabled(null!=this._analysisVolume),this._rctx.setStencilFunction(517,0,255),this._rctx.drawArrays(t.primitiveType,0,this._vao.vertexCount("geometry"))}_updateCamera(e){if(!this._enabled)return;const t=this._bindParameters.camera;e.equals(t)||t.copyFrom(e),this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight)),this._opacityFromElevation=1-s(F,A,e.relativeElevation)}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get _rctx(){return this._fbos.rctx}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e)}get test(){}};e([c()],E.prototype,"_refining",null),e([c()],E.prototype,"active",null),e([c()],E.prototype,"canAccumulate",null),e([c()],E.prototype,"_doneAccumulating",null),e([c()],E.prototype,"_opacityFromElevation",null),e([c()],E.prototype,"_numActive",null),e([c()],E.prototype,"_colorFormat",null),e([c()],E.prototype,"readyToRun",null),e([c()],E.prototype,"_depthRange",void 0),e([c()],E.prototype,"_enabled",void 0),e([c()],E.prototype,"_previewing",void 0),e([c()],E.prototype,"_accumulationRenderer",void 0),E=e([l("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],E);const M=6,k=new Uint8Array(4);class O{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=h(0),this._sampleCount=h(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,s=Math.min(C,e.length);if(!i(t,0,t.length,e,0,s,m)){t.length=s,this._sampleCount.value=s;for(let i=0;i<s;++i)t[i]=u(t[i]??_(),e[i]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(R,this.configuration),e.precompile(q,this.configuration)}}export{E as ShadowAccumulator};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{sliceEquals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{releaseMaybe as s,disposeMaybe as a}from"../../../../core/maybe.js";import{watch as o,sync as n}from"../../../../core/reactiveUtils.js";import{signal as h}from"../../../../core/signal.js";import{property as c,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{copy as l,equals as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as d}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{F as p}from"../../../../chunks/FocusAreaMask.glsl.js";import{volumeToVao as f}from"../effects/focusArea/focusAreaMaskUtils.js";import{BindParameters as g}from"./BindParameters.js";import{DepthRange as b}from"./DepthRange.js";import{createQuadVAO as v}from"./glUtil3D.js";import{ShadowCastRenderer as y,shadowCastDisabledElevationThreshold as S,shadowCastDisableElevationMax as w,shadowCastDisableElevationMin as A}from"./ShadowCastRenderer.js";import{ShadowMap as F}from"./ShadowMap.js";import{S as C}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as R}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as x}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as P}from"../shaders/ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as q}from"../shaders/ShadowCastMaskTechnique.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{PrimitiveType as H,PixelType as V}from"../../../webgl/enums.js";import{DisposableFramebufferObject as T}from"../../../webgl/FramebufferObject.js";import{noParameters as D}from"../../../webgl/NoParameters.js";let M=class extends t{constructor(e,t,i,r,a,h){super({}),this._fbos=e,this._techniques=t,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=a,this._requestRender=h,this._analysisVolumeGeometry=null,this._primarySet=new O(new x(0),()=>this._requestRenderIfEnabled()),this._contextSet=new O(new x(1),()=>this._requestRenderIfEnabled()),this._passParameters=new d,this._maskParameters=new p,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=b.Zero,this._enabled=!1,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._bindParameters=new g(e.rctx,new F(e,i.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=v(e.rctx),this._accumulationRenderer=new y(t,e.rctx,this,h),this._tmpReadFbo=new T(e.rctx);const c=this._stage.view.resourceController.scheduler;this.addHandles([c.registerTask(j.SHADOW_ACCUMULATOR,this),o(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},n),o(()=>this._numActive,()=>this._numActiveChanged(),n),o(()=>this._depthRange,()=>this._invalidateAccumulationSets(),n),o(()=>this.readyToRun,e=>{e||(this._bindParameters.depth=s(this._bindParameters.depth),this.notifyChange("canAccumulate"))})],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=a(this._accumulationRenderer),this._fboHandle=a(this._fboHandle),this._vao=a(this._vao),this._volumeVao=a(this._volumeVao),this._tmpReadFbo=a(this._tmpReadFbo),this._bindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&[...this._accumulationSets()].some(e=>e.active)}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==b.Zero&&this._opacityFromElevation>S}get _doneAccumulating(){return[...this._accumulationSets()].every(e=>e.doneAccumulating)}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get _numActive(){return[...this._accumulationSets()].reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get readyToRun(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some(e=>e.running)}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=a(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const a of this._accumulationSets())a.configuration.useMask=t;if(!t)return;const i=e.geometryVolume,{vao:r,vertexCount:s}=f(this._rctx,i);this._volumeVao=r,this._volumeVertexCount=s}runTask(e){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let t=!1;for(const i of this._accumulationSets())this._runTaskForSet(i,e)&&(t=!0);t&&this._requestRender()}_runTaskForSet(e,t){let i=!1;for(;!t.done&&!e.doneAccumulating;)this._accumulateShadow(e),t.madeProgress(),i=!0;return i}renderAccumulation(e,t){return this._updateCamera(e.camera),this._bindParameters.contentCamera=e.contentCamera,e.depth?.retain(),this._bindParameters.depth?.release(),this._bindParameters.depth=e.depth,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||t?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._renderAreaMask(),this._accumulateSetsForRenderFrame(t))}_renderAreaMask(){const e=this._techniques.getCompiled(q),t=this._volumeVao,i=this._volumeVertexCount,r=this._fboHandle,s=this._analysisVolume;if(r?.detachDepth(),!e||!t||i<1||!r||!s)return;r.acquireDepth(13);const a=this._rctx,o=this._bindParameters,n=o.depth,h=this._tmpReadFbo;h.attachDepthStencil(n?.attachment),a.blitFramebuffer(h,r.fbo,256),h.detachDepthStencilTexture(),a.bindFramebuffer(r.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const c=a.bindTechnique(e,o);this._maskParameters.origin=s.origin,c.bindDraw(o,D,this._maskParameters),a.bindVAO(t),a.drawArrays(H.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every(e=>0===e.progress))this._clearFramebuffer();else for(const e of this._accumulationSets())0===e.progress&&this._clearFramebufferForSet(this._fboHandle,e)}_accumulateSetsForRenderFrame(e){let t=!1;for(const i of this._accumulationSets())this._accumulateSetForRenderFrame(i,e)&&(t=!0);return t&&this._requestRender(),t}_accumulateSetForRenderFrame(e,t){let i=t?e.sampleCount:Math.min(E,e.sampleCount);i-=e.progress;for(let r=0;r<i;++r)this._accumulateShadow(e);return i>0}precompilePrepass(){if(this.accumulating){for(const e of this._accumulationSets())this._techniques.precompile(R,e.configuration),this._techniques.precompile(P,e.configuration);this._techniques.precompile(q)}}precompile(){this._accumulationRenderer.precompile()}render(e){this._accumulationRenderer.render(e)}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,V.UNSIGNED_BYTE,k),k[0]/i)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,r=this._createFBO(t,i);e&&(this._clearFramebuffer(r),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,r.fbo),this._fboHandle.dispose(),this._fboHandle=r,this._requestRender()}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=a(this._fboHandle),this._enabled=!1,this._requestRender())}_createFBO(e,t){return this._fbos.acquire(e,t,"shadow accumulation",this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t){if(!e)return;const i=this._techniques.get(P,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(i,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e){this._renderToShadowMap(this._bindParameters,e.lightDirections[e.progress++],this._depthRange);const t=this._techniques.get(R,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(t,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(t.primitiveType,0,this._vao.vertexCount("geometry"))}_updateCamera(e){if(!this._enabled)return;const t=this._bindParameters.camera;e.equals(t)||t.copyFrom(e),this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight)),this._opacityFromElevation=1-r(A,w,e.relativeElevation)}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}get _rctx(){return this._fbos.rctx}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e)}get test(){}};e([c()],M.prototype,"_refining",null),e([c()],M.prototype,"active",null),e([c()],M.prototype,"canAccumulate",null),e([c()],M.prototype,"_doneAccumulating",null),e([c()],M.prototype,"_opacityFromElevation",null),e([c()],M.prototype,"_numActive",null),e([c()],M.prototype,"_colorFormat",null),e([c()],M.prototype,"readyToRun",null),e([c()],M.prototype,"_depthRange",void 0),e([c()],M.prototype,"_enabled",void 0),e([c()],M.prototype,"_previewing",void 0),e([c()],M.prototype,"_accumulationRenderer",void 0),M=e([u("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],M);const E=6,k=new Uint8Array(4);class O{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=h(0),this._sampleCount=h(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,r=Math.min(C,e.length);if(!i(t,0,t.length,e,0,r,m)){t.length=r,this._sampleCount.value=r;for(let i=0;i<r;++i)t[i]=l(t[i]??_(),e[i]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(R,this.configuration),e.precompile(P,this.configuration)}}export{M as ShadowAccumulator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{equals as s}from"../../../../core/arrayUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{property as a,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{exactEquals as o,copy as n,equals as h}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{createQuadVAO as d}from"./glUtil3D.js";import{vvColorNumber as l}from"../materials/VisualVariablePassParameters.js";import{S as _}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as m}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as p}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{ColorAttachment0 as u}from"../../../webgl/enums.js";const c=4e4,b=5e4,v=1/512;let f=class extends t{constructor(e,t,s,i){super({}),this._techniques=e,this._rctx=t,this._data=s,this._requestRender=i,this._configuration=new p,this._enabled=!1,this._passParameters=new _(this._data),this._vao=d(t)}dispose(){this._stop(),this._vao=i(this._vao)}precompile(){this._showVisualization&&this._techniques.precompile(m,this._configuration)}render(e){if(!this._showVisualization)return;const[t,s]=this._data.computedSamples;this._passParameters.sampleScale=[t?1/t:0,s?1/s:0];const i=this._techniques.get(m,this._configuration);this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(i,e,this._passParameters),this._rctx.setDrawBuffers([u]),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.thresholdColor&&this._setThresholdColor(e.thresholdColor),void 0!==e.gradientColorRamp&&this._setGradientColorRamp(e.gradientColorRamp),void 0!==e.bandedGradientColorRamp&&this._setBandedGradientColorRamp(e.bandedGradientColorRamp),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(e){this._passParameters.opacityFromElevation!==e&&(this._passParameters.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&(this._data.computedSamples[0]>0||this._data.computedSamples[1]>0)&&this.opacityFromElevation>v}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfEnabled())}get _visualization(){return this._configuration.visualization}set _visualization(e){e!==this._visualization&&(this._configuration.visualization=e,this._requestRenderIfEnabled())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfEnabled())}_setThresholdColor(e){const t=this._passParameters.thresholdColor;o(e,t)||(n(this._passParameters.thresholdColor,e),this._requestRenderIfEnabled())}_setGradientColorRamp(e){e.length>l&&(e=e.slice(0,l));g(this._passParameters.gradientColorRamp,e)||(this._passParameters.gradientColorRamp=e,this._requestRenderIfEnabled())}_setBandedGradientColorRamp(e){e.length>l&&(e=e.slice(0,l));g(this._passParameters.bandedGradientColorRamp,e)||(this._passParameters.bandedGradientColorRamp=e,this._requestRenderIfEnabled())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};function g(e,t){return s(e,t,([e,t],[s,i])=>e===s&&h(t,i))}e([a()],f.prototype,"opacityFromElevation",null),f=e([r("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],f);export{f as ShadowCastRenderer,b as shadowCastDisableElevationMax,c as shadowCastDisableElevationMin,v as shadowCastDisabledElevationThreshold};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
import{simpleStencilTestParams as a}from"../../../webgl/renderState.js";const s={func:513},i={func:519},l={mask:255},z={mask:0},e=s=>a(s,s,{compare:517,fail:7680,zFail:7680,zPass:7680}),r=s=>a(s,s,{compare:519,fail:7680,zFail:7680,zPass:7681}),m=a(2,2,{compare:519,fail:7680,zFail:7680,zPass:0}),o=a(2,2,{compare:519,fail:7680,zFail:7680,zPass:7681}),c=a(2,2,{compare:514,fail:7680,zFail:7680,zPass:7680}),f=a(2,2,{compare:517,fail:7680,zFail:7680,zPass:7680});export{i as depthCompareAlways,s as depthCompareLess,e as renderWhenBitIsNotSet,r as replaceBitWhenDepthTestPasses,m as stencilBaseAllZerosParams,o as stencilToolMaskBaseParams,c as stencilToolMaskOccluderParams,f as stencilToolTransparentOccluderParams,z as stencilWriteMaskOff,l as stencilWriteMaskOn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as r,initial as
|
|
2
|
+
import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as r,initial as o,when as a,sync as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{translate as c,fromTranslation as p,scale as l,mul as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as f,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as _}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as V}from"../../webgl.js";import b from"../../webgl/RenderNode.js";import{ViewshedShadowMap as M}from"./ViewshedShadowMap.js";import{V as S}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as y}from"../shaders/ViewshedTechnique.js";import{ColorAttachment0 as j}from"../../../webgl/enums.js";let x=class extends b{get shadowMap(){return this._shadowMap}get hasViewsheds(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>P(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new S,this._viewsheds=new s,this._shadowMap=null,this.consumes={required:[V.VIEWSHED,"normals"]},this.produces=V.VIEWSHED}initialize(){this._shadowMap=new M(this.fboCache),this.addHandles([r(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},o),a(()=>!this.hasViewsheds,()=>this._shadowMap?.dispose()),r(()=>this._viewshedsInView.map(e=>[e.elevationAlignedObserverRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),n)])}destroy(){this._shadowMap=i(this._shadowMap)}precompile(){if(this.hasViewsheds){this.techniques.precompile(y);for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e))return void this.view.stage.renderer.precompileViewshedShadowMap()}}render(e){const s=this.bindParameters,t=this.renderingContext,i=e.find(({name:e})=>e===V.VIEWSHED);if(!this.hasViewsheds||this.isDecoration&&!s.decorations)return i;const r=this.techniques.getCompiled(y);if(!r)return this.requestRender(1),i;const o=this.view.stage.renderer.isFeatureEnabled(6);this._passParameters.shadowMap=this._shadowMap??this._passParameters.shadowMap,this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();const a=i.obtainDepthTexture();for(const n of this._viewshedsInView){if(!this._renderShadowCubeMap(s,n,o)||!this._shadowMap?.ready)continue;const e=this._setupViewshedParameters(n,s.camera);t.bindFramebuffer(i.fbo),t.bindTechnique(r,s,e),t.setDrawBuffers([j]),t.screen.draw()}return this.shadowMap?.dispose(),i.attachDepth(a),a?.release(),i}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:i}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),i)if(Array.isArray(i)){const e=i.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(i)||s.add(i)}_renderShadowCubeMap(e,s,t){const i=this._shadowMap;if(!i)return!1;const r=this.view.basemapTerrain.hasStencilEnabledExtents,o=i.start(e.camera,s,t,this._contentPixelRatio,r);return o&&i.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),i.finish(),o}_setupViewshedParameters(e,s){const i=this._shadowMap;if(!i)return this._passParameters;const r=this._passParameters,o=e.effectiveObserverRenderSpace;r.localOrigin=o,r.observerOffset=f(D,e.elevationAlignedObserverRenderSpace,e.effectiveObserverRenderSpace),r.fovs=[t(e.horizontalFieldOfView),t(e.verticalFieldOfView)],r.headingAndTilt=[t(e.heading),t(e.tiltParallelToSurface)],r.upVector=e.tiltedUpVector;const a=A(e.elevationAlignedTargetRenderSpace,o);r.targetVector=a;const n=new Array,h=new Array;for(let t=0;t<i.numActiveFaces;t++)c(E,i.viewshedViewMatrices[t],o),n.push(...E),R(i.viewshedProjectionMatrices[t],E,I),h.push(...I);return r.viewMatrices=n,r.projectionMatrices=h,r.volumeOffset=this.selectedViewshed?.()===e.viewshed?O(e,this.view,s.eye):0,r}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function A(e,s){const t=v();return f(t,e,s)}function R(e,s,t){const i=g(.5,.5,.5);return p(t,i),l(t,t,i),w(t,t,e),w(t,t,s),t}function P(e,s){const t=new _(s.elevationAlignedObserverRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function O(e,s,t){if(null==e)return 0;const{elevationAlignedObserverRenderSpace:i,elevationAlignedTargetRenderSpace:r}=e,o=u(t,i)>u(t,r)?e.observer:e.target;return s.pixelSizeAt(o)}e([h()],x.prototype,"selectedViewshed",void 0),e([h()],x.prototype,"isDecoration",void 0),e([h()],x.prototype,"shadowMap",null),e([h()],x.prototype,"hasViewsheds",null),e([h()],x.prototype,"_contentPixelRatio",null),e([h()],x.prototype,"_viewshedsInView",null),e([h()],x.prototype,"consumes",void 0),e([h()],x.prototype,"produces",void 0),x=e([d("esri.views.3d.webgl-engine.lib.Viewshed")],x);const D=v(),E=m(),I=m();export{x as Viewshed,O as computeOffsetScale};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{VisualVariablesParameters as
|
|
2
|
+
import{VisualVariablesParameters as r}from"../../layers/support/FastSymbolUpdates.js";import{maxColorRampSize as s}from"../shaders/colorRampParameters.js";class e extends r{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}}const t=s;export{e as VisualVariablePassParameters,t as vvColorNumber};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as t}from"../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{PrimitiveType as o}from"../../../webgl/enums.js";import{makePipelineState as a,add as n}from"../../../webgl/renderState.js";let
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as t}from"../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{PrimitiveType as o}from"../../../webgl/enums.js";import{makePipelineState as a,add as l,simpleStencilTestParams as n}from"../../../webgl/renderState.js";let c=class extends t{constructor(){super(...arguments),this.shader=new s(i,()=>import("./ShadowCastAccumulate.glsl.js")),this.ignoreUnused=!0,this.primitiveType=o.TRIANGLE_STRIP}initializePipeline(e){const r={r:0===e.index,g:1===e.index,b:!1,a:!1};return a({blending:l,colorWrite:r,depthTest:null,depthWrite:null,stencilTest:e.useMask?n(0,255,{compare:517,fail:7680,zFail:7680,zPass:7680}):null})}};c=e([r("esri.views.3d.webgl-engine.shaders.ShadowCastAccumulateTechnique")],c);export{c as ShadowCastAccumulateTechnique};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as
|
|
2
|
+
import{__decorate as e}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class i extends t{constructor(e){super(),this.index=0,this.useMask=!1,this.index=e}}e([o({count:2})],i.prototype,"index",void 0),e([o()],i.prototype,"useMask",void 0);export{i as ShadowCastAccumulateTechniqueConfiguration};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as s}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as r}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{a as o}from"../../../../chunks/FocusAreaMask.glsl.js";import{PrimitiveType as a}from"../../../webgl/enums.js";import{makePipelineState as t,separateStencilTestParams as c}from"../../../webgl/renderState.js";let l=class extends i{constructor(){super(...arguments),this.shader=new r(o,()=>import("../effects/focusArea/FocusAreaMask.glsl.js")),this.ignoreUnused=!0,this.primitiveType=a.TRIANGLE_STRIP}initializePipeline(){return t({depthTest:{func:513},stencilTest:c(0,255,{compare:519,fail:7680,zFail:34055,zPass:7680},{compare:519,fail:7680,zFail:34056,zPass:7680}),stencilWrite:{mask:255}})}};l=e([s("esri.views.3d.webgl-engine.shaders.ShadowCastMaskTechnique")],l);export{l as ShadowCastMaskTechnique};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js";import"../core/shaderLibrary/util/CameraSpace.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../../chunks/ShadowCastAccumulate.glsl.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastVisualizePassParameters,b as build}from"../../../../chunks/ShadowCastVisualize.glsl.js";
|
|
2
|
+
import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js";import"../core/shaderLibrary/util/CameraSpace.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/Float4sPassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/FloatsPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"./colorRampParameters.js";import"../../../../chunks/ShadowCastAccumulate.glsl.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastVisualizePassParameters,b as build}from"../../../../chunks/ShadowCastVisualize.glsl.js";
|