@arcgis/core 4.28.0-next.20230919 → 4.28.0-next.20230921
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/Color.js +1 -1
- package/WebScene.js +1 -1
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/executionError.js +1 -1
- package/arcade/featureset/support/errorsupport.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/06621efb2573fad23b45.js +1 -0
- package/assets/esri/core/workers/chunks/072b4e041b8630c513a0.js +1 -0
- package/assets/esri/core/workers/chunks/101f776316a85b708927.js +1 -0
- package/assets/esri/core/workers/chunks/107546ef77a45d31c7ac.js +1 -0
- package/assets/esri/core/workers/chunks/10fd951bd296b2beeeba.js +1 -0
- package/assets/esri/core/workers/chunks/114269dda1d296893908.js +1 -0
- package/assets/esri/core/workers/chunks/126df6237fc80608344e.js +1 -0
- package/assets/esri/core/workers/chunks/134524cf6b1ebf208338.js +1 -0
- package/assets/esri/core/workers/chunks/17a36704e63ca1b34c5d.js +1 -0
- package/assets/esri/core/workers/chunks/1c83f47d446f2bca1721.js +1 -0
- package/assets/esri/core/workers/chunks/{09d395a9786607294689.js → 1c8469fbde39d85ee622.js} +1 -1
- package/assets/esri/core/workers/chunks/1cbaba30f55f00f7498b.js +1 -0
- package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +1 -0
- package/assets/esri/core/workers/chunks/{506874f562ce11f8914a.js → 243a4eed107d363dfad8.js} +1 -1
- package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +1 -0
- package/assets/esri/core/workers/chunks/2a1c1be9c202462cf54d.js +1 -0
- package/assets/esri/core/workers/chunks/2bb69d76a13564e8e455.js +1 -0
- package/assets/esri/core/workers/chunks/2d0d03cbea83c868edba.js +1 -0
- package/assets/esri/core/workers/chunks/2e130cb2f1038055c07b.js +1 -0
- package/assets/esri/core/workers/chunks/32ba4eba730e9232d964.js +1 -0
- package/assets/esri/core/workers/chunks/{b428fcb53ecc82b49e66.js → 332689bf60d246485993.js} +1 -1
- package/assets/esri/core/workers/chunks/3619e04cbb6691549014.js +1 -0
- package/assets/esri/core/workers/chunks/37116fb4c68cf3c3890a.js +1 -0
- package/assets/esri/core/workers/chunks/{3a7ad0d24264e2bc2e87.js → 3ca759f72d3bb29e9ea9.js} +22 -22
- package/assets/esri/core/workers/chunks/3dbfb4f370a874393822.js +1 -0
- package/assets/esri/core/workers/chunks/3f4e9b1663ec521bfe00.js +1 -0
- package/assets/esri/core/workers/chunks/406db5c90271a3a203d4.js +1 -0
- package/assets/esri/core/workers/chunks/4339ce8aaf87fabb80cc.js +1 -0
- package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +1 -0
- package/assets/esri/core/workers/chunks/43ba2bacd0f7d19915f7.js +1 -0
- package/assets/esri/core/workers/chunks/44b8e75593b7df1843e1.js +1 -0
- package/assets/esri/core/workers/chunks/467a821d05df8ec0dc1c.js +1 -0
- package/assets/esri/core/workers/chunks/47be4c75dd6372b96fe4.js +1 -0
- package/assets/esri/core/workers/chunks/53097659f31750c03a6d.js +1 -0
- package/assets/esri/core/workers/chunks/{c1141056581af072aee9.js → 580039dd491854ca325c.js} +1 -1
- package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +1 -0
- package/assets/esri/core/workers/chunks/5a5720caa64a46daadf9.js +1 -0
- package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +1 -0
- package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +1 -0
- package/assets/esri/core/workers/chunks/652749dc847fcb887234.js +1 -0
- package/assets/esri/core/workers/chunks/6c495077cc79e1898927.js +1 -0
- package/assets/esri/core/workers/chunks/{e5c3beebd507e1dda35f.js → 749fc49246093d693227.js} +1 -1
- package/assets/esri/core/workers/chunks/74d3ecb1a06d9f81e2c5.js +1 -0
- package/assets/esri/core/workers/chunks/77c15b1c2729c780f75a.js +1 -0
- package/assets/esri/core/workers/chunks/7ea33aa455c5143affb1.js +1 -0
- package/assets/esri/core/workers/chunks/7ed70c96fbfe00792e7c.js +1 -0
- package/assets/esri/core/workers/chunks/8ab832468300cc4feb5a.js +1 -0
- package/assets/esri/core/workers/chunks/90771b0de3e520a1df9a.js +1 -0
- package/assets/esri/core/workers/chunks/94188fe381239d48a975.js +1 -0
- package/assets/esri/core/workers/chunks/a277c980ba8704939688.js +1 -0
- package/assets/esri/core/workers/chunks/b1746c022fe6edaeda55.js +1 -0
- package/assets/esri/core/workers/chunks/b449d6bd5851187d419f.js +1 -0
- package/assets/esri/core/workers/chunks/bbc0dcd316c5598bc9ad.js +1 -0
- package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +1 -0
- package/assets/esri/core/workers/chunks/bc6323bdc98013da6fe5.js +1 -0
- package/assets/esri/core/workers/chunks/bde89b2684b6185992ef.js +1 -0
- package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +1 -0
- package/assets/esri/core/workers/chunks/{727548fffd4e270617d3.js → c6ea5aac232d1eca04dd.js} +1 -1
- package/assets/esri/core/workers/chunks/c8438c2d9ac48afe4033.js +1 -0
- package/assets/esri/core/workers/chunks/c9dfb145f0c1d93e0fbd.js +1 -0
- package/assets/esri/core/workers/chunks/cad260881653567bc8f9.js +1 -0
- package/assets/esri/core/workers/chunks/cec607d0138351a4952e.js +1 -0
- package/assets/esri/core/workers/chunks/d24afa6d8fd0061d9f00.js +1 -0
- package/assets/esri/core/workers/chunks/{f147269d85adfb4588ed.js → d9061beaa43065316062.js} +1 -1
- package/assets/esri/core/workers/chunks/dd7508d4016715371e0c.js +1 -0
- package/assets/esri/core/workers/chunks/dff1c3c38dda2bd1a9d6.js +1 -0
- package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +1 -0
- package/assets/esri/core/workers/chunks/eb01f4cdb9b918cc61e7.js +1 -0
- package/assets/esri/core/workers/chunks/ec8258c9dc1491e97fc8.js +1 -0
- package/assets/esri/core/workers/chunks/ed1fbc1bc8d50453e2f5.js +1 -0
- package/assets/esri/core/workers/chunks/eeac53da496de4cd4182.js +1 -0
- package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +1 -0
- package/assets/esri/core/workers/chunks/f38c54ada9e7012a2960.js +1 -0
- package/assets/esri/core/workers/chunks/f508ccfde6425dabe9ac.js +1 -0
- package/assets/esri/core/workers/chunks/f5e0ff5292b9fd18fc92.js +1 -0
- package/assets/esri/core/workers/chunks/f5eb8b5021620be7538e.js +1 -0
- package/assets/esri/images/portal/onlinemedialayer16.png +0 -0
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +2 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ar.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bg.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ca.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_cs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_da.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_de.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_el.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_en.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_es.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_et.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_he.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hu.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_id.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_it.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ja.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ko.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lt.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nb.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ro.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ru.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_th.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_tr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_uk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_vi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_en.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
- package/chunks/LaserlinePath.glsl.js +5 -1
- package/core/HandleOwner.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/date.js +5 -0
- package/core/sql.js +1 -1
- package/core/string.js +1 -1
- package/interfaces.d.ts +60 -43
- package/intl/date.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/ImageryLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/WFSLayer.js +1 -1
- package/layers/graphics/sources/GeoJSONSource.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/graphics/sources/WFSSource.js +1 -1
- package/layers/graphics/sources/WFSSourceWorker.js +1 -1
- package/layers/graphics/sources/csv/csv.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/{views/interactive/tooltip/tooltipInfoUnion.js → layers/graphics/sources/support/QueryEngineBuildLayer.js} +1 -0
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/mixins/SceneService.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/save/utils.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/labelFormatUtils.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/layers/support/rasterFunctionUtils.js +1 -1
- package/layers/support/rasterFunctions/creators/createBandIndexFunctions.js +1 -1
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
- package/layers/support/rasterFunctions/creators/createLocalFunctions.js +1 -1
- package/networks/support/utils.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/rest/geometryService/cut.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/versionManagement/deleteVersion.js +1 -1
- package/rest/versionManagement/gdbVersion/alterVersion.js +1 -1
- package/rest/versionManagement/gdbVersion/post.js +1 -1
- package/rest/versionManagement/gdbVersion/reconcile.js +1 -1
- package/rest/versionManagement/gdbVersion/serverVersionUtils.js +5 -0
- package/support/revision.js +1 -1
- package/time/timeZoneUtils.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/WGLMeshFactory.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/sources/StreamSource.js +1 -1
- package/views/2d/layers/features/support/whereUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/externalRenderers/StageRenderer.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/overlayImageUtils.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/dito.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js +10 -12
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js +8 -21
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/Attribute.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/support/HighlightHelper.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/layerUtils.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/keybindings.js +1 -1
- package/views/interactive/tooltip/SketchTooltipInfo.js +1 -1
- package/views/interactive/tooltip/TooltipContentWithHelpMessage.js +1 -1
- package/views/interactive/tooltip/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/TranslateTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/Fields.js +5 -0
- 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/layers/FeatureLayerView.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/webdoc/saveAPIKeyUtils.js +5 -0
- package/webdoc/webdocSaveUtils.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/EditableInput.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
- package/widgets/UtilityNetworkTrace/support/UtilityHelper.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/support/SketchTooltipControls.js +1 -1
- package/widgets/support/globalCss.js +1 -1
- package/assets/esri/core/workers/chunks/0274b84548cb048562e4.js +0 -1
- package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +0 -1
- package/assets/esri/core/workers/chunks/0839b45999fcb556e460.js +0 -1
- package/assets/esri/core/workers/chunks/09589852b129bfb5624f.js +0 -1
- package/assets/esri/core/workers/chunks/132e9e6147304ffd128d.js +0 -1
- package/assets/esri/core/workers/chunks/1790ca4193d730f5f206.js +0 -1
- package/assets/esri/core/workers/chunks/1a449168d30a688e6128.js +0 -1
- package/assets/esri/core/workers/chunks/1c94624fd001c803a814.js +0 -1
- package/assets/esri/core/workers/chunks/25ab3bec45de900be36e.js +0 -1
- package/assets/esri/core/workers/chunks/273167b2dd46e58b8739.js +0 -1
- package/assets/esri/core/workers/chunks/2c5eb8aaad696fa16744.js +0 -1
- package/assets/esri/core/workers/chunks/353bad8530710a284592.js +0 -1
- package/assets/esri/core/workers/chunks/357d452b8522185cc433.js +0 -1
- package/assets/esri/core/workers/chunks/3c2be3d204e6bf87266a.js +0 -1
- package/assets/esri/core/workers/chunks/3c2c64832fb498bbaa83.js +0 -1
- package/assets/esri/core/workers/chunks/3c4d59018ce8502c65e7.js +0 -1
- package/assets/esri/core/workers/chunks/43eff89599f36d83924b.js +0 -1
- package/assets/esri/core/workers/chunks/4632ada4af99cab70a61.js +0 -1
- package/assets/esri/core/workers/chunks/481eab7879ed5d8a1f67.js +0 -1
- package/assets/esri/core/workers/chunks/4b3a5cc435435c81e6a5.js +0 -1
- package/assets/esri/core/workers/chunks/4f34fd8c2bb769541e9c.js +0 -1
- package/assets/esri/core/workers/chunks/4f5a0bc7411c0db33662.js +0 -1
- package/assets/esri/core/workers/chunks/56a4cea67cc579bf7547.js +0 -1
- package/assets/esri/core/workers/chunks/56afd89d08c874f620a1.js +0 -1
- package/assets/esri/core/workers/chunks/5b08d578521562b166e3.js +0 -1
- package/assets/esri/core/workers/chunks/5f938d6da9fd3f3edc74.js +0 -1
- package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +0 -1
- package/assets/esri/core/workers/chunks/656a8be4ce1bec721366.js +0 -1
- package/assets/esri/core/workers/chunks/7531ebc60e9ae61220e0.js +0 -1
- package/assets/esri/core/workers/chunks/77923afde29ae1ff10ca.js +0 -1
- package/assets/esri/core/workers/chunks/79683324be49aab79dd8.js +0 -1
- package/assets/esri/core/workers/chunks/7cdb4416afd5922cf5f3.js +0 -1
- package/assets/esri/core/workers/chunks/7e87bc83a0a2715e3016.js +0 -1
- package/assets/esri/core/workers/chunks/7f680cf24dd97d61bcd2.js +0 -1
- package/assets/esri/core/workers/chunks/7f797fed73cf7b48a686.js +0 -1
- package/assets/esri/core/workers/chunks/861609ebd3a77b787b0f.js +0 -1
- package/assets/esri/core/workers/chunks/869c3927f1e246cd1e42.js +0 -1
- package/assets/esri/core/workers/chunks/95371c0f5464f5daae9f.js +0 -1
- package/assets/esri/core/workers/chunks/962b99fd273709c726d3.js +0 -1
- package/assets/esri/core/workers/chunks/98fbcbb2115376d7ff62.js +0 -1
- package/assets/esri/core/workers/chunks/9abcd1d11bfd92f872ab.js +0 -1
- package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +0 -1
- package/assets/esri/core/workers/chunks/9dab9f6c07ececa7f851.js +0 -1
- package/assets/esri/core/workers/chunks/9ff6ce486898713af7e2.js +0 -1
- package/assets/esri/core/workers/chunks/a98a435d4dbea73f7517.js +0 -1
- package/assets/esri/core/workers/chunks/b05bb6e784e5453696be.js +0 -1
- package/assets/esri/core/workers/chunks/b51d0ec283f61f638a48.js +0 -1
- package/assets/esri/core/workers/chunks/b5ee6c0c07fa50410370.js +0 -1
- package/assets/esri/core/workers/chunks/b9cf8f02974aeb3ce208.js +0 -1
- package/assets/esri/core/workers/chunks/bdf13091bd0e1ab0db7e.js +0 -1
- package/assets/esri/core/workers/chunks/bef1a1218a94ab6e2b51.js +0 -1
- package/assets/esri/core/workers/chunks/c22c2b15fe5f2c97a2ae.js +0 -1
- package/assets/esri/core/workers/chunks/c880d2f0ff06b3bf731f.js +0 -1
- package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +0 -1
- package/assets/esri/core/workers/chunks/cc96be71fee49f07dcd4.js +0 -1
- package/assets/esri/core/workers/chunks/e4237360eef474d1f0ac.js +0 -1
- package/assets/esri/core/workers/chunks/e54ae2a4281dd58e0707.js +0 -1
- package/assets/esri/core/workers/chunks/e977e721f6f50e3c5f13.js +0 -1
- package/assets/esri/core/workers/chunks/ed31cf6688c0f7dac1f9.js +0 -1
- package/assets/esri/core/workers/chunks/f07a0ea10428adecea1a.js +0 -1
- package/assets/esri/core/workers/chunks/f1eab5c67ed808c18f86.js +0 -1
- package/assets/esri/core/workers/chunks/f2e7142a8db164940544.js +0 -1
- package/assets/esri/core/workers/chunks/f939b4166f76975f5da0.js +0 -1
- package/assets/esri/core/workers/chunks/ff4f4107a866e4a68386.js +0 -1
- package/layers/ogc/dateUtils.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{_ 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,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?.fbo),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.render(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 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};
|
|
@@ -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 t from"../../../../core/PooledArray.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 i}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as n}from"../../../../chunks/vec2f64.js";import{OverlayTarget as o}from"../../terrain/Intersector.js";import{ChangeSet as a}from"./ChangeSet.js";import{newIntersectorResult as d}from"./Intersector.js";import{StoreResults as h,IntersectorType as l}from"./IntersectorInterfaces.js";import{DirtyOperation as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import t from"../../../../core/PooledArray.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 i}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as n}from"../../../../chunks/vec2f64.js";import{OverlayTarget as o}from"../../terrain/Intersector.js";import{ChangeSet as a}from"./ChangeSet.js";import{newIntersectorResult as d}from"./Intersector.js";import{StoreResults as h,IntersectorType as l}from"./IntersectorInterfaces.js";import{DirtyOperation as p,DirtyState as c}from"./ModelDirtyTypes.js";import{splitRenderGeometryChangeSetByMaterial as m}from"./rendererUtils.js";import{MergedRenderer as g}from"../materials/renderers/MergedRenderer.js";let u=class extends r{constructor(e){super(e),this._pending=new y,this._changes=new a,this._materialRenderers=new t,this._sortedMaterialRenderers=new t,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this._changes.prune(),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._sortedMaterialRenderers.clear(),this._geometries.clear(),this._pending.clear()}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _materialRepository(){return this.rendererContext.materialRepository}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return this._materialRenderers.some((e=>e.rendersOccluded))}get isEmpty(){return!this.updating&&0===this._materialRenderers.length&&0===this._geometries.size}getMemoryForMaterial(e){if(null==e)return 0;const r=this._materialRenderers.find((r=>r.material===e));return r?.usedMemory??0}commitChanges(){if(!this.updating)return!1;this._processAddsRemoves();const e=m(this._changes);let r=!1,t=!1,s=!1;return e.forEach(((e,i)=>{let n=this._materialRenderers.find((e=>e.material===i));if(!n&&e.adds.length>0){const e=new g({material:i});e.initializeRenderContext(this.rendererContext.pluginContext,this._materialRepository),n=e,this._materialRenderers.push(n),r=!0,t=!0,s=!0}if(!n)return;const o=t||n.hasHighlights,a=s||n.hasWater;n.modify(e),t=t||o!==n.hasHighlights,s=s||a!==n.hasWater,n.isEmpty&&(this._materialRenderers.removeUnordered(n),n.dispose(),r=!0)})),this._changes.clear(),r&&this._updateSortedMaterialRenderers(),t&&(this._hasHighlights=this._materialRenderers.some((e=>e.hasHighlights))),s&&(this._hasWater=this._materialRenderers.some((e=>e.hasWater))),this.notifyChange("updating"),!0}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);s&&this.notifyChange("updating"),r===p.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,r){const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),r===p.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=this._changes.updates.pushNew();e.renderGeometry=this._validateRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case c.TRANSFORMATION:case c.GEOMETRY:return this._notifyGraphicGeometryChanged(e);case c.VISIBILITY:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedMaterialRenderers.forAll((t=>r=t.updateAnimation(e)||r)),r}shouldRender(e){return this._sortedMaterialRenderers.some((r=>r.prepareTechnique(e)))}render(e){this._sortedMaterialRenderers.forAll((r=>{const t=r.prepareTechnique(e);null!=t&&r.renderNode(e,t)}))}intersect(e,r,t,s,i){return this._geometries.forEach((n=>{if(s&&!s(n))return;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere[0]-n.boundingSphere[3]<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere[0]+n.boundingSphere[3]>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++})),i}_updateSortedMaterialRenderers(){this._sortedMaterialRenderers.clear(),this._materialRenderers.forAll(((e,r)=>{e.priority=r,this._sortedMaterialRenderers.push(e)})),this._sortedMaterialRenderers.sort(((e,r)=>r.material.renderPriority===e.material.renderPriority?e.priority-r.priority:r.material.renderPriority-e.material.renderPriority))}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes));for(let e=0;e<this._changes.updates.length;){const r=this._changes.updates.data[e];this._pending.has(r.renderGeometry)?this._changes.updates.removeUnorderedIndex(e):e++}this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible)return;let o=0;s+=e.transformation[12],o=e.transformation[13],f[0]=t[0]-s,f[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectDraped(e,null,i,f,((t,s,o)=>{_(r,o,e.material.renderPriority,n,i,e.layerUid,e.graphicUid)}),r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const t of e){const e=t.graphicUid;null!=e&&e!==r&&(this.drapeSource.notifyGraphicGeometryChanged(e),r=e)}}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const t of e){const e=t.graphicUid;null!=e&&e!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(e),r=e)}}_validateRenderGeometries(e){for(const r of e)this._validateRenderGeometry(r);return e}_validateRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere)),e}get test(){return{sortedMaterialRenderers:this._sortedMaterialRenderers}}};e([s()],u.prototype,"drapeSource",void 0),e([s()],u.prototype,"updating",null),e([s()],u.prototype,"rctx",null),e([s({constructOnly:!0})],u.prototype,"rendererContext",void 0),e([s()],u.prototype,"_materialRepository",null),e([s()],u.prototype,"_localOriginFactory",null),e([s({readOnly:!0})],u.prototype,"isEmpty",null),e([s()],u.prototype,"_materialRenderers",void 0),e([s()],u.prototype,"_geometries",void 0),u=e([i("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],u);class y{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function _(e,r,t,s,i,n,a){const p=new o(n,a,r),c=r=>{r.set(l.OVERLAY,p,e.dist,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.dist||i.results.ground.dist<=i.results.min.dist)&&c(i.results.min),i.options.store!==h.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.dist||i.results.ground.dist>i.results.max.dist)&&c(i.results.max),i.options.store===h.ALL){const e=d(i.ray);c(e),i.results.all.push(e)}}const f=n();export{u as SortedRenderGeometryRenderer};
|
|
@@ -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 a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{s as o}from"../../../../chunks/vec4.js";import{c as l}from"../../../../chunks/vec4f64.js";import{ContentObjectType as c}from"./ContentObjectType.js";import{textTextureAtlas as d}from"./testUtils.js";import{applyTextureResizeModulo as _}from"./textureUtils.js";import{VertexAttribute as m}from"./VertexAttribute.js";import{TaskPriority as u,Task as g}from"../../../support/Scheduler.js";import{TextureWrapMode as p,TextureSamplingMode as f}from"../../../webgl/enums.js";import{Texture as x}from"../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";const y=4096;class j{constructor(){this.offset={x:0,y:0},this.uvMinMax=l()}}class b{constructor(e,t){this.textId=e,this.textRenderer=t,this.placement=new j,this.rendered=!1}}class v{constructor(e,t,s){this.size=e,this.cursor=t,this.lineHeight=s}resetCursor(){this.cursor.x=this.cursor.y=this.lineHeight=0}}let z=class extends t{constructor(e){super(e),this.type=c.Texture,this.id=n(),this.events=new s,this._glTexture=null,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._atlas=new v({width:y,height:256},{x:0,y:0},0),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this.updating=!1,this.events.emit("unloaded")}get glTexture(){return this._glTexture}get maxSize(){return y-k-A}load(e){if(this._glTexture)return this._glTexture;const t=new T;return t.wrapMode=p.CLAMP_TO_EDGE,t.flipped=!0,t.samplingMode=f.LINEAR_MIPMAP_LINEAR,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new x(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(u.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements=null,this._elementsToRender=null,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.size.width.toString()),this._canvas.setAttribute("height",e.size.height.toString())}_resizeAtlas(e){const t=this._atlas;t.size.height=e,this._glTexture?.resize(t.size.width,t.size.height),this._updateCanvasElementSize(t)}_reset(){this._elements.forEach((e=>e.rendered=!1)),this._elementsToRender.clear(),this._atlas.resetCursor(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas,{renderedWidth:n,renderedHeight:a}=e.textRenderer;e.placement.offset.x=r.cursor.x,e.placement.offset.y=r.cursor.y,o(e.placement.uvMinMax,e.placement.offset.x/r.size.width,1-(e.placement.offset.y+a)/r.size.height,(e.placement.offset.x+n)/r.size.width,1-e.placement.offset.y/r.size.height),r.cursor.x+=s,r.lineHeight=Math.max(r.lineHeight,i),this._elements.set(t,e)}_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.geometryVertexAttrsUpdated(t.geometries[0]),this._elementsToRender.delete(e))}_processAddition(e){const t=e.textId;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,n=i+k,a=r+k+A;if(s.cursor.x+n<s.size.width&&s.cursor.y+a<s.size.height)this._addAtlasElement(e,t,n,a),this._elementsToRender.set(t,e);else if(s.cursor.y+a+s.lineHeight<s.size.height)s.cursor.x=0,s.cursor.y+=s.lineHeight,s.lineHeight=0,this._addAtlasElement(e,t,n,a),this._elementsToRender.set(t,e);else{if(this._canRepack)this._reset();else if(s.size.height<y){const e=s.cursor.y+a+s.lineHeight-s.size.height,t=Math.ceil(s.size.height*Math.max(1.3,(e+s.size.height)/s.size.height));this._resizeAtlas(Math.min(_(t),y)),this._reset()}this._elements.set(t,e)}}_renderElement(e){this._ctx.clearRect(e.placement.offset.x-k,e.placement.offset.y-k,e.textRenderer.renderedWidth+2*k,e.textRenderer.renderedHeight+2*k),e.textRenderer.render(this._ctx,e.placement.offset.x,e.placement.offset.y);const t=this._stageObjects.get(e.textId);t?.forEach((t=>R(t,e))),e.rendered=!0}get running(){return this.updating}runTask(e){if(null==this._glTexture)return g.YIELD;for(;this._needsRepack&&(this._canRepack||this._atlas.size.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,i=this._elements.get(s)||new b(s,e);if(this._addStageObject(s,t),i?.rendered){const e=this._stageObjects.get(s);e&&e.forEach((e=>R(e,i)))}else this._processAddition(i);this.setDirty()}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=>i._resizeAtlas(e),run:e=>i.runTask(e)}}};function R(e,t){e.geometries[0].setAttributeData(m.UV0,t.placement.uvMinMax),e.geometries[0].setAttributeData(m.SIZE,[t.textRenderer.displayWidth,t.textRenderer.displayHeight]),e.geometryVertexAttrsUpdated(e.geometries[0])}e([a({constructOnly:!0})],z.prototype,"view",void 0),e([a({type:Boolean})],z.prototype,"updating",void 0),z=e([h("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],z);const k=2,A=2;export{z 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{_ 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 O}from"../../../../../core/support/UpdatingHandles.js";import{g as j,a as w}from"../../../../../chunks/sphere.js";import{c as E}from"../../../../../chunks/vec33.js";import{ViewingMode as v}from"../../../../ViewingMode.js";import{encodeElevationOffset as R}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 I,SilhouetteEdgeBufferWriter as L}from"./edgeBufferWriters.js";import{EdgeType as H}from"./edgePreprocessing.js";import{EdgeRenderer as V,lineWidthFractionFactor as N,extensionLengthOffset as G}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 O,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)),j(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*N),0,255),c=o(e.extensionLength,-G,255-G)+G,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),R(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?I.glLayout:L.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.vertexAttributes.get(D.POSITION),a=r.indices.get(D.POSITION),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.vertexAttributes.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.vertexAttributes.get(D.POSITION),s=t.indices.get(D.POSITION);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===v.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{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};
|
|
@@ -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{s as t,g as n,i as
|
|
5
|
+
import{s as t,g as n,i as e,r as s}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{areaPoints3d as o}from"../../../../geometry/support/triangle.js";function c(s,r){if(!s)return!1;const{size:c,data:i,indices:f}=s;t(r,0,0,0),t(m,0,0,0);let d=0,g=0;for(let p=0;p<f.length-2;p+=3){const s=f[p]*c,h=f[p+1]*c,j=f[p+2]*c;t(a,i[s],i[s+1],i[s+2]),t(u,i[h],i[h+1],i[h+2]),t(l,i[j],i[j+1],i[j+2]);const z=o(a,u,l);z?(n(a,a,u),n(a,a,l),e(a,a,1/3*z),n(r,r,a),d+=z):(n(m,m,a),n(m,m,u),n(m,m,l),g+=3)}return(0!==g||0!==d)&&(0!==d?(e(r,r,1/d),!0):0!==g&&(e(r,m,1/g),!0))}function i(n,s){if(!n)return!1;const{size:r,data:o,indices:c}=n;t(s,0,0,0);let i=-1,f=0;for(let t=0;t<c.length;t++){const n=c[t]*r;i!==n&&(s[0]+=o[n],s[1]+=o[n+1],s[2]+=o[n+2],f++),i=n}return f>1&&e(s,s,1/f),f>0}function f(r,o,c){if(!r)return!1;t(c,0,0,0),t(m,0,0,0);let i=0,f=0;const{size:l,data:d,indices:g}=r,p=g.length-1,h=p+(o?2:0);for(let t=0;t<h;t+=2){const r=t<p?t+1:0,o=g[t<p?t:p]*l,h=g[r]*l;a[0]=d[o],a[1]=d[o+1],a[2]=d[o+2],u[0]=d[h],u[1]=d[h+1],u[2]=d[h+2],e(a,n(a,a,u),.5);const j=s(a,u);j>0?(n(c,c,e(a,a,j)),i+=j):0===i&&(n(m,m,a),f++)}return 0!==i?(e(c,c,1/i),!0):0!==f&&(e(c,m,1/f),!0)}const a=r(),u=r(),l=r(),m=r();export{f as computeAttachmentOriginLines,i as computeAttachmentOriginPoints,c as computeAttachmentOriginTriangles};
|
|
@@ -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{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{a as o}from"../../../../../chunks/mat4f64.js";import{f as l,j as c,e as h}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec3f64.js";import{c as u,f as m}from"../../../../../chunks/vec4f64.js";import{debugFlags as p}from"../../../support/debugFlags.js";import{glLayout as f}from"../../../support/buffer/glUtil.js";import{newLayout as _}from"../../../support/buffer/InterleavedLayout.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as I}from"../../effects/RenderPlugin.js";import{Camera as y}from"../Camera.js";import{Default3D as C}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as D}from"../Util.js";import{VertexAttribute as R}from"../VertexAttribute.js";import{InstanceData as b,StateFlags as T}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as N}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as x}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as H}from"../../../../webgl/Util.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends I{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new y,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>this._produces(e)],[A.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new b({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=f(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>e.material.produces(A.TRANSPARENT_MATERIAL,g.Color)))))}hasHighlights(){return this._highlightRenderInstanceData[0].some((e=>e.size>0))}_produces(e){return e!==g.Highlight&&e!==g.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!p.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}render(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==g.Highlight&&e!==g.ShadowHighlight,r=e!==g.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.isVisible()||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;D(0!=(n&T.ACTIVE),"invalid instance state"),D(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&T.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&T.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&T.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&T.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&T.REMOVE)s.freeInstance(l);else if(h&T.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),e>=0&&(h&T.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=T.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=T.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&T.ACTIVE),t=!!(d&T.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&T.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const a=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return null!=a?a.beginSlot(e.bindParameters):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a.material.parameters,n);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),o.bindDraw(Q,n,a.material.parameters),p.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===g.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",N.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,C,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),H(i,C,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(D(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(D(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(D(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){x(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=_().vec3f(R.INSTANCEMODELORIGINHI).vec3f(R.INSTANCEMODELORIGINLO).mat3f(R.INSTANCEMODEL).mat3f(R.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(R.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(R.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(R.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{a as o}from"../../../../../chunks/mat4f64.js";import{f as l,j as c,e as h}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec3f64.js";import{c as u,f as m}from"../../../../../chunks/vec4f64.js";import{debugFlags as p}from"../../../support/debugFlags.js";import{glLayout as f}from"../../../support/buffer/glUtil.js";import{newLayout as _}from"../../../support/buffer/InterleavedLayout.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as I}from"../../effects/RenderPlugin.js";import{Camera as y}from"../Camera.js";import{Default3D as C}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as D}from"../Util.js";import{VertexAttribute as R}from"../VertexAttribute.js";import{InstanceData as b,StateFlags as T}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as N}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as x}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as H}from"../../../../webgl/Util.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends I{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new y,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>this._produces(e)],[A.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new b({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=f(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>e.material.produces(A.TRANSPARENT_MATERIAL,g.Color)))))}hasHighlights(){return this._highlightRenderInstanceData[0].some((e=>e.size>0))}_produces(e){return e!==g.Highlight&&e!==g.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!p.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}renderNode(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==g.Highlight&&e!==g.ShadowHighlight,r=e!==g.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.isVisible()||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;D(0!=(n&T.ACTIVE),"invalid instance state"),D(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&T.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&T.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&T.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&T.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&T.REMOVE)s.freeInstance(l);else if(h&T.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),e>=0&&(h&T.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=T.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=T.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&T.ACTIVE),t=!!(d&T.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&T.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const a=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return null!=a?a.beginSlot(e.bindParameters):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a.material.parameters,n);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),o.bindDraw(Q,n,a.material.parameters),p.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===g.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",N.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,C,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),H(i,C,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(D(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(D(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(D(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){x(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=_().vec3f(R.INSTANCEMODELORIGINHI).vec3f(R.INSTANCEMODELORIGINLO).mat3f(R.INSTANCEMODEL).mat3f(R.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(R.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(R.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(R.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
|
|
@@ -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{unique as e}from"../../../../../core/arrayUtils.js";import{VertexAttribute as t}from"../VertexAttribute.js";class s{constructor(e,t=null){this.geometry=e,this.textures=t}}class r{constructor(e,s,r){this.components=e,this.minScreenSpaceRadius=s,this.pivotOffset=r;const n=this.geometries;this.numVertices=n.reduce(((e,s)=>e+s.
|
|
5
|
+
import{unique as e}from"../../../../../core/arrayUtils.js";import{VertexAttribute as t}from"../VertexAttribute.js";class s{constructor(e,t=null){this.geometry=e,this.textures=t}}class r{constructor(e,s,r){this.components=e,this.minScreenSpaceRadius=s,this.pivotOffset=r;const n=this.geometries;this.numVertices=n.reduce(((e,s)=>e+s.attributes.get(t.POSITION).indices.length),0)}get geometries(){return e(this.components.map((e=>e.geometry)))}}class n{constructor(e){this.levels=e,this.levels.sort(((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius))}}function c(t){const s=[];return t.levels.forEach((e=>e.components.forEach((e=>s.push(e.geometry.material))))),e(s)}function o(t){const s=new Array;return t.levels.forEach((e=>e.components.forEach((e=>{null!=e.textures&&s.push(...e.textures)})))),e(s)}function i(t){const s=new Array;return t.levels.forEach((e=>e.components.forEach((e=>s.push(e.geometry))))),e(s)}export{s as LodComponentResources,r as LodLevelResources,n as LodResources,i as geometriesFromLodResources,c as materialsFromLodResources,o as texturesFromLodResources};
|
|
@@ -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{VertexAttribute as t}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as e}from"./internal/bufferWriterUtils.js";class r{constructor(t){this.vertexBufferLayout=t}elementCount(e){return e.
|
|
5
|
+
import{VertexAttribute as t}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as e}from"./internal/bufferWriterUtils.js";class r{constructor(t){this.vertexBufferLayout=t}elementCount(e){return e.attributes.get(t.POSITION).indices.length}write(t,r,i,o,s){e(i,this.vertexBufferLayout,t,r,o,s)}}export{r as DefaultBufferWriter};
|
|
@@ -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 has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{a as s}from"../../../../chunks/mat3f64.js";import{i as r}from"../../../../chunks/mat4.js";import{a as i}from"../../../../chunks/mat4f64.js";import{j as a}from"../../../../chunks/vec2.js";import{a as n,f as o}from"../../../../chunks/vec2f64.js";import{s as c,e as l,n as f,f as u,i as p,c as h,l as m,o as d,t as g,j as S,g as A}from"../../../../chunks/vec3.js";import{c as O,f as v}from"../../../../chunks/vec3f64.js";import{b as T,c as b,f as x}from"../../../../chunks/vec4f64.js";import{isMat4 as I}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as P}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as E}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as R}from"../../support/debugFlags.js";import{newLayout as y}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as j}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as C,GLTextureMaterialBindParameters as L}from"../lib/GLTextureMaterial.js";import{Material as D,RenderOccludedFlag as M}from"../lib/Material.js";import{RenderSlot as z}from"../lib/RenderSlot.js";import{applyScaleFactor as w,applyPrecomputedScaleFactor as F,precomputeScaleFactor as V}from"../lib/screenSizePerspectiveUtils.js";import{assert as N}from"../lib/Util.js";import{VertexAttribute as B}from"../lib/VertexAttribute.js";import{ScaleInfo as X}from"./ScaleInfo.js";import{writePosition as k,writeNormal as G,writeColor as W,writeBufferVec4 as H,writeBufferVec4Zeros as q,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as J}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as K}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as Q}from"../shaders/HUDMaterialTechniqueConfiguration.js";class $ extends D{constructor(e){super(e,new be),this._configuration=new Q}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?j.Screen:j.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===z.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===U.Color||e===U.Alpha),e===U.Color&&(this._configuration.debugDrawLabelBorder=!!R.LABELS_SHOW_BORDER),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,i,a,n,o){if(!(i.options.selectionMode&&i.options.hud&&e.visible&&i.point))return;const g=this.parameters,S=i.point,A=i.camera;let{scaleX:v,scaleY:T}=this._getScreenScale(e);v*=A.pixelRatio,T*=A.pixelRatio,t(ue,s),e.vertexAttributes.has(B.FEATUREATTRIBUTE)&&se(ue);const b=e.vertexAttributes.get(B.POSITION),x=e.vertexAttributes.get(B.SIZE),I=e.vertexAttributes.get(B.NORMAL),_=e.vertexAttributes.get(B.AUXPOS1);N(b.size>=3);const P=J(g),E="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<b.data.length/b.size;t++){const e=t*b.size;c(ne,b.data[e],b.data[e+1],b.data[e+2]),l(ne,ne,s);const a=t*x.size;ve[0]=x.data[a]*v,ve[1]=x.data[a+1]*T,l(ne,ne,A.viewMatrix);const n=t*_.size;if(c(me,_.data[n],_.data[n+1],_.data[n+2]),!E&&(ne[0]+=me[0],ne[1]+=me[1],0!==me[2])){const e=me[2];f(me,ne),u(ne,ne,p(me,me,e))}const R=t*I.size;if(c(oe,I.data[R],I.data[R+1],I.data[R+2]),this._normalAndViewAngle(oe,ue,A,Se),this._applyVerticalOffsetTransformationView(ne,Se,A,ie),A.applyProjection(ne,ce),ce[0]>-1){E&&(me[0]||me[1])&&(ce[0]+=me[0]*A.pixelRatio,0!==me[1]&&(ce[1]+=w(me[1],ie.factorAlignment)*A.pixelRatio),A.unapplyProjection(ce,ne)),ce[0]+=this.parameters.screenOffset[0]*A.pixelRatio,ce[1]+=this.parameters.screenOffset[1]*A.pixelRatio,ce[0]=Math.floor(ce[0]),ce[1]=Math.floor(ce[1]),F(ve,ie.factor,ve);const e=Ae*A.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*A.pixelRatio/2),re(S,ce[0],ce[1],ve,e,t,g,P)){const e=i.ray;if(l(fe,ne,r(he,A.viewMatrix)),ce[0]=S[0],ce[1]=S[1],A.unprojectFromRenderScreen(ce,ne)){const t=O();h(t,e.direction);const s=1/m(t);p(t,t,s);o(d(e.origin,ne)*s,t,-1,!0,1,fe)}}}}}intersectDraped(e,t,s,r,i,a){const n=e.vertexAttributes.get(B.POSITION),o=e.vertexAttributes.get(B.SIZE),c=this.parameters,l=J(c);let{scaleX:f,scaleY:u}=this._getScreenScale(e);f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=Oe*e.screenToWorldRatio;for(let h=0;h<n.data.length/n.size;h++){const t=h*n.size,s=n.data[t],m=n.data[t+1],d=h*o.size;ve[0]=o.data[d]*f,ve[1]=o.data[d+1]*u;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,s,m,ve,p,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new _e(this)}_normalAndViewAngle(e,s,r,i){return I(s)&&(s=t(pe,s)),g(i.normal,e,s),l(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=S(le,Te),i}_updateScaleInfo(e,t,s){const r=this.parameters;null!=r.screenSizePerspective?V(s,t,r.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=r.screenSizePerspectiveAlignment?V(s,t,r.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,s,r,i,a,n){const o=this._normalAndViewAngle(t,s,i,Se);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,r[3],i,n),this._applyCenterOffsetView(n,r,n),n}applyShaderOffsetsNDC(e,t,s,r,i){return this._applyCenterOffsetNDC(e,t,s,r),null!=i&&h(i,r),this._applyPolygonOffsetNDC(r,t,s,r),r}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const l=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return p(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,s,r){const i=m(e),a=s.aboveGround?1:-1,n=.5*s.computeRenderPixelSizeAtDist(i),o=p(ne,t.normal,a*n);return A(r,e,o),r}_applyVerticalOffsetTransformationView(e,t,s,r){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const s=m(e);this._updateScaleInfo(r,s,t.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return e}const a=m(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(s,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(r,a,t.cosAngle),p(t.normal,t.normal,o),A(e,e,t.normal)}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(f(oe,s),A(s,s,p(oe,oe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t[3]);r[2]-=(a||e)*i}return r}produces(e,t){if(t===U.Color||t===U.Alpha||t===U.Highlight||t===U.ObjectAndLayerIdColor){if(e===z.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:s}=this.parameters;return e===(t?z.LABEL_MATERIAL:z.HUD_MATERIAL)||s&&e===z.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new ee(e)}calculateRelativeScreenBounds(e,t,s=_()){return te(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}_getScreenScale(e){const t=e.vertexAttributes.get(B.FEATUREATTRIBUTE);if(null==t)return{scaleX:1,scaleY:1};const s=T(t.data,ge),[r,i]=E(de,this.parameters,s);return{scaleX:r,scaleY:i}}}class ee extends C{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(K,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function te(e,t,s,r=ae){return a(r,e.anchorPosition),r[0]*=-t[0],r[1]*=-t[1],r[0]+=e.screenOffset[0]*s,r[1]+=e.screenOffset[1]*s,r}function se(e){const t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+s*s+r*r),u=1/Math.sqrt(i*i+a*a+n*n),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=s*f,e[2]=r*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function re(e,t,s,r,i,a,n,o){let c=t-i-(o[0]>0?r[0]*o[0]:0),l=c+r[0]+2*i,f=s-i-(o[1]>0?r[1]*o[1]:0),u=f+r[1]+2*i;const p=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=p&&(c+=r[0]*p[0],f+=r[1]*p[1],l-=r[0]*(1-p[2]),u-=r[1]*(1-p[3]),c-=a,l+=a,f-=a,u+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const ie=new X,ae=n(),ne=O(),oe=O(),ce=b(),le=O(),fe=O(),ue=s(),pe=s(),he=i(),me=O(),de=b(),ge=b(),Se={normal:le,cosAngle:0},Ae=1,Oe=2,ve=[0,0],Te=v(0,0,1);class be extends L{constructor(){super(...arguments),this.renderOccluded=M.Occlude,this.isDecoration=!1,this.color=x(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=o(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=x(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const xe=y().vec3f(B.POSITION).vec3f(B.NORMAL).vec2f(B.UV0).vec4u8(B.COLOR).vec2f(B.SIZE).vec4f(B.AUXPOS1).vec4f(B.FEATUREATTRIBUTE),Ie=xe.clone().vec4u8(B.OBJECTANDLAYERIDCOLOR);class _e{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?Ie:xe}elementCount(e){return 6*e.indices.get(B.POSITION).length}write(e,t,s,r,i){k(s.indices.get(B.POSITION),s.vertexAttributes.get(B.POSITION).data,e,r.position,i,6),G(s.indices.get(B.NORMAL),s.vertexAttributes.get(B.NORMAL).data,t,r.normal,i,6);const a=s.vertexAttributes.get(B.UV0).data;let n,o,c,l;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,c=e.texCoordScale[0],l=e.texCoordScale[1]}else n=a[0],o=a[1],c=a[2],l=a[3];c=Math.min(1.99999,c+1),l=Math.min(1.99999,l+1);let f=s.indices.get(B.POSITION).length,u=i;const p=r.uv0;for(let g=0;g<f;++g)p.set(u,0,n),p.set(u,1,o),u++,p.set(u,0,c),p.set(u,1,o),u++,p.set(u,0,c),p.set(u,1,l),u++,p.set(u,0,c),p.set(u,1,l),u++,p.set(u,0,n),p.set(u,1,l),u++,p.set(u,0,n),p.set(u,1,o),u++;W(s.indices.get(B.COLOR),s.vertexAttributes.get(B.COLOR).data,4,r.color,i,6);const h=s.indices.get(B.SIZE),m=s.vertexAttributes.get(B.SIZE).data;f=h.length;const d=r.size;u=i;for(let g=0;g<f;++g){const e=m[2*h[g]],t=m[2*h[g]+1];for(let s=0;s<6;++s)d.set(u,0,e),d.set(u,1,t),u++}if(s.indices.get(B.AUXPOS1)&&s.vertexAttributes.get(B.AUXPOS1)?H(s.indices.get(B.AUXPOS1),s.vertexAttributes.get(B.AUXPOS1).data,r.auxpos1,i,6):q(r.auxpos1,i,6*f),s.indices.get(B.FEATUREATTRIBUTE)&&s.vertexAttributes.get(B.FEATUREATTRIBUTE)?H(s.indices.get(B.FEATUREATTRIBUTE),s.vertexAttributes.get(B.FEATUREATTRIBUTE).data,r.featureAttribute,i,6):q(r.featureAttribute,i,6*f),null!=s.objectAndLayerIdColor){if(s.indices.get(B.POSITION)){const e=s.indices.get(B.POSITION).length,t=r.getField(B.OBJECTANDLAYERIDCOLOR,P);Y(s.objectAndLayerIdColor,t,e,i,6)}}}}export{$ as HUDMaterial,be as Parameters};
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{a as s}from"../../../../chunks/mat3f64.js";import{i as r}from"../../../../chunks/mat4.js";import{a as i}from"../../../../chunks/mat4f64.js";import{j as a}from"../../../../chunks/vec2.js";import{a as n,f as o}from"../../../../chunks/vec2f64.js";import{s as c,e as l,n as f,f as u,i as p,c as h,l as m,o as d,t as g,j as S,g as O}from"../../../../chunks/vec3.js";import{c as b,f as A}from"../../../../chunks/vec3f64.js";import{b as v,c as T,f as _}from"../../../../chunks/vec4f64.js";import{isMat4 as I}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as y}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as P}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as E}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as R}from"../../support/debugFlags.js";import{newLayout as x}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as j}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as U,GLTextureMaterialBindParameters as D}from"../lib/GLTextureMaterial.js";import{Material as L,RenderOccludedFlag as z}from"../lib/Material.js";import{RenderSlot as M}from"../lib/RenderSlot.js";import{applyScaleFactor as w,applyPrecomputedScaleFactor as V,precomputeScaleFactor as F}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{VertexAttribute as N}from"../lib/VertexAttribute.js";import{ScaleInfo as k}from"./ScaleInfo.js";import{writePosition as X,writeNormal as G,writeColor as W,writeBufferVec4 as H,writeBufferVec4Zeros as q,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as J}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as K}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as Q}from"../shaders/HUDMaterialTechniqueConfiguration.js";class $ extends L{constructor(e){super(e,new Te),this._configuration=new Q}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?C.Screen:C.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===M.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===j.Color||e===j.Alpha),e===j.Color&&(this._configuration.debugDrawLabelBorder=!!R.LABELS_SHOW_BORDER),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,i,a,n,o){if(!(i.options.selectionMode&&i.options.hud&&e.visible&&i.point))return;const g=this.parameters,S=i.point,O=i.camera;let{scaleX:A,scaleY:v}=this._getScreenScale(e);A*=O.pixelRatio,v*=O.pixelRatio,t(ue,s),e.attributes.has(N.FEATUREATTRIBUTE)&&se(ue);const T=e.attributes.get(N.POSITION),_=e.attributes.get(N.SIZE),I=e.attributes.get(N.NORMAL),y=e.attributes.get(N.AUXPOS1);B(T.size>=3);const P=J(g),E="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<T.data.length/T.size;t++){const e=t*T.size;c(ne,T.data[e],T.data[e+1],T.data[e+2]),l(ne,ne,s);const a=t*_.size;Ae[0]=_.data[a]*A,Ae[1]=_.data[a+1]*v,l(ne,ne,O.viewMatrix);const n=t*y.size;if(c(me,y.data[n],y.data[n+1],y.data[n+2]),!E&&(ne[0]+=me[0],ne[1]+=me[1],0!==me[2])){const e=me[2];f(me,ne),u(ne,ne,p(me,me,e))}const R=t*I.size;if(c(oe,I.data[R],I.data[R+1],I.data[R+2]),this._normalAndViewAngle(oe,ue,O,Se),this._applyVerticalOffsetTransformationView(ne,Se,O,ie),O.applyProjection(ne,ce),ce[0]>-1){E&&(me[0]||me[1])&&(ce[0]+=me[0]*O.pixelRatio,0!==me[1]&&(ce[1]+=w(me[1],ie.factorAlignment)*O.pixelRatio),O.unapplyProjection(ce,ne)),ce[0]+=this.parameters.screenOffset[0]*O.pixelRatio,ce[1]+=this.parameters.screenOffset[1]*O.pixelRatio,ce[0]=Math.floor(ce[0]),ce[1]=Math.floor(ce[1]),V(Ae,ie.factor,Ae);const e=Oe*O.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*O.pixelRatio/2),re(S,ce[0],ce[1],Ae,e,t,g,P)){const e=i.ray;if(l(fe,ne,r(he,O.viewMatrix)),ce[0]=S[0],ce[1]=S[1],O.unprojectFromRenderScreen(ce,ne)){const t=b();h(t,e.direction);const s=1/m(t);p(t,t,s);o(d(e.origin,ne)*s,t,-1,!0,1,fe)}}}}}intersectDraped(e,t,s,r,i,a){const n=e.attributes.get(N.POSITION),o=e.attributes.get(N.SIZE),c=this.parameters,l=J(c);let{scaleX:f,scaleY:u}=this._getScreenScale(e);f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=be*e.screenToWorldRatio;for(let h=0;h<n.data.length/n.size;h++){const t=h*n.size,s=n.data[t],m=n.data[t+1],d=h*o.size;Ae[0]=o.data[d]*f,Ae[1]=o.data[d+1]*u;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,s,m,Ae,p,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new ye(this)}_normalAndViewAngle(e,s,r,i){return I(s)&&(s=t(pe,s)),g(i.normal,e,s),l(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=S(le,ve),i}_updateScaleInfo(e,t,s){const r=this.parameters;null!=r.screenSizePerspective?F(s,t,r.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=r.screenSizePerspectiveAlignment?F(s,t,r.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,s,r,i,a,n){const o=this._normalAndViewAngle(t,s,i,Se);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,r[3],i,n),this._applyCenterOffsetView(n,r,n),n}applyShaderOffsetsNDC(e,t,s,r,i){return this._applyCenterOffsetNDC(e,t,s,r),null!=i&&h(i,r),this._applyPolygonOffsetNDC(r,t,s,r),r}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const l=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return p(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,s,r){const i=m(e),a=s.aboveGround?1:-1,n=.5*s.computeRenderPixelSizeAtDist(i),o=p(ne,t.normal,a*n);return O(r,e,o),r}_applyVerticalOffsetTransformationView(e,t,s,r){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const s=m(e);this._updateScaleInfo(r,s,t.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return e}const a=m(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(s,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(r,a,t.cosAngle),p(t.normal,t.normal,o),O(e,e,t.normal)}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(f(oe,s),O(s,s,p(oe,oe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t[3]);r[2]-=(a||e)*i}return r}produces(e,t){if(t===j.Color||t===j.Alpha||t===j.Highlight||t===j.ObjectAndLayerIdColor){if(e===M.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:s}=this.parameters;return e===(t?M.LABEL_MATERIAL:M.HUD_MATERIAL)||s&&e===M.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new ee(e)}calculateRelativeScreenBounds(e,t,s=y()){return te(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}_getScreenScale(e){const t=e.attributes.get(N.FEATUREATTRIBUTE);if(null==t)return{scaleX:1,scaleY:1};const s=v(t.data,ge),[r,i]=E(de,this.parameters,s);return{scaleX:r,scaleY:i}}}class ee extends U{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(K,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function te(e,t,s,r=ae){return a(r,e.anchorPosition),r[0]*=-t[0],r[1]*=-t[1],r[0]+=e.screenOffset[0]*s,r[1]+=e.screenOffset[1]*s,r}function se(e){const t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+s*s+r*r),u=1/Math.sqrt(i*i+a*a+n*n),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=s*f,e[2]=r*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function re(e,t,s,r,i,a,n,o){let c=t-i-(o[0]>0?r[0]*o[0]:0),l=c+r[0]+2*i,f=s-i-(o[1]>0?r[1]*o[1]:0),u=f+r[1]+2*i;const p=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=p&&(c+=r[0]*p[0],f+=r[1]*p[1],l-=r[0]*(1-p[2]),u-=r[1]*(1-p[3]),c-=a,l+=a,f-=a,u+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const ie=new k,ae=n(),ne=b(),oe=b(),ce=T(),le=b(),fe=b(),ue=s(),pe=s(),he=i(),me=b(),de=T(),ge=T(),Se={normal:le,cosAngle:0},Oe=1,be=2,Ae=[0,0],ve=A(0,0,1);class Te extends D{constructor(){super(...arguments),this.renderOccluded=z.Occlude,this.isDecoration=!1,this.color=_(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=o(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=_(1,1,1,1),this.outlineSize=0,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const _e=x().vec3f(N.POSITION).vec3f(N.NORMAL).vec2f(N.UV0).vec4u8(N.COLOR).vec2f(N.SIZE).vec4f(N.AUXPOS1).vec4f(N.FEATUREATTRIBUTE),Ie=_e.clone().vec4u8(N.OBJECTANDLAYERIDCOLOR);class ye{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?Ie:_e}elementCount(e){return 6*e.attributes.get(N.POSITION).indices.length}write(e,t,s,r,i){X(s.attributes.get(N.POSITION),e,r.position,i,6),G(s.attributes.get(N.NORMAL),t,r.normal,i,6);const a=s.attributes.get(N.UV0).data;let n,o,c,l;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,c=e.texCoordScale[0],l=e.texCoordScale[1]}else n=a[0],o=a[1],c=a[2],l=a[3];c=Math.min(1.99999,c+1),l=Math.min(1.99999,l+1);let f=s.attributes.get(N.POSITION).indices.length,u=i;const p=r.uv0;for(let g=0;g<f;++g)p.set(u,0,n),p.set(u,1,o),u++,p.set(u,0,c),p.set(u,1,o),u++,p.set(u,0,c),p.set(u,1,l),u++,p.set(u,0,c),p.set(u,1,l),u++,p.set(u,0,n),p.set(u,1,l),u++,p.set(u,0,n),p.set(u,1,o),u++;W(s.attributes.get(N.COLOR),4,r.color,i,6);const{data:h,indices:m}=s.attributes.get(N.SIZE);f=m.length;const d=r.size;u=i;for(let g=0;g<f;++g){const e=h[2*m[g]],t=h[2*m[g]+1];for(let s=0;s<6;++s)d.set(u,0,e),d.set(u,1,t),u++}if(s.attributes.get(N.AUXPOS1)?H(s.attributes.get(N.AUXPOS1),r.auxpos1,i,6):q(r.auxpos1,i,6*f),s.attributes.get(N.FEATUREATTRIBUTE)?H(s.attributes.get(N.FEATUREATTRIBUTE),r.featureAttribute,i,6):q(r.featureAttribute,i,6*f),null!=s.objectAndLayerIdColor){const e=s.attributes.get(N.POSITION)?.indices;if(e){const t=e.length,a=r.getField(N.OBJECTANDLAYERIDCOLOR,P);Y(s.objectAndLayerIdColor,a,t,i,6)}}}}export{$ as HUDMaterial,Te as Parameters};
|
|
@@ -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{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as
|
|
5
|
+
import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as p}from"../shaders/HeatmapDensityTechnique.js";const h=2;class T extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends o{constructor(t){super(t,new T),this._configuration=new m}produces(t,e){return t===n.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new d(t)}intersect(){}intersectDraped(r,s,i,a,o,n){const l=r.attributes.get(u.POSITION),{parameters:c}=this,{searchRadius:f}=c,{screenToWorldRatio:m}=r,p=f*m+h*m,T=p*p,b=l.data.length/l.size;for(let u=0;u<b;u++){const r=u*l.size,s=t(E,l.data[r],l.data[r+1]);e(s,a)<T&&o(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new g(this.parameters.isAttributeDriven?I:A)}}class d extends a{beginSlot(t){return this.ensureTechnique(p,t)}}class g{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.attributes.get(u.POSITION).indices.length*v}write(t,e,r,s,i){l(r.attributes.get(u.POSITION),t,s.position,i,v);const a=r.attributes.get(u.POSITION).indices.length,o=s.uv0;let n=i;for(let u=0;u<a;++u)o.setValues(n++,-1,-1),o.setValues(n++,1,-1),o.setValues(n++,1,1),o.setValues(n++,1,1),o.setValues(n++,-1,1),o.setValues(n++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&c(r.attributes.get(u.FEATUREATTRIBUTE),f,i,v)}}const A=s().vec3f(u.POSITION).vec2f(u.UV0),I=A.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{b as HeatmapDensityMaterial,T as HeatmapDensityMaterialParameters};
|
|
@@ -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{BufferViewFloat as t}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as r}from"../lib/basicInterfaces.js";import{GLTextureMaterial as
|
|
5
|
+
import{BufferViewFloat as t}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as r}from"../lib/basicInterfaces.js";import{GLTextureMaterial as s}from"../lib/GLTextureMaterial.js";import{MaterialParameters as i}from"../lib/Material.js";import{OITPolygonOffsetLimit as a}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as o}from"../lib/Util.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as c}from"./TriangleMaterial.js";import{writeBufferFloat as h,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as f,ImageMaterialTechniqueConfiguration as d,ImageMaterialTechnique as _}from"../shaders/ImageMaterialTechnique.js";class g extends c{constructor(t){super(t,new T),this.supportsEdges=!0,this._vertexAttributeLocations=f,this._configuration=new d}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<a,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}produces(t,r){if(r===e.Color||r===e.Alpha||r===e.Highlight){if(t===n.DRAPED_MATERIAL)return!0;if(r===e.Highlight)return t===n.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?n.TRANSPARENT_MATERIAL:n.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:n.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new E(t)}createBufferWriter(){const t=p.clone();return this.parameters.perspectiveInterpolation&&t.f32(u.PERSPECTIVEDIVIDE),new A(t)}}class E extends s{constructor(t){super({...t,...t.material.parameters})}_updateParameters(t){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(_,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:t.hasOccludees}),this._updateParameters(t))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class A extends l{write(e,r,s,i,a){for(const n of this.vertexBufferLayout.fields.keys()){const l=s.attributes.get(n);if(l)if(n===u.PERSPECTIVEDIVIDE){o(1===l.size);const e=i.getField(n,t);e&&h(l,e,a)}else m(n,l,e,r,i,a)}}}class T extends i{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=r.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0,this.perspectiveInterpolation=!1}}export{g as ImageMaterial,T as Parameters};
|