@arcgis/core 6.0.0-next.15 → 6.0.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/LineOfSightAnalysis.d.ts +49 -32
- package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
- package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
- package/analysis/Viewshed.d.ts +23 -3
- package/analysis/ViewshedAnalysis.d.ts +33 -13
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
- package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
- package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
- package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
- package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
- package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
- package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
- package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
- package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
- package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
- package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
- package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
- package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
- package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
- package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
- package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
- package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
- package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
- package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
- package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
- package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
- package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
- package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
- package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
- package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
- package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
- package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
- package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
- package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
- package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
- package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
- package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
- package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
- package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
- package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
- package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
- package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
- package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
- package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
- package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
- package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
- package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
- package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
- package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
- package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
- package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
- package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
- package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
- package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
- package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
- package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
- package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
- package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
- package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
- package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
- package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
- package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
- package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
- package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
- package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
- package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
- package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
- package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
- package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
- package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
- package/assets/esri/core/workers/chunks/{ae31fd416bbb41a81392.js → f9c5aa0bbf23e780fecc.js} +1 -1
- package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
- package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
- package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
- package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/index.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/core/accessorSupport/DefaultsStore.js +1 -1
- package/core/accessorSupport/MultiOriginStore.js +1 -1
- package/core/accessorSupport/Store.js +1 -1
- package/core/accessorSupport/decorators/reader.js +1 -1
- package/core/accessorSupport/decorators/writer.js +1 -1
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +9 -0
- package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/polygonExtentClipping.js +1 -1
- package/identity/Credential.js +1 -1
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -2
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/CatalogLayer.d.ts +2 -2
- package/layers/CatalogLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -2
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +4 -4
- package/layers/FeatureLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/LineOfSightLayer.d.ts +10 -8
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.d.ts +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
- package/layers/mixins/ReloadableLayer.js +2 -0
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +2 -2
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/Zlib.js +1 -1
- package/layers/raster/functions/stretchUtils.js +1 -1
- package/layers/raster/functions/vectorFieldUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/featureReductionProperties.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/video/VideoController.js +10 -10
- package/libs/maquette/projection.js +1 -1
- package/networks/UtilityNetworkTraceAnalysis.js +1 -1
- package/package.json +5 -5
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/portal/Portal.js +1 -1
- package/request/process.js +1 -1
- package/request/types.d.ts +7 -0
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/trace.js +1 -1
- package/rest/query/executeQuery.js +1 -1
- package/smartMapping/raster/renderers/shadedRelief.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/clusterUtils.js +1 -1
- package/statistics/utils.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +4 -3
- package/undoredo/support/Services.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +7 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/sphereExtentUtils.js +2 -0
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
- package/views/interactive/options/TooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +35 -13
- package/views/layers/SketchLayerView.d.ts +1 -0
- package/views/layers/ViewshedLayerView.d.ts +36 -12
- package/views/webgl/Program.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
- package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
- package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
- package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
- package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
- package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
- package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
- package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
- package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
- package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
- package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
- package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
- package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
- package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
- package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
- package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
- package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
- package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
- package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
- package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
- package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
- package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
- package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
- package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
- package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
- package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
- package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
- package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
- package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
- package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +0 -1
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
- package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
- package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
- package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
- package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
- package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
- package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
- package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
- package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
- package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +0 -1
- package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
- package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
- package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
- package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
- package/layers/mixins/FeatureLayerReload.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{unique as t}from"../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as r,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as a}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as s,syncAndInitial as c,on as l,initial as u}from"../../../core/reactiveUtils.js";import{someSet as d}from"../../../core/SetUtils.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as m,fromTranslation as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as v}from"../support/debugFlags.js";import{Overlay as y}from"./Overlay.js";import{OverlayRenderTargets as b}from"./OverlayRenderTargets.js";import x from"../webgl/RenderCamera.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as C,renderHighlightBuffer as w}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as T}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as E}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as D,defaultRenderOccludedMask as O}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as k}from"../webgl-engine/lib/ShadowMap.js";import{T as A}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as j}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as M}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as N}from"../webgl-engine/lighting/Lightsources.js";import{O as P}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as F}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as I}from"../../support/Scheduler.js";import L from"../../webgl/Texture.js";import{TextureDescriptor as R}from"../../webgl/TextureDescriptor.js";let z=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new P,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new A,this._screenToMapUnitsRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new x,this.events=new n,this.longitudeCyclical=null,this.produces=new Map([[18,e=>e!==10||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;let{state:t,stage:r}=e.parent.view,i=r.renderer.fboCache,a=r.renderView.renderingContext,s=r.renderView.techniques;this._renderContext=new D(a,new k(i,t.viewingMode),s)}initialize(){let e=this._view,t=e.stage.renderView.waterTextures;this.addHandles([s(()=>t.updating,()=>this.events.emit(`content-changed`),c),s(()=>this._spatialReference,e=>this._localOriginFactory=new E(e),c),l(()=>e.allLayerViews,`after-changes`,()=>this._sortedDrapeSourceRenderersDirty=!0),s(()=>C(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,u),s(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},u),e.resourceController.scheduler.registerTask(I.OVERLAY_RENDERER,this)]);let n=this._camera;n.near=1,n.far=1e4,n.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=n,this._bindParameters.updateLighting(new N(_()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=a(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToMapUnitsRatio(){return this._screenToMapUnitsRatio}get mapUnitsToGroundRatio(){return this.parent.mapUnitsToPlanarDistanceRatio*this._bindParameters.planarDistanceToGroundRatio}get localOriginFactory(){return this._localOriginFactory}set overlayStretch(e){this._bindParameters.overlayStretch=e}get overlayStretch(){return this._bindParameters.overlayStretch}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){let t=new T(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit(`content-changed`),this.notifyChange(`updating`),this.notifyChange(`isEmpty`)},()=>this.events.emit(`content-changed`));this._pluginContext={...e,materials:t},this._techniques.precompile(F)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||r(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return this._overlays!=null&&this._renderTargets!=null}getMaterialRenderer(e){for(let t of this._renderers.values()){let n=t.getMaterialRenderer(e);if(n)return n}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),t(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,t){this._renderers.get(e)?.destroy(),this._renderers.set(e,t),this._sortedDrapeSourceRenderersDirty=!0,`fullOpacity`in e&&this.addHandles(s(()=>e.fullOpacity,()=>this.events.emit(`content-changed`)),e)}removeDrapeSourceRenderer(e){if(e==null)return;let t=this._renderers.get(e);t!=null&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),t.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=this._overlays?d(e,e=>e.drapeTargetType===1):!1}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d(e,e=>e.drapeSourceType===1),this._hasDrapedRasterSource=d(e,e=>e.drapeSourceType===0),this._hasDrapedFlowSource=d(e,e=>e.drapeSourceType===2)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,t){this._overlays??=(this._renderTargets=new b(this._stage.renderer.fboCache),[new y,new y]),this.ensureDrapeTargets(e),this.ensureDrapeSources(t)}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit(`textures-disposed`)}_useOverlayColorInsteadOfColorNoRasterImage(e){return e===1&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){let t=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(t?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=r(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,t){let n=!1;for(let[r,i]of this._renderers){if(t?.done)break;(r.destroyed||e(r))&&i.commitChanges()&&(n=!0,t?.madeProgress())}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,n=!0,this._updateSortedDrapeSourceRenderers(),t?.madeProgress()),t&&this.compact(t),n&&(this._overlays!=null&&this._renderers.size===0&&this.disposeOverlays(),this.notifyChange(`updating`),this.notifyChange(`isEmpty`),this._onMaterialOrContentChanged(),this.hasHighlights=r(this._renderers,e=>e.hasHighlights),this.events.emit(`content-changed`))}compact(e){let t=!1;for(let n of this._renderers.values()){if(e.done)break;t=n.compact(e)||t}return t&&this.notifyChange(`updating`),t}hasHighlight(e){return r(this._renderers,t=>t.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>e.updatePolicy===1)}get isEmpty(){return!v.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){let e=r(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit(`has-water`)),this._hasWater}renders(e){if(v.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==4&&e!==2)return!0;if(!this._overlays)return!1;let t=this._overlays[0];for(let e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);if(!t.hasSomeSizedView())return!1;let n=this._setOutput(this._renderTargets?.targets.find(t=>t.content===e)?.output??0);++this._techniques.precompiling;let r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(n),r}_setOutput(e){let t=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=e===4?19:18,t}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:+!!this._renderTargets?.getTexture(0)}updateAnimation(e){let t=!1;return this._renderers.forEach(n=>t=n.updateAnimation(e)||t),t&&this.parent.requestRender(0),t}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;let t=this._bindParameters;t.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(let e of this._renderTargets.targets){if(e.content===1&&!this._needsColorWithoutRasterImage)continue;let{output:n}=e;this._setOutput(n),n===10&&(t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null);let r=this._renderContext.renderOccludedMask;e.content===4&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:t,renderer:n})=>{(e.content!==1||t.drapeSourceType!==0)&&(e.content===4&&n.hasOnlyOccluders||n.precompile(this._renderContext))}),this._renderContext.renderOccludedMask=r,t.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,t){if(!this._overlays||!this._renderTargets)return;for(let e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;let n=this.allSourcesOccluders;for(let e of this._renderTargets.targets){if(!(e.content===0&&this._hasDrapedFlowSource)&&!e.handleRenderRequest(t)||e.content===1&&!this._needsColorWithoutRasterImage||e.content===4&&n)continue;let r=this._drawTarget(0,e),i=this._drawTarget(1,e);(r||i)&&e.fbo.generateMipMap()}}_drawTarget(e,t){let n=this._overlays[e],r=n.canvasGeometries;if(r.numViews===0)return!1;let i=this._view.state.contentPixelRatio;this._screenToMapUnitsRatio=i*n.mapUnitsPerPixel/this._bindParameters.overlayStretch;let{output:a,content:o}=t;if(this.isEmpty||a===4&&!this.hasWater||!n.hasSomeSizedView())return!1;let{_rctx:s,_camera:c,_renderContext:l,_bindParameters:u}=this;if(c.pixelRatio=n.pixelRatio*i,this._setOutput(a),u.screenToMapUnitsRatio=this._screenToMapUnitsRatio,u.screenToPlanarDistanceRatio=this._screenToMapUnitsRatio*this.parent.mapUnitsToPlanarDistanceRatio,o===4&&(l.renderOccludedMask=H),!this.renders(o))return l.renderOccludedMask=O,!1;let{resolution:d}=n,f=e===0,p=f?0:d;if(s.setViewport(p,0,d,d),this._bindTargetFBO(t),f&&(a===10?s.gl.clearBufferuiv(s.gl.COLOR,0,[0,0,0,0]):(s.setClearColor(0,0,0,0),s.clear(16384))),v.OVERLAY_DRAW_DEBUG_TEXTURE&&o!==4&&o!==2){this._techniques.precompile(j,U);let t=this._techniques.get(j,U);for(let i=0;i<r.numViews;i++)this._setViewParameters(r.extents[i],n),this._ensureDebugPatternResources(n.resolution,V[e]),s.bindTechnique(t,u,this._passParameters),s.screen.draw()}if(a===10){let{fboCache:n}=this._stage.renderer,r=this._resolution;this._bindTargetFBO(t),w(s,n,r,r,u,()=>this._renderAllGeometry(e,t),p)}else this._renderAllGeometry(e,t);return s.bindFramebuffer(null),l.renderOccludedMask=O,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,t){let n=this._overlays[e],r=n.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:a})=>{if(t.content===1&&i.drapeSourceType===0)return;let{fullOpacity:o}=i,s=o!=null&&o<1&&t.output===0&&this._bindTemporaryFBO();for(let e=0;e<r.numViews;e++)this._setViewParameters(r.extents[e],n),a.render(this._renderContext);if(s){this._bindTargetFBO(t),this._overlayParameters.texture=s.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;let n=this._techniques.get(F);this._rctx.bindTechnique(n,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),s.release()}})}_bindTargetFBO(e){let t=this._resolution,n=2*t;e.fbo.ensureFramebuffer(n,t),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){let e=this._resolution,t=2*e,n=this._stage.renderer.fboCache,r=n.acquire(t,e,`overlay tmp`);return n.rctx.bindFramebuffer(r.fbo),n.rctx.clear(16384),r}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit(`content-changed`)}intersectRay(e,t,n,r){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(let{renderer:a}of this._sortedRenderers)i=a.intersectRay?.(e,t,n,r,i)??i}*intersectScreenPolygon(e,t,n){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let r=0;for(let{renderer:i}of this._sortedRenderers)r=yield*i.intersectScreenPolygon(e,t,n,r)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),this._renderers.size===0)return;let e=this._view.map.allLayers.map(e=>e.uid),t=e.length;this._renderers.forEach((n,r)=>{let i=e.indexOf(r.layer?.uid),a=i>=0,o=r.renderGroup??+!a,s=r.drapeSourcePriorityOffset??0,c=t*o+(a?i:0)+s;this._sortedRenderers.push(new B(r,n,c))}),this._sortedRenderers.sort((e,t)=>e.index-t.index)}_setViewParameters(e,t){let n=this._camera;n.viewport=[0,0,t.resolution,t.resolution],this._bindParameters.planarDistanceToGroundRatio=this.parent.getPlanarDistanceToGroundRatio((e[1]+e[3])*.5),m(n.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],n.near,n.far),h(n.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,t){if(g(this._passParameters.color,t[0],t[1],t[2]),this._passParameters.texture)return;let n=new Uint8Array(e*e*4),r=0;for(let t=0;t<e;t++)for(let i=0;i<e;i++){let a=Math.floor(i/10),o=Math.floor(t/10);a<2||o<2||a*10>e-20||o*10>e-20?(n[r++]=255,n[r++]=255,n[r++]=255,n[r++]=255):(n[r++]=255,n[r++]=255,n[r++]=255,a&1&&o&1?n[r++]=i&1^t&1?0:255:n[r++]=a&1^o&1?0:128)}let i=new R(e);i.samplingMode=9728,this._passParameters.texture=new L(this._rctx,i,n)}get test(){}};e([f()],z.prototype,`hasHighlights`,void 0),e([f()],z.prototype,`renderOccludedFlags`,void 0),e([f()],z.prototype,`_sortedDrapeSourceRenderersDirty`,void 0),e([f({constructOnly:!0})],z.prototype,`parent`,void 0),e([f({readOnly:!0})],z.prototype,`_techniques`,null),e([f({type:Boolean,readOnly:!0})],z.prototype,`updating`,null),e([f()],z.prototype,`isEmpty`,null),z=e([p(`esri.views.3d.terrain.OverlayRenderer`)],z);class B{constructor(e,t,n){this.drapeSource=e,this.renderer=t,this.index=n}}const V=[[1,.5,.5],[.5,.5,1]],H=4,U=new M;U.hasAlpha=!0;export{z as OverlayRenderer,H as overlayRenderOccludedFlag};
|
|
2
|
+
import{__decorate as e}from"tslib";import{unique as t}from"../../../core/arrayUtils.js";import{EventEmitter as n}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as r,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as a}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as s,syncAndInitial as c,on as l,initial as u}from"../../../core/reactiveUtils.js";import{someSet as d}from"../../../core/SetUtils.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{ortho as m,fromTranslation as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{set as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as v}from"../support/debugFlags.js";import{Overlay as y}from"./Overlay.js";import{OverlayRenderTargets as b}from"./OverlayRenderTargets.js";import x from"../webgl/RenderCamera.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as C,renderHighlightBuffer as w}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as T}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as E}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as D,defaultRenderOccludedMask as O}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as k}from"../webgl-engine/lib/ShadowMap.js";import{T as A}from"../../../chunks/Texture.glsl.js";import{TextureTechnique as j}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as M}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as N}from"../webgl-engine/lighting/Lightsources.js";import{O as P}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as F}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as I}from"../../support/Scheduler.js";import L from"../../webgl/Texture.js";import{TextureDescriptor as R}from"../../webgl/TextureDescriptor.js";let z=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new P,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new A,this._screenToMapUnitsRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new x,this.events=new n,this.longitudeCyclical=null,this.produces=new Map([[18,e=>e!==10||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1;let{state:t,stage:r}=e.parent.view,i=r.renderer.fboCache,a=r.renderView.renderingContext,s=r.renderView.techniques;this._renderContext=new D(a,new k(i,t.viewingMode),s)}initialize(){let e=this._view,t=e.stage.renderView.waterTextures;this.addHandles([s(()=>t.updating,()=>this.events.emit(`content-changed`),c),s(()=>this._spatialReference,e=>this._localOriginFactory=new E(e),c),l(()=>e.allLayerViews,`after-changes`,()=>this._sortedDrapeSourceRenderersDirty=!0),s(()=>C(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,u),s(()=>e.state.highlights,e=>{this._bindParameters.highlights=e},u),e.resourceController.scheduler.registerTask(I.OVERLAY_RENDERER,this)]);let n=this._camera;n.near=1,n.far=1e4,n.relativeElevation=null,this._bindParameters.slot=18,this._bindParameters.camera=n,this._bindParameters.updateLighting(new N(_()),0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=a(this._passParameters.texture),this.disposeOverlays(),this._renderContext.destroy(),this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToMapUnitsRatio(){return this._screenToMapUnitsRatio}get mapUnitsToGroundRatio(){return this.parent.mapUnitsToPlanarDistanceRatio*this._bindParameters.planarDistanceToGroundRatio}get localOriginFactory(){return this._localOriginFactory}set overlayStretch(e){this._bindParameters.overlayStretch=e}get overlayStretch(){return this._bindParameters.overlayStretch}set time(e){this._renderContext.time=e}get pluginContext(){return this._pluginContext}initializeRenderContext(e){let t=new T(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit(`content-changed`),this.notifyChange(`updating`),this.notifyChange(`isEmpty`)},()=>this.events.emit(`content-changed`));this._pluginContext={...e,materials:t},this._techniques.precompile(F)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||r(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return this._overlays!=null&&this._renderTargets!=null}getMaterialRenderer(e){for(let t of this._renderers.values()){let n=t.getMaterialRenderer(e);if(n)return n}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),t(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,t){this._renderers.get(e)?.destroy(),this._renderers.set(e,t),this._sortedDrapeSourceRenderersDirty=!0,`fullOpacity`in e&&this.addHandles(s(()=>e.fullOpacity,()=>this.events.emit(`content-changed`)),e)}removeDrapeSourceRenderer(e){if(e==null)return;let t=this._renderers.get(e);t!=null&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),t.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=this._overlays?d(e,e=>e.drapeTargetType===1):!1}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d(e,e=>e.drapeSourceType===1),this._hasDrapedRasterSource=d(e,e=>e.drapeSourceType===0),this._hasDrapedFlowSource=d(e,e=>e.drapeSourceType===2)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,t){this._overlays??=(this._renderTargets=new b(this._stage.renderer.fboCache),[new y,new y]),this.ensureDrapeTargets(e),this.ensureDrapeSources(t)}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit(`textures-disposed`)}_useOverlayColorInsteadOfColorNoRasterImage(e){return e===1&&!this._needsColorWithoutRasterImage&&(this._hasDrapedFeatureSource||this._hasDrapedRasterSource)}getTexture(e){let t=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(t?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(()=>!0,e)}_onMaterialOrContentChanged(){this.renderOccludedFlags=r(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,t){let n=!1;for(let[r,i]of this._renderers){if(t?.done)break;(r.destroyed||e(r))&&i.commitChanges()&&(n=!0,t?.madeProgress())}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,n=!0,this._updateSortedDrapeSourceRenderers(),t?.madeProgress()),t&&this.compact(t),n&&(this._overlays!=null&&this._renderers.size===0&&this.disposeOverlays(),this.notifyChange(`updating`),this.notifyChange(`isEmpty`),this._onMaterialOrContentChanged(),this.hasHighlights=r(this._renderers,e=>e.hasHighlights),this.events.emit(`content-changed`))}compact(e){let t=!1;for(let n of this._renderers.values()){if(e.done)break;t=n.compact(e)||t}return t&&this.notifyChange(`updating`),t}hasHighlight(e){return r(this._renderers,t=>t.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(e=>e.updatePolicy===1)}get isEmpty(){return!v.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){let e=r(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit(`has-water`)),this._hasWater}renders(e){if(v.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==4&&e!==2)return!0;if(!this._overlays)return!1;let t=this._overlays[0];for(let e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);if(!t.hasSomeSizedView())return!1;let n=this._setOutput(this._renderTargets?.targets.find(t=>t.content===e)?.output??0);++this._techniques.precompiling;let r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._setOutput(n),r}_setOutput(e){let t=this._bindParameters.output;return this._bindParameters.output=e,this._bindParameters.slot=e===4?19:18,t}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:+!!this._renderTargets?.getTexture(0)}updateAnimation(e){let t=!1;return this._renderers.forEach(n=>t=n.updateAnimation(e)||t),t&&this.parent.requestRender(0),t}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;let t=this._bindParameters;t.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(let e of this._renderTargets.targets){if(e.content===1&&!this._needsColorWithoutRasterImage)continue;let{output:n}=e;this._setOutput(n),n===10&&(t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null);let r=this._renderContext.renderOccludedMask;e.content===4&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:t,renderer:n})=>{e.content===1&&t.drapeSourceType===0||e.content===4&&n.hasOnlyOccluders||n.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=r,t.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,t){if(!this._overlays||!this._renderTargets)return;for(let e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;let n=this.allSourcesOccluders;for(let e of this._renderTargets.targets){if(!(e.content===0&&this._hasDrapedFlowSource)&&!e.handleRenderRequest(t)||e.content===1&&!this._needsColorWithoutRasterImage||e.content===4&&n)continue;let r=this._drawTarget(0,e),i=this._drawTarget(1,e);(r||i)&&e.fbo.generateMipMap()}}_drawTarget(e,t){let n=this._overlays[e],r=n.canvasGeometries;if(r.numViews===0)return!1;let i=this._view.state.contentPixelRatio;this._screenToMapUnitsRatio=i*n.mapUnitsPerPixel/this._bindParameters.overlayStretch;let{output:a,content:o}=t;if(this.isEmpty||a===4&&!this.hasWater||!n.hasSomeSizedView())return!1;let{_rctx:s,_camera:c,_renderContext:l,_bindParameters:u}=this;if(c.pixelRatio=n.pixelRatio*i,this._setOutput(a),u.screenToMapUnitsRatio=this._screenToMapUnitsRatio,u.screenToPlanarDistanceRatio=this._screenToMapUnitsRatio*this.parent.mapUnitsToPlanarDistanceRatio,o===4&&(l.renderOccludedMask=H),!this.renders(o))return l.renderOccludedMask=O,!1;let{resolution:d}=n,f=e===0,p=f?0:d;if(s.setViewport(p,0,d,d),this._bindTargetFBO(t),f&&(a===10?s.gl.clearBufferuiv(s.gl.COLOR,0,[0,0,0,0]):(s.setClearColor(0,0,0,0),s.clear(16384))),v.OVERLAY_DRAW_DEBUG_TEXTURE&&o!==4&&o!==2){this._techniques.precompile(j,U);let t=this._techniques.get(j,U);for(let i=0;i<r.numViews;i++)this._setViewParameters(r.extents[i],n),this._ensureDebugPatternResources(n.resolution,V[e]),s.bindTechnique(t,u,this._passParameters),s.screen.draw()}if(a===10){let{fboCache:n}=this._stage.renderer,r=this._resolution;this._bindTargetFBO(t),w(s,n,r,r,u,()=>this._renderAllGeometry(e,t),p)}else this._renderAllGeometry(e,t);return s.bindFramebuffer(null),l.renderOccludedMask=O,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,t){let n=this._overlays[e],r=n.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:a})=>{if(t.content===1&&i.drapeSourceType===0)return;let{fullOpacity:o}=i,s=o!=null&&o<1&&t.output===0&&this._bindTemporaryFBO();for(let e=0;e<r.numViews;e++)this._setViewParameters(r.extents[e],n),a.render(this._renderContext);if(s){this._bindTargetFBO(t),this._overlayParameters.texture=s.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;let n=this._techniques.get(F);this._rctx.bindTechnique(n,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),s.release()}})}_bindTargetFBO(e){let t=this._resolution,n=2*t;e.fbo.ensureFramebuffer(n,t),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){let e=this._resolution,t=2*e,n=this._stage.renderer.fboCache,r=n.acquire(t,e,`overlay tmp`);return n.rctx.bindFramebuffer(r.fbo),n.rctx.clear(16384),r}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit(`content-changed`)}intersectRay(e,t,n,r){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(let{renderer:a}of this._sortedRenderers)i=a.intersectRay?.(e,t,n,r,i)??i}*intersectScreenPolygon(e,t,n){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let r=0;for(let{renderer:i}of this._sortedRenderers)r=yield*i.intersectScreenPolygon(e,t,n,r)}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),this._renderers.size===0)return;let e=this._view.map.allLayers.map(e=>e.uid),t=e.length;this._renderers.forEach((n,r)=>{let i=e.indexOf(r.layer?.uid),a=i>=0,o=r.renderGroup??+!a,s=r.drapeSourcePriorityOffset??0,c=t*o+(a?i:0)+s;this._sortedRenderers.push(new B(r,n,c))}),this._sortedRenderers.sort((e,t)=>e.index-t.index)}_setViewParameters(e,t){let n=this._camera;n.viewport=[0,0,t.resolution,t.resolution],this._bindParameters.planarDistanceToGroundRatio=this.parent.getPlanarDistanceToGroundRatio((e[1]+e[3])*.5),m(n.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],n.near,n.far),h(n.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,t){if(g(this._passParameters.color,t[0],t[1],t[2]),this._passParameters.texture)return;let n=new Uint8Array(e*e*4),r=0;for(let t=0;t<e;t++)for(let i=0;i<e;i++){let a=Math.floor(i/10),o=Math.floor(t/10);a<2||o<2||a*10>e-20||o*10>e-20?(n[r++]=255,n[r++]=255,n[r++]=255,n[r++]=255):(n[r++]=255,n[r++]=255,n[r++]=255,a&1&&o&1?n[r++]=i&1^t&1?0:255:n[r++]=a&1^o&1?0:128)}let i=new R(e);i.samplingMode=9728,this._passParameters.texture=new L(this._rctx,i,n)}get test(){}};e([f()],z.prototype,`hasHighlights`,void 0),e([f()],z.prototype,`renderOccludedFlags`,void 0),e([f()],z.prototype,`_sortedDrapeSourceRenderersDirty`,void 0),e([f({constructOnly:!0})],z.prototype,`parent`,void 0),e([f({readOnly:!0})],z.prototype,`_techniques`,null),e([f({type:Boolean,readOnly:!0})],z.prototype,`updating`,null),e([f()],z.prototype,`isEmpty`,null),z=e([p(`esri.views.3d.terrain.OverlayRenderer`)],z);class B{constructor(e,t,n){this.drapeSource=e,this.renderer=t,this.index=n}}const V=[[1,.5,.5],[.5,.5,1]],H=4,U=new M;U.hasAlpha=!0;export{z as OverlayRenderer,H as overlayRenderOccludedFlag};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{equals as e}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{disposeMaybe as n,releaseMaybe as r}from"../../../core/maybe.js";import{glLayout as i}from"../support/buffer/glUtil.js";import{GeometryState as a}from"./GeometryState.js";import{PatchGeometry as o}from"./PatchGeometry.js";import"../../../geometry/Extent.js";import"../../../geometry/support/Ellipsoid.js";import{internalAssert as s,neighborEdgeIndices as c,oppositeEdge as l,neighborCornerIndices as u,enableTerrainInternalChecks as d}from"./terrainUtils.js";import{maxTileNeighborLevelDelta as f}from"./TerrainConst.js";import{TextureFader as p}from"./TextureFader.js";import{TextureReference as m}from"./TextureReference.js";import h from"./TileOverlayData.js";import{fallsWithinLayerView as g}from"./tileUtils.js";import{VertexArrayObject as _}from"../webgl-engine/lib/VertexArrayObject.js";import{BufferObject as v}from"../../webgl/BufferObject.js";import{VertexBuffer as y}from"../../webgl/VertexBuffer.js";class b{constructor(){this.geometry=new o,this.geometryState=null,this._texture=null,this._textureOpacity=1,this._textureFader=new p(()=>this._tile.surface.fadeDuration),this.overlay=new h,this._localOrigin=null,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._modifiedFlags=0}get tile(){return this._tile}get localOrigin(){return this._localOrigin}init(e,t){this.clear(),this._tile=e,this.geometry.reset(),this.intersectionData=null,this.geometryState=new a,this._localOrigin=t,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureFader.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if(this._tile&&this.geometryState&&((!this._vao||this._geometryStateChangedSinceLastUpdate||this.wireframeChanged||this.clippingAreaChanged||this.samplerDataChanged||this.numVerticesPerSideChanged||this.dirtyCorners||this.dirtyEdgeResolutions||this.dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),d&&this.tile.intersectsClippingArea))for(let e=0;e<A;++e)s(this.geometry.getEdgeCount(e)===this.geometryState.edgeResolutions[e]+1)}_calculateEdgeResolution(e,t){let n=this.tile,r=this.geometryState.numVerticesPerSide-1;if(!n.surface.isGlobal){let t=n.surface.groundExtent;if(t!=null&&(e===0&&n.extent[3]>t[3]||e===1&&n.extent[2]>t[2]||e===2&&n.extent[1]<t[1]||e===3&&n.extent[0]<t[0]))return r}let i=n.level,a=c[e];if(!t)return s(n.surface?.rootTiles==null||n.surface.updatingRootTiles||!n.shouldHaveNeighbor(a)),r;if(t.loaded){let n=t,a=n.renderData?.geometryState;if(!a)return r;let o=i-n.level;if(s(o>=0),o===0){let e=a.numVerticesPerSide-1;return Math.max(e,r)}let c=2**o,l=a.edgeResolutions[(e+2)%4]/c;return Math.max(1,l)}s(!t.leaf);let o=r;return t.forAllSubtreeOnSide(l(a),e=>e===n?!0:e.loaded?(o=Math.max(o,2**(e.level-i)),!0):(s(!e.leaf),!1)),o}updateNeighborData(){let e=this.tile;if(!e.intersectsClippingArea)return;let n=e.renderData.geometryState,r=t=>(t.loaded||t.level===e.level)&&t.intersectsClippingArea,i=n.edgePeerNeighbors,a=n.edgePeerNeighborSamplerVersions;for(let o=0;o<A;++o){let l=e.findNeighborTile(c[o],r),u=S(e,l),p=u?.renderData?.geometryState.samplerDataVersion??-1,m=i[o],h=u!==S(e,m),g=a[o]!==p;d&&l&&(s(e.level>=l.level),s(e.level-l.level<=f)),i[o]=l,(h||g)&&(a[o]=p,this._markEdgeDirty(o));let _=n.edgeResolutions[o],v=this._calculateEdgeResolution(o,l);s(t(v)),s(v>=1),n.edgeResolutions[o]=v,_!==v&&this._markEdgeResolutionDirty(o)}for(let t=0;t<A;++t){let a=e.findNeighborTile(u[t],r);n.cornerPeerNeighbors[t]=a;let o=S(e,i[t]),c=S(e,i[(t+1)%A]),l=S(e,a);x[t]=l,x[(t+1)%A]=c,x[(t+2)%A]=e,x[(t+3)%A]=o,s(x.some(t=>t?.loaded||t===e));let f=x.reduce((e,t)=>Math.min(e,t?.level??1/0),1/0);x.forEach((e,t)=>{e&&e.level>f&&(x[t]=null)}),s(x.some(t=>t?.loaded||t===e));let p=n.cornerNeighborCornerTiles,m=n.cornerNeighborCornerTileSamplerVersions;for(let e=0;e<A;++e){let n=x[e],r=n?.renderData?.geometryState?.samplerDataVersion??-1,i=t*A+e,a=p[i]!==n,o=!a&&m[i]!==r;(a||o)&&(p[i]=n,m[i]=r,this._markCornerDirty(t))}d&&s(j.some(n=>{let r=p[t*A+n];return r?.loaded||r===e}))}d&&s(n.edgeResolutions.every(e=>e>0));for(let e=0;e<A;++e)x[e]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;d&&s(!this.tile.intersectsClippingArea||this.geometryState.edgeResolutions.every(e=>e>0)),this.intersectionData=null;let{tile:t,_vao:n,geometry:r,geometryState:i}=this,{vertexAttributes:a}=r,o=!n||!a||this.wireframeChanged||this.samplerDataChanged||this.clippingAreaChanged,c=this.dirtyEdgeResolutions!==0,l=i.edgeResolutions.reduce((e,t)=>Math.max(e,t),0)+1,u=c&&l>r.maxEdgeVertexCount,f=o||this.numVerticesPerSideChanged||u,p=!f&&c,m=!p&&this.dirtyEdges!==0,h=!m&&this.dirtyCorners!==0;f?(this.releaseGeometry(),this._createGeometry(e)):p?t.updateEdgeElevationsAndResolutions():m||h?t.updateEdgeElevations():console.warn(`Update for no reason?`),this._modifiedFlags=0}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,this._vao?(this._vao=n(this._vao),this.geometry.release(),!0):!1}ensureTexture(e,t,n,r){let i=t?6408:6407;return this._texture!=null&&(n===0&&this._tile.surface.fadeDuration>0&&this._isTextureVisible(this._texture)||this._texture.descriptor.width!==e||this._texture.descriptor.pixelFormat!==i)&&this.releaseTexture(),this._texture??(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){this._texture&&(this._texture=r(this._texture),this.tile.setMemoryDirty())}reuseTexture(e,t){return!e||!this._texture?!1:(e.setTextureReference(new m(this._texture,0,t,this._textureOpacity,0,1)),!0)}get numVerticesPerSideChanged(){return(this._modifiedFlags&C)!==0}get samplerDataChanged(){return(this._modifiedFlags&w)!==0}get clippingAreaChanged(){return(this._modifiedFlags&T)!==0}get wireframeChanged(){return(this._modifiedFlags&E)!==0}get dirtyEdges(){return this._modifiedFlags>>D&15}get dirtyCorners(){return this._modifiedFlags>>O&15}get dirtyEdgeResolutions(){return this._modifiedFlags>>k&15}_markCornerDirty(e){let t=1<<e<<O;this._modifiedFlags|=t}_markEdgeDirty(e){let t=1<<e<<D;this._modifiedFlags|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){let t=1<<e<<k;this._modifiedFlags|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._modifiedFlags|=15<<O|15<<D|15<<k}updateGeometryState(){let t=this._elevationInfo,n=this.tile,r=t.samplerData?n.getElevationVerticesPerSide(t.maxTileLevel):n.minimumVerticesPerSide,i=Math.max(r,5),a=n.clippingArea;(!n.intersectsClippingArea||n.withinClippingArea)&&(a=null);let o=this.geometryState,s=!1;o.numVerticesPerSide!==i&&(this._modifiedFlags|=C,o.numVerticesPerSide=i,o.samplerDataVersion++,s=!0),t.changed&&(this._modifiedFlags|=w,o.samplerData=t.samplerData,o.samplerDataSourceLevels=t.samplerDataSourceLevels,o.samplerDataVersion++,s=!0),e(o.clippingArea,a)||(this._modifiedFlags|=T,o.clippingArea=a,s=!0);let c=n.surface.wireframe;return o.wireframe!==c&&(this._modifiedFlags|=E,o.wireframe=c,s=!0),this._geometryStateChangedSinceLastUpdate||=s,s&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();let{vertexAttributes:t,indices:n}=this.geometry,r=e.gl;this._vao=new _(e,new y(e,i(t.layout),t.buffer),v.createIndex(e,r.STATIC_DRAW,n)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=0){e?.texture===this._texture?this._textureOpacity=e.opacities[0]:this.releaseTexture(),this._textureFader.push(e,t)}get textureReference(){return this._textureFader.current}get nextTextureReference(){return this._textureFader.next}get textureFadeFactor(){return this._textureFader.fadeFactor}get textureIsFading(){return this._textureFader.isFading}_isTextureVisible(e){return this._textureFader.current?.texture===e||this._textureFader.next?.texture===e&&this._textureFader.fadeFactor<1}get _elevationInfo(){let t=this.geometryState.samplerData,n=this.geometryState.samplerDataSourceLevels,r=this.tile.layerInfo[0],i=r.length,a=Array(i),o=Array(i),s=0,c=0,l=!1;for(let e=0;e<i;e++){let n=r[e],i=n.upsampleInfo?.tile;if(i){let n=i.layerInfo[0][e].data,r=n&&n.samplerData;
|
|
2
|
+
import{equals as e}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{disposeMaybe as n,releaseMaybe as r}from"../../../core/maybe.js";import{glLayout as i}from"../support/buffer/glUtil.js";import{GeometryState as a}from"./GeometryState.js";import{PatchGeometry as o}from"./PatchGeometry.js";import"../../../geometry/Extent.js";import"../../../geometry/support/Ellipsoid.js";import{internalAssert as s,neighborEdgeIndices as c,oppositeEdge as l,neighborCornerIndices as u,enableTerrainInternalChecks as d}from"./terrainUtils.js";import{maxTileNeighborLevelDelta as f}from"./TerrainConst.js";import{TextureFader as p}from"./TextureFader.js";import{TextureReference as m}from"./TextureReference.js";import h from"./TileOverlayData.js";import{fallsWithinLayerView as g}from"./tileUtils.js";import{VertexArrayObject as _}from"../webgl-engine/lib/VertexArrayObject.js";import{BufferObject as v}from"../../webgl/BufferObject.js";import{VertexBuffer as y}from"../../webgl/VertexBuffer.js";class b{constructor(){this.geometry=new o,this.geometryState=null,this._texture=null,this._textureOpacity=1,this._textureFader=new p(()=>this._tile.surface.fadeDuration),this.overlay=new h,this._localOrigin=null,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._modifiedFlags=0}get tile(){return this._tile}get localOrigin(){return this._localOrigin}init(e,t){this.clear(),this._tile=e,this.geometry.reset(),this.intersectionData=null,this.geometryState=new a,this._localOrigin=t,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureFader.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if(this._tile&&this.geometryState&&((!this._vao||this._geometryStateChangedSinceLastUpdate||this.wireframeChanged||this.clippingAreaChanged||this.samplerDataChanged||this.numVerticesPerSideChanged||this.dirtyCorners||this.dirtyEdgeResolutions||this.dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),d&&this.tile.intersectsClippingArea))for(let e=0;e<A;++e)s(this.geometry.getEdgeCount(e)===this.geometryState.edgeResolutions[e]+1)}_calculateEdgeResolution(e,t){let n=this.tile,r=this.geometryState.numVerticesPerSide-1;if(!n.surface.isGlobal){let t=n.surface.groundExtent;if(t!=null&&(e===0&&n.extent[3]>t[3]||e===1&&n.extent[2]>t[2]||e===2&&n.extent[1]<t[1]||e===3&&n.extent[0]<t[0]))return r}let i=n.level,a=c[e];if(!t)return s(n.surface?.rootTiles==null||n.surface.updatingRootTiles||!n.shouldHaveNeighbor(a)),r;if(t.loaded){let n=t,a=n.renderData?.geometryState;if(!a)return r;let o=i-n.level;if(s(o>=0),o===0){let e=a.numVerticesPerSide-1;return Math.max(e,r)}let c=2**o,l=a.edgeResolutions[(e+2)%4]/c;return Math.max(1,l)}s(!t.leaf);let o=r;return t.forAllSubtreeOnSide(l(a),e=>e===n?!0:e.loaded?(o=Math.max(o,2**(e.level-i)),!0):(s(!e.leaf),!1)),o}updateNeighborData(){let e=this.tile;if(!e.intersectsClippingArea)return;let n=e.renderData.geometryState,r=t=>(t.loaded||t.level===e.level)&&t.intersectsClippingArea,i=n.edgePeerNeighbors,a=n.edgePeerNeighborSamplerVersions;for(let o=0;o<A;++o){let l=e.findNeighborTile(c[o],r),u=S(e,l),p=u?.renderData?.geometryState.samplerDataVersion??-1,m=i[o],h=u!==S(e,m),g=a[o]!==p;d&&l&&(s(e.level>=l.level),s(e.level-l.level<=f)),i[o]=l,(h||g)&&(a[o]=p,this._markEdgeDirty(o));let _=n.edgeResolutions[o],v=this._calculateEdgeResolution(o,l);s(t(v)),s(v>=1),n.edgeResolutions[o]=v,_!==v&&this._markEdgeResolutionDirty(o)}for(let t=0;t<A;++t){let a=e.findNeighborTile(u[t],r);n.cornerPeerNeighbors[t]=a;let o=S(e,i[t]),c=S(e,i[(t+1)%A]),l=S(e,a);x[t]=l,x[(t+1)%A]=c,x[(t+2)%A]=e,x[(t+3)%A]=o,s(x.some(t=>t?.loaded||t===e));let f=x.reduce((e,t)=>Math.min(e,t?.level??1/0),1/0);x.forEach((e,t)=>{e&&e.level>f&&(x[t]=null)}),s(x.some(t=>t?.loaded||t===e));let p=n.cornerNeighborCornerTiles,m=n.cornerNeighborCornerTileSamplerVersions;for(let e=0;e<A;++e){let n=x[e],r=n?.renderData?.geometryState?.samplerDataVersion??-1,i=t*A+e,a=p[i]!==n,o=!a&&m[i]!==r;(a||o)&&(p[i]=n,m[i]=r,this._markCornerDirty(t))}d&&s(j.some(n=>{let r=p[t*A+n];return r?.loaded||r===e}))}d&&s(n.edgeResolutions.every(e=>e>0));for(let e=0;e<A;++e)x[e]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;d&&s(!this.tile.intersectsClippingArea||this.geometryState.edgeResolutions.every(e=>e>0)),this.intersectionData=null;let{tile:t,_vao:n,geometry:r,geometryState:i}=this,{vertexAttributes:a}=r,o=!n||!a||this.wireframeChanged||this.samplerDataChanged||this.clippingAreaChanged,c=this.dirtyEdgeResolutions!==0,l=i.edgeResolutions.reduce((e,t)=>Math.max(e,t),0)+1,u=c&&l>r.maxEdgeVertexCount,f=o||this.numVerticesPerSideChanged||u,p=!f&&c,m=!p&&this.dirtyEdges!==0,h=!m&&this.dirtyCorners!==0;f?(this.releaseGeometry(),this._createGeometry(e)):p?t.updateEdgeElevationsAndResolutions():m||h?t.updateEdgeElevations():console.warn(`Update for no reason?`),this._modifiedFlags=0}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,this._vao?(this._vao=n(this._vao),this.geometry.release(),!0):!1}ensureTexture(e,t,n,r){let i=t?6408:6407;return this._texture!=null&&(n===0&&this._tile.surface.fadeDuration>0&&this._isTextureVisible(this._texture)||this._texture.descriptor.width!==e||this._texture.descriptor.pixelFormat!==i)&&this.releaseTexture(),this._texture??(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){this._texture&&(this._texture=r(this._texture),this.tile.setMemoryDirty())}reuseTexture(e,t){return!e||!this._texture?!1:(e.setTextureReference(new m(this._texture,0,t,this._textureOpacity,0,1)),!0)}get numVerticesPerSideChanged(){return(this._modifiedFlags&C)!==0}get samplerDataChanged(){return(this._modifiedFlags&w)!==0}get clippingAreaChanged(){return(this._modifiedFlags&T)!==0}get wireframeChanged(){return(this._modifiedFlags&E)!==0}get dirtyEdges(){return this._modifiedFlags>>D&15}get dirtyCorners(){return this._modifiedFlags>>O&15}get dirtyEdgeResolutions(){return this._modifiedFlags>>k&15}_markCornerDirty(e){let t=1<<e<<O;this._modifiedFlags|=t}_markEdgeDirty(e){let t=1<<e<<D;this._modifiedFlags|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){let t=1<<e<<k;this._modifiedFlags|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._modifiedFlags|=15<<O|15<<D|15<<k}updateGeometryState(){let t=this._elevationInfo,n=this.tile,r=t.samplerData?n.getElevationVerticesPerSide(t.maxTileLevel):n.minimumVerticesPerSide,i=Math.max(r,5),a=n.clippingArea;(!n.intersectsClippingArea||n.withinClippingArea)&&(a=null);let o=this.geometryState,s=!1;o.numVerticesPerSide!==i&&(this._modifiedFlags|=C,o.numVerticesPerSide=i,o.samplerDataVersion++,s=!0),t.changed&&(this._modifiedFlags|=w,o.samplerData=t.samplerData,o.samplerDataSourceLevels=t.samplerDataSourceLevels,o.samplerDataVersion++,s=!0),e(o.clippingArea,a)||(this._modifiedFlags|=T,o.clippingArea=a,s=!0);let c=n.surface.wireframe;return o.wireframe!==c&&(this._modifiedFlags|=E,o.wireframe=c,s=!0),this._geometryStateChangedSinceLastUpdate||=s,s&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();let{vertexAttributes:t,indices:n}=this.geometry,r=e.gl;this._vao=new _(e,new y(e,i(t.layout),t.buffer),v.createIndex(e,r.STATIC_DRAW,n)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=0){e?.texture===this._texture?this._textureOpacity=e.opacities[0]:this.releaseTexture(),this._textureFader.push(e,t)}get textureReference(){return this._textureFader.current}get nextTextureReference(){return this._textureFader.next}get textureFadeFactor(){return this._textureFader.fadeFactor}get textureIsFading(){return this._textureFader.isFading}_isTextureVisible(e){return this._textureFader.current?.texture===e||this._textureFader.next?.texture===e&&this._textureFader.fadeFactor<1}get _elevationInfo(){let t=this.geometryState.samplerData,n=this.geometryState.samplerDataSourceLevels,r=this.tile.layerInfo[0],i=r.length,a=Array(i),o=Array(i),s=0,c=0,l=!1;for(let e=0;e<i;e++){let n=r[e],i=n.upsampleInfo?.tile;if(i){let n=i.layerInfo[0][e].data,r=n&&n.samplerData;t&&t[s]===r||(l=!0),a[s++]=r,o[s-1]=n?.level??i.level,c=Math.max(c,i.lij[0])}else if(n.data){let r=this.tile.surface.layerViewByIndex(e,0);if(g(this.tile,r)){let e=n.data;t&&t[s]===e.samplerData||(l=!0),a[s++]=e.samplerData,o[s-1]=e.level,c=this.tile.level}}}t!=null&&t.length!==s&&(l=!0);let u=s>0,d=u?a:null,f=u?o:null;return u&&(a.length=s,o.length=s),e(n,f)||(l=!0),{changed:l,samplerData:d,samplerDataSourceLevels:f,maxTileLevel:c}}get estimatedGeometryMemoryUsage(){let e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){}checkGeometryWaterproofness(){}}const x=[null,null,null,null];function S(e,t){return t?.loaded||t===e?t:null}const C=1,w=2,T=4,E=8,D=4,O=8,k=12,A=4,j=[0,1,2,3];export{b as PatchRenderData,S as neighborTileIfLoadedOrSelf,j as zeroToFour};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{releaseMaybe as e}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import r from"../../webgl/RenderCamera.js";import{isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as a}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as o}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as s}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as c}from"../lighting/SceneLighting.js";class l{constructor(e,t){this.width=e,this.height=t}}class u{constructor(e){this.shadowMap=e,this.output=0,this.slot=2,this.slicePlane=null,this.planarDistanceToGroundRatio=1,this.metersPerRenderUnit=1,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.globalIlluminationDirectFactor=.
|
|
2
|
+
import{releaseMaybe as e}from"../../../../core/maybe.js";import{signal as t}from"../../../../core/signal.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import r from"../../webgl/RenderCamera.js";import{isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as a}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as o}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as s}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as c}from"../lighting/SceneLighting.js";class l{constructor(e,t){this.width=e,this.height=t}}class u{constructor(e){this.shadowMap=e,this.output=0,this.slot=2,this.slicePlane=null,this.planarDistanceToGroundRatio=1,this.metersPerRenderUnit=1,this.hasOccludees=!1,this._emissions=t(0),this.transparentWithoutDepthEmissionDimmingPass=!1,this.useFloatBlend=t(!0),this.globalIlluminationDirectFactor=.55,this.globalIlluminationAmbientFactor=.85,this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.frameRendererTarget=0,this.overlayStretch=1,this.viewshedEnabled=!1,this.laserlinesEnabled=!1,this.shadowAnalysisEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=t(new r),this._inverseViewport=n(),this._oldLighting=new c,this._newLighting=new c,this._fadedLighting=new c,this._lighting=this._newLighting,this.screenSpaceReflections=new s,this.reprojection=new o,this.highlights=[],this.highlightMixOrigin=n(),this.highlightMixTexture=null,this.globalIlluminationEnabled=!1,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new a,this.hasShadowHighlights=!1}destroy(){this._camera=this.contentCamera=null,this.mainDepth=this.overlay=this.ssao=this.shadowHighlight=null,this.depth=e(this.depth),this.shadowMap?.dispose()}get emissions(){return this._emissions.value}set emissions(e){this._emissions.value=e}get hasEmission(){switch(this.output){case 0:return this.hasOpaqueEmission;case 1:case 2:return this.hasTransparentEmission;default:return!1}}get hasOpaqueEmission(){return this.emissions===1||this.emissions===3}get hasTransparentEmission(){return this.emissions===2||this.emissions===3}get hasEmissions(){return this.emissions!==0}get camera(){return this._camera.value}set camera(e){this._camera.value=e,this._inverseViewport[0]=1/e.fullViewport[2],this._inverseViewport[1]=1/e.fullViewport[3]}get enableOITOffset(){return this.camera.relativeElevation<5e5}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(e,t,n,r){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=n,this._newLighting.set(e),this._oldLighting.updateLegacy(),r===1&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return i(this.output)&&this.screenSpaceReflections.enabled&&this.reprojection.lastFrameColor!=null}get highlight(){return this.highlightLevel==null?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(e){e&&(e.name=`geometry depth`),this._depth=e}get occluder(){return this.slot===10||this.slot===11?this.slot:null}}export{u as BindParameters,l as ViewportSize};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Error.js";import{EventEmitter as t}from"../../../../core/Evented.js";import{disposeMaybe as n,removeMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as s,isArrayBuffer as c,isTypedArray as l}from"../../../../core/typedArrayUtil.js";import{generateUID as u}from"../../../../core/uid.js";import{isBlobProtocol as d,isDataProtocol as f}from"../../../../core/urlUtils.js";import{whenVideoPlayable as p}from"../../../../layers/support/videoUtils.js";import{requestImage as m}from"../../../../request/image.js";import{loadImage as h}from"../../../../request/loadImage.js";import{createTextureKTX1 as g,createTextureKTX2 as _,createTextureBasis as v,estimateMemoryKTX2 as y,estimateMemoryBasis as b}from"./BasisUtil.js";import{createDDSTexture as x}from"./DDSUtil.js";import{ensureImageMaxSize as S}from"./textureUtils.js";import{assert as C}from"./Util.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";import{isCompressedFormat as E,isSizedPixelFormat as D,isSizedDepthFormat as O,isSizedDepthStencilFormat as k}from"../../../webgl/textureUtils.js";import{getFormatComponents as A}from"../../../webgl/Util.js";class j{constructor(e,n){this._data=e,this.id=u(),this.events=new t,this._parameters={...P,...n},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!d(e.src)&&(e.preload!==`auto`||!e.crossOrigin)&&(e.preload=`auto`,e.crossOrigin=`anonymous`,e.src=e.src,e.paused&&e.autoplay)){let t=[];p(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){
|
|
2
|
+
import e from"../../../../core/Error.js";import{EventEmitter as t}from"../../../../core/Evented.js";import{disposeMaybe as n,removeMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as s,isArrayBuffer as c,isTypedArray as l}from"../../../../core/typedArrayUtil.js";import{generateUID as u}from"../../../../core/uid.js";import{isBlobProtocol as d,isDataProtocol as f}from"../../../../core/urlUtils.js";import{whenVideoPlayable as p}from"../../../../layers/support/videoUtils.js";import{requestImage as m}from"../../../../request/image.js";import{loadImage as h}from"../../../../request/loadImage.js";import{createTextureKTX1 as g,createTextureKTX2 as _,createTextureBasis as v,estimateMemoryKTX2 as y,estimateMemoryBasis as b}from"./BasisUtil.js";import{createDDSTexture as x}from"./DDSUtil.js";import{ensureImageMaxSize as S}from"./textureUtils.js";import{assert as C}from"./Util.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";import{isCompressedFormat as E,isSizedPixelFormat as D,isSizedDepthFormat as O,isSizedDepthStencilFormat as k}from"../../../webgl/textureUtils.js";import{getFormatComponents as A}from"../../../webgl/Util.js";class j{constructor(e,n){this._data=e,this.id=u(),this.events=new t,this._parameters={...P,...n},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!d(e.src)&&(e.preload!==`auto`||!e.crossOrigin)&&(e.preload=`auto`,e.crossOrigin=`anonymous`,e.src=e.src,e.paused&&e.autoplay)){let t=[];p(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){f(e.src)||d(e.src)||e.crossOrigin||(e.crossOrigin=`anonymous`,e.src=e.src)}_createDescriptor(e){let t=new T;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t.isImmutable=this._parameters.immutable===!0&&F(this._parameters.internalFormat),t}get texture(){return this._texture??this._emptyTexture}get loaded(){return this._texture!=null}get usedMemory(){return this._texture?.usedMemory||M(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;let t=this._data;return t==null?(this._texture=new w(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),typeof t==`string`?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):s(t)&&this._parameters.encoding===`image/vnd-ms.dds`?this._loadFromDDSData(e,t):c(t)&&this._parameters.encoding===`image/vnd-ms.dds`?this._loadFromDDSData(e,new Uint8Array(t)):s(t)&&this._parameters.encoding===`image/ktx`?this._loadFromKTX1(e,t):c(t)&&this._parameters.encoding===`image/ktx`?this._loadFromKTX1(e,new Uint8Array(t)):(c(t)||s(t))&&this._parameters.encoding===`image/ktx2`?this._loadFromKTX2(e,t):(c(t)||s(t))&&this._parameters.encoding===`image/x.basis`?this._loadFromBasis(e,t):c(t)?this._loadFromPixelData(e,new Uint8Array(t)):l(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return this._texture==null||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=x(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX1(e,t){return this._texture=g(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>_(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>v(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){C(this._parameters.width>0&&this._parameters.height>0);let n=this._createDescriptor(e);return(n.pixelFormat===6407||n.pixelFormat===6408)&&(n.compress=this._parameters.compressionOptions),n.width=this._parameters.width??0,n.height=this._parameters.height??0,this._texture=new w(e,n,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async n=>{let r=await m(t,{signal:n});return i(n),this._loadFromImage(e,r)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async n=>{let r=await h(t,t.src,!1,n);return i(n),this._loadFromImage(e,r)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,n){return this._loadAsync(i=>new Promise((s,c)=>{let l=()=>{n.removeEventListener(`loadeddata`,u),n.removeEventListener(`error`,d),r(f)},u=()=>{n.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),s(this._loadFromImage(t,n)))},d=t=>{l(),c(t||new e(`texture:load-error`,`Failed to load video`))};n.addEventListener(`loadeddata`,u),n.addEventListener(`error`,d);let f=a(i,()=>d(o()))}))}_loadFromImage(e,t){let n=t;n instanceof HTMLVideoElement||(n=S(n,e.parameters));let r=N(n);this._parameters.width=r.width,this._parameters.height=r.height;let i=this._createDescriptor(e);return i.width=r.width,i.height=r.height,i.compress=this._parameters.compressionOptions,this._texture=new w(e,i,n),this._emptyTexture=null,this.events.emit(`loaded`),this._texture}_loadAsync(e){let t=new AbortController;this._loadingController=t;let n=e(t.signal);this._loadingPromise=n;let r=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===n&&(this._loadingPromise=null),this._emptyTexture=null};return n.then(r,r),n}unload(){if(this._texture=n(this._texture),this._emptyTexture=null,this._loadingController!=null){let e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit(`unloaded`)}get parameters(){return this._parameters}}function M(e,t){if(e==null)return 0;if(c(e)||s(e))return t.encoding===`image/ktx2`?y(e,!!t.mipmap):t.encoding===`image/x.basis`?b(e,!!t.mipmap):e.byteLength;let{width:n,height:r}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?N(e):t,i=t.pixelFormat??6408,a=A(i);return(t.mipmap?4/3:1)*n*r*a||0}function N(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const P={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};function F(e){return e!=null&&(E(e)||D(e)||O(e)||k(e))}export{j as ManagedTexture};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as D}from"../effects/highlight/Highlight.js";import{OITBlend as me}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Te,PerformanceCategory as I}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Ee,ColorAttachment0 as L,ColorAttachment1 as R,ColorAttachment2 as z,DrawBufferNone as De}from"../../../webgl/enums.js";const Oe=has(`disable-feature:async-navigation-3d-depth-readback`);let B=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new Te(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new me(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=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:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...q),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?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,n=!1){try{return this._isRendering=!0,this._render(e,t,n)}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(J),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...H),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(I.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),!Oe&&(c===2||c===0)&&this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...U),t.output=0,this._plugins.precompile(...U),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(I.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let 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(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),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,Ee.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?I.OPAQUE_EDGES:I.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(I.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?I.AMBIENT_ILLUMINATION_HIGH_QUALITY:I.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(L);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,L),n?.release(),this.performanceInfo.advance(I.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(I.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,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||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,W),this._needsDepth&&this._precompilePlugins(3,G)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...W),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(I.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...U),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...K);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...K),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...G)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...V),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...V)}_renderTransparentGeometry(){this._plugins.render(...H),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...U)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...q),this._bindParameters.output=2,this._plugins.precompile(...q),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...q)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(R);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?I.HUD_OCCLUDED:I.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),D(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(I.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...ke),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(I.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...H)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(R,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(z,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(R,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?z:R;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-L,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...V)||this.plugins.produces(5,...V)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([De,R]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(R)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,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}}get test(){}};e([m({readOnly:!0})],B.prototype,`highResolutionAtmosphere`,null),e([m()],B.prototype,`_edgeView`,void 0),e([m()],B.prototype,`updating`,null),B=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],B);const V=[0,1,2,3],H=[7,6,4,5],U=[7,6],W=[0,1,2,4,...U],G=[3,5],K=[2,4,8],q=[16,12,14,13],ke=[4,5,2,3,0,1,...U],J=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...U],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{B as Renderer};
|
|
2
|
+
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as D}from"../effects/highlight/Highlight.js";import{OITBlend as me}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Te,PerformanceCategory as I}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Ee,ColorAttachment0 as L,ColorAttachment1 as R,ColorAttachment2 as z,DrawBufferNone as De}from"../../../webgl/enums.js";const Oe=has(`disable-feature:async-navigation-3d-depth-readback`);let B=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new Te(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new me(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=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:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...q),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?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,n=!1){try{return this._isRendering=!0,this._render(e,t,n)}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(J),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...H),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(I.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),Oe||c!==2&&c!==0||this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...U),t.output=0,this._plugins.precompile(...U),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(I.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let 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(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),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,Ee.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?I.OPAQUE_EDGES:I.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(I.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?I.AMBIENT_ILLUMINATION_HIGH_QUALITY:I.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(L);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,L),n?.release(),this.performanceInfo.advance(I.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(I.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,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||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,W),this._needsDepth&&this._precompilePlugins(3,G)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...W),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(I.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...U),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...K);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...K),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...G)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...V),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...V)}_renderTransparentGeometry(){this._plugins.render(...H),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...U)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...q),this._bindParameters.output=2,this._plugins.precompile(...q),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...q)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(R);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?I.HUD_OCCLUDED:I.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),D(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(I.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...ke),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(I.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...H)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(R,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(z,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(R,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?z:R;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-L,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...V)||this.plugins.produces(5,...V)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([De,R]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(R)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,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}}get test(){}};e([m({readOnly:!0})],B.prototype,`highResolutionAtmosphere`,null),e([m()],B.prototype,`_edgeView`,void 0),e([m()],B.prototype,`updating`,null),B=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],B);const V=[0,1,2,3],H=[7,6,4,5],U=[7,6],W=[0,1,2,4,...U],G=[3,5],K=[2,4,8],q=[16,12,14,13],ke=[4,5,2,3,0,1,...U],J=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...U],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{B as Renderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{fromRotation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,add as a,negate as o,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as l}from"./textureUtils.js";import{ViewshedFaceCamera as u}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as d,SizedDepthFormat as f}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as p}from"../../../webgl/textureUtils.js";class m{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(e){let t=e?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*t}textureResizeModulo(e){return Math.ceil(e/this.textureSizeMultiple)*this.textureSizeMultiple}}const h=[`front`,`left`,`right`,`back`,`top`,`bottom`];function g(e){return![`top`,`bottom`].includes(e)}class _{constructor(e){this._fbos=e,this._faces={},this._width=0,this._height=0,this.settings=new m,this._maxTextureSize=Math.min(has(`esri-mobile`)?4096:16384,e.rctx.parameters.maxTextureSize)}get depthTexture(){return this._fbo?.getTexture(d)}get renderTarget(){return this._fbo}get ready(){return this.depthTexture!=null&&this._width!==0&&this._height!==0}get nearFar(){let e=this.faces;return e.length===0?null:e[0].nearFar}get numActiveFaces(){return h.values().reduce((e,t)=>e+ +!!this._faces[t],0)}get faces(){let e=this._faces,t=[];for(let n of h){let r=e[n];r&&t.push(r)}return t}get atlasRegions(){return this.faces.map(e=>[e.x/this._width,(e.x+e.width)/this._width,e.y/this._height,(e.y+e.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(e=>e.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(e=>e.viewMatrix)}_setupFaceCamera(t,l,d,f){let{effectiveObserverRenderSpace:p,effectiveTargetRenderSpace:m,tiltedUpVector:h,farDistanceRenderSpace:_,horizontalFieldOfView:v,verticalFieldOfView:y}=l,b=c();i(b,m,p);let x=c(),S=c(),C=(e,t)=>{let i=c(),o=r();return n(o,e,t),s(i,b,o),a(i,p,i),i},w,T=h,E=Math.min(90,v),D=Math.min(90,Math.max(0,(v-90)/2)),O=-45,k=45,A=-45,j=45;if(g(t)){let t=t=>e(t,-45,45);A=t(-y/2)-this.settings.toleranceBottomTop,j=t(y/2)+this.settings.toleranceBottomTop}switch(t){case`front`:w=m,O=-E/2,k=E/2;break;case`left`:w=C(Math.PI/2,h),O=45-D;break;case`right`:w=C(-Math.PI/2,h),k=-45+D;break;case`top`:w=a(x,p,h),T=o(S,b);break;case`bottom`:w=i(x,p,h),T=b;break;case`back`:w=C(Math.PI,h)}let M=new u({center:w,eye:p,up:T,far:_});M.sectionAnglesDeg=[O-this.settings.toleranceSides,k+this.settings.toleranceSides,A,j],M.fovY=Math.PI/2;let N=M.setViewport(d,f);return this._faces[t]=M,N}isActive(e){return this._computeActiveFaces(e).size>0}_computeActiveFaces(e){let t=new Set,{horizontalFieldOfView:n,verticalFieldOfView:r}=e,i=-r/2,a=r/2;return n===0||r===0||(i<=45&&a>=-45&&t.add(`front`),n>90&&(t.add(`left`),t.add(`right`)),n>270&&t.add(`back`),a>45-this.settings.toleranceBottomTop&&t.add(`top`),i<-45+this.settings.toleranceBottomTop&&t.add(`bottom`)),t}_computeBaseTextureSize({pixelRatio:e,fullWidth:t,fullHeight:n},r,i,a){let o=r/e,s=this.settings.textureSizeModifier(i);return l(Math.max(t,n)*o*s,this._maxTextureSize/a)}_ensureFBO(e){let t=this._width,n=this._height,r=this._fbo?.fbo;
|
|
2
|
+
import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{fromRotation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,add as a,negate as o,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as l}from"./textureUtils.js";import{ViewshedFaceCamera as u}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as d,SizedDepthFormat as f}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as p}from"../../../webgl/textureUtils.js";class m{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(e){let t=e?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*t}textureResizeModulo(e){return Math.ceil(e/this.textureSizeMultiple)*this.textureSizeMultiple}}const h=[`front`,`left`,`right`,`back`,`top`,`bottom`];function g(e){return![`top`,`bottom`].includes(e)}class _{constructor(e){this._fbos=e,this._faces={},this._width=0,this._height=0,this.settings=new m,this._maxTextureSize=Math.min(has(`esri-mobile`)?4096:16384,e.rctx.parameters.maxTextureSize)}get depthTexture(){return this._fbo?.getTexture(d)}get renderTarget(){return this._fbo}get ready(){return this.depthTexture!=null&&this._width!==0&&this._height!==0}get nearFar(){let e=this.faces;return e.length===0?null:e[0].nearFar}get numActiveFaces(){return h.values().reduce((e,t)=>e+ +!!this._faces[t],0)}get faces(){let e=this._faces,t=[];for(let n of h){let r=e[n];r&&t.push(r)}return t}get atlasRegions(){return this.faces.map(e=>[e.x/this._width,(e.x+e.width)/this._width,e.y/this._height,(e.y+e.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(e=>e.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(e=>e.viewMatrix)}_setupFaceCamera(t,l,d,f){let{effectiveObserverRenderSpace:p,effectiveTargetRenderSpace:m,tiltedUpVector:h,farDistanceRenderSpace:_,horizontalFieldOfView:v,verticalFieldOfView:y}=l,b=c();i(b,m,p);let x=c(),S=c(),C=(e,t)=>{let i=c(),o=r();return n(o,e,t),s(i,b,o),a(i,p,i),i},w,T=h,E=Math.min(90,v),D=Math.min(90,Math.max(0,(v-90)/2)),O=-45,k=45,A=-45,j=45;if(g(t)){let t=t=>e(t,-45,45);A=t(-y/2)-this.settings.toleranceBottomTop,j=t(y/2)+this.settings.toleranceBottomTop}switch(t){case`front`:w=m,O=-E/2,k=E/2;break;case`left`:w=C(Math.PI/2,h),O=45-D;break;case`right`:w=C(-Math.PI/2,h),k=-45+D;break;case`top`:w=a(x,p,h),T=o(S,b);break;case`bottom`:w=i(x,p,h),T=b;break;case`back`:w=C(Math.PI,h)}let M=new u({center:w,eye:p,up:T,far:_});M.sectionAnglesDeg=[O-this.settings.toleranceSides,k+this.settings.toleranceSides,A,j],M.fovY=Math.PI/2;let N=M.setViewport(d,f);return this._faces[t]=M,N}isActive(e){return this._computeActiveFaces(e).size>0}_computeActiveFaces(e){let t=new Set,{horizontalFieldOfView:n,verticalFieldOfView:r}=e,i=-r/2,a=r/2;return n===0||r===0||(i<=45&&a>=-45&&t.add(`front`),n>90&&(t.add(`left`),t.add(`right`)),n>270&&t.add(`back`),a>45-this.settings.toleranceBottomTop&&t.add(`top`),i<-45+this.settings.toleranceBottomTop&&t.add(`bottom`)),t}_computeBaseTextureSize({pixelRatio:e,fullWidth:t,fullHeight:n},r,i,a){let o=r/e,s=this.settings.textureSizeModifier(i);return l(Math.max(t,n)*o*s,this._maxTextureSize/a)}_ensureFBO(e){let t=this._width,n=this._height,r=this._fbo?.fbo;r&&r.width===t&&r.height===n&&e===p(r.depthStencilTexture?.descriptor?.internalFormat??f.DEPTH_COMPONENT16)||(this._fbo?.release(),this._fbo=this._allocateFBO(e))}_allocateFBO(e){let{_width:t,_height:n}=this,r=e?14:13,i=this._fbos.acquire(t,n,`viewshed shadow map`,r);return i.getTexture(d)?.setShadowFiltering(!1),i}clearFBO(e){let t=this._fbos.rctx;this._ensureFBO(e),t.bindFramebuffer(this._fbo?.fbo),t.setClearColor(1,1,1,1),t.clear(16640)}dispose(){this._fbo=t(this._fbo)}releaseFBO(){this._debugFBO||(this._fbo=t(this._fbo))}start(e,t,n,r,i=!1){this._faces={};let a=this._computeActiveFaces(t),o=a.size;if(o===0)return!1;let s=this._computeBaseTextureSize(e,r,n,o),c=0,l=0,u=0;for(let e of a){let n=v(e,o);n>l&&(u=Math.max(u,c),c=0),l=n;let r=n*s;c+=this._setupFaceCamera(e,t,[c,r],s)}return u=Math.max(u,c),this._width=this.settings.textureResizeModulo(u),this._height=y(o)*s,this.clearFBO(i),!0}finish(){}get test(){}}function v(e,t){if(t<4)return 0;let n=e===`front`||e===`left`;return t===4?+!n:n||e===`right`?0:1}function y(e){return e<4?1:2}export{_ as ViewshedShadowMap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{makeArrayEquals as e}from"../../../../../core/arrayUtils.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{ScreenSizePerspectiveEvaluator as n}from"../../lib/screenSizePerspectiveUtils.js";function r(e,n,r,i,a,o){let c=r.screenLength*e.pixelRatio;a!=null&&(s.update(i,n,a,o),c=s.apply(c));let l=c*Math.tan(.5*e.fovY)/(e.fullHeight*.5);return t(l*n,r.minWorldLength,r.maxWorldLength)}const i=e();function a(e,t){let n=!1;for(let r in t){let a=t[r];a!==void 0&&(Array.isArray(a)?
|
|
2
|
+
import{makeArrayEquals as e}from"../../../../../core/arrayUtils.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{ScreenSizePerspectiveEvaluator as n}from"../../lib/screenSizePerspectiveUtils.js";function r(e,n,r,i,a,o){let c=r.screenLength*e.pixelRatio;a!=null&&(s.update(i,n,a,o),c=s.apply(c));let l=c*Math.tan(.5*e.fovY)/(e.fullHeight*.5);return t(l*n,r.minWorldLength,r.maxWorldLength)}const i=e();function a(e,t){let n=!1;for(let r in t){let a=t[r];a!==void 0&&(Array.isArray(a)?Array.isArray(e[r])&&i(a,e[r])||(e[r]=a.slice(),n=!0):e[r]!==a&&(n=!0,e[r]=a))}return n}const o={multiply:1,ignore:2,replace:3,tint:4},s=new n;export{o as colorMixModes,a as updateParameters,r as verticalOffsetAtDistance};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import t from"../../../../../core/PooledArray.js";import{assert as n}from"../../lib/Util.js";import{bufferRangePool as r,mergeAdjacentRanges as i}from"./BufferRange.js";import{DrawCommand as a}from"./DrawCommand.js";import{Instance as o}from"./Instance.js";import{InstancedCommandVAO as s}from"./InstancedCommandVAO.js";import{InstancedCommandVAOs as c}from"./InstancedCommandVAOs.js";import{defaultHighlightName as l}from"../../../../support/HighlightDefaults.js";class u{constructor(e,t){this.isInstanced=e,this.targetBuffers=t,this.vao=null,this.textureBuffer=null,this.endElements={geometry:0,texture:0,index:0},this._instances=new Map,this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=f(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=f(),this.drawCommandsShadowHighlightRest=f(),this._instancedCommandVAOs=null;let n={},r={};for(let e of t)n[e]=0,r[e]=[];this._numElements=n,this._holes=r,this.useIndexing=t.includes(`index`),this._drawRangesTarget=this.useIndexing?`index`:`geometry`}getTargetBuffer(e){return e===`geometry`?this.vao?.buffer(`geometry`):e===`texture`?this.textureBuffer:this.vao?.indexBuffer}get numElements(){return this._numElements}get instances(){return this._instances}get writeableInstances(){return this._instances}get indexType(){return this.vao?.indexBuffer?.indexType}clearHoles(){for(let e of this.targetBuffers){let t=this._holes[e];for(let e of t)r.release(e);t.length=0}}get holes(){return this._holes}get hasHighlights(){return this.highlightNames.size>0}get instancedCommandVAOs(){return this._instancedCommandVAOs}get _drawTargetHoles(){return this._holes[this._drawRangesTarget]}get _drawTargetEndElement(){return this.endElements[this._drawRangesTarget]}get usedMemory(){return(this.vao?.usedMemory??0)+(this.textureBuffer?.usedMemory??0)}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateDirtyDrawCommands(e){if(this.drawCommandsDirty){this.resetInstanceSummary();for(let e of this.instances.values())this.updateDrawState(e);this.updateDrawCommands(e)}}createInstance(e,t,n=this._makeEmptyRanges()){let r=new o(e,n,t,this._drawRangesTarget);return this.addInstance(e.id,r),r}addInstance(e,t){n(!this._instances.has(e)),this._instances.set(e,t);for(let e of this.targetBuffers)this._numElements[e]+=t.targetRanges[e].numElements}deleteInstance(e){let t=this._instances.get(e);if(t){for(let e of this.targetBuffers){let n=t.targetRanges[e];this._numElements[e]-=n.numElements,r.release(n)}this._instances.delete(e)}}updateInstances(){let{targetBuffers:e}=this,t={};for(let n of e)t[n]=0;for(let n of this._instances.values()){for(let r of e)t[r]+=n.targetRanges[r].numElements;this.updateDrawState(n)}this._numElements=t}updateDrawState(e){if(e.isVisible){let{highlightName:t}=e;t&&this.highlightNames.add(t),e.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(e){this._updateDrawCommands(e),this._updateInstancedCommandVAOs()}_updateDrawCommands(e){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,this._instances.size===0)return;let{sortedInstances:t}=this;if(this._updateHighlightDrawCommands(e,t),!this.needsMultipleCommands){let e=this.drawCommandsDefault.pushNew(),t=this._drawTargetHoles,n=t.at(0);if(this.vao&&t.length===1&&n.to===this._drawTargetEndElement){e.first=0,e.count=n.from;return}e.first=1/0,e.count=0,this._instances.forEach(t=>{e.first=Math.min(e.first,t.drawRange.from),e.count=Math.max(e.count,t.drawRange.to)}),e.count-=e.first}else for(let e of t)e.isVisible&&this.addOrMerge(e.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,e)}get sortedInstances(){return Array.from(this._instances.values()).sort(({drawRange:e},{drawRange:t})=>e.from===t.from?e.to-t.to:e.from-t.from)}updateHighlights(e){this.highlightNames.clear();let t=this.sortedInstances;for(let n of t)n.updateHighlightOptions(e),n.isVisible&&n.highlightName&&this.highlightNames.add(n.highlightName);this._updateHighlightDrawCommands(e,t),this._updateInstancedCommandVAOs()}mergeHoles(){let e=this._holes;for(let t of this.targetBuffers)i(e[t])}_updateHighlightDrawCommands(t,n){let{drawCommandsHighlights:r,drawCommandsShadowHighlightRest:i}=this;r.clear(),i.clear();for(let a of n){if(a.updateHighlightOptions(t),!a.isVisible)continue;let{highlightName:n}=a;if(n){this.highlightNames.add(n);let t=e(r,n,f);this.addOrMerge(t,a)}
|
|
2
|
+
import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import t from"../../../../../core/PooledArray.js";import{assert as n}from"../../lib/Util.js";import{bufferRangePool as r,mergeAdjacentRanges as i}from"./BufferRange.js";import{DrawCommand as a}from"./DrawCommand.js";import{Instance as o}from"./Instance.js";import{InstancedCommandVAO as s}from"./InstancedCommandVAO.js";import{InstancedCommandVAOs as c}from"./InstancedCommandVAOs.js";import{defaultHighlightName as l}from"../../../../support/HighlightDefaults.js";class u{constructor(e,t){this.isInstanced=e,this.targetBuffers=t,this.vao=null,this.textureBuffer=null,this.endElements={geometry:0,texture:0,index:0},this._instances=new Map,this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=f(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=f(),this.drawCommandsShadowHighlightRest=f(),this._instancedCommandVAOs=null;let n={},r={};for(let e of t)n[e]=0,r[e]=[];this._numElements=n,this._holes=r,this.useIndexing=t.includes(`index`),this._drawRangesTarget=this.useIndexing?`index`:`geometry`}getTargetBuffer(e){return e===`geometry`?this.vao?.buffer(`geometry`):e===`texture`?this.textureBuffer:this.vao?.indexBuffer}get numElements(){return this._numElements}get instances(){return this._instances}get writeableInstances(){return this._instances}get indexType(){return this.vao?.indexBuffer?.indexType}clearHoles(){for(let e of this.targetBuffers){let t=this._holes[e];for(let e of t)r.release(e);t.length=0}}get holes(){return this._holes}get hasHighlights(){return this.highlightNames.size>0}get instancedCommandVAOs(){return this._instancedCommandVAOs}get _drawTargetHoles(){return this._holes[this._drawRangesTarget]}get _drawTargetEndElement(){return this.endElements[this._drawRangesTarget]}get usedMemory(){return(this.vao?.usedMemory??0)+(this.textureBuffer?.usedMemory??0)}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateDirtyDrawCommands(e){if(this.drawCommandsDirty){this.resetInstanceSummary();for(let e of this.instances.values())this.updateDrawState(e);this.updateDrawCommands(e)}}createInstance(e,t,n=this._makeEmptyRanges()){let r=new o(e,n,t,this._drawRangesTarget);return this.addInstance(e.id,r),r}addInstance(e,t){n(!this._instances.has(e)),this._instances.set(e,t);for(let e of this.targetBuffers)this._numElements[e]+=t.targetRanges[e].numElements}deleteInstance(e){let t=this._instances.get(e);if(t){for(let e of this.targetBuffers){let n=t.targetRanges[e];this._numElements[e]-=n.numElements,r.release(n)}this._instances.delete(e)}}updateInstances(){let{targetBuffers:e}=this,t={};for(let n of e)t[n]=0;for(let n of this._instances.values()){for(let r of e)t[r]+=n.targetRanges[r].numElements;this.updateDrawState(n)}this._numElements=t}updateDrawState(e){if(e.isVisible){let{highlightName:t}=e;t&&this.highlightNames.add(t),e.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(e){this._updateDrawCommands(e),this._updateInstancedCommandVAOs()}_updateDrawCommands(e){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,this._instances.size===0)return;let{sortedInstances:t}=this;if(this._updateHighlightDrawCommands(e,t),!this.needsMultipleCommands){let e=this.drawCommandsDefault.pushNew(),t=this._drawTargetHoles,n=t.at(0);if(this.vao&&t.length===1&&n.to===this._drawTargetEndElement){e.first=0,e.count=n.from;return}e.first=1/0,e.count=0,this._instances.forEach(t=>{e.first=Math.min(e.first,t.drawRange.from),e.count=Math.max(e.count,t.drawRange.to)}),e.count-=e.first}else for(let e of t)e.isVisible&&this.addOrMerge(e.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,e)}get sortedInstances(){return Array.from(this._instances.values()).sort(({drawRange:e},{drawRange:t})=>e.from===t.from?e.to-t.to:e.from-t.from)}updateHighlights(e){this.highlightNames.clear();let t=this.sortedInstances;for(let n of t)n.updateHighlightOptions(e),n.isVisible&&n.highlightName&&this.highlightNames.add(n.highlightName);this._updateHighlightDrawCommands(e,t),this._updateInstancedCommandVAOs()}mergeHoles(){let e=this._holes;for(let t of this.targetBuffers)i(e[t])}_updateHighlightDrawCommands(t,n){let{drawCommandsHighlights:r,drawCommandsShadowHighlightRest:i}=this;r.clear(),i.clear();for(let a of n){if(a.updateHighlightOptions(t),!a.isVisible)continue;let{highlightName:n}=a;if(n){this.highlightNames.add(n);let t=e(r,n,f);this.addOrMerge(t,a)}n&&n===l||this.addOrMerge(i,a)}}_updateInstancedCommandVAOs(){let e=this.vao;if(!this.isInstanced||e==null)return;this._instancedCommandVAOs??=new c;let t=this._instancedCommandVAOs,n=t.commandVAOs.clone();t.clear();let r=t.commandVAOs,i=(t,i)=>{for(let a of t){let{first:t,count:o}=a,c=r.get(t,o)??n.pop(t,o)??new s(e.shallowCloneWithBaseInstances(new Map([[`geometry`,a.first]])),a.count);r.set(t,o,c),i.push(c)}};i(this.drawCommandsDefault,t.drawCommandsDefault);for(let[e,n]of this.drawCommandsHighlights){let r=[];i(n,r),t.drawCommandsHighlights.set(e,r)}i(this.drawCommandsOccludees,t.drawCommandsOccludees),i(this.drawCommandsShadowHighlightRest,t.drawCommandsShadowHighlightRest);for(let e of n.values())e.dispose();n.clear()}get needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}addOrMerge(e,{drawRange:t}){let n=e.back();if(n==null){let n=e.pushNew();n.first=t.from,n.count=t.numElements}else if(p(n,t))n.count=t.from-n.first+t.numElements;else{let n=e.pushNew();n.first=t.from,n.count=t.numElements}}_makeEmptyRanges(){let e={};for(let t of this.targetBuffers)e[t]=r.acquire(0,0);return e}}function d(e){return e.vao!=null}function f(){return new t({allocator:e=>e||new a,deallocator:e=>e})}function p(e,t){return e.first+e.count>=t.from}export{u as PerBufferData,d as hasVao};
|