@arcgis/core 6.0.0-next.54 → 6.0.0-next.55
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/WebScene.js +2 -2
- package/applications/Components/OrientedImageryViewer/shared/constants.js +1 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/validation/arcadeValidator.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0329fa3aa3403f1c243b.js +1 -0
- package/assets/esri/core/workers/chunks/{6602310c3fcd91fb6a2f.js → 07c8ac092e4b9e8d5b3c.js} +1 -1
- package/assets/esri/core/workers/chunks/0a97b1974367382cfdf5.js +1 -0
- package/assets/esri/core/workers/chunks/{db0a7671ab5cbe8afd72.js → 123661019bb69c53f2d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{d14732a57c8e63948c60.js → 14259910f44c08fd5bbd.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b41ba050cde068d2860.js → 193a73a2c7f4f8482c21.js} +1 -1
- package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +1 -0
- package/assets/esri/core/workers/chunks/{e507dfc4788295d9c244.js → 249a687ce1b6d0815242.js} +1 -1
- package/assets/esri/core/workers/chunks/{afb4dfb89fbc8a342cc5.js → 3354f1fa90f8ce4c8fde.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b458b0d1627f22fdd93.js → 3b11e4d2e69b7aea1d65.js} +1 -1
- package/assets/esri/core/workers/chunks/41694ee8990e799da225.js +1 -0
- package/assets/esri/core/workers/chunks/{e592f2483db71230e8e5.js → 4401b3f8ebb658abe789.js} +1 -1
- package/assets/esri/core/workers/chunks/{12add2003631fa314f25.js → 5060be52a380fc4920f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{2aa6be0b047a1b25a520.js → 53bbb9aa6e4e4a0a8121.js} +1 -1
- package/assets/esri/core/workers/chunks/{4707aedcc1b3bdf5e987.js → 5c34d49a6c9cc34b7626.js} +1 -1
- package/assets/esri/core/workers/chunks/69a09c6acb5ae03c67f6.js +1 -0
- package/assets/esri/core/workers/chunks/7b156905d168bf973518.js +1 -0
- package/assets/esri/core/workers/chunks/{e83806797979138fd22a.js → 844c593754b2692257f4.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d3e977f3b75474d7ebc.js → 846248697c398468d8e6.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7e33d37dd11fb08f3f8.js → 97107e64407fa6825620.js} +1 -1
- package/assets/esri/core/workers/chunks/{032733b863426c5bde00.js → 9e508f930086d2ef5f22.js} +3 -3
- package/assets/esri/core/workers/chunks/{5118c7269b706089c88e.js → a05a2c2aaf0c288f9681.js} +1 -1
- package/assets/esri/core/workers/chunks/{817bf487df056da1e6ec.js → a116dd204921e7464944.js} +1 -1
- package/assets/esri/core/workers/chunks/{944f17e9c9f681b971fb.js → a12e2a345005189c64be.js} +1 -1
- package/assets/esri/core/workers/chunks/{15b3386ad92a0b4149b8.js → a24dc5350af001db417a.js} +1 -1
- package/assets/esri/core/workers/chunks/{10967a36c77c5188690d.js → a66d6298236d59a615db.js} +1 -1
- package/assets/esri/core/workers/chunks/{255f5b45c4d32f97f86c.js → ac0861014b3d2f1a1de2.js} +1 -1
- package/assets/esri/core/workers/chunks/ace210d313ce53f3ae10.js +1 -0
- package/assets/esri/core/workers/chunks/ae48ee283cfa5b3c14b0.js +1 -0
- package/assets/esri/core/workers/chunks/bbd8fcb0bbba7bde3d9b.js +1 -0
- package/assets/esri/core/workers/chunks/{ac8d38016e4bee37a77c.js → be0b8bb4f09aae6ff5de.js} +1 -1
- package/assets/esri/core/workers/chunks/d0659f1b0495734be4b3.js +1 -0
- package/assets/esri/core/workers/chunks/{b9a2b05ede02c305e865.js → d8ffb1502def5c85740b.js} +1 -1
- package/assets/esri/core/workers/chunks/{7dfe1e78d2e66de6be22.js → d9ef244019954d5a8a27.js} +1 -1
- package/assets/esri/core/workers/chunks/{95403bb27a4ea0a4b7b1.js → ddbfa664e69612295785.js} +1 -1
- package/assets/esri/core/workers/chunks/{c6d82397044e403a1f61.js → e61082f56c08abe54b3a.js} +1 -1
- package/assets/esri/core/workers/chunks/{55d28d3f5b8ced061e39.js → eaf73ce60f39a48ddd2a.js} +1 -1
- package/assets/esri/core/workers/chunks/ed2f2a5da830d058e339.js +1 -0
- package/assets/esri/core/workers/chunks/{944cb751c85d3a127f49.js → f52d081bbde5c95265cf.js} +1 -1
- package/assets/esri/core/workers/chunks/{1de9be7b65109c207bd5.js → fbd5f3b81cd9f061824d.js} +1 -1
- package/assets/esri/layers/raster/formats/blosc-wasm.wasm +0 -0
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/basemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/chunks/CypherParser.js +1 -1
- package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/blosc-wasm.js +2 -0
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/parquet.js +1 -1
- package/chunks/text.js +1 -1
- package/config.js +1 -1
- package/core/sql/SqlInterval.js +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/geometryEngine.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/support/Ellipsoid.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/geodesicConstants.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/parquet.js +1 -1
- package/layers/raster/datasets/ZarrRaster.js +1 -1
- package/layers/raster/datasets/wcsCoverageParser.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/blosc.js +2 -0
- package/layers/support/BuildingFilter.js +1 -1
- package/layers/support/IntegratedMeshSemantics.js +1 -1
- package/layers/support/fieldUtils.d.ts +23 -87
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/layersMapping.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/libs/ajv/ajv.bundle-wrapper.js +1 -1
- package/package.json +4 -4
- package/renderers/types.d.ts +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
- package/smartMapping/statistics/support/attributeDensity.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/tests/serviceMockDependencies.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
- package/symbols/cim/rasterizingUtils.js +1 -1
- package/views/2d/PaddedViewState.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
- package/views/2d/engine/vectorTiles/constants.js +1 -1
- package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/ParquetLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/EnvironmentView.js +1 -1
- package/views/3d/focusAreaUtils.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.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/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolFactory.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +1 -1
- package/views/3d/layers/support/selectTiles3DSpatialReference.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/state/Constraints.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/RenderCoordsHelper.js +1 -1
- package/views/3d/support/SweptSphereVolume.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/engineContent/marker.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TilingSchemeLogic.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/MapView.d.ts +1 -0
- package/views/SceneView.js +1 -1
- package/views/View2D.js +1 -1
- package/views/ViewingMode.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/helpMessageUtils.js +1 -1
- package/views/draw/support/managers/EditSessionManager.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/AddOrUpdatePart.js +1 -1
- package/views/layers/support/editableLayerViews.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/spatialReferenceSupport.js +1 -1
- package/views/webgl/ShaderTranspiler.js +2 -2
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Legend/styles/card/ColorRamp.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Measurement.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/Weather/css.js +1 -1
- package/widgets/Weather.js +1 -1
- package/assets/esri/core/workers/chunks/021bd07b9a3e70598840.js +0 -1
- package/assets/esri/core/workers/chunks/170e68624b71ac96de4a.js +0 -1
- package/assets/esri/core/workers/chunks/8a820e303941b351de81.js +0 -1
- package/assets/esri/core/workers/chunks/90d567e920b6982b402d.js +0 -1
- package/assets/esri/core/workers/chunks/97cdcedfe853280f6258.js +0 -1
- package/assets/esri/core/workers/chunks/9ebc6026934400fc1e1f.js +0 -1
- package/assets/esri/core/workers/chunks/b4a325dcf50e276751d7.js +0 -1
- package/assets/esri/core/workers/chunks/be5857b0d1b00faf430b.js +0 -1
- package/assets/esri/core/workers/chunks/cd9100a7c8309dfa7569.js +0 -1
- package/assets/esri/core/workers/chunks/e58f51618251f74aaafd.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import"../../../../../core/has.js";import{clone as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../../../core/Logger.js";import a from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as c}from"../../../../../core/typedArrayUtil.js";import{create as l}from"../../../../../geometry/support/aaBoundingBox.js";import{d as u}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec32.js";import{compactIndices as f}from"../../../../../geometry/support/Indices.js";import{BufferObject as p}from"../../../../webgl/BufferObject.js";import{PrimitiveType as m}from"../../../../webgl/enums.js";import{VertexBuffer as h}from"../../../../webgl/VertexBuffer.js";import{SamplerRepository as g}from"../../lib/SamplerRepository.js";import{BufferManager as _}from"../../lib/TextureBackedBuffer/BufferManager.js";import{VertexArrayObject as v}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as y}from"../../lib/verticalOffsetUtils.js";import{getComponentDataLayout as b,IndexGlLayout as x}from"../../materials/DefaultLayouts.js";import{ComponentData as S}from"./ComponentData.js";import{defaultComponentParameters as C,ComponentDrawParametersImplementation as w}from"./ComponentDrawParameters.js";import{ComponentObject as T}from"./ComponentObject.js";import{IntersectionGeometry as E}from"./IntersectionGeometry.js";import{ComponentMaterialParameters as D}from"./Material/ComponentMaterialInitParameters.js";import{ComponentMaterialRepository as O}from"./Material/ComponentMaterialRepository.js";import{RenderableMeta as k,Renderable as A}from"./Renderable.js";import{RenderGeometry as j}from"./RenderGeometry.js";import{RenderSubmitSystem as M}from"./RenderSubmitSystem.js";const N=()=>i.getLogger(`esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection`);let P=class extends t{constructor(e,t,n){super(),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new a,this._hidden=new a,this._renderSubmit=new M(this),this._renderPassManager.register(this._renderSubmit);let{rctx:r,bind:i}=e;this._componentBufferManager=new _(r,b());let c=this._viewingMode===2?0:n?1:2;this.materials=new O(i,c),this.samplers=new g(r.gl),this.addHandles(o(()=>i.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){let{geometry:n}=e,r=new S(this._componentBufferManager,f(n.componentOffsets)),i=this._createRenderable(e,t,r),a=new E(this._viewingMode,n.positions,r,e.elevationAlignable),o=new T(this,e.transform,e.obb.clone(),r,i,a,e.aabbInWorldCoordinates);return(o.visible?this._visible:this._hidden).push(o),o}destroyObject(e){let t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){let n=e;t!==n.visible&&(t?(this._hidden.removeUnordered(n),this._visible.push(n)):(this._visible.removeUnordered(n),this._hidden.push(n)),n.visible=t,this._requestRender())}preSubmit(e){let{camera:t,highlights:n}=e;this._updateHighlightsInOrder(n),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t,n){let r=e;(r.opacity!==t||n!==void 0&&n!==r.renderable.material.parameters.groundTransparencyMode)&&(r.updateOpacity(t,n),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){let n=e;n.componentData.visibility.reset(t),n.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){let{componentData:t}=e,n=t.visibility.componentCount;return{visible:n,invisible:t.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,n,r=!1){e.intersectionGeometry.getComponentAabb(t,n);let i=e,a=i.componentData.verticalOffsets;if(r||a==null)return n;let o=a[t];if(this._viewingMode===2||o===0)return n[2]+=o,n[5]+=o,n;let s=y(o);return s.localOrigin=i.transform.position,s.applyToAabb(n)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,n){return e.intersectionGeometry.getComponentPositions(t,n)}_updateHighlightsInOrder(e){if(this._highlights===e)return;let{_highlightsInOrder:t}=this,n=Math.min(e.length,8),r=t.length!==n;for(let i=0;i<n;++i)if(t[i]!==e[i].name){r=!0;break}if(this._highlights=e,r){t.length=n;for(let r=0;r<n;++r)t[r]=e[r].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){let e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,n,r){!Number.isNaN(this._elevationRangeCacheVerticalOffset)&&this._elevationRangeCacheVerticalOffset===t&&r.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);let i=e,{componentData:a}=i,o=a.count,{verticalOffsets:s}=a,{intersectionGeometry:c}=i,l=this._viewingMode===2,u=c.getComponentAabbs(),d=F,f=1/0,p=-1/0;for(let e=0;e<o;e++){let a=e*6,o=s?.[e]??0,c=1/0,m=-1/0;if(l)c=u[a+2]+o+t,m=u[a+5]+o+t;else{if(d[0]=u[a],d[1]=u[a+1],d[2]=u[a+2],d[3]=u[a+3],d[4]=u[a+4],d[5]=u[a+5],o!==0){let e=y(o);e.localOrigin=i.transform.position,e.applyToAabb(d)}let e=Math.max(Math.abs(d[3]),Math.abs(d[0])),s=Math.max(Math.abs(d[4]),Math.abs(d[1])),c=t+d[5]+n;r.expandElevationRangeValues(t+d[2],Math.sqrt(e*e+s*s+c*c)-n)}r.expandElevationRangeValues(c,m),f=Math.min(f,c),p=Math.max(p,m)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=f,this._elevationRangeCacheMax=p}intersectRay(e,t,n,r,i,a){let{transform:o,componentData:s,intersectionGeometry:c}=e;r!=null&&(r.localOrigin=o.position),c.intersectRay(t,n,r,s.verticalOffsets,o,i,a)}*intersectScreenPolygon(e,t,n,r,i){let{transform:a,componentData:o,intersectionGeometry:s}=e;r!=null&&(r.localOrigin=a.position),yield*s.intersectScreenPolygon(t,n,r,o.verticalOffsets,a,i)}addEdges(e,t,n,r,i){let a=e,{indices:o,positions:s}=a.intersectionGeometry,c=a.componentData.offsets;return t.addComponentObject(a,s,o,c,n,r,i)}async extractEdgeInformation(e,t,n){let i=e,a=i.componentData.visibility;if(a.allInvisible()){let{extractComponentsEdgeLocationsLayout:e}=await import(`../../lib/edgeRendering/edgeProcessing.js`);return{buffer:e.createBuffer(0),origin:[0,0,0]}}let{indices:o,positions:s}=i.intersectionGeometry,c=i.componentData.offsets,{EdgeInputBufferLayout:l}=await import(`../../lib/edgeRendering/bufferLayouts.js`),f=l.createBuffer(s.length/3);d(f.position.typedBuffer,s,f.position.typedBufferStride,3),u(f.position,f.position,i.transform.rotationScale),this._setComponentIndices(f.componentIndex,o,c);let p=f.count,m=this._computeVisibilityIndices(o,a,c,p);return{origin:r(i.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:m,indicesLength:m.length,skipDeduplicate:!0,data:f,writerSettings:{reducedPrecision:!1,variants:0}},n)}}_setComponentIndices(e,t,n){let r=0;for(let i=0;i<n.length-1;i++){let a=n[i],o=n[i+1];for(let n=a;n<o;n++){let i=t?t[n]:n;e.set(i,r)}r++}}_computeVisibilityIndices(e,t,n,r){if(e&&t.allVisible())return e;let i=0;t.forEachComponentRange((e,t)=>(i+=n[t]-n[e],!0));let a=c(e)?e?.BYTES_PER_ELEMENT===2||r<=65536?new Uint16Array(i):new Uint32Array(i):Array(i),o=0;return t.forEachComponentRange((t,r)=>{let i=n[t],s=n[r];for(let t=i;t<s;t++)a[o++]=e?e[t]:t;return!0}),a}addHighlight(e,t,n){let r=e,i=this._activeHighlightOptions.get(n)??0;this._activeHighlightOptions.set(n,i+1),r.componentData.setHighlightsInOrder(this._highlightsInOrder),r.addHighlight(t,n)&&this._requestRender()}removeHighlight(e,t,n){let r=e.removeHighlight(t,n);r!==`notfound`&&(this._removeActiveHighlight(n),r&&this._requestRender())}_removeActiveHighlight(e,t=1){let n=this._activeHighlightOptions.get(e);if(n===void 0)N().warn(`Removing non-existing highlight "${e}".`);else{let r=n-t;r<0&&N().warn(`Removing non-existing highlight "${e}".`),r<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,r)}}clearHighlights(e){let t=e,{componentData:n}=t,{componentHighlights:r}=t.componentData;if(r.size>0){for(let e of r)this._removeActiveHighlight(e[0],e[1][n.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,n){let r=this._renderPassManager.rctx,i=e.geometry,a=i.parameters.layout,{interleavedVertexData:o,indexData:s,vertexCount:c}=i.renderGeometryData,l=new h(r,a,o),u=s?p.createIndex(r,35044,s):null,d=0,f=[[`geometry`,l]];if(!t.isIntegratedMesh){let e=new Uint16Array(c);for(let t=0;t<n.count;t++){let r=n.offsets[t],i=n.offsets[t+1],a=n.materialDataIndices[t];if(s!=null)for(let t=r;t<i;t++){let n=s[t];e[n]=a}else for(let t=r;t<i;t++)e[t]=a}let t=new h(r,x,e.buffer);d+=t.usedMemory,f.push([`componentIndices`,t])}let g=new v(r,new Map(f),u),_=s?.length??c,y=new j(g,m.TRIANGLES,i.parameters,u!=null,_),b=new D(t),S=this.materials.acquire(b,y.parameters,C),T=new k(l.usedMemory+d+(u?.usedMemory??0)),E=this.samplers.addFromTexture(t.baseColorTexture?.texture),O=new w(e,t,E);return new A(S,O,y,T)}_requestRender(){this._renderPassManager.requestRender()}};P=e([n(`esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection`)],P);const F=l();export{P as ComponentObjectCollection};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import"../../../../../core/has.js";import{clone as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../../../core/Logger.js";import a from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as c}from"../../../../../core/typedArrayUtil.js";import{create as l}from"../../../../../geometry/support/aaBoundingBox.js";import{d as u}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec32.js";import{compactIndices as f}from"../../../../../geometry/support/Indices.js";import{BufferObject as p}from"../../../../webgl/BufferObject.js";import{PrimitiveType as m}from"../../../../webgl/enums.js";import{VertexBuffer as h}from"../../../../webgl/VertexBuffer.js";import{SamplerRepository as g}from"../../lib/SamplerRepository.js";import{BufferManager as _}from"../../lib/TextureBackedBuffer/BufferManager.js";import{VertexArrayObject as v}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as y}from"../../lib/verticalOffsetUtils.js";import{getComponentDataLayout as b,IndexGlLayout as x}from"../../materials/DefaultLayouts.js";import{ComponentData as S}from"./ComponentData.js";import{defaultComponentParameters as C,ComponentDrawParametersImplementation as w}from"./ComponentDrawParameters.js";import{ComponentObject as T}from"./ComponentObject.js";import{IntersectionGeometry as E}from"./IntersectionGeometry.js";import{ComponentMaterialParameters as D}from"./Material/ComponentMaterialInitParameters.js";import{ComponentMaterialRepository as O}from"./Material/ComponentMaterialRepository.js";import{RenderableMeta as k,Renderable as A}from"./Renderable.js";import{RenderGeometry as j}from"./RenderGeometry.js";import{RenderSubmitSystem as M}from"./RenderSubmitSystem.js";const N=()=>i.getLogger(`esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection`);let P=class extends t{constructor(e,t,n){super(),this._renderPassManager=e,this._isGlobal=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new a,this._hidden=new a,this._renderSubmit=new M(this),this._renderPassManager.register(this._renderSubmit);let{rctx:r,bind:i}=e;this._componentBufferManager=new _(r,b());let c=this._isGlobal?n?1:2:0;this.materials=new O(i,c),this.samplers=new g(r.gl),this.addHandles(o(()=>i.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){let{geometry:n}=e,r=new S(this._componentBufferManager,f(n.componentOffsets)),i=this._createRenderable(e,t,r),a=new E(this._isGlobal,n.positions,r,e.elevationAlignable),o=new T(this,e.transform,e.obb.clone(),r,i,a,e.aabbInWorldCoordinates);return(o.visible?this._visible:this._hidden).push(o),o}destroyObject(e){let t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){let n=e;t!==n.visible&&(t?(this._hidden.removeUnordered(n),this._visible.push(n)):(this._visible.removeUnordered(n),this._hidden.push(n)),n.visible=t,this._requestRender())}preSubmit(e){let{camera:t,highlights:n}=e;this._updateHighlightsInOrder(n),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t,n){let r=e;(r.opacity!==t||n!==void 0&&n!==r.renderable.material.parameters.groundTransparencyMode)&&(r.updateOpacity(t,n),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){let n=e;n.componentData.visibility.reset(t),n.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){let{componentData:t}=e,n=t.visibility.componentCount;return{visible:n,invisible:t.count-n}}setComponentData(e,t){e.setComponentData(t,this._isGlobal),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,n,r=!1){e.intersectionGeometry.getComponentAabb(t,n);let i=e,a=i.componentData.verticalOffsets;if(r||a==null)return n;let o=a[t];if(!this._isGlobal||o===0)return n[2]+=o,n[5]+=o,n;let s=y(o);return s.localOrigin=i.transform.position,s.applyToAabb(n)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,n){return e.intersectionGeometry.getComponentPositions(t,n)}_updateHighlightsInOrder(e){if(this._highlights===e)return;let{_highlightsInOrder:t}=this,n=Math.min(e.length,8),r=t.length!==n;for(let i=0;i<n;++i)if(t[i]!==e[i].name){r=!0;break}if(this._highlights=e,r){t.length=n;for(let r=0;r<n;++r)t[r]=e[r].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){let e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,n,r){!Number.isNaN(this._elevationRangeCacheVerticalOffset)&&this._elevationRangeCacheVerticalOffset===t&&r.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);let i=e,{componentData:a}=i,o=a.count,{verticalOffsets:s}=a,{intersectionGeometry:c}=i,l=c.getComponentAabbs(),u=F,d=1/0,f=-1/0;for(let e=0;e<o;e++){let a=e*6,o=s?.[e]??0,c=1/0,p=-1/0;if(this._isGlobal){if(u[0]=l[a],u[1]=l[a+1],u[2]=l[a+2],u[3]=l[a+3],u[4]=l[a+4],u[5]=l[a+5],o!==0){let e=y(o);e.localOrigin=i.transform.position,e.applyToAabb(u)}let e=Math.max(Math.abs(u[3]),Math.abs(u[0])),s=Math.max(Math.abs(u[4]),Math.abs(u[1])),c=t+u[5]+n;r.expandElevationRangeValues(t+u[2],Math.sqrt(e*e+s*s+c*c)-n)}else c=l[a+2]+o+t,p=l[a+5]+o+t;r.expandElevationRangeValues(c,p),d=Math.min(d,c),f=Math.max(f,p)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=d,this._elevationRangeCacheMax=f}intersectRay(e,t,n,r,i,a){let{transform:o,componentData:s,intersectionGeometry:c}=e;r!=null&&(r.localOrigin=o.position),c.intersectRay(t,n,r,s.verticalOffsets,o,i,a)}*intersectScreenPolygon(e,t,n,r,i){let{transform:a,componentData:o,intersectionGeometry:s}=e;r!=null&&(r.localOrigin=a.position),yield*s.intersectScreenPolygon(t,n,r,o.verticalOffsets,a,i)}addEdges(e,t,n,r,i){let a=e,{indices:o,positions:s}=a.intersectionGeometry,c=a.componentData.offsets;return t.addComponentObject(a,s,o,c,n,r,i)}async extractEdgeInformation(e,t,n){let i=e,a=i.componentData.visibility;if(a.allInvisible()){let{extractComponentsEdgeLocationsLayout:e}=await import(`../../lib/edgeRendering/edgeProcessing.js`);return{buffer:e.createBuffer(0),origin:[0,0,0]}}let{indices:o,positions:s}=i.intersectionGeometry,c=i.componentData.offsets,{EdgeInputBufferLayout:l}=await import(`../../lib/edgeRendering/bufferLayouts.js`),f=l.createBuffer(s.length/3);d(f.position.typedBuffer,s,f.position.typedBufferStride,3),u(f.position,f.position,i.transform.rotationScale),this._setComponentIndices(f.componentIndex,o,c);let p=f.count,m=this._computeVisibilityIndices(o,a,c,p);return{origin:r(i.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:m,indicesLength:m.length,skipDeduplicate:!0,data:f,writerSettings:{reducedPrecision:!1,variants:0}},n)}}_setComponentIndices(e,t,n){let r=0;for(let i=0;i<n.length-1;i++){let a=n[i],o=n[i+1];for(let n=a;n<o;n++){let i=t?t[n]:n;e.set(i,r)}r++}}_computeVisibilityIndices(e,t,n,r){if(e&&t.allVisible())return e;let i=0;t.forEachComponentRange((e,t)=>(i+=n[t]-n[e],!0));let a=c(e)?e?.BYTES_PER_ELEMENT===2||r<=65536?new Uint16Array(i):new Uint32Array(i):Array(i),o=0;return t.forEachComponentRange((t,r)=>{let i=n[t],s=n[r];for(let t=i;t<s;t++)a[o++]=e?e[t]:t;return!0}),a}addHighlight(e,t,n){let r=e,i=this._activeHighlightOptions.get(n)??0;this._activeHighlightOptions.set(n,i+1),r.componentData.setHighlightsInOrder(this._highlightsInOrder),r.addHighlight(t,n)&&this._requestRender()}removeHighlight(e,t,n){let r=e.removeHighlight(t,n);r!==`notfound`&&(this._removeActiveHighlight(n),r&&this._requestRender())}_removeActiveHighlight(e,t=1){let n=this._activeHighlightOptions.get(e);if(n===void 0)N().warn(`Removing non-existing highlight "${e}".`);else{let r=n-t;r<0&&N().warn(`Removing non-existing highlight "${e}".`),r<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,r)}}clearHighlights(e){let t=e,{componentData:n}=t,{componentHighlights:r}=t.componentData;if(r.size>0){for(let e of r)this._removeActiveHighlight(e[0],e[1][n.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,n){let r=this._renderPassManager.rctx,i=e.geometry,a=i.parameters.layout,{interleavedVertexData:o,indexData:s,vertexCount:c}=i.renderGeometryData,l=new h(r,a,o),u=s?p.createIndex(r,35044,s):null,d=0,f=[[`geometry`,l]];if(!t.isIntegratedMesh){let e=new Uint16Array(c);for(let t=0;t<n.count;t++){let r=n.offsets[t],i=n.offsets[t+1],a=n.materialDataIndices[t];if(s!=null)for(let t=r;t<i;t++){let n=s[t];e[n]=a}else for(let t=r;t<i;t++)e[t]=a}let t=new h(r,x,e.buffer);d+=t.usedMemory,f.push([`componentIndices`,t])}let g=new v(r,new Map(f),u),_=s?.length??c,y=new j(g,m.TRIANGLES,i.parameters,u!=null,_),b=new D(t),S=this.materials.acquire(b,y.parameters,C),T=new k(l.usedMemory+d+(u?.usedMemory??0)),E=this.samplers.addFromTexture(t.baseColorTexture?.texture),O=new w(e,t,E);return new A(S,O,y,T)}_requestRender(){this._renderPassManager.requestRender()}};P=e([n(`esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection`)],P);const F=l();export{P as ComponentObjectCollection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{copy as e,sub as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,copy as i,expandWithAABB as a}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as o}from"../../../../../geometry/support/DoubleArray.js";import{intersectsTransformedAabb as s}from"../../../../../geometry/support/frustumPlanes.js";import{MeshIntersectionOptions as c,computeInvDir as l,intersectAabbInvDir as u}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as d}from"../../lib/triangleIntersectionUtils.js";import{intersectTriangleRangeForComponent as f,intersectTriangleRangeScreenPolygonForComponent as p,ComponentObjectElevationAgnosticComponentGeometryBVH as m}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as h}from"./ElevationAgnosticBVH.js";class g{constructor(e,t,r,i,a,o,s,c){this.vertexData=e,this.vertexStride=t,this.indexData=r,this._componentData=i,this._componentAabbs3D=a,this.geometryMinZ=o,this.planetCenterZ=s,this.
|
|
2
|
+
import{copy as e,sub as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,copy as i,expandWithAABB as a}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as o}from"../../../../../geometry/support/DoubleArray.js";import{intersectsTransformedAabb as s}from"../../../../../geometry/support/frustumPlanes.js";import{MeshIntersectionOptions as c,computeInvDir as l,intersectAabbInvDir as u}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as d}from"../../lib/triangleIntersectionUtils.js";import{intersectTriangleRangeForComponent as f,intersectTriangleRangeScreenPolygonForComponent as p,ComponentObjectElevationAgnosticComponentGeometryBVH as m}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as h}from"./ElevationAgnosticBVH.js";class g{constructor(e,t,r,i,a,o,s,c){this.vertexData=e,this.vertexStride=t,this.indexData=r,this._componentData=i,this._componentAabbs3D=a,this.geometryMinZ=o,this.planetCenterZ=s,this.isGlobal=c,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=C,this._ray1=w,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=D,this._callback=T,this._screenPolygonCallback=E,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._localModeOffsetDisplacement=new k,this._nodeAabbs3D=null,this.rayDirectionC=n(),this._intersectComponent=T,this._componentIndexMap=null,this._bvh=new h(i.count,this),this.componentIntersectionData=Array(i.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.isGlobal?this.getAabbs2DGlobal():this.getAabbs2DLocal()}getAabbs2DGlobal(){let{numComponents:e,planetCenterZ:t,minZGlobal:n}=this,r=o(e*4),i=this._componentAabbs3D;for(let a=0;a<e;++a){let e=a*6,o=i[e+0],s=i[e+1],c=i[e+2],l=i[e+3],u=i[e+4],d=i[e+5],f=n/(c-t),p=n/(d-t),m=Math.min(o*f,o*p),h=Math.min(s*f,s*p),g=Math.max(l*f,l*p),_=Math.max(u*f,u*p),v=a*4;r[v+0]=m,r[v+1]=h,r[v+2]=g,r[v+3]=_}return r}getAabbs2DLocal(){let{numComponents:e}=this,t=o(e*4),n=this._componentAabbs3D;for(let r=0;r<e;++r){let e=r*6,i=n[e+0],a=n[e+1],o=n[e+3],s=n[e+4],c=r*4;t[c+0]=i,t[c+1]=a,t[c+2]=o,t[c+3]=s}return t}intersectRay(e,t,n,r,i,a){let{isVerticalRay:o}=n,s=this._componentVerticalOffsets,c=this._verticalOffset,u=this._componentIndexMap,d=this._intersectComponent,f=this._callback;this._ray0=e,this._ray1=t,this._componentVerticalOffsets=i??null,this._verticalOffset=a??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._intersectComponent=this._intersectComponentRay,this._componentIndexMap=this._bvh.elementIndexMap,l(e,t,this._invDir),this._callback=r;try{this._bvh.intersectRay(e,t,o)}finally{this._callback=f,this._componentVerticalOffsets=s,this._verticalOffset=c,this._componentIndexMap=u,this._intersectComponent=d}}*intersectScreenPolygon(e,t,n,r,i,a){this._componentVerticalOffsets=i??null,this._verticalOffset=a??null,this._screenPolygonIntersector=e,this._screenPolygonQuery=t,this._screenPolygonTransformation=n,this._screenPolygonCallback=r,this._componentIndexMap=this._bvh.elementIndexMap,this._intersectComponent=this._intersectComponentScreenPolygon,yield*this._bvh.intersectNodesGenerator((e,t)=>this._intersectScreenPolygonNode(e,t)),this._componentIndexMap=null,this._componentVerticalOffsets=null,this._verticalOffset=null,this._screenPolygonCallback=E,this._screenPolygonTransformation=null,this._screenPolygonQuery=null,this._screenPolygonIntersector=null,this._intersectComponent=T}intersectRange(e,t){this._forEachIntersectableComponent(e,t,e=>{this._intersectComponent(e)})}*intersectRangeGenerator(e,t){let n=this._componentIndexMap,r=this._componentData;for(let i=e;i<t;++i){let e=n?n[i]:i;r.isPickable(e)&&r.isVisible(e)&&(this._intersectComponent(e),yield)}}getComponentTriangleCount(e){let t=this._componentData.offsets,n=t[e]/3;return t[e+1]/3-n}getComponentAabb3D(e,t){let n=this._componentAabbs3D,r=e*6;return t[0]=n[r],t[1]=n[r+1],t[2]=n[r+2],t[3]=n[r+3],t[4]=n[r+4],t[5]=n[r+5],t}_intersectComponentRay(n){let r=this.getComponentAabb3D(n,_),i=!1,{isGlobal:a,_componentVerticalOffsets:o,_verticalOffset:s,_ray0:c,_ray1:l,_invDir:p,planetCenterZ:m,_tolerance:h,rayDirectionC:g}=this,{isVerticalRay:v}=this._intersectionOptions,y=this._componentData.offsets,b=e(x,c),C=e(S,l),w=o?.[n]??0,T=w+(s?.offset??0);if(T!==0&&(a?(s!=null&&(s.componentOffset=w),v&&(d(b,-T,m,c),d(C,-T,m,l),i=!0)):(b[2]=c[2]-T,C[2]=l[2]-T,i=!0)),s!=null&&!i&&T!==0&&s.applyToAabb(r),!u(r,b,p,h))return;t(g,C,b);let E=y[n]/3,D=y[n+1]/3,k=D-E,A=(e,t,r,i)=>this._callback(e,t,r,i,n),{vertexData:j,vertexStride:M,indexData:N,_intersectionOptions:P}=this,{normalRequired:F}=P;k>O?this._getOrCreateComponentGeometryBvh(n,E,D).intersectRay(b,C,v,i?0:T,A,F):f(b,g,E,D,N,j,M,i?0:T,m,F,A)}_intersectComponentScreenPolygon(e){let t=this._screenPolygonIntersector,n=this._screenPolygonQuery;if(t==null||n==null)return;let r=this.getComponentAabb3D(e,_),{_screenPolygonTransformation:a,_screenPolygonCallback:o,vertexData:c,vertexStride:l,indexData:u}=this,d=this._getScreenPolygonElevationDisplacement(e),f=d==null?r:d.applyToAabb(i(v,r));if(!s(n.broadPhaseFrustum,f,a))return;let m=this._componentData.offsets,h=m[e]/3,g=m[e+1]/3;if(g-h>O){this._getOrCreateComponentGeometryBvh(e,h,g).intersectScreenPolygon(t,a,n,d,(t,n,r)=>{o(t,n,e,r)});return}let y=p(t,a,n,h,g,u,c,l,d);y!=null&&o(y.distance,y.primitiveIndex,e,y.point)}_intersectScreenPolygonNode(e,t){let n=this._screenPolygonQuery;if(n==null)return!1;let r=this._getScreenPolygonNodeAabb(e,t,v),{_screenPolygonTransformation:i}=this;return s(n.broadPhaseFrustum,r,i)}_forEachIntersectableComponent(e,t,n){let r=this._componentIndexMap,i=this._componentData;for(let a=e;a<t;++a){let e=r?r[a]:a;i.isPickable(e)&&i.isVisible(e)&&n(e)}}_getOrCreateComponentGeometryBvh(e,t,n){let r=this.componentIntersectionData[e];return r??(r=new m(e,this.vertexData,this.vertexStride,this.indexData,t,n,this._componentAabbs3D[e*6+2],this._componentAabbs3D[e*6+5],this.geometryMinZ,this.planetCenterZ,this.isGlobal),this.componentIntersectionData[e]=r),r}_getScreenPolygonElevationDisplacement(e){let t=this._componentVerticalOffsets?.[e]??0;return this._getScreenPolygonDisplacementForOffset(t)}_getScreenPolygonDisplacementForOffset(e){let t=this._verticalOffset;return t==null?this.isGlobal||e===0?null:(this._localModeOffsetDisplacement.offset=e,this._localModeOffsetDisplacement):e===0&&t.offset===0?null:(t.componentOffset=e,t)}_getScreenPolygonNodeAabb(e,t,n){let r=this._getNodeAabb3D(e,t,n),[o,s]=this._getNodeComponentOffsetRange(e);if(o===s)return this._applyScreenPolygonDisplacementToAabb(r,o);let c=this._applyScreenPolygonDisplacementToAabb(i(y,r),o),l=this._applyScreenPolygonDisplacementToAabb(i(b,r),s);return a(c,l,n),n}_applyScreenPolygonDisplacementToAabb(e,t){let n=this._getScreenPolygonDisplacementForOffset(t);return n==null?e:n.applyToAabb(e)}_getNodeAabb3D(e,t,n){let o=this._nodeAabbs3D??=[],s=o[t];if(s!=null)return i(n,s);let c=this._componentIndexMap,l=!1;for(let t=e.minIndexIndex;t<e.maxIndexIndex;++t){let e=c?c[t]:t,r=this.getComponentAabb3D(e,y);l?a(n,r):(i(n,r),l=!0)}let u=r();return i(u,n),o[t]=u,n}_getNodeComponentOffsetRange(e){let t=this._componentVerticalOffsets;if(t==null)return[0,0];let n=this._componentIndexMap,r=0,i=0,a=!1;for(let o=e.minIndexIndex;o<e.maxIndexIndex;++o){let e=t[n?n[o]:o]??0;a?(r=Math.min(r,e),i=Math.max(i,e)):(r=e,i=e,a=!0)}return a?[r,i]:[0,0]}}const _=r(),v=r(),y=r(),b=r(),x=n(),S=n(),C=n(),w=n(),T=()=>{},E=()=>{},D=new c,O=40;class k{constructor(){this.offset=0}applyToVertex(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r+this.offset,e}applyToAabb(e){return e[2]+=this.offset,e[5]+=this.offset,e}}export{g as ComponentObjectElevationAgnosticComponentBVH};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{copy as e,sub as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as a}from"../../../../../geometry/support/frustumPlanes.js";import{createPositionReader as o}from"../../lib/PositionReader.js";import{intersectRayTrianglesWithVerticalOffsetENUGlobal as s,intersectRayTriangles as c}from"../../lib/RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as l,Hit as u}from"../../lib/screenPolygonTriangleIntersections.js";import{
|
|
2
|
+
import{copy as e,sub as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as a}from"../../../../../geometry/support/frustumPlanes.js";import{createPositionReader as o}from"../../lib/PositionReader.js";import{intersectRayTrianglesWithVerticalOffsetENUGlobal as s,intersectRayTriangles as c}from"../../lib/RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as l,Hit as u}from"../../lib/screenPolygonTriangleIntersections.js";import{generateTriangleAabbsGlobal as d,generateTriangleAabbsLocal as f}from"../../lib/triangleIntersectionUtils.js";import{ElevationAgnosticBVH as p}from"./ElevationAgnosticBVH.js";const m=()=>{};class h{constructor(e,t,r,i,a,o,s,c,l,u,d){this.componentIndex=e,this.vertexData=t,this.vertexStride=r,this.indexData=i,this.startTriangleNumber=a,this.endTriangleNumber=o,this.componentMinZ=s,this.componentMaxZ=c,this.geometryMinZ=l,this.planetCenterZ=u,this.isGlobal=d,this.maxBspNodeDepth=8,this.minElementCountForBVH=20,this.minBspNodeElementCount=10,this.rayDirection=n(),this.ray0=n(),this.isVerticalRay=!1,this._triangleHitCallback=v,this.totalElevationOffset=0,this.normalRequired=!1,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonBestDistance=1/0,this._screenPolygonBestTriangleNumber=-1,this._screenPolygonHasNormal=!1,this._screenPolygonBestNormal=n(),this._screenPolygonBestPoint=n(),this.intersectRange=m,this._bvh=new p(o-a,this)}getAabbs2D(){return this.isGlobal?d(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride,this.geometryMinZ,this.planetCenterZ):f(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride)}get numTriangles(){return this.endTriangleNumber-this.startTriangleNumber}intersectRay(n,r,i,a,o,s){e(this.ray0,n),t(this.rayDirection,r,n),this.isVerticalRay=i,this.totalElevationOffset=a,this.normalRequired=s,this.intersectRange=this._intersectRangeRay,this._triangleHitCallback=o,this._bvh.intersectRay(n,r,i),this._triangleHitCallback=v,this.intersectRange=m}intersectScreenPolygon(e,t,n,r,i){this._screenPolygonIntersector=e,this._screenPolygonTransformation=t,this._screenPolygonQuery=n,this._screenPolygonDisplacement=r,this._screenPolygonBestDistance=1/0,this.intersectRange=this._intersectRangeScreenPolygon,this._bvh.intersectNodes(e=>this._couldIntersectScreenPolygonNode(e)),this._screenPolygonBestDistance<1/0&&i(this._screenPolygonBestDistance,this._screenPolygonBestTriangleNumber,this._screenPolygonBestPoint,this._screenPolygonHasNormal?this._screenPolygonBestNormal:null),this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null,this.intersectRange=m}_intersectRangeRay(e,t){let n=this._bvh.elementIndexMap;g(this.ray0,this.rayDirection,e,t,this.indexData,this.vertexData,this.vertexStride,this.totalElevationOffset,this.planetCenterZ,this.normalRequired,this._triangleHitCallback,n,this.startTriangleNumber)}_intersectRangeScreenPolygon(t,n){let{_screenPolygonQuery:r,_screenPolygonIntersector:i}=this;if(!r||!i)return;let a=this._bvh.elementIndexMap,o=_(i,this._screenPolygonTransformation,r,t,n,this.indexData,this.vertexData,this.vertexStride,this._screenPolygonDisplacement,a,this.startTriangleNumber);o!=null&&o.distance<this._screenPolygonBestDistance&&(this._screenPolygonBestDistance=o.distance,this._screenPolygonBestTriangleNumber=o.primitiveIndex,this._screenPolygonHasNormal=o.hasNormal,e(this._screenPolygonBestPoint,o.point),o.hasNormal&&e(this._screenPolygonBestNormal,o.normal))}getTriangleElevationOffset(e){return this.totalElevationOffset}_couldIntersectScreenPolygonNode(e){let t=this._screenPolygonQuery;if(t==null)return!1;let n=this._getNodeAabb3D(e,S);return this._screenPolygonDisplacement?.applyToAabb(n),a(t.broadPhaseFrustum,n,this._screenPolygonTransformation)}_getNodeAabb3D(e,t){let[n,r,a,o]=e.aabb2D;if(!this.isGlobal)return i(n,r,this.componentMinZ,a,o,this.componentMaxZ,t);let s=this.geometryMinZ-this.planetCenterZ,c=(this.componentMinZ-this.planetCenterZ)/s,l=(this.componentMaxZ-this.planetCenterZ)/s,u=n*c,d=n*l,f=a*c,p=a*l,m=r*c,h=r*l,g=o*c,_=o*l;return i(Math.min(u,d,f,p),Math.min(m,h,g,_),this.componentMinZ,Math.max(u,d,f,p),Math.max(m,h,g,_),this.componentMaxZ,t)}}function g(e,t,n,r,i,a,o,l,u,d,f,p=null,m=0){l===0?c(e,t,n,r,i,a,o,d,f,p,m):s(e,t,n,r,i,a,o,l,u,d,f,p,m)}function _(t,n,r,i,a,s,c,u,d,f=null,p=0){let m=1/0,h=-1,g=!1,_=!1,v=o(c,s,u);for(let o of l(t,n,r,i,a,v,d,f,p))o.distance>=m||(m=o.distance,h=o.primitiveIndex,g=!0,_=o.hasNormal,e(y,o.point),o.hasNormal&&e(b,o.normal));return g?(x.update(m,h,y,_?b:null),x):null}function v(){}const y=n(),b=n(),x=new u(4),S=r();export{h as ComponentObjectElevationAgnosticComponentGeometryBVH,g as intersectTriangleRangeForComponent,_ as intersectTriangleRangeScreenPolygonForComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{createUintArray as r}from"../../lib/triangleIntersectionUtils.js";class i{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.
|
|
2
|
+
import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{createUintArray as r}from"../../lib/triangleIntersectionUtils.js";class i{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.isGlobal=n.isGlobal,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}get _skipBVH(){return this.elementCount<this.minElementCountForBVH||this.geometryMinZ<.5*this.planetCenterZ}_ensureBVH(){this._generatedBVH||this._skipBVH||this._bspNodes.length===0&&this._generateBsp()}intersectRay(e,t,n){this.elementCount<1||(this._skipBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(e,t,n))}intersectNodes(e){if(this.elementCount<1)return;if(this._skipBVH){this._intersectRange(0,this.elementCount);return}this._ensureBVH();let t=[0];for(;t.length>0;){let n=t.pop(),r=this._bspNodes[n];if(!e(r,n))continue;let{child0:i,child1:a,minIndexIndex:o,minMidIndexIndex:s,maxMidIndexIndex:c,maxIndexIndex:l}=r;i===-1&&a===-1?this._intersectRange(o,l):(i===-1?this._intersectRange(o,s):t.push(i),this._intersectRange(s,c),a===-1?this._intersectRange(c,l):t.push(a))}}*intersectNodesGenerator(e){if(this.elementCount<1)return;if(this._skipBVH){yield*this._intersectRangeGenerator(0,this.elementCount);return}this._ensureBVH();let t=[0];for(;t.length>0;){let n=t.pop(),r=this._bspNodes[n];if(!e(r,n))continue;let{child0:i,child1:a,minIndexIndex:o,minMidIndexIndex:s,maxMidIndexIndex:c,maxIndexIndex:l}=r;i===-1&&a===-1?yield*this._intersectRangeGenerator(o,l):(i===-1?yield*this._intersectRangeGenerator(o,s):t.push(i),yield*this._intersectRangeGenerator(s,c),a===-1?yield*this._intersectRangeGenerator(c,l):t.push(a))}}_intersectRayWithoutBVH(e){this._intersectRange(0,this.elementCount)}_intersectRange(e,t){this.model.intersectRange(e,t)}*_intersectRangeGenerator(e,t){this.model.intersectRangeGenerator?yield*this.model.intersectRangeGenerator(e,t):(this._intersectRange(e,t),yield)}_intersectRayWithBVH(e,t,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(e):this._intersectGeometryWithBVHGeneralRay(e,t)}_intersectGeometryWithBVHVerticalRay(e){let t=e[0],n=e[1];if(this.isGlobal){let{geometryMinZ:r,planetCenterZ:i}=this,a=e[2]-i,o=(r-i)/a;t=e[0]*o,n=e[1]*o}let{_bspNodes:r}=this,i=0;for(;i>=0;){let e=r[i],{d:a,dim:o,minIndexIndex:s,minMidIndexIndex:c,maxMidIndexIndex:l,maxIndexIndex:u,aabb2D:d}=e;if(t<d[0]||t>d[2]||n<d[1]||n>d[3])break;if(o===-1||e.child0===-1&&e.child1===-1){this._intersectRange(s,u);break}{this._intersectRange(c,l);let r=(o===0?t:n)-a;if(r<0){if(e.child0===-1){this._intersectRange(s,c);break}i=e.child0}else if(r>0){if(e.child1===-1){this._intersectRange(l,u);break}i=e.child1}else break}}}_intersectGeometryWithBVHGeneralRay(e,n){let r=e[0],i=e[1],a=n[0],o=n[1],{geometryMinZ:s}=this;if(this.isGlobal){let t=0,c=1,l=Math.min(.5*this.planetCenterZ,s),u=e[2],d=n[2];if(u<l&&d<l||(u<l&&(t=(l-u)/(d-u)),d<l&&(c=(l-u)/(d-u)),t>c))return;let f=(1-t)*e[0]+t*n[0],p=(1-t)*e[1]+t*n[1],m=(1-t)*e[2]+t*n[2],h=(1-c)*e[0]+c*n[0],g=(1-c)*e[1]+c*n[1],_=(1-c)*e[2]+c*n[2],{planetCenterZ:v}=this,y=s-v,b=y/(m-v);r=f*b,i=p*b;let x=y/(_-v);a=h*x,o=g*x}let c=a-r,l=o-i,u=this._bspNodes,d=1;{let{aabb2D:e}=u[0],t=(e,t,n,r)=>{if(Math.abs(t)<1e-5*Math.max(r-n,1))return!1;let i=t>0,a=i?r:n,o=e+d*t;return(i?o<a:o>a)&&(d=Math.max((a-e)/t,d),!0)},n=()=>t(r,c,e[0],e[2]),a=()=>t(i,l,e[1],e[3]);Math.abs(c)>=Math.abs(l)?n()||a():a()||n()}let f=[0,0,d],p=0;for(;p<f.length;){let e=f[p],n=f[p+1],a=f[p+2];if(p+=3,n>a)continue;let o=u[e],{minIndexIndex:s,maxIndexIndex:m}=o,{child0:h,child1:g,minMidIndexIndex:_,maxMidIndexIndex:v,aabb2D:y,d:b,dim:x}=o;{let e=r+n*c,t=r+a*c,i=Math.min(e,t),o=Math.max(e,t),s=y[0],l=y[2];if(o<s||l<i)continue;if(i<s){let e=(s-r)/c;c>0?n=Math.max(n,e):a=Math.min(a,e)}if(l<o){let e=(l-r)/c;c>0?a=Math.min(a,e):n=Math.max(n,e)}}{let e=i+n*l,t=i+a*l,r=Math.min(e,t),o=Math.max(e,t),s=y[1],c=y[3];if(o<s||c<r)continue;if(r<s){let e=(s-i)/l;l>0?n=Math.max(n,e):a=Math.min(a,e)}if(c<o){let e=(c-i)/l;l>0?a=Math.min(a,e):n=Math.max(n,e)}}if(h===-1&&g===-1)this._intersectRange(s,m);else{let e=x===0?r:i,o=x===0?c:l,u=e+n*o,p=e+a*o,y=Math.min(u,p),S=Math.max(u,p),C=t((b-e)/o,0,d);s<_&&y<=b&&(h===-1?this._intersectRange(s,_):(f.push(h),f.push(o>=0?n:Math.max(n,C)),f.push(o>=0?Math.min(a,C):a))),this._intersectRange(_,v),v<m&&b<=S&&(g===-1?this._intersectRange(v,m):(f.push(g),f.push(o>=0?Math.max(n,C):n),f.push(o>=0?a:Math.min(a,C))))}}}_generateBsp(){let{elementCount:e}=this;if(e<1)return;let t=r(e,e);this._elementIndexMap=t;for(let n=0;n<e;++n)t[n]=n;let i=this.model.getAabbs2D(),c=0,d=this._bspNodes;d.length=0;let f=!1;if(this.isGlobal){let{planetCenterZ:e,geometryMinZ:t}=this;f=e>=0||t<.5*e}let p=[],m=(e,t,n,r,i)=>{p.push(e),p.push(t),p.push(n),p.push(r<0?-1:+!i+2*r)},{maxBspNodeDepth:h,minBspNodeElementCount:g}=this,_=(e,r,c,p,_)=>{let v=d.length;if(v>0&&(f||c>=h||r-e<g))return;let y=n();l(y,e,r,t,i);let{d:b,dim:x}=this.isGlobal?o(y):a(y),{rangeMidStart:S,rangeMidEnd:C}=s(e,r,x,b,t,i),w=c===h-1,T=!w&&S>=e+g,E=!w&&r>=C+g;if(T||E||v===0){let t=new u(e,S,C,r,x,b,y);if(T&&m(e,S,c+1,v,!0),E&&m(C,r,c+1,v,!1),d.push(t),p!==-1){let e=d[p];_?e.child0=v:e.child1=v}}};for(m(0,e,0,-1,!1);c<p.length;){let e=p[c],t=p[c+1],n=p[c+2],r=p[c+3];c+=4;let i=r>>1;_(e,t,n,i,r-(i<<1)==0)}this._generatedBVH=!0}}function a(e){let t=e[0],n=e[1],r=e[2],i=e[3],a=r-t,o=i-n,s,c;return a>=o?(c=.5*(t+r),s=0):(c=.5*(n+i),s=1),{d:c,dim:s}}function o(e){let t=e[0],n=e[1],r=e[2],i=e[3],a=r-t,o=i-n,s=.5*(t+r),c=.5*(n+i),l,u;return a>=o?(l=0,u=s):(l=1,u=c),{dim:l,d:u}}function s(e,t,n,r,i,a){let o=e;{let e=t;for(;o<e;){let t=i[o];c(t,n,r,a)<0?++o:(--e,i[o]=i[e],i[e]=t)}}let s=o,l=o,u=t;for(;l<u;){let e=i[u-1];c(e,n,r,a)>0?--u:(i[u-1]=i[l],i[l]=e,++l)}return{rangeMidStart:s,rangeMidEnd:u}}function c(e,t,n,r){let i=e*4,a=r[i+0+t];return r[i+2+t]<n?-1:+(a>n)}function l(e,t,n,r,i){let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e=t;e<n;++e){let t=r[e]*4;a=Math.min(a,i[t+0]),o=Math.min(o,i[t+1]),s=Math.max(s,i[t+2]),c=Math.max(c,i[t+3])}e[0]=a,e[1]=o,e[2]=s,e[3]=c}class u{constructor(e,t,n,r,i,a,o){this.minIndexIndex=e,this.minMidIndexIndex=t,this.maxMidIndexIndex=n,this.maxIndexIndex=r,this.dim=i,this.d=a,this.aabb2D=o,this.child0=-1,this.child1=-1}}export{i as ElevationAgnosticBVH};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{transpose as e,invert as t}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,transformMat3 as a,negate as o}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c}from"../../../../../geometry/support/aaBoundingBox.js";import{floatArrayFrom as l,floatArrayByteSize as u,newFloatArray as d}from"../../../../../geometry/support/FloatArray.js";import{indexArrayFrom as f,getContinuousIndexArray as p,indexArrayByteSize as m}from"../../../../../geometry/support/Indices.js";import{ComponentObjectElevationAgnosticComponentBVH as h}from"./ComponentObjectElevationAgnosticBVH.js";import{ComponentObjectFixedBVH as g}from"./ComponentObjectFixedBVH.js";class _{constructor(e,t,n,r){this.
|
|
2
|
+
import{transpose as e,invert as t}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,transformMat3 as a,negate as o}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c}from"../../../../../geometry/support/aaBoundingBox.js";import{floatArrayFrom as l,floatArrayByteSize as u,newFloatArray as d}from"../../../../../geometry/support/FloatArray.js";import{indexArrayFrom as f,getContinuousIndexArray as p,indexArrayByteSize as m}from"../../../../../geometry/support/Indices.js";import{ComponentObjectElevationAgnosticComponentBVH as h}from"./ComponentObjectElevationAgnosticBVH.js";import{ComponentObjectFixedBVH as g}from"./ComponentObjectFixedBVH.js";class _{constructor(e,t,n,r){this.isGlobal=e,this._components=n,this._needsElevationAlignment=r,this.verticalOffset=null,this.componentVerticalOffsets=null,this._planetCenter=s(),this._componentBvh=null,this._aabb=c();let{indices:i,positions:a}=t,o=a.length/3;this._indices=i?f(i,o):p(o),this._positions=l(a)}get usedMemory(){return u(this._positions)+m(this._indices)}destroy(){this._positions=null,this._indices=null,this._perComponentAabbs=null,this._componentBvh=null}getComponentAabb(e,t){let n=this._ensureComponentAabbs(),r=e*6;return t[0]=n[r],t[1]=n[r+1],t[2]=n[r+2],t[3]=n[r+3],t[4]=n[r+4],t[5]=n[r+5],t}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||=this._computePerComponentAabbs(),this._perComponentAabbs}getComponentPositions(e,t){t.indices=this._indices,t.data=this._positions,t.stride=3,t.startIndex=this._components.offsets[e],t.endIndex=this._components.offsets[e+1]}intersectRay(t,n,r,s,c,l,u){let d=b;this._setupIntersect(r,s,c,d);let{position:f}=c,p=i(v,t,f),m=i(y,n,f);a(p,p,d),a(m,m,d);let h=e(C,d);if(this.isGlobal){let e=this._planetCenter;o(e,f),a(e,e,d)}this._intersectComponents(p,m,s,r,(e,t,n,r,i)=>{u(e,t,n?a(S,n,h):null,r,i)},l)}*intersectScreenPolygon(e,t,n,r,i,a){this._setupIntersect(n,r,i),yield*this._ensureComponentBvh().intersectScreenPolygon(e,t,i.toMat4(x),(e,t,n,r)=>a(n,e,r,t),r??void 0,n??void 0)}_setupIntersect(e,n,r,i=b){if(this.verticalOffset=e,this.componentVerticalOffsets=n,t(i,r.rotationScale),this.isGlobal){let e=this._planetCenter;o(e,r.position),a(e,e,i)}}_computePerComponentAabbs(){let e=this._aabb,t=.5*(e[0]+e[3]),n=.5*(e[1]+e[4]),r=.5*(e[2]+e[5]),i=this._components.count,a=d(i*6),o=this._indices,s=this._positions,c=this._components.offsets,l=0,u=1/0,f=1/0,p=1/0,m=-1/0,h=-1/0,g=-1/0;for(let e=0;e<i;e++){let i=c[e],d=c[e+1],_=1/0,v=1/0,y=1/0,b=-1/0,x=-1/0,S=-1/0;if(i<d)for(let e=i;e<d;e++){let t=o[e]*3,n=s[t],r=s[t+1],i=s[t+2];_=Math.min(_,n),v=Math.min(v,r),y=Math.min(y,i),b=Math.max(b,n),x=Math.max(x,r),S=Math.max(S,i)}else _=t,v=n,y=r,b=t,x=n,S=r;a[l++]=_,a[l++]=v,a[l++]=y,a[l++]=b,a[l++]=x,a[l++]=S,u=Math.min(u,_),f=Math.min(f,v),p=Math.min(p,y),m=Math.max(m,b),h=Math.max(h,x),g=Math.max(g,S)}return this._aabb[0]=u,this._aabb[1]=f,this._aabb[2]=p,this._aabb[3]=m,this._aabb[4]=h,this._aabb[5]=g,a}_intersectComponents(e,t,n,r,i,a){this._ensureComponentBvh().intersectRay(e,t,a,i,n??void 0,r??void 0)}_ensureComponentBvh(){let e=this._componentBvh;return e??(e=this._needsElevationAlignment?new h(this._positions,w,this._indices,this._components,this._ensureComponentAabbs(),this.geometryMinZ,this.planetCenterZ,this.isGlobal):new g(this._positions,w,this._indices,this.numTriangles,this._components.offsets),this._componentBvh=e),e}get geometryMinZ(){return this._aabb[2]}get planetCenterZ(){return this._planetCenter[2]}get numTriangles(){return this._indices.length/3}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}const v=s(),y=s(),b=n(),x=r(),S=s(),C=n(),w=3;export{_ as IntersectionGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{MaterialBase as e}from"../../../core/material/MaterialBase.js";import{isColor as t}from"../../../core/shaderLibrary/ShaderOutput.js";import{getIMOverlayColorContent as n}from"../../../core/shaderLibrary/terrain/Overlay.glsl.js";import{hasShadowHighlights as r}from"../../../shaders/ReceiveShadowsConfiguration.js";import{isSphereDepthInterpolateActive as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";import{ComponentTechnique as a}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as o}from"./ComponentTechniqueConfiguration.js";class s extends e{constructor(e,t,n,r,i){super(),this.parameters=e,this.key=i;let a=u(e,n);this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this._emissions=a!==0,this.materialPass=c(e,n),this._configuration=new o(r),this._supportsSphereDepthInterpolate=e.sphereDepthInterpolate&&this._configuration.spherical,this._initializeMaterialConfiguration(e,t,n)}destroy(){}get emissions(){if(!this._emissions)return 0;switch(this.materialPass){case 0:case 3:return 1;case 1:case 4:return 2;case 2:return 3}}acquireTechnique(e,t,n,r){let o=this._updateConfiguration(t,n);if(this._supportsSphereDepthInterpolate&&e.precompiling>0){o.sphereDepthInterpolate=!1;let t=e.get(a,o,r.layout);o.sphereDepthInterpolate=!0;let s=e.get(a,o,r.layout);return i(n.camera,o)?s:t}return e.get(a,o,r.layout)}_initializeMaterialConfiguration(e,t,n){let r=this._configuration;r.hasMetallicRoughnessTexture=e.hasMetallicRoughnessTexture,r.hasOcclusionTexture=e.hasOcclusionTexture,r.hasNormalTexture=e.hasNormalTexture;let i=t.textureCoordinateType!==0;r.hasColorTextureTransform=i&&e.hasBaseColorTexture&&e.hasColorTextureTransform,r.hasNormalTextureTransform=i&&e.hasNormalTexture&&e.hasNormalTextureTransform,r.hasEmissiveTextureTransform=i&&e.hasEmissionTexture&&e.hasEmissiveTextureTransform,r.hasOcclusionTextureTransform=i&&e.hasOcclusionTexture&&e.hasOcclusionTextureTransform,r.hasMetallicRoughnessTextureTransform=i&&e.hasMetallicRoughnessTexture&&e.hasMetallicRoughnessTextureTransform,r.sphereDepthInterpolate=!1,r.ellipsoidMode=e.ellipsoidMode,r.doubleSidedMode=+!!e.doubleSided,r.hasColorTexture=e.hasBaseColorTexture,r.cullFace=e.cullFace,r.alphaDiscardMode=e.alphaDiscardMode,r.hasVertexColors=t.hasVertexColors,r.textureCoordinateType=t.textureCoordinateType,r.shadeNormals=t.shadeNormals,r.normalType=t.hasNormals?1:2,r.polygonOffset=e.polygonOffset,r.vertexPositionRotationType=t.vertexPositionRotationType,r.componentDataType=n.componentDataType,r.emissionSource=u(e,n),r.groundTransparencyMode=e.groundTransparencyMode}_updateConfiguration(e,n){let a=this._configuration,{identifier:o}=e,s=o===0;a.output=n.output,a.enableOITOffset=n.enableOITOffset,a.
|
|
2
|
+
import{MaterialBase as e}from"../../../core/material/MaterialBase.js";import{isColor as t}from"../../../core/shaderLibrary/ShaderOutput.js";import{getIMOverlayColorContent as n}from"../../../core/shaderLibrary/terrain/Overlay.glsl.js";import{hasShadowHighlights as r}from"../../../shaders/ReceiveShadowsConfiguration.js";import{isSphereDepthInterpolateActive as i}from"../../../shaders/SphereDepthInterpolate.glsl.js";import{ComponentTechnique as a}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as o}from"./ComponentTechniqueConfiguration.js";class s extends e{constructor(e,t,n,r,i){super(),this.parameters=e,this.key=i;let a=u(e,n);this.usePBR=e.usePBR,this.hasParametersFromSource=e.hasParametersFromSource,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isIntegratedMesh=e.isIntegratedMesh,this.applySSAO=e.applySSAO,this._emissions=a!==0,this.materialPass=c(e,n),this._configuration=new o(r),this._supportsSphereDepthInterpolate=e.sphereDepthInterpolate&&this._configuration.spherical,this._initializeMaterialConfiguration(e,t,n)}destroy(){}get emissions(){if(!this._emissions)return 0;switch(this.materialPass){case 0:case 3:return 1;case 1:case 4:return 2;case 2:return 3}}acquireTechnique(e,t,n,r){let o=this._updateConfiguration(t,n);if(this._supportsSphereDepthInterpolate&&e.precompiling>0){o.sphereDepthInterpolate=!1;let t=e.get(a,o,r.layout);o.sphereDepthInterpolate=!0;let s=e.get(a,o,r.layout);return i(n.camera,o)?s:t}return e.get(a,o,r.layout)}_initializeMaterialConfiguration(e,t,n){let r=this._configuration;r.hasMetallicRoughnessTexture=e.hasMetallicRoughnessTexture,r.hasOcclusionTexture=e.hasOcclusionTexture,r.hasNormalTexture=e.hasNormalTexture;let i=t.textureCoordinateType!==0;r.hasColorTextureTransform=i&&e.hasBaseColorTexture&&e.hasColorTextureTransform,r.hasNormalTextureTransform=i&&e.hasNormalTexture&&e.hasNormalTextureTransform,r.hasEmissiveTextureTransform=i&&e.hasEmissionTexture&&e.hasEmissiveTextureTransform,r.hasOcclusionTextureTransform=i&&e.hasOcclusionTexture&&e.hasOcclusionTextureTransform,r.hasMetallicRoughnessTextureTransform=i&&e.hasMetallicRoughnessTexture&&e.hasMetallicRoughnessTextureTransform,r.sphereDepthInterpolate=!1,r.ellipsoidMode=e.ellipsoidMode,r.doubleSidedMode=+!!e.doubleSided,r.hasColorTexture=e.hasBaseColorTexture,r.cullFace=e.cullFace,r.alphaDiscardMode=e.alphaDiscardMode,r.hasVertexColors=t.hasVertexColors,r.textureCoordinateType=t.textureCoordinateType,r.shadeNormals=t.shadeNormals,r.normalType=t.hasNormals?1:2,r.polygonOffset=e.polygonOffset,r.vertexPositionRotationType=t.vertexPositionRotationType,r.componentDataType=n.componentDataType,r.emissionSource=u(e,n),r.groundTransparencyMode=e.groundTransparencyMode}_updateConfiguration(e,n){let a=this._configuration,{identifier:o}=e,s=o===0;a.output=n.output,a.enableOITOffset=n.enableOITOffset,a.shouldDrapeRaster=this.parameters.integratedMeshSemantics.shouldDrapeRaster,a.sphereDepthInterpolate=this._supportsSphereDepthInterpolate&&i(n.camera,a),a.hasEmission=n.hasEmission,a.renderOccluded=n.slot===9;let c=this.parameters.integratedMeshSemantics.shouldStencilTerrain?this.parameters.integratedMeshSemantics.shouldDrape&&f(n,this.parameters.integratedMeshSemantics.shouldDrapeRaster)?d(n)?3:2:1:0;a.integratedMeshMode=c,a.pbrMode=c===3?4:this.usePBR?this.hasParametersFromSource?a.shadeNormals!==0&&this.isIntegratedMesh?0:2:1:0,a.hasSlicePlane=n.slicePlane!=null&&this.slicePlaneEnabled,a.isGroundSlice=a.hasSlicePlane&&this.parameters.integratedMeshSemantics.shouldFadeSlicedSurface;let{materialPass:l}=this;a.transparent=s&&(l===1||l===2&&e.transparent||l===4)||a.isGroundSlice,a.hasHighlightMixTexture=o===2&&n.highlightMixTexture!=null,a.snowCover=s&&n.snowCover>0,a.vertexDiscardMode=s&&l===2?e.transparent?2:1:0;let u=t(n.output);return a.receiveAmbientOcclusion=u&&this.applySSAO&&!a.renderOccluded&&n.ssao?.getTexture()!=null,a.receiveGlobalIllumination=u&&this.applySSAO&&!a.renderOccluded&&n.globalIlluminationEnabled,a.hasOccludees=u&&n.hasOccludees,a.receiveShadows=u&&n.shadowMap.ready,a.hasShadowHighlights=r(a,n),a.screenSpaceReflections=n.hasScreenSpaceReflections,a.cloudReflections=u&&n.clouds.data?.cubeMap?.colorTexture!=null,a}}function c(e,t){let{alphaDiscardMode:n,isIntegratedMesh:r,slicePlaneEnabled:i}=e,{transparent:a,opaqueOverride:o}=t,s=e.isObjectTransparent,c=e.hasBaseColorTransparency;if(r)return s||i&&e.integratedMeshSemantics.shouldRenderSliceAsTransparent?4:3;if(s)return 1;if(o===0)return 0;if(c||n===0||n===3)return 1;switch(a){case 2:return 0;case 0:return 1;case 1:return 2}}function l(e){return e.hasEmissionTexture||e.hasEmissiveBaseColor}function u(e,{emissiveSourceOverride:t,emissiveOverride:n}){let r=e.hasEmissionTexture,i=n!==2&&(l(e)||t!==2),a=t===1,o=t===2;return i?l(e)?o?r?4:2:a?r?5:7:6:a?7:6:0}function d(e){return e.overlay?.getTexture(3)!=null}function f(e,t){return e.overlay?.getTexture(n(t))!=null}export{s as ComponentMaterial,c as computeMaterialPass,u as getEmissionSource};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import{ComponentMaterial as e,computeMaterialPass as t,getEmissionSource as n}from"./ComponentMaterial.js";import{ComponentMaterialGlobalParameters as r}from"./ComponentMaterialGlobalParameters.js";class i{constructor(e,t){this._store=new Map,this.globals=new r(e,t)}destroy(){this._store.forEach(({material:e})=>e.destroy()),this._store.clear()}acquire(t,n,r){let i=this.globals,o=a(t,n,r,i),s=this._store.get(o);if(s)return s.refCount++,s.material.key,s.material;let c=new e(t,n,r,i,o);return this._store.set(o,{material:c,refCount:1}),c}release(e){let{key:t}=e,n=this._store.get(t);if(!n||n.refCount<1)throw Error(`Internal error in material repository`);n.refCount===1?this._store.delete(t):n.refCount--}}function a(e,r,i,a){let o=t(e,i),s=n(e,i);return`|${+a.useFloatBlend}|${+e.usePBR}|${+e.hasParametersFromSource}|${+e.integratedMeshSemantics.
|
|
2
|
+
import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import{ComponentMaterial as e,computeMaterialPass as t,getEmissionSource as n}from"./ComponentMaterial.js";import{ComponentMaterialGlobalParameters as r}from"./ComponentMaterialGlobalParameters.js";class i{constructor(e,t){this._store=new Map,this.globals=new r(e,t)}destroy(){this._store.forEach(({material:e})=>e.destroy()),this._store.clear()}acquire(t,n,r){let i=this.globals,o=a(t,n,r,i),s=this._store.get(o);if(s)return s.refCount++,s.material.key,s.material;let c=new e(t,n,r,i,o);return this._store.set(o,{material:c,refCount:1}),c}release(e){let{key:t}=e,n=this._store.get(t);if(!n||n.refCount<1)throw Error(`Internal error in material repository`);n.refCount===1?this._store.delete(t):n.refCount--}}function a(e,r,i,a){let o=t(e,i),s=n(e,i);return`|${+a.useFloatBlend}|${+e.usePBR}|${+e.hasParametersFromSource}|${+e.integratedMeshSemantics.shouldStencilTerrain}|${+e.integratedMeshSemantics.shouldDrape}|${+e.integratedMeshSemantics.shouldDrapeRaster}|${+e.integratedMeshSemantics.shouldRenderSliceAsTransparent}|${+e.integratedMeshSemantics.shouldFadeSlicedSurface}|${+e.groundTransparencyMode}|${+e.slicePlaneEnabled}|${+e.isIntegratedMesh}|${+e.applySSAO}|${+o}|${+i.componentDataType}|${+s}|${+e.sphereDepthInterpolate}|${+e.ellipsoidMode}|${+e.doubleSided}|${+e.cullFace}|${+e.alphaDiscardMode}|${+r.hasVertexColors}|${+r.textureCoordinateType}|${+r.shadeNormals}|${+r.hasNormals}|${e.polygonOffset}|${+r.vertexPositionRotationType}|${+e.hasBaseColorTexture}|${+e.hasEmissionTexture}|${+e.hasMetallicRoughnessTexture}|${+e.hasOcclusionTexture}|${+e.hasNormalTexture}|${+e.hasColorTextureTransform}|${+e.hasNormalTextureTransform}|${+e.hasEmissiveTextureTransform}|${+e.hasOcclusionTextureTransform}|${+e.hasMetallicRoughnessTextureTransform}|${+i.emissiveOverride}`}export{i as ComponentMaterialRepository,a as makeMaterialKey};
|
package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isColorHighlightOrOLID as t}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as n}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{SphereDepthInterpolateConfiguration as r}from"../../../shaders/SphereDepthInterpolate.glsl.js";class i extends r{constructor(e){super(),this.output=0,this.textureCoordinateType=0,this.componentDataType=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.pbrMode=0,this.normalType=0,this.emissionSource=0,this.shadeNormals=1,this.polygonOffset=0,this.vertexPositionRotationType=1,this.hasEmission=!1,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.
|
|
2
|
+
import{__decorate as e}from"tslib";import{isColorHighlightOrOLID as t}from"../../../core/shaderLibrary/ShaderOutput.js";import{parameter as n}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{SphereDepthInterpolateConfiguration as r}from"../../../shaders/SphereDepthInterpolate.glsl.js";class i extends r{constructor(e){super(),this.output=0,this.textureCoordinateType=0,this.componentDataType=0,this.cullFace=2,this.vertexDiscardMode=0,this.doubleSidedMode=2,this.alphaDiscardMode=1,this.integratedMeshMode=0,this.pbrMode=0,this.normalType=0,this.emissionSource=0,this.shadeNormals=1,this.polygonOffset=0,this.vertexPositionRotationType=1,this.hasEmission=!1,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.shouldDrapeRaster=!1,this.isGroundSlice=!1,this.hasColorTexture=!1,this.hasHighlightMixTexture=!1,this.emissionDimmingPass=!1,this.receiveAmbientOcclusion=!0,this.receiveGlobalIllumination=!1,this.receiveShadows=!0,this.hasShadowHighlights=!1,this.transparent=!0,this.groundTransparencyMode=1,this.screenSpaceReflections=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.hasNormalTextureTransform=!1,this.hasColorTextureTransform=!1,this.hasEmissiveTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.cloudReflections=!0,this.snowCover=!1,this.renderOccluded=!1,this.enableOITOffset=!1,this.sphereDepthInterpolate=!1,this.writeDepth=!0,this.oitPremultipliedAlpha=!1,this.occlusionPass=!1,this.bindType=2,this.useCustomDTRExponentForWater=!1,this.hasVertexTangents=!1,this.hasSliceTranslatedView=!1,this.rayMarchMaxReach=1,this.rayMarchMaxSteps=75,this.useProjectedRayLength=!1,this.clampRayToScreen=!0,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.useFillLights=!0,this.draped=!1,this.useTransformationTexture=!0,this.sphericalSR=e.sphericalSR,this.useFloatBlend=e.useFloatBlend}get spherical(){return this.sphericalSR!==0}get overlayEnabled(){return(this.integratedMeshMode===2||this.integratedMeshMode===3)&&t(this.output)}get hasWater(){return this.pbrMode===3||this.pbrMode===4||this.pbrMode===6}}e([n()],i.prototype,`useFloatBlend`,void 0),e([n({count:12})],i.prototype,`output`,void 0),e([n({count:3})],i.prototype,`textureCoordinateType`,void 0),e([n({count:2})],i.prototype,`componentDataType`,void 0),e([n({count:3})],i.prototype,`cullFace`,void 0),e([n({count:3})],i.prototype,`vertexDiscardMode`,void 0),e([n({count:3})],i.prototype,`doubleSidedMode`,void 0),e([n({count:4})],i.prototype,`alphaDiscardMode`,void 0),e([n({count:4})],i.prototype,`integratedMeshMode`,void 0),e([n({count:8})],i.prototype,`pbrMode`,void 0),e([n({count:3})],i.prototype,`normalType`,void 0),e([n({count:8})],i.prototype,`emissionSource`,void 0),e([n({count:3})],i.prototype,`shadeNormals`,void 0),e([n({count:5})],i.prototype,`polygonOffset`,void 0),e([n({count:3})],i.prototype,`vertexPositionRotationType`,void 0),e([n()],i.prototype,`hasEmission`,void 0),e([n()],i.prototype,`hasVertexColors`,void 0),e([n()],i.prototype,`hasSlicePlane`,void 0),e([n()],i.prototype,`shouldDrapeRaster`,void 0),e([n()],i.prototype,`isGroundSlice`,void 0),e([n()],i.prototype,`hasColorTexture`,void 0),e([n()],i.prototype,`hasHighlightMixTexture`,void 0),e([n()],i.prototype,`emissionDimmingPass`,void 0),e([n()],i.prototype,`receiveAmbientOcclusion`,void 0),e([n()],i.prototype,`receiveGlobalIllumination`,void 0),e([n()],i.prototype,`receiveShadows`,void 0),e([n()],i.prototype,`hasShadowHighlights`,void 0),e([n()],i.prototype,`transparent`,void 0),e([n({count:4})],i.prototype,`groundTransparencyMode`,void 0),e([n()],i.prototype,`screenSpaceReflections`,void 0),e([n()],i.prototype,`hasMetallicRoughnessTexture`,void 0),e([n()],i.prototype,`hasOcclusionTexture`,void 0),e([n()],i.prototype,`hasNormalTexture`,void 0),e([n()],i.prototype,`hasOccludees`,void 0),e([n()],i.prototype,`terrainDepthTest`,void 0),e([n()],i.prototype,`cullAboveTerrain`,void 0),e([n()],i.prototype,`hasNormalTextureTransform`,void 0),e([n()],i.prototype,`hasColorTextureTransform`,void 0),e([n()],i.prototype,`hasEmissiveTextureTransform`,void 0),e([n()],i.prototype,`hasOcclusionTextureTransform`,void 0),e([n()],i.prototype,`hasMetallicRoughnessTextureTransform`,void 0),e([n()],i.prototype,`cloudReflections`,void 0),e([n()],i.prototype,`snowCover`,void 0),e([n()],i.prototype,`renderOccluded`,void 0),e([n()],i.prototype,`enableOITOffset`,void 0),e([n()],i.prototype,`sphereDepthInterpolate`,void 0);export{i as ComponentTechniqueConfiguration};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as t,width as n,height as r}from"../../../../../../geometry/support/aaBoundingRect.js";import{Uniform as i}from"../../../../../webgl/Uniform.js";import{Float4DrawUniform as a}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as o}from"../../shaderModules/FloatPassUniform.js";import{glsl as s}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as c}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as l}from"../../shaderModules/Texture2DUintPassUniform.js";import{isColor as u}from"../ShaderOutput.js";import{mainLightDirection as d,mainLightIntensity as f}from"../shading/lightingUniforms.js";import{WaterColor as p}from"../shading/WaterColor.glsl.js";import{BlendColorsPremultiplied as m}from"../util/BlendColorsPremultiplied.glsl.js";function h(e,t){let{vertex:n,fragment:r}=e;n.uniforms.add(new a(`overlayTexOffset`,(e,n)=>C(t.spherical,e,n)),new a(`overlayTexScale`,(e,n)=>w(t.spherical,e,n))),r.uniforms.add(new a(`overlayTexOffset`,(e,n)=>C(t.spherical,e,n)),new a(`overlayTexScale`,(e,n)=>w(t.spherical,e,n))),r.constants.add(`overlayOpacity`,`float`,1),r.uniforms.add(new c(`ovColorTex`,(e,n)=>g(e,n,t.
|
|
2
|
+
import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as t,width as n,height as r}from"../../../../../../geometry/support/aaBoundingRect.js";import{Uniform as i}from"../../../../../webgl/Uniform.js";import{Float4DrawUniform as a}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as o}from"../../shaderModules/FloatPassUniform.js";import{glsl as s}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as c}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as l}from"../../shaderModules/Texture2DUintPassUniform.js";import{isColor as u}from"../ShaderOutput.js";import{mainLightDirection as d,mainLightIntensity as f}from"../shading/lightingUniforms.js";import{WaterColor as p}from"../shading/WaterColor.glsl.js";import{BlendColorsPremultiplied as m}from"../util/BlendColorsPremultiplied.glsl.js";function h(e,t){let{vertex:n,fragment:r}=e;n.uniforms.add(new a(`overlayTexOffset`,(e,n)=>C(t.spherical,e,n)),new a(`overlayTexScale`,(e,n)=>w(t.spherical,e,n))),r.uniforms.add(new a(`overlayTexOffset`,(e,n)=>C(t.spherical,e,n)),new a(`overlayTexScale`,(e,n)=>w(t.spherical,e,n))),r.constants.add(`overlayOpacity`,`float`,1),r.uniforms.add(new c(`ovColorTex`,(e,n)=>g(e,n,t.shouldDrapeRaster===!0))),x(e,t)}function g(e,t,n){let r=_(e,t,n);return r==null?null:t.overlay?.getTexture(r)}function _(e,t,n){return e.identifier===0?u(t.output)?!e.occludedGround||t.overlay?.allSourcesOccluders?v(n):4:t.output===3||t.output===4?v(n):t.output===11?5:null:e.identifier===2?2:null}function v(e){return+!e}function y(e,t){let{vertex:n,fragment:r}=e;n.uniforms.add(new E(`overlayTexOffset`),new E(`overlayTexScale`)),r.uniforms.add(new o(`overlayOpacity`,e=>e.overlayOpacity)),t.output!==10&&r.uniforms.add(new c(`ovColorTex`,(e,t)=>t.overlay?.getTexture(e.overlayContent))),x(e,t)}function b(e,t){switch(e){case 0:case 1:case 2:return t.slot===9&&!t.overlay?.allSourcesOccluders?4:0;case 3:case 4:return 0;case 10:return 2;case 5:case 7:case 8:case 9:return null;case 11:return 5}return null}function x(e,t){let{hasWater:n,output:r}=t;n&&e.include(p,t);let{vertex:i,fragment:a,varyings:o}=e;o.add(`vtcOverlay`,`vec4`);let c=r===10;i.code.add(s`void setOverlayVTC(in vec2 uv) {
|
|
3
3
|
vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
|
|
4
4
|
}`),a.code.add(s`bool isValid(vec2 uv, vec2 dxdy) {
|
|
5
5
|
return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{lookAt as n}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as a,scale as o,add as s,distance as c,cross as l,squaredLength as u}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lerp as f,clamp as p}from"../../../../../core/mathUtils.js";import{disposeMaybe as m}from"../../../../../core/maybe.js";import{watch as h,initial as g}from"../../../../../core/reactiveUtils.js";import{getReferenceEllipsoid as _}from"../../../../../geometry/ellipsoidUtils.js";import{newFloatArray as v}from"../../../../../geometry/support/FloatArray.js";import{PrimitiveType as y}from"../../../../webgl/enums.js";import{Texture as b}from"../../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as S}from"../../../../webgl/VertexBuffer.js";import{glLayout as C}from"../../../support/buffer/glUtil.js";import{makePiecewiseLinearFunction as w}from"../../../support/mathUtils.js";import{InternalRenderCategory as T}from"../../../webgl.js";import{createQuadVAO as E}from"../../lib/glUtil3D.js";import{project as D}from"../../lib/Util.js";import{VertexArrayObject as O}from"../../lib/VertexArrayObject.js";import{OpaqueEnvironment as k}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as A,innerAtmosphereDepth as j}from"./atmosphereUtils.js";import{marsAtmosphereTextureSimple as M}from"./MarsAtmosphereTexture.js";import{S as N}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as P,layout as F}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as I}from"./SimpleAtmosphereTechniqueConfiguration.js";const L=-j,R=()=>1-511/512,z=w([[50,1-460/512],[500
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{lookAt as n}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as a,scale as o,add as s,distance as c,cross as l,squaredLength as u}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lerp as f,clamp as p}from"../../../../../core/mathUtils.js";import{disposeMaybe as m}from"../../../../../core/maybe.js";import{watch as h,initial as g}from"../../../../../core/reactiveUtils.js";import{getReferenceEllipsoid as _}from"../../../../../geometry/ellipsoidUtils.js";import{newFloatArray as v}from"../../../../../geometry/support/FloatArray.js";import{PrimitiveType as y}from"../../../../webgl/enums.js";import{Texture as b}from"../../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../../webgl/TextureDescriptor.js";import{VertexBuffer as S}from"../../../../webgl/VertexBuffer.js";import{glLayout as C}from"../../../support/buffer/glUtil.js";import{makePiecewiseLinearFunction as w}from"../../../support/mathUtils.js";import{InternalRenderCategory as T}from"../../../webgl.js";import{createQuadVAO as E}from"../../lib/glUtil3D.js";import{project as D}from"../../lib/Util.js";import{VertexArrayObject as O}from"../../lib/VertexArrayObject.js";import{OpaqueEnvironment as k}from"../OpaqueEnvironment.js";import{computeInnerAltitudeFade as A,innerAtmosphereDepth as j}from"./atmosphereUtils.js";import{marsAtmosphereTextureSimple as M}from"./MarsAtmosphereTexture.js";import{S as N}from"../../../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as P,layout as F}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as I}from"./SimpleAtmosphereTechniqueConfiguration.js";const L=-j,R=()=>1-511/512,z=w([[50,1-460/512],[500,.21875],[5e3,1-250/512],[5e4,1-300/512]]);let B=class extends k{constructor(e){super(e),this._passParameters=new N,this._configuration=new I,this._vao=null,this._fadeVao=null,this._texV1=1;let t=e.view,{outerAtmosphereRimWidth:n,radius:r}=_(t.spatialReference);this._planetRadius=r,this._innerRimFactor=1+L/r,this._middleRimFactor=1+0/r,this._outerRimFactor=1+n/r,this._texV0=0/n,this._texVScale=this._texV1-this._texV0}initialize(){this.addHandles(h(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),g))}destroy(){this._passParameters.texture=m(this._passParameters.texture),this._fadeVao=m(this._fadeVao),this._vao=m(this._vao)}render(e){let t=e.find(({name:e})=>e===T.OPAQUE_ENVIRONMENT);this._update();let n=this.renderingContext;if(!this._passParameters.texture){let e=new x(1,512);e.wrapMode=33071,e.flipped=!0,this._passParameters.texture=new b(n,e,M)}if(this._passParameters.undergroundFadeAlpha<1){this._vao??=this._createRibbon(n),this._configuration.geometry=0;let e=this.techniques.getCompiled(P,this._configuration);if(!e)return this.requestRender(1),t;n.bindTechnique(e,this.bindParameters,this._passParameters),n.bindVAO(this._vao),n.drawArrays(y.TRIANGLES,0,this._vao.vertexCount(`geometry`))}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao??=E(n),this._configuration.geometry=2;let e=this.techniques.getCompiled(P,this._configuration);if(!e)return this.requestRender(1),t;n.bindTechnique(e,this.bindParameters,this._passParameters),n.bindVAO(this._fadeVao),n.drawArrays(y.TRIANGLE_STRIP,0,this._fadeVao.vertexCount(`geometry`))}return t}_update(){let e=this.bindParameters.camera,t=d(),n=this._planetRadius,r=a(e.eye),s=r-n;if(s<0){let e=Math.min(-s/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;let c=Math.max(50,s),l=n+L;this._passParameters.innerScale=G(n+c,n,l)-1,this._passParameters.altitudeFade=A(s),o(t,e.eye,(n+50)/r),V(t,e.center,e.up,n,this._passParameters.silhouette);let u=this._computeScreenRimWidth(e,t,e.up,this._passParameters.silhouette),m=R(),h=z(s),g=this._texV0+m*this._texVScale,_=this._texV0+u*h*this._texVScale;if(s>50){V(e.eye,e.center,e.up,n,this._passParameters.silhouette);let t=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),r=p((t-1.5)/(u-1.5),0,1);g=this._texV0+r*m*this._texVScale,_=this._texV0+f(this._texV1,u*h,r)*this._texVScale}i(this._passParameters.texV,g,_)}_createRibbon(e){let t=v(1155),n=new Uint32Array(1920);t[0]=0,t[1]=0,t[2]=-1;for(let e=0;e<128;e++){let r=e*9+3;t[r]=e,t[r+1]=this._innerRimFactor,t[r+2]=-1,t[r+3]=e,t[r+4]=this._middleRimFactor,t[r+5]=0,t[r+6]=e,t[r+7]=this._outerRimFactor,t[r+8]=1;let i=3*e+1,a=e===127?1:i+3,o=e*15;n[o]=i,n[o+1]=i+1,n[o+2]=a+1,n[o+3]=a+1,n[o+4]=a,n[o+5]=i,n[o+6]=i+1,n[o+7]=i+2,n[o+8]=a+2,n[o+9]=a+2,n[o+10]=a+1,n[o+11]=i+1,n[o+12]=i,n[o+13]=a,n[o+14]=0}let r=F.createBuffer(n.length),i=r.position;for(let e=0;e<n.length;++e){let r=n[e]*3;i.set(e,0,t[r]),i.set(e,1,t[r+1]),i.set(e,2,t[r+2])}return new O(e,new S(e,C(F),r.buffer))}_computeScreenRimWidth(e,t,r,i){return s(U,i.center,i.v2),o(W,U,this._outerRimFactor),n(H,t,U,r),D(U,H,e.projectionMatrix,e.viewport,U),D(W,H,e.projectionMatrix,e.viewport,W),c(U,W)/e.height}};B=e([t(`esri.views.3d.webgl-engine.effects.atmosphere.MarsAtmosphere`)],B);function V(e,t,n,r,i){let s=a(e),c=r*Math.sqrt(s*s-r*r)/s,d=Math.sqrt(r*r-c*c),f=i.v1,p=i.v2;return o(i.center,e,d/s),l(f,e,t),u(f)<1&&l(f,e,n),o(f,f,c/a(f)),l(p,f,e),o(p,p,c/a(p)),c}const H=r(),U=d(),W=d();function G(e,t,n){let r=Math.sqrt(e*e-t*t),i=Math.sqrt(e*e-n*n);return e*e/(r*i+t*n)}export{B as MarsAtmosphere};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as r}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{releaseMaybe as i}from"../../../../../core/maybe.js";import{checkWebGLError as a}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as o,SizedPixelFormat as s,DataType as c}from"../../../../webgl/enums.js";import{RenderNodeOutput as l}from"../../../webgl.js";import u from"../../../webgl/RenderNode.js";import{If as d,glsl as f}from"../../core/shaderModules/glsl.js";import{Pos2Locations as p}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as m}from"../../shaders/floatBlendScale.glsl.js";let h=class extends u{constructor(e){super(e),this.destroyedCB=null,this.consumes={required:[l.FINAL]},this.produces=l.FINAL,this.clearColor=r,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(){let e=this.input;if(!this._focusedTexture)return e;let t=this.renderingContext,n=t.boundFramebuffer;t.bindFramebuffer(e.fbo),t.setClearColor(0,0,0,0),t.clear(16384);let r=this._focusedTexture.attachment,i=[_(r)],a=this._ensureProgram(t,!1,i);return t.useProgram(a),t.bindTexture(r,0),a.setUniform1i(`colorTex0`,0),a.setUniform1i(`inputType`,this._focusedFBOType),this._focusedFBOType===3&&a.setUniform2fv(`nearFar`,this.camera.nearFar),t.setDrawBuffers([o]),t.screen.draw(),t.bindFramebuffer(n),e}getDownscaledFBO(e,t,n,r,i,c){if(i?.startsWith(`${t}\n`)??!1){let t=1/2**e.level;n=e.width*t,r=e.height*t}else c=null;let l=t===`linear depth`||t.includes(`shadow`),u=t===`overlay highlight`||t===`highlights`||t===`highlight mix`,d=t===`highlight coverage`,f=e.colorTexture?.descriptor?.internalFormat,p=[],m=[],h=[],g=!1;e.colorAttachments.forEach((t,n)=>{let r=e.getColorTexture(t);if(r){let e=_(r);p.push(e);let{hasMipmap:t,isImmutable:i}=r.descriptor;e===`float`&&!t&&!i&&(r.generateMipmap(),m[n]=!0),g||=t}if(n>0){let e=r?.descriptor.internalFormat;e===s.RGBA8&&(r?.debugName?.indexOf(`emissive`)??-1)>=0?h.push(8):h.push(y(e))}else h.push(l?0:u?1:d?2:c??y(f))});let v=this.renderingContext,{depthStencilTexture:x,level:S}=e,C=this._ensureProgram(v,x!=null,p,g?S:null),w=this.fboCache.acquire(n,r,`fbo visualizer`);v.useProgram(C);let T=v.boundFramebuffer;v.bindFramebuffer(w.fbo);let E=[];e.colorAttachments.forEach((t,n)=>{let r=`colorTex${n.toFixed()}`;v.bindTexture(e.getColorTexture(t),n),C.setUniform1i(r,n),n>0&&w.acquireColor(o+n,5,`fbo visualizer`),E.push(t)});let D=x?.descriptor.linearFilterDepth??!1;if(x){let t=e.colorAttachments.length;x.setShadowFiltering(!1),v.bindTexture(x,t),C.setUniform1i(`depthTex`,t);let n=o+t;n>o&&w.acquireColor(n,5,`fbo visualizer`),E.push(n)}v.gl.drawBuffers(E),a(v.gl);let O=v.getViewport();return v.setViewport(0,0,n,r),v.setClearColor(0,0,0,0),v.clear(16384),v.setBlendingEnabled(!0),v.setBlendFunction(1,771),C.setUniform1iv(`inputTypes`,h.length>0?h:[7]),C.setUniform2fv(`nearFar`,this.camera.nearFar),v.screen.draw(),a(v.gl),v.bindFramebuffer(T),v.setViewport(O.x,O.y,O.width,O.height),e.colorAttachments.forEach((n,r)=>{let a=e.getColorTexture(n);m[r]&&a?.clearMipmap(),i===b(t,e,n,!1)&&(this._focusedTexture?.release(),this._focusedTexture=w.getAttachment(n),this._focusedTexture?.retain(),this._focusedFBOType=h[r]===9?y(a?.descriptor.internalFormat):h[r])}),x&&x.setShadowFiltering(D),w}clearFocusedFBO(){this._focusedTexture=i(this._focusedTexture)}getPreviewContent(e,t,n,r){let i=this.renderingContext,o=r.includes(`
|
|
3
3
|
depth`),l=this.fboCache.acquire(e,t,`fbo visualizer`),u=i.boundFramebuffer;i.bindFramebuffer(l?.fbo);let d=i.getViewport();i.setViewport(0,0,e,t),i.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),i.clear(16384),i.setBlendingEnabled(!0),i.setBlendFunction(1,771);let f=n.attachment,p=this._ensureProgram(i,!1,[_(f)]);i.useProgram(p),i.bindTexture(f,0),p.setUniform1i(`colorTex0`,0),p.setUniform1iv(`inputTypes`,[!o&&f.descriptor.internalFormat===s.RGBA16F?5:7]),i.screen.draw();let m=new ImageData(new Uint8ClampedArray(e*t*4),e,t);return i.gl.readPixels(0,0,e,t,6408,c.UNSIGNED_BYTE,new Uint8Array(m.data.buffer)),a(i.gl),i.bindFramebuffer(u),i.setViewport(d.x,d.y,d.width,d.height),l?.release(),m}_ensureProgram(e,t,n,r){let i=v({hasDepthAttachment:t,colorSamplerTypes:n,lod:r}),a=this._programs.get(i);if(a)return a;let o=e=>{let t=``;for(let n=0;n<e.length;++n){let r=e[n];t+=`layout(location = ${f.int(n)}) out vec4 fragColor${f.int(n)};
|
|
4
|
-
uniform ${g(r)} colorTex${f.int(n)};`}return t},s=r??0,c=r==null?1:1/2**(r+1)
|
|
4
|
+
uniform ${g(r)} colorTex${f.int(n)};`}return t},s=r??0,c=r==null?1:1/2**(r+1),l=e=>e.reduce((e,t,n)=>e+`{
|
|
5
5
|
int inputType = inputTypes[${n}];
|
|
6
6
|
if (inputType == ${3 .toFixed()}) {
|
|
7
7
|
fragColor${n} = vec4(vec3(readTexture(colorTex${n}, uv, ${s}).r), 1.0);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{normalize as r,set as i,dot as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{smoothstep as s,clamp as c}from"../../../../../core/mathUtils.js";import{watch as l,syncAndInitial as u}from"../../../../../core/reactiveUtils.js";import{defaultShadowOpacity as d,defaultShadowDifference as f,defaultShadowColor as p}from"../../../../support/HighlightDefaults.js";import{RenderNodeOutput as m}from"../../../webgl.js";import h from"../../../webgl/RenderNode.js";import{EmissiveTechniqueConfiguration as g}from"../../shaders/EmissiveTechniqueConfiguration.js";import{ShadowHighlightPassParameters as _,ShadowHighlightTechnique as v}from"./ShadowHighlightTechnique.js";let y=class extends h{constructor(e){super(e),this.consumes={required:[m.COMPOSITE,`highlights`]},this.produces=m.COMPOSITE,this._configuration=new g,this._passParameters=new _,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([l(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??d,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},u),l(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},u),l(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??p).toUnitRGBA(),this._ensureMaxOpacity()},u)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){let e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&(this._configuration.hasEmissive=this.bindParameters.emissions!==0,this.techniques.precompile(v,this._configuration))}render(e){let t=this.input;if(!this._ensureIfVisible())return t;let n=this.bindParameters;this._passParameters.highlightTexture=e.find(({name:e})=>e===`highlights`)?.getTexture(),this._passParameters.origin=n.camera.center;let r=this.renderingContext,i=this.techniques.get(v,this._configuration),a=t.obtainDepthTexture();return r.bindFramebuffer(t.fbo),r.bindTechnique(i,n,this._passParameters),r.screen.draw(),t.attachDepth(a),a?.release(),t}_ensureIfVisible(){let e=this.bindParameters;if(!e.hasShadowHighlights||!e.mainDepth||!e.shadowHighlight?.getTexture())return!1;let{camera:t,lighting:n}=e;this._passParameters.opacityElevation=1-s(4e4,5e4,t.relativeElevation);let o=this.
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{normalize as r,set as i,dot as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{smoothstep as s,clamp as c}from"../../../../../core/mathUtils.js";import{watch as l,syncAndInitial as u}from"../../../../../core/reactiveUtils.js";import{defaultShadowOpacity as d,defaultShadowDifference as f,defaultShadowColor as p}from"../../../../support/HighlightDefaults.js";import{RenderNodeOutput as m}from"../../../webgl.js";import h from"../../../webgl/RenderNode.js";import{EmissiveTechniqueConfiguration as g}from"../../shaders/EmissiveTechniqueConfiguration.js";import{ShadowHighlightPassParameters as _,ShadowHighlightTechnique as v}from"./ShadowHighlightTechnique.js";let y=class extends h{constructor(e){super(e),this.consumes={required:[m.COMPOSITE,`highlights`]},this.produces=m.COMPOSITE,this._configuration=new g,this._passParameters=new _,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([l(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??d,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},u),l(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},u),l(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??p).toUnitRGBA(),this._ensureMaxOpacity()},u)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){let e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&(this._configuration.hasEmissive=this.bindParameters.emissions!==0,this.techniques.precompile(v,this._configuration))}render(e){let t=this.input;if(!this._ensureIfVisible())return t;let n=this.bindParameters;this._passParameters.highlightTexture=e.find(({name:e})=>e===`highlights`)?.getTexture(),this._passParameters.origin=n.camera.center;let r=this.renderingContext,i=this.techniques.get(v,this._configuration),a=t.obtainDepthTexture();return r.bindFramebuffer(t.fbo),r.bindTechnique(i,n,this._passParameters),r.screen.draw(),t.attachDepth(a),a?.release(),t}_ensureIfVisible(){let e=this.bindParameters;if(!e.hasShadowHighlights||!e.mainDepth||!e.shadowHighlight?.getTexture())return!1;let{camera:t,lighting:n}=e;this._passParameters.opacityElevation=1-s(4e4,5e4,t.relativeElevation);let o=this.isGlobal?r(b,t.center):i(b,0,0,1),l=a(o,n.mainLight.direction);return this._passParameters.dayNightTerminator=s(0,1,c(l*30,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=.001953125}};e([t()],y.prototype,`consumes`,void 0),e([t()],y.prototype,`produces`,void 0),e([t({constructOnly:!0})],y.prototype,`isGlobal`,void 0),y=e([n(`esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight`)],y);const b=o();export{y as ShadowHighlight};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{set as e,subtract as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as r}from"../../../../../geometry/support/DoubleArray.js";import{PrimitiveType as i}from"../../../../webgl/enums.js";import{VertexBuffer as a}from"../../../../webgl/VertexBuffer.js";import{glLayout as o}from"../../../support/buffer/glUtil.js";import{VertexArrayObject as s}from"../../lib/VertexArrayObject.js";import{layoutSpherical as c,layoutPlanar as l}from"./LaserlinePathTechnique.js";class u{constructor(e){this._renderCoordsHelper=e,this._origin=n(),this._dirty=!1,this._count=0}set vertices(e){let t=r(e.length*3),n=0;for(let r of e)t[n++]=r[0],t[n++]=r[1],t[n++]=r[2];this.buffers=[t]}set buffers(t){if(this._buffers=t,this._buffers.length>0){let t=this._buffers[0],n=Math.floor(t.length/3/2)*3;e(this._origin,t[n],t[n+1],t[n+2])}else e(this._origin,0,0,0);this._dirty=!0}get origin(){return this._origin}draw(e){let t=this._ensureVAO(e);t!=null&&(e.bindVAO(t),e.drawArrays(i.TRIANGLES,0,this._count))}dispose(){this._vao!=null&&this._vao.dispose()}get _layout(){return this._renderCoordsHelper.
|
|
2
|
+
import{set as e,subtract as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as r}from"../../../../../geometry/support/DoubleArray.js";import{PrimitiveType as i}from"../../../../webgl/enums.js";import{VertexBuffer as a}from"../../../../webgl/VertexBuffer.js";import{glLayout as o}from"../../../support/buffer/glUtil.js";import{VertexArrayObject as s}from"../../lib/VertexArrayObject.js";import{layoutSpherical as c,layoutPlanar as l}from"./LaserlinePathTechnique.js";class u{constructor(e){this._renderCoordsHelper=e,this._origin=n(),this._dirty=!1,this._count=0}set vertices(e){let t=r(e.length*3),n=0;for(let r of e)t[n++]=r[0],t[n++]=r[1],t[n++]=r[2];this.buffers=[t]}set buffers(t){if(this._buffers=t,this._buffers.length>0){let t=this._buffers[0],n=Math.floor(t.length/3/2)*3;e(this._origin,t[n],t[n+1],t[n+2])}else e(this._origin,0,0,0);this._dirty=!0}get origin(){return this._origin}draw(e){let t=this._ensureVAO(e);t!=null&&(e.bindVAO(t),e.drawArrays(i.TRIANGLES,0,this._count))}dispose(){this._vao!=null&&this._vao.dispose()}get _layout(){return this._renderCoordsHelper.isGlobal?c:l}_ensureVAO(e){return this._buffers==null?null:(this._vao??=this._createVAO(e,this._buffers),this._ensureVertexData(this._vao,this._buffers),this._vao)}_createVAO(e,t){let n=this._createDataBuffer(t);return this._dirty=!1,new s(e,new a(e,o(this._layout),n))}_ensureVertexData(e,t){if(!this._dirty)return;let n=this._createDataBuffer(t);e.buffer()?.setData(n),this._dirty=!1}_createDataBuffer(n){let r=n.reduce((e,t)=>e+d(t),0);this._count=r;let i=this._layout.createBuffer(r),a=this._origin,o=0,s=0,c=`startUp`in i?this._setUpVectors.bind(this,i):void 0;for(let r of n){for(let n=0;n<r.length;n+=3){let l=e(p,r[n],r[n+1],r[n+2]);n===0?s=this._renderCoordsHelper.getAltitude(l):this._renderCoordsHelper.setAltitude(l,s);let u=o+n*2;c?.(n,u,r,l);let d=t(p,l,a);if(n<r.length-3){for(let e=0;e<6;e++)i.start.setVec(u+e,d);i.extrude.setValues(u,0,-1),i.extrude.setValues(u+1,1,-1),i.extrude.setValues(u+2,1,1),i.extrude.setValues(u+3,0,-1),i.extrude.setValues(u+4,1,1),i.extrude.setValues(u+5,0,1)}if(n>0)for(let e=-6;e<0;e++)i.end.setVec(u+e,d)}o+=d(r)}return i.buffer}_setUpVectors(e,t,n,r,i){let a=this._renderCoordsHelper.worldUpAtPosition(i,f);if(t<r.length-3)for(let t=0;t<6;t++)e.startUp.setVec(n+t,a);if(t>0)for(let t=-6;t<0;t++)e.endUp.setVec(n+t,a)}}function d(e){return(e.length/3-1)*2*3}const f=n(),p=n();export{u as LaserlinePathData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{sliceEquals as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{copy as i,equals as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as c,sync as l}from"../../../../../core/reactiveUtils.js";import{signal as u}from"../../../../../core/signal.js";import{PrimitiveType as d,DepthStencilAttachment as f,PixelType as p}from"../../../../webgl/enums.js";import{DisposableFramebufferObject as m}from"../../../../webgl/FramebufferObject.js";import{noParameters as h}from"../../../../webgl/NoParameters.js";import{InternalRenderCategory as g}from"../../../webgl.js";import _ from"../../../webgl/RenderNode.js";import{ReadShadowMapPassParameters as v}from"../../core/shaderLibrary/shading/readShadow.glsl.js";import{BindParameters as y}from"../../lib/BindParameters.js";import{DepthRange as b}from"../../lib/DepthRange.js";import{createQuadVAO as x}from"../../lib/glUtil3D.js";import{ShadowMap as S}from"../../lib/ShadowMap.js";import{V as C}from"../../../../../chunks/VolumeMask.glsl.js";import{volumeToVao as w}from"../focusArea/focusAreaMaskUtils.js";import{S as T}from"../../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as E}from"./ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as D}from"./ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as O}from"./ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as k}from"./ShadowCastMaskTechnique.js";let A=class extends _{constructor(e){super(e),this.consumes={required:[]},this.produces=g.SHADOW_ACCUMULATION,this._fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new N(new D(0),()=>this._requestRenderIfEnabled()),this._contextSet=new N(new D(1),()=>this._requestRenderIfEnabled()),this._passParameters=new v,this._maskParameters=new C,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=b.Zero,this._didAccumulate=!1,this._enabled=!1,this._previewing=!1,this.accumulationRenderer=null,this._shadowAccumulatorKey=Symbol(`shadowAccumulator`);let{view:t}=e,n=t.stage.renderer.fboCache;this._accumulationBindParameters=new y(new S(n,t.stage.viewingMode)),this._accumulationBindParameters.shadowMap.enabled=!0,this._vao=x(n.rctx),this._tmpReadFbo=new m(n.rctx),this.addHandles([c(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},l),c(()=>this._numActive,()=>this._numActiveChanged(),l)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this.accumulationRenderer=null,this._fboHandle=s(this._fboHandle),this._vao=s(this._vao),this._volumeVao=s(this._volumeVao),this._tmpReadFbo=s(this._tmpReadFbo),this._accumulationBindParameters.destroy();for(let e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this._fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&this._accumulationSets().some(e=>e.active)}get canAccumulate(){return this._accumulationBindParameters.depth!=null&&this._depthRange!==b.Zero&&this.accumulationRenderer!=null&&this.accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return this._accumulationSets().every(e=>e.doneAccumulating)}get _numActive(){return this._accumulationSets().reduce((e,t)=>e+ +t.active,0)}get _colorFormat(){return this._numActive===2?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=s(this._volumeVao),this._volumeVertexCount=0;let t=e!=null;for(let e of this._accumulationSets())e.configuration.useMask=t;if(!t)return;let n=e.geometryVolume,{vao:r,vertexCount:i}=w(this._rctx,n);this._volumeVao=r,this._volumeVertexCount=i}get requireGeometryDepth(){return this.accumulating||this._volumeVao!=null}precompile(){if(this.active&&(this._fullyRecompute=this.bindParameters.frameRendererTarget!==0,this.accumulating)){for(let e of this._accumulationSets())this.techniques.precompile(E,e.configuration),this.techniques.precompile(O,e.configuration);this.techniques.precompile(k)}}get didAccumulate(){return this._didAccumulate}render(){this._updateCamera(),this._didAccumulate=this._renderAccumulation(),this._updateMask();let e=this._fboHandle;return e?.retain(),e}_renderAccumulation(){if(!this.active)return!1;if(this._accumulationBindParameters.contentCamera=this.bindParameters.contentCamera,this._accumulationBindParameters.depth=this.bindParameters.depth,this._passParameters.origin=this._accumulationBindParameters.camera.center,!this.canAccumulate||(this._renderAreaMask(),!this.accumulating))return this._accumulationBindParameters.depth=null,!1;(this._previewing||this._fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._accumulationBindParameters);let e=this._accumulateSetsForRenderFrame(this._previewing&&!this._fullyRecompute,this._accumulationBindParameters);return this._accumulationBindParameters.depth=null,e}_renderAreaMask(){let e=this.techniques.getCompiled(k),t=this._volumeVao,n=this._volumeVertexCount,r=this._fboHandle,i=this._analysisVolume;if(r?.detachDepth(),!e||!t||n<1||!r||!i)return;r.acquireDepth(14);let a=this._rctx,o=this._accumulationBindParameters,s=o.depth,c=this._tmpReadFbo;c.attachDepthStencil(s?.attachment),a.blitFramebuffer(c,r.fbo,256),c.detachDepthStencilTexture(),a.bindFramebuffer(r.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);let l=a.bindTechnique(e,o,h);this._maskParameters.origin=i.origin,l.bindDraw(o,h,this._maskParameters),a.bindVAO(t),a.drawArrays(d.TRIANGLES,0,n)}_clearBuffersOnAccumulationStart(e){if(this._accumulationSets().every(e=>e.progress===0))this._clearFramebuffer();else for(let t of this._accumulationSets())t.progress===0&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let n=!1;for(let r of this._accumulationSets())this._accumulateSet(r,e,t),n=!0;return n&&this.requestRender(1),n}_accumulateSet(e,t,n){let r=t?Math.min(j,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let t=0;t<r;++t)this._accumulateShadow(e,n)}_updateMask(){this.accumulationRenderer?.setStencilMask(this._fboHandle?.getAttachment(f))}setParameters(e){e.previewing!==void 0&&(this._previewing=e.previewing),e.lightDirections!==void 0&&(this._primarySet.lightDirections=e.lightDirections),e.lightDirectionsContext!==void 0&&(this._contextSet.lightDirections=e.lightDirectionsContext),e.enabled===!0?this._enable():e.enabled===!1&&this._disable(),e.analysisVolume!==void 0&&(this._analysisVolume=e.analysisVolume),this.accumulationRenderer?.setOptions(e)}readAccumulatedShadow(e,t){let n=this._primarySet.progress;return!this.active||!this._fboHandle||n<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,p.UNSIGNED_BYTE,M),M[0]/n)}_updateCamera(){if(!this.active)return;let e=this.bindParameters.camera,t=this._accumulationBindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this.accumulationRenderer?.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;let e=this._numActive===2,{width:t,height:n}=this._fboHandle.fbo,r=this._createFBO(t,n);e&&(this._clearFramebuffer(r),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,r.fbo),this._fboHandle.dispose(),this._fboHandle=r,this.requestRender(1)}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=s(this._fboHandle),this._enabled=!1,this.requestRender(1))}_createFBO(e,t){return this.fboCache.acquire(e,t,this.produces,this._colorFormat)}_invalidateAccumulationSets(){for(let e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(let e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,n){if(!e)return;let r=this.techniques.get(O,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(r,n,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,this._vao.vertexCount(`geometry`))}_accumulateShadow(e,t){this.view.stage.renderer.renderShadowAccumulationShadowMap(t.camera,t.contentCamera,this._accumulationBindParameters.shadowMap,e.lightDirections[e.progress++],this._depthRange);let n=this.techniques.get(E,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(n,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(n.primitiveType,0,this._vao.vertexCount(`geometry`))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this.requestRender(1)}get _rctx(){return this.renderingContext}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([t()],A.prototype,`consumes`,void 0),e([t()],A.prototype,`produces`,void 0),e([t()],A.prototype,`_refining`,null),e([t()],A.prototype,`active`,null),e([t()],A.prototype,`_doneAccumulating`,null),e([t()],A.prototype,`_numActive`,null),e([t()],A.prototype,`_colorFormat`,null),e([t()],A.prototype,`_depthRange`,void 0),e([t()],A.prototype,`_enabled`,void 0),e([t()],A.prototype,`_previewing`,void 0),e([t()],A.prototype,`accumulationRenderer`,void 0),A=e([n(`esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowAccumulator`)],A);const j=6,M=new Uint8Array(4);class N{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=u(0),this._sampleCount=u(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){let t=this._cachedLightDirections,n=Math.min(T,e.length);if(!r(t,0,t.length,e,0,n,a)){t.length=n,this._sampleCount.value=n;for(let r=0;r<n;++r)t[r]=i(t[r]??o(),e[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}}export{A as ShadowAccumulator};
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{sliceEquals as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{copy as i,equals as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as c,sync as l}from"../../../../../core/reactiveUtils.js";import{signal as u}from"../../../../../core/signal.js";import{PrimitiveType as d,DepthStencilAttachment as f,PixelType as p}from"../../../../webgl/enums.js";import{DisposableFramebufferObject as m}from"../../../../webgl/FramebufferObject.js";import{noParameters as h}from"../../../../webgl/NoParameters.js";import{InternalRenderCategory as g}from"../../../webgl.js";import _ from"../../../webgl/RenderNode.js";import{ReadShadowMapPassParameters as v}from"../../core/shaderLibrary/shading/readShadow.glsl.js";import{BindParameters as y}from"../../lib/BindParameters.js";import{DepthRange as b}from"../../lib/DepthRange.js";import{createQuadVAO as x}from"../../lib/glUtil3D.js";import{ShadowMap as S}from"../../lib/ShadowMap.js";import{V as C}from"../../../../../chunks/VolumeMask.glsl.js";import{volumeToVao as w}from"../focusArea/focusAreaMaskUtils.js";import{S as T}from"../../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as E}from"./ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as D}from"./ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as O}from"./ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as k}from"./ShadowCastMaskTechnique.js";let A=class extends _{constructor(e){super(e),this.consumes={required:[]},this.produces=g.SHADOW_ACCUMULATION,this._fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new N(new D(0),()=>this._requestRenderIfEnabled()),this._contextSet=new N(new D(1),()=>this._requestRenderIfEnabled()),this._passParameters=new v,this._maskParameters=new C,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=b.Zero,this._didAccumulate=!1,this._enabled=!1,this._previewing=!1,this.accumulationRenderer=null,this._shadowAccumulatorKey=Symbol(`shadowAccumulator`);let{view:t}=e,n=t.stage.renderer.fboCache;this._accumulationBindParameters=new y(new S(n,t.stage.isGlobal)),this._accumulationBindParameters.shadowMap.enabled=!0,this._vao=x(n.rctx),this._tmpReadFbo=new m(n.rctx),this.addHandles([c(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},l),c(()=>this._numActive,()=>this._numActiveChanged(),l)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this.accumulationRenderer=null,this._fboHandle=s(this._fboHandle),this._vao=s(this._vao),this._volumeVao=s(this._volumeVao),this._tmpReadFbo=s(this._tmpReadFbo),this._accumulationBindParameters.destroy();for(let e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this._fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&this._accumulationSets().some(e=>e.active)}get canAccumulate(){return this._accumulationBindParameters.depth!=null&&this._depthRange!==b.Zero&&this.accumulationRenderer!=null&&this.accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return this._accumulationSets().every(e=>e.doneAccumulating)}get _numActive(){return this._accumulationSets().reduce((e,t)=>e+ +t.active,0)}get _colorFormat(){return this._numActive===2?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=s(this._volumeVao),this._volumeVertexCount=0;let t=e!=null;for(let e of this._accumulationSets())e.configuration.useMask=t;if(!t)return;let n=e.geometryVolume,{vao:r,vertexCount:i}=w(this._rctx,n);this._volumeVao=r,this._volumeVertexCount=i}get requireGeometryDepth(){return this.accumulating||this._volumeVao!=null}precompile(){if(this.active&&(this._fullyRecompute=this.bindParameters.frameRendererTarget!==0,this.accumulating)){for(let e of this._accumulationSets())this.techniques.precompile(E,e.configuration),this.techniques.precompile(O,e.configuration);this.techniques.precompile(k)}}get didAccumulate(){return this._didAccumulate}render(){this._updateCamera(),this._didAccumulate=this._renderAccumulation(),this._updateMask();let e=this._fboHandle;return e?.retain(),e}_renderAccumulation(){if(!this.active)return!1;if(this._accumulationBindParameters.contentCamera=this.bindParameters.contentCamera,this._accumulationBindParameters.depth=this.bindParameters.depth,this._passParameters.origin=this._accumulationBindParameters.camera.center,!this.canAccumulate||(this._renderAreaMask(),!this.accumulating))return this._accumulationBindParameters.depth=null,!1;(this._previewing||this._fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._accumulationBindParameters);let e=this._accumulateSetsForRenderFrame(this._previewing&&!this._fullyRecompute,this._accumulationBindParameters);return this._accumulationBindParameters.depth=null,e}_renderAreaMask(){let e=this.techniques.getCompiled(k),t=this._volumeVao,n=this._volumeVertexCount,r=this._fboHandle,i=this._analysisVolume;if(r?.detachDepth(),!e||!t||n<1||!r||!i)return;r.acquireDepth(14);let a=this._rctx,o=this._accumulationBindParameters,s=o.depth,c=this._tmpReadFbo;c.attachDepthStencil(s?.attachment),a.blitFramebuffer(c,r.fbo,256),c.detachDepthStencilTexture(),a.bindFramebuffer(r.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);let l=a.bindTechnique(e,o,h);this._maskParameters.origin=i.origin,l.bindDraw(o,h,this._maskParameters),a.bindVAO(t),a.drawArrays(d.TRIANGLES,0,n)}_clearBuffersOnAccumulationStart(e){if(this._accumulationSets().every(e=>e.progress===0))this._clearFramebuffer();else for(let t of this._accumulationSets())t.progress===0&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let n=!1;for(let r of this._accumulationSets())this._accumulateSet(r,e,t),n=!0;return n&&this.requestRender(1),n}_accumulateSet(e,t,n){let r=t?Math.min(j,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let t=0;t<r;++t)this._accumulateShadow(e,n)}_updateMask(){this.accumulationRenderer?.setStencilMask(this._fboHandle?.getAttachment(f))}setParameters(e){e.previewing!==void 0&&(this._previewing=e.previewing),e.lightDirections!==void 0&&(this._primarySet.lightDirections=e.lightDirections),e.lightDirectionsContext!==void 0&&(this._contextSet.lightDirections=e.lightDirectionsContext),e.enabled===!0?this._enable():e.enabled===!1&&this._disable(),e.analysisVolume!==void 0&&(this._analysisVolume=e.analysisVolume),this.accumulationRenderer?.setOptions(e)}readAccumulatedShadow(e,t){let n=this._primarySet.progress;return!this.active||!this._fboHandle||n<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,p.UNSIGNED_BYTE,M),M[0]/n)}_updateCamera(){if(!this.active)return;let e=this.bindParameters.camera,t=this._accumulationBindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this.accumulationRenderer?.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;let e=this._numActive===2,{width:t,height:n}=this._fboHandle.fbo,r=this._createFBO(t,n);e&&(this._clearFramebuffer(r),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,r.fbo),this._fboHandle.dispose(),this._fboHandle=r,this.requestRender(1)}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=s(this._fboHandle),this._enabled=!1,this.requestRender(1))}_createFBO(e,t){return this.fboCache.acquire(e,t,this.produces,this._colorFormat)}_invalidateAccumulationSets(){for(let e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(let e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,n){if(!e)return;let r=this.techniques.get(O,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(r,n,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,this._vao.vertexCount(`geometry`))}_accumulateShadow(e,t){this.view.stage.renderer.renderShadowAccumulationShadowMap(t.camera,t.contentCamera,this._accumulationBindParameters.shadowMap,e.lightDirections[e.progress++],this._depthRange);let n=this.techniques.get(E,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(n,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(n.primitiveType,0,this._vao.vertexCount(`geometry`))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this.requestRender(1)}get _rctx(){return this.renderingContext}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([t()],A.prototype,`consumes`,void 0),e([t()],A.prototype,`produces`,void 0),e([t()],A.prototype,`_refining`,null),e([t()],A.prototype,`active`,null),e([t()],A.prototype,`_doneAccumulating`,null),e([t()],A.prototype,`_numActive`,null),e([t()],A.prototype,`_colorFormat`,null),e([t()],A.prototype,`_depthRange`,void 0),e([t()],A.prototype,`_enabled`,void 0),e([t()],A.prototype,`_previewing`,void 0),e([t()],A.prototype,`accumulationRenderer`,void 0),A=e([n(`esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowAccumulator`)],A);const j=6,M=new Uint8Array(4);class N{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=u(0),this._sampleCount=u(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){let t=this._cachedLightDirections,n=Math.min(T,e.length);if(!r(t,0,t.length,e,0,n,a)){t.length=n,this._sampleCount.value=n;for(let r=0;r<n;++r)t[r]=i(t[r]??o(),e[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}}export{A as ShadowAccumulator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as n,transformMat4 as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustumPlanes.js";import{create as s,fromPoints as c,copy as l}from"../../../../geometry/support/ray.js";import u from"../../webgl/RenderCamera.js";import{HUDTarget as d,HUDIntersectorResult as f}from"./HUDIntersectorResult.js";import{IntersectorOptions as p}from"./IntersectorInterfaces.js";import{IntersectorResultRay as m,compareOrderedIntersectionHits as h}from"./IntersectorResult.js";import{ObjectTarget as g}from"./ObjectTarget.js";import{PolygonIntersectionResults as _}from"./PolygonIntersectionResults.js";import{IntersectorTransform as v,getVerticalOffsetObject3D as y}from"./verticalOffsetUtils.js";const b=1e-5,x=t();class S{constructor(e){this.options=new p,this._results=new C,this.polygonResults=new _,this.transform=new v,this.camera=new u,this.metersPerRenderUnit=1,this.screenPolygonPrimitiveProcessor=w,this.tolerance=b,this.verticalOffset=null,this._ray=s(),this._rayEnd=a(),this._rayBeginTransformed=a(),this._rayEndTransformed=a()
|
|
2
|
+
import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as n,transformMat4 as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustumPlanes.js";import{create as s,fromPoints as c,copy as l}from"../../../../geometry/support/ray.js";import u from"../../webgl/RenderCamera.js";import{HUDTarget as d,HUDIntersectorResult as f}from"./HUDIntersectorResult.js";import{IntersectorOptions as p}from"./IntersectorInterfaces.js";import{IntersectorResultRay as m,compareOrderedIntersectionHits as h}from"./IntersectorResult.js";import{ObjectTarget as g}from"./ObjectTarget.js";import{PolygonIntersectionResults as _}from"./PolygonIntersectionResults.js";import{IntersectorTransform as v,getVerticalOffsetObject3D as y}from"./verticalOffsetUtils.js";const b=1e-5,x=t();class S{constructor(e){this.isGlobal=e,this.options=new p,this._results=new C,this.polygonResults=new _,this.transform=new v,this.camera=new u,this.metersPerRenderUnit=1,this.screenPolygonPrimitiveProcessor=w,this.tolerance=b,this.verticalOffset=null,this._ray=s(),this._rayEnd=a(),this._rayBeginTransformed=a(),this._rayEndTransformed=a()}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(e,t,n){this.resetWithRay(c(e,t,this._ray),n)}resetWithRay(e,t){this.camera=t,e!==this._ray&&l(e,this._ray),this.options.verticalOffset===0?this.verticalOffset=null:this.isGlobal?this.verticalOffset=this.options.verticalOffset:this._ray.origin[2]-=this.options.verticalOffset,n(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray),this.polygonResults.init()}intersect(e=null,t,n,r,i){this.point=t,this.filterPredicate=r,this.tolerance=n??b;let a=y(this.verticalOffset);if(e&&e.length>0){let t=i?e=>{i(e)&&this.intersectObject(e)}:e=>{this.intersectObject(e)};for(let n of e){let e=n.getSpatialQueryAccelerator?.();e==null?n.objects.forEach(e=>t(e)):(a==null?e.forEachAlongRay(this._ray.origin,this._ray.direction,t):e.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,t,a),this.options.selectionMode&&this.options.hud&&e.forEachDegenerateObject(t))}}this.sortResults()}*intersectScreenPolygon(e=null,t){if(this.verticalOffset=null,e?.length)for(let n of e){let e=n.getSpatialQueryAccelerator?.();if(e!=null)for(let n of e.intersectingFrustumValues(t.broadPhaseFrustum,e=>e.visible))yield*this._intersectScreenPolygonObject(n,t);else for(let e of n.objects.values())e.visible&&o(t.broadPhaseFrustum,e.boundingVolumeWorldSpace.sphere)&&(yield*this._intersectScreenPolygonObject(e,t))}}*intersectHUDScreenPolygon(e=null,t){if(this.verticalOffset=null,this.options.selectionMode&&this.options.hud&&e?.length)for(let n of e){let e=(n.getSpatialQueryAccelerator?.())?.degenerateObjectValues()??n.objects.values();for(let n of e)yield*this._intersectScreenPolygonObject(n,t)}}*_intersectScreenPolygonObject(e,t){let n=e.geometries;if(!e.visible||!n)return;let r=e.effectiveTransformation;for(let i of n){if(!i.visible)continue;let{material:n,id:a}=i;if(!n.visible||!n.intersectScreenPolygon)continue;this._setGeometryTransform(r,i);let o=n.intersectScreenPolygon(i,this.transform.transform,this,t);o?.valid&&this._handleObjectScreenPolygonIntersection(o.type,new g(e,a,o.primitiveIndex),o.distance,o.renderDistance,o.point),yield}}intersectObject(e){let t=e.geometries;if(!t)return;let n=e.effectiveTransformation,i=y(this.verticalOffset);for(let a of t){if(!a.visible)continue;let{material:t,id:o}=a;if(!t.visible)continue;this._setGeometryTransform(n,a),r(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),r(this._rayEndTransformed,this.rayEnd,this.transform.inverse);let s=this.transform.transform;i!=null&&(i.objectTransform=this.transform),t.intersectRay(a,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(t,n,r,i,a)=>this.handleObjectIntersection({object:e,geometryId:o,primitiveIndex:i},t,n,r,s,a))}}_setGeometryTransform(t,n){let r=n.type===1?e(x,n.localOrigin.vec3):n.transformation;this.transform.setAndInvalidateLazyTransforms(t,r)}handleObjectIntersection(e,t,n,r,i,a){if(t<0||this.filterPredicate!=null&&!this.filterPredicate(this._ray.origin,this._rayEnd,n))return;let o=a?this._results.hud:this._results;e=a?new d(e,a):e;let s=a?i=>i.set(1,e,t,n,r):a=>a.set(4,e,t,n,r,i);if((o.min.renderDistance==null||n<o.min.renderDistance)&&s(o.min),this.options.store!==0&&(o.max.renderDistance==null||n>o.max.renderDistance)&&s(o.max),this.options.store===2){if(a){let e=new f(this._ray);s(e),this._results.hud.all.push(e)}else{let e=new m(this._ray);s(e),this._results.all.push(e)}}}_handleObjectScreenPolygonIntersection(e,t,n,r,i){n<0||(this.filterPredicate==null||i!=null&&this.filterPredicate(this.camera.eye,i,1))&&this.polygonResults.add(e,e===1&&i?new d(t,i):t,n,r)}sortResults(e=this._results.all){e.sort(h)}}class C{constructor(){this.min=new m(s()),this.max=new m(s()),this.hud={min:new f(s()),max:new f(s()),all:[]},this.ground=new m(s()),this.all=[]}init(e){this.min.init(e),this.max.init(e),this.ground.init(e),this.all.length=0,this.hud.min.init(e),this.hud.max.init(e),this.hud.all.length=0}}const w={*processTriangle(e){yield e},*processLineSegment(e,t,n){i(e[0],t),i(e[1],n),yield e},validatePoint(){return!0}};export{S as Intersector,w as defaultScreenPolygonPrimitiveProcessor,b as defaultTolerance};
|