@arcgis/core 5.1.0-next.43 → 5.1.0-next.45
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/applications/Components/featureUtils.d.ts +11 -7
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/AttributeFilter.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/featureset/actions/Top.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/OrderbyClause.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{eff198e0c21c9767ffaa.js → 0155e5679ded9de5c327.js} +1 -1
- package/assets/esri/core/workers/chunks/128799741dd3c6fc69b9.js +1 -0
- package/assets/esri/core/workers/chunks/13eb0162d95b4d27389c.js +1 -0
- package/assets/esri/core/workers/chunks/{0836964a65f76da35b5c.js → 1a3f874700f86b750390.js} +23 -23
- package/assets/esri/core/workers/chunks/1a481f3ae3146682eb00.js +1 -0
- package/assets/esri/core/workers/chunks/1cce2f8837ad765acf44.js +1 -0
- package/assets/esri/core/workers/chunks/2379c64b0ca30814a815.js +1 -0
- package/assets/esri/core/workers/chunks/23a9070e9362b8439770.js +1 -0
- package/assets/esri/core/workers/chunks/25e4568a3ff76f48ac5e.js +1 -0
- package/assets/esri/core/workers/chunks/{dbedd246f4b584583f95.js → 288bd32831e94e81653e.js} +1 -1
- package/assets/esri/core/workers/chunks/2b3a8a53cd68f666676b.js +1 -0
- package/assets/esri/core/workers/chunks/{4d16b6ac52e25bd7e6aa.js → 32a51ce8e1a362115c89.js} +1 -1
- package/assets/esri/core/workers/chunks/{392941013107bbd96503.js → 365ad1ffd496ed86637b.js} +1 -1
- package/assets/esri/core/workers/chunks/375eac59c9f88c7572db.js +2 -0
- package/assets/esri/core/workers/chunks/{eab74d830c2eaa9d133b.js → 4869e2f35aaf6b058281.js} +1 -1
- package/assets/esri/core/workers/chunks/{10941b50f5933d168df6.js → 521a671182b0f79e3624.js} +1 -1
- package/assets/esri/core/workers/chunks/{c2f3fc1b34a6782b431f.js → 5351e71ce7839636d06d.js} +1 -1
- package/assets/esri/core/workers/chunks/5b515b5741733bcb4645.js +1 -0
- package/assets/esri/core/workers/chunks/{1669f1bf959c4e3083da.js → 5c0b3c76a7bc971c61dc.js} +1 -1
- package/assets/esri/core/workers/chunks/5c830cce32710d70dfa6.js +1 -0
- package/assets/esri/core/workers/chunks/5e9bd5ed6ecee5b15127.js +1 -0
- package/assets/esri/core/workers/chunks/5f2e246ffcbdedea4de5.js +1 -0
- package/assets/esri/core/workers/chunks/617328964d480d4a3a45.js +1 -0
- package/assets/esri/core/workers/chunks/64da1ad9df9094ef5c12.js +1 -0
- package/assets/esri/core/workers/chunks/650614a9e4871714c42e.js +1 -0
- package/assets/esri/core/workers/chunks/66baacbef23291eab853.js +1 -0
- package/assets/esri/core/workers/chunks/7278cc37e85f0242f19b.js +1 -0
- package/assets/esri/core/workers/chunks/{3c597d8ef898627b8f93.js → 768bbc910be6c65ac107.js} +1 -1
- package/assets/esri/core/workers/chunks/{a1f36240a31057f998da.js → 79dc7045d9a2d43ba8df.js} +1 -1
- package/assets/esri/core/workers/chunks/{f9da5c81535eaffc8b9c.js → 7f07f490c6fcc794c8d9.js} +1 -1
- package/assets/esri/core/workers/chunks/{2b386374330d96387aec.js → 851fc5290497991ba001.js} +1 -1
- package/assets/esri/core/workers/chunks/{7132420980f77b6a871b.js → 8cafdd4addd366795600.js} +1 -1
- package/assets/esri/core/workers/chunks/{30cdb2d1d9f018f1642d.js → 9032c040b214b5af775b.js} +1 -1
- package/assets/esri/core/workers/chunks/{ff8ec6369c8a1bee9bb4.js → 908f171b9c512d738dea.js} +1 -1
- package/assets/esri/core/workers/chunks/{c7799ba861ac5af08e6a.js → 92d4e962284e13ba2fc5.js} +1 -1
- package/assets/esri/core/workers/chunks/970d971551e42f7ae08d.js +1 -0
- package/assets/esri/core/workers/chunks/9802770413ad814dab29.js +1 -0
- package/assets/esri/core/workers/chunks/{6e8cfe69617876ee0dac.js → a69f1879735a031f62e9.js} +1 -1
- package/assets/esri/core/workers/chunks/{af804beb43d4d10c54d9.js → a9f35127c3f5bf42036b.js} +1 -1
- package/assets/esri/core/workers/chunks/b5ced451d331ca1ffb68.js +1 -0
- package/assets/esri/core/workers/chunks/beb53b372d356800f333.js +1 -0
- package/assets/esri/core/workers/chunks/{8f12a559dbf284c21e2f.js → bf4d2f42d31861ea1046.js} +1 -1
- package/assets/esri/core/workers/chunks/c2aa3b1344b42a904234.js +1 -0
- package/assets/esri/core/workers/chunks/{9a9b1250be3e20499d75.js → ca88a364ef911526102e.js} +1 -1
- package/assets/esri/core/workers/chunks/cdeb6aec578a1c07d663.js +1 -0
- package/assets/esri/core/workers/chunks/cf5e4cf9b1aa37eeb6b0.js +1 -0
- package/assets/esri/core/workers/chunks/d0adf059085ddf7151dd.js +1 -0
- package/assets/esri/core/workers/chunks/d2af5342fbe80e2d8c60.js +1 -0
- package/assets/esri/core/workers/chunks/d3d024b3d2bb8fbbf760.js +1 -0
- package/assets/esri/core/workers/chunks/{80bfb5e5d613d2c412bf.js → dbafe96ce37bb82d0584.js} +1 -1
- package/assets/esri/core/workers/chunks/e4e0c5a45cf32973d5d5.js +1 -0
- package/assets/esri/core/workers/chunks/{093aa05fbde548bf9040.js → e5927f9d0e757ec4c22a.js} +1 -1
- package/assets/esri/core/workers/chunks/{b15a02bdcd78a1a51bd6.js → e72ca52d930afb5650af.js} +1 -1
- package/assets/esri/core/workers/chunks/{465cc0e00f03cdb640b2.js → e7402dfd683f82878360.js} +1 -1
- package/assets/esri/core/workers/chunks/{8838ff9668b472af16a1.js → ef0eae13408cbf83a64f.js} +1 -1
- package/assets/esri/core/workers/chunks/f1767b8ba82fdd9bd947.js +1 -0
- package/assets/esri/core/workers/chunks/{f835eea9f617556c7276.js → f6e3954ddbb5993d56df.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Grid.scss +5 -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/views/interactive/tooltip/t9n/Tooltip.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
- package/chunks/ComponentShader.glsl.js +11 -11
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/HUDMaterial.glsl.js +28 -36
- package/chunks/ImageMaterial.glsl.js +1 -1
- package/chunks/Jpg.js +1 -1
- package/chunks/Path.glsl.js +7 -7
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +2 -2
- package/chunks/ShadowHighlight.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +5 -5
- package/chunks/Water.glsl.js +5 -5
- package/chunks/Zlib.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/config.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/geometry/support/zscale.js +1 -1
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/SceneLayer.d.ts +16 -10
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/JpgPlus.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/save/groupLayerUtils.js +1 -1
- package/layers/save/mapImageLayerUtils.js +1 -1
- package/layers/support/Sublayer.d.ts +6 -0
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/package.json +3 -3
- package/rest/query/operations/pbfFeatureSetUtils.js +1 -1
- package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
- package/rest/query/operations/pbfOptimizedFeatureSet.js +1 -1
- package/support/revision.js +1 -1
- package/third-party-notices.txt +2 -2
- package/views/2d/engine/ManagedCanvas.js +1 -1
- package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.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/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentDrawParameters.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +1 -1
- package/widgets/Editor.d.ts +2 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Sketch/support/PluginManager.js +1 -1
- package/assets/esri/core/workers/chunks/02a0a58ca5916db1db19.js +0 -1
- package/assets/esri/core/workers/chunks/03c8453ae72a4e190252.js +0 -1
- package/assets/esri/core/workers/chunks/04981ae9d7728208ffce.js +0 -1
- package/assets/esri/core/workers/chunks/0e669a04999feb9f98c9.js +0 -1
- package/assets/esri/core/workers/chunks/23af269e88f9ac101ffb.js +0 -1
- package/assets/esri/core/workers/chunks/244dd7a948ca8a7dc6ef.js +0 -1
- package/assets/esri/core/workers/chunks/26cafd20c8d03c274389.js +0 -1
- package/assets/esri/core/workers/chunks/2fa86dacc8a12a6a6c43.js +0 -1
- package/assets/esri/core/workers/chunks/3e26f9af6b8c75bad97a.js +0 -1
- package/assets/esri/core/workers/chunks/42b556d56013350c9d80.js +0 -1
- package/assets/esri/core/workers/chunks/5a6a6e7151085a3cd3dd.js +0 -1
- package/assets/esri/core/workers/chunks/5eb9fdb076488de9cd83.js +0 -1
- package/assets/esri/core/workers/chunks/65865c25487d23dd2e31.js +0 -1
- package/assets/esri/core/workers/chunks/65ea5028eb12457a3aeb.js +0 -1
- package/assets/esri/core/workers/chunks/73a008b48e29eb6f2064.js +0 -2
- package/assets/esri/core/workers/chunks/80a1ccabd4257cc61e0d.js +0 -1
- package/assets/esri/core/workers/chunks/8333561a938bcdf6c2e6.js +0 -1
- package/assets/esri/core/workers/chunks/91718795fc4ca6516ac7.js +0 -1
- package/assets/esri/core/workers/chunks/93846f8b77fc802069a7.js +0 -1
- package/assets/esri/core/workers/chunks/9b80569819cd1c72a9ff.js +0 -1
- package/assets/esri/core/workers/chunks/b056b4c79bcd542dd1d2.js +0 -1
- package/assets/esri/core/workers/chunks/b553264db0f10bb8c5f7.js +0 -1
- package/assets/esri/core/workers/chunks/b6e63d8ce3c9ac9762f4.js +0 -1
- package/assets/esri/core/workers/chunks/c1cae45a159a5373ac00.js +0 -1
- package/assets/esri/core/workers/chunks/c4f64195e44986644993.js +0 -1
- package/assets/esri/core/workers/chunks/ca6012135929b028ea1b.js +0 -1
- package/assets/esri/core/workers/chunks/de79645e559a2d1ffa67.js +0 -1
- package/assets/esri/core/workers/chunks/ea356a5b90ea44b5cbe1.js +0 -1
- package/assets/esri/core/workers/chunks/f0e6a26a3625068b08ab.js +0 -1
- package/assets/esri/core/workers/chunks/f36a234ef35faf8ca04d.js +0 -1
- package/views/2d/engine/vectorTiles/GlyphMosaic.js +0 -2
- package/views/2d/engine/vectorTiles/GlyphSource.js +0 -2
- package/views/2d/engine/vectorTiles/RectangleBinPack.js +0 -2
- /package/assets/esri/core/workers/chunks/{73a008b48e29eb6f2064.js.LICENSE.txt → 375eac59c9f88c7572db.js.LICENSE.txt} +0 -0
package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{addNearFar as o}from"../ForwardLinearDepthToWriteShadowMap.glsl.js";import{SliceDraw as r}from"../Slice.glsl.js";import{Transform as e}from"../Transform.glsl.js";import{NormalAttribute as t}from"../attributes/NormalAttribute.glsl.js";import{ObjectAndLayerIdColor as i}from"../attributes/ObjectAndLayerIdColor.glsl.js";import{TextureCoordinateAttribute as a}from"../attributes/TextureCoordinateAttribute.glsl.js";import{VertexNormal as s}from"../attributes/VertexNormal.glsl.js";import{OutputDepth as l}from"../output/OutputDepth.glsl.js";import{OutputHighlight as d}from"../output/OutputHighlight.glsl.js";import{VisualVariables as n}from"../shading/VisualVariables.glsl.js";import{DiscardOrAdjustAlphaPass as c}from"../util/DiscardOrAdjustAlpha.glsl.js";import{addProjViewLocalOrigin as u}from"../util/View.glsl.js";import{glsl as p,If as v}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as m}from"../../shaderModules/Texture2DPassUniform.js";function f(f,g){const{vertex:x,fragment:O,varyings:j}=f,{hasColorTexture:h,alphaDiscardMode:w}=g,V=h&&1!==w,{output:C,normalType:b,hasColorTextureTransform:A}=g;switch(C){case
|
|
2
|
+
import{addNearFar as o}from"../ForwardLinearDepthToWriteShadowMap.glsl.js";import{SliceDraw as r}from"../Slice.glsl.js";import{Transform as e}from"../Transform.glsl.js";import{NormalAttribute as t}from"../attributes/NormalAttribute.glsl.js";import{ObjectAndLayerIdColor as i}from"../attributes/ObjectAndLayerIdColor.glsl.js";import{TextureCoordinateAttribute as a}from"../attributes/TextureCoordinateAttribute.glsl.js";import{VertexNormal as s}from"../attributes/VertexNormal.glsl.js";import{OutputDepth as l}from"../output/OutputDepth.glsl.js";import{OutputHighlight as d}from"../output/OutputHighlight.glsl.js";import{VisualVariables as n}from"../shading/VisualVariables.glsl.js";import{DiscardOrAdjustAlphaPass as c}from"../util/DiscardOrAdjustAlpha.glsl.js";import{addProjViewLocalOrigin as u}from"../util/View.glsl.js";import{glsl as p,If as v}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as m}from"../../shaderModules/Texture2DPassUniform.js";function f(f,g){const{vertex:x,fragment:O,varyings:j}=f,{hasColorTexture:h,alphaDiscardMode:w}=g,V=h&&1!==w,{output:C,normalType:b,hasColorTextureTransform:A}=g;switch(C){case 3:u(x,g),f.include(e),O.include(r,g),f.include(a,g),V&&O.uniforms.add(new m("tex",o=>o.texture)),x.main.add(p`vpos = getVertexInLocalOriginSpace();
|
|
3
3
|
vpos = subtractOrigin(vpos);
|
|
4
4
|
vpos = addVerticalOffset(vpos, localOrigin);
|
|
5
5
|
gl_Position = transformPosition(proj, view, vpos);
|
|
6
6
|
forwardTextureCoordinates();`),f.include(c,g),O.main.add(p`
|
|
7
7
|
discardBySlice(vpos);
|
|
8
8
|
${v(V,p`vec4 texColor = texture(tex, ${A?"colorUV":"vuv0"});
|
|
9
|
-
discardOrAdjustAlpha(texColor);`)}`);break;case
|
|
9
|
+
discardOrAdjustAlpha(texColor);`)}`);break;case 5:case 6:case 7:case 8:case 11:u(x,g),f.include(e),f.include(a,g),f.include(n,g),f.include(l,g),O.include(r,g),f.include(i,g),o(f),j.add("depth","float",{invariant:!0}),V&&O.uniforms.add(new m("tex",o=>o.texture)),x.main.add(p`vpos = getVertexInLocalOriginSpace();
|
|
10
10
|
vpos = subtractOrigin(vpos);
|
|
11
11
|
vpos = addVerticalOffset(vpos, localOrigin);
|
|
12
12
|
gl_Position = transformPositionWithDepth(proj, view, vpos, nearFar, depth);
|
|
@@ -15,7 +15,7 @@ forwardObjectAndLayerIdColor();`),f.include(c,g),O.main.add(p`
|
|
|
15
15
|
discardBySlice(vpos);
|
|
16
16
|
${v(V,p`vec4 texColor = texture(tex, ${A?"colorUV":"vuv0"});
|
|
17
17
|
discardOrAdjustAlpha(texColor);`)}
|
|
18
|
-
${
|
|
18
|
+
${11===C?p`outputObjectAndLayerIdColor();`:p`outputDepth(depth);`}`);break;case 4:{u(x,g),f.include(e),f.include(t,g),f.include(s,g),f.include(a,g),f.include(n,g),V&&O.uniforms.add(new m("tex",o=>o.texture)),2===b&&j.add("vPositionView","vec3",{invariant:!0});const o=0===b||1===b;x.main.add(p`
|
|
19
19
|
vpos = getVertexInLocalOriginSpace();
|
|
20
20
|
${o?p`vNormalWorld = dpNormalView(vvLocalNormal(normalModel()));`:p`vPositionView = (view * vec4(vpos, 1.0)).xyz;`}
|
|
21
21
|
vpos = subtractOrigin(vpos);
|
|
@@ -30,7 +30,7 @@ forwardObjectAndLayerIdColor();`),f.include(c,g),O.main.add(p`
|
|
|
30
30
|
if (gl_FrontFacing == false){
|
|
31
31
|
normal = -normal;
|
|
32
32
|
}`}
|
|
33
|
-
fragColor = vec4(0.5 + 0.5 * normal, 1.0);`);break}case
|
|
33
|
+
fragColor = vec4(0.5 + 0.5 * normal, 1.0);`);break}case 10:u(x,g),f.include(e),f.include(a,g),f.include(n,g),V&&O.uniforms.add(new m("tex",o=>o.texture)),x.main.add(p`vpos = getVertexInLocalOriginSpace();
|
|
34
34
|
vpos = subtractOrigin(vpos);
|
|
35
35
|
vpos = addVerticalOffset(vpos, localOrigin);
|
|
36
36
|
gl_Position = transformPosition(proj, view, vpos);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{glsl as t}from"../../shaderModules/glsl.js";function a(a,e){switch(e.output){case
|
|
2
|
+
import{glsl as t}from"../../shaderModules/glsl.js";function a(a,e){switch(e.output){case 5:case 6:case 7:case 8:a.fragment.code.add(t`float _calculateFragDepth(const in float depth) {
|
|
3
3
|
const float SLOPE_SCALE = 2.0;
|
|
4
4
|
const float BIAS = 20.0 * .000015259;
|
|
5
5
|
float m = max(abs(dFdx(depth)), abs(dFdy(depth)));
|
|
@@ -8,6 +8,6 @@ return depth + SLOPE_SCALE * m + BIAS;
|
|
|
8
8
|
void outputDepth(float _linearDepth){
|
|
9
9
|
float fragDepth = _calculateFragDepth(_linearDepth);
|
|
10
10
|
gl_FragDepth = fragDepth;
|
|
11
|
-
}`);break;case
|
|
11
|
+
}`);break;case 9:a.fragment.code.add(t`void outputDepth(float _linearDepth){
|
|
12
12
|
gl_FragDepth = _linearDepth;
|
|
13
13
|
}`)}}export{a as OutputDepth};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{HighlightReadBitmap as i}from"../HighlightReadBitmap.glsl.js";import{glsl as e}from"../../shaderModules/glsl.js";import{Integer2BindUniform as t}from"../../shaderModules/Integer2BindUniform.js";import{IntegerBindUniform as h}from"../../shaderModules/IntegerBindUniform.js";import{Texture2DBindUniform as l}from"../../shaderModules/Texture2DBindUniform.js";import{Texture2DUintBindUniform as g}from"../../shaderModules/Texture2DUintBindUniform.js";function d(d,o){const{fragment:u}=d,{output:r,draped:c,hasHighlightMixTexture:n}=o;
|
|
2
|
+
import{HighlightReadBitmap as i}from"../HighlightReadBitmap.glsl.js";import{glsl as e}from"../../shaderModules/glsl.js";import{Integer2BindUniform as t}from"../../shaderModules/Integer2BindUniform.js";import{IntegerBindUniform as h}from"../../shaderModules/IntegerBindUniform.js";import{Texture2DBindUniform as l}from"../../shaderModules/Texture2DBindUniform.js";import{Texture2DUintBindUniform as g}from"../../shaderModules/Texture2DUintBindUniform.js";function d(d,o){const{fragment:u}=d,{output:r,draped:c,hasHighlightMixTexture:n}=o;10===r?(u.uniforms.add(new h("highlightLevel",i=>i.highlightLevel??0),new t("highlightMixOrigin",i=>i.highlightMixOrigin)),d.outputs.add("fragHighlight","uvec2",0),d.include(i),n?u.uniforms.add(new g("highlightMixTexture",i=>i.highlightMixTexture)).code.add(e`uvec2 getAccumulatedHighlight() {
|
|
3
3
|
return texelFetch(highlightMixTexture, ivec2(gl_FragCoord.xy) - highlightMixOrigin, 0).rg;
|
|
4
4
|
}
|
|
5
5
|
void outputHighlight(bool occluded) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{OutputHighlight as i}from"./OutputHighlight.glsl.js";import{glsl as t}from"../../shaderModules/glsl.js";function l(l,e){
|
|
2
|
+
import{OutputHighlight as i}from"./OutputHighlight.glsl.js";import{glsl as t}from"../../shaderModules/glsl.js";function l(l,e){10===e.output&&(l.include(i,e),l.fragment.code.add(t`
|
|
3
3
|
void calculateOcclusionAndOutputHighlight(uvec2 highlightToAdd) {
|
|
4
4
|
uint levelBits = readLevelBits(highlightToAdd, highlightLevel);
|
|
5
5
|
if ((levelBits & 1u) == 0u) discard;
|
|
@@ -6,7 +6,7 @@ import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f6
|
|
|
6
6
|
`)}function g(a){a.include(r),S(a),a.fragment.code.add(n`float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
|
|
7
7
|
vec3 uvzShadow = calculateUVZShadow(_worldPos, _linearDepth, textureSize(shadowMap, 0));
|
|
8
8
|
return readShadowMaps(uvzShadow);
|
|
9
|
-
}`)}function S(a){a.include(r),a.fragment.uniforms.add(new i("singleShadowMap",({shadowMap:a})=>!!a.getOutput(
|
|
9
|
+
}`)}function S(a){a.include(r),a.fragment.uniforms.add(new i("singleShadowMap",({shadowMap:a})=>!!a.getOutput(5)),new h("shadowMap",({shadowMap:a})=>a.getOutput(5)??a.getOutput(7)),new h("shadowMapHighlight",({shadowMap:a})=>a.getOutput(5)??a.getOutput(6))).code.add(n`float readShadowMaps(const in vec3 uvzShadow) {
|
|
10
10
|
if (uvzShadow.z < 0.0) {
|
|
11
11
|
return 0.0;
|
|
12
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{MaskedColorDefinition as o,MultiplyMaskedColors as e,CreateMaskedFromNaNColor as r}from"../attributes/MaskedColor.glsl.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{Float4PassUniform as t}from"../../shaderModules/Float4PassUniform.js";import{Float4sPassUniform as v}from"../../shaderModules/Float4sPassUniform.js";import{FloatsPassUniform as l}from"../../shaderModules/FloatsPassUniform.js";import{glsl as i}from"../../shaderModules/glsl.js";import{Matrix3PassUniform as s}from"../../shaderModules/Matrix3PassUniform.js";import{vvColorNumber as n}from"../../../materials/VisualVariablePassParameters.js";function u(u,c){const{vertex:m,attributes:d}=u;c.hasVVInstancing&&(c.hasVVSize||c.hasVVColor)&&d.add("instanceFeatureAttribute","vec4"),c.hasVVSize?(m.uniforms.add(new a("vvSizeMinSize",o=>o.vvSize.minSize)),m.uniforms.add(new a("vvSizeMaxSize",o=>o.vvSize.maxSize)),m.uniforms.add(new a("vvSizeOffset",o=>o.vvSize.offset)),m.uniforms.add(new a("vvSizeFactor",o=>o.vvSize.factor)),m.uniforms.add(new a("vvSizeFallback",o=>o.vvSize.fallback)),m.uniforms.add(new s("vvSymbolRotationMatrix",o=>o.
|
|
2
|
+
import{MaskedColorDefinition as o,MultiplyMaskedColors as e,CreateMaskedFromNaNColor as r}from"../attributes/MaskedColor.glsl.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{Float4PassUniform as t}from"../../shaderModules/Float4PassUniform.js";import{Float4sPassUniform as v}from"../../shaderModules/Float4sPassUniform.js";import{FloatsPassUniform as l}from"../../shaderModules/FloatsPassUniform.js";import{glsl as i}from"../../shaderModules/glsl.js";import{Matrix3PassUniform as s}from"../../shaderModules/Matrix3PassUniform.js";import{vvColorNumber as n}from"../../../materials/VisualVariablePassParameters.js";function u(u,c){const{vertex:m,attributes:d}=u;c.hasVVInstancing&&(c.hasVVSize||c.hasVVColor)&&d.add("instanceFeatureAttribute","vec4"),c.hasVVSize?(m.uniforms.add(new a("vvSizeMinSize",o=>o.vvSize.minSize)),m.uniforms.add(new a("vvSizeMaxSize",o=>o.vvSize.maxSize)),m.uniforms.add(new a("vvSizeOffset",o=>o.vvSize.offset)),m.uniforms.add(new a("vvSizeFactor",o=>o.vvSize.factor)),m.uniforms.add(new a("vvSizeFallback",o=>o.vvSize.fallback)),m.uniforms.add(new s("vvSymbolRotationMatrix",o=>o.vvSize.symbolRotationMatrix)),m.uniforms.add(new a("vvSymbolAnchor",o=>o.vvSize.symbolAnchor)),m.code.add(i`vec3 vvScale(vec4 _featureAttribute) {
|
|
3
3
|
if (isnan(_featureAttribute.x)) {
|
|
4
4
|
return vvSizeFallback;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{isColor as l}from"../ShaderOutput.js";import{addMainLightDirection as a,addMainLightIntensity as i}from"../shading/MainLighting.glsl.js";import{WaterColor as c}from"../shading/WaterColor.glsl.js";import{Float4DrawUniform as s}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as n}from"../../shaderModules/FloatPassUniform.js";import{glsl as v}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as d}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as u}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as x}from"../../../../../webgl/Uniform.js";function y(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new s("overlayTexOffset",(e,r)=>h(o.spherical,e,r)),new s("overlayTexScale",(e,r)=>O(o.spherical,e,r))),t.uniforms.add(new s("overlayTexOffset",(e,r)=>h(o.spherical,e,r)),new s("overlayTexScale",(e,r)=>O(o.spherical,e,r))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new d("ovColorTex",(e,o)=>f(e,o))),g(e,o)}function f(e,o){return 0===e.identifier&&l(
|
|
2
|
+
import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{isColor as l}from"../ShaderOutput.js";import{addMainLightDirection as a,addMainLightIntensity as i}from"../shading/MainLighting.glsl.js";import{WaterColor as c}from"../shading/WaterColor.glsl.js";import{Float4DrawUniform as s}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as n}from"../../shaderModules/FloatPassUniform.js";import{glsl as v}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as d}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as u}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as x}from"../../../../../webgl/Uniform.js";function y(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new s("overlayTexOffset",(e,r)=>h(o.spherical,e,r)),new s("overlayTexScale",(e,r)=>O(o.spherical,e,r))),t.uniforms.add(new s("overlayTexOffset",(e,r)=>h(o.spherical,e,r)),new s("overlayTexScale",(e,r)=>O(o.spherical,e,r))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new d("ovColorTex",(e,o)=>f(e,o))),g(e,o)}function f(e,o){return 0===e.identifier&&l(o.output)?e.occludedGround?o.overlay?.allSourcesOccluders?o.overlay?.getTexture(1):o.overlay?.getTexture(4):o.overlay?.getTexture(1):0===e.identifier&&11===o.output?o.overlay?.getTexture(5):2===e.identifier?o.overlay?.getTexture(2):null}function m(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new V("overlayTexOffset"),new V("overlayTexScale")),t.uniforms.add(new n("overlayOpacity",e=>e.overlayOpacity)),10!==o.output&&t.uniforms.add(new d("ovColorTex",(e,o)=>o.overlay?.getTexture(e.overlayContent))),g(e,o)}function p(e,o){switch(e){case 0:case 1:case 2:return 10!==o.slot||o.overlay?.allSourcesOccluders?0:4;case 3:case 4:return 0;case 10:return 2;case 5:case 7:case 8:case 9:return null;case 11:return 5}return null}function g(e,o){const{hasWater:r,output:t}=o;r&&e.include(c,o);const{vertex:l,fragment:s,varyings:n}=e;n.add("vtcOverlay","vec4");const d=10===t;l.code.add(v`void setOverlayVTC(in vec2 uv) {
|
|
3
3
|
vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
|
|
4
4
|
}`),s.code.add(v`bool isValid(vec2 uv, vec2 dxdy) {
|
|
5
5
|
return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Accessor.js";const r={required:[]},t={required:[
|
|
2
|
+
import e from"../../../../core/Accessor.js";const r={required:[]},t={required:[3]};class s extends e{precompile(e){return!!this.acquireTechniques(e)}get usedMemory(){return 0}get renderOccludedFlags(){return 1}get testsTransparentRenderOrder(){return 0}get isDecoration(){return!1}get readyToRun(){return!1}get numGeometries(){return 0}get hasOccludees(){return!1}get hasEmitters(){return!1}forEachGeometry(e){}}class n extends s{}class u extends s{}export{u as AsyncRenderPlugin,t as ConsumesDepth,r as ConsumesNone,n as SyncRenderPlugin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import"../../../../core/has.js";import{destroyMaybe as
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as s,sync as r}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{property as n,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{cloudPresets as u}from"./clouds/CloudsPresets.js";import{CloudsRenderer as c}from"./clouds/CloudsRenderer.js";import{Precipitation as p}from"./precipitation/Precipitation.js";let h=class extends e{constructor(t){super(t),this._clouds=o(null),this._incarnation=0,this._precipitation=null}initialize(){const t=()=>this._requestRender();this.addHandles([s(()=>this._precipitation,t,r),s(()=>this._clouds.value?.state,t,r),s(()=>this.view.state.mode,t,r),s(()=>this._updateClouds(),t,r),s(()=>this._updatePrecipitation(),t,r),s(()=>this.weather,t=>this._initWeather(t))])}destroy(){this.removeHandles(),this._clouds.value=i(this._clouds.value),this._precipitation=null,this._precipitationOutgoing=null}get readyToRun(){return!!this._clouds.value?.readyToRun}get usedMemory(){return this._clouds.value?.usedMemory??0}_fadeOutPrecipitation(){this._precipitation&&(this._precipitationOutgoing?.destroy(),this._precipitationOutgoing=this._precipitation,this._precipitationOutgoing.fadeOut(()=>this._precipitationOutgoing=i(this._precipitationOutgoing)),this._precipitation=null,++this._incarnation)}get snowCover(){return this._precipitationOutgoing?.snowCover??this._precipitation?.snowCover??0}get weather(){return this.view?.environmentManager?.weatherEnabled?this.view.environment.weather:null}cleanupCubemap(){const t=this._clouds.value;0!==t?.state||0!==t.coverage||t.readyToRun||t.destroyCubeMap()}_requestRender(){this.view.stage.renderView.requestRender()}_initWeather(t){t&&this.context?this._clouds.value||(this._clouds.value=new c({context:this.context,view:this.view,requestRender:()=>this._requestRender()})):this._clouds.value=i(this._clouds.value)}_updateClouds(){const t=this.view.environment.weather;return null==t||null==this._clouds.value||this._clouds.value.applyPreset(u[t.type],l(t)),++this._incarnation}_updatePrecipitation(){const t=this.view.environment.weather;if(t.type===this._precipitation?.type)return this._incarnation;this._fadeOutPrecipitation();return("rainy"===t.type||"snowy"===t.type)&&(this._precipitation=new p({view:this.view,type:t.type}),++this._incarnation),this._incarnation}get test(){}};function l(t){switch(t.type){case"rainy":case"snowy":case"cloudy":case"sunny":return t.cloudCover;case"foggy":return t.fogStrength}}t([n({constructOnly:!0})],h.prototype,"view",void 0),t([n({constructOnly:!0})],h.prototype,"context",void 0),h=t([a("esri.views.3d.webgl-engine.effects.WeatherFader")],h);export{h as WeatherFader};
|
|
@@ -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/Logger.js";import{destroyMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,cast as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Logger.js";import{destroyMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,cast as l,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as d}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeVisualizerNode as h}from"./RenderNodeVisualizerNode.js";import{ColorAttachment0 as a}from"../../../../webgl/enums.js";import c from"../../../../../widgets/Widget.js";import{tsx as p}from"../../../../../widgets/support/widget.js";let u=class extends c{constructor(){super(...arguments),this.clearColor=d,this.previewSize=v,this.filter=["color"],this.node=null,this.active=!0,this._previews=new Map,this._allPreviews=new Set,this._dirty=!0,this.previewEnabled=!0}castPreviewSize(e){return Math.max(e,v)}get _namedFilters(){const e=this.filter?.filter(e=>"color"!==e&&"depth"!==e);return e&&e.length>0?e:null}initialize(){this.node||(this.node=new h({view:this.view,destroyedCB:()=>{this.node=null,this.destroy()},clearColor:this.clearColor}));const e=this.node;this.addHandles([r(()=>this.active,i=>{this.view.stage.renderer.fboCache.debugCallback=i?(i,r)=>{if(null==i||null==r||!this.view.stage.renderView.renderingContext)return this._previews.forEach(([e])=>e.release()),void this._previews.clear();if("fbo visualizer"===i||null!=this._namedFilters&&!this._namedFilters.includes(i)||r&&0===r.colorAttachments.length&&null==r.depthStencilTexture)return;const{width:s,height:o}=r,l=o>this.previewSize?Math.round(s*this.previewSize/o):s,n=o>this.previewSize?this.previewSize:o;if(l/n>4)return void t.getLogger(this).warnOnce(`Skipping preview of wide ${i} FBO (${l}x${n}px)`);const d=this._fboInFocus?.startsWith(`${i}\n`)??!1,h=e.getDownscaledFBO(r,d,i,l,n),a=null!=r.depthStencilTexture,c=this.filter?.includes("color")||!this.filter?.includes("depth"),p=this.filter?.includes("depth")||!this.filter?.includes("color");h.fbo?.colorAttachments.forEach((e,t)=>{const l=h.getAttachment(e);if(l){const n=a&&t===r.colorAttachments.length;if(n&&!p||!n&&!c)return;l.retain();const d=n?`${i}\ndepth`:`${i}\n${w(r,e)}`,h=this._previews.get(d);h?.[0]?.release(),this._previews.set(d,[l,s,o]),this._allPreviews.add(d)}}),h.detachAllColors(),h.release(),this._dirty=!0}:null},s),r(()=>this.previewEnabled,e=>{e?(this._updatePreviews(),this._updateInterval=setInterval(()=>this._updatePreviews())):this._removeUpdate()},s)])}destroy(){this.removeHandles(),this.view.stage?.renderer&&(this.view.stage.renderer.fboCache.debugCallback=null),this._removeUpdate(),this.node&&(this.node.destroyedCB=()=>{},this.node=i(this.node)),this._previews.forEach(([e])=>e.release()),this._previews.clear()}_updatePreviews(){if(!this._dirty)return;this._dirty=!1,this.renderNow();let e=!1;this._previews.forEach((t,i)=>e=i===this._fboInFocus||e),this._fboInFocus&&!e&&this._deselectFocusFBO(),this._allPreviews.forEach((e,t)=>{const i=this._getElement(t);if(!i)return;i.getContext("2d").clearRect(0,0,i.width,i.height)}),this._previews.forEach(([e,t,i],r)=>{const s=this._getElement(r);if(!s)return;const o=i>this.previewSize?Math.round(t*this.previewSize/i):t,l=i>this.previewSize?this.previewSize:i;s.style.width=`${o}px`,s.style.height=`${l}px`;const n=s.width,d=s.height,h=this._getElement(`label-${r}`);h&&(h.innerText=`${r} (${t}x${i})`);const a=this.node?.getPreviewContent(n,d,e,r),c=s.getContext("2d");c.clearRect(0,0,n,d),a&&c.putImageData(a,0,0)})}_getElement(e){return document.querySelector("arcgis-scene")?.shadowRoot?.getElementById(e)??document.getElementById(e)}_fboPreviewStyle(e){return{width:"1px",height:"1px",background:e?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0)",transform:"rotateX(180deg)"}}_removeUpdate(){null!=this._updateInterval&&(clearInterval(this._updateInterval),this._updateInterval=null)}_selectFocusFBO(e){this._fboInFocus=e,this.view.stage.renderView.requestRender()}_deselectFocusFBO(){this._fboInFocus=null,this.node?.clearFocusedFBO(),this.view.stage.renderView.requestRender()}_renderFBOPreviews(){const e=this._allPreviews.size>0?Array.from(this._allPreviews.keys()).sort().map(e=>this._renderFBOPreview(e)):p("div",null);return p("div",{styles:{display:"flex",flexFlow:"row wrap",justifyContent:"flex-end",gap:"2px"}},e)}_renderFBOPreview(e){const t=this._previews.has(e);return p("div",{key:e,onclick:()=>this._selectFocusFBO(e),styles:{display:"flex",flexFlow:"column nowrap",alignItems:"center"}},p("canvas",{id:e,styles:this._fboPreviewStyle(t)}),p("div",{id:e,styles:{display:"flex",justifyContent:"center"}},p("p",{id:`label-${e}`,styles:{fontSize:"12px",color:"white",margin:"1px",textShadow:"-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000"}})))}render(){return p("div",{class:"esri-widget debug-widget",styles:{display:"flex",flexFlow:"column nowrap",alignItems:"flex-end",background:"rgba(255, 255, 255, 0)"}},this._renderFBOPreviews(),p("button",{onclick:()=>this._deselectFocusFBO(),type:"button"},"Reset focus"))}};function w(e,t){return`${e.getColorTexture(t)?.debugName??"color"+(t-a)}`}e([o({constructOnly:!0})],u.prototype,"view",void 0),e([o({constructOnly:!0})],u.prototype,"clearColor",void 0),e([o()],u.prototype,"previewSize",void 0),e([l("previewSize")],u.prototype,"castPreviewSize",null),e([o()],u.prototype,"filter",void 0),e([o()],u.prototype,"_namedFilters",null),e([o()],u.prototype,"node",void 0),e([o()],u.prototype,"active",void 0),e([o()],u.prototype,"previewEnabled",void 0),u=e([n("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizer")],u);const v=140;export{u as RenderNodeVisualizer,v as minimumPreviewSize};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{checkWebGLError as l}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as h,SizedPixelFormat as p,DataType as d}from"../../../../webgl/enums.js";let f=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=i.FINAL,this.consumes={required:[i.FINAL]},this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===i.FINAL);if(!this._focusedTexture)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const o=this._focusedTexture.attachment,n=[g(o)],s=this._ensureProgram(t,!1,n);return t.useProgram(s),t.bindTexture(o,0),s.setUniform1i("colorTex0",0),s.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&s.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n){r&&(o=e.width,n=e.height);const i="linear depth"===t||t.includes("shadow"),s="overlay highlight"===t||"highlights"===t||"highlight mix"===t,a="highlight coverage"===t,c=e.colorTexture?.descriptor,u=c?.internalFormat,p=[],d=new Array,f=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);p.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),d[t]=!0)}if(t>0){const t=e.getColorTexture(r)?.descriptor.internalFormat;return void f.push(x(t))}f.push(i?0:s?1:a?2:x(u))});const m=this.renderingContext,{depthStencilTexture:v}=e,F=this._ensureProgram(m,null!=v,p),T=this.fboCache.acquire(o,n,"fbo visualizer");m.useProgram(F),m.bindFramebuffer(T.fbo);const b=[];e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;m.bindTexture(e.getColorTexture(r),t),F.setUniform1i(o,t),t>0&&T.acquireColor(h+t,5,"fbo visualizer"),b.push(r)});const C=v?.descriptor.linearFilterDepth??!1;if(v){const r=e.colorAttachments.length;v.setShadowFiltering(!1),m.bindTexture(v,r),F.setUniform1i("depthTex",r);const t=h+r;t>h&&T.acquireColor(t,5,"fbo visualizer"),b.push(t)}m.gl.drawBuffers(b),l(m.gl);const R=m.getViewport();return m.setViewport(0,0,o,n),m.setClearColor(0,0,0,0),m.clear(16384),m.setBlendingEnabled(!0),m.setBlendFunction(1,771),F.setUniform1iv("inputTypes",f),F.setUniform2fv("nearFar",this.camera.nearFar),m.screen.draw(),l(m.gl),m.bindFramebuffer(null),m.setViewport(R.x,R.y,R.width,R.height),r&&(this._focusedTexture?.release(),this._focusedTexture=T.getAttachment(h),this._focusedTexture?.retain(),this._focusedFBOType=f[0]),e.colorAttachments.forEach((r,t)=>{if(d[t]){const t=e.getColorTexture(r);t?.clearMipmap()}}),v&&v.setShadowFiltering(C),T}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(s?.fbo);const a=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const c=t.attachment,u=this._ensureProgram(n,!1,[g(c)]);n.useProgram(u),n.bindTexture(c,0),u.setUniform1i("colorTex0",0),u.setUniform1iv("inputTypes",[i||c.descriptor.internalFormat!==p.RGBA16F?7:5]),n.screen.draw();const h=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,d.UNSIGNED_BYTE,new Uint8Array(h.data.buffer)),l(n.gl),n.bindFramebuffer(null),n.setViewport(a.x,a.y,a.width,a.height),s?.release(),h}_ensureProgram(e,r,t){const o=v({hasDepthAttachment:r,colorSamplerTypes:t}),n=this._programs.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",s=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${m(o)} colorTex${c.int(t)};`}return r},l=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(texture(colorTex${t}, uv).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv).rgb, 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv)) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t},iuv,0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n fragColor${t} = vec4(texture(colorTex${t}, uv));\n }\n }`,""),h=t.length,p=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${s(t)}\n ${a(r,`layout(location = ${c.int(h)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${l(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,d=e.programCache.get(i,p,u);return this._programs.set(o,d),d}};function m(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function g(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case p.R8I:case p.R16I:case p.R32I:case p.RG8I:case p.RG16I:case p.RG32I:case p.RGB8I:case p.RGB16I:case p.RGB32I:case p.RGBA8I:case p.RGBA16I:case p.RGBA32I:return"int";case p.R8UI:case p.R16UI:case p.R32UI:case p.RG8UI:case p.RG16UI:case p.RG32UI:case p.RGB8UI:case p.RGB16UI:case p.RGB32UI:case p.RGBA8UI:case p.RGBA16UI:case p.RGBA32UI:return"uint";default:return"float"}}function v(e){const{hasDepthAttachment:r,colorSamplerTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}function x(e){switch(e){case p.R16F:case p.R32F:case p.R8:return 3;case p.RG8:return 4;case p.RGBA16F:return 5;case p.RG8UI:return 6;default:return 7}}e([t()],f.prototype,"destroyedCB",void 0),e([t()],f.prototype,"produces",void 0),e([t()],f.prototype,"consumes",void 0),e([t()],f.prototype,"clearColor",void 0),f=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],f);export{f as RenderNodeVisualizerNode};
|
|
2
|
+
import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{checkWebGLError as l}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as h,SizedPixelFormat as p,DataType as d}from"../../../../webgl/enums.js";let f=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=i.FINAL,this.consumes={required:[i.FINAL]},this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===i.FINAL);if(!this._focusedTexture)return r;const t=this.renderingContext;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const o=this._focusedTexture.attachment,n=[g(o)],s=this._ensureProgram(t,!1,n);return t.useProgram(s),t.bindTexture(o,0),s.setUniform1i("colorTex0",0),s.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&s.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),r}getDownscaledFBO(e,r,t,o,n){r&&(o=e.width,n=e.height);const i="linear depth"===t||t.includes("shadow"),s="overlay highlight"===t||"highlights"===t||"highlight mix"===t,a="highlight coverage"===t,c=e.colorTexture?.descriptor,u=c?.internalFormat,p=[],d=new Array,f=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=g(o);p.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),d[t]=!0)}if(t>0){const t=e.getColorTexture(r)?.descriptor.internalFormat;return void f.push(x(t))}f.push(i?0:s?1:a?2:x(u))});const m=this.renderingContext,{depthStencilTexture:v}=e,F=this._ensureProgram(m,null!=v,p),T=this.fboCache.acquire(o,n,"fbo visualizer");m.useProgram(F),m.bindFramebuffer(T.fbo);const b=[];e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;m.bindTexture(e.getColorTexture(r),t),F.setUniform1i(o,t),t>0&&T.acquireColor(h+t,5,"fbo visualizer"),b.push(r)});const C=v?.descriptor.linearFilterDepth??!1;if(v){const r=e.colorAttachments.length;v.setShadowFiltering(!1),m.bindTexture(v,r),F.setUniform1i("depthTex",r);const t=h+r;t>h&&T.acquireColor(t,5,"fbo visualizer"),b.push(t)}m.gl.drawBuffers(b),l(m.gl);const R=m.getViewport();return m.setViewport(0,0,o,n),m.setClearColor(0,0,0,0),m.clear(16384),m.setBlendingEnabled(!0),m.setBlendFunction(1,771),F.setUniform1iv("inputTypes",f.length>0?f:[7]),F.setUniform2fv("nearFar",this.camera.nearFar),m.screen.draw(),l(m.gl),m.bindFramebuffer(null),m.setViewport(R.x,R.y,R.width,R.height),r&&(this._focusedTexture?.release(),this._focusedTexture=T.getAttachment(h),this._focusedTexture?.retain(),this._focusedFBOType=f[0]),e.colorAttachments.forEach((r,t)=>{if(d[t]){const t=e.getColorTexture(r);t?.clearMipmap()}}),v&&v.setShadowFiltering(C),T}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(s?.fbo);const a=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const c=t.attachment,u=this._ensureProgram(n,!1,[g(c)]);n.useProgram(u),n.bindTexture(c,0),u.setUniform1i("colorTex0",0),u.setUniform1iv("inputTypes",[i||c.descriptor.internalFormat!==p.RGBA16F?7:5]),n.screen.draw();const h=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,d.UNSIGNED_BYTE,new Uint8Array(h.data.buffer)),l(n.gl),n.bindFramebuffer(null),n.setViewport(a.x,a.y,a.width,a.height),s?.release(),h}_ensureProgram(e,r,t){const o=v({hasDepthAttachment:r,colorSamplerTypes:t}),n=this._programs.get(o);if(n)return n;const i="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",s=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${m(o)} colorTex${c.int(t)};`}return r},l=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(texture(colorTex${t}, uv).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv).rgb, 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv)) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t},iuv,0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n fragColor${t} = vec4(texture(colorTex${t}, uv));\n }\n }`,""),h=t.length,p=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${s(t)}\n ${a(r,`layout(location = ${c.int(h)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${l(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,d=e.programCache.get(i,p,u);return this._programs.set(o,d),d}};function m(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function g(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case p.R8I:case p.R16I:case p.R32I:case p.RG8I:case p.RG16I:case p.RG32I:case p.RGB8I:case p.RGB16I:case p.RGB32I:case p.RGBA8I:case p.RGBA16I:case p.RGBA32I:return"int";case p.R8UI:case p.R16UI:case p.R32UI:case p.RG8UI:case p.RG16UI:case p.RG32UI:case p.RGB8UI:case p.RGB16UI:case p.RGB32UI:case p.RGBA8UI:case p.RGBA16UI:case p.RGBA32UI:return"uint";default:return"float"}}function v(e){const{hasDepthAttachment:r,colorSamplerTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}function x(e){switch(e){case p.R16F:case p.R32F:case p.R8:return 3;case p.RG8:return 4;case p.RGBA16F:return 5;case p.RG8UI:return 6;default:return 7}}e([t()],f.prototype,"destroyedCB",void 0),e([t()],f.prototype,"produces",void 0),e([t()],f.prototype,"consumes",void 0),e([t()],f.prototype,"clearColor",void 0),f=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],f);export{f as RenderNodeVisualizerNode};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as t}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import s from"../../../webgl/RenderNode.js";let i=class extends s{constructor(e){super(e),this.consumes={required:["olid"]},this.produces="olid"}destroy(){}render(e){const r=e.find(({name:e})=>"olid"===e),o=this.renderingContext;return o.bindFramebuffer(r.fbo),o.clearFramebuffer(t,!0,!0),this.view.stage.renderer.renderAllGeometry(
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as t}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import s from"../../../webgl/RenderNode.js";let i=class extends s{constructor(e){super(e),this.consumes={required:["olid"]},this.produces="olid"}destroy(){}render(e){const r=e.find(({name:e})=>"olid"===e),o=this.renderingContext;return o.bindFramebuffer(r.fbo),o.clearFramebuffer(t,!0,!0),this.view.stage.renderer.renderAllGeometry(11),o.clear(1280),this.view.stage.renderer.renderHUD(1),r}};e([r()],i.prototype,"consumes",void 0),e([r()],i.prototype,"produces",void 0),i=e([o("esri.views.3d.webgl-engine.effects.geometry.ObjectAndLayerIDRenderNode")],i);export{i as ObjectAndLayerIDRenderNode};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{create as
|
|
2
|
+
import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import h from"../../webgl/RenderCamera.js";import{CloudsParameters as e}from"../effects/clouds/CloudsParameters.js";import{OITPolygonOffsetLimit as s}from"./OrderIndependentTransparency.js";import{SceneLighting as r}from"../lighting/SceneLighting.js";class n{constructor(t,i){this.width=t,this.height=i}}class l{constructor(t,s){this._rctx=t,this.shadowMap=s,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.hasEmission=!1,this.hasFloatOit=!0,this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillEnabled=!1,this._camera=new h,this._inverseViewport=i(),this._oldLighting=new r,this._newLighting=new r,this._fadedLighting=new r,this._lighting=this._newLighting,this.ssr=new g,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=i(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new e,this.shadowHighlightsVisible=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=null,this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.terrainDepth=null}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOffset(){return 1===this.output&&this.camera.relativeElevation<s}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,h,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=h,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===e&&this.clouds.requestFade(),this.fadeLighting()}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}class g{constructor(){this.fadeFactor=1,this.reprojectionMatrix=t()}}export{l as BindParameters,n as ViewportSize};
|
|
@@ -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 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 f}from"../../state/Frustum.js";import{glLayout as _}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 v}from"../../../webgl/enums.js";import{Sync as O}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=7,this._frustum=new f(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.precompileCutFillReferenceDepth()}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(),f=a.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);u.bindFramebuffer(f.fbo),u.setViewport(0,0,this._width,this._height),u.clear(1280),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const _=a.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);u.bindFramebuffer(_.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=f.depthTexture,this._cutFillDepthParameters.targetDepthTexture=_.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),f.release(),_.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 O(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,v.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.reduce((t,e)=>t+e.indices.length,0),s=z.createBuffer(r),h=s.position;let o=0;for(const i of e){const{positions:t,indices:e}=i;for(let i=0;i<e.length;++i){const r=3*e[i];h.set(o,0,t[r]),h.set(o,1,t[r+1]),h.set(o,2,t[r+2]),o++}}const n=new V(t,_(z),s.buffer);this._targetGeometryVao=new R(t,n)}};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};
|
|
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 f}from"../../state/Frustum.js";import{glLayout as _}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 v}from"../../../webgl/enums.js";import{Sync as O}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 f(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.precompileCutFillReferenceDepth()}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(),f=a.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);u.bindFramebuffer(f.fbo),u.setViewport(0,0,this._width,this._height),u.clear(1280),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const _=a.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);u.bindFramebuffer(_.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=f.depthTexture,this._cutFillDepthParameters.targetDepthTexture=_.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),f.release(),_.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 O(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,v.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.reduce((t,e)=>t+e.indices.length,0),s=z.createBuffer(r),h=s.position;let o=0;for(const i of e){const{positions:t,indices:e}=i;for(let i=0;i<e.length;++i){const r=3*e[i];h.set(o,0,t[r]),h.set(o,1,t[r+1]),h.set(o,2,t[r+2]),o++}}const n=new V(t,_(z),s.buffer);this._targetGeometryVao=new R(t,n)}};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
|
-
class
|
|
2
|
+
class e{constructor(e){this._material=e.material,this._techniques=e.techniques,this._output=e.output}dispose(){}get _stippleTextures(){return this._techniques.context?.stippleTextures}get _markerTextures(){return this._techniques.context?.markerTextures}getTechnique(e,t){return this._techniques.get(e,this._material.getConfiguration(t))}ensureResources(e){return 2}}export{e as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{generateUID as r}from"../../../../core/uid.js";import{isColor as t}from"../core/shaderLibrary/ShaderOutput.js";import{updateParameters as e}from"../materials/internal/MaterialUtil.js";import{NoParameters as i}from"../../../webgl/NoParameters.js";class s{constructor(t,i){this.id=r(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new i,e(this._parameters,t),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(r){return!1}setParameters(r,t=!0){e(this._parameters,r)&&(this.validateParameters(this._parameters),t&&this._parametersChanged())}validateParameters(r){}shouldRender(r){return this.visible&&this.isVisibleForOutput(r.output)&&(!this.parameters.isDecoration||r.bind.decorations)&&0!==(this.parameters.renderOccluded&r.renderOccludedMask)}isVisibleForOutput(r){return!0}get renderPriority(){return this._renderPriority}set renderPriority(r){r!==this._renderPriority&&(this._renderPriority=r,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(r
|
|
2
|
+
import{generateUID as r}from"../../../../core/uid.js";import{isColor as t}from"../core/shaderLibrary/ShaderOutput.js";import{updateParameters as e}from"../materials/internal/MaterialUtil.js";import{NoParameters as i}from"../../../webgl/NoParameters.js";class s{constructor(t,i){this.id=r(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new i,e(this._parameters,t),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(r){return!1}setParameters(r,t=!0){e(this._parameters,r)&&(this.validateParameters(this._parameters),t&&this._parametersChanged())}validateParameters(r){}shouldRender(r){return this.visible&&this.isVisibleForOutput(r.output)&&(!this.parameters.isDecoration||r.bind.decorations)&&0!==(this.parameters.renderOccluded&r.renderOccludedMask)}isVisibleForOutput(r){return!0}get renderPriority(){return this._renderPriority}set renderPriority(r){r!==this._renderPriority&&(this._renderPriority=r,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(r){return this.updateConfiguration(r),this._configuration}updateConfiguration(r){this._configuration.output=r.output,this._configuration.hasEmission=r.hasEmission&&t(r.output),this._configuration.hasHighlightMixTexture=10===r.output&&null!=r.highlightMixTexture,this._configuration.hasFloatOit=r.hasFloatOit}}class a extends i{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}}export{s as Material,a as MaterialParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{defaultDepthWrite as
|
|
2
|
+
import{isOITColor as t}from"../core/shaderLibrary/ShaderOutput.js";import{defaultDepthWrite as r,premultipliedAlpha as e,unpremultipliedAlphaToPremultipliedAlpha as n,separateBlendingParams as u}from"../../../webgl/renderState.js";const c=u(1,0,1,771);function o(t,r=!1){switch(t){case 0:return r?e:n;case 1:return c;default:return null}}function a(t){if(t.draped)return null;switch(t.output){case 0:case 2:default:return t.writeDepth?r:null;case 1:return null}}function l(r,e=513){return{func:t(r)?515:e}}const s={factor:-1,units:-2},f=5e5;function i({output:r,enableOffset:e}){return e&&t(r)?s:null}export{s as OITPolygonOffset,f as OITPolygonOffsetLimit,o as blending,c as blendingColorAlpha,l as depthTest,a as depthWrite,i as oitPolygonOffset};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{Milliseconds as t}from"../../../../core/time.js";import e from"../../webgl/RenderCamera.js";import{BindParameters as r}from"./BindParameters.js";class i{constructor(i,
|
|
2
|
+
import{Milliseconds as t}from"../../../../core/time.js";import e from"../../webgl/RenderCamera.js";import{BindParameters as r}from"./BindParameters.js";class i{constructor(i,n,o){this.rctx=i,this.techniques=o,this.lastFrameCamera=new e,this.renderOccludedMask=s,this.time=t(0),this.bind=new r(i,n),this.bind.alignPixelEnabled=!0}get output(){return this.bind.output}}const s=13;export{i as RenderContext,s as defaultRenderOccludedMask};
|
|
@@ -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 r,abortMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as h}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as d,initial as _,sync as l}from"../../../../core/reactiveUtils.js";import{signal as u}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as m,invert as f,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as T}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as A,InternalRenderCategory as x,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as R}from"../../webgl.js";import{minNearDistanceInMeters as D}from"../../state/NearFarHeuristic.js";import{debugFlags as O}from"../../support/debugFlags.js";import{FBOCache as I}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as H}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as N}from"../effects/RenderPluginManager.js";import{WeatherFader as M}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as q}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as G}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as U,renderHighlightBuffer as L}from"../effects/highlight/Highlight.js";import{OITBlend as j}from"../effects/transparency/OITBlend.js";import{AnimationTimer as V}from"./AnimationTimer.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as W}from"./DepthRange.js";import{depthRangeFromScene as Q}from"./depthRangeUtils.js";import{MainFramebuffer as Y}from"./MainFramebuffer.js";import{RenderContext as J,defaultRenderOccludedMask as K}from"./RenderContext.js";import{RendererBase as Z}from"./RendererBase.js";import{setupFeatureDefaults as $}from"./RenderFeature.js";import{RenderPluginInput as X}from"./RenderPluginInput.js";import{ShadowAccumulator as ee}from"./ShadowAccumulator.js";import{ShadowMap as te}from"./ShadowMap.js";import se from"./SliceHelper.js";import{MergedRenderer as re}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ie}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ae,PerformanceCategory as ne}from"../statistics/RendererPerformanceInfo.js";import{PixelType as he,ColorAttachment1 as oe,ColorAttachment2 as de,ColorAttachment0 as _e}from"../../../webgl/enums.js";let le=class extends Z{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new se,this.sceneDepthRange=u(W.Infinite),this._state=u(2),this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=u(0),this._hasOIT8=!has("disable-feature:oit8"),this._hasIOSEmission=this._hasOIT8&&!has("disable-feature:oit8-emissive"),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new X,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Ce)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._debugNeedsDepth=!1,this._fboCache=new I(r),this._compositor=new z(r,s),this._renderStateFeatures=u($(e.view.qualityProfile)),this._shadowMap=new te(this._fboCache,e.viewingMode),this._renderContext=new J(this._rctx,this._shadowMap,s),this._framebuffer=new Y(this._fboCache,this._bindParameters),this._performanceInfo=new ae(this._rctx),this._blit=new G(s),this._shadowAccumulator=new ee(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(3,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new v(this._renderContext),this._plugins=new N({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new M({view:e.view}),this._plugins.add(this.weatherFader),this.addHandles([o(()=>e.view.state.camera,()=>i(),d),o(()=>O.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),o(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():E;T(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},d),o(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=H,d),o(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},l),o(()=>this._bindParameters.clouds.data?.state,()=>i(),l),o(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),o(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},d)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,k.prune(),re.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new j(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=$(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasIOSEmission||this.hasFloatOit)}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOutputs(),this._bindParameters.depth=n(this._bindParameters.depth)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");h(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:Re(this.stage.view.resourceController)});return this.addHandles(o(()=>s.updating,()=>this._requestRender(),l)),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&&m(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._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}get hasFloatOit(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatOit||this._hasOIT8}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,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...be),has.water=this._plugins.produces(2,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new V(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?r(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,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return new ie(this._pluginInput.get(A.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h,this._renderContext.time=t,this._rctx.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null,this._bindParameters.hasFloatOit=this.hasFloatOit;const d=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=d?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(x.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(x.CUTFILL_COMPUTATION),this._renderOverlay(),a.setGLViewport(this._rctx);const _=this._framebuffer,l=_.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(l?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=l):l?.release(),this._ensureBindParametersCamera(a,n),this._plugins.sortTestsTransparentOrderedSlots(Te),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!r,this._hasTransparentGeometry=this._plugins.produces(0,...pe),this._precompilePrepasses(),this.performanceInfo.advance(ne.PREPARE);const u=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,u),this._pluginInput.set("normals",this._renderNormals()),this._renderSSAOAndDepth(),this._renderShadowAccumulation(u,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),this._precompileShaders(),this._rctx.output=0,_.bind(),this._bindParameters.mainDepth=_.depth.attachment,this._renderOpaque(),this._renderTransparent(),this._shadowMap.disposeOutput(3),this._renderCutFillComputation(),this._pluginInput.set(x.FOCUSAREA,this._renderFocusAreaGeometry()),_.update(e=>this._renderNodes(x.TRANSPARENT_ENVIRONMENT,e)),_.update(e=>this._renderNodes(x.VIEWSHED,e)),_.update(e=>this._renderNodes(x.LASERLINES,e)),_.update(e=>this._renderNodes(x.FOCUSAREA_COLOR,e)),this._pluginInput.release(x.FOCUSAREA),_.update(e=>this._renderNodes(x.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const p=2===s?this._renderObjectAndLayerIdColor():null;_.update(e=>this._renderNodes(A.COMPOSITE,e)),this._shadowMap.disposeOutputs(),_.update(e=>this._renderNodes(x.ANTIALIASING,e));const c=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let m;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&_.update(e=>this._renderHUD(c,e)),_.update(e=>this._renderNodes(x.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||_.update(e=>this._renderHUD(c,e)),this._bindParameters.hasEmission=this._hasEmission,_.update(e=>this._renderNodes(x.MAGNIFIER,e)),_.update(e=>this._renderNodes(A.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,_.color,this._bindParameters),this.onPostRender?.(),this._releaseFBOs(),_.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(m=_.color,m.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new ie(m,p)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._rctx.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,x.OPAQUE_ENVIRONMENT,x.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._rctx.output=1,this._plugins.precompile(...ce),this._needsDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._rctx.output=0,this._plugins.precompile(...ce),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._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,x.FOCUSAREA);const s=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,x.TRANSPARENT_ENVIRONMENT,x.VIEWSHED,x.CUTFILL_COMPUTATION,x.LASERLINES,x.FOCUSAREA_COLOR,x.OCCLUDED,x.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(8),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,x.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,A.COMPOSITE,x.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(x.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ne.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._rctx.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(ne.OBJECT_AND_LAYER_ID_COLOR),this._rctx.output=e,r}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 r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(E),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),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,he.UNSIGNED_BYTE,t),i.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:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,E),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?ne.OPAQUE_EDGES:ne.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ne.OVERLAY)}_renderShadowMap(e,t,s){if(!this.shadowsEnabled)return;const r=this._shadowMap;r.start(e,t,s,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),r.clear(),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(x.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){const s=this._rctx.output;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e);t.finish(e),this._rctx.output=s}get _needsDepth(){return this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderSSAOAndDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(x.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),this._bindParameters.depth?.release(),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(ne.DEPTH)):(e.detachDepth(),this._bindParameters.depth=n(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(this._bindParameters.depth=n(this._bindParameters.depth),!this._needsDepth)return;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ne.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._rctx.output;this._rctx.output=1;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._rctx.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._rctx.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._rctx.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return W.Zero;const t=Q(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=W.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<q)return void(this.sceneDepthRange.value=W.Infinite);const t=e.clone();t.near=D,t.far=1e10;const s=Q(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(){const e=this._nodes.require("normals",...S,x.VIEWSHED,x.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,x.SSAO)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(E,!0,!0),this._rctx.output=2,this._plugins.render(...me);const i=this._nodes.optional("normals",...S,x.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(ne.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(x.SSAO,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ne.SSAO),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._rctx.output;this._rctx.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ce),this._rctx.output=t}renderAllGeometry(e){this._rctx.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,...ge);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(10),this.renderSlots(e,...ge),this._renderContext.renderOccludedMask=K}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...we[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFillReferenceDepth(){const e=this._rctx.output;this._rctx.output=7,this._plugins.precompile(...Ee),this._rctx.output=e}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._rctx.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.output=r}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._rctx.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._rctx.output=7,this._plugins.render(...Ee),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._rctx.output=r}_renderOpaqueAndTransparentGeometry(e){this._rctx.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._rctx.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ue),this._nodes.precompile(this._bindParameters.hasEmission,x.CUTFILL_COLOR,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ue)}_renderTransparentGeometry(){this._plugins.render(...pe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,E),this.performanceInfo.advance(ne.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...ce)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(this._hudDepthFormat,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(this._pluginsHas.hudElements&&(this._precompileHUDOutput(e),this._hasHighlights)){const t=this._rctx.output;this._rctx.output=8,this._precompileHUDOutput(e),this._rctx.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled&&F(this._rctx.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0,this._oitBlend.precompile(this._bindParameters,!1,1)):this._plugins.precompile(...be),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const r=!!t.getTexture(oe);this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),r),s.release()}else if(this._rctx.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?ne.HUD_OCCLUDED:ne.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=s,n=a.length>U?3:1,h=e.acquire(r,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(8,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._rctx.output=8,t.bindFramebuffer(h.fbo),L(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ne.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...R)+this._nodes.optional("highlights",...R)-1),h}_renderHighlightGeometries(){this._plugins.render(...Pe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e);const{depth:s,camera:r,contentCamera:i}=this._bindParameters;this._rctx.output=0,this._shadowAccumulator.accumulating&&s&&this._shadowAccumulator.renderAccumulation(s,r,i,t)&&this.performanceInfo.advance(ne.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this.oitEnabled&&F(this._rctx.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...pe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.oitPass=2,this._plugins.precompile(...pe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.oitPass=0):this._plugins.precompile(...pe)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this.hasFloatOit?8:5,d=this._rctx.output;this._rctx.output=0,h.oitPass=1;const _=s?"oit hud":"oit",l=this.fboCache.acquire(r,i,_,o),u=this._bindParameters.hasEmission&&(0===e||1!==t);u&&l.acquireColor(oe,o,"oit emissive");const p=u?de:oe;l.acquireColor(p,this.hasFloatOit?7:0,"oit alpha"),s||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,E),a(),l.detachDepth(),h.oitPass=2;const c=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");u&&c.acquireColor(oe,o,"oit emissive front"),s?c.acquireDepth(this._hudDepthFormat):c.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(c.fbo),this._rctx.clearFramebuffer(E,s),a(),c.detachDepth();const m=this._pluginsHas.occludedHudElements&&!s;let f;return this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),h.oitPass=0,s?(f=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(m&&(this._framebuffer.color.acquireColor(p,0,"hud occlusion"),this._rctx.clearBuffer(p-_e,E)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,l,c,h,u,m,e),f?.detachDepth(),s||(this._rctx.bindFramebuffer(c.fbo),this._framebuffer.bind(),m&&(this._bindParameters.hudOcclusion=this._framebuffer.color.obtainAttachment(p))),c.release(),l.release(),this._rctx.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ue)||this.plugins.produces(3,...ue)||this.plugins.produces(1,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._framebuffer.update(e=>this._renderNodes(x.CUTFILL_COLOR,e)),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(A.OPAQUE,t,e)),this.fboCache.debugCallback?.(A.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(x.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(x.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(x.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(x.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(A.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(A.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),s=t?.getTexture();s&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,s&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(ne.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(ne.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(ne.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const r=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?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(f(xe,this._bindParameters.camera.viewMatrix),f(Ae,this._bindParameters.camera.projectionMatrix),g(Se,xe,Ae),g(Se,this._renderContext.lastFrameCamera.viewMatrix,Se),g(Se,this._renderContext.lastFrameCamera.projectionMatrix,Se),this._reprojectionMatrix=Se);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,a=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,a),e(),t.detachDepth()}get test(){}};e([p({readOnly:!0})],le.prototype,"highResolutionAtmosphere",null),e([p()],le.prototype,"_edgeView",void 0),e([p()],le.prototype,"updating",null),le=e([c("esri.views.3d.webgl-engine.lib.Renderer")],le);const ue=[0,1,2,3],pe=[7,8,4,5],ce=[6,7,8],me=[0,1,2,4,...ce],fe=[3,5],ge=[2,4,9],be=[17,13,15,14],Pe=[4,5,2,3,0,1,...ce],Te=[4,9,5,12],we={0:[14],1:[13],2:[14,13],3:[14,13]},Ee=[0,1,...ce],Ce=["normals","highlights"],Ae=P(),xe=P(),Se=P();function Re(e){return t=>e.immediate.schedule(t)}export{le 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 r,abortMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as h}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as d,initial as _,sync as u}from"../../../../core/reactiveUtils.js";import{signal as l}from"../../../../core/signal.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{equals as c,invert as f,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as w}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as T,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as A,InternalRenderCategory as S,AllRenderNodeOutputs as R,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import{FBOCache as I}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as H}from"../effects/RenderNodes.js";import{RenderPluginManager as N}from"../effects/RenderPluginManager.js";import{WeatherFader as M}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as q}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as G}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as L,renderHighlightBuffer as U}from"../effects/highlight/Highlight.js";import{OITBlend as j}from"../effects/transparency/OITBlend.js";import{AnimationTimer as V}from"./AnimationTimer.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{Compositor as W}from"./Compositor.js";import{DepthRange as z}from"./DepthRange.js";import{depthRangeFromScene as Q}from"./depthRangeUtils.js";import{MainFramebuffer as Y}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as J}from"./RenderContext.js";import{RendererBase as K}from"./RendererBase.js";import{setupFeatureDefaults as Z}from"./RenderFeature.js";import{RenderPluginInput as X}from"./RenderPluginInput.js";import{ShadowAccumulator as ee}from"./ShadowAccumulator.js";import{ShadowMap as te}from"./ShadowMap.js";import se from"./SliceHelper.js";import{MergedRenderer as re}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ie}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ae,PerformanceCategory as ne}from"../statistics/RendererPerformanceInfo.js";import{PixelType as he,ColorAttachment1 as oe,ColorAttachment2 as de,ColorAttachment0 as _e}from"../../../webgl/enums.js";let ue=class extends K{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=T(0,0,0,1),this._sliceHelper=new se,this.sceneDepthRange=l(z.Infinite),this._state=l(2),this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=l(0),this._hasOIT8=!has("disable-feature:oit8"),this._hasIOSEmission=this._hasOIT8&&!has("disable-feature:oit8-emissive"),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new X,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Ce)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._debugNeedsDepth=!1,this._fboCache=new I(r),this._compositor=new W(r,s),this._renderStateFeatures=l(Z(e.view.qualityProfile)),this._shadowMap=new te(this._fboCache,e.viewingMode),this._renderContext=new $(this._rctx,this._shadowMap,s),this._framebuffer=new Y(this._fboCache,this._bindParameters),this._performanceInfo=new ae(this._rctx),this._blit=new G(s),this._shadowAccumulator=new ee(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new H(this._renderContext),this._plugins=new N({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new M({view:e.view,context:this._renderContext}),this.addHandles([o(()=>e.view.state.camera,()=>i(),d),o(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),o(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():E;w(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},d),o(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,d),o(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),o(()=>this._bindParameters.clouds.data?.state,()=>i(),u),o(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),o(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},d)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(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._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,k.prune(),re.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new j(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=Z(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasIOSEmission||this.hasFloatOit)}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOutputs(),this._bindParameters.depth=n(this._bindParameters.depth)}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");h(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:De(this.stage.view.resourceController)});return this.addHandles(o(()=>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&&c(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._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}get hasFloatOit(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatOit||this._hasOIT8}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,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...be),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new V(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?r(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,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new ie(this._pluginInput.get(A.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null,this._bindParameters.hasFloatOit=this.hasFloatOit;const d=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=d?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(S.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(S.CUTFILL_COMPUTATION),this._renderOverlay(),a.setGLViewport(this._rctx);const _=this._framebuffer,u=_.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(u?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=u):u?.release(),this._ensureBindParametersCamera(a,n),this._ensureBindParametersWeatherFader(this._renderContext.time),this._plugins.sortTestsTransparentOrderedSlots(we),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!r,this._hasTransparentGeometry=this._plugins.produces(0,...pe),this._precompilePrepasses(),this.performanceInfo.advance(ne.PREPARE);const l=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,l),this._pluginInput.set("normals",this._renderNormals()),this._renderSSAOAndDepth(),this._renderShadowAccumulation(l,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),this._precompileShaders(),this._bindParameters.output=0,_.bind(),this._bindParameters.mainDepth=_.depth.attachment,this._renderOpaque(),this._renderTransparent(),this._shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(S.FOCUSAREA,this._renderFocusAreaGeometry()),_.update(e=>this._renderNodes(S.TRANSPARENT_ENVIRONMENT,e)),_.update(e=>this._renderNodes(S.VIEWSHED,e)),_.update(e=>this._renderNodes(S.LASERLINES,e)),_.update(e=>this._renderNodes(S.FOCUSAREA_COLOR,e)),this._pluginInput.release(S.FOCUSAREA),_.update(e=>this._renderNodes(S.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const p=2===s?this._renderObjectAndLayerIdColor():null;_.update(e=>this._renderNodes(A.COMPOSITE,e)),this._shadowMap.disposeOutputs(),_.update(e=>this._renderNodes(S.ANTIALIASING,e));const m=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let c;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&_.update(e=>this._renderHUD(m,e)),_.update(e=>this._renderNodes(S.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||_.update(e=>this._renderHUD(m,e)),this._bindParameters.hasEmission=this._hasEmission,_.update(e=>this._renderNodes(S.MAGNIFIER,e)),_.update(e=>this._renderNodes(A.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,_.color,this._bindParameters),this.onPostRender?.(),this._releaseFBOs(),_.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(c=_.color,c.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new ie(c,p)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,S.OPAQUE_ENVIRONMENT,S.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...me),this._needsDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._bindParameters.output=0,this._plugins.precompile(...me),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._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,S.FOCUSAREA);const s=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,S.TRANSPARENT_ENVIRONMENT,S.VIEWSHED,S.CUTFILL_COMPUTATION,S.LASERLINES,S.FOCUSAREA_COLOR,S.OCCLUDED,S.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,S.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,A.COMPOSITE,S.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(S.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ne.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 r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(ne.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,r}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 r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(E),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),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,he.UNSIGNED_BYTE,t),i.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:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,E),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?ne.OPAQUE_EDGES:ne.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ne.OVERLAY)}_renderShadowMap(e,t,s){if(!this.shadowsEnabled)return;const r=this._shadowMap;r.start(e,t,s,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(7,this._shadowMap),r.clear(),this._renderShadowCascades(6,this._shadowMap)):this._renderShadowCascades(5),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(S.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){const s=this._bindParameters.output;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=s}get _needsDepth(){return this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderSSAOAndDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(S.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth?.release(),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(ne.DEPTH)):(e.detachDepth(),this._bindParameters.depth=n(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(this._bindParameters.depth=n(this._bindParameters.depth),!this._needsDepth)return;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ne.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return z.Zero;const t=Q(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=z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<q)return void(this.sceneDepthRange.value=z.Infinite);const t=e.clone();t.near=O,t.far=1e10;const s=Q(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(){const e=this._nodes.require("normals",...R,S.VIEWSHED,S.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(4),this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,S.SSAO)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(E,!0,!0),this._bindParameters.output=4,this._plugins.render(...ce);const i=this._nodes.optional("normals",...R,S.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(ne.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(S.SSAO,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ne.SSAO),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...me),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,...ge);this._renderContext.renderOccludedMask=J}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(10),this.renderSlots(e,...ge),this._renderContext.renderOccludedMask=J}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Te[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillReferenceDepth(){const e=this._bindParameters.output;this._bindParameters.output=9,this._plugins.precompile(...Ee),this._bindParameters.output=e}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,r=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=r}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Ee),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=r}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...le),this._nodes.precompile(this._bindParameters.hasEmission,S.CUTFILL_COLOR,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...le)}_renderTransparentGeometry(){this._plugins.render(...pe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,E),this.performanceInfo.advance(ne.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...me)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(this._hudDepthFormat,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...be),this._bindParameters.output=2,this._plugins.precompile(...be),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...be)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...be)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const r=!!t.getTexture(oe);this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),r),s.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?ne.HUD_OCCLUDED:ne.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:r,height:i}=this._framebuffer.size,{highlights:a}=s,n=a.length>L?3:1,h=e.acquire(r,i,"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),U(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ne.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...Pe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e);const{depth:s,camera:r,contentCamera:i}=this._bindParameters;this._bindParameters.output=0,this._shadowAccumulator.accumulating&&s&&this._shadowAccumulator.renderAccumulation(s,r,i,t)&&this.performanceInfo.advance(ne.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this.oitEnabled&&F(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...pe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...pe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...pe)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this.hasFloatOit?8:5,d=h.output;h.output=1;const _=s?"oit hud":"oit",u=this.fboCache.acquire(r,i,_,o),l=this._bindParameters.hasEmission&&(0===e||1!==t);l&&u.acquireColor(oe,o,"oit emissive");const p=l?de:oe;u.acquireColor(p,this.hasFloatOit?7:0,"oit alpha"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,E),a(),u.detachDepth(),h.output=2;const m=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");l&&m.acquireColor(oe,o,"oit emissive front"),s?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(E,s),a(),m.detachDepth();const c=this._pluginsHas.occludedHudElements&&!s;let f;return this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(f=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(p,0,"hud occlusion"),this._rctx.clearBuffer(p-_e,E)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,m,h,l,c,e),f?.detachDepth(),s||(this._rctx.bindFramebuffer(m.fbo),this._framebuffer.bind(),c&&(this._bindParameters.hudOcclusion=this._framebuffer.color.obtainAttachment(p))),m.release(),u.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...le)||this.plugins.produces(5,...le)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._framebuffer.update(e=>this._renderNodes(S.CUTFILL_COLOR,e)),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(A.OPAQUE,t,e)),this.fboCache.debugCallback?.(A.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)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(S.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(S.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(A.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(A.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),s=t?.getTexture();s&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,s&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(ne.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(ne.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(ne.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const r=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?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_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)}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(f(Se,this._bindParameters.camera.viewMatrix),f(Ae,this._bindParameters.camera.projectionMatrix),g(Re,Se,Ae),g(Re,this._renderContext.lastFrameCamera.viewMatrix,Re),g(Re,this._renderContext.lastFrameCamera.projectionMatrix,Re),this._reprojectionMatrix=Re);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,a=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,a),e(),t.detachDepth()}get test(){}};e([p({readOnly:!0})],ue.prototype,"highResolutionAtmosphere",null),e([p()],ue.prototype,"_edgeView",void 0),e([p()],ue.prototype,"updating",null),ue=e([m("esri.views.3d.webgl-engine.lib.Renderer")],ue);const le=[0,1,2,3],pe=[7,8,4,5],me=[6,7,8],ce=[0,1,2,4,...me],fe=[3,5],ge=[2,4,9],be=[17,13,15,14],Pe=[4,5,2,3,0,1,...me],we=[4,9,5,12],Te={0:[14],1:[13],2:[14,13],3:[14,13]},Ee=[0,1,...me],Ce=["normals","highlights"],Ae=P(),Se=P(),Re=P();function De(e){return t=>e.immediate.schedule(t)}export{ue as Renderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{isDepthOrShadowLike as s}from"../core/shaderLibrary/ShaderOutput.js";import{ScreenSpaceGeometry as
|
|
2
|
+
import has from"../../../../core/has.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{isDepthOrShadowLike as s}from"../core/shaderLibrary/ShaderOutput.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as t}from"./glUtil3D.js";import{IndexBufferCache as i}from"../materials/renderers/IndexBufferCache.js";import{TextureBufferCache as h}from"../materials/renderers/TextureBufferCache.js";import{VaoCache as a}from"../materials/renderers/VaoCache.js";import{VboCache as o}from"../materials/renderers/VboCache.js";import{DrawBufferNone as n}from"../../../webgl/enums.js";import{RenderingContext as u,getFramebufferDrawBuffers as c}from"../../../webgl/RenderingContext.js";class f extends u{constructor(e,s){super(e,s),this.emptyTexture=t(this),this._vaoCaches=new Map,this._vboCaches=new Map,this._indexBufferCache=null,this._textureBufferCaches=new Map,this._output=0,this.debugBoundTechnique="",this._refCount=1,this._newCache=s.newCache,this._screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache=e(this._indexBufferCache),this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache?.dispose(),this._indexBufferCache=null,this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){const s=JSON.stringify(e),r=this._vaoCaches.get(s);if(r)return r;const t=new a(this,e);return this._vaoCaches.set(s,t),t}getVboCache(e){const s=JSON.stringify(e),r=this._vboCaches.get(s);if(r)return r;const t=new o(this,e);return this._vboCaches.set(s,t),t}get indexBufferCache(){return this._indexBufferCache??=new i(this),this._indexBufferCache}getTextureBufferCache(e){const s=JSON.stringify(e),r=this._textureBufferCaches.get(s);if(r)return r;const t=new h(this,e);return this._textureBufferCaches.set(s,t),t}resetDrawBuffers(e){this._output=e,this.setDrawBuffers(c(this._state.drawFramebuffer))}setDrawBuffers(e){return s(this._output)?super.setDrawBuffers([n]):super.setDrawBuffers(e)}bindTechnique(e,s,r,t){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline(s)),e.program.bind(s),r&&(e.program.bindPass(r,s),t&&e.program.bindDraw(s,r,t)),e.program}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),s=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=s??!0}return this._isAssumedMetalDriver}get test(){}}export{f as RenderingContext};
|