@arcgis/core 4.34.0-next.14 → 4.34.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/Components/sanitizerUtils.d.ts +3 -0
- package/applications/Components/sanitizerUtils.js +5 -0
- package/applications/MapViewer/layerUtils.d.ts +3 -0
- package/applications/MapViewer/layerUtils.js +5 -0
- package/applications/SceneViewer/layerUtils.d.ts +2 -2
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{a08ce98672ab94d19613.js → 04e558a970c6a77f243e.js} +1 -1
- package/assets/esri/core/workers/chunks/0512ee54f2259a437fdb.js +1 -0
- package/assets/esri/core/workers/chunks/0d99579d8cdeddc0fc9c.js +1 -0
- package/assets/esri/core/workers/chunks/0f81a2deb656e8b28eae.js +1 -0
- package/assets/esri/core/workers/chunks/{ad4f65d764654c70a117.js → 0f8f217aaf42eb1b9699.js} +1 -1
- package/assets/esri/core/workers/chunks/{74276044cb75b51967f2.js → 10eb89a93c8e31f03c95.js} +1 -1
- package/assets/esri/core/workers/chunks/1443520c9fb23381f8d5.js +1 -0
- package/assets/esri/core/workers/chunks/15d3193576f93586674c.js +1 -0
- package/assets/esri/core/workers/chunks/1a7570bd2b79194ff94b.js +42 -0
- package/assets/esri/core/workers/chunks/243eb8a317333ec2715b.js +1 -0
- package/assets/esri/core/workers/chunks/{0ed4ec00ef16aa58a33d.js → 254c4f7e277ae9915dce.js} +1 -1
- package/assets/esri/core/workers/chunks/273beed633cc37416ad7.js +1 -0
- package/assets/esri/core/workers/chunks/2990145d7ac3af0d68be.js +1 -0
- package/assets/esri/core/workers/chunks/{63852887b3f07d50f7c9.js → 2ad538440cfb3ab94787.js} +1 -1
- package/assets/esri/core/workers/chunks/2d51d0a24cdc89bafa1c.js +1 -0
- package/assets/esri/core/workers/chunks/2d89e354eeadadca4f7f.js +1 -0
- package/assets/esri/core/workers/chunks/3f8cc157b65a9d570921.js +1 -0
- package/assets/esri/core/workers/chunks/{2254989ca3ff3960f2fe.js → 400a4c9fa62964f8fa1d.js} +1 -1
- package/assets/esri/core/workers/chunks/445ddf57d2f503a0b98b.js +1 -0
- package/assets/esri/core/workers/chunks/{aaa564c84ee8ea36fbb4.js → 49a57dc1e6d1048fa949.js} +1 -1
- package/assets/esri/core/workers/chunks/513dc2467e9b8b8c6df4.js +1 -0
- package/assets/esri/core/workers/chunks/52239e958a82ebcd2e7a.js +1 -0
- package/assets/esri/core/workers/chunks/53e43798d08ad2075c1f.js +1 -0
- package/assets/esri/core/workers/chunks/{8b93cd4132934b0d7d39.js → 54814a269d44855f0673.js} +1 -1
- package/assets/esri/core/workers/chunks/55ce214a10fb6fc2e901.js +1 -0
- package/assets/esri/core/workers/chunks/{e7589c39b13295af8f1d.js → 604f8094992bb642378b.js} +1 -1
- package/assets/esri/core/workers/chunks/66c8816e91e3f9e214d4.js +346 -0
- package/assets/esri/core/workers/chunks/6975929fa91c81c8afc0.js +1 -0
- package/assets/esri/core/workers/chunks/7716a9fb380d66ba7292.js +1 -0
- package/assets/esri/core/workers/chunks/77ad62ed93f713a909f0.js +1 -0
- package/assets/esri/core/workers/chunks/7b9eec0090f48e9cdaf1.js +1 -0
- package/assets/esri/core/workers/chunks/7c56740cac444419e5b4.js +1 -0
- package/assets/esri/core/workers/chunks/{3b63edcd34f832ac7bd8.js → 7c6b9e2c1dada4668c01.js} +1 -1
- package/assets/esri/core/workers/chunks/{af0d7a7cbbaad47a49c6.js → 802c6b1a6cb9264b8e4f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b21651eb93efe9ce089.js → 827919fe23e06e40a330.js} +189 -165
- package/assets/esri/core/workers/chunks/87986f31061c426e761b.js +1 -0
- package/assets/esri/core/workers/chunks/{7ae88c141a5d85e5bb88.js → 87a743df7d8556d5e253.js} +1 -1
- package/assets/esri/core/workers/chunks/8855f1a6224ffbd0bb66.js +1 -0
- package/assets/esri/core/workers/chunks/885e8e90dfe5dbd5053d.js +1 -0
- package/assets/esri/core/workers/chunks/8865bd8f196556441ce3.js +1 -0
- package/assets/esri/core/workers/chunks/8b1842f0f94c18652d4e.js +1 -0
- package/assets/esri/core/workers/chunks/932808e485f305b6a26a.js +1 -0
- package/assets/esri/core/workers/chunks/93c145a738b3f6cf4ee4.js +1 -0
- package/assets/esri/core/workers/chunks/93e66d9c49eaeb503bff.js +1 -0
- package/assets/esri/core/workers/chunks/9959a91c8de6fef499c2.js +1 -0
- package/assets/esri/core/workers/chunks/9d779891d51d196aa8c8.js +1 -0
- package/assets/esri/core/workers/chunks/{6cbe8205a4e0f62da519.js → a5a27e2e9b91fbe12da9.js} +1 -1
- package/assets/esri/core/workers/chunks/aeac889d95f34b6d3b72.js +1 -0
- package/assets/esri/core/workers/chunks/c1a72e1dbd1ba7b41965.js +1 -0
- package/assets/esri/core/workers/chunks/c4065934637b820cad5b.js +1 -0
- package/assets/esri/core/workers/chunks/cc1328cacc4ac07eb548.js +1 -0
- package/assets/esri/core/workers/chunks/d0876a713079c669995a.js +1 -0
- package/assets/esri/core/workers/chunks/{3145218abe59b5e99ff8.js → d2139307f62ea8bf999a.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5f770302dc686e55ba7.js → daffceecdc71e74d2629.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f58da371633967a61ca.js → ddb66fe6fcd0764daa7a.js} +1 -1
- package/assets/esri/core/workers/chunks/{0eeb0dce918e4827309a.js → eac7af86166c09c6a9be.js} +1 -1
- package/assets/esri/core/workers/chunks/{998819aade3898f52414.js → ec49e2849766402ad5c7.js} +1 -1
- package/assets/esri/core/workers/chunks/{7317346ed8d7c5bb859d.js → f537a02dc2fc9e6435a2.js} +1 -1
- package/assets/esri/core/workers/chunks/fa3edfbdaa3b716a3a10.js +1 -0
- package/assets/esri/core/workers/chunks/fa5715ca3ce95d005b0a.js +1 -0
- package/assets/esri/core/workers/chunks/{7e1906d35a764f7f10b0.js → fe1129f03476825a7344.js} +1 -1
- package/assets/esri/themes/base/widgets/_SelectionList.scss +31 -28
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/DefaultMaterial.glsl.js +30 -28
- package/chunks/RealisticTree.glsl.js +25 -22
- package/chunks/aiServices.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/config.js +1 -1
- package/core/LRUCache.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/accessorSupport/utils.js +1 -1
- package/core/object.js +1 -1
- package/core/urlUtils.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/core/workers/WorkerHandle.js +1 -1
- package/editing/sharedTemplates/executor/builders/bufferPolygonToPolygon.js +1 -1
- package/interfaces.d.ts +76 -24
- package/intl/date.js +1 -1
- package/intl/duration.js +1 -1
- package/intl/locale.js +1 -1
- package/intl/messages.js +1 -1
- package/intl/number.js +1 -1
- package/intl.d.ts +1 -0
- package/intl.js +1 -1
- package/kernel.js +1 -1
- package/layers/CatalogLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/WFSLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/queryValidationUtils.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/support/arcgisLayers.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/fetchService.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/rasterDatasets/covJSONParser.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/package.json +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/loadUtils.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/renderers/support/DictionaryScriptEvaluator.js +1 -1
- package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
- package/rest/networks/circuits/support/CircuitVerifyResult.js +1 -1
- package/rest/support/DateBinTimeInterval.js +1 -1
- package/rest/support/DateBinUtils.js +5 -0
- package/rest/support/TranslateParameters.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/ArcadeExpression.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/WaterSymbol3DLayer.js +1 -1
- package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleProperty.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
- package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/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/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SLodHandling.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/makeScheduleFunction.js +1 -1
- package/views/3d/layers/support/symbolColorUtils.js +1 -1
- package/views/3d/state/controllers/FovController.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/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.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/utils/navigationUtils.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstanceColor.glsl.js +11 -0
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/MaskedColor.glsl.js +18 -0
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +40 -26
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +35 -24
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +12 -8
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +3 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +26 -8
- package/views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4sPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatDrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatsPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix3DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix3PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4sDrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4sPassUniform.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/ui/UI.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions/DirectionsVisibleElements.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflowData.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationNode.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationSettings.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI360.js +5 -0
- package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider/scalePreviewUtils.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/support/ItemList.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/widgets/support/symbolPreviewUtils.js +1 -1
- package/widgets/support/timeWidgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0dbb350ce651bc236ec8.js +0 -1
- package/assets/esri/core/workers/chunks/0ff6f15d46d7ddf6fe4d.js +0 -1
- package/assets/esri/core/workers/chunks/18011c691e0aca4144dd.js +0 -1
- package/assets/esri/core/workers/chunks/183a7dec68c8ba6eb3d6.js +0 -1
- package/assets/esri/core/workers/chunks/2ddb776434a93b8d9e63.js +0 -1
- package/assets/esri/core/workers/chunks/369978472cc9ee6a00b5.js +0 -346
- package/assets/esri/core/workers/chunks/3916879b9ca8c6979011.js +0 -1
- package/assets/esri/core/workers/chunks/3cbc498388fb1931a9f8.js +0 -1
- package/assets/esri/core/workers/chunks/4079e307a0fce4516aa4.js +0 -1
- package/assets/esri/core/workers/chunks/4088f4c25a09932a3eb1.js +0 -1
- package/assets/esri/core/workers/chunks/462cc6966d060be59c7c.js +0 -1
- package/assets/esri/core/workers/chunks/467cacb501b0417bb4df.js +0 -1
- package/assets/esri/core/workers/chunks/49089731ecfe7e8bb2f6.js +0 -1
- package/assets/esri/core/workers/chunks/4a805e7a57d25c4b595f.js +0 -66
- package/assets/esri/core/workers/chunks/4e0bae3671fe1c7efa76.js +0 -1
- package/assets/esri/core/workers/chunks/58f92100b1b2343111c6.js +0 -1
- package/assets/esri/core/workers/chunks/5dcc8fa321f0a7c49f36.js +0 -1
- package/assets/esri/core/workers/chunks/5df4f2315fae82030e87.js +0 -1
- package/assets/esri/core/workers/chunks/5e539ce4751bcfa57145.js +0 -1
- package/assets/esri/core/workers/chunks/6194636638b0439fccd8.js +0 -1
- package/assets/esri/core/workers/chunks/622c0552ca3cd674d46c.js +0 -1
- package/assets/esri/core/workers/chunks/64f5f27e7c5649d79cbc.js +0 -1
- package/assets/esri/core/workers/chunks/658e82c9b722852e02d0.js +0 -1
- package/assets/esri/core/workers/chunks/679d7baea233faf3fdbc.js +0 -1
- package/assets/esri/core/workers/chunks/72ea996b03932c0f004f.js +0 -1
- package/assets/esri/core/workers/chunks/7aef81778155be373d3e.js +0 -1
- package/assets/esri/core/workers/chunks/97b69fec3e87f11210ba.js +0 -1
- package/assets/esri/core/workers/chunks/a1a42b0d7cd47b647f8a.js +0 -1
- package/assets/esri/core/workers/chunks/a250a5c6e055e33bd25c.js +0 -1
- package/assets/esri/core/workers/chunks/a622ed3f182648ab3ff6.js +0 -1
- package/assets/esri/core/workers/chunks/a693cd3af2e995972252.js +0 -1
- package/assets/esri/core/workers/chunks/b4273381dc069f4e1fa2.js +0 -1
- package/assets/esri/core/workers/chunks/b72137c63b7f2a525d9e.js +0 -1
- package/assets/esri/core/workers/chunks/c2264451d12f1fbaad22.js +0 -1
- package/assets/esri/core/workers/chunks/c6c86cbe65a58c3093ae.js +0 -1
- package/assets/esri/core/workers/chunks/c8856370bae65d9eeb2b.js +0 -1
- package/assets/esri/core/workers/chunks/cd4fb107489594c57438.js +0 -1
- package/assets/esri/core/workers/chunks/d28d874c1337b69fedc0.js +0 -1
- package/assets/esri/core/workers/chunks/ec922f876e1465d36045.js +0 -1
- package/assets/esri/core/workers/chunks/fe3703ec198cbfebec30.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as s}from"../../../../webgl/Uniform.js";class o extends s{constructor(s,o){super(s,"mat3",r.Pass,((r,
|
|
5
|
+
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as s}from"../../../../webgl/Uniform.js";class o extends s{constructor(s,o,t){super(s,"mat3",r.Pass,((r,e,m)=>r.setUniformMatrix3fv(s,o(e,m),t)))}}export{o as Matrix3PassUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as o}from"../../../../webgl/Uniform.js";class t extends o{constructor(o,t){super(o,"mat4",r.Bind,((r,
|
|
5
|
+
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as o}from"../../../../webgl/Uniform.js";class t extends o{constructor(o,t,e){super(o,"mat4",r.Bind,((r,s)=>r.setUniformMatrix4fv(o,t(s),e)))}}export{t as Matrix4BindUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as o}from"../../../../webgl/Uniform.js";class t extends o{constructor(o,t){super(o,"mat4",r.Draw,((r,
|
|
5
|
+
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as o}from"../../../../webgl/Uniform.js";class t extends o{constructor(o,t,e){super(o,"mat4",r.Draw,((r,s,m)=>r.setUniformMatrix4fv(o,t(s,m),e)))}}export{t as Matrix4DrawUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as s}from"../../../../webgl/Uniform.js";class o extends s{constructor(s,o){super(s,"mat4",r.Pass,((r,
|
|
5
|
+
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as s}from"../../../../webgl/Uniform.js";class o extends s{constructor(s,o,t){super(s,"mat4",r.Pass,((r,e,m)=>r.setUniformMatrix4fv(s,o(e,m),t)))}}export{o as Matrix4PassUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as o}from"../../../../webgl/Uniform.js";class t extends o{constructor(o,t,e){super(o,"mat4",r.Draw,((r,e,
|
|
5
|
+
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as o}from"../../../../webgl/Uniform.js";class t extends o{constructor(o,t,e,s){super(o,"mat4",r.Draw,((r,e,m,i)=>r.setUniformMatrix4fv(o,t(e,m,i),s)),e)}}export{t as Matrix4sDrawUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as s}from"../../../../webgl/Uniform.js";class o extends s{constructor(s,o,t){super(s,"mat4",r.Pass,((r,t,
|
|
5
|
+
import{BindType as r}from"../../../../webgl/BindType.js";import{Uniform as s}from"../../../../webgl/Uniform.js";class o extends s{constructor(s,o,t,e){super(s,"mat4",r.Pass,((r,t,m)=>r.setUniformMatrix4fv(s,o(t,m),e)),t)}}export{o as Matrix4sPassUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{ColorFormat as m}from"../../core/FBOCacheFormats.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{B as n,a as c}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as u}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as h}from"./BloomBlurTechniqueConfiguration.js";import{B as p}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as b}from"./BloomCompositionTechnique.js";import{blurRadiusPresets as _,lodFactorsPresets as d,normalizePreset as g}from"./BloomPresets.glsl.js";import{RenderRequestType as f}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as P,DepthStencilAttachment as T,FramebufferBit as R}from"../../../../webgl/enums.js";let j=class extends l{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT_ENVIRONMENT,"emissive"]},this._blurHorizontalConfiguration=new h,this._blurVerticalConfiguration=new h,this._compositionParameters=new p,this._blurParameters=new n,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),o),r((()=>this.view.qualitySettings.bloom),(e=>{e?(this._enable(),this.precompile()):this._disable()}),o)])}
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{ColorFormat as m}from"../../core/FBOCacheFormats.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{B as n,a as c}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as u}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as h}from"./BloomBlurTechniqueConfiguration.js";import{B as p}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as b}from"./BloomCompositionTechnique.js";import{blurRadiusPresets as _,lodFactorsPresets as d,normalizePreset as g}from"./BloomPresets.glsl.js";import{RenderRequestType as f}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as P,DepthStencilAttachment as T,FramebufferBit as R}from"../../../../webgl/enums.js";let j=class extends l{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT_ENVIRONMENT,"emissive"]},this._blurHorizontalConfiguration=new h,this._blurVerticalConfiguration=new h,this._compositionParameters=new p,this._blurParameters=new n,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),o),r((()=>this.view.qualitySettings.bloom),(e=>{e?(this._enable(),this.precompile()):this._disable()}),o)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=_[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(_.cloudy,_[e.type],r)}this._compositionParameters.lodFactors=d[e.type].far,this._compositionParameters.lodFactorsFront=d[e.type].near,this.requestRender(f.UPDATE)}precompile(){this.techniques.precompile(u,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.bloomStage=c.Vertical,this.techniques.precompile(u,this._blurVerticalConfiguration),this.techniques.precompile(b)}render(e){const t=e.find((({name:e})=>e===a.TRANSPARENT_ENVIRONMENT)),r=t.getAttachment(P)?.attachment;if(!r)return t;const o=this.techniques.get(u,this._blurHorizontalConfiguration),s=this.techniques.get(u,this._blurVerticalConfiguration),i=this.techniques.get(b);if(!o.compiled||!s.compiled||!i.compiled)return this.requestRender(f.UPDATE),t;const l=t.getTexture(),n=this.fboCache,{fullWidth:c,fullHeight:h}=this.bindParameters.camera,p=this.renderingContext;let _=r,d=c/2,g=h/2;const R=5,j=this._blurParameters.blurRadius;for(let a=0;a<R;a++){const e=n.acquire(d,g,"bloomHorizontal",m.RGBA16FLOAT);this._blurParameters.color=_,this._prepareFBO(e,d,g),p.bindTechnique(o,this.bindParameters,this._blurParameters),p.screen.draw();const t=n.acquire(d,g,"bloomVertical",m.RGBA16FLOAT);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,d,g),p.bindTechnique(s,this.bindParameters,this._blurParameters),p.screen.draw(),e.release(),this._bloomResults[a]=t,d=Math.ceil(d/2),g=Math.ceil(g/2),_=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=j,this._compositionParameters.color=l,this._compositionParameters.emission=r,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const q=n.acquire(l.descriptor.width,l.descriptor.height,this.produces);return this._prepareFBO(q,c,h),p.bindTechnique(i,this.bindParameters,this._compositionParameters),p.screen.draw(),this._bloomResults.forEach((e=>e.release())),q.attachDepth(t.getAttachment(T)),q.attachColor(t.getAttachment(P),P),q}_prepareFBO(e,t,r){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,r),o.setClearColor(0,0,0,0),o.clear(R.COLOR)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=g(e)}}}};e([s()],j.prototype,"consumes",void 0),j=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],j);export{j as BloomRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{CloudsParameters as h}from"../../environment/CloudsParameters.js";import e from"../../webgl/RenderCamera.js";import{HUDRenderStyle as s}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{OITPass as r}from"./OITPass.js";import{RenderSlot as
|
|
5
|
+
import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{CloudsParameters as h}from"../../environment/CloudsParameters.js";import e from"../../webgl/RenderCamera.js";import{HUDRenderStyle as s}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{OITPass as r}from"./OITPass.js";import{RenderSlot as n}from"./RenderSlot.js";import{Update as g}from"./Update.js";import{SceneLighting as l}from"../lighting/SceneLighting.js";class a{constructor(i,t){this.width=i,this.height=t}}class o{constructor(i){this.shadowMap=i,this.slot=n.OPAQUE_MATERIAL,this.slicePlane=null,this.hasOccludees=!1,this.enableFillLights=!0,this.oitPass=r.NONE,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this._camera=new e,this._inverseViewport=t(),this._oldLighting=new l,this._newLighting=new l,this._fadedLighting=new l,this._lighting=this._newLighting,this.ssr=new c,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=t(),this.highlightMixTexture=null,this.hudRenderStyle=s.Occluded,this.hudOccludedFragmentOpacity=1,this.snowCover=!1,this.clouds=new h,this.shadowHighlightsVisible=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=null,this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.terrainDepth=null}get camera(){return this._camera}set camera(i){this._camera=i,this._inverseViewport[0]=1/i.fullViewport[2],this._inverseViewport[1]=1/i.fullViewport[3]}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(i,t,h,e){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=t,this._newLighting.globalFactor=h,this._newLighting.set(i),e===g.FadeWithWeather&&this.clouds.requestFade(),this.fadeLighting()}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}}class c{constructor(){this.fadeFactor=1,this.reprojectionMatrix=i()}}export{o as BindParameters,a as ViewportSize};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{i as t,d as n,n as e,c as o,g as s,f as r,h as l,t as h,e as u}from"../../../../chunks/vec32.js";import{fromValues as c,clone as a,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{create as p,clone as i,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as O,floatArrayFrom as m}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as A,getZeroIndexArray as M}from"../../../../geometry/support/Indices.js";import{create as I,fromPositionAndNormal as y,intersectRay as N}from"../../../../geometry/support/plane.js";import{wrap as P}from"../../../../geometry/support/ray.js";import{Attribute as T}from"./Attribute.js";import{Vec3Compact as S}from"./BufferVectorMath.js";import{Geometry as R}from"./Geometry.js";import{assert as b}from"./Util.js";import{VertexAttribute as L}from"./VertexAttribute.js";import{GeometryType as d}from"./IntersectableGeometry.js";const j=S,E=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],U=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],V=[0,0,1,0,1,1,0,1],v=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],x=new Array(36);for(let Nt=0;Nt<6;Nt++)for(let t=0;t<6;t++)x[6*Nt+t]=Nt;const F=new Array(36);for(let Nt=0;Nt<6;Nt++)F[6*Nt]=0,F[6*Nt+1]=1,F[6*Nt+2]=2,F[6*Nt+3]=2,F[6*Nt+4]=3,F[6*Nt+5]=0;function C(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let o=0;o<8;o++)e[3*o]=E[o][0]*n[0],e[3*o+1]=E[o][1]*n[1],e[3*o+2]=E[o][2]*n[2];return new R(t,[[L.POSITION,new T(e,v,3,!0)],[L.NORMAL,new T(U,x,3)],[L.UV0,new T(V,F,2)]])}const G=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],D=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],q=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],z=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function B(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let o=0;o<6;o++)e[3*o]=G[o][0]*n[0],e[3*o+1]=G[o][1]*n[1],e[3*o+2]=G[o][2]*n[2];return new R(t,[[L.POSITION,new T(e,q,3,!0)],[L.NORMAL,new T(D,z,3)]])}const k=c(-.5,0,-.5),Z=c(.5,0,-.5),H=c(0,0,.5),J=c(0,.5,0),K=f(),Q=f(),W=f(),X=f(),Y=f();n(K,k,J),n(Q,k,Z),l(W,K,Q),e(W,W),n(K,Z,J),n(Q,Z,H),l(X,K,Q),e(X,X),n(K,H,J),n(Q,H,k),l(Y,K,Q),e(Y,Y);const $=[k,Z,H,J],_=[0,-1,0,W[0],W[1],W[2],X[0],X[1],X[2],Y[0],Y[1],Y[2]],tt=[0,1,2,3,1,0,3,2,1,3,0,2],nt=[0,0,0,1,1,1,2,2,2,3,3,3];function et(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let o=0;o<4;o++)e[3*o]=$[o][0]*n[0],e[3*o+1]=$[o][1]*n[1],e[3*o+2]=$[o][2]*n[2];return new R(t,[[L.POSITION,new T(e,tt,3,!0)],[L.NORMAL,new T(_,nt,3)]])}function ot(t,n,e,o,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(o)),f=(c+1)*(a+1),p=O(3*f),i=O(3*f),w=O(2*f),g=[];let m=0;for(let O=0;O<=a;O++){const t=[],e=O/a,o=h+e*u,s=Math.cos(o);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*s,g=Math.sin(o),O=-Math.sin(a)*s;p[3*m]=f*n,p[3*m+1]=g*n,p[3*m+2]=O*n,i[3*m]=f,i[3*m+1]=g,i[3*m+2]=O,w[2*m]=u,w[2*m+1]=e,t.push(m),++m}g.push(t)}const A=new Array;for(let O=0;O<a;O++)for(let t=0;t<c;t++){const n=g[O][t],e=g[O][t+1],o=g[O+1][t+1],s=g[O+1][t];0===O?(A.push(n),A.push(o),A.push(s)):O===a-1?(A.push(n),A.push(e),A.push(o)):(A.push(n),A.push(e),A.push(o),A.push(o),A.push(s),A.push(n))}const I=[[L.POSITION,new T(p,A,3,!0)],[L.NORMAL,new T(i,A,3,!0)]];return s.uv&&I.push([L.UV0,new T(w,A,2,!0)]),s.offset&&(I[0][0]=L.OFFSET,I.push([L.POSITION,new T(Float64Array.from(s.offset),M(A.length),3,!0)])),new R(t,I)}function st(t,n,e,o){const s=rt(n,e,o);return new R(t,s)}function rt(t,n,e){const o=t;let s,r;if(e)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=o*(1+Math.sqrt(5))/2;s=[-o,t,0,o,t,0,-o,-t,0,o,-t,0,0,-o,t,0,o,t,0,-o,-t,0,o,-t,t,0,-o,t,0,o,-t,0,-o,-t,0,o],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<s.length;c+=3)j.scale(s,c,t/j.length(s,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const o=n.toString()+"."+e.toString();if(l[o])return l[o];let r=s.length;return s.length+=3,j.add(s,3*n,s,3*e,s,r),j.scale(s,r,t/j.length(s,r)),r/=3,l[o]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],o=r[e+1],s=r[e+2],l=h(t,o),u=h(o,s),c=h(s,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=o,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=m(s);for(let c=0;c<u.length;c+=3)j.normalize(u,c);return[[L.POSITION,new T(m(s),r,3,!0)],[L.NORMAL,new T(u,r,3,!0)]]}function lt(t,{normal:n,position:e,color:o,rotation:s,size:r,centerOffsetAndDistance:l,uvi:h,featureAttribute:u,objectAndLayerIdColor:c=null}={}){const a=e?i(e):p(),f=n?i(n):w(0,0,1),g=o?[255*o[0],255*o[1],255*o[2],o.length>3?255*o[3]:255]:[255,255,255,255],O=null!=r&&2===r.length?r:[1,1],m=null!=s?[s]:[0],A=M(1),I=[[L.POSITION,new T(a,A,3,!0)],[L.NORMAL,new T(f,A,3,!0)],[L.COLOR,new T(g,A,4,!0)],[L.SIZE,new T(O,A,2)],[L.ROTATION,new T(m,A,1,!0)]];if(h&&I.push([L.UVI,new T(h,A,h.length)]),null!=l){const t=[l[0],l[1],l[2],l[3]];I.push([L.CENTEROFFSETANDDISTANCE,new T(t,A,4)])}if(u){const t=[u[0],u[1],u[2],u[3]];I.push([L.FEATUREATTRIBUTE,new T(t,A,4)])}return new R(t,I,null,d.Point,c)}const ht=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ut(t,n=ht){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const o=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[L.POSITION,new T(e,o,3,!0)],[L.NORMAL,new T(s,r,3,!0)],[L.UV0,new T(l,o,2,!0)],[L.COLOR,new T(h,r,4,!0)]];return new R(t,u)}function ct(t,n,e,o,s=!0,r=!0){let l=0;const h=n,u=t;let a=c(0,l,0),f=c(0,l+u,0),p=c(0,-1,0),i=c(0,1,0);o&&(l=u,f=c(0,0,0),a=c(0,l,0),p=c(0,1,0),i=c(0,-1,0));const w=[f,a],g=[p,i],m=e+2,A=Math.sqrt(u*u+h*h);if(o)for(let O=e-1;O>=0;O--){const t=O*(2*Math.PI/e),n=c(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const o=c(u*Math.cos(t)/A,-h/A,u*Math.sin(t)/A);g.push(o)}else for(let O=0;O<e;O++){const t=O*(2*Math.PI/e),n=c(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const o=c(u*Math.cos(t)/A,h/A,u*Math.sin(t)/A);g.push(o)}const M=new Array,I=new Array;if(s){for(let t=3;t<w.length;t++)M.push(1),M.push(t-1),M.push(t),I.push(0),I.push(0),I.push(0);M.push(w.length-1),M.push(2),M.push(1),I.push(0),I.push(0),I.push(0)}if(r){for(let t=3;t<w.length;t++)M.push(t),M.push(t-1),M.push(0),I.push(t),I.push(t-1),I.push(1);M.push(0),M.push(2),M.push(w.length-1),I.push(1),I.push(2),I.push(g.length-1)}const y=O(3*m);for(let c=0;c<m;c++)y[3*c]=w[c][0],y[3*c+1]=w[c][1],y[3*c+2]=w[c][2];const N=O(3*m);for(let c=0;c<m;c++)N[3*c]=g[c][0],N[3*c+1]=g[c][1],N[3*c+2]=g[c][2];return[[L.POSITION,new T(y,M,3,!0)],[L.NORMAL,new T(N,I,3,!0)]]}function at(t,n,e,o,s,r=!0,l=!0){return new R(t,ct(n,e,o,s,r,l))}function ft(n,o,h,p,i,w,g){const m=i?a(i):c(1,0,0),A=w?a(w):c(0,0,0);g??=!0;const M=f();e(M,m);const I=f();s(I,M,Math.abs(o));const y=f();s(y,I,-.5),r(y,y,A);const N=c(0,1,0);Math.abs(1-u(M,N))<.2&&t(N,0,0,1);const P=f();l(P,M,N),e(P,P),l(N,P,M);const S=2*p+(g?2:0),b=p+(g?2:0),d=O(3*S),j=O(3*b),E=O(2*S),U=new Array(3*p*(g?4:2)),V=new Array(3*p*(g?4:2));g&&(d[3*(S-2)]=y[0],d[3*(S-2)+1]=y[1],d[3*(S-2)+2]=y[2],E[2*(S-2)]=0,E[2*(S-2)+1]=0,d[3*(S-1)]=d[3*(S-2)]+I[0],d[3*(S-1)+1]=d[3*(S-2)+1]+I[1],d[3*(S-1)+2]=d[3*(S-2)+2]+I[2],E[2*(S-1)]=1,E[2*(S-1)+1]=1,j[3*(b-2)]=-M[0],j[3*(b-2)+1]=-M[1],j[3*(b-2)+2]=-M[2],j[3*(b-1)]=M[0],j[3*(b-1)+1]=M[1],j[3*(b-1)+2]=M[2]);const v=(t,n,e)=>{U[t]=n,V[t]=e};let x=0;const F=f(),C=f();for(let t=0;t<p;t++){const n=t*(2*Math.PI/p);s(F,N,Math.sin(n)),s(C,P,Math.cos(n)),r(F,F,C),j[3*t]=F[0],j[3*t+1]=F[1],j[3*t+2]=F[2],s(F,F,h),r(F,F,y),d[3*t]=F[0],d[3*t+1]=F[1],d[3*t+2]=F[2],E[2*t]=t/p,E[2*t+1]=0,d[3*(t+p)]=d[3*t]+I[0],d[3*(t+p)+1]=d[3*t+1]+I[1],d[3*(t+p)+2]=d[3*t+2]+I[2],E[2*(t+p)]=t/p,E[2*t+1]=1;const e=(t+1)%p;v(x++,t,t),v(x++,t+p,t),v(x++,e,e),v(x++,e,e),v(x++,t+p,t),v(x++,e+p,e)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;v(x++,S-2,b-2),v(x++,t,b-2),v(x++,n,b-2)}for(let t=0;t<p;t++){const n=(t+1)%p;v(x++,t+p,b-1),v(x++,S-1,b-1),v(x++,n+p,b-1)}}const G=[[L.POSITION,new T(d,U,3,!0)],[L.NORMAL,new T(j,V,3,!0)],[L.UV0,new T(E,U,2,!0)]];return new R(n,G)}function pt(t,n,e,o,s,r){o=o||10,s=null==s||s,b(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<o;c++){h.push([0,-c-1,-(c+1)%o-1]);const t=c/o*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return it(t,u,n,l,h,s,r)}function it(h,u,a,f,i,w,g=c(0,0,0)){const m=u.length,A=O(a.length*m*3+(6*f.length||0)),M=O(a.length*m*3+(f?6:0)),S=new Array,b=new Array;let d=0,j=0;const E=p(),U=p(),V=p(),v=p(),x=p(),F=p(),C=p(),G=p(),D=p(),q=p(),z=p(),B=p(),k=p(),Z=I();t(D,0,1,0),n(U,a[1],a[0]),e(U,U),w?(r(G,a[0],g),e(V,G)):t(V,0,0,1),Mt(U,V,D,D,x,V,It),o(v,V),o(B,x);for(let t=0;t<f.length;t++)s(F,x,f[t][0]),s(G,V,f[t][2]),r(F,F,G),r(F,F,a[0]),A[d++]=F[0],A[d++]=F[1],A[d++]=F[2];M[j++]=-U[0],M[j++]=-U[1],M[j++]=-U[2];for(let t=0;t<i.length;t++)S.push(i[t][0]>0?i[t][0]:-i[t][0]-1+f.length),S.push(i[t][1]>0?i[t][1]:-i[t][1]-1+f.length),S.push(i[t][2]>0?i[t][2]:-i[t][2]-1+f.length),b.push(0),b.push(0),b.push(0);let H=f.length;const J=f.length-1;for(let t=0;t<a.length;t++){let h=!1;if(t>0){o(E,U),t<a.length-1?(n(U,a[t+1],a[t]),e(U,U)):h=!0,r(q,E,U),e(q,q),r(z,a[t-1],v),y(a[t],q,Z);N(Z,P(z,E),G)?(n(G,G,a[t]),e(V,G),l(x,q,V),e(x,x)):Mt(q,v,B,D,x,V,It),o(v,V),o(B,x)}w&&(r(G,a[t],g),e(k,G));for(let n=0;n<m;n++)if(s(F,x,u[n][0]),s(G,V,u[n][1]),r(F,F,G),e(C,F),M[j++]=C[0],M[j++]=C[1],M[j++]=C[2],r(F,F,a[t]),A[d++]=F[0],A[d++]=F[1],A[d++]=F[2],!h){const t=(n+1)%m;S.push(H+n),S.push(H+m+n),S.push(H+t),S.push(H+t),S.push(H+m+n),S.push(H+m+t);for(let n=0;n<6;n++){const t=S.length-6;b.push(S[t+n]-J)}}H+=m}const K=a[a.length-1];for(let t=0;t<f.length;t++)s(F,x,f[t][0]),s(G,V,f[t][1]),r(F,F,G),r(F,F,K),A[d++]=F[0],A[d++]=F[1],A[d++]=F[2];const Q=j/3;M[j++]=U[0],M[j++]=U[1],M[j++]=U[2];const W=H-m;for(let t=0;t<i.length;t++)S.push(i[t][0]>=0?H+i[t][0]:-i[t][0]-1+W),S.push(i[t][2]>=0?H+i[t][2]:-i[t][2]-1+W),S.push(i[t][1]>=0?H+i[t][1]:-i[t][1]-1+W),b.push(Q),b.push(Q),b.push(Q);const X=[[L.POSITION,new T(A,S,3,!0)],[L.NORMAL,new T(M,b,3,!0)]];return new R(h,X)}function wt(t,n,e,o){b(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),b(3===n[0].length,"createPolylineGeometry(): malformed vertex"),b(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),b(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const s=g(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)s[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[L.POSITION,new T(s,r,3,!0)]];if(e){const t=O(3*e.length);let o=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[o++]=e[s][n];u.push([L.NORMAL,new T(t,r,3,!0)])}return o&&u.push([L.COLOR,new T(o,A(o.length/4),4)]),new R(t,u,null,d.Line)}function gt(t,n,e,o,s,r=0){const l=new Array(18),h=[[-e,r,s/2],[o,r,s/2],[0,n+r,s/2],[-e,r,-s/2],[o,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new R(t,[[L.POSITION,new T(l,u,3,!0)]])}function Ot(n,e){const o=n.getMutableAttribute(L.POSITION).data;for(let s=0;s<o.length;s+=3){const n=o[s],r=o[s+1],l=o[s+2];t(yt,n,r,l),h(yt,yt,e),o[s]=yt[0],o[s+1]=yt[1],o[s+2]=yt[2]}}function mt(t,n=t){const e=t.attributes,o=e.get(L.POSITION).data,s=e.get(L.NORMAL).data;if(s){const t=n.getMutableAttribute(L.NORMAL).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}if(o){const t=n.getMutableAttribute(L.POSITION).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}}function At(t,n,o,s,r){return!(Math.abs(u(n,t))>r)&&(l(o,t,n),e(o,o),l(s,o,t),e(s,s),!0)}function Mt(t,n,e,o,s,r,l){return At(t,n,s,r,l)||At(t,e,s,r,l)||At(t,o,s,r,l)}const It=.99619469809,yt=p();export{mt as cgToGIS,C as createBoxGeometry,at as createConeGeometry,ct as createConeGeometryData,ft as createCylinderGeometry,B as createDiamondGeometry,gt as createExtrudedTriangle,it as createPathExtrusionGeometry,lt as createPointGeometry,rt as createPolySphereData,st as createPolySphereGeometry,wt as createPolylineGeometry,ot as createSphereGeometry,ut as createSquareGeometry,et as createTetrahedronGeometry,pt as createTubeGeometry,Mt as makeOrthoBasisDirUpFallback,Ot as transformInPlace};
|
|
5
|
+
import{i as t,d as n,n as e,c as o,g as s,f as r,h as l,t as h,e as u}from"../../../../chunks/vec32.js";import{fromValues as c,clone as a,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{create as p,clone as i,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as O,floatArrayFrom as m}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as A,getZeroIndexArray as M}from"../../../../geometry/support/Indices.js";import{create as I,fromPositionAndNormal as y,intersectRay as N}from"../../../../geometry/support/plane.js";import{wrap as P}from"../../../../geometry/support/ray.js";import{Attribute as T}from"./Attribute.js";import{Vec3Compact as S}from"./BufferVectorMath.js";import{Geometry as R}from"./Geometry.js";import{assert as b}from"./Util.js";import{VertexAttribute as L}from"./VertexAttribute.js";import{GeometryType as d}from"./IntersectableGeometry.js";const j=S,E=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],U=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],V=[0,0,1,0,1,1,0,1],v=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],x=new Array(36);for(let Nt=0;Nt<6;Nt++)for(let t=0;t<6;t++)x[6*Nt+t]=Nt;const F=new Array(36);for(let Nt=0;Nt<6;Nt++)F[6*Nt]=0,F[6*Nt+1]=1,F[6*Nt+2]=2,F[6*Nt+3]=2,F[6*Nt+4]=3,F[6*Nt+5]=0;function C(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(24);for(let o=0;o<8;o++)e[3*o]=E[o][0]*n[0],e[3*o+1]=E[o][1]*n[1],e[3*o+2]=E[o][2]*n[2];return new R(t,[[L.POSITION,new T(e,v,3,!0)],[L.NORMAL,new T(U,x,3)],[L.UV0,new T(V,F,2)]])}const G=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],D=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],q=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],z=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function B(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(18);for(let o=0;o<6;o++)e[3*o]=G[o][0]*n[0],e[3*o+1]=G[o][1]*n[1],e[3*o+2]=G[o][2]*n[2];return new R(t,[[L.POSITION,new T(e,q,3,!0)],[L.NORMAL,new T(D,z,3)]])}const k=c(-.5,0,-.5),Z=c(.5,0,-.5),H=c(0,0,.5),J=c(0,.5,0),K=f(),Q=f(),W=f(),X=f(),Y=f();n(K,k,J),n(Q,k,Z),l(W,K,Q),e(W,W),n(K,Z,J),n(Q,Z,H),l(X,K,Q),e(X,X),n(K,H,J),n(Q,H,k),l(Y,K,Q),e(Y,Y);const $=[k,Z,H,J],_=[0,-1,0,W[0],W[1],W[2],X[0],X[1],X[2],Y[0],Y[1],Y[2]],tt=[0,1,2,3,1,0,3,2,1,3,0,2],nt=[0,0,0,1,1,1,2,2,2,3,3,3];function et(t,n){Array.isArray(n)||(n=[n,n,n]);const e=new Array(12);for(let o=0;o<4;o++)e[3*o]=$[o][0]*n[0],e[3*o+1]=$[o][1]*n[1],e[3*o+2]=$[o][2]*n[2];return new R(t,[[L.POSITION,new T(e,tt,3,!0)],[L.NORMAL,new T(_,nt,3)]])}function ot(t,n,e,o,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,c=Math.max(3,Math.floor(e)),a=Math.max(2,Math.floor(o)),f=(c+1)*(a+1),p=O(3*f),i=O(3*f),w=O(2*f),g=[];let m=0;for(let O=0;O<=a;O++){const t=[],e=O/a,o=h+e*u,s=Math.cos(o);for(let h=0;h<=c;h++){const u=h/c,a=r+u*l,f=Math.cos(a)*s,g=Math.sin(o),O=-Math.sin(a)*s;p[3*m]=f*n,p[3*m+1]=g*n,p[3*m+2]=O*n,i[3*m]=f,i[3*m+1]=g,i[3*m+2]=O,w[2*m]=u,w[2*m+1]=e,t.push(m),++m}g.push(t)}const A=new Array;for(let O=0;O<a;O++)for(let t=0;t<c;t++){const n=g[O][t],e=g[O][t+1],o=g[O+1][t+1],s=g[O+1][t];0===O?(A.push(n),A.push(o),A.push(s)):O===a-1?(A.push(n),A.push(e),A.push(o)):(A.push(n),A.push(e),A.push(o),A.push(o),A.push(s),A.push(n))}const I=[[L.POSITION,new T(p,A,3,!0)],[L.NORMAL,new T(i,A,3,!0)]];return s.uv&&I.push([L.UV0,new T(w,A,2,!0)]),s.offset&&(I[0][0]=L.OFFSET,I.push([L.POSITION,new T(Float64Array.from(s.offset),M(A.length),3,!0)])),new R(t,I)}function st(t,n,e,o){const s=rt(n,e,o);return new R(t,s)}function rt(t,n,e){const o=t;let s,r;if(e)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=o*(1+Math.sqrt(5))/2;s=[-o,t,0,o,t,0,-o,-t,0,o,-t,0,0,-o,t,0,o,t,0,-o,-t,0,o,-t,t,0,-o,t,0,o,-t,0,-o,-t,0,o],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let c=0;c<s.length;c+=3)j.scale(s,c,t/j.length(s,c));let l={};function h(n,e){n>e&&([n,e]=[e,n]);const o=n.toString()+"."+e.toString();if(l[o])return l[o];let r=s.length;return s.length+=3,j.add(s,3*n,s,3*e,s,r),j.scale(s,r,t/j.length(s,r)),r/=3,l[o]=r,r}for(let c=0;c<n;c++){const t=r.length,n=new Array(4*t);for(let e=0;e<t;e+=3){const t=r[e],o=r[e+1],s=r[e+2],l=h(t,o),u=h(o,s),c=h(s,t),a=4*e;n[a]=t,n[a+1]=l,n[a+2]=c,n[a+3]=o,n[a+4]=u,n[a+5]=l,n[a+6]=s,n[a+7]=c,n[a+8]=u,n[a+9]=l,n[a+10]=u,n[a+11]=c}r=n,l={}}const u=m(s);for(let c=0;c<u.length;c+=3)j.normalize(u,c);return[[L.POSITION,new T(m(s),r,3,!0)],[L.NORMAL,new T(u,r,3,!0)]]}function lt(t,{normal:n,position:e,color:o,rotation:s,size:r,centerOffsetAndDistance:l,uvi:h,featureAttribute:u,objectAndLayerIdColor:c=null}={}){const a=e?i(e):p(),f=n?i(n):w(0,0,1),g=o?[o[0],o[1],o[2],o.length>3?o[3]:255]:[255,255,255,255],O=null!=r&&2===r.length?r:[1,1],m=null!=s?[s]:[0],A=M(1),I=[[L.POSITION,new T(a,A,3,!0)],[L.NORMAL,new T(f,A,3,!0)],[L.COLOR,new T(g,A,4,!0)],[L.SIZE,new T(O,A,2)],[L.ROTATION,new T(m,A,1,!0)]];if(h&&I.push([L.UVI,new T(h,A,h.length)]),null!=l){const t=[l[0],l[1],l[2],l[3]];I.push([L.CENTEROFFSETANDDISTANCE,new T(t,A,4)])}if(u){const t=[u[0],u[1],u[2],u[3]];I.push([L.FEATUREATTRIBUTE,new T(t,A,4)])}return new R(t,I,null,d.Point,c)}const ht=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ut(t,n=ht){const e=new Array(12);for(let c=0;c<4;c++)for(let t=0;t<3;t++)e[3*c+t]=n[c][t];const o=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[[L.POSITION,new T(e,o,3,!0)],[L.NORMAL,new T(s,r,3,!0)],[L.UV0,new T(l,o,2,!0)],[L.COLOR,new T(h,r,4,!0)]];return new R(t,u)}function ct(t,n,e,o,s=!0,r=!0){let l=0;const h=n,u=t;let a=c(0,l,0),f=c(0,l+u,0),p=c(0,-1,0),i=c(0,1,0);o&&(l=u,f=c(0,0,0),a=c(0,l,0),p=c(0,1,0),i=c(0,-1,0));const w=[f,a],g=[p,i],m=e+2,A=Math.sqrt(u*u+h*h);if(o)for(let O=e-1;O>=0;O--){const t=O*(2*Math.PI/e),n=c(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const o=c(u*Math.cos(t)/A,-h/A,u*Math.sin(t)/A);g.push(o)}else for(let O=0;O<e;O++){const t=O*(2*Math.PI/e),n=c(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const o=c(u*Math.cos(t)/A,h/A,u*Math.sin(t)/A);g.push(o)}const M=new Array,I=new Array;if(s){for(let t=3;t<w.length;t++)M.push(1),M.push(t-1),M.push(t),I.push(0),I.push(0),I.push(0);M.push(w.length-1),M.push(2),M.push(1),I.push(0),I.push(0),I.push(0)}if(r){for(let t=3;t<w.length;t++)M.push(t),M.push(t-1),M.push(0),I.push(t),I.push(t-1),I.push(1);M.push(0),M.push(2),M.push(w.length-1),I.push(1),I.push(2),I.push(g.length-1)}const y=O(3*m);for(let c=0;c<m;c++)y[3*c]=w[c][0],y[3*c+1]=w[c][1],y[3*c+2]=w[c][2];const N=O(3*m);for(let c=0;c<m;c++)N[3*c]=g[c][0],N[3*c+1]=g[c][1],N[3*c+2]=g[c][2];return[[L.POSITION,new T(y,M,3,!0)],[L.NORMAL,new T(N,I,3,!0)]]}function at(t,n,e,o,s,r=!0,l=!0){return new R(t,ct(n,e,o,s,r,l))}function ft(n,o,h,p,i,w,g){const m=i?a(i):c(1,0,0),A=w?a(w):c(0,0,0);g??=!0;const M=f();e(M,m);const I=f();s(I,M,Math.abs(o));const y=f();s(y,I,-.5),r(y,y,A);const N=c(0,1,0);Math.abs(1-u(M,N))<.2&&t(N,0,0,1);const P=f();l(P,M,N),e(P,P),l(N,P,M);const S=2*p+(g?2:0),b=p+(g?2:0),d=O(3*S),j=O(3*b),E=O(2*S),U=new Array(3*p*(g?4:2)),V=new Array(3*p*(g?4:2));g&&(d[3*(S-2)]=y[0],d[3*(S-2)+1]=y[1],d[3*(S-2)+2]=y[2],E[2*(S-2)]=0,E[2*(S-2)+1]=0,d[3*(S-1)]=d[3*(S-2)]+I[0],d[3*(S-1)+1]=d[3*(S-2)+1]+I[1],d[3*(S-1)+2]=d[3*(S-2)+2]+I[2],E[2*(S-1)]=1,E[2*(S-1)+1]=1,j[3*(b-2)]=-M[0],j[3*(b-2)+1]=-M[1],j[3*(b-2)+2]=-M[2],j[3*(b-1)]=M[0],j[3*(b-1)+1]=M[1],j[3*(b-1)+2]=M[2]);const v=(t,n,e)=>{U[t]=n,V[t]=e};let x=0;const F=f(),C=f();for(let t=0;t<p;t++){const n=t*(2*Math.PI/p);s(F,N,Math.sin(n)),s(C,P,Math.cos(n)),r(F,F,C),j[3*t]=F[0],j[3*t+1]=F[1],j[3*t+2]=F[2],s(F,F,h),r(F,F,y),d[3*t]=F[0],d[3*t+1]=F[1],d[3*t+2]=F[2],E[2*t]=t/p,E[2*t+1]=0,d[3*(t+p)]=d[3*t]+I[0],d[3*(t+p)+1]=d[3*t+1]+I[1],d[3*(t+p)+2]=d[3*t+2]+I[2],E[2*(t+p)]=t/p,E[2*t+1]=1;const e=(t+1)%p;v(x++,t,t),v(x++,t+p,t),v(x++,e,e),v(x++,e,e),v(x++,t+p,t),v(x++,e+p,e)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;v(x++,S-2,b-2),v(x++,t,b-2),v(x++,n,b-2)}for(let t=0;t<p;t++){const n=(t+1)%p;v(x++,t+p,b-1),v(x++,S-1,b-1),v(x++,n+p,b-1)}}const G=[[L.POSITION,new T(d,U,3,!0)],[L.NORMAL,new T(j,V,3,!0)],[L.UV0,new T(E,U,2,!0)]];return new R(n,G)}function pt(t,n,e,o,s,r){o=o||10,s=null==s||s,b(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let c=0;c<o;c++){h.push([0,-c-1,-(c+1)%o-1]);const t=c/o*2*Math.PI;u.push([Math.cos(t)*e,Math.sin(t)*e])}return it(t,u,n,l,h,s,r)}function it(h,u,a,f,i,w,g=c(0,0,0)){const m=u.length,A=O(a.length*m*3+(6*f.length||0)),M=O(a.length*m*3+(f?6:0)),S=new Array,b=new Array;let d=0,j=0;const E=p(),U=p(),V=p(),v=p(),x=p(),F=p(),C=p(),G=p(),D=p(),q=p(),z=p(),B=p(),k=p(),Z=I();t(D,0,1,0),n(U,a[1],a[0]),e(U,U),w?(r(G,a[0],g),e(V,G)):t(V,0,0,1),Mt(U,V,D,D,x,V,It),o(v,V),o(B,x);for(let t=0;t<f.length;t++)s(F,x,f[t][0]),s(G,V,f[t][2]),r(F,F,G),r(F,F,a[0]),A[d++]=F[0],A[d++]=F[1],A[d++]=F[2];M[j++]=-U[0],M[j++]=-U[1],M[j++]=-U[2];for(let t=0;t<i.length;t++)S.push(i[t][0]>0?i[t][0]:-i[t][0]-1+f.length),S.push(i[t][1]>0?i[t][1]:-i[t][1]-1+f.length),S.push(i[t][2]>0?i[t][2]:-i[t][2]-1+f.length),b.push(0),b.push(0),b.push(0);let H=f.length;const J=f.length-1;for(let t=0;t<a.length;t++){let h=!1;if(t>0){o(E,U),t<a.length-1?(n(U,a[t+1],a[t]),e(U,U)):h=!0,r(q,E,U),e(q,q),r(z,a[t-1],v),y(a[t],q,Z);N(Z,P(z,E),G)?(n(G,G,a[t]),e(V,G),l(x,q,V),e(x,x)):Mt(q,v,B,D,x,V,It),o(v,V),o(B,x)}w&&(r(G,a[t],g),e(k,G));for(let n=0;n<m;n++)if(s(F,x,u[n][0]),s(G,V,u[n][1]),r(F,F,G),e(C,F),M[j++]=C[0],M[j++]=C[1],M[j++]=C[2],r(F,F,a[t]),A[d++]=F[0],A[d++]=F[1],A[d++]=F[2],!h){const t=(n+1)%m;S.push(H+n),S.push(H+m+n),S.push(H+t),S.push(H+t),S.push(H+m+n),S.push(H+m+t);for(let n=0;n<6;n++){const t=S.length-6;b.push(S[t+n]-J)}}H+=m}const K=a[a.length-1];for(let t=0;t<f.length;t++)s(F,x,f[t][0]),s(G,V,f[t][1]),r(F,F,G),r(F,F,K),A[d++]=F[0],A[d++]=F[1],A[d++]=F[2];const Q=j/3;M[j++]=U[0],M[j++]=U[1],M[j++]=U[2];const W=H-m;for(let t=0;t<i.length;t++)S.push(i[t][0]>=0?H+i[t][0]:-i[t][0]-1+W),S.push(i[t][2]>=0?H+i[t][2]:-i[t][2]-1+W),S.push(i[t][1]>=0?H+i[t][1]:-i[t][1]-1+W),b.push(Q),b.push(Q),b.push(Q);const X=[[L.POSITION,new T(A,S,3,!0)],[L.NORMAL,new T(M,b,3,!0)]];return new R(h,X)}function wt(t,n,e,o){b(n.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),b(3===n[0].length,"createPolylineGeometry(): malformed vertex"),b(null==e||e.length===n.length,"createPolylineGeometry: need same number of points and normals"),b(null==e||3===e[0].length,"createPolylineGeometry(): malformed normal");const s=g(3*n.length),r=new Array(2*(n.length-1));let l=0,h=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)s[l++]=n[c][t];c>0&&(r[h++]=c-1,r[h++]=c)}const u=[[L.POSITION,new T(s,r,3,!0)]];if(e){const t=O(3*e.length);let o=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[o++]=e[s][n];u.push([L.NORMAL,new T(t,r,3,!0)])}return o&&u.push([L.COLOR,new T(o,A(o.length/4),4)]),new R(t,u,null,d.Line)}function gt(t,n,e,o,s,r=0){const l=new Array(18),h=[[-e,r,s/2],[o,r,s/2],[0,n+r,s/2],[-e,r,-s/2],[o,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let c=0;c<6;c++)l[3*c]=h[c][0],l[3*c+1]=h[c][1],l[3*c+2]=h[c][2];return new R(t,[[L.POSITION,new T(l,u,3,!0)]])}function Ot(n,e){const o=n.getMutableAttribute(L.POSITION).data;for(let s=0;s<o.length;s+=3){const n=o[s],r=o[s+1],l=o[s+2];t(yt,n,r,l),h(yt,yt,e),o[s]=yt[0],o[s+1]=yt[1],o[s+2]=yt[2]}}function mt(t,n=t){const e=t.attributes,o=e.get(L.POSITION).data,s=e.get(L.NORMAL).data;if(s){const t=n.getMutableAttribute(L.NORMAL).data;for(let n=0;n<s.length;n+=3){const e=s[n+1];t[n+1]=-s[n+2],t[n+2]=e}}if(o){const t=n.getMutableAttribute(L.POSITION).data;for(let n=0;n<o.length;n+=3){const e=o[n+1];t[n+1]=-o[n+2],t[n+2]=e}}}function At(t,n,o,s,r){return!(Math.abs(u(n,t))>r)&&(l(o,t,n),e(o,o),l(s,o,t),e(s,s),!0)}function Mt(t,n,e,o,s,r,l){return At(t,n,s,r,l)||At(t,e,s,r,l)||At(t,o,s,r,l)}const It=.99619469809,yt=p();export{mt as cgToGIS,C as createBoxGeometry,at as createConeGeometry,ct as createConeGeometryData,ft as createCylinderGeometry,B as createDiamondGeometry,gt as createExtrudedTriangle,it as createPathExtrusionGeometry,lt as createPointGeometry,rt as createPolySphereData,st as createPolySphereGeometry,wt as createPolylineGeometry,ot as createSphereGeometry,ut as createSquareGeometry,et as createTetrahedronGeometry,pt as createTubeGeometry,Mt as makeOrthoBasisDirUpFallback,Ot as transformInPlace};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{copy as t,set as e,length as s,normalize as i,dot as r,scale as o,add as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h
|
|
5
|
+
import{copy as t,set as e,length as s,normalize as i,dot as r,scale as o,add as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h,i as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as p}from"../../../../chunks/vec42.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as d}from"../../../../geometry/support/Indices.js";import{Attribute as A,Vertices as b}from"./Attribute.js";import{decompressNormal as v,compressNormal as g}from"./Normals.js";import{intersectTriangles as I}from"./RayIntersections.js";import{VertexAttribute as x}from"./VertexAttribute.js";class T{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class O extends T{constructor(t){super(t),this.color=m(255,255,255,255),this._size=a(),this.positions=u(3*this.builder.numVerticesTotal),this.normals=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){p(this.color,t)}bake(a){t(this._size,a);const{numVerticesTotal:c,pathVertexData:p,positions:m,profileRightAxes:u,profileUpAxes:f,profileVertexAndNormals:d,profileAuxData:A}=this.builder;for(let t=0;t<c;++t){let c=p[t];c*=3;const b=j;let I=0,x=0;const T=v(y,u,t),O=v(C,f,t),R=4*t,V=e(E,d[R]*a[0],d[R+1]*a[1]),U=3*t;if(1===A[U+2])h(b,O,T),I=A[U]*a[0],x=A[U+1];else{const t=P,a=w;e(t,A[U],A[U+1]);const h=s(t);i(t,t);const c=r(V,t);if(Math.abs(c)>h){e(a,-t[1],t[0]);const s=r(V,a);o(t,t,h*Math.sign(c)),o(a,a,s),n(V,t,a)}l(b,0,0,0)}const F=T[0]*V[0]+O[0]*V[1],N=T[1]*V[0]+O[1]*V[1],_=T[2]*V[0]+O[2]*V[1];this.positions[U]=m[c]+F+b[0]*I,this.positions[U+1]=m[c+1]+N+b[1]*I,this.positions[U+2]=m[c+2]+_+b[2]*I;const z=d[R+2],D=d[R+3];g(this.normals,t,T[0]*z+O[0]*D+b[0]*x,T[1]*z+O[1]*D+b[1]*x,T[2]*z+O[2]*D+b[2]*x)}}createGeometryData(){const t=this.builder.vertexIndices;return[[x.POSITION,new A(this.positions,t,3,!0)],[x.NORMALCOMPRESSED,new A(this.normals,t,2,!0)],[x.COLOR,new A(this.color,d(t.length),4,!0)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,s,i){const r=this.builder.vertexIndices,o=new b(this.positions,3),n=r.length/3;I(t,e,0,n,r,o,void 0,s,((t,e,s)=>i(t,s,e)))}get size(){return this._size}}class R extends T{constructor(t,e,s,i){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=s,this.opacityAttributeValue=i,this.baked=new O(t),this._vvSize=u(this.builder.path.vertices.length).fill(e),this._vvColor=f(this.builder.path.vertices.length).fill(s),this._vvOpacity=f(this.builder.path.vertices.length).fill(i)}createGeometryData(){const t=this.builder,{pathVertexIndices:e,vertexIndices:s}=t;return[[x.POSITION,new A(t.positions,e,3,!0)],[x.PROFILEVERTEXANDNORMAL,new A(t.profileVertexAndNormals,s,4,!0)],[x.PROFILEAUXDATA,new A(t.profileAuxData,s,3,!0)],[x.PROFILERIGHT,new A(t.profileRightAxes,s,2,!0)],[x.PROFILEUP,new A(t.profileUpAxes,s,2,!0)],[x.SIZEFEATUREATTRIBUTE,new A(this._vvSize,e,1,!0)],[x.COLORFEATUREATTRIBUTE,new A(this._vvColor,e,1,!0)],[x.OPACITYFEATUREATTRIBUTE,new A(this._vvOpacity,e,1,!0)]]}onPathChanged(t){super.onPathChanged(t);const e=t.getMutableAttribute(x.POSITION);e&&(e.data=this.builder.positions)}}const E=a(),P=a(),w=a(),j=c(),y=c(),C=c();export{R as FastUpdatePathGeometry,T as PathGeometryData,O as StaticPathGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{webglDebugEnabled as t}from"../../../webgl/checkWebGLError.js";class r{constructor(t,r,e){this._context=t,this._locations=e,this._textures=new Map,this._glProgram=t.programCache.acquire(r.generate("vertex",!0),r.generate("fragment",!0),e),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=r.generateBind(this),this.bindPass=r.generateBindPass(this),this.bindDraw=r.generateBindDraw(this)}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,r){this._glProgram.setUniform1i(t,r?1:0)}setUniform1i(t,r){this._glProgram.setUniform1i(t,r)}setUniform1f(t,r){this._glProgram.setUniform1f(t,r)}setUniform2fv(t,r){this._glProgram.setUniform2fv(t,r)}setUniform3fv(t,r){this._glProgram.setUniform3fv(t,r)}setUniform4fv(t,r){this._glProgram.setUniform4fv(t,r)}setUniformMatrix3fv(t,r){this._glProgram.setUniformMatrix3fv(t,r)}setUniformMatrix4fv(t,r){this._glProgram.setUniformMatrix4fv(t,r)}setUniform1fv(t,r){this._glProgram.setUniform1fv(t,r)}setUniform1iv(t,r){this._glProgram.setUniform1iv(t,r)}setUniform2iv(t,r){this._glProgram.setUniform2iv(t,r)}setUniform3iv(t,r){this._glProgram.setUniform3iv(t,r)}setUniform4iv(t,r){this._glProgram.setUniform4iv(t,r)}assertCompatibleVertexAttributeLocations(t){t.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear()}bindTexture(r,e){e?.glName||(t()&&console.error(`Texture sampler ${r} has no given Texture in ${(new Error).stack} `),e=this._context.emptyTexture);const i=this._ensureTextureUnit(r,e);this._context.useProgram(this),this.setUniform1i(r,i.unit),this._context.bindTexture(e,i.unit)}_ensureTextureUnit(t,r){let e=this._textures.get(t);return null==e?(e={texture:r,unit:this._textures.size},this._textures.set(t,e)):e.texture=r,e}}export{r as Program};
|
|
5
|
+
import"../../../../core/has.js";import{webglDebugEnabled as t}from"../../../webgl/checkWebGLError.js";class r{constructor(t,r,e){this._context=t,this._locations=e,this._textures=new Map,this._glProgram=t.programCache.acquire(r.generate("vertex",!0),r.generate("fragment",!0),e),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bind=r.generateBind(this),this.bindPass=r.generateBindPass(this),this.bindDraw=r.generateBindDraw(this)}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get hasTransformFeedbackVaryings(){return this._glProgram.hasTransformFeedbackVaryings}get compiled(){return this._glProgram.compiled}setUniform1b(t,r){this._glProgram.setUniform1i(t,r?1:0)}setUniform1i(t,r){this._glProgram.setUniform1i(t,r)}setUniform1f(t,r,e){this._glProgram.setUniform1f(t,r,e)}setUniform2fv(t,r,e){this._glProgram.setUniform2fv(t,r,e)}setUniform3fv(t,r,e){this._glProgram.setUniform3fv(t,r,e)}setUniform4fv(t,r,e){this._glProgram.setUniform4fv(t,r,e)}setUniformMatrix3fv(t,r,e){this._glProgram.setUniformMatrix3fv(t,r,!1,e)}setUniformMatrix4fv(t,r,e){this._glProgram.setUniformMatrix4fv(t,r,!1,e)}setUniform1fv(t,r,e){this._glProgram.setUniform1fv(t,r,e)}setUniform1iv(t,r){this._glProgram.setUniform1iv(t,r)}setUniform2iv(t,r){this._glProgram.setUniform2iv(t,r)}setUniform3iv(t,r){this._glProgram.setUniform3iv(t,r)}setUniform4iv(t,r){this._glProgram.setUniform4iv(t,r)}assertCompatibleVertexAttributeLocations(t){t.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear()}bindTexture(r,e){e?.glName||(t()&&console.error(`Texture sampler ${r} has no given Texture in ${(new Error).stack} `),e=this._context.emptyTexture);const i=this._ensureTextureUnit(r,e);this._context.useProgram(this),this.setUniform1i(r,i.unit),this._context.bindTexture(e,i.unit)}_ensureTextureUnit(t,r){let e=this._textures.get(t);return null==e?(e={texture:r,unit:this._textures.size},this._textures.set(t,e)):e.texture=r,e}}export{r as Program};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as R,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as w,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as N}from"../../webgl.js";import{innerAtmosphereFadeStart as H}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as y}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthFormat as v,ColorFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as G,isColorOrColorEmission as q}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as V}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as j}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as B}from"../effects/RenderNodes.js";import{RenderPluginManager as Q}from"../effects/RenderPluginManager.js";import{Blit as W}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as k,renderHighlightBuffer as z}from"../effects/highlight/Highlight.js";import{OITBlend as Y}from"../effects/transparency/OITBlend.js";import{AnimationTimer as X}from"./AnimationTimer.js";import{AnimationTimeStep as K}from"./AnimationTimeStep.js";import{RenderRequestType as J}from"./basicInterfaces.js";import{BoundingInfo as Z}from"./BoundingInfo.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as ee,DepthRangeMode as te}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as re}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ie}from"./MainFramebuffer.js";import{RenderOccludedFlag as se}from"./Material.js";import{OITPass as ae}from"./OITPass.js";import{RenderContext as ne,defaultRenderOccludedMask as he}from"./RenderContext.js";import{RendererBase as oe}from"./RendererBase.js";import{RendererTarget as de}from"./rendererUtils.js";import{setupFeatureDefaults as le,RenderFeature as _e}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as pe}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as me,SnapshotSlot as ge}from"./ShadowMap.js";import fe from"./SliceHelper.js";import{Transparency as be}from"./edgeRendering/interfaces.js";import{MergedRenderer as Ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Te}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Ee,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Pe}from"../../../support/RenderState.js";import{PixelFormat as Se,PixelType as Ce,FramebufferBit as we,ColorAttachment1 as Ie,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let De=class extends oe{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new F,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new fe,this._blit=null,this._oitblend=null,this.sceneDepthRange=m($.infinite),this._state=m(Pe.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new K,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=m(le(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ie(this.fboCache),this.performanceInfo=new Ee(this._rctx),this._shadowMap=new me(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(G.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ne(this._rctx,this._shadowMap,r),this._nodes=new B(this._renderContext),this._plugins=new Q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_((()=>e.view.state.camera),(()=>n()),u),_((()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(be.TRANSPARENT):()=>{},n()}),p),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):I;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=j),u),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),c),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),c),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,Z.prune(),Ae.prune(),O()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=le(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(_e.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(_e.WaterReflection))}get _hasHighlights(){return this._plugins.produces(G.Highlight,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.DRAPED_MATERIAL,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(G.Highlight,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(_e.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(_e.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(_e.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ve(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),c)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&A(this._bindParameters.ssr.reprojectionMatrix,R)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){if(null!=e.environment.weather){const t=e.environment.weather;this._bindParameters.weather=t,this._bindParameters.snowCover=!!e.weatherVisible&&null!=t&&"snowy"===t.type&&"enabled"===t.snowCover}const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&0!==(this.plugins.renderOccludedFlags&se.OccludeAndTransparentStencil)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(G.Color,pe.INTEGRATED_MESH)&&this._plugins.produces(G.Color,pe.OCCLUDED_GROUND)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(G.Color,...ve),has.water=this._plugins.produces(G.Normal,pe.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new X(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=de.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Te(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=re,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,c=e===Pe.IDLE?r:i,m=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,c,m),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/p,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=de.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===de.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),d=this._nodes.produces(D.FINAL),l=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,_=l?G.ColorEmission:G.Color;this._renderContext.time=t,this._renderContext.output=_,this._bindParameters.oitPass=ae.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const u=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(),s.setGLViewport(this._rctx);const p=this._framebuffer,c=p.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(G.Color,...Le);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a,r===de.Screenshot),this._ensureBindParametersSSR(t),this._precompileShaders(m,g,_),this._renderContext.output=_,p.bind(),this._bindParameters.mainDepth=p.depth.attachment,this._renderOpaque(m),this._renderTransparent(g,m,_),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),p.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),p.update((e=>this._renderNodes(N.VIEWSHED,e))),p.update((e=>this._renderNodes(N.LASERLINES,e))),p.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),this._pluginInput.release(N.FOCUSAREA),p.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(s,this._bindParameters.lighting.mainLight.direction,f);const b=r===de.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;p.update((e=>this._renderNodes(D.COMPOSITE,e))),this._shadowMap.disposeOffscreenBuffers();const A=!(r!==de.Default||d||o&&!i),T=this._pluginInput.get(D.COMPOSITE),E=A?M:this.fboCache.acquire(T.fbo.width,T.fbo.height,N.ANTIALIASING),R=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,E):this._blitFBO(T,E,!1);let P;this._pluginInput.set(N.ANTIALIASING,R),this._hasHUDHighlights?(this._renderHUD(V.NotOccluded,R,_),P=this._renderNodes(N.HIGHLIGHTS,R)):(P=this._renderNodes(N.HIGHLIGHTS,R),this._renderHUD(V.NotOccluded,P,_));const S=this._renderNodes(N.MAGNIFIER,P);return o&&!i&&r===de.Default&&!d&&this._blitFBO(S),d?(S.attachDepth(p.depth),this._blitFBO(this._renderNodes(D.FINAL,S)),S.detachDepth()):this._pluginInput.set(D.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),p.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==de.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Te(this._pluginInput.get(D.FINAL),b)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=G.Depth,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(pe.OCCLUSION_PIXELS),this._plugins.precompile(pe.LINE_CALLOUTS),this._precompileHUD(V.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(V.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(G.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(N.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(Re.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===J.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(I),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Se.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Se.RGBA,Ce.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,I),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===be.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(G.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ge.ExcludeHighlight),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(G.Shadow),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap),s.moveSnapshot(ge.Highlight),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(G.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(N.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(we.STENCIL),this._renderGeometryWithoutNormals(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(Re.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this.renderAllGeometry(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=G.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderOpaqueAndTransparentGeometry(G.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.zero;const t=ee(e,this._plugins.plugins,this.stage.layers,te.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<H)return void(this.sceneDepthRange.value=$.infinite);const t=e.clone();t.near=y,t.far=1e10;const r=ee(t,this._plugins.plugins,this.stage.layers,te.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(G.Normal),this._needsDepth&&this._precompileAllGeometry(G.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(G.ShadowHighlight),this._precompileShadowCascades(G.ShadowExcludeHighlight),this._precompileShadowCascades(G.ShadowHighlight)):this._precompileShadowCascades(G.Shadow)),this._shadowAccumulator.active&&this._precompileAllGeometry(G.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",U.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._renderGeometryWithNormals(G.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(N.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(pe.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Me);this._renderContext.renderOccludedMask=he}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>se.Occlude&&this._plugins.render(pe.OCCLUDED_GROUND),this.renderSlots(e,...Me),this._renderContext.renderOccludedMask=he}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(pe.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(G.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(G.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ye)}_precompileOpaqueGeometry(){this._plugins.precompile(...xe)}_renderOpaqueGeometry(){this._plugins.render(...xe)}_renderTransparentGeometry(){this._plugins.render(...Le)}get _hasTransparentTerrain(){return this._plugins.produces(G.Color,pe.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(pe.TRANSPARENT_TERRAIN);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,I),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,pe.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",U.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(pe.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===V.Occluded){const e=()=>this._plugins.render(pe.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(v.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(pe.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=G.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...ve),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(Ne.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===V.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(v.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(v.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===V.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...ve)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(G.ShadowHighlight,pe.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>k?U.RG8UINT:U.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=G.Highlight,t.bindFramebuffer(a.fbo),z(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ue),this._rctx.clear(we.DEPTH),this._renderHUDElements(V.Both)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...Le)}_renderOIT(e,t,r=V.Both){const i=e===Ne.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ae.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,U.RGBA16FLOAT),_=t===G.ColorEmission;_&&l.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ie,U.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,C),n(),l.detachDepth(),h.oitPass=ae.FrontFace;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),a?u.acquireDepth(v.DEPTH16):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(I,!!a),n(),u.detachDepth(),h.oitPass=ae.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(we.COLOR)):this._framebuffer.bind(),this._oitblend??=new Y(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(G.Color,...xe);if(t){this._plugins.render(pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN);const e=this._framebuffer;e.update((e=>this._renderNodes(N.OPAQUE_TERRAIN,e))),e.bind(),this._plugins.render(pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS)}const r=this._framebuffer;r.update((e=>this._renderNodes(D.OPAQUE,e,t))),this.fboCache.debugCallback?.(D.OPAQUE,r.color.fbo),r.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(be.OPAQUE)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(pe.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry()),i.update((t=>this._renderNodes(D.TRANSPARENT,t,e))),this.fboCache.debugCallback?.(D.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(pe.LINE_CALLOUTS),this._renderEdges(be.TRANSPARENT);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(V.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(V.Occluded,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(be.OPAQUE),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(be.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(V.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new W(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=R:(T(Ge,this._bindParameters.camera.viewMatrix),T(Fe,this._bindParameters.camera.projectionMatrix),E(qe,Ge,Fe),E(qe,this._renderContext.lastFrameCamera.viewMatrix,qe),E(qe,this._renderContext.lastFrameCamera.projectionMatrix,qe),this._reprojectionMatrix=qe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=R,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(J.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var Ne;e([f({readOnly:!0})],De.prototype,"fullResolutionAtmosphere",null),e([f()],De.prototype,"_edgeView",void 0),e([f()],De.prototype,"updating",null),De=e([b("esri.views.3d.webgl-engine.lib.Renderer")],De),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ne||(Ne={}));const He=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL],ye=[pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],xe=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS],Le=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],ve=[pe.LINE_CALLOUTS_HUD_DEPTH,pe.HUD_MATERIAL,pe.LABEL_MATERIAL],Ue=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_TERRAIN,pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN],Fe=P(),Ge=P(),qe=P();function Ve(e){return t=>e.immediate.schedule(t)}export{De as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as R,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as w,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as N}from"../../webgl.js";import{innerAtmosphereFadeStart as H}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as y}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthFormat as v,ColorFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as G,isColorOrColorEmission as q}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as V}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as j}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as B}from"../effects/RenderNodes.js";import{RenderPluginManager as Q}from"../effects/RenderPluginManager.js";import{Blit as W}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as k,renderHighlightBuffer as z}from"../effects/highlight/Highlight.js";import{OITBlend as Y}from"../effects/transparency/OITBlend.js";import{AnimationTimer as X}from"./AnimationTimer.js";import{AnimationTimeStep as K}from"./AnimationTimeStep.js";import{RenderRequestType as J}from"./basicInterfaces.js";import{BoundingInfo as Z}from"./BoundingInfo.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as ee,DepthRangeMode as te}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as re}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ie}from"./MainFramebuffer.js";import{RenderOccludedFlag as se}from"./Material.js";import{OITPass as ae}from"./OITPass.js";import{RenderContext as ne,defaultRenderOccludedMask as he}from"./RenderContext.js";import{RendererBase as oe}from"./RendererBase.js";import{RendererTarget as de}from"./rendererUtils.js";import{setupFeatureDefaults as le,RenderFeature as _e}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as pe}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as me,SnapshotSlot as ge}from"./ShadowMap.js";import fe from"./SliceHelper.js";import{Transparency as be}from"./edgeRendering/interfaces.js";import{MergedRenderer as Ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Te}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Ee,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Pe}from"../../../support/RenderState.js";import{PixelFormat as Se,PixelType as Ce,FramebufferBit as we,ColorAttachment1 as Ie,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let De=class extends oe{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new F,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new fe,this._blit=null,this._oitblend=null,this.sceneDepthRange=m($.infinite),this._state=m(Pe.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new K,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=m(le(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ie(this.fboCache),this.performanceInfo=new Ee(this._rctx),this._shadowMap=new me(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(G.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ne(this._rctx,this._shadowMap,r),this._nodes=new B(this._renderContext),this._plugins=new Q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_((()=>e.view.state.camera),(()=>n()),u),_((()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(be.TRANSPARENT):()=>{},n()}),p),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):I;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=j),u),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),c),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),c),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,Z.prune(),Ae.prune(),O()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=le(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(_e.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(_e.WaterReflection))}get _hasHighlights(){return this._plugins.produces(G.Highlight,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.DRAPED_MATERIAL,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(G.Highlight,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(_e.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(_e.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(_e.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ve(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),c)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&A(this._bindParameters.ssr.reprojectionMatrix,R)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){if(null!=e.environment.weather){const t=e.environment.weather;this._bindParameters.weather=t,this._bindParameters.snowCover=!!e.weatherVisible&&null!=t&&"snowy"===t.type&&"enabled"===t.snowCover}const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&0!==(this.plugins.renderOccludedFlags&se.OccludeAndTransparentStencil)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(G.Color,pe.INTEGRATED_MESH)&&this._plugins.produces(G.Color,pe.OCCLUDED_GROUND)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(G.Color,...ve),has.water=this._plugins.produces(G.Normal,pe.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new X(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=de.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Te(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=re,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,c=e===Pe.IDLE?r:i,m=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,c,m),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/p,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=de.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===de.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),d=this._nodes.produces(D.FINAL),l=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,_=l?G.ColorEmission:G.Color;this._renderContext.time=t,this._renderContext.output=_,this._bindParameters.oitPass=ae.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const u=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(),s.setGLViewport(this._rctx);const p=this._framebuffer,c=p.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(G.Color,...Le);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a,r===de.Screenshot),this._ensureBindParametersSSR(t),this._precompileShaders(m,g,_),this._renderContext.output=_,p.bind(),this._bindParameters.mainDepth=p.depth.attachment,this._renderOpaque(m),this._renderTransparent(g,m,_),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),p.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),p.update((e=>this._renderNodes(N.VIEWSHED,e))),p.update((e=>this._renderNodes(N.LASERLINES,e))),p.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),this._pluginInput.release(N.FOCUSAREA),p.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(s,this._bindParameters.lighting.mainLight.direction,f);const b=r===de.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;p.update((e=>this._renderNodes(D.COMPOSITE,e))),this._shadowMap.disposeOffscreenBuffers();const A=!(r!==de.Default||d||o&&!i),T=this._pluginInput.get(D.COMPOSITE),E=A?M:this.fboCache.acquire(T.fbo.width,T.fbo.height,N.ANTIALIASING),R=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,E):this._blitFBO(T,E,!1);let P;this._pluginInput.set(N.ANTIALIASING,R),this._hasHUDHighlights?(this._renderHUD(V.NotOccluded,R,_),P=this._renderNodes(N.HIGHLIGHTS,R)):(P=this._renderNodes(N.HIGHLIGHTS,R),this._renderHUD(V.NotOccluded,P,_));const S=this._renderNodes(N.MAGNIFIER,P);return o&&!i&&r===de.Default&&!d&&this._blitFBO(S),d?(S.attachDepth(p.depth),this._blitFBO(this._renderNodes(D.FINAL,S)),S.detachDepth()):this._pluginInput.set(D.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),p.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==de.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Te(this._pluginInput.get(D.FINAL),b)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=G.Depth,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(pe.OCCLUSION_PIXELS),this._plugins.precompile(pe.LINE_CALLOUTS),this._precompileHUD(V.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(V.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(G.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(N.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(Re.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===J.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(I),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Se.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Se.RGBA,Ce.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,I),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===be.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(G.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ge.ExcludeHighlight),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(G.Shadow),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap),s.moveSnapshot(ge.Highlight),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(G.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(N.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(we.STENCIL),this._renderGeometryWithoutNormals(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(Re.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this.renderAllGeometry(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=G.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderOpaqueAndTransparentGeometry(G.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.zero;const t=ee(e,this._plugins.plugins,this.stage.layers,te.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<H)return void(this.sceneDepthRange.value=$.infinite);const t=e.clone();t.near=y,t.far=1e10;const r=ee(t,this._plugins.plugins,this.stage.layers,te.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(G.Normal),this._needsDepth&&this._precompileAllGeometry(G.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(G.ShadowHighlight),this._precompileShadowCascades(G.ShadowExcludeHighlight),this._precompileShadowCascades(G.ShadowHighlight)):this._precompileShadowCascades(G.Shadow)),this._shadowAccumulator.active&&this._precompileAllGeometry(G.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",U.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._renderGeometryWithNormals(G.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(N.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(pe.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Me);this._renderContext.renderOccludedMask=he}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>se.Occlude&&this._plugins.render(pe.OCCLUDED_GROUND),this.renderSlots(e,...Me),this._renderContext.renderOccludedMask=he}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(pe.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(G.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(G.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ye)}_precompileOpaqueGeometry(){this._plugins.precompile(...xe)}_renderOpaqueGeometry(){this._plugins.render(...xe)}_renderTransparentGeometry(){this._plugins.render(...Le)}get _hasTransparentTerrain(){return this._plugins.produces(G.Color,pe.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(pe.TRANSPARENT_TERRAIN);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,I),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,pe.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",U.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(pe.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===V.Occluded){const e=()=>this._plugins.render(pe.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(v.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(pe.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=G.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...ve),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(Ne.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===V.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(v.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(v.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===V.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...ve)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(G.ShadowHighlight,pe.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>k?U.RG8UINT:U.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=G.Highlight,t.bindFramebuffer(a.fbo),z(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ue),this._rctx.clear(we.DEPTH),this._renderHUDElements(V.Both)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...Le)}_renderOIT(e,t,r=V.Both){const i=e===Ne.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ae.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,U.RGBA16FLOAT),_=t===G.ColorEmission;_&&l.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ie,U.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,C),n(),l.detachDepth(),h.oitPass=ae.FrontFace;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),a?u.acquireDepth(v.DEPTH16):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(I,!!a),n(),u.detachDepth(),h.oitPass=ae.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(we.COLOR)):this._framebuffer.bind(),this._oitblend??=new Y(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(G.Color,...xe);if(t){this._plugins.render(pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN);const e=this._framebuffer;e.update((e=>this._renderNodes(N.OPAQUE_TERRAIN,e))),e.bind(),this._plugins.render(pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS)}const r=this._framebuffer;r.update((e=>this._renderNodes(D.OPAQUE,e,t))),this.fboCache.debugCallback?.(D.OPAQUE,r.color.fbo),r.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(be.OPAQUE)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(pe.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry()),i.update((t=>this._renderNodes(D.TRANSPARENT,t,e))),this.fboCache.debugCallback?.(D.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(pe.LINE_CALLOUTS),this._renderEdges(be.TRANSPARENT);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(V.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(V.Occluded,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(be.OPAQUE),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(be.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(V.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new W(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=R:(T(Ge,this._bindParameters.camera.viewMatrix),T(Fe,this._bindParameters.camera.projectionMatrix),E(qe,Ge,Fe),E(qe,this._renderContext.lastFrameCamera.viewMatrix,qe),E(qe,this._renderContext.lastFrameCamera.projectionMatrix,qe),this._reprojectionMatrix=qe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=R,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(J.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var Ne;e([f({readOnly:!0})],De.prototype,"fullResolutionAtmosphere",null),e([f()],De.prototype,"_edgeView",void 0),e([f()],De.prototype,"updating",null),De=e([b("esri.views.3d.webgl-engine.lib.Renderer")],De),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ne||(Ne={}));const He=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL],ye=[pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],xe=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS],Le=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],ve=[pe.LINE_CALLOUTS_HUD_DEPTH,pe.HUD_MATERIAL,pe.LABEL_MATERIAL],Ue=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_TERRAIN,pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN],Fe=P(),Ge=P(),qe=P();function Ve(e){return t=>e.immediate.schedule(t)}export{De as Renderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as u,G as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as A}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as F,ShadowCastAccumulateIndex as R}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as C}from"../../../support/Scheduler.js";import{SizedPixelFormat as j,PixelFormat as P,PixelType as q,TextureWrapMode as D,FramebufferBit as T}from"../../../webgl/enums.js";import{FramebufferObject as E}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as O}from"../../../webgl/TextureDescriptor.js";import{vertexCount as M}from"../../../webgl/Util.js";let B=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new I(new F(R.PRIMARY),(()=>this._requestRenderIfEnabled())),this._contextSet=new I(new F(R.CONTEXT),(()=>this._requestRenderIfEnabled())),this._passParameters=new _,this._depthRange=d.zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(C.SHADOW_ACCUMULATOR,this),o((()=>this._previewing),(()=>this._requestRenderIfEnabled()),a),o((()=>2===this._numActive),(()=>this._numActiveChanged()),a),o((()=>this._depthRange),(()=>this._invalidateAccumulationSets()),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some((t=>t.active))}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every((t=>t.doneAccumulating))}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce(((t,e)=>t+(e.active?1:0)),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:P.RG,internalFormat:j.RG8}:{pixelFormat:P.RED,internalFormat:j.R8}}get running(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some((t=>t.running))}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every((t=>0===t.progress)))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(L,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,P.RGBA,q.UNSIGNED_BYTE,U),U[R.PRIMARY]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new O;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=D.CLAMP_TO_EDGE,new E(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(T.COLOR))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,M(this._vao,"geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,M(this._vao,"geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],B.prototype,"_fbo",void 0),t([h()],B.prototype,"_depthRange",void 0),t([h()],B.prototype,"_previewing",void 0),t([h()],B.prototype,"_accumulationRenderer",void 0),t([h()],B.prototype,"_refining",null),t([h()],B.prototype,"active",null),t([h()],B.prototype,"canAccumulate",null),t([h()],B.prototype,"_doneAccumulating",null),t([h()],B.prototype,"_opacityFromElevation",null),t([h()],B.prototype,"_numActive",null),t([h()],B.prototype,"_pixelFormat",null),t([h()],B.prototype,"running",null),B=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],B);const L=6,U=new Uint8Array(4);class I{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}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(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(A,this.configuration),t.precompile(x,this.configuration)}}export{B as ShadowAccumulator};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as u,G as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as A}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as F,ShadowCastAccumulateIndex as R}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as C}from"../../../support/Scheduler.js";import{SizedPixelFormat as j,PixelFormat as P,PixelType as q,TextureWrapMode as D,FramebufferBit as T}from"../../../webgl/enums.js";import{FramebufferObject as E}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as O}from"../../../webgl/TextureDescriptor.js";import{vertexCount as M}from"../../../webgl/Util.js";let B=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new I(new F(R.PRIMARY),(()=>this._requestRenderIfEnabled())),this._contextSet=new I(new F(R.CONTEXT),(()=>this._requestRenderIfEnabled())),this._passParameters=new _,this._depthRange=d.zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(C.SHADOW_ACCUMULATOR,this),o((()=>this._previewing),(()=>this._requestRenderIfEnabled()),a),o((()=>2===this._numActive),(()=>this._numActiveChanged()),a),o((()=>this._depthRange),(()=>this._invalidateAccumulationSets()),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy();this._contextSet=null,this._primarySet=null,this._bindParameters.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some((t=>t.active))}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every((t=>t.doneAccumulating))}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce(((t,e)=>t+(e.active?1:0)),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:P.RG,internalFormat:j.RG8}:{pixelFormat:P.RED,internalFormat:j.R8}}get running(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some((t=>t.running))}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every((t=>0===t.progress)))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(L,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,P.RGBA,q.UNSIGNED_BYTE,U),U[R.PRIMARY]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new O;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=D.CLAMP_TO_EDGE,new E(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(T.COLOR))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,M(this._vao,"geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,M(this._vao,"geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],B.prototype,"_fbo",void 0),t([h()],B.prototype,"_depthRange",void 0),t([h()],B.prototype,"_previewing",void 0),t([h()],B.prototype,"_accumulationRenderer",void 0),t([h()],B.prototype,"_refining",null),t([h()],B.prototype,"active",null),t([h()],B.prototype,"canAccumulate",null),t([h()],B.prototype,"_doneAccumulating",null),t([h()],B.prototype,"_opacityFromElevation",null),t([h()],B.prototype,"_numActive",null),t([h()],B.prototype,"_pixelFormat",null),t([h()],B.prototype,"running",null),B=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],B);const L=6,U=new Uint8Array(4);class I{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}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(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(A,this.configuration),t.precompile(x,this.configuration)}}export{B as ShadowAccumulator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/has.js";import{someMap as r}from"../../../../core/MapUtils.js";import t from"../../../../core/PooledArray.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as o}from"../../../../chunks/sphere.js";import{OverlayTarget as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../core/has.js";import{someMap as r}from"../../../../core/MapUtils.js";import t from"../../../../core/PooledArray.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as o}from"../../../../chunks/sphere.js";import{OverlayTarget as d}from"../../terrain/Intersector.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{ChangeSet as h}from"./ChangeSet.js";import{StoreResults as c}from"./IntersectorInterfaces.js";import{IntersectorResult as l}from"./IntersectorResult.js";import{IntersectorType as p}from"./IntersectorType.js";import{RenderOccludedFlag as m}from"./Material.js";import{DirtyOperation as u,DirtyState as g}from"./ModelDirtyTypes.js";import{RendererBase as y}from"./RendererBase.js";import{RenderSlot as _}from"./RenderSlot.js";import{noBudget as f}from"../../../support/Scheduler.js";let R=class extends y{constructor(e){super(e),this._pending=new G,this._changes=new h,this._sortedRenderers=new t,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.clear(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return r(this.renderers,(r=>r.hasHighlight(e)))}get hasWater(){return this._hasWater}get rendersOccludedDraped(){for(const e of this.renderers.values())if(0!==e.numGeometries&&e.renderOccludedFlags&~m.Occlude)return!0;return!1}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,f,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=r(this.renderers,(e=>{const r=e.produces.get(_.DRAPED_MATERIAL);return!!r&&r(a.Highlight)})),this._hasWater=r(this.renderers,(e=>{const r=e.produces.get(_.DRAPED_WATER);return!!r&&r(a.Normal)}))),this.notifyChange("updating"),!0)}rendererAdded(){this._sortedRenderers.clear()}rendererRemoved(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);s&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),r===u.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=this._changes.updates.pushNew();e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case g.TRANSFORMATION:case g.GEOMETRY:return this._notifyGraphicGeometryChanged(e);case g.VISIBILITY:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll((t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r)),r}precompile(e){return this._sortedRenderers.reduce(((r,t)=>t.precompile(e)||r),!1)}render(e){this._sortedRenderers.forAll((r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)}))}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere[0]-n.boundingSphere[3]<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere[0]+n.boundingSphere[3]>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort(((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0)))}}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes)),this._changes.updates.filterInPlace((({renderGeometry:e})=>!this._pending.has(e))),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],C[0]=t[0]-s,C[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectDraped(e,i,C,((t,s,o)=>{v(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)}),r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(o(e.boundingSphere))),e}get test(){}};e([s({constructOnly:!0})],R.prototype,"drapeSource",void 0),e([s({constructOnly:!0})],R.prototype,"rendererContext",void 0),e([s()],R.prototype,"updating",null),e([s()],R.prototype,"rctx",null),e([s()],R.prototype,"_localOriginFactory",null),e([s({readOnly:!0})],R.prototype,"isEmpty",null),e([s()],R.prototype,"_geometries",void 0),R=e([i("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],R);class G{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function v(e,r,t,s,i,n,o){const a=new d(n,o,r),h=r=>{r.set(p.OVERLAY,a,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&h(i.results.min),i.options.store!==c.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&h(i.results.max),i.options.store===c.ALL){const e=new l(i.ray);h(e),i.results.all.push(e)}}const C=n();export{R as SortedRenderGeometryRenderer};
|