@arcgis/core 4.28.0-next.20230921 → 4.28.0-next.20230923
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/Graphic.js +1 -1
- package/PopupTemplate.js +1 -1
- package/TimeExtent.js +1 -1
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/arcade/featureset/support/StatsField.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02156fd04279f4d0fd3f.js +1 -0
- package/assets/esri/core/workers/chunks/07f6175b52366b2c28bd.js +1 -0
- package/assets/esri/core/workers/chunks/098073c3b2849f56dad8.js +1 -0
- package/assets/esri/core/workers/chunks/1186ba1947bd0c32f148.js +1 -0
- package/assets/esri/core/workers/chunks/186445b9fbedd261f684.js +1 -0
- package/assets/esri/core/workers/chunks/{580039dd491854ca325c.js → 21fc02f0d5716c4a7acd.js} +1 -1
- package/assets/esri/core/workers/chunks/{dff1c3c38dda2bd1a9d6.js → 246a954347fe9318190e.js} +1 -1
- package/assets/esri/core/workers/chunks/{c9dfb145f0c1d93e0fbd.js → 250bb6ae6f1992b5b4f9.js} +1 -1
- package/assets/esri/core/workers/chunks/{314c307e30f308a40a28.js → 25b09e9c0511c8e1cf8a.js} +1 -1
- package/assets/esri/core/workers/chunks/2a0b3b52ecd787a613bc.js +1 -0
- package/assets/esri/core/workers/chunks/2bc9b55e655968229ef4.js +1 -0
- package/assets/esri/core/workers/chunks/2f0924e7aa89e689da4a.js +1 -0
- package/assets/esri/core/workers/chunks/3f218d65ec451b2a1027.js +1 -0
- package/assets/esri/core/workers/chunks/425b5733bb88e6efe242.js +1 -0
- package/assets/esri/core/workers/chunks/45d6b942cdccca2ce44a.js +1 -0
- package/assets/esri/core/workers/chunks/4bf1a7e82a68ccee0ee1.js +1 -0
- package/assets/esri/core/workers/chunks/4c110c7f4f940ec58010.js +1 -0
- package/assets/esri/core/workers/chunks/{bde89b2684b6185992ef.js → 4ed77097e69fa3096ce4.js} +1 -1
- package/assets/esri/core/workers/chunks/4fe5bac782a742d5b1c0.js +1 -0
- package/assets/esri/core/workers/chunks/{1cbaba30f55f00f7498b.js → 51324d042f469f3b8914.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f4e9b1663ec521bfe00.js → 542ce10e1872399790b4.js} +1 -1
- package/assets/esri/core/workers/chunks/54d2b7e2ac4ba883bee8.js +1 -0
- package/assets/esri/core/workers/chunks/54ecb6cae310818d1aa2.js +1 -0
- package/assets/esri/core/workers/chunks/57c932e289d89d97da4b.js +1 -0
- package/assets/esri/core/workers/chunks/{6403de6fc067cf8f7436.js → 592c1fb531f2be928e8a.js} +1 -1
- package/assets/esri/core/workers/chunks/59a807220d6f0dd18776.js +1 -0
- package/assets/esri/core/workers/chunks/59dff10d7ad2b1bf469e.js +1 -0
- package/assets/esri/core/workers/chunks/609a475ab395f2ce63e2.js +1 -0
- package/assets/esri/core/workers/chunks/612c485c5aad1548d708.js +1 -0
- package/assets/esri/core/workers/chunks/{2bb69d76a13564e8e455.js → 645ba2d5c10184632d23.js} +1 -1
- package/assets/esri/core/workers/chunks/{332689bf60d246485993.js → 65186e168dd112ac6221.js} +1 -1
- package/assets/esri/core/workers/chunks/6b9248fb2d6aadbce7bb.js +1 -0
- package/assets/esri/core/workers/chunks/709465832d306e02df52.js +1 -0
- package/assets/esri/core/workers/chunks/72c5bd6f7b8541b8d69e.js +1 -0
- package/assets/esri/core/workers/chunks/{bbc0dcd316c5598bc9ad.js → 74368a5213def6c200a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{94188fe381239d48a975.js → 76483c9a8848f3106126.js} +1 -1
- package/assets/esri/core/workers/chunks/7aa58c96798447ce5907.js +1 -0
- package/assets/esri/core/workers/chunks/7d078b8b9997b5300c0a.js +1 -0
- package/assets/esri/core/workers/chunks/7fe641cf1467496e670a.js +1 -0
- package/assets/esri/core/workers/chunks/{df8f62beb36fb9d2ac81.js → 810c8d6ff19976fd1366.js} +1 -1
- package/assets/esri/core/workers/chunks/8458ed96f3e72814cef2.js +1 -0
- package/assets/esri/core/workers/chunks/{243a4eed107d363dfad8.js → 887652bbdb3b71d0a089.js} +1 -1
- package/assets/esri/core/workers/chunks/896bfda379cf620b63ec.js +1 -0
- package/assets/esri/core/workers/chunks/91c9f0d59eaed7a735ce.js +1 -0
- package/assets/esri/core/workers/chunks/{1f7e041140088f8ac489.js → 97073a60f0ea2a397165.js} +1 -1
- package/assets/esri/core/workers/chunks/97658ac749664a07c92d.js +1 -0
- package/assets/esri/core/workers/chunks/{1da74a306aa5b4eacaae.js → 9866bbaeaf885c2dcca9.js} +1 -1
- package/assets/esri/core/workers/chunks/a39ae87298ac674f129d.js +1 -0
- package/assets/esri/core/workers/chunks/a7b3048c19348540e004.js +1 -0
- package/assets/esri/core/workers/chunks/a8ca4b116909e47722f9.js +1 -0
- package/assets/esri/core/workers/chunks/{101f776316a85b708927.js → a99070ec4c06c435b744.js} +1 -1
- package/assets/esri/core/workers/chunks/ab145d13932d87dd7bf9.js +1 -0
- package/assets/esri/core/workers/chunks/{77c15b1c2729c780f75a.js → aeeeb386134b341d7ad2.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ca759f72d3bb29e9ea9.js → af54b233f6d6ad70b4a3.js} +2 -2
- package/assets/esri/core/workers/chunks/b9146daae8457224fd08.js +1 -0
- package/assets/esri/core/workers/chunks/bcdd2e8841abcb4df6da.js +1 -0
- package/assets/esri/core/workers/chunks/be05cc0cdabd5e051045.js +1 -0
- package/assets/esri/core/workers/chunks/c5f5f37bef11c6fbdc40.js +1 -0
- package/assets/esri/core/workers/chunks/d414dba3179bcf75bc6b.js +1 -0
- package/assets/esri/core/workers/chunks/{b449d6bd5851187d419f.js → d6e5408f9fa6b4bcd118.js} +1 -1
- package/assets/esri/core/workers/chunks/d9fb500cbd0f04d219a3.js +1 -0
- package/assets/esri/core/workers/chunks/e0dd6789fb797e9b7206.js +1 -0
- package/assets/esri/core/workers/chunks/{6f271249e042086d5a16.js → e4e49deae8da74f629db.js} +1 -1
- package/assets/esri/core/workers/chunks/e5dcff7a4fa84ba09670.js +1 -0
- package/assets/esri/core/workers/chunks/{f508ccfde6425dabe9ac.js → ee0bf611d191103a7046.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed1fbc1bc8d50453e2f5.js → f793cd41fcd022baeea2.js} +1 -1
- package/assets/esri/core/workers/chunks/fad6a7bb82a0a2df726f.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +2 -84
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/arcade.js +1 -1
- package/config.js +1 -1
- package/core/Accessor.js +1 -1
- package/core/accessorSupport/diffUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/number.js +1 -1
- package/core/reactiveUtils.js +1 -1
- package/core/sql/DateOnly.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/sql.js +1 -1
- package/core/timeUtils.js +1 -1
- package/identity/IdentityForm.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +48 -203
- package/layers/LinkChartLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/applyEditsUtils.js +5 -0
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/orientedImagery/core/CameraOrientationLTP.js +1 -1
- package/layers/orientedImagery/core/ElevationSourceDefinitions.js +5 -0
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/core/cameraOrientationFactory.js +1 -1
- package/layers/orientedImagery/core/utils.js +5 -0
- package/layers/orientedImagery/transformations/groundToImageUtils.js +1 -1
- package/layers/support/fieldProperties.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/imageryRendererUtils.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +1 -1
- package/request.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/support/DirectionsFeatureSet.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/statistics/support/ageUtils.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/apiKeyUtils.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/time/TimeReference.js +1 -1
- package/time/timeReferenceUtils.js +1 -1
- package/versionManagement/VersionManagementService.js +1 -1
- package/versionManagement/support/EditMomentStack.js +5 -0
- package/versionManagement/support/versionManagementUtils.js +1 -1
- package/views/2d/engine/Container.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/ManagedCanvas.js +5 -0
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/GroupContainer.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/WGLContainer.js +1 -1
- package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
- package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/graphics/BaseGraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/2d/layers/support/DisplayGL.js +1 -1
- package/views/2d/webglDeps.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/featureEditing.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginInput.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/RenderSlot.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureFactory.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgeProcessing.js +1 -1
- package/views/View.js +1 -1
- package/views/interactive/tooltip/TooltipContentWithHelpMessage.js +1 -1
- package/views/interactive/tooltip/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/constraintUtils.js +1 -1
- package/views/interactive/tooltip/content/Fields.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawMesh.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformAbsolute.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphic.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicZ.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexZ.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/ui/UI.js +1 -1
- package/views/webgl/ShaderTranspiler.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/contextUtils.js +1 -1
- package/webmap/InitialViewProperties.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/AreaMeasurement3D.js +1 -1
- package/widgets/Attachments/AttachmentsViewModel.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/Compass.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Directions/components/SaveLayer.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/components/FooterActions.js +1 -1
- package/widgets/Editor/components/Notices.js +1 -1
- package/widgets/Editor/components/PanelContent.js +1 -1
- package/widgets/Editor/components/PanelToolbar.js +1 -1
- package/widgets/Editor/components/Prompt.js +1 -1
- package/widgets/Editor/components/Settings.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/components/UploadDetails.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/components/LegendItem.js +1 -1
- package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
- package/widgets/ElevationProfile/components/Statistics.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureContent.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/FeatureContentMixin.js +1 -1
- package/widgets/Feature/support/FeatureElementInfo.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/GroupInput.js +1 -1
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Features/FeaturesRelatedRecords.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Histogram.js +1 -1
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Home.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/Classic.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/NavigationToggle.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider/scalePreviewUtils.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast/components/DiscreteConfigurator.js +1 -1
- package/widgets/ShadowCast/components/DurationConfigurator.js +1 -1
- package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
- package/widgets/ShadowCast/components/ThresholdConfigurator.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/widgets/VideoPlayer.js +1 -1
- package/widgets/Weather/LabeledSlider.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/Zoom/IconButton.js +1 -1
- package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ClassedColorSlider.js +1 -1
- package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSlider.js +1 -1
- package/widgets/smartMapping/HeatmapSlider.js +1 -1
- package/widgets/smartMapping/OpacitySlider.js +1 -1
- package/widgets/smartMapping/SizeSlider.js +1 -1
- package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/Heading.js +1 -1
- package/widgets/support/LabeledSwitch.js +1 -1
- package/widgets/support/MeasurementWidgetContent.js +1 -1
- package/widgets/support/Popover.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SketchTooltipControls.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/widgets/support/TimezonePicker.js +1 -1
- package/widgets/support/UnitSelect.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/072b4e041b8630c513a0.js +0 -1
- package/assets/esri/core/workers/chunks/092920c25cac89c038ee.js +0 -1
- package/assets/esri/core/workers/chunks/114269dda1d296893908.js +0 -1
- package/assets/esri/core/workers/chunks/126df6237fc80608344e.js +0 -1
- package/assets/esri/core/workers/chunks/1b3655f5bf5d90fa8730.js +0 -1
- package/assets/esri/core/workers/chunks/1c83f47d446f2bca1721.js +0 -1
- package/assets/esri/core/workers/chunks/1cf7bb514e7eefc3e9c6.js +0 -1
- package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +0 -1
- package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +0 -1
- package/assets/esri/core/workers/chunks/2a1c1be9c202462cf54d.js +0 -1
- package/assets/esri/core/workers/chunks/2cb36f9686693234991a.js +0 -1
- package/assets/esri/core/workers/chunks/2d0d03cbea83c868edba.js +0 -1
- package/assets/esri/core/workers/chunks/2e130cb2f1038055c07b.js +0 -1
- package/assets/esri/core/workers/chunks/3619e04cbb6691549014.js +0 -1
- package/assets/esri/core/workers/chunks/3dbfb4f370a874393822.js +0 -1
- package/assets/esri/core/workers/chunks/406db5c90271a3a203d4.js +0 -1
- package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +0 -1
- package/assets/esri/core/workers/chunks/4f4a424d1747d04501df.js +0 -1
- package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +0 -1
- package/assets/esri/core/workers/chunks/5a5720caa64a46daadf9.js +0 -1
- package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +0 -1
- package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +0 -1
- package/assets/esri/core/workers/chunks/650a317b6dc245a7060f.js +0 -1
- package/assets/esri/core/workers/chunks/7a358b1fd0c0cce59e9b.js +0 -1
- package/assets/esri/core/workers/chunks/83d1a1b3d371c991cc4c.js +0 -1
- package/assets/esri/core/workers/chunks/846b7a81b870c8b238a1.js +0 -1
- package/assets/esri/core/workers/chunks/8ab832468300cc4feb5a.js +0 -1
- package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +0 -1
- package/assets/esri/core/workers/chunks/bc6323bdc98013da6fe5.js +0 -1
- package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +0 -1
- package/assets/esri/core/workers/chunks/c60cf62f374e71e562fc.js +0 -1
- package/assets/esri/core/workers/chunks/c6ea5aac232d1eca04dd.js +0 -1
- package/assets/esri/core/workers/chunks/c8438c2d9ac48afe4033.js +0 -1
- package/assets/esri/core/workers/chunks/c8f239c25fe864f0e47a.js +0 -1
- package/assets/esri/core/workers/chunks/cad260881653567bc8f9.js +0 -1
- package/assets/esri/core/workers/chunks/d824f4b405a72cd2fa74.js +0 -1
- package/assets/esri/core/workers/chunks/dd7508d4016715371e0c.js +0 -1
- package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +0 -1
- package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +0 -1
- package/assets/esri/core/workers/chunks/f38c54ada9e7012a2960.js +0 -1
- package/assets/esri/core/workers/chunks/f5e0ff5292b9fd18fc92.js +0 -1
- package/assets/esri/core/workers/chunks/f5eb8b5021620be7538e.js +0 -1
- package/core/watchUtils.d.ts +0 -4
- package/core/watchUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{I as t,b as i}from"../../../../chunks/mat4f64.js";import{e}from"../../../../chunks/vec3.js";import{
|
|
5
|
+
import{I as t,b as i}from"../../../../chunks/mat4f64.js";import{e}from"../../../../chunks/vec3.js";import{compactIndices as n,getContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as r}from"./AttributeArray.js";import{Object3DState as o}from"./basicInterfaces.js";import{BoundingInfo as h}from"./BoundingInfo.js";import{ContentObject as a}from"./ContentObject.js";import{ContentObjectType as u}from"./ContentObjectType.js";import{computeAttachmentOriginTriangles as g,computeAttachmentOriginLines as c,computeAttachmentOriginPoints as m}from"./geometryDataUtils.js";import{Object3DStateID as l}from"./Object3DStateID.js";import{assert as d}from"./Util.js";import{VertexAttribute as f}from"./VertexAttribute.js";import{addObject3DStateID as b,removeObject3DStateID as p}from"../materials/renderers/utils.js";class I extends a{constructor(t,i,e=null,s=u.Mesh,r=null,o=-1){super(),this.material=t,this.mapPositions=e,this.type=s,this.objectAndLayerIdColor=r,this.edgeIndicesLength=o,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[h,a]of i)this._attributes.set(h,{...a,indices:n(a.indices)}),h===f.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(h).indices.length:this.edgeIndicesLength)}instantiate(t={}){const i=new I(t.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach(((t,e)=>{t.exclusive=!1,i._attributes.set(e,t)})),i._boundingInfo=this._boundingInfo,i.transformation=t.transformation||this.transformation,i}get attributes(){return this._attributes}getMutableAttribute(t){let i=this._attributes.get(t);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:r(i.data)},this._attributes.set(t,i)),i}setAttributeData(t,i){const e=this._attributes.get(t);e&&this._attributes.set(t,{...e,exclusive:!0,data:i})}get indexCount(){const t=this._attributes.values().next().value.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return null==this._boundingInfo&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(t){return!!(this.type===u.Mesh?this._computeAttachmentOriginTriangles(t):this.type===u.Line?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t))&&(null!=this._transformation&&e(t,t,this._transformation),!0)}_computeAttachmentOriginTriangles(t){const i=this.attributes.get(f.POSITION);return g(i,t)}_computeAttachmentOriginLines(t){const i=this.attributes.get(f.POSITION);return c(i,_(this.material.parameters,i),t)}_computeAttachmentOriginPoints(t){const i=this.attributes.get(f.POSITION);return m(i,t)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const t=this.attributes.get(f.POSITION);if(!t||0===t.indices.length)return null;const i=this.type===u.Mesh?3:1;d(t.indices.length%i==0,"Indexing error: "+t.indices.length+" not divisible by "+i);const e=s(t.indices.length/i);return new h(e,i,t)}get transformation(){return this._transformation??t}set transformation(e){this._transformation=e&&e!==t?i(e):null}addHighlight(){const t=new l(o.Highlight);return this.highlights=b(this.highlights,t),t}removeHighlight(t){this.highlights=p(this.highlights,t)}}function _(t,i){return!(!("isClosed"in t)||!t.isClosed)&&i.indices.length>2}export{I as Geometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{someMap as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{someMap as o}from"../../../../core/MapUtils.js";import{NullUID as r}from"../../../../core/uid.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{DirtyOperation as i,DirtyState as c}from"./ModelDirtyTypes.js";import{assert as a}from"./Util.js";class n{constructor(e,t,o,r){this.operation=e,this.geometry=t,this.states=o,this.sync=r}}let m=class extends t{constructor(e){super(e),this._residentGeomRecords=new Map,this._dirtyGeomRecords=new Map,this.dirty=!1}commitLayer(e,t){const o=this._dirtyGeomRecords.get(e);o&&(o.forEach(((o,r)=>{const s=this._ensureGeomRecord(e,r);o.forEach((({geometry:e,operation:o,states:d},n)=>{let m=!1;if(o===i.UPDATE){const o=s.get(n);if(o){if(d&c.TRANSFORMATION){const t=this.model.getObject(r);this.model.updateRenderGeometryTransformation(t,e,o)&&(m=!0)}m||t.updates.push({renderGeometry:o,updateType:d})}else a(!1,"ModelDirtySet.commitLayer: invalid update")}if(o===i.REMOVE||m){const e=s.get(n);e?(t.removes.push(e),s.delete(n)):o===i.REMOVE&&a(!1,"ModelDirtySet.commitLayer: invalid remove")}if(o===i.ADD||m){const o=this.model.getObject(r);if(null!=o){const r=this.model.getRenderGeometry(o,e);t.adds.push(r),s.set(n,r)}}})),0===s.size&&this._residentGeomRecords.get(e).delete(r)})),0===this._residentGeomRecords.get(e).size&&this._residentGeomRecords.delete(e),this._dirtyGeomRecords.delete(e),this.dirty=this._hasDirtyGeometryRecords)}commitSyncUpdates(e,t){const o=this._dirtyGeomRecords.get(e);o&&o.forEach(((o,r)=>{const s=this._ensureGeomRecord(e,r);o.forEach((({geometry:e,operation:o,states:d,sync:n},m)=>{let y=!1;if(o===i.UPDATE&&n){const o=s.get(m);if(o){if(d&c.TRANSFORMATION){const t=this.model.getObject(r);this.model.updateRenderGeometryTransformation(t,e,o)&&(y=!0)}y||t.updates.push({renderGeometry:o,updateType:d})}else a(!1,"ModelDirtySet.commitSyncUpdates: invalid update")}}))}))}getResidentRenderGeometries(e,t){const o=this._residentGeomRecords.get(e);o&&o.forEach((e=>e.forEach((e=>t.push(e)))))}_objectStateChanged(e,t){for(const o of t.geometries)this._updateOrCreateDirtyRecord(t,o,null,i.UPDATE,e)}visibilityChanged(e){this._objectStateChanged(c.VISIBILITY,e)}highlightChanged(e){this._objectStateChanged(c.HIGHLIGHT,e)}occlusionChanged(e){this._objectStateChanged(c.OCCLUDEE,e)}objectGeometryUpdated({object:e,geometry:t,sync:o}){this._updateOrCreateDirtyRecord(e,t,null,i.UPDATE,c.GEOMETRY,o)}layerAdded(e){e.objects.forAll((t=>this._layerObjectAdded(e,t)))}layerRemoved(e){e.objects.forAll((t=>this._layerObjectRemoved(e,t)))}layerObjectAdded(e){this._layerObjectAdded(e.layer,e.object)}_layerObjectAdded(e,t){const o=e.id;for(const r of t.geometries)this._objectGeometryAdded(t,r,o)}layerObjectRemoved(e){this._layerObjectRemoved(e.layer,e.object)}layerObjectsAdded(e){for(const t of e.objects)this._layerObjectAdded(e.layer,t)}layerObjectsRemoved(e){for(const t of e.objects)this._layerObjectRemoved(e.layer,t)}_layerObjectRemoved(e,t){const o=e.id;for(const r of t.geometries)this._objectGeometryRemoved(t,r,o)}objectTransformation(e){const t=this._getParentLayerId(e),o=e.id;this._ensureGeomRecord(t,o).forEach((o=>{this._updateOrCreateDirtyRecord(e,o.geometry,t,i.UPDATE,c.TRANSFORMATION)}))}objectShaderTransformation(e){const t=this._getParentLayerId(e),o=e.id;this._ensureGeomRecord(t,o).forEach((t=>{t.objectShaderTransformationChanged(e.shaderTransformation)}))}objectGeometryAdded(e){this._objectGeometryAdded(e.object,e.geometry)}_objectGeometryAdded(e,t,o=null){this._updateOrCreateDirtyRecord(e,t,o,i.ADD)}objectGeometryRemoved(e){this._objectGeometryRemoved(e.object,e.geometry)}_objectGeometryRemoved(e,t,o=null){this._updateOrCreateDirtyRecord(e,t,o,i.REMOVE)}_updateOrCreateDirtyRecord(e,t,o,r,s=c.NONE,d=!1){o=o??this._getParentLayerId(e);const m=e.id,y=t.id,h=this._ensureDirtyRecord(o,m),l=h.get(y);if(l){const e=l.operation;e===i.REMOVE&&r===i.ADD&&l.states!==c.NONE?l.operation=i.UPDATE:e===i.REMOVE&&r===i.ADD||e===i.ADD&&r===i.REMOVE?h.delete(y):e!==i.UPDATE||r!==i.REMOVE&&r!==i.UPDATE?(a((e===i.REMOVE||e===i.ADD)&&r===i.UPDATE,"ModelDirtySet.objectGeometryAdded: inconsistent state"),l.states|=s):(l.operation=r,l.states|=s),l.sync=l.sync||d}else h.set(y,new n(r,t,s,d));this.dirty=this._hasDirtyGeometryRecords}_ensureGeomRecord(e,t){let o=this._residentGeomRecords.get(e);o||(o=new Map,this._residentGeomRecords.set(e,o));let r=o.get(t);return r||(r=new Map,o.set(t,r)),r}get _hasDirtyGeometryRecords(){return o(this._dirtyGeomRecords,(e=>o(e,(e=>e&&e.size>0))))}_ensureDirtyRecord(e,t){let o=this._dirtyGeomRecords.get(e);o||(o=new Map,this._dirtyGeomRecords.set(e,o));let r=o.get(t);return r||(r=new Map,o.set(t,r)),r}_getParentLayerId(e){return e.parentLayer?e.parentLayer.id:r}formatDebugInfo(){const e=["ADD","UPD",void 0,"REM"];let t="";return this._dirtyGeomRecords.forEach(((o,r)=>{o.forEach(((o,s)=>{t.length>0&&(t+="\n"),t+=r+"."+s;const d=[];o.forEach((e=>{const t=e.operation;d[t]||(d[t]=[]),d[t].push(e.geometry.id)}));for(let r=0;r<d.length;r++)if(d[r]){t+=" "+e[r-1]+": ";for(let e=0;e<d[r].length;e++)t+=d[r][e]+", "}}))})),t}get test(){const e=this;return{get residentLayerCount(){return e._residentGeomRecords.size},get residentObjectCount(){return Array.from(e._residentGeomRecords.values()).reduce(((e,t)=>e+t.size),0)},commit:t=>e._dirtyGeomRecords.forEach(((o,r)=>e.commitLayer(r,t)))}}};e([s({constructOnly:!0})],m.prototype,"model",void 0),e([s()],m.prototype,"dirty",void 0),m=e([d("esri.views.3d.webgl-engine.lib.ModelDirtySet")],m);const y=m;export{y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{h as t,m as e,y as i}from"../../../../chunks/mat4.js";import{I as s,a as o}from"../../../../chunks/mat4f64.js";import{p as r,e as n,o as a,s as h,g as m,h as c,c as l}from"../../../../chunks/vec3.js";import{f as d,c as u}from"../../../../chunks/vec3f64.js";import{c as
|
|
5
|
+
import{h as t,m as e,y as i}from"../../../../chunks/mat4.js";import{I as s,a as o}from"../../../../chunks/mat4f64.js";import{p as r,e as n,o as a,s as h,g as m,h as c,c as l}from"../../../../chunks/vec3.js";import{f as d,c as u}from"../../../../chunks/vec3f64.js";import{c as f}from"../../../../chunks/sphere.js";import{maxScale as g}from"../../support/mathUtils.js";import{Object3DState as b}from"./basicInterfaces.js";import{ContentObject as _}from"./ContentObject.js";import{ContentObjectType as p}from"./ContentObjectType.js";import{Object3DStateID as v}from"./Object3DStateID.js";import{assert as j}from"./Util.js";import{VertexAttribute as y}from"./VertexAttribute.js";import{addObject3DStateID as S,removeObject3DStateID as x}from"../materials/renderers/utils.js";class O extends _{get geometries(){return this._geometries}get transformation(){return this._transformation??s}set transformation(e){this._transformation=t(this._transformation??o(),e),this._invalidateBoundingVolume(),this._emit("objectTransformation",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?t(this._shaderTransformation??o(),e):null,this._invalidateBoundingVolume(),this._emit("objectShaderTransformation",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}constructor(t={}){super(),this.type=p.Object,this._shaderTransformation=null,this._parentLayer=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerUid=t.layerUid,t.isElevationSource&&(this.lastValidElevationBB=new V),this._geometries=t.geometries?Array.from(t.geometries):new Array}dispose(){this._geometries.length=0}get parentLayer(){return this._parentLayer}set parentLayer(t){j(null==this._parentLayer||null==t,"Object3D can only be added to a single Layer"),this._parentLayer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t),this._emit("objectGeometryAdded",{object:this,geometry:t}),this._invalidateBoundingVolume()}removeGeometry(t){const e=this._geometries.splice(t,1)[0];e&&(this._emit("objectGeometryRemoved",{object:this,geometry:e}),this._invalidateBoundingVolume())}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,e,i=!1){if(this._emit("objectGeometryUpdated",{object:this,geometry:t,attribute:e,sync:i}),e===y.POSITION)this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new v(b.MaskOccludee);for(const e of this._geometries)e.occludees=S(e.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const e of this._geometries)e.occludees=x(e.occludees,t);this._emit("occlusionChanged",this)}highlight(){const t=new v(b.Highlight);for(const e of this._geometries)e.highlights=S(e.highlights,t);return this._emit("highlightChanged",this),t}removeHighlight(t){for(const e of this._geometries)e.highlights=x(e.highlights,t);this._emit("highlightChanged",this)}getCombinedStaticTransformation(t,i){return e(i,this.transformation,t.transformation)}getCombinedShaderTransformation(t,i=o()){return e(i,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new T,this._validateBoundingVolume(this._bvWorldSpace,C.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new T,this._validateBoundingVolume(this._bvObjectSpace,C.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(t,e){const i=e===C.ObjectSpace;for(const s of this._geometries){const e=s.boundingInfo;e&&A(e,t,i?s.transformation:this.getCombinedShaderTransformation(s))}r(t.bounds,t.min,t.max,.5);for(const s of this._geometries){const e=s.boundingInfo;if(null==e)continue;const o=i?s.transformation:this.getCombinedShaderTransformation(s),r=g(o);n(B,e.center,o);const h=a(B,t.bounds),m=e.radius*r;t.bounds[3]=Math.max(t.bounds[3],h+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&t&&this._parentLayer.notifyObjectBBChanged(this,t)}_emit(t,e){this._parentLayer&&this._parentLayer.events.emit(t,e)}get test(){const t=this;return{hasGeometry:e=>t._geometries.includes(e),getGeometryIndex:e=>t._geometries.indexOf(e)}}}class V{constructor(){this.min=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]<this.min[0]&&this.max[1]<this.min[1]&&this.max[2]<this.min[2]}}class T extends V{constructor(){super(...arguments),this.bounds=f()}}function A(t,e,s){const o=t.bbMin,r=t.bbMax;if(i(s)){const t=h(M,s[12],s[13],s[14]);m(L,o,t),m(U,r,t);for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],L[i]),e.max[i]=Math.max(e.max[i],U[i])}else if(n(L,o,s),c(o,r))for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],L[i]),e.max[i]=Math.max(e.max[i],L[i]);else{n(U,r,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],L[t],U[t]),e.max[t]=Math.max(e.max[t],L[t],U[t]);for(let t=0;t<3;++t){l(L,o),l(U,r),L[t]=r[t],U[t]=o[t],n(L,L,s),n(U,U,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],L[t],U[t]),e.max[t]=Math.max(e.max[t],L[t],U[t])}}}const M=u(),L=u(),U=u(),B=u();var C;!function(t){t[t.WorldSpace=0]="WorldSpace",t[t.ObjectSpace=1]="ObjectSpace"}(C||(C={}));export{O as Object3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var A;!function(A){A[A.INTEGRATED_MESH=0]="INTEGRATED_MESH",A[A.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",A[A.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",A[A.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",A[A.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",A[A.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",A[A.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",A[A.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",A[A.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",A[A.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",A[A.ANTIALIASING=10]="ANTIALIASING",A[A.
|
|
5
|
+
var A;!function(A){A[A.INTEGRATED_MESH=0]="INTEGRATED_MESH",A[A.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",A[A.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",A[A.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",A[A.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",A[A.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",A[A.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",A[A.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",A[A.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",A[A.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",A[A.ANTIALIASING=10]="ANTIALIASING",A[A.BLIT=11]="BLIT",A[A.SSAO=12]="SSAO",A[A.HIGHLIGHT=13]="HIGHLIGHT",A[A.SHADOW_HIGHLIGHT=14]="SHADOW_HIGHLIGHT",A[A.ENVIRONMENT_OPAQUE=15]="ENVIRONMENT_OPAQUE",A[A.ENVIRONMENT_TRANSPARENT=16]="ENVIRONMENT_TRANSPARENT",A[A.LASERLINES=17]="LASERLINES",A[A.LASERLINES_CONTRAST_CONTROL=18]="LASERLINES_CONTRAST_CONTROL",A[A.HUD_MATERIAL=19]="HUD_MATERIAL",A[A.LABEL_MATERIAL=20]="LABEL_MATERIAL",A[A.LINE_CALLOUTS=21]="LINE_CALLOUTS",A[A.LINE_CALLOUTS_HUD_DEPTH=22]="LINE_CALLOUTS_HUD_DEPTH",A[A.DRAPED_MATERIAL=23]="DRAPED_MATERIAL",A[A.DRAPED_WATER=24]="DRAPED_WATER",A[A.VOXEL=25]="VOXEL",A[A.MAX_SLOTS=26]="MAX_SLOTS"}(A||(A={}));export{A as RenderSlot};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import h from"../../../../core/PooledArray.js";import{watch as o,syncAndInitial as d,initial as l,sync as _}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as c,i as m,m as f}from"../../../../chunks/mat4.js";import{I as g,a as T}from"../../../../chunks/mat4f64.js";import{s as A}from"../../../../chunks/vec4.js";import{f as P,Z as R}from"../../../../chunks/vec4f64.js";import{a as E}from"../../../../chunks/boundedPlane.js";import{debugFlags as b}from"../../support/debugFlags.js";import{TransparencyMode as S}from"../../terrain/TerrainRenderer.js";import{FBOCache as I,ColorFormat as y,DepthFormat as C}from"../core/FBOCache.js";import{RenderPassManager as w}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as D}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{RenderPluginInput as N}from"../effects/RenderPluginInput.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{Highlight as L}from"../effects/highlight/Highlight.js";import{ShadowHighlight as H}from"../effects/highlight/ShadowHighlight.js";import{SMAA as x}from"../effects/smaa/SMAA.js";import{SSAO as F}from"../effects/ssao/SSAO.js";import{AnimationTimeStep as v}from"./AnimationTimeStep.js";import{Decorations as U,RenderRequestType as B,StencilBits as G}from"./basicInterfaces.js";import{BoundingInfo as j}from"./BoundingInfo.js";import{zero as q,union as V}from"./depthRange.js";import{depthRangeFromScene as Q}from"./depthRangeUtils.js";import{RenderOccludedFlag as W}from"./Material.js";import{OffscreenRendering as k}from"./OffscreenRendering.js";import{RenderContext as Y}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as X}from"./rendererUtils.js";import{setupFeatureDefaults as z,RenderFeature as J}from"./RenderFeature.js";import{RenderSlot as K}from"./RenderSlot.js";import{ShadowAccumulator as Z}from"./ShadowAccumulator.js";import{ShadowMap as $,SnapshotSlot as ee}from"./ShadowMap.js";import re from"./SliceHelper.js";import{TransparencyPassType as te}from"./TransparencyPassType.js";import{EdgeView as se}from"./edgeRendering/EdgeView.js";import{Transparency as ie}from"./edgeRendering/interfaces.js";import{MergedRenderer as ae}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ne}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as he,PerformanceCategory as oe}from"../statistics/RendererPerformanceInfo.js";import{RenderState as de}from"../../../support/RenderState.js";import{PixelFormat as le,PixelType as _e,ClearBufferBit as pe}from"../../../webgl/enums.js";import ue from"../../../../webscene/background/ColorBackground.js";let ce=class extends r{get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,r=!has("disable-feature:high-quality-idle")){this._renderStateFeatures=z(r,e),this.notifyChange("_renderStateFeatures"),this._renderPlugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(J.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(J.WaterReflection))}get hasDecorations(){return this._materialRenderersHas.decorations||this._renderPlugins.hasDecorations}get hasHighlights(){return this._materialRenderersHas.highlights||this._renderPlugins.produces(K.OPAQUE_MATERIAL,O.Highlight)||this._renderPlugins.produces(K.DRAPED_MATERIAL,O.Highlight)}get hasShadowHighlights(){return this._materialRenderersHas.highlights||this._renderPlugins.produces(K.OPAQUE_MATERIAL,O.ShadowHighlight)}get _magnifierEnabled(){return this._bindParameters.decorations===U.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(J.HighResolutionAtmosphere)}get hasWater(){return this._materialRenderersHas.water||this._hasOverlayWater}constructor(e,r,t,i,a,n,_,p){super({}),this._stage=e,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=_,this._requestRender=p,this._materialRenderers=new h,this._needsTransparentPass=!1,this._materialRenderersHas={hudElements:!1,highlights:!1,water:!1,decorations:!1,occludees:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._backgroundColor=P(0,0,0,1),this._sliceHelper=new re,this._state=de.IDLE,this._highQualityTransparencyEnabled=!0,this._terrainTransparency=S.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new v,this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new N,this.fboCache=new I(a),this._renderStateFeatures=z(!has("disable-feature:high-quality-idle"),e.view.qualityProfile),this._offscreen=new k(this.fboCache,this._compositingHelper),this.performanceInfo=new he(this._rctx),this._shadowMap=new $(this.fboCache,e.viewingMode),this._highlight=new L({view:e.view}),this._shadowHighlight=new H({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new Z(this.fboCache,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t,!0,this._stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(O.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),p),this._ssao=new F({view:this._stage.view}),this._renderContext=new Y(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._renderPlugins=new M({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:r,requestRender:p,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new w,this._renderPlugins.add(this.renderPassManager),this._smaa=new x({view:this._stage.view}),this._renderPlugins.add(this._smaa),this._renderPlugins.add(this._ssao),this._renderPlugins.add(this._highlight),this._renderPlugins.add(this._shadowHighlight),this.addHandles([o((()=>this._stage.view.state.camera),(()=>p()),d),o((()=>b.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ie.TRANSPARENT):()=>{},p()}),l),o((()=>this._stage.view.environment.background),(e=>{const r=e instanceof ue?s(e.color):R;A(this._backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3])}),d)])}normalizeCtorArgs(){return{}}destroy(){this._smaa.destroy(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreen.dispose(),this._shadowMap.dispose(),this._ssao.destroy(),this._highlight.dispose(),this._shadowHighlight.destroy(),this._shadowAccumulator.dispose(),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),j.prune()}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=n(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=n(this._bindParameters.multipassGeometry.linearDepth)}disposeOffscreenBuffers(){this._releaseFBOs(),this._disposeOffscreenBuffers()}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=n(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=n(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new se({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:Ee(e)}),this.addHandles(o((()=>this._edgeView?.updating),(()=>this._requestRender()),_)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return c(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=X(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._materialRenderers.find((e=>e.material===s));if(null==i&&t.adds.length>0){const e=new ae({material:s});e.initializeRenderContext(this._renderPlugins._context),i=e,this._materialRenderers.push(i)}i&&(i.modify(t),i.isEmpty&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._materialRenderersHas;has.decorations=!1,has.highlights=!1,has.hudElements=!1,has.water=!1,has.occludees=!1,this._materialRenderers.forAll((e=>{has.highlights||=e.hasHighlights,has.occludees||=e.hasOccludees,has.water||=e.hasWater,has.decorations||=e.isDecoration,has.hudElements||=e.material.produces(K.LINE_CALLOUTS_HUD_DEPTH,O.Color)||e.material.produces(K.HUD_MATERIAL,O.Color)||e.material.produces(K.LABEL_MATERIAL,O.Color)})),this._bindParameters.hasOccludees=has.occludees}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}render(e,r,t,s,i){this._isRendering=!0,this.performanceInfo.startFrame(),this._disposeBindBuffers(),this.fboCache.resetPeakMemoryUsage();const a=this._offscreen,{camera:h,contentCamera:o,mode:d,alignPixelEnabled:l}=t;this._state=d,this._bindParameters.overlay=this.renderOverlay(i),this.performanceInfo.advance(oe.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=te.NONE,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=s;const _=E(this._sliceHelper.plane);s===U.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e?.fbo),h.setGLViewport(this._rctx);const p=a.initializeFrame(h,this._backgroundColor);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.release(),this._prepare(h,o),this._renderPlugins.prepareRender(),this.performanceInfo.advance(oe.PREPARE);const u=this._computeDepthRange(h);this._renderShadowMap(e?.fbo,h,this._bindParameters.lighting.mainLight.direction,u),this.performanceInfo.advance(oe.SHADOW_MAP),this._ensureBindParameters(h,o);const c=this._renderPlugins.produces(K.OPAQUE_TERRAIN)&&(this._terrainTransparency===S.Semitransparent||this._terrainTransparency===S.TransparentWithDraped),m=this._highQualityTransparency&&c,f=this._needsTransparentPass||this._renderPlugins.produces(K.TRANSPARENT_MATERIAL);this._prepareShaders(m,f),this._renderLinearDepth(),this.performanceInfo.advance(oe.LINEAR_DEPTH),this._renderShadowAccumulation(u,h,o),this.performanceInfo.advance(oe.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(i),this._renderSSAO(),this.performanceInfo.advance(oe.SSAO),this._renderContext.output=O.Color,a.bindFbo(),this._renderOpaqueGeometry(),this._renderPlugins.render(K.ENVIRONMENT_OPAQUE),this.performanceInfo.advance(oe.OPAQUE),this._renderTerrainLinearDepth(m),this._setMultipassTerrain(m),this._renderEdges(ie.OPAQUE),this.performanceInfo.advance(oe.OPAQUE_EDGES),a.bindFbo(),this._renderPlugins.render(K.VOXEL),this.performanceInfo.advance(oe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(me.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(oe.TRANSPARENT);const g=this._renderGeometryLinearDepth(m);this._renderHUDVisibility(g),m||this._renderInternalSlot(K.LINE_CALLOUTS),this.performanceInfo.advance(oe.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(oe.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(ie.TRANSPARENT,g),g?.release(),this.performanceInfo.advance(oe.TRANSPARENT_EDGES);const T=c?this._renderTransparentTerrain():null;T&&this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(D.Occluded):a.compositeToHUDVisibility(this._bindParameters,T.colorTexture),this._renderHUD(D.Occluded,a.color),this.performanceInfo.advance(oe.HUD_OCCLUDED)),this.performanceInfo.advance(oe.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),T&&(a.compositeToFramebuffer(this._bindParameters,T.colorTexture,ne.PremultipliedAlpha,1),T.release(),m&&(this._renderEdges(ie.OPAQUE),this.performanceInfo.advance(oe.OPAQUE_EDGES),f&&(this._oitEnabled?this._renderOITPass(me.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(oe.TRANSPARENT),this._renderEdges(ie.TRANSPARENT),this.performanceInfo.advance(oe.TRANSPARENT_EDGES))),this._bindParameters.ssao=n(this._bindParameters.ssao),m&&this._renderLineCallouts(D.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),a.bindFbo(),this._renderInternalSlot(K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderPlugins.render(K.ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(oe.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(oe.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(oe.OCCLUDED);const A=this._renderAntialiasing(e),P=A??e;this.performanceInfo.advance(oe.ANTIALIASING),this._renderHUD(D.NotOccluded,P),this.performanceInfo.advance(oe.HUD),this._renderHighlights(P,this._bindParameters),this.performanceInfo.advance(oe.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),P!==e&&(this._rctx.bindFramebuffer(e?.fbo),this._compositingHelper.composite(this._bindParameters,A?.colorTexture,ne.None)),A?.release(),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=_,this._isRendering=!1,this.performanceInfo.finishFrame()}_prepareShaders(e,r){this._renderContext.output=O.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._renderPlugins.prepare(K.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,K.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderPlugins.prepare(K.ENVIRONMENT_TRANSPARENT),this._renderPlugins.prepare(K.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null==e||!has("enable-feature:objectAndLayerId-rendering"))return;const r=this._renderContext.output;this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO((()=>this._renderAllGeometry(O.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO((()=>{this._bindParameters.hudRenderStyle=D.NotOccluded,this._renderInternalSlot(K.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===B.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._bindParameters.linearDepth?.fbo;if(s?.colorTexture)return void s.readPixels(r[0],r[1],r[2],r[3],le.RGBA,_e.UNSIGNED_BYTE,t);const i=this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height).acquireDepth(C.DEPTH16_BUFFER);this._rctx.bindFramebuffer(i.fbo),this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const a=pe.COLOR_BUFFER_BIT|pe.DEPTH_BUFFER_BIT|pe.STENCIL_BUFFER_BIT;this._rctx.clearSafe(a),this._renderAllGeometry(O.Depth),i.fbo.readPixels(r[0],r[1],r[2],r[3],le.RGBA,_e.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,r,t,s,i){this._bindParameters.hudVisibility?.fbo.readPixels(e,r,t,s,le.RGBA,_e.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e,r){const t=this._edgeView;if(t?.shouldRender()){const{width:s,height:i,depth:a}=this._offscreen,n=this.fboCache.acquire(y.RGBA,s,i),h=()=>t.render(this._bindParameters,e);this._offscreen.renderToTargets(h,n,r??a,ge),this._offscreen.compositeToFramebuffer(this._bindParameters,n.colorTexture,ne.Alpha,1),n.release()}}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s,this.isFeatureEnabled(J.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(O.ShadowHighlight,this._shadowMap),i.moveSnapshot(ee.Highlight),i.clear(),this._renderShadowCascades(O.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(ee.Default),this._renderShadowCascades(O.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(O.Shadow),i.finish(),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap){for(const t of r.cascades)t.camera.setGLViewport(this._rctx),this._prepare(t.camera,t.camera),this._renderAllGeometry(e)}get _needsLinearDepth(){return this._renderPlugins.consumes(O.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,(()=>this._renderAllGeometry(O.Depth)),[0,0,0,0],y.RGBA,C.DEPTH24_BUFFER),this._bindParameters.linearDepth.releaseDepth(),this._offscreen.bindFbo()):this._bindParameters.linearDepth=n(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=O.Depth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,(()=>this._renderTransparentTerrain()),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.releaseDepth(),this._renderContext.output=e}else this._bindParameters.multipassTerrain.linearDepth=n(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=n(this._bindParameters.multipassGeometry.linearDepth));const r=this._renderContext.output;return this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,(()=>this._renderOpaqueGeometryAndTransparentMaterial(O.Depth)),[1,1,1,1]),this._renderContext.output=r,this._bindParameters.multipassGeometry.linearDepth.detachDepth()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return q;const r=Q(e,this._materialRenderers,this._stage.layers);return V(r,this._renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderAllGeometry(e){this._renderContext.output=e,this._renderPlugins.prepare(K.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._renderPlugins.prepare(K.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderSSAO(){if(!this._renderPlugins.produces(K.SSAO))return;const e=this._offscreen.renderToCachedFBO(null,(()=>this._renderAllGeometry(O.Normal)),[0,0,0,0],y.RGBA4,C.DEPTH24_BUFFER);e.releaseDepth(),this._offscreen.bindFbo(),this._pluginInput.normalTexture=e.colorTexture,this._bindParameters.ssao=this._renderPlugins.render(K.SSAO,this._pluginInput),e.release()}_prepareOpaqueGeometrySlots(){this._renderPlugins.prepare(K.INTEGRATED_MESH),this._renderPlugins.prepare(K.OPAQUE_TERRAIN),this._renderPlugins.prepare(K.OPAQUE_MATERIAL),this._renderPlugins.prepare(K.ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,K.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderPlugins.render(K.INTEGRATED_MESH),this._renderPlugins.render(K.OPAQUE_TERRAIN),this._renderInternalSlot(K.OPAQUE_MATERIAL),this._renderPlugins.render(K.OPAQUE_MATERIAL)}_renderTransparentMaterial(){this._renderInternalSlot(K.TRANSPARENT_MATERIAL),this._renderPlugins.render(K.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){if(!this._renderPlugins.produces(K.TRANSPARENT_TERRAIN))return;const e=()=>this._renderPlugins.render(K.TRANSPARENT_TERRAIN,null);if(this._renderContext.output!==O.Color)return void e();const{width:r,height:t,depth:s}=this._offscreen,i=this.fboCache.acquire(y.RGBA,r,t);return this._offscreen.renderToTargets(e,i,s,[0,0,0,0]),i}_renderHUDVisibility(e){this._shouldRenderInternalSlot(this._materialRenderers,K.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._renderInternalSlot(K.OCCLUSION_PIXELS)),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=n(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===D.Occluded){const e=()=>this._renderInternalSlot(K.LINE_CALLOUTS),{width:r,height:t,color:s}=this._offscreen,i=this.fboCache.acquireDepth(C.DEPTH16_BUFFER,r,t);this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._renderInternalSlot(K.LINE_CALLOUTS)}_renderLaserlines(){if(this._renderPlugins.render(K.LASERLINES),this._renderPlugins.produces(K.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:r,height:t,depth:s}=e,i=this.fboCache.acquire(y.RGBA,r,t),a=()=>this._renderPlugins.render(K.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,ge),e.compositeToFramebuffer(this._bindParameters,i.colorTexture,ne.PremultipliedAlpha,1),i.release()}}_renderHUD(e,r){if(this._materialRenderersHas.hudElements)if(this._oitEnabled){const t=this._renderOITPass(me.HUD,e);this._rctx.bindFramebuffer(r?.fbo),this._compositingHelper.composite(this._bindParameters,t.colorTexture,ne.PremultipliedAlpha),t.release()}else if(e===D.Occluded){const r=()=>this._renderHUDElements(e),{width:t,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(C.DEPTH16_BUFFER,t,s);this._offscreen.renderToTargets(r,i,a,void 0,!0,!0),a.release()}else this._renderHUDElements(e)}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._prepareInternalSlots(this._materialRenderers,K.LINE_CALLOUTS_HUD_DEPTH,K.HUD_MATERIAL,K.LABEL_MATERIAL),this._renderInternalSlot(K.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(K.HUD_MATERIAL),this._renderInternalSlot(K.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._renderPlugins.produces(K.SHADOW_HIGHLIGHT)&&this.hasShadowHighlights}_renderHighlights(e,r){if(!this.hasHighlights||r.decorations===U.OFF)return;const t=()=>{this._renderAllGeometry(O.Highlight),this._rctx.clearSafe(pe.DEPTH_BUFFER_BIT),this._renderHUDElements(D.Both)},s=this._offscreen.renderToCachedFBO(null,t,[0,0,0,0],y.RGBA4,C.DEPTH_STENCIL_TEXTURE);this._needsShadowHighlight&&(this._pluginInput.highlightTexture=s.fbo.colorTexture,this._renderPlugins.render(K.SHADOW_HIGHLIGHT,this._pluginInput,e)),s.releaseDepth(),this._renderPlugins.produces(K.HIGHLIGHT)&&(this._pluginInput.compositeTexture=null,this._pluginInput.normalTexture=null,this._pluginInput.highlightTexture=s.fbo.colorTexture,this._renderPlugins.render(K.HIGHLIGHT,this._pluginInput,e)),s.release()}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,r,t){this._needsShadowCast&&this._bindParameters.linearDepth?.colorTexture&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=O.Alpha,this._bindParameters.transparencyPassType=te.Alpha,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(K.TRANSPARENT_MATERIAL),this._renderContext.output=O.Color,this._bindParameters.transparencyPassType=te.Color,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(K.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=te.FrontFace,this._prepareInternalSlots(this._materialRenderers,K.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(K.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=te.NONE}_renderOITPass(e,r=D.Both){const t=e===me.HUD,s=t?this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height):null,i=t?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=O.Alpha,this._bindParameters.transparencyPassType=te.Alpha;const n=this._offscreen.renderOITPass(i,te.Alpha,t);this._renderContext.output=O.Color,this._bindParameters.transparencyPassType=te.Color;const h=this._offscreen.renderOITPass(i,te.Color,t);this._bindParameters.transparencyPassType=te.FrontFace;const o=this._offscreen.renderOITPass(i,te.FrontFace,t);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,h,n,o,s),s?.releaseDepth(),o.release(),h.release(),n.release(),this._bindParameters.transparencyPassType=te.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;Te.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&r.material.parameters.renderOccluded===W.OccludeAndTransparentStencil&&(e|=r.material.parameters.renderOccluded,Te.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{if(0==(e&s))return;const{width:h,height:o,depth:d}=r,l=this.fboCache.acquire(y.RGBA,h,o);r.renderToTargets(i,l,d,[0,0,0,0],a,n),r.compositeToFramebuffer(this._bindParameters,l.colorTexture,ne.PremultipliedAlpha,t),l.release()};0!==Te.length&&(this._prepareInternalSlots(Te,K.OCCLUDER_MATERIAL,K.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(K.OCCLUDER_MATERIAL,Te),t(.5,W.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(K.TRANSPARENT_OCCLUDER_MATERIAL,Te)),!1,!1)),Te.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&(r.material.parameters.renderOccluded===W.OccludeAndTransparent||r.material.parameters.renderOccluded===W.Transparent||r.material.parameters.renderOccluded===W.Opaque)&&(e|=r.material.parameters.renderOccluded,Te.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,this._prepareInternalSlots(Te,K.OPAQUE_MATERIAL,K.TRANSPARENT_MATERIAL,K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),s>W.Occlude&&this._renderPlugins.render(K.OCCLUDED_TERRAIN),this._renderInternalSlot(K.OPAQUE_MATERIAL,Te),this._renderInternalSlot(K.TRANSPARENT_MATERIAL,Te),this._renderInternalSlot(K.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Te),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=O.Color,t(.5,W.OccludeAndTransparent,(()=>i(W.OccludeAndTransparent)),!0,G.OutlineVisualElementMask),t(.5,W.Transparent,(()=>i(W.Transparent)),!0,G.OutlineVisualElementMask),t(1,W.Opaque,(()=>i(W.Opaque)),!0,G.OutlineVisualElementMask),Te.clear()}_renderAntialiasing(e){const r=this._magnifierEnabled&&null==e?this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height).acquireDepth(C.DEPTH16_BUFFER):null,t=this._offscreen.colorTexture;return this._renderPlugins.produces(K.ANTIALIASING)?(this._pluginInput.compositeTexture=this._offscreen.colorTexture,this._pluginInput.normalTexture=null,this._pluginInput.highlightTexture=null,this._renderPlugins.render(K.ANTIALIASING,this._pluginInput,r??e)):(null!=t&&(this._rctx.bindFramebuffer(r?.fbo??e?.fbo),this._compositingHelper.composite(this._bindParameters,t,ne.None)),r)}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.material.produces(K.TRANSPARENT_MATERIAL,O.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.mainColor=t.colorTexture,this._bindParameters.mainDepth=t.depthTexture}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(m(Pe,this._bindParameters.camera.viewMatrix),m(Ae,this._bindParameters.camera.projectionMatrix),f(Re,Pe,Ae),f(Re,this._renderContext.lastFrameCamera.viewMatrix,Re),f(Re,this._renderContext.lastFrameCamera.projectionMatrix,Re),this._reprojectionMatrix=Re);const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._ssrEnableTime=null}_shouldRenderInternalSlot(e,r){return this._bindParameters.slot=r,e.some((e=>null!=e.prepareTechnique(this._renderContext)))}_prepareInternalSlots(e,...r){for(const t of r)this._bindParameters.slot=t,e.forAll((e=>null!=e.prepareTechnique(this._renderContext)))}_renderInternalSlot(e,r=this._materialRenderers){this._bindParameters.slot=e,r.forAll((e=>{const r=e.prepareTechnique(this._renderContext);r&&e.renderNode(this._renderContext,r)}))}get memoryInfo(){return{fbos:this.fboCache.peakMemoryUsage,vaos:this._materialRenderers.reduce(((e,r)=>e+r.usedMemory),0),plugins:this._renderPlugins.usedMemory}}getMemoryForMaterial(e){if(null==e)return 0;const r=this._materialRenderers.find((r=>r.material===e));return r?.usedMemory??0}get usedMemory(){return this.fboCache.peakMemoryUsage+(this.edgeView?.usedMemory??0)+this._renderPlugins.usedMemory}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=z(),this._renderPlugins.renderFeatureChanged(),this._requestRender()},getFramebufferTexture:r=>{switch(r){case fe.Color:return e._offscreen.colorTexture;case fe.LinearDepth:return e._bindParameters.linearDepth?.colorTexture;case fe.ShadowMap:return e._shadowMap.depthTexture;case fe.HudVisibility:return e._bindParameters.hudVisibility?.colorTexture}}}}};var me,fe;e([p()],ce.prototype,"_renderPlugins",void 0),e([p()],ce.prototype,"_shadowAccumulator",void 0),e([p()],ce.prototype,"_state",void 0),e([p()],ce.prototype,"_renderStateFeatures",void 0),e([p({readOnly:!0})],ce.prototype,"fullResolutionAtmosphere",null),e([p()],ce.prototype,"_smaa",void 0),e([p({autoDestroy:!0})],ce.prototype,"_edgeView",void 0),e([p()],ce.prototype,"updating",null),e([p()],ce.prototype,"isCameraFinal",null),ce=e([u("esri.views.3d.webgl-engine.lib.Renderer")],ce),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(me||(me={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility"}(fe||(fe={}));const ge=[0,0,0,0],Te=new h,Ae=T(),Pe=T(),Re=T();function Ee(e){return r=>e.immediate.schedule(r)}export{fe as FramebufferId,ce as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import h from"../../../../core/PooledArray.js";import{watch as o,syncAndInitial as d,initial as l,sync as _}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as c,i as m,m as f}from"../../../../chunks/mat4.js";import{I as g,a as T}from"../../../../chunks/mat4f64.js";import{s as A}from"../../../../chunks/vec4.js";import{f as P,Z as R}from"../../../../chunks/vec4f64.js";import{a as E}from"../../../../chunks/boundedPlane.js";import{debugFlags as b}from"../../support/debugFlags.js";import{TransparencyMode as S}from"../../terrain/TerrainRenderer.js";import{FBOCache as I,ColorFormat as y,DepthFormat as w}from"../core/FBOCache.js";import{RenderPassManager as C}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as D}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{RenderPluginInput as N}from"../effects/RenderPluginInput.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{Blit as L}from"../effects/blit/Blit.js";import{Highlight as H}from"../effects/highlight/Highlight.js";import{ShadowHighlight as x}from"../effects/highlight/ShadowHighlight.js";import{SMAA as F}from"../effects/smaa/SMAA.js";import{SSAO as v}from"../effects/ssao/SSAO.js";import{AnimationTimeStep as U}from"./AnimationTimeStep.js";import{Decorations as B,RenderRequestType as G,StencilBits as j}from"./basicInterfaces.js";import{BoundingInfo as q}from"./BoundingInfo.js";import{zero as V,union as Q}from"./depthRange.js";import{depthRangeFromScene as W}from"./depthRangeUtils.js";import{RenderOccludedFlag as k}from"./Material.js";import{OffscreenRendering as Y}from"./OffscreenRendering.js";import{RenderContext as X}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as z}from"./rendererUtils.js";import{setupFeatureDefaults as J,RenderFeature as K}from"./RenderFeature.js";import{RenderSlot as Z}from"./RenderSlot.js";import{ShadowAccumulator as $}from"./ShadowAccumulator.js";import{ShadowMap as ee,SnapshotSlot as re}from"./ShadowMap.js";import te from"./SliceHelper.js";import{TransparencyPassType as se}from"./TransparencyPassType.js";import{EdgeView as ie}from"./edgeRendering/EdgeView.js";import{Transparency as ae}from"./edgeRendering/interfaces.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as he}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{RenderState as le}from"../../../support/RenderState.js";import{PixelFormat as _e,PixelType as pe,ClearBufferBit as ue}from"../../../webgl/enums.js";import ce from"../../../../webscene/background/ColorBackground.js";let me=class extends r{get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,r=!has("disable-feature:high-quality-idle")){this._renderStateFeatures=J(r,e),this.notifyChange("_renderStateFeatures"),this._renderPlugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(K.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(K.WaterReflection))}get hasDecorations(){return this._materialRenderersHas.decorations||this._renderPlugins.hasDecorations}get hasHighlights(){return this._materialRenderersHas.highlights||this._renderPlugins.produces(Z.OPAQUE_MATERIAL,O.Highlight)||this._renderPlugins.produces(Z.DRAPED_MATERIAL,O.Highlight)}get hasShadowHighlights(){return this._materialRenderersHas.highlights||this._renderPlugins.produces(Z.OPAQUE_MATERIAL,O.ShadowHighlight)}get _magnifierEnabled(){return this._bindParameters.decorations===B.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(K.HighResolutionAtmosphere)}get hasWater(){return this._materialRenderersHas.water||this._hasOverlayWater}constructor(e,r,t,i,a,n,_,p){super({}),this._stage=e,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=_,this._requestRender=p,this._materialRenderers=new h,this._needsTransparentPass=!1,this._materialRenderersHas={hudElements:!1,highlights:!1,water:!1,decorations:!1,occludees:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._backgroundColor=P(0,0,0,1),this._sliceHelper=new te,this._state=le.IDLE,this._highQualityTransparencyEnabled=!0,this._terrainTransparency=S.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new U,this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new N,this.fboCache=new I(a),this._renderStateFeatures=J(!has("disable-feature:high-quality-idle"),e.view.qualityProfile),this._offscreen=new Y(this.fboCache,this._compositingHelper),this.performanceInfo=new oe(this._rctx),this._shadowMap=new ee(this.fboCache,e.viewingMode),this._highlight=new H({view:e.view}),this._shadowHighlight=new x({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new $(this.fboCache,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t,!0,this._stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(O.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),p),this._ssao=new v({view:this._stage.view}),this._renderContext=new X(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._renderPlugins=new M({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:r,requestRender:p,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new C,this._renderPlugins.add(this.renderPassManager),this._smaa=new F({view:this._stage.view}),this._renderPlugins.add(this._smaa),this._blit=new L({opacity:1,alphaMode:he.None}),this._renderPlugins.add(this._blit),this._renderPlugins.add(this._ssao),this._renderPlugins.add(this._highlight),this._renderPlugins.add(this._shadowHighlight),this.addHandles([o((()=>this._stage.view.state.camera),(()=>p()),d),o((()=>b.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ae.TRANSPARENT):()=>{},p()}),l),o((()=>this._stage.view.environment.background),(e=>{const r=e instanceof ce?s(e.color):R;A(this._backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3])}),d)])}normalizeCtorArgs(){return{}}destroy(){this._smaa.destroy(),this._blit.destroy(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreen.dispose(),this._shadowMap.dispose(),this._ssao.destroy(),this._highlight.dispose(),this._shadowHighlight.destroy(),this._shadowAccumulator.dispose(),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),q.prune()}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=n(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=n(this._bindParameters.multipassGeometry.linearDepth)}disposeOffscreenBuffers(){this._releaseFBOs(),this._disposeOffscreenBuffers()}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=n(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=n(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new ie({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:be(e)}),this.addHandles(o((()=>this._edgeView?.updating),(()=>this._requestRender()),_)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return c(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=z(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._materialRenderers.find((e=>e.material===s));if(null==i&&t.adds.length>0){const e=new ne({material:s});e.initializeRenderContext(this._renderPlugins._context),i=e,this._materialRenderers.push(i)}i&&(i.modify(t),i.isEmpty&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._materialRenderersHas;has.decorations=!1,has.highlights=!1,has.hudElements=!1,has.water=!1,has.occludees=!1,this._materialRenderers.forAll((e=>{has.highlights||=e.hasHighlights,has.occludees||=e.hasOccludees,has.water||=e.hasWater,has.decorations||=e.isDecoration,has.hudElements||=e.material.produces(Z.LINE_CALLOUTS_HUD_DEPTH,O.Color)||e.material.produces(Z.HUD_MATERIAL,O.Color)||e.material.produces(Z.LABEL_MATERIAL,O.Color)})),this._bindParameters.hasOccludees=has.occludees}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}render(e,r,t,s,i){this._isRendering=!0,this.performanceInfo.startFrame(),this._disposeBindBuffers(),this.fboCache.resetPeakMemoryUsage();const a=this._offscreen,{camera:h,contentCamera:o,mode:d,alignPixelEnabled:l}=t;this._state=d,this._bindParameters.overlay=this.renderOverlay(i),this.performanceInfo.advance(de.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=se.NONE,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=s;const _=E(this._sliceHelper.plane);s===B.OFF&&(this._sliceHelper.plane=null),h.setGLViewport(this._rctx);const p=a.initializeFrame(h,this._backgroundColor);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.release(),this._prepare(h,o),this._renderPlugins.prepareRender(),this.performanceInfo.advance(de.PREPARE);const u=this._computeDepthRange(h);this._renderShadowMap(h,this._bindParameters.lighting.mainLight.direction,u),this.performanceInfo.advance(de.SHADOW_MAP),this._ensureBindParameters(h,o);const c=this._renderPlugins.produces(Z.OPAQUE_TERRAIN)&&(this._terrainTransparency===S.Semitransparent||this._terrainTransparency===S.TransparentWithDraped),m=this._highQualityTransparency&&c,f=this._needsTransparentPass||this._renderPlugins.produces(Z.TRANSPARENT_MATERIAL);this._prepareShaders(m,f),this._renderLinearDepth(),this.performanceInfo.advance(de.LINEAR_DEPTH),this._renderShadowAccumulation(u,h,o),this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(i),this._renderSSAO(),this.performanceInfo.advance(de.SSAO),this._renderContext.output=O.Color,a.bindFbo(),this._renderOpaqueGeometry(),this._renderPlugins.render(Z.ENVIRONMENT_OPAQUE),this.performanceInfo.advance(de.OPAQUE),this._renderTerrainLinearDepth(m),this._setMultipassTerrain(m),this._renderEdges(ae.OPAQUE),this.performanceInfo.advance(de.OPAQUE_EDGES),a.bindFbo(),this._renderPlugins.render(Z.VOXEL),this.performanceInfo.advance(de.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(fe.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(de.TRANSPARENT);const g=this._renderGeometryLinearDepth(m);this._renderHUDVisibility(g),m||this._renderInternalSlot(Z.LINE_CALLOUTS),this.performanceInfo.advance(de.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(ae.TRANSPARENT,g),g?.release(),this.performanceInfo.advance(de.TRANSPARENT_EDGES);const T=c?this._renderTransparentTerrain():null;T&&this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(D.Occluded):a.compositeToHUDVisibility(this._bindParameters,T.colorTexture),this._renderHUD(D.Occluded,a.color),this.performanceInfo.advance(de.HUD_OCCLUDED)),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),T&&(a.compositeToFramebuffer(this._bindParameters,T.colorTexture,he.PremultipliedAlpha,1),T.release(),m&&(this._renderEdges(ae.OPAQUE),this.performanceInfo.advance(de.OPAQUE_EDGES),f&&(this._oitEnabled?this._renderOITPass(fe.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(de.TRANSPARENT),this._renderEdges(ae.TRANSPARENT),this.performanceInfo.advance(de.TRANSPARENT_EDGES))),this._bindParameters.ssao=n(this._bindParameters.ssao),m&&this._renderLineCallouts(D.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),a.bindFbo(),this._renderInternalSlot(Z.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderPlugins.render(Z.ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(de.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(de.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(de.OCCLUDED);const A=this._magnifierEnabled&&null==e?this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height).acquireDepth(w.DEPTH16_BUFFER):null,P=this._renderAntialiasing(A??e,this._offscreen.color),R=P??e;this.performanceInfo.advance(de.ANTIALIASING),this._renderHUD(D.NotOccluded,R),this.performanceInfo.advance(de.HUD),this._renderHighlights(R,this._bindParameters),this.performanceInfo.advance(de.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),R!==e&&(this._rctx.bindFramebuffer(e?.fbo),this._compositingHelper.composite(this._bindParameters,P?.colorTexture,he.None)),A!==e&&A?.release(),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=_,this._isRendering=!1,this.performanceInfo.finishFrame()}_prepareShaders(e,r){this._renderContext.output=O.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._renderPlugins.prepare(Z.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,Z.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,Z.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderPlugins.prepare(Z.ENVIRONMENT_TRANSPARENT),this._renderPlugins.prepare(Z.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null==e||!has("enable-feature:objectAndLayerId-rendering"))return;const r=this._renderContext.output;this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO((()=>this._renderAllGeometry(O.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO((()=>{this._bindParameters.hudRenderStyle=D.NotOccluded,this._renderInternalSlot(Z.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===G.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._bindParameters.linearDepth?.fbo;if(s?.colorTexture)return void s.readPixels(r[0],r[1],r[2],r[3],_e.RGBA,pe.UNSIGNED_BYTE,t);const i=this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height).acquireDepth(w.DEPTH16_BUFFER);this._rctx.bindFramebuffer(i.fbo),this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const a=ue.COLOR_BUFFER_BIT|ue.DEPTH_BUFFER_BIT|ue.STENCIL_BUFFER_BIT;this._rctx.clearSafe(a),this._renderAllGeometry(O.Depth),i.fbo.readPixels(r[0],r[1],r[2],r[3],_e.RGBA,pe.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,r,t,s,i){this._bindParameters.hudVisibility?.fbo.readPixels(e,r,t,s,_e.RGBA,pe.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e,r){const t=this._edgeView;if(t?.shouldRender()){const{width:s,height:i,depth:a}=this._offscreen,n=this.fboCache.acquire(y.RGBA,s,i),h=()=>t.render(this._bindParameters,e);this._offscreen.renderToTargets(h,n,r??a,Te),this._offscreen.compositeToFramebuffer(this._bindParameters,n.colorTexture,he.Alpha,1),n.release()}}_renderShadowMap(e,r,t){const s=this._shadowMap;s.enabled&&(s.start(e,r,t,this.isFeatureEnabled(K.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(e,r),this._needsShadowHighlight?(this._renderShadowCascades(O.ShadowHighlight,this._shadowMap),s.moveSnapshot(re.Highlight),s.clear(),this._renderShadowCascades(O.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(re.Default),this._renderShadowCascades(O.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(O.Shadow),s.finish(),e.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap){for(const t of r.cascades)t.camera.setGLViewport(this._rctx),this._prepare(t.camera,t.camera),this._renderAllGeometry(e)}get _needsLinearDepth(){return this._renderPlugins.consumes(O.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,(()=>this._renderAllGeometry(O.Depth)),[0,0,0,0],y.RGBA,w.DEPTH24_BUFFER),this._bindParameters.linearDepth.releaseDepth(),this._offscreen.bindFbo()):this._bindParameters.linearDepth=n(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=O.Depth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,(()=>this._renderTransparentTerrain()),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.releaseDepth(),this._renderContext.output=e}else this._bindParameters.multipassTerrain.linearDepth=n(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=n(this._bindParameters.multipassGeometry.linearDepth));const r=this._renderContext.output;return this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,(()=>this._renderOpaqueGeometryAndTransparentMaterial(O.Depth)),[1,1,1,1]),this._renderContext.output=r,this._bindParameters.multipassGeometry.linearDepth.detachDepth()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return V;const r=W(e,this._materialRenderers,this._stage.layers);return Q(r,this._renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderAllGeometry(e){this._renderContext.output=e,this._renderPlugins.prepare(Z.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._renderPlugins.prepare(Z.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderSSAO(){if(!this._renderPlugins.produces(Z.SSAO))return;const e=this._offscreen.renderToCachedFBO(null,(()=>this._renderAllGeometry(O.Normal)),[0,0,0,0],y.RGBA4,w.DEPTH24_BUFFER);e.releaseDepth(),this._offscreen.bindFbo(),this._pluginInput.normal=e,this._bindParameters.ssao=this._renderPlugins.render(Z.SSAO,this._pluginInput),e.release()}_prepareOpaqueGeometrySlots(){this._renderPlugins.prepare(Z.INTEGRATED_MESH),this._renderPlugins.prepare(Z.OPAQUE_TERRAIN),this._renderPlugins.prepare(Z.OPAQUE_MATERIAL),this._renderPlugins.prepare(Z.ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,Z.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderPlugins.render(Z.INTEGRATED_MESH),this._renderPlugins.render(Z.OPAQUE_TERRAIN),this._renderInternalSlot(Z.OPAQUE_MATERIAL),this._renderPlugins.render(Z.OPAQUE_MATERIAL)}_renderTransparentMaterial(){this._renderInternalSlot(Z.TRANSPARENT_MATERIAL),this._renderPlugins.render(Z.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){if(!this._renderPlugins.produces(Z.TRANSPARENT_TERRAIN))return;const e=()=>this._renderPlugins.render(Z.TRANSPARENT_TERRAIN,null);if(this._renderContext.output!==O.Color)return void e();const{width:r,height:t,depth:s}=this._offscreen,i=this.fboCache.acquire(y.RGBA,r,t);return this._offscreen.renderToTargets(e,i,s,[0,0,0,0]),i}_renderHUDVisibility(e){this._shouldRenderInternalSlot(this._materialRenderers,Z.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._renderInternalSlot(Z.OCCLUSION_PIXELS)),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=n(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===D.Occluded){const e=()=>this._renderInternalSlot(Z.LINE_CALLOUTS),{width:r,height:t,color:s}=this._offscreen,i=this.fboCache.acquireDepth(w.DEPTH16_BUFFER,r,t);this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._renderInternalSlot(Z.LINE_CALLOUTS)}_renderLaserlines(){if(this._renderPlugins.render(Z.LASERLINES),this._renderPlugins.produces(Z.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:r,height:t,depth:s}=e,i=this.fboCache.acquire(y.RGBA,r,t),a=()=>this._renderPlugins.render(Z.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Te),e.compositeToFramebuffer(this._bindParameters,i.colorTexture,he.PremultipliedAlpha,1),i.release()}}_renderHUD(e,r){if(this._materialRenderersHas.hudElements)if(this._oitEnabled){const t=this._renderOITPass(fe.HUD,e);this._rctx.bindFramebuffer(r?.fbo),this._compositingHelper.composite(this._bindParameters,t.colorTexture,he.PremultipliedAlpha),t.release()}else if(e===D.Occluded){const r=()=>this._renderHUDElements(e),{width:t,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(w.DEPTH16_BUFFER,t,s);this._offscreen.renderToTargets(r,i,a,void 0,!0,!0),a.release()}else this._renderHUDElements(e)}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._prepareInternalSlots(this._materialRenderers,Z.LINE_CALLOUTS_HUD_DEPTH,Z.HUD_MATERIAL,Z.LABEL_MATERIAL),this._renderInternalSlot(Z.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(Z.HUD_MATERIAL),this._renderInternalSlot(Z.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._renderPlugins.produces(Z.SHADOW_HIGHLIGHT)&&this.hasShadowHighlights}_renderHighlights(e,r){if(!this.hasHighlights||r.decorations===B.OFF)return;const t=()=>{this._renderAllGeometry(O.Highlight),this._rctx.clearSafe(ue.DEPTH_BUFFER_BIT),this._renderHUDElements(D.Both)},s=this._offscreen.renderToCachedFBO(null,t,[0,0,0,0],y.RGBA4,w.DEPTH_STENCIL_TEXTURE);this._needsShadowHighlight&&(this._pluginInput.highlight=s,this._renderPlugins.render(Z.SHADOW_HIGHLIGHT,this._pluginInput,e)),s.releaseDepth(),this._renderPlugins.produces(Z.HIGHLIGHT)&&(this._pluginInput.composite=null,this._pluginInput.normal=null,this._pluginInput.highlight=s,this._renderPlugins.render(Z.HIGHLIGHT,this._pluginInput,e)),s.release()}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,r,t){this._needsShadowCast&&this._bindParameters.linearDepth?.colorTexture&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=O.Alpha,this._bindParameters.transparencyPassType=se.Alpha,this._prepareInternalSlots(this._materialRenderers,Z.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(Z.TRANSPARENT_MATERIAL),this._renderContext.output=O.Color,this._bindParameters.transparencyPassType=se.Color,this._prepareInternalSlots(this._materialRenderers,Z.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(Z.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=se.FrontFace,this._prepareInternalSlots(this._materialRenderers,Z.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(Z.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=se.NONE}_renderOITPass(e,r=D.Both){const t=e===fe.HUD,s=t?this.fboCache.acquire(y.RGBA,this._offscreen.width,this._offscreen.height):null,i=t?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=O.Alpha,this._bindParameters.transparencyPassType=se.Alpha;const n=this._offscreen.renderOITPass(i,se.Alpha,t);this._renderContext.output=O.Color,this._bindParameters.transparencyPassType=se.Color;const h=this._offscreen.renderOITPass(i,se.Color,t);this._bindParameters.transparencyPassType=se.FrontFace;const o=this._offscreen.renderOITPass(i,se.FrontFace,t);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,h,n,o,s),s?.releaseDepth(),o.release(),h.release(),n.release(),this._bindParameters.transparencyPassType=se.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;Ae.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&r.material.parameters.renderOccluded===k.OccludeAndTransparentStencil&&(e|=r.material.parameters.renderOccluded,Ae.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{if(0==(e&s))return;const{width:h,height:o,depth:d}=r,l=this.fboCache.acquire(y.RGBA,h,o);r.renderToTargets(i,l,d,[0,0,0,0],a,n),r.compositeToFramebuffer(this._bindParameters,l.colorTexture,he.PremultipliedAlpha,t),l.release()};0!==Ae.length&&(this._prepareInternalSlots(Ae,Z.OCCLUDER_MATERIAL,Z.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(Z.OCCLUDER_MATERIAL,Ae),t(.5,k.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(Z.TRANSPARENT_OCCLUDER_MATERIAL,Ae)),!1,!1)),Ae.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&(r.material.parameters.renderOccluded===k.OccludeAndTransparent||r.material.parameters.renderOccluded===k.Transparent||r.material.parameters.renderOccluded===k.Opaque)&&(e|=r.material.parameters.renderOccluded,Ae.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,this._prepareInternalSlots(Ae,Z.OPAQUE_MATERIAL,Z.TRANSPARENT_MATERIAL,Z.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),s>k.Occlude&&this._renderPlugins.render(Z.OCCLUDED_TERRAIN),this._renderInternalSlot(Z.OPAQUE_MATERIAL,Ae),this._renderInternalSlot(Z.TRANSPARENT_MATERIAL,Ae),this._renderInternalSlot(Z.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Ae),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=O.Color,t(.5,k.OccludeAndTransparent,(()=>i(k.OccludeAndTransparent)),!0,j.OutlineVisualElementMask),t(.5,k.Transparent,(()=>i(k.Transparent)),!0,j.OutlineVisualElementMask),t(1,k.Opaque,(()=>i(k.Opaque)),!0,j.OutlineVisualElementMask),Ae.clear()}_renderAntialiasing(e,r){return this._pluginInput.composite=r,this._pluginInput.normal=null,this._pluginInput.highlight=null,this._renderPlugins.produces(Z.ANTIALIASING)?this._renderPlugins.render(Z.ANTIALIASING,this._pluginInput,e):this._renderPlugins.render(Z.BLIT,this._pluginInput,e)}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.material.produces(Z.TRANSPARENT_MATERIAL,O.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.mainColor=t.colorTexture,this._bindParameters.mainDepth=t.depthTexture}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(m(Re,this._bindParameters.camera.viewMatrix),m(Pe,this._bindParameters.camera.projectionMatrix),f(Ee,Re,Pe),f(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),f(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._ssrEnableTime=null}_shouldRenderInternalSlot(e,r){return this._bindParameters.slot=r,e.some((e=>null!=e.prepareTechnique(this._renderContext)))}_prepareInternalSlots(e,...r){for(const t of r)this._bindParameters.slot=t,e.forAll((e=>null!=e.prepareTechnique(this._renderContext)))}_renderInternalSlot(e,r=this._materialRenderers){this._bindParameters.slot=e,r.forAll((e=>{const r=e.prepareTechnique(this._renderContext);r&&e.renderNode(this._renderContext,r)}))}get memoryInfo(){return{fbos:this.fboCache.peakMemoryUsage,vaos:this._materialRenderers.reduce(((e,r)=>e+r.usedMemory),0),plugins:this._renderPlugins.usedMemory}}getMemoryForMaterial(e){if(null==e)return 0;const r=this._materialRenderers.find((r=>r.material===e));return r?.usedMemory??0}get usedMemory(){return this.fboCache.peakMemoryUsage+(this.edgeView?.usedMemory??0)+this._renderPlugins.usedMemory}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=J(),this._renderPlugins.renderFeatureChanged(),this._requestRender()},getFramebufferTexture:r=>{switch(r){case ge.Color:return e._offscreen.colorTexture;case ge.LinearDepth:return e._bindParameters.linearDepth?.colorTexture;case ge.ShadowMap:return e._shadowMap.depthTexture;case ge.HudVisibility:return e._bindParameters.hudVisibility?.colorTexture}}}}};var fe,ge;e([p()],me.prototype,"_renderPlugins",void 0),e([p()],me.prototype,"_shadowAccumulator",void 0),e([p()],me.prototype,"_state",void 0),e([p()],me.prototype,"_renderStateFeatures",void 0),e([p({readOnly:!0})],me.prototype,"fullResolutionAtmosphere",null),e([p()],me.prototype,"_smaa",void 0),e([p()],me.prototype,"_blit",void 0),e([p({autoDestroy:!0})],me.prototype,"_edgeView",void 0),e([p()],me.prototype,"updating",null),e([p()],me.prototype,"isCameraFinal",null),me=e([u("esri.views.3d.webgl-engine.lib.Renderer")],me),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(fe||(fe={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility"}(ge||(ge={}));const Te=[0,0,0,0],Ae=new h,Pe=T(),Re=T(),Ee=T();function be(e){return r=>e.immediate.schedule(r)}export{ge as FramebufferId,me as Renderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as t}from"../../../../core/mathUtils.js";import{debugFlags as e}from"../../support/debugFlags.js";import{getFontMetrics as i}from"./FontMetrics.js";import{getTextHelperCanvas as n}from"./TextHelperCanvas.js";const s=1;class r{constructor(t,e,i,n
|
|
5
|
+
import{clamp as t}from"../../../../core/mathUtils.js";import{debugFlags as e}from"../../support/debugFlags.js";import{getFontMetrics as i}from"./FontMetrics.js";import{getTextHelperCanvas as n}from"./TextHelperCanvas.js";const s=1;class r{constructor(t,e,i,n){this.text=t,this._alignment=e,this._parameters=i,this._maxSize=n,this._textWidths=[],this._lineWidths=[],this._renderPixelRatio=null,this._metricsCached=null,this.key=`TextRenderer-${this._parameters.key}-${this._alignment}--${t}`,this._lines=t.split(/\r?\n/)}get displayWidth(){return Math.ceil(this._displayWidth+2*this._horizontalPadding)}get displayHeight(){let t=this._metrics.firstLineAscent;for(let e=0;e<this._lines.length-1;e++)t+=this._lineSpacing;return t+=this._metrics.lastLineDescent,Math.ceil(t+2*this._haloSize+2*this._verticalPadding)}get renderedWidth(){return this._toRoundedRenderUnit(this.displayWidth)}get renderedHeight(){return this._toRoundedRenderUnit(this.displayHeight)}get firstRenderedBaselinePosition(){return this._toRenderUnit(this._firstLineYOffset+this._metrics.firstLineAscent)}get _firstLineYOffset(){return this._verticalPadding+this._haloSize}get _metrics(){if(null==this._metricsCached){const t=n(a,l,l).getContext("2d");this._parameters.setFontProperties(t,this._fontSize);let e=2*this._haloSize;const s=this._parameters.definition.font;"italic"!==s.style&&"oblique"!==s.style&&"bold"!==s.weight&&"bolder"!==s.weight||(e+=.3*t.measureText("A").width),this._textWidths.length=0,this._lineWidths.length=0;let r,h,o=0,d=0,_=0;this._lines.forEach(((i,n)=>{const s=t.measureText(i),a=s.width,l=a+e;this._textWidths.push(a),this._lineWidths.push(l),o=Math.max(o,l),d=Math.max(d,s.actualBoundingBoxAscent),_=Math.max(_,s.actualBoundingBoxDescent),0===n&&(r=s),n===this._lines.length-1&&(h=s)}));const g=i(this._parameters);d=Math.max(d,g.maxAscent),_=Math.max(_,g.maxDescent);const m=r.actualBoundingBoxAscent,f="underline"===this._parameters.definition.font.decoration?_:h.actualBoundingBoxDescent;this._metricsCached=new c(m,f,d,_,o)}return this._metricsCached}get _lineSpacing(){return(this._midLineHeight+this._linePadding)*this._parameters.definition.lineSpacingFactor}get _midLineHeight(){return this._metrics.midLineHeight}get _linePadding(){return this._midLineHeight*d}get _midLineAscent(){return this._metrics.maxLineAscent}get _renderedFontSize(){return this._toRenderUnit(this._fontSize)}get _fontSize(){return this._parameters.definition.size}get _renderedHaloSize(){return this._toRenderUnit(this._haloSize)}get _haloSize(){return this._parameters.haloSize}get _horizontalPadding(){return this._hasBackground?this._parameters.definition.background.padding[0]:0}get _verticalPadding(){return Math.max(this._hasBackground?this._parameters.definition.background.padding[1]:0,s)}get _hasBackground(){return!!this._parameters.backgroundStyle}get renderPixelRatio(){if(null==this._renderPixelRatio){const t=this._parameters.definition.pixelRatio;this._renderPixelRatio=Math.min(t,Math.min(this._maxSize[0]/this.displayWidth,this._maxSize[1]/this.displayHeight))}return this._renderPixelRatio}_getLineXOffset(t){switch(this._alignment){case o.Left:return this._horizontalPadding;case o.Center:return(this.displayWidth-this._lineWidths[t])/2;case o.Right:return this.displayWidth-this._horizontalPadding-this._lineWidths[t]}}render(t,i,n){t.save();const s=i/=this.renderPixelRatio,r=n/=this.renderPixelRatio,h=this._haloSize,o=this._firstLineYOffset+this._metrics.firstLineAscent;i+=h,n+=o;const a=this._haloSize>0;a&&this._renderHalo(t,s,r,h,o),this._parameters.setFontProperties(t,this._renderedFontSize);for(let e=0;e<this._lines.length;++e){const s=this._lines[e],r=this._getLineXOffset(e);a&&(t.globalCompositeOperation="destination-out",t.fillStyle="rgb(0, 0, 0)",this._fillText(t,s,i+r,n),this._renderLineDecoration(t,i+r,n,this._textWidths[e])),t.globalCompositeOperation="source-over",t.fillStyle=this._parameters.textStyle,this._fillText(t,s,i+this._getLineXOffset(e),n),this._renderLineDecoration(t,i+r,n,this._textWidths[e]),n+=this._lineSpacing}if(e.TEXT_SHOW_BASELINE){t.strokeStyle=_,t.setLineDash([2,2]),t.lineWidth=1;let e=r+o;for(let i=0;i<this._lines.length;++i)this._drawLine(t,[s,e],[s+this.displayWidth,e]),e+=this._lineSpacing}if(e.TEXT_SHOW_BORDER&&(t.strokeStyle=_,t.setLineDash([]),t.lineWidth=1,this._drawBox(t,[s,r],[this.displayWidth,this.displayHeight])),this._hasBackground){const e=this._parameters.definition.background.borderRadius*this.renderPixelRatio;this._roundedRect(t,s,r,e),t.globalCompositeOperation="destination-over",t.fillStyle=this._parameters.backgroundStyle,t.fill()}t.restore()}_renderLineDecoration(t,e,i,n,s=!1){if("none"===this._parameters.definition.font.decoration||0===n)return;const r=1,h=Math.max(this._parameters.definition.size/16,r);switch(this._parameters.definition.font.decoration){case"underline":i+=2*h;break;case"line-through":i-=.33*this._midLineAscent}const o=s?this._haloSize:0;t.strokeStyle=s?this._parameters.haloStyle:this._parameters.textStyle,t.lineWidth=this._toRenderUnit(h+2*o),t.beginPath(),t.moveTo(this._toRenderUnit(e-o),this._toRenderUnit(i)),t.lineTo(this._toRenderUnit(e+n+o),this._toRenderUnit(i)),t.stroke()}_roundedRect(e,i,n,s){i=this._toRenderUnit(i),n=this._toRenderUnit(n);const r=this.renderedWidth,h=this.renderedHeight;0!==s?(s=t(s,0,Math.floor(h/2)),e.beginPath(),e.moveTo(i,n+s),e.arcTo(i,n,i+s,n,s),e.lineTo(i+r-s,n),e.arcTo(i+r,n,i+r,n+s,s),e.lineTo(i+r,n+h-s),e.arcTo(i+r,n+h,i+r-s,n+h,s),e.lineTo(i+s,n+h),e.arcTo(i,n+h,i,n+h-s,s),e.closePath()):e.rect(i,n,r,h)}_renderHalo(t,e,i,s,r){const h=this.renderedWidth,o=this.renderedHeight,d=n(a,Math.max(h,l),Math.max(o,l)),_=d.getContext("2d");_.clearRect(0,0,h,o),this._parameters.setFontProperties(_,this._renderedFontSize),_.fillStyle=this._parameters.haloStyle,_.strokeStyle=this._parameters.haloStyle;const c=this._renderedHaloSize<3;_.lineJoin=c?"miter":"round",c?this._renderHaloEmulated(_,s,r):this._renderHaloNative(_,s,r);let g=r;for(let n=0;n<this._lines.length;++n){const t=this._getLineXOffset(n);this._renderLineDecoration(_,s+t,g,this._textWidths[n],!0),g+=this._lineSpacing}t.globalAlpha=this._parameters.definition.halo.color[3],t.drawImage(d,0,0,h,o,this._toRenderUnit(e),this._toRenderUnit(i),h,o),t.globalAlpha=1}_renderHaloEmulated(t,e,i){for(let n=0;n<this._lines.length;++n){const s=this._lines[n],r=this._getLineXOffset(n);for(const[n,o]of h)this._fillText(t,s,e+r+this._haloSize*n,i+this._haloSize*o);i+=this._lineSpacing}}_renderHaloNative(t,e,i){const n=2*this._haloSize;for(let s=0;s<this._lines.length;++s){const r=this._lines[s],h=this._getLineXOffset(s),o=5,a=.1;for(let s=0;s<o;s++){const d=1-(o-1)*a+s*a;t.lineWidth=this._toRenderUnit(d*n),this._strokeText(t,r,e+h,i)}i+=this._lineSpacing}}get _displayWidth(){return this._metrics.displayWidth}_toRenderUnit(t){return t*this.renderPixelRatio}_toRoundedRenderUnit(t){return Math.round(t*this.renderPixelRatio)}_fillText(t,e,i,n){t.fillText(e,this._toRenderUnit(i),this._toRenderUnit(n))}_strokeText(t,e,i,n){t.strokeText(e,this._toRenderUnit(i),this._toRenderUnit(n))}_drawLine(t,e,i){t.beginPath(),t.moveTo(this._toRoundedRenderUnit(e[0])+.5,this._toRoundedRenderUnit(e[1])+.5),t.lineTo(this._toRoundedRenderUnit(i[0])+.5,this._toRoundedRenderUnit(i[1])+.5),t.stroke()}_drawBox(t,e,i){const n=this._toRenderUnit(e[0]),s=this._toRenderUnit(e[1]),r=this._toRenderUnit(i[0]),h=this._toRenderUnit(i[1]),o=Math.floor(n)+.5,a=Math.ceil(n+r)-.5,d=Math.floor(s)+.5,l=Math.ceil(s+h)-.5;t.beginPath(),t.moveTo(o,d),t.lineTo(a,d),t.lineTo(a,l),t.lineTo(o,l),t.lineTo(o,d),t.stroke()}}const h=[];{const t=16;for(let e=0;e<360;e+=360/t)h.push([Math.cos(Math.PI*e/180),Math.sin(Math.PI*e/180)])}var o;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right"}(o||(o={}));const a={canvas:null},d=.2,l=512,_="rgb(255, 0, 255, 0.5)";class c{get firstLineHeight(){return this.firstLineAscent+this.maxLineDescent}get midLineHeight(){return this.maxLineAscent+this.maxLineDescent}get lastLineHeight(){return this.maxLineAscent+this.lastLineDescent}constructor(t,e,i,n,s){this.firstLineAscent=t,this.lastLineDescent=e,this.maxLineAscent=i,this.maxLineDescent=n,this.displayWidth=s}}export{o as TextRenderAlignment,r as TextRenderer,s as textVerticalPaddingPx};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as n}from"../../../../core/uid.js";import{property as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as n}from"../../../../core/uid.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{s as o}from"../../../../chunks/vec4.js";import{c as l,Z as _}from"../../../../chunks/vec4f64.js";import{ContentObjectType as c}from"./ContentObjectType.js";import{textTextureAtlas as d}from"./testUtils.js";import{applyTextureResizeModulo as u}from"./textureUtils.js";import{VertexAttribute as m}from"./VertexAttribute.js";import{TaskPriority as g,Task as p}from"../../../support/Scheduler.js";import{TextureWrapMode as f,TextureSamplingMode as x}from"../../../webgl/enums.js";import{Texture as w}from"../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";const y=4096;let b=class extends t{constructor(e){super(e),this.type=c.Texture,this.id=n(),this.events=new s,this._glTexture=null,this._atlas=new O(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._stageObjects=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view._stage,this._stage.add(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this.updating=!1,this.events.emit("unloaded")}get glTexture(){return this._glTexture}static get maxSize(){return[y-R,y-R-k]}load(e){if(this._glTexture)return this._glTexture;const t=new T;return t.wrapMode=f.CLAMP_TO_EDGE,t.samplingMode=x.LINEAR_MIPMAP_LINEAR,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new w(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(g.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._glTexture&&(this._stage.remove(this),this._glTexture=i(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.setAttribute("width",e.width.toString()),this._canvas.setAttribute("height",e.height.toString())}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._glTexture?.resize(e,t),this._glTexture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach((e=>{const t=this._stageObjects.get(e.textRenderer.key);t?.forEach((t=>v(t,e)))})),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let n=r.cursors.get(i);if(!n){if(r.height<r.nextY+i)return!1;n=[new E(r.nextY)],r.cursors.set(i,n),r.nextY+=i}let h=n.find((e=>r.width>=e.x+s));if(null==h){if(r.height<r.nextY+i)return!1;h=new E(r.nextY),r.nextY+=i,n.push(h)}return e.setNewPosition(h),this._elements.set(t,e),this._elementsToRender.set(t,e),h.x+=s,!0}_ensureStageObjects(e){const t=this._stageObjects.get(e);if(t)return t;const s=new Set;return this._stageObjects.set(e,s),s}_addStageObject(e,t){this._ensureStageObjects(e).add(t)}_removeStageObject(e,t){const s=this._stageObjects.get(e);s?.delete(t)&&(t.geometries[0].setAttributeData(m.SIZE,[0,0]),t.geometryVertexAttributeUpdated(t.geometries[0],m.SIZE),this._elementsToRender.delete(e))}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,n=i+R,h=r+R+k;if(!this._addAtlasElement(e,t,n,h)){if(this._canRepack)this._reset();else if(s.width<n){const e=Math.min(u(Math.max(n,1.5*s.width)),y);this._resizeAtlas(e,s.height)}else{const e=s.nextY+h,t=Math.min(u(Math.max(e,1.5*s.height)),y);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<y){const e=Math.min(u(1.5*s.width),y);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition();this._ctx.clearRect(t[0]-R,t[1]-R,e.textRenderer.renderedWidth+2*R,e.textRenderer.renderedHeight+2*R),e.textRenderer.render(this._ctx,t[0],t[1]);const s=this._stageObjects.get(e.textRenderer.key);s?.forEach((t=>v(t,e)))}get running(){return this.updating}runTask(e){if(null==this._glTexture)return p.YIELD;for(;this._needsRepack&&(this._canRepack||this._atlas.height<y&&this._atlas.height<y);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach((e=>this._processAddition(e))),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0,!this.updating&&d.orderedRepackingEnabled&&(this._repackOrdered(),e.madeProgress())}addTextTexture(e,t){const s=e.key;this._addStageObject(s,t);let i=this._elements.get(s);null==i&&(i=new A(this._atlas,e),this._processAddition(i),this.setDirty()),j(t,i),v(t,i)}removeTextTexture(e,t){const s=e.key;if(!this._elements.get(s))return;this._removeStageObject(s,t);const i=this._stageObjects.get(s);i&&0!==i.size||this._elements.delete(s),0===i?.size&&this._stageObjects.delete(s),this._canRepack=!0}setDirty(){this._glTexture&&(this.updating=!0)}_repackOrdered(){if(0===this._elements.size)return;const e=[];this._elements.forEach(((t,s)=>e.push({element:t,key:s})));let t=!0;for(let s=0;s<e.length-1;s++)if(e[s].key.localeCompare(e[s+1].key)>0){t=!1;break}if(!t){e.sort(((e,t)=>e.key.localeCompare(t.key))),this._elements.clear();for(const{element:t,key:s}of e)this._elements.set(s,t);this._reset()}}get test(){const{_elements:e,_stageObjects:t,_atlas:s}=this,i=this;return{elements:e,stageObjects:t,atlas:s,resizeAtlas:(e,t)=>i._resizeAtlas(e,t),run:e=>i.runTask(e)}}};function j(e,t){e.geometries[0].setAttributeData(m.SIZE,[t.textRenderer.displayWidth,t.textRenderer.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],m.SIZE)}function v(e,t){e.geometries[0].setAttributeData(m.UV0,t.uv),e.geometryVertexAttributeUpdated(e.geometries[0],m.UV0,!0)}e([h({constructOnly:!0})],b.prototype,"view",void 0),e([h({type:Boolean})],b.prototype,"updating",void 0),b=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],b);const R=2,k=2;class A{constructor(e,t){this._atlas=e,this.textRenderer=t,this._uv=l(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return o(this._uv,this._xOffset/this._atlas.width,(this._yOffset+t)/this._atlas.height,(this._xOffset+e)/this._atlas.width,this._yOffset/this._atlas.height)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class O{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=0}}class E{constructor(e){this.y=e,this.x=0}}export{b as TextTextureAtlas};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getTextHelperCanvas as e}from"./TextHelperCanvas.js";import{TextRenderer as r}from"./TextRenderer.js";import{
|
|
5
|
+
import{getTextHelperCanvas as e}from"./TextHelperCanvas.js";import{TextRenderer as r}from"./TextRenderer.js";import{TextTextureAtlas as t}from"./TextTextureAtlas.js";import{Texture as n}from"./Texture.js";import{TextureWrapMode as s}from"../../../webgl/enums.js";class i{constructor(e,n,s){this._renderer=new r(e,n,s,t.maxSize)}get key(){return this._renderer.key}get baselineAnchorY(){return 1-this._renderer.firstRenderedBaselinePosition/this._renderer.renderedHeight}get displayWidth(){return this._renderer.displayWidth}get displayHeight(){return this._renderer.displayHeight}create(){const r=e(d,this._renderer.renderedWidth,this._renderer.renderedHeight),t=r.getContext("2d");return t.save(),this._renderer.render(t,0,0),t.restore(),new n(r,{wrap:{s:s.CLAMP_TO_EDGE,t:s.CLAMP_TO_EDGE},noUnpackFlip:!1,mipmap:!0,preMultiplyAlpha:!0})}}const d={canvas:null};export{i as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var E;!function(E){E.POSITION="position",E.NORMAL="normal",E.NORMALCOMPRESSED="normalCompressed",E.UV0="uv0",E.AUXPOS1="auxpos1",E.AUXPOS2="auxpos2",E.COLOR="color",E.SYMBOLCOLOR="symbolColor",E.SIZE="size",E.TANGENT="tangent",E.OFFSET="offset",E.PERSPECTIVEDIVIDE="perspectiveDivide",E.SUBDIVISIONFACTOR="subdivisionFactor",E.COLORFEATUREATTRIBUTE="colorFeatureAttribute",E.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",E.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",E.DISTANCETOSTART="distanceToStart",E.UVMAPSPACE="uvMapSpace",E.BOUNDINGRECT="boundingRect",E.UVREGION="uvRegion",E.PROFILERIGHT="profileRight",E.PROFILEUP="profileUp",E.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",E.FEATUREVALUE="featureValue",E.INSTANCEMODELORIGINHI="instanceModelOriginHi",E.INSTANCEMODELORIGINLO="instanceModelOriginLo",E.INSTANCEMODEL="instanceModel",E.INSTANCEMODELNORMAL="instanceModelNormal",E.INSTANCECOLOR="instanceColor",E.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",E.LOCALTRANSFORM="localTransform",E.GLOBALTRANSFORM="globalTransform",E.BOUNDINGSPHERE="boundingSphere",E.MODELORIGIN="modelOrigin",E.MODELSCALEFACTORS="modelScaleFactors",E.FEATUREATTRIBUTE="featureAttribute",E.STATE="state",E.LODLEVEL="lodLevel",E.POSITION0="position0",E.POSITION1="position1",E.NORMALA="normalA",E.NORMALB="normalB",E.COMPONENTINDEX="componentIndex",E.VARIANTOFFSET="variantOffset",E.VARIANTSTROKE="variantStroke",E.VARIANTEXTENSION="variantExtension",E.
|
|
5
|
+
var E;!function(E){E.POSITION="position",E.NORMAL="normal",E.NORMALCOMPRESSED="normalCompressed",E.UV0="uv0",E.AUXPOS1="auxpos1",E.AUXPOS2="auxpos2",E.COLOR="color",E.SYMBOLCOLOR="symbolColor",E.SIZE="size",E.TANGENT="tangent",E.OFFSET="offset",E.PERSPECTIVEDIVIDE="perspectiveDivide",E.SUBDIVISIONFACTOR="subdivisionFactor",E.COLORFEATUREATTRIBUTE="colorFeatureAttribute",E.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",E.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",E.DISTANCETOSTART="distanceToStart",E.UVMAPSPACE="uvMapSpace",E.BOUNDINGRECT="boundingRect",E.UVREGION="uvRegion",E.PROFILERIGHT="profileRight",E.PROFILEUP="profileUp",E.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",E.FEATUREVALUE="featureValue",E.INSTANCEMODELORIGINHI="instanceModelOriginHi",E.INSTANCEMODELORIGINLO="instanceModelOriginLo",E.INSTANCEMODEL="instanceModel",E.INSTANCEMODELNORMAL="instanceModelNormal",E.INSTANCECOLOR="instanceColor",E.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",E.LOCALTRANSFORM="localTransform",E.GLOBALTRANSFORM="globalTransform",E.BOUNDINGSPHERE="boundingSphere",E.MODELORIGIN="modelOrigin",E.MODELSCALEFACTORS="modelScaleFactors",E.FEATUREATTRIBUTE="featureAttribute",E.STATE="state",E.LODLEVEL="lodLevel",E.POSITION0="position0",E.POSITION1="position1",E.NORMALA="normalA",E.NORMALB="normalB",E.COMPONENTINDEX="componentIndex",E.VARIANTOFFSET="variantOffset",E.VARIANTSTROKE="variantStroke",E.VARIANTEXTENSION="variantExtension",E.SIDENESS="sideness",E.START="start",E.END="end",E.UP="up",E.EXTRUDE="extrude",E.OBJECTANDLAYERIDCOLOR="objectAndLayerIdColor",E.INSTANCEOBJECTANDLAYERIDCOLOR="instanceObjectAndLayerIdColor"}(E||(E={}));export{E as VertexAttribute};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Logger.js";import{clamp as o}from"../../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as a}from"../../../../../core/maybe.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f as d,t as u,d as h}from"../../../../../chunks/mat3.js";import{a as m}from"../../../../../chunks/mat3f64.js";import{a as g}from"../../../../../chunks/mat4f64.js";import{s as p,c as f,u as _,j as b}from"../../../../../chunks/vec3.js";import{c as y}from"../../../../../chunks/vec3f64.js";import{UpdatingHandles as j}from"../../../../../core/support/UpdatingHandles.js";import{g as O,a as w}from"../../../../../chunks/sphere.js";import{c as E}from"../../../../../chunks/vec33.js";import{ViewingMode as R}from"../../../../ViewingMode.js";import{encodeElevationOffset as v}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as x}from"../../core/util/TwoVectorPosition.js";import{GridLocalOriginFactory as T}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as C}from"../localOriginHelper.js";import{LocalOriginManager as M}from"../LocalOriginManager.js";import{Object3D as P}from"../Object3D.js";import{VertexArrayObject as S}from"../VertexArrayObject.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{VertexLayout as A,EdgeInputBufferLayout as U,EdgeShaderAttributeLocations as B,glVertexLayout as k}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as L,SilhouetteEdgeBufferWriter as I}from"./edgeBufferWriters.js";import{EdgeType as H}from"./edgePreprocessing.js";import{EdgeRenderer as V,lineWidthFractionFactor as G,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as q}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as z}from"./EdgeWorkerHandle.js";import{Transparency as W}from"./interfaces.js";import{generateStrokesTexture as K}from"./strokes.js";import{determineRendererType as F,determineEdgeTransparency as Q,determineObjectTransparency as J,fillComponenBufferIndices as X}from"./util.js";import{BufferManager as Y}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as Z}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as $}from"../../../../webgl/BufferObject.js";import{Usage as ee}from"../../../../webgl/enums.js";let te=class extends t{constructor(e){super(e),this._updatingHandles=new j,this._perObjectData=new Map,this._perObjectDataEvictionCache=new Set,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=y(),this._localOrigins=new M(new T(e.renderSR))}initialize(){this._worker=new z(this.schedule),this._componentColorManager=new Y(this.rctx,3);const e=A.createBuffer(4);for(let t=0;t<4;t++)e.sideness.set(t,0,0===t||3===t?0:1),e.sideness.set(t,1,0===t||1===t?0:1);this._verticesBufferObject=$.createVertex(this.rctx,ee.STATIC_DRAW,e.buffer)}destroy(){this.destroyed||(this._perObjectData.forEach((e=>this._discardObjectEntry(e))),this._perObjectData.clear(),this._strokesTexture=i(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject=i(this._verticesBufferObject),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",fe))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,o,i,a){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let c;const l=new ne(new Promise((e=>c=e)),r.center,r.radius);this._perObjectData.set(e,l);const d=await this._updatingHandles.addPromise(this._addComponentGeometry(t,l,s,n,o,i,a));return this.setNeedsRender(),c(),d}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const o=this._perObjectData.get(e);let i;o?.renderables.length>0&&this._perObjectDataEvictionCache.add(o);const a=e.boundingVolumeWorldSpace.bounds,c=new ne(new Promise((e=>i=e)),O(a),w(a));this._perObjectData.set(e,c);const l=new Array;if(r.mergeGeometries&&e.geometries.length>1&&se(e))l.push(this._addObjectMergedGeometries(e,c,t,r,s));else for(let n=0;n<e.geometries.length;n++){const o=e.geometries[n];o.material.supportsEdges&&l.push(this._addGeometry(e,c,o,t[0],r,s))}await this._updatingHandles.addPromise(Promise.all(l)),this._perObjectDataEvictionCache.delete(c),this._discardObjectEntry(o),this.setNeedsRender(),i()}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._perObjectData.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=t instanceof Array?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],o=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(o,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return null!=t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof P,o=!!r.hasSlicePlane,i=F(t),a=V.getKey(i,o,n),c=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=c&&(c.renderables.forEach((e=>{if(a!==e.rendererKey){const t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(i,o,n);t.removeRenderable(e),--t.refCount,e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&this._updateComponentBuffer(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&(r.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;this._updateComponentBuffer(e.components)})),this.setNeedsRender())}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}removeObject(e){const t=this._perObjectData.get(e);t&&(this._perObjectData.delete(e),this._discardObjectEntry(t))}async _getObjectEntry(e){const t=this._perObjectData.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=y(),n=new x;let o=0,i=0;if(this._renderers.forEach((r=>{if(0===r.refCount)this._renderers.delete(r.key),r.dispose();else{let s=!0,n=!0;r.forEachRenderable((t=>{t.visible&&(o+=t.statistics.averageEdgeLength,i++,s&&t.regular&&(r.updateTechnique(e,!1),s=!1),n&&t.silhouette&&(r.updateTechnique(e,!0),n=!1))}),t)}})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===i)return;const a=new q(40*o/i,t);p(s,r[3],r[7],r[11]),n.set(s),f(a.transformWorldFromViewTH,n.high),f(a.transformWorldFromViewTL,n.low),d(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),u(pe,a.transformViewFromCameraRelativeRS),h(a.transformNormalViewFromGlobal,pe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{this._renderRegularEdges(t,e,a),this._renderSilhouetteEdges(t,e,a)}))}_updateTransparency(e){const t=Q(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(p(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,C(s.origin.vec3,r),s}_updateComponentBuffer(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,i=t[n].index,a=o(Math.round(e.size*G),0,255),c=o(e.extensionLength,-N,255-N)+N,l="solid"===e.type?H.SOLID:H.SKETCH,d=255*e.opacity,u=e.color,h=255*u[0],m=255*u[1],g=255*u[2],p=255*u[3];r.textureBuffer.setData(i,0,h,m,g,p),r.textureBuffer.setData(i,1,a,c,l,d),v(t[n].verticalOffset,s),r.textureBuffer.setData(i,2,s[0],s[1],s[2],s[3])}}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],o=r.acquireIndex();t.push({index:o,verticalOffset:0,material:s})}const s=new oe(r,t);return this._updateComponentBuffer(s),s}_extractEdges(e,t,r,s,n,o=n.length){return this._worker.process({data:t,indices:n,indicesLength:o,writerSettings:e,skipDeduplicate:r},this._workerAbort.signal,s)}_createRenderable(e,t,r,s,n){const o=t=>null!=this._verticesBufferObject?new ie(new S(this.rctx,B,{vertices:k,instances:t===Z.REGULAR?L.glLayout:I.glLayout},{vertices:this._verticesBufferObject,instances:$.createVertex(this.rctx,ee.STATIC_DRAW,t===Z.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),t===Z.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo):null,i=e.regular.lodInfo.lengths.length>0?o(Z.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?o(Z.SILHOUETTE):null,c=(i?.vao.memoryUsage??0)+(a?.vao.memoryUsage??0);return new ce(i,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,Q(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,o){const i=r.attributes.get(D.POSITION),a=i.indices,c=g(),l=this._computeModelTransformWithLocalOrigin(e,r,c),d=new ge(i,a,c,l);return this._addPositionData(t,d,r.edgeIndicesLength,s,n,o)}async _addPositionData(e,t,r,s,n,o=!1){if(null==e.loaded)return;const i=this._createComponentBuffers([s]);if(null==i||r<=0)return;const a=this._acquireRenderer(s.type,!!n.hasSlicePlane,!0),{modelTransform:c,origin:l}=t,d=t.indices,u=t.position,h=u.data.length/u.size,m=U.createBuffer(h);for(let f=0;f<h;f++)m.position.set(f,0,u.data[f*u.size]),m.position.set(f,1,u.data[f*u.size+1]),m.position.set(f,2,u.data[f*u.size+2]);X(i.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(a.writerSettings,m,!1,o,d,r));if(null==e.loaded)return;const p=this._createRenderable(g,i,new ae(c,l),a.key,!1);e.renderables.push(p),a.addRenderable(p),this._gpuMemoryUsage+=p.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,o,i){if(null==t.loaded)return 0;const a=this._createComponentBuffers(o);if(null==a)return 0;const c=F(o),l=this._acquireRenderer(c,i.hasSlicePlane||!1,!1),d=U.createBuffer(r.length/3);E(d.position.typedBuffer,r,d.position.typedBufferStride,3),X(a.meta,n,d.componentIndex,s);const u=!0,h=l.writerSettings,m=await this._updatingHandles.addPromise(this._extractEdges(h,d,u,!1,s));if(null==t.loaded)return 0;const g=this._createRenderable(m,a,e,l.key,!0);return t.renderables.push(g),l.addRenderable(g),g.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const o=new Map;let i=0,a=null,c=0;for(let g=0;g<e.geometries.length;g++){const t=e.geometries[g];if(!t.material.supportsEdges)continue;!a&&t.localOrigin&&(a=t);const r=t.attributes.get(D.POSITION);c+=r.data.length/r.size,i+=t.edgeIndicesLength}const l=c>=65536?Uint32Array:Uint16Array,d=i?new l(i):null,u=[];let h=0;for(let g=0;g<e.geometries.length;g++){const t=e.geometries[g];if(!t.material.supportsEdges)continue;const r=t.attributes.get(D.POSITION),s=r.indices;let n=o.get(r.data);if(null==n){n=u.length/3;for(let e=0;e<r.data.length;e+=r.size)u.push(r.data[e]),u.push(r.data[e+1]),u.push(r.data[e+2]);o.set(r.data,n)}if(s)for(let e=0;e<t.edgeIndicesLength;e++)d[h++]=n+s[e]}const m=a||e.geometries[0],p=g(),f=this._computeModelTransformWithLocalOrigin(e,m,p);for(let g=0;g<e.geometries.length;g++)e.geometries[g].localOrigin=f.origin;const _=new ge({data:u,size:3},d,p,f);await this._updatingHandles.addPromise(this._addPositionData(t,_,d.length,r[0],s,n))}_acquireRenderer(e,t,r){const s=V.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=K(this.rctx)),n||(n=new V(this.rctx,this.techniqueRepository,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===R.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){re(e.regular),re(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,"origin"in e.transform&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=y(),n=e=>{_(s,e.center,t);const n=b(s,r),o=e.radius,i=n<-o?1/0:n<o?0:n-o;e.renderables.forEach((e=>e.distanceToCamera=i))};this._perObjectData.forEach(n),this._perObjectDataEvictionCache.forEach(n)}_renderRegularEdges(e,t,r){const s=e.bindRegularEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!de(n)||!n.visible)return;const i=me(n.regular.lod.lengths,n.distanceToCamera,o);e.renderRegularEdges(s,n,r,t,i)}),n)}_renderSilhouetteEdges(e,t,r){const s=e.bindSilhouetteEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!he(n)||!n.visible)return;const i=me(n.silhouette.lod.lengths,n.distanceToCamera,o);e.renderSilhouetteEdges(s,n,r,t,i)}),n)}get test(){return{hasRenderedPrimitives:e=>{let t=!1;const r=e.perScreenPixelRatio,s=(e,s)=>e.forEachRenderable((e=>{e.visible&&!t&&(de(e)&&(t=me(e.regular.lod.lengths,e.distanceToCamera,r)>0),!t&&he(e)&&(t=me(e.silhouette.lod.lengths,e.distanceToCamera,r)>0))}),s);return this._renderers.forEach((e=>{t||(s(e,W.OPAQUE),s(e,W.TRANSPARENT))})),t}}}};function re(e){null!=e&&(e.vao.vertexBuffers.instances.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,s=null;for(let n=0;n<e.geometries.length;n++){const o=e.geometries[n];if(o.material.supportsEdges){if(t){if(!r(t,o.transformation))return!1}else t=o.transformation;if(s||null==o.localOrigin){if(s&&null!=s.localOrigin&&null!=o.localOrigin&&s.localOrigin.id!==o.localOrigin.id)return!1}else s=o}}return!0}e([c({constructOnly:!0})],te.prototype,"rctx",void 0),e([c({constructOnly:!0})],te.prototype,"renderSR",void 0),e([c({constructOnly:!0})],te.prototype,"viewingMode",void 0),e([c({constructOnly:!0})],te.prototype,"techniqueRepository",void 0),e([c({constructOnly:!0})],te.prototype,"setNeedsRender",void 0),e([c({constructOnly:!0})],te.prototype,"schedule",void 0),e([c({readOnly:!0})],te.prototype,"_updatingHandles",void 0),e([c({readOnly:!0})],te.prototype,"updating",null),te=e([l("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],te);class ne{constructor(e,t,r){this.center=t,this.radius=r,this.renderables=new Array,this.loaded=e,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0)}))}}class oe{constructor(e,t){this.buffer=e,this.meta=t}}class ie{constructor(e,t){this.vao=e,this.lod=t}}class ae{constructor(e,t){this.modelMatrix=e,this.origin=t}}class ce{constructor(e,t,r,s,n,o,i,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=o,this.components=i,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class le extends ce{}function de(e){return null!=e.regular}class ue extends ce{}function he(e){return null!=e.silhouette}function me(e,t,r){const n=t*r,o=s(e,n,!0);return-1===o?n<e[0]?e.length:0:e.length-o}class ge{constructor(e,t,r,s){this.position=e,this.indices=t,this.modelTransform=r,this.origin=s}}const pe=m(),fe=()=>Promise.reject();export{te as EdgeView,ae as LegacyTransform,le as RegularRenderable,ce as Renderable,ue as SilhouetteRenderable};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Logger.js";import{clamp as o}from"../../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as a}from"../../../../../core/maybe.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f as d,t as u,d as h}from"../../../../../chunks/mat3.js";import{a as m}from"../../../../../chunks/mat3f64.js";import{a as g}from"../../../../../chunks/mat4f64.js";import{s as p,c as f,u as _,j as b}from"../../../../../chunks/vec3.js";import{c as y}from"../../../../../chunks/vec3f64.js";import{UpdatingHandles as j}from"../../../../../core/support/UpdatingHandles.js";import{g as O,a as w}from"../../../../../chunks/sphere.js";import{c as E}from"../../../../../chunks/vec33.js";import{ViewingMode as R}from"../../../../ViewingMode.js";import{encodeElevationOffset as v}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as x}from"../../core/util/TwoVectorPosition.js";import{Attribute as T}from"../Attribute.js";import{GridLocalOriginFactory as C}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as M}from"../localOriginHelper.js";import{LocalOriginManager as P}from"../LocalOriginManager.js";import{Object3D as S}from"../Object3D.js";import{VertexArrayObject as D}from"../VertexArrayObject.js";import{VertexAttribute as A}from"../VertexAttribute.js";import{VertexLayout as U,EdgeInputBufferLayout as B,EdgeShaderAttributeLocations as k,glVertexLayout as L}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as I,SilhouetteEdgeBufferWriter as H}from"./edgeBufferWriters.js";import{EdgeType as V}from"./edgePreprocessing.js";import{EdgeRenderer as G,lineWidthFractionFactor as N,extensionLengthOffset as q}from"./EdgeRenderer.js";import{EdgePassParameters as W}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as z}from"./EdgeWorkerHandle.js";import{Transparency as K}from"./interfaces.js";import{generateStrokesTexture as F}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as J,determineObjectTransparency as X,fillComponenBufferIndices as Y}from"./util.js";import{BufferManager as Z}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as $}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as ee}from"../../../../webgl/BufferObject.js";import{Usage as te}from"../../../../webgl/enums.js";let re=class extends t{constructor(e){super(e),this._updatingHandles=new j,this._perObjectData=new Map,this._perObjectDataEvictionCache=new Set,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=y(),this._localOrigins=new P(new C(e.renderSR))}initialize(){this._worker=new z(this.schedule),this._componentColorManager=new Z(this.rctx,3);const e=U.createBuffer(4);for(let t=0;t<4;t++)e.sideness.set(t,0,0===t||3===t?0:1),e.sideness.set(t,1,0===t||1===t?0:1);this._verticesBufferObject=ee.createVertex(this.rctx,te.STATIC_DRAW,e.buffer)}destroy(){this.destroyed||(this._perObjectData.forEach((e=>this._discardObjectEntry(e))),this._perObjectData.clear(),this._strokesTexture=i(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject=i(this._verticesBufferObject),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",_e))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,o,i,a){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let c;const l=new oe(new Promise((e=>c=e)),r.center,r.radius);this._perObjectData.set(e,l);const d=await this._updatingHandles.addPromise(this._addComponentGeometry(t,l,s,n,o,i,a));return this.setNeedsRender(),c(),d}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const o=this._perObjectData.get(e);let i;o?.renderables.length>0&&this._perObjectDataEvictionCache.add(o);const a=e.boundingVolumeWorldSpace.bounds,c=new oe(new Promise((e=>i=e)),O(a),w(a));this._perObjectData.set(e,c);const l=new Array;if(r.mergeGeometries&&e.geometries.length>1&&ne(e))l.push(this._addObjectMergedGeometries(e,c,t,r,s));else for(let n=0;n<e.geometries.length;n++){const o=e.geometries[n];o.material.supportsEdges&&l.push(this._addGeometry(e,c,o,t[0],r,s))}await this._updatingHandles.addPromise(Promise.all(l)),this._perObjectDataEvictionCache.delete(c),this._discardObjectEntry(o),this.setNeedsRender(),i()}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._perObjectData.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=t instanceof Array?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],o=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(o,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return null!=t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof S,o=!!r.hasSlicePlane,i=Q(t),a=G.getKey(i,o,n),c=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=c&&(c.renderables.forEach((e=>{if(a!==e.rendererKey){const t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(i,o,n);t.removeRenderable(e),--t.refCount,e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&this._updateComponentBuffer(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&(r.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;this._updateComponentBuffer(e.components)})),this.setNeedsRender())}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}removeObject(e){const t=this._perObjectData.get(e);t&&(this._perObjectData.delete(e),this._discardObjectEntry(t))}async _getObjectEntry(e){const t=this._perObjectData.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=y(),n=new x;let o=0,i=0;if(this._renderers.forEach((r=>{if(0===r.refCount)this._renderers.delete(r.key),r.dispose();else{let s=!0,n=!0;r.forEachRenderable((t=>{t.visible&&(o+=t.statistics.averageEdgeLength,i++,s&&t.regular&&(r.updateTechnique(e,!1),s=!1),n&&t.silhouette&&(r.updateTechnique(e,!0),n=!1))}),t)}})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===i)return;const a=new W(40*o/i,t);p(s,r[3],r[7],r[11]),n.set(s),f(a.transformWorldFromViewTH,n.high),f(a.transformWorldFromViewTL,n.low),d(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),u(fe,a.transformViewFromCameraRelativeRS),h(a.transformNormalViewFromGlobal,fe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{this._renderRegularEdges(t,e,a),this._renderSilhouetteEdges(t,e,a)}))}_updateTransparency(e){const t=J(e.components.meta),r=X(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(p(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,M(s.origin.vec3,r),s}_updateComponentBuffer(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,i=t[n].index,a=o(Math.round(e.size*N),0,255),c=o(e.extensionLength,-q,255-q)+q,l="solid"===e.type?V.SOLID:V.SKETCH,d=255*e.opacity,u=e.color,h=255*u[0],m=255*u[1],g=255*u[2],p=255*u[3];r.textureBuffer.setData(i,0,h,m,g,p),r.textureBuffer.setData(i,1,a,c,l,d),v(t[n].verticalOffset,s),r.textureBuffer.setData(i,2,s[0],s[1],s[2],s[3])}}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],o=r.acquireIndex();t.push({index:o,verticalOffset:0,material:s})}const s=new ie(r,t);return this._updateComponentBuffer(s),s}_extractEdges(e,t,r,s,n,o=n.length){return this._worker.process({data:t,indices:n,indicesLength:o,writerSettings:e,skipDeduplicate:r},this._workerAbort.signal,s)}_createRenderable(e,t,r,s,n){const o=t=>null!=this._verticesBufferObject?new ae(new D(this.rctx,k,{vertices:L,instances:t===$.REGULAR?I.glLayout:H.glLayout},{vertices:this._verticesBufferObject,instances:ee.createVertex(this.rctx,te.STATIC_DRAW,t===$.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),t===$.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo):null,i=e.regular.lodInfo.lengths.length>0?o($.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?o($.SILHOUETTE):null,c=(i?.vao.memoryUsage??0)+(a?.vao.memoryUsage??0);return new le(i,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,J(t.meta),X(t.meta),t,s)}async _addGeometry(e,t,r,s,n,o){const i=r.attributes.get(A.POSITION),a=g(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new pe(i,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,o)}async _addPositionData(e,t,r,s,n,o=!1){if(null==e.loaded)return;const i=this._createComponentBuffers([s]);if(null==i||r<=0)return;const a=this._acquireRenderer(s.type,!!n.hasSlicePlane,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,u=t.position,h=u.data.length/u.size,m=B.createBuffer(h);for(let f=0;f<h;f++)m.position.set(f,0,u.data[f*u.size]),m.position.set(f,1,u.data[f*u.size+1]),m.position.set(f,2,u.data[f*u.size+2]);Y(i.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(a.writerSettings,m,!1,o,d,r));if(null==e.loaded)return;const p=this._createRenderable(g,i,new ce(c,l),a.key,!1);e.renderables.push(p),a.addRenderable(p),this._gpuMemoryUsage+=p.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,o,i){if(null==t.loaded)return 0;const a=this._createComponentBuffers(o);if(null==a)return 0;const c=Q(o),l=this._acquireRenderer(c,i.hasSlicePlane||!1,!1),d=B.createBuffer(r.length/3);E(d.position.typedBuffer,r,d.position.typedBufferStride,3),Y(a.meta,n,d.componentIndex,s);const u=!0,h=l.writerSettings,m=await this._updatingHandles.addPromise(this._extractEdges(h,d,u,!1,s));if(null==t.loaded)return 0;const g=this._createRenderable(m,a,e,l.key,!0);return t.renderables.push(g),l.addRenderable(g),g.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const o=new Map;let i=0,a=null,c=0;for(let g=0;g<e.geometries.length;g++){const t=e.geometries[g];if(!t.material.supportsEdges)continue;!a&&t.localOrigin&&(a=t);const r=t.attributes.get(A.POSITION);c+=r.data.length/r.size,i+=t.edgeIndicesLength}const l=c>=65536?Uint32Array:Uint16Array,d=i?new l(i):null,u=[];let h=0;for(let g=0;g<e.geometries.length;g++){const t=e.geometries[g];if(!t.material.supportsEdges)continue;const r=t.attributes.get(A.POSITION),s=r.indices;let n=o.get(r.data);if(null==n){n=u.length/3;for(let e=0;e<r.data.length;e+=r.size)u.push(r.data[e]),u.push(r.data[e+1]),u.push(r.data[e+2]);o.set(r.data,n)}if(s)for(let e=0;e<t.edgeIndicesLength;e++)d[h++]=n+s[e]}const m=a||e.geometries[0],p=g(),f=this._computeModelTransformWithLocalOrigin(e,m,p);for(let g=0;g<e.geometries.length;g++)e.geometries[g].localOrigin=f.origin;const _=new pe(new T(u,d,3),p,f);await this._updatingHandles.addPromise(this._addPositionData(t,_,d.length,r[0],s,n))}_acquireRenderer(e,t,r){const s=G.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=F(this.rctx)),n||(n=new G(this.rctx,this.techniqueRepository,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===R.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){se(e.regular),se(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,"origin"in e.transform&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=y(),n=e=>{_(s,e.center,t);const n=b(s,r),o=e.radius,i=n<-o?1/0:n<o?0:n-o;e.renderables.forEach((e=>e.distanceToCamera=i))};this._perObjectData.forEach(n),this._perObjectDataEvictionCache.forEach(n)}_renderRegularEdges(e,t,r){const s=e.bindRegularEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!ue(n)||!n.visible)return;const i=ge(n.regular.lod.lengths,n.distanceToCamera,o);e.renderRegularEdges(s,n,r,t,i)}),n)}_renderSilhouetteEdges(e,t,r){const s=e.bindSilhouetteEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!me(n)||!n.visible)return;const i=ge(n.silhouette.lod.lengths,n.distanceToCamera,o);e.renderSilhouetteEdges(s,n,r,t,i)}),n)}get test(){return{hasRenderedPrimitives:e=>{let t=!1;const r=e.perScreenPixelRatio,s=(e,s)=>e.forEachRenderable((e=>{e.visible&&!t&&(ue(e)&&(t=ge(e.regular.lod.lengths,e.distanceToCamera,r)>0),!t&&me(e)&&(t=ge(e.silhouette.lod.lengths,e.distanceToCamera,r)>0))}),s);return this._renderers.forEach((e=>{t||(s(e,K.OPAQUE),s(e,K.TRANSPARENT))})),t}}}};function se(e){null!=e&&(e.vao.vertexBuffers.instances.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function ne(e){let t=null,s=null;for(let n=0;n<e.geometries.length;n++){const o=e.geometries[n];if(o.material.supportsEdges){if(t){if(!r(t,o.transformation))return!1}else t=o.transformation;if(s||null==o.localOrigin){if(s&&null!=s.localOrigin&&null!=o.localOrigin&&s.localOrigin.id!==o.localOrigin.id)return!1}else s=o}}return!0}e([c({constructOnly:!0})],re.prototype,"rctx",void 0),e([c({constructOnly:!0})],re.prototype,"renderSR",void 0),e([c({constructOnly:!0})],re.prototype,"viewingMode",void 0),e([c({constructOnly:!0})],re.prototype,"techniqueRepository",void 0),e([c({constructOnly:!0})],re.prototype,"setNeedsRender",void 0),e([c({constructOnly:!0})],re.prototype,"schedule",void 0),e([c({readOnly:!0})],re.prototype,"_updatingHandles",void 0),e([c({readOnly:!0})],re.prototype,"updating",null),re=e([l("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],re);class oe{constructor(e,t,r){this.center=t,this.radius=r,this.renderables=new Array,this.loaded=e,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0)}))}}class ie{constructor(e,t){this.buffer=e,this.meta=t}}class ae{constructor(e,t){this.vao=e,this.lod=t}}class ce{constructor(e,t){this.modelMatrix=e,this.origin=t}}class le{constructor(e,t,r,s,n,o,i,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=o,this.components=i,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class de extends le{}function ue(e){return null!=e.regular}class he extends le{}function me(e){return null!=e.silhouette}function ge(e,t,r){const n=t*r,o=s(e,n,!0);return-1===o?n<e[0]?e.length:0:e.length-o}class pe{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const fe=m(),_e=()=>Promise.reject();export{re as EdgeView,ce as LegacyTransform,de as RegularRenderable,le as Renderable,he as SilhouetteRenderable};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{glLayout as N}from"../../../support/buffer/glUtil.js";import{newLayout as O}from"../../../support/buffer/InterleavedLayout.js";import{VertexAttribute as I}from"../VertexAttribute.js";const
|
|
5
|
+
import{glLayout as N}from"../../../support/buffer/glUtil.js";import{newLayout as O}from"../../../support/buffer/InterleavedLayout.js";import{VertexAttribute as I}from"../VertexAttribute.js";const T=O().vec3f(I.POSITION).u16(I.COMPONENTINDEX),A=O().vec2u8(I.SIDENESS),E=N(A),e=O().vec3f(I.POSITION0).vec3f(I.POSITION1).vec3f(I.NORMAL).u16(I.COMPONENTINDEX).u8(I.VARIANTOFFSET,{glNormalized:!0}).u8(I.VARIANTSTROKE).u8(I.VARIANTEXTENSION,{glNormalized:!0}),S=O().vec3f(I.POSITION0).vec3f(I.POSITION1).vec3f(I.NORMALA).vec3f(I.NORMALB).u16(I.COMPONENTINDEX).u8(I.VARIANTOFFSET,{glNormalized:!0}).u8(I.VARIANTSTROKE).u8(I.VARIANTEXTENSION,{glNormalized:!0}),r=new Map([[I.POSITION0,0],[I.POSITION1,1],[I.COMPONENTINDEX,2],[I.VARIANTOFFSET,3],[I.VARIANTSTROKE,4],[I.VARIANTEXTENSION,5],[I.NORMAL,6],[I.NORMALA,6],[I.NORMALB,7],[I.SIDENESS,8]]);export{T as EdgeInputBufferLayout,r as EdgeShaderAttributeLocations,e as RegularEdgeInstancesLayout,S as SilhouetteEdgeInstancesLayout,A as VertexLayout,E as glVertexLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{deduplicate as e}from"../../../../../geometry/support/meshUtils/deduplicate.js";import{computeNeighbors as t}from"../../../support/meshProcessing.js";import{newLayout as
|
|
5
|
+
import{deduplicate as e}from"../../../../../geometry/support/meshUtils/deduplicate.js";import{computeNeighbors as t}from"../../../support/meshProcessing.js";import{newLayout as r}from"../../../support/buffer/InterleavedLayout.js";import{VertexAttribute as i}from"../VertexAttribute.js";import{EdgeInputBufferLayout as s}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as n,SilhouetteEdgeBufferWriter as o}from"./edgeBufferWriters.js";import{extractEdges as c}from"./edgePreprocessing.js";function f(e){const t=u(e.data,e.skipDeduplicate,e.indices,e.indicesLength);return g.updateSettings(e.writerSettings),a.updateSettings(e.writerSettings),c(t,g,a)}function u(r,i,n,o){if(i){const e=t(n,o,r.count);return new p(n,o,e,r)}const c=e(r.buffer,r.stride/4,{originalIndices:n,originalIndicesLength:o}),f=t(c.indices,o,c.uniqueCount);return{faces:c.indices,facesLength:c.indices.length,neighbors:f,vertices:s.createView(c.buffer)}}class p{constructor(e,t,r,i){this.faces=e,this.facesLength=t,this.neighbors=r,this.vertices=i}}const g=new n,a=new o,d=r().vec3f(i.POSITION0).vec3f(i.POSITION1),m=r().vec3f(i.POSITION0).vec3f(i.POSITION1).u16(i.COMPONENTINDEX);export{f as extract,m as extractComponentsEdgeLocationsLayout,u as extractEdgeInformation,d as extractEdgeLocationsLayout};
|