@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{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,e as u,t as m}from"../../../../../chunks/vec32.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as A}from"../IntersectorType.js";import b from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=A.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDataMap.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlight(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=t===C.ShadowHighlight,a=!n&&!s,i=t!==C.ShadowExcludeHighlight;if(a)return i?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDataMap:o}=this;if(i){if(n){const e=r.highlight?.name;if(!e)return null;const t=o.get(e);return t?[t]:null}const e=o.get(V);return s?e?[e]:null:Array.from(o.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=p();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(0!==(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,b.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,b.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDataMap:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let p=0;if(!(m&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const f=o.lodLevel.get(h);if(m&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[f].freeTail(),m&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[f].freeTail(),t.every((e=>e.isEmpty))&&(t.forEach((e=>e.destroy())),u.delete(e))}}if(m&j.REMOVE)i.freeInstance(h);else if(m&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(m&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}p|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),p|=j.DEFAULT_ACTIVE;o.state.set(h,p),o.lodLevel.set(h,e)}else p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,p);if(null!=this._octreeCached){const e=!!(m&j.ACTIVE),t=!!(p&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&m&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d===0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("colorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=p(),Q=f(),Z=h(),$=p(),X=p(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,e as u,t as m}from"../../../../../chunks/vec32.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as I}from"../../../support/buffer/glUtil.js";import{newLayout as y}from"../../../support/buffer/InterleavedLayout.js";import v from"../../../webgl/RenderCamera.js";import{ShaderOutput as C}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as E}from"../../effects/RenderPlugin.js";import{Default3D as R}from"../DefaultVertexAttributeLocations.js";import{DepthRange as D}from"../DepthRange.js";import{IntersectorType as b}from"../IntersectorType.js";import A from"../Octree.js";import{RenderSlot as T}from"../RenderSlot.js";import{assert as L}from"../Util.js";import{VertexAttribute as S}from"../VertexAttribute.js";import{InstanceData as O,StateFlags as j}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as M}from"./LevelSelector.js";import{LodLevel as N}from"./LodLevel.js";import{RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as H}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as F}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as V}from"../../../../support/HighlightDefaults.js";import{TaskPriority as B,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as G,unbindVertexBufferLayout as P}from"../../../../webgl/Util.js";const z=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new M(t,r)};let k=class extends E{constructor(e,t){super(e),this.type=b.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[T.OPAQUE_MATERIAL,e=>this._produces(e)],[T.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new O({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(B.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Y(this.optionalFields),this._glInstanceBufferLayout=I(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDataMap.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)t[0]!==V&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDataMap.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some((e=>e.components.some((e=>e.material.hasEmissions))))}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),this._levels.reduce(((e,t)=>e+t.components.reduce(((e,t)=>e+t.usedMemory),0)),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map((r=>{e.push(new w(t,this._instanceBufferLayout))})),e}async initializeRenderContext(e,r){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const n=await Promise.allSettled(this.symbol.levels.map((t=>N.create(e,t,r)))),s=n.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(i(r)||s.length!==n.length){s.forEach((e=>e.destroy())),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=z(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceDataMap.forEach((e=>e.forEach((e=>e.destroy()))))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(T.TRANSPARENT_MATERIAL);return t?.(C.Color)}))))}hasHighlights(){return n(this._highlightRenderInstanceDataMap,(e=>e.some((e=>e.size>0))))}_produces(e){return(e!==C.Highlight||this.hasHighlights())&&(e!==C.ShadowHighlight||this.hasHighlight(V))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach((t=>n.forEach((({components:n},s)=>n.forEach((n=>r.push(this._beginComponent(e,t[s],n)))))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;e.rctx.bindVAO();const s=this.levels;r.forEach((r=>s.forEach((({components:s},a)=>s.forEach((s=>this._renderComponent(e,t[n++],r[a],s,a)))))))}_getInstanceDatas(e){const{output:t,bind:r}=e,n=t===C.Highlight,s=t===C.ShadowHighlight,a=!n&&!s,i=t!==C.ShadowExcludeHighlight;if(a)return i?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDataMap:o}=this;if(i){if(n){const e=r.highlight?.name;if(!e)return null;const t=o.get(e);return t?[t]:null}const e=o.get(V);return s?e?[e]:null:Array.from(o.values())}return null}intersect(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=p();d(s,n,r);const a=s=>{this._instanceData.getCombinedModelTransform(s,Z),e.transform.set(Z),m($,r,e.transform.inverse),m(X,n,e.transform.inverse);const a=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;L(0!==(a&j.ACTIVE),"invalid instance state"),L(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,$,X,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&j.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,A.DepthOrder.FRONT_TO_BACK,e.frustum),n=this._octree.findClosest(t,A.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,Q),d(Q,Q,s);const i=u(Q,t)-Q[3];a.boundingSphere.getVec(n,Q),d(Q,Q,s);const o=u(Q,t)+Q[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDataMap:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let p=0;if(!(m&j.ALLOCATED)){h=h+1===c?0:h+1,l++;continue}const f=o.lodLevel.get(h);if(m&j.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[f].freeTail(),m&j.HIGHLIGHT_ACTIVE){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[f].freeTail(),t.every((e=>e.isEmpty))&&(t.forEach((e=>e.destroy())),u.delete(e))}}if(m&j.REMOVE)i.freeInstance(h);else if(m&j.VISIBLE){let e=0;if(t&&(o.modelOrigin.getVec(h,J),e=a.selectLevel(J,i.getCombinedMedianScaleFactor(h),n)),p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),e>=0)if(m&j.HIGHLIGHT){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach((e=>e.beginUpdate())),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);W(a[e],o,h)}p|=j.HIGHLIGHT_ACTIVE}else W(this._defaultRenderInstanceData[e],o,h),p|=j.DEFAULT_ACTIVE;o.state.set(h,p),o.lodLevel.set(h,e)}else p=m&~(j.ACTIVE|j.TRANSFORM_CHANGED),o.state.set(h,p);if(null!=this._octreeCached){const e=!!(m&j.ACTIVE),t=!!(p&j.ACTIVE);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&m&j.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d===0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterials.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,n.material.parameters,te);i.bindVAO(n.vao),t.ensureAttributeLocations(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===C.Color&&(o.setUniform4fv("externalColor",ee[Math.min(s,ee.length-1)]),o.setUniform1i("symbolColorMixMode",H.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{G(i,R,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,n.vertexCount,s-e),P(i,R,r.buffer,u)};n.material.transparent&&null!=d?c>h?(L(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(L(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(L(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function W(e,t,r){const n=e.allocateHead();K(t,r,e.view,n)}function K(e,t,r,n){U(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(n,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}function Y(e){let t=y().vec3f(S.INSTANCEMODELORIGINHI).vec3f(S.INSTANCEMODELORIGINLO).mat3f(S.INSTANCEMODEL).mat3f(S.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(S.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(S.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(S.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([l({constructOnly:!0})],k.prototype,"symbol",void 0),e([l({constructOnly:!0})],k.prototype,"optionalFields",void 0),e([l({constructOnly:!0})],k.prototype,"metadata",void 0),e([l({constructOnly:!0})],k.prototype,"shaderTransformation",void 0),e([l()],k.prototype,"_instanceData",void 0),e([l()],k.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],k.prototype,"_enableLevelSelection",null),e([l()],k.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],k.prototype,"running",null),k=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],k);const J=p(),Q=f(),Z=h(),$=p(),X=p(),ee=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],te=new F;export{k as LodRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{q as e,i as r,c as t,n as s,d as a,l as i,g as o,e as n,o as l}from"../../../../chunks/vec32.js";import{ZEROS as c,create as m,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{EmissiveSourceMode as h}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{newLayout as d}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as f,isShadowRelatedOutput as T,is3DGeometryOutput as v,ShaderOutput as x,isColorOrColorEmission as g,isColorEmission as b}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as S}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as O}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as M}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as y}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{DepthTestFunction as R,CullFaceOptions as A,AlphaDiscardMode as I}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as P}from"../lib/Material.js";import{OITPolygonOffsetLimit as j}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as E}from"../lib/RayIntersections.js";import{RenderSlot as L}from"../lib/RenderSlot.js";import{VertexAttribute as
|
|
5
|
+
import{q as e,i as r,c as t,n as s,d as a,l as i,g as o,e as n,o as l}from"../../../../chunks/vec32.js";import{ZEROS as c,create as m,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{EmissiveSourceMode as h}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{newLayout as d}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as f,isShadowRelatedOutput as T,is3DGeometryOutput as v,ShaderOutput as x,isColorOrColorEmission as g,isColorEmission as b}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as S}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as O}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as M}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as y}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{DepthTestFunction as R,CullFaceOptions as A,AlphaDiscardMode as I}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as P}from"../lib/Material.js";import{OITPolygonOffsetLimit as j}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as E}from"../lib/RayIntersections.js";import{RenderSlot as L}from"../lib/RenderSlot.js";import{VertexAttribute as N}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as D}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as B}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as _}from"./internal/MaterialUtil.js";import{DefaultMaterialPassParameters as V,DefaultMaterialTechnique as z}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as U}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as q}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as k}from"../../../../webscene/support/AlphaCutoff.js";class W extends P{constructor(e,r){super(e,H),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[L.OPAQUE_MATERIAL,e=>(f(e)||T(e))&&!this.transparent],[L.TRANSPARENT_MATERIAL,e=>(f(e)||T(e))&&this.transparent&&this.parameters.writeDepth],[L.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(v(e)||T(e))&&this.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=F(this.parameters),this._configuration=new U(r.spherical)}isVisibleForOutput(e){return e!==x.Shadow&&e!==x.ShadowExcludeHighlight&&e!==x.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=k}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,c)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===h.Emissive&&this._hasEmissiveBase||this.parameters.emissiveSource===h.Color)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=!a&&!!t.normalTextureId,s.hasColorTexture=!!t.textureId,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.isInstanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.vvSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?S.Attribute:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??R.Less,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?A.None:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?M.WindingOrder:i&&"normal"===o?M.View:i&&"winding-order"===o?M.WindingOrder:M.None,s.instancedColor=t.hasInstancedColor,g(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.vvColor=!!t.vvColor,s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?y.Schematic:y.Normal:y.Disabled,s.hasMetallicRoughnessTexture=!a&&!!t.metallicRoughnessTextureId,s.emissionSource=a?O.None:null!=t.emissiveTextureId&&t.emissiveSource===h.Emissive?O.Texture:t.usePBR?t.emissiveSource===h.Emissive?O.EmissiveColor:O.SymbolColor:O.None,s.hasOcclusionTexture=!a&&!!t.occlusionTextureId,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.camera.relativeElevation<j,s.snowCover=r.snowCover,s.hasBloom=b(e),s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,c,m,u,h,d){if(null!=this.parameters.verticalOffset){const e=m.camera;r($,c[12],c[13],c[14]);let d=null;switch(m.viewingMode){case p.Global:d=s(X,$);break;case p.Local:d=t(X,K)}let f=0;const T=a(ee,$,e.eye),v=i(T),x=o(T,T,1/v);let g=null;this.parameters.screenSizePerspective&&(g=n(d,x)),f+=_(e,v,this.parameters.verticalOffset,g??0,this.parameters.screenSizePerspective),o(d,d,f),l(Z,d,m.transform.inverseRotation),u=a(Y,u,Z),h=a(J,h,Z)}E(e,m,u,h,D(m.verticalOffset),d)}createGLMaterial(e){return new G(e)}createBufferWriter(){return new B(this._vertexBufferLayout)}get transparent(){return Q(this.parameters)}}class G extends w{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?q:z,e)}}class H extends V{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function F(e){const r=d().vec3f(N.POSITION);e.normalType===S.Compressed?r.vec2i16(N.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(N.NORMAL),e.hasVertexTangents&&r.vec4f(N.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f16(N.UV0),e.hasVertexColors&&r.vec4u8(N.COLOR),e.hasSymbolColors&&r.vec4u8(N.SYMBOLCOLOR),C()&&r.vec4u8(N.OLIDCOLOR),r}function Q(e){const{drivenOpacity:r,opacity:t,externalColor:s,layerOpacity:a,texture:i,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,c=s[3];return r||t<1&&"replace"!==l||c<1&&"ignore"!==l||a<1||(null!=i||null!=o)&&n!==I.Opaque&&n!==I.Mask&&"replace"!==l}const Y=m(),J=m(),K=u(0,0,1),X=m(),Z=m(),$=m(),ee=m();export{G as DefaultGLMaterial,W as DefaultMaterial,H as DefaultMaterialParameters,Q as isTransparent};
|
|
@@ -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{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmission as s}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as o,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as u,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class d extends o{constructor(e,t){super(e,T),this.intersectDraped=void 0,this.produces=new Map([[c.LINE_CALLOUTS,e=>s(e)],[c.LINE_CALLOUTS_HUD_DEPTH,e=>s(e)]]),this._configuration=new m(t),this._uniqueMaterialIdentifier=O(this.parameters)}passParameters(){return this.parameters}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=t.slot===c.LINE_CALLOUTS_HUD_DEPTH,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new S(e)}createBufferWriter(){return new D}validateParameters(e){this._uniqueMaterialIdentifier=O(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function O({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,occlusionTest:o,shaderPolygonOffset:a,hudDepthAlignStart:c,centerOffsetUnits:l,hasSlicePlane:f,screenSizePerspective:u,verticalOffset:h,borderColor:p}){return e`${t}:${r}:${i}:[${s}]:${n}:${o}:${a}:${c}:${l}:${f}:${null!=u}:{${h
|
|
5
|
+
import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmission as s}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as o,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as u,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class d extends o{constructor(e,t){super(e,T),this.intersectDraped=void 0,this.produces=new Map([[c.LINE_CALLOUTS,e=>s(e)],[c.LINE_CALLOUTS_HUD_DEPTH,e=>s(e)]]),this._configuration=new m(t),this._uniqueMaterialIdentifier=O(this.parameters)}passParameters(){return this.parameters}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=t.slot===c.LINE_CALLOUTS_HUD_DEPTH,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new S(e)}createBufferWriter(){return new D}validateParameters(e){this._uniqueMaterialIdentifier=O(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function O({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,occlusionTest:o,shaderPolygonOffset:a,hudDepthAlignStart:c,centerOffsetUnits:l,hasSlicePlane:f,screenSizePerspective:u,verticalOffset:h,borderColor:p}){return e`${t}:${r}:${i}:[${s}]:${n}:${o}:${a}:${c}:${l}:${f}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${p}]`}class S extends n{beginSlot(e){return this.getTechnique(p,e)}}class T extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=r(0,0,0,1),this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const L=i().vec3f(l.POSITION).vec3f(l.NORMAL).vec2f16(l.UV0).vec4f(l.CENTEROFFSETANDDISTANCE),_=[t(0,0),t(1,0),t(0,1),t(1,0),t(1,1),t(0,1)];class D{constructor(){this.vertexBufferLayout=L}elementCount(e){return 6*e.get(l.POSITION).indices.length}write(e,t,r,i,s,n){f(r.get(l.POSITION),e,s.position,n,6),u(r.get(l.NORMAL),t,s.normal,n,6),h(r.get(l.CENTEROFFSETANDDISTANCE),s.centerOffsetAndDistance,n,6);for(let o=0;o<_.length;++o)s.uv0.setVec(n+o,_[o]);return null}}export{d as LineCalloutMaterial,T as Parameters,O as uniqueMaterialIdentifier};
|
|
@@ -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{equals as r}from"../../../../../core/arrayUtils.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{scale as e}from"../../lib/screenSizePerspectiveUtils.js";function i(r,i,n,
|
|
5
|
+
import{equals as r}from"../../../../../core/arrayUtils.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{scale as e}from"../../lib/screenSizePerspectiveUtils.js";function i(r,i,o,n,l){let s=o.screenLength*r.pixelRatio;null!=l&&(s=e(s,n,i,l));const c=s*Math.tan(.5*r.fovY)/(.5*r.fullHeight);return t(c*i,o.minWorldLength,o.maxWorldLength)}function o(t,e){let i=!1;for(const o in e){const n=e[o];void 0!==n&&(Array.isArray(n)?Array.isArray(t[o])&&r(n,t[o])||(t[o]=n.slice(),i=!0):t[o]!==n&&(i=!0,t[o]=n))}return i}const n={multiply:1,ignore:2,replace:3,tint:4};export{n as colorMixModes,o as updateParameters,i as verticalOffsetAtDistance};
|
|
@@ -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 t from"../../../../core/Accessor.js";import{unpackFloatRGBA as r}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as n}from"../../../../core/maybe.js";import{watch as o,initial as a,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as m,isMars as u}from"../../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{ChapmanAtmosphere as _}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as g}from"../../environment/CloudsComposition.js";import{Fog as w}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import v from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as j}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as y}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as b}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{BloomRenderNode as R}from"../effects/bloom/BloomRenderNode.js";import{ObjectAndLayerIDRenderNode as A}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as S}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as T}from"../effects/haze/Haze.js";import{Highlight as O}from"../effects/highlight/Highlight.js";import{ShadowHighlight as U}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as q}from"../effects/magnifier/Magnifier.js";import{SMAA as D}from"../effects/smaa/SMAA.js";import{SSAO as L}from"../effects/ssao/SSAO.js";import{Stars as M}from"../effects/stars/Stars.js";import{RenderRequestType as k}from"../lib/basicInterfaces.js";import E from"../lib/CompositingHelper.js";import{GLMaterialRepository as B}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as W}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as F}from"../lib/Renderer.js";import{RenderingContext as H}from"../lib/RenderingContext.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as P}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as N}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as I}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as z}from"./contextCache.js";import{removeLoadedShaderModules as K}from"./renderUtils.js";import{ScreenshotManager as V,ScreenshotContext as X}from"./ScreenshotManager.js";import{contextCache as Q}from"./testUtils.js";import{RenderState as J}from"../../../support/RenderState.js";import{noBudget as Y}from"../../../support/Scheduler.js";import{checkWebGLError as Z}from"../../../webgl/checkWebGLError.js";let $=class extends t{constructor(e){super(e),this.waterTextures=new I,this.olidRenderHelper=C()?new W:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.bloom=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:r}=t.view.resourceController;this.stippleTextures=N(this._rctx,r),this.markerTextures=P(this._rctx,r),this._techniques=new b(new y(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e))));const s=new B(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender()));this._compositingHelper=new E(this._rctx,this._techniques),this.renderer=new F(t,s,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),this.addHandles([o((()=>t.view.ready),(e=>{e&&this._createRenderNodes()}),a),o((()=>this.waterTextures?.updating),(()=>this.requestRender()),a),o((()=>t.view.qualityProfile),(e=>this.renderer?.updateRenderFeatures(e)),h)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new V(this._rctx,i,(e=>t.view.basemapTerrain.overlayManager.updateOverlays(Y,e.camera,k.BACKGROUND))),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=i(this._frameTask),this._techniques=n(this._techniques),this._componentObjects=n(this._componentObjects),this._screenshotManager=n(this._screenshotManager),n(this.renderer),this._textures=n(this._textures),n(this.waterTextures),n(this.markerTextures),n(this.stippleTextures),this._canvas=null,this._rctx=n(this._rctx)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new M({view:e}),m(e.spatialReference)||(t===f.Local?(new x({view:e}),this.bloom=new R({view:e})):u(e.spatialReference)?(new v({view:e}),this.bloom=new R({view:e})):(new _({view:e}),new g({view:e}),this.bloom=new R({view:e}),new T({view:e}),new w({view:e}))),new L({view:e,isEnabled:()=>this.renderer.hasSSAO}),new D({view:e,isEnabled:()=>this.renderer.hasSMAA}),new q({view:e}),new O({view:e}),new U({view:e,viewingMode:t}),new S({view:e}),C()&&new A({view:e})}requestRender(e=k.UPDATE){this._needsRender=!0,e===k.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,s,i,n,o=n){const a=i.constrainWindowSize(t,s,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const p=(e,t,s)=>r(t,e)*(s[1]-s[0])+s[0];let d=Number.MAX_VALUE;for(let r=0;r<a[2]*a[3];r++){const e=p(4*r,h,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(e){const r=e.pickDepth(t*i.pixelRatio,s*i.pixelRatio,i);null!=r&&d>r&&r!==i.nearFar[0]&&r!==i.nearFar[1]&&(d=r)}return d===Number.MAX_VALUE?void 0:d}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){K(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=k.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?k.UPDATE:k.BACKGROUND,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(k.BACKGROUND),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(k.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new X(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(t.mode===J.IDLE?s:k.UPDATE),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const i={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",i);if(null==n)return void s.getLogger(this).error("A WebGL2 context could not be created.");Z(n,!0),this._rctx=ee(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&s.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new j(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){this.test&&null!=this.test.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=d(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.stage.view.qualitySettings.maxTexturePixels})}};function ee(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,maxPreferredTexturePixels:t.view.qualitySettings.maxTexturePixels,newCache:r};if(Q.enabled){let t=te.get(e);return t?(t.configure(s),t.ref(),t):(t=new H(e,s),te.set(e,t),t.ref(),t)}return new H(e,s)}e([c({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([c({constructOnly:!0})],$.prototype,"stage",void 0),e([c()],$.prototype,"_rctx",void 0),e([c()],$.prototype,"_canvas",void 0),e([c()],$.prototype,"stippleTextures",void 0),e([c()],$.prototype,"markerTextures",void 0),e([c()],$.prototype,"waterTextures",void 0),e([c({readOnly:!0})],$.prototype,"olidRenderHelper",void 0),e([c()],$.prototype,"_textures",void 0),e([c({readOnly:!0})],$.prototype,"renderer",void 0),e([c()],$.prototype,"_screenshotManager",void 0),e([c()],$.prototype,"componentObjectCollection",null),e([c()],$.prototype,"_componentObjects",void 0),e([c()],$.prototype,"_needsUpdate",void 0),e([c()],$.prototype,"_needsWaterReflectionUpdate",void 0),$=e([l("esri.views.3d.webgl-engine.parts.RenderView")],$);const te=z();export{$ as RenderView};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{unpackFloatRGBA as r}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as n}from"../../../../core/maybe.js";import{watch as o,initial as a,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as m,isMars as u}from"../../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{ChapmanAtmosphere as _}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as g}from"../../environment/CloudsComposition.js";import{Fog as w}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import v from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as j}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as y}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as b}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{BloomRenderNode as R}from"../effects/bloom/BloomRenderNode.js";import{ObjectAndLayerIDRenderNode as A}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as S}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as T}from"../effects/haze/Haze.js";import{Highlight as O}from"../effects/highlight/Highlight.js";import{ShadowHighlight as U}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as q}from"../effects/magnifier/Magnifier.js";import{SMAA as D}from"../effects/smaa/SMAA.js";import{SSAO as L}from"../effects/ssao/SSAO.js";import{Stars as M}from"../effects/stars/Stars.js";import{RenderRequestType as k}from"../lib/basicInterfaces.js";import E from"../lib/CompositingHelper.js";import{GLMaterialRepository as B}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as W}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as F}from"../lib/Renderer.js";import{RenderingContext as H}from"../lib/RenderingContext.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as P}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as N}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as I}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as z}from"./contextCache.js";import{removeLoadedShaderModules as K}from"./renderUtils.js";import{ScreenshotManager as V,ScreenshotContext as X}from"./ScreenshotManager.js";import{contextCache as Q}from"./testUtils.js";import{RenderState as J}from"../../../support/RenderState.js";import{noBudget as Y}from"../../../support/Scheduler.js";import{checkWebGLError as Z}from"../../../webgl/checkWebGLError.js";let $=class extends t{constructor(e){super(e),this.waterTextures=new I,this.olidRenderHelper=C()?new W:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.bloom=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:r}=t.view.resourceController;this.stippleTextures=N(this._rctx,r),this.markerTextures=P(this._rctx,r),this._techniques=new b(new y(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e))));const s=new B(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender()));this._compositingHelper=new E(this._rctx,this._techniques),this.renderer=new F(t,s,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),this.addHandles([o((()=>t.view.ready),(e=>{e&&this._createRenderNodes()}),a),o((()=>this.waterTextures?.updating),(()=>this.requestRender()),a),o((()=>t.view.qualityProfile),(e=>this.renderer?.updateRenderFeatures(e)),h)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new V(this._rctx,i,(e=>t.view.basemapTerrain.overlayManager.updateOverlays(Y,e.camera,k.BACKGROUND))),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=i(this._frameTask),this._techniques=n(this._techniques),this._componentObjects=n(this._componentObjects),this._screenshotManager=n(this._screenshotManager),n(this.renderer),this._textures=n(this._textures),n(this.waterTextures),n(this.markerTextures),n(this.stippleTextures),this._canvas=null,this._rctx=n(this._rctx),this._set("renderer",null)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new M({view:e}),m(e.spatialReference)||(t===f.Local?(new x({view:e}),this.bloom=new R({view:e})):u(e.spatialReference)?(new v({view:e}),this.bloom=new R({view:e})):(new _({view:e}),new g({view:e}),this.bloom=new R({view:e}),new T({view:e}),new w({view:e}))),new L({view:e,isEnabled:()=>this.renderer.hasSSAO}),new D({view:e,isEnabled:()=>this.renderer.hasSMAA}),new q({view:e}),new O({view:e}),new U({view:e,viewingMode:t}),new S({view:e}),C()&&new A({view:e})}requestRender(e=k.UPDATE){this._needsRender=!0,e===k.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,s,i,n,o=n){const a=i.constrainWindowSize(t,s,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const p=(e,t,s)=>r(t,e)*(s[1]-s[0])+s[0];let d=Number.MAX_VALUE;for(let r=0;r<a[2]*a[3];r++){const e=p(4*r,h,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(e){const r=e.pickDepth(t*i.pixelRatio,s*i.pixelRatio,i);null!=r&&d>r&&r!==i.nearFar[0]&&r!==i.nearFar[1]&&(d=r)}return d===Number.MAX_VALUE?void 0:d}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){K(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=k.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?k.UPDATE:k.BACKGROUND,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(k.BACKGROUND),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(k.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new X(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(t.mode===J.IDLE?s:k.UPDATE),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const i={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",i);if(null==n)return void s.getLogger(this).error("A WebGL2 context could not be created.");Z(n,!0),this._rctx=ee(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&s.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new j(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){this.test&&null!=this.test.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=d(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.stage.view.qualitySettings.maxTexturePixels})}};function ee(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,maxPreferredTexturePixels:t.view.qualitySettings.maxTexturePixels,newCache:r};if(Q.enabled){let t=te.get(e);return t?(t.configure(s),t.ref(),t):(t=new H(e,s),te.set(e,t),t.ref(),t)}return new H(e,s)}e([c({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([c({constructOnly:!0})],$.prototype,"stage",void 0),e([c()],$.prototype,"_rctx",void 0),e([c()],$.prototype,"_canvas",void 0),e([c()],$.prototype,"stippleTextures",void 0),e([c()],$.prototype,"markerTextures",void 0),e([c()],$.prototype,"waterTextures",void 0),e([c({readOnly:!0})],$.prototype,"olidRenderHelper",void 0),e([c()],$.prototype,"_textures",void 0),e([c({readOnly:!0})],$.prototype,"renderer",void 0),e([c()],$.prototype,"_screenshotManager",void 0),e([c()],$.prototype,"componentObjectCollection",null),e([c()],$.prototype,"_componentObjects",void 0),e([c()],$.prototype,"_needsUpdate",void 0),e([c()],$.prototype,"_needsWaterReflectionUpdate",void 0),$=e([l("esri.views.3d.webgl-engine.parts.RenderView")],$);const te=z();export{$ as RenderView};
|
|
@@ -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"
|
|
5
|
+
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstanceColor.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/MaskedColor.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/TextureTransformUV.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../effects/weather/SnowCover.glsl.js";import"../lib/VertexAttribute.js";import"../materials/internal/MaterialUtil.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/DefaultMaterial.glsl.js";
|
|
@@ -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{ZEROS as e,freeze as t,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as r}from"../../../../symbols/support/materialUtils.js";import{isColorOrColorEmission as l}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as o}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{VertexNormalPassParameters as a,VertexNormalDrawParameters as n}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShaderModule as c}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as h,depthOnlyOutputBuffersOr as u}from"../core/shaderTechnique/ShaderTechnique.js";import{CullFaceOptions as m,DepthTestFunction as p,AlphaDiscardMode as d}from"../lib/basicInterfaces.js";import{RenderOccludedFlag as f}from"../lib/Material.js";import{oitPolygonOffset as b,getDrawBuffers as S,depthWrite as g,oitDepthTest as j,blending as v}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as y,stencilBaseAllZerosParams as P,stencilWriteMaskOn as x}from"../lib/StencilUtils.js";import{advancedMRRFactors as T}from"../materials/pbrUtils.js";import{D as O}from"../../../../chunks/DefaultMaterial.glsl.js";import{CompareFunction as
|
|
5
|
+
import{ZEROS as e,freeze as t,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as r}from"../../../../symbols/support/materialUtils.js";import{isColorOrColorEmission as l}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as o}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{VertexNormalPassParameters as a,VertexNormalDrawParameters as n}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShaderModule as c}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as h,depthOnlyOutputBuffersOr as u}from"../core/shaderTechnique/ShaderTechnique.js";import{CullFaceOptions as m,DepthTestFunction as p,AlphaDiscardMode as d}from"../lib/basicInterfaces.js";import{RenderOccludedFlag as f}from"../lib/Material.js";import{oitPolygonOffset as b,getDrawBuffers as S,depthWrite as g,oitDepthTest as j,blending as v}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as y,stencilBaseAllZerosParams as P,stencilWriteMaskOn as x}from"../lib/StencilUtils.js";import{advancedMRRFactors as T}from"../materials/pbrUtils.js";import{D as O}from"../../../../chunks/DefaultMaterial.glsl.js";import{CompareFunction as A}from"../../../webgl/enums.js";import{makePipelineState as C,cullingParams as M,defaultColorWrite as D}from"../../../webgl/renderState.js";import{alphaCutoff as L}from"../../../../webscene/support/AlphaCutoff.js";class w extends a{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=T,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=m.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrength=0,this.emissiveSource=r.Color,this.emissiveBaseColor=e,this.instancedDoublePrecision=!1,this.normalType=o.Attribute,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.externalColor=s(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=i(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=p.Less,this.textureAlphaMode=d.Blend,this.textureAlphaCutoff=L,this.textureAlphaPremultiplied=!1,this.renderOccluded=f.Occlude,this.isDecoration=!1}}class k extends n{constructor(){super(...arguments),this.origin=i(),this.slicePlaneLocalOrigin=this.origin}}class B extends h{constructor(e,t,i=new c(O,(()=>import("./DefaultMaterial.glsl.js")))){super(e,t,i),this.type="DefaultMaterialTechnique"}_makePipeline(e,t){const{oitPass:i,output:s,transparent:r,cullFace:o,customDepthTest:a,hasOccludees:n}=e;return C({blending:l(s)&&r?v(i):null,culling:I(e)?M(o):null,depthTest:{func:j(i,q(a))},depthWrite:g(e),drawBuffers:u(s,S(i,s)),colorWrite:D,stencilWrite:n?x:null,stencilTest:n?t?y:P:null,polygonOffset:b(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}function q(e){return e===p.Lequal?A.LEQUAL:A.LESS}function I(e){return e.cullFace!==m.None||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}export{k as DefaultMaterialDrawParameters,w as DefaultMaterialPassParameters,B as DefaultMaterialTechnique};
|
|
@@ -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/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/RealisticTree.glsl.js";
|
|
5
|
+
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstanceColor.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/MaskedColor.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"../materials/internal/MaterialUtil.js";import"./OutputColorHighlightOID.glsl.js";import"../../../webgl/ShaderBuilder.js";import"../../../../webscene/support/AlphaCutoff.js";export{b as build}from"../../../../chunks/RealisticTree.glsl.js";
|
|
@@ -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{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as e}from"../../core/maybe.js";import{throwIfAborted as i,isAbortError as
|
|
5
|
+
import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as e}from"../../core/maybe.js";import{notDeepEqual as n}from"../../core/object.js";import{throwIfAborted as i,isAbortError as r,onAbort as a}from"../../core/promiseUtils.js";import{watch as s,syncAndInitial as l,on as c,whenOnce as u}from"../../core/reactiveUtils.js";function m(t,n){t.interactive=!0;const{tool:i,view:r}=t;r.activeTool=i;let s=a(n,(()=>{r.activeTool===i&&(r.activeTool=null)}));return o((async o=>{await u((()=>!t.tool?.active),o),s=e(s)}),n)}function p(o,t){return s((()=>o.interactive),(()=>v(o,t)),l)}function v(o,t){o.interactive?f(o,t):y(o)}function f(o,t){y(o);const{view:e,analysis:n}=o,i=new t({view:e,analysis:n,analysisViewData:o});return o.tool=i,e.tools.add(i),i}function y(o){const{view:t,tool:e}=o;null!=e&&(t.tools.remove(e),o.tool=null)}function d(e,n){const a=e.userOperation,s=o((async o=>{if(a){const t=a.promise.catch((()=>{}));a?.abort(),await t,i(o)}const s=m(e,{signal:o}),l=n?.shouldRejectOnCancel??(()=>!0),u=t([c((()=>e.tool),"cancel",(()=>{l()&&s.abort()}))]),{tool:p}=e;try{p&&(p.resetCreated(),n?.onToolActivated?.(p)),await s.promise,i(o)}catch(v){if(o.aborted||!r(v)||l())throw v}finally{u?.remove()}}),{signal:n?.abortOptions?.signal});return e.userOperation=s,s.promise.finally((()=>{e.userOperation===s&&(e.userOperation=null)}))}function O(o,t){const e=o.analysis.toJSON();return d(o,{abortOptions:t?.placementOptions,onToolActivated:t?.onToolActivated,shouldRejectOnCancel:()=>{const{analysis:t}=o;return!t.valid||!n(e,t.toJSON())}})}export{m as activateAnalysisViewTool,p as connectAnalysisViewToTool,y as removeAnalysisViewTool,d as startExclusiveInteractiveOperation,O as startPlaceOperation};
|
package/views/ui/UI.js
CHANGED
|
@@ -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"../../intl.js";import o from"../../core/Accessor.js";import{isSome as n}from"../../core/arrayUtils.js";import e from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteModeClass as c}from"../../support/modeUtils.js";import l from"./Component.js";import{isRTL as m}from"../../widgets/support/widgetUtils.js";import{getLocale as h,onLocaleChange as u}from"../../intl/locale.js";const f={left:0,top:0,bottom:0,right:0},_={bottom:30,top:15,right:15,left:15},g="esri-ui",y={ui:g,corner:`${g}-corner`,innerContainer:`${g}-inner-container`,manualContainer:`${g}-manual-container`,cornerContainer:`${g}-corner-container`,topLeft:`${g}-top-left`,topRight:`${g}-top-right`,bottomLeft:`${g}-bottom-left`,bottomRight:`${g}-bottom-right`};function C(t){return t&&!t._started&&"function"==typeof t.postMixInProperties&&"function"==typeof t.buildRendering&&"function"==typeof t.postCreate&&"function"==typeof t.startup}function v(t){return 0===t?"0":`${t}px`}function b(t){const o="object"==typeof t&&null!==t&&Object.getPrototypeOf(t);return(null===o||o===Object.prototype)&&("component"in t||"index"in t||"position"in t)?t:null}function w(t,{top:o,bottom:n,left:e,right:i}){t.style.top=o,t.style.bottom=n,t.style.left=e,t.style.right=i}let P=class extends e.EventedAccessor{constructor(t){super(t),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=new Array,this._componentMap=new Map,this._removeWidgetHandleKey=Symbol("componentOnRemoveSymbol"),this._locale=h(),this.view=null,this._applyViewPadding=()=>{const t=this.container;t&&w(t,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{const t=this._innerContainer;t&&w(t,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([r((()=>[this.view?.padding,this.container]),this._applyViewPadding,s),r((()=>this.padding),this._applyUIPadding,s),r((()=>[this.container,this._locale]),(([t,o])=>{t&&t.setAttribute("lang",o)}),s),u((t=>{this._locale=t}))])}destroy(){this.container=null;for(const t of this._components)t.destroy();this._components.length=0,this._componentMap.clear()}set container(t){const o=this._get("container");t!==o&&(t&&(t.classList.add(y.ui),c(t),this._attachContainers(t)),o&&(o.classList.remove(y.ui),w(o,{top:"",bottom:"",left:"",right:""}),o.textContent=""),this._set("container",t))}get height(){const t=this.view?.height??0;if(0===t)return t;const o=this._getViewPadding(),{top:n,bottom:e}=o;return Math.max(t-n-e,0)}get padding(){return this._get("padding")}set padding(t){this._overrideIfSome("padding",t)}castPadding(t){return"number"==typeof t?{bottom:t,top:t,right:t,left:t}:{..._,...t}}get width(){const t=this.view?.width??0;if(0===t)return t;const o=this._getViewPadding(),{left:n,right:e}=o;return Math.max(t-n-e,0)}add(t,o){let n,e,i;if(Array.isArray(t))return void t.forEach((t=>this.add(t,o)));const r=b(t);r&&({index:n,position:o,component:t,key:e}=r),o&&"object"==typeof o&&({index:n,key:e,position:o,internal:i}=o),!t||o&&!this._isValidPosition(o)||this._add(t,o,n??this._getNumComponentsAtPosition(o),e,i)}remove(t,o){if(!t)return;if(Array.isArray(t))return t.map((t=>this.remove(t,o)));const n=this._find(t);if(n){
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import o from"../../core/Accessor.js";import{isSome as n}from"../../core/arrayUtils.js";import e from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteModeClass as c}from"../../support/modeUtils.js";import l from"./Component.js";import{isRTL as m}from"../../widgets/support/widgetUtils.js";import{getLocale as h,onLocaleChange as u}from"../../intl/locale.js";const f={left:0,top:0,bottom:0,right:0},_={bottom:30,top:15,right:15,left:15},g="esri-ui",y={ui:g,corner:`${g}-corner`,innerContainer:`${g}-inner-container`,manualContainer:`${g}-manual-container`,cornerContainer:`${g}-corner-container`,topLeft:`${g}-top-left`,topRight:`${g}-top-right`,bottomLeft:`${g}-bottom-left`,bottomRight:`${g}-bottom-right`};function C(t){return t&&!t._started&&"function"==typeof t.postMixInProperties&&"function"==typeof t.buildRendering&&"function"==typeof t.postCreate&&"function"==typeof t.startup}function v(t){return 0===t?"0":`${t}px`}function b(t){const o="object"==typeof t&&null!==t&&Object.getPrototypeOf(t);return(null===o||o===Object.prototype)&&("component"in t||"index"in t||"position"in t)?t:null}function w(t,{top:o,bottom:n,left:e,right:i}){t.style.top=o,t.style.bottom=n,t.style.left=e,t.style.right=i}let P=class extends e.EventedAccessor{constructor(t){super(t),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=new Array,this._componentMap=new Map,this._removeWidgetHandleKey=Symbol("componentOnRemoveSymbol"),this._locale=h(),this.view=null,this._applyViewPadding=()=>{const t=this.container;t&&w(t,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{const t=this._innerContainer;t&&w(t,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([r((()=>[this.view?.padding,this.container]),this._applyViewPadding,s),r((()=>this.padding),this._applyUIPadding,s),r((()=>[this.container,this._locale]),(([t,o])=>{t&&t.setAttribute("lang",o)}),s),u((t=>{this._locale=t}))])}destroy(){this.container=null;for(const t of this._components)t.destroy();this._components.length=0,this._componentMap.clear()}set container(t){const o=this._get("container");t!==o&&(t&&(t.classList.add(y.ui),c(t),this._attachContainers(t)),o&&(o.classList.remove(y.ui),w(o,{top:"",bottom:"",left:"",right:""}),o.textContent=""),this._set("container",t))}get height(){const t=this.view?.height??0;if(0===t)return t;const o=this._getViewPadding(),{top:n,bottom:e}=o;return Math.max(t-n-e,0)}get padding(){return this._get("padding")}set padding(t){this._overrideIfSome("padding",t)}castPadding(t){return"number"==typeof t?{bottom:t,top:t,right:t,left:t}:{..._,...t}}get width(){const t=this.view?.width??0;if(0===t)return t;const o=this._getViewPadding(),{left:n,right:e}=o;return Math.max(t-n-e,0)}add(t,o){let n,e,i;if(Array.isArray(t))return void t.forEach((t=>this.add(t,o)));const r=b(t);r&&({index:n,position:o,component:t,key:e}=r),o&&"object"==typeof o&&({index:n,key:e,position:o,internal:i}=o),!t||o&&!this._isValidPosition(o)||this._add(t,o,n??this._getNumComponentsAtPosition(o),e,i)}remove(t,o){if(!t)return;if(Array.isArray(t))return t.map((t=>this.remove(t,o)));const n=this._find(t);if(n){const t=this._componentMap.get(n);if(!t||t.key!==o)return;const e=this._components.indexOf(n),i=n.node.parentNode;return i?.removeChild(n.node),this._componentMap.delete(n),n.widget?.removeHandlesReference(this._removeWidgetHandleKey),this._components.forEach((o=>{const n=this._componentMap.get(o);n&&n.position===t.position&&n.index>t.index&&n.index--})),this._components.splice(e,1)[0]}}empty(t,o={removeInternal:!1}){if(Array.isArray(t)){for(const n of t)this.empty(n,o);return}const n=this._positionNameToContainerLookup[t??"manual"],e=Array.prototype.slice.call(n.children).map((t=>this._findByNode(t))).filter((t=>{if(null==t)return!1;return!(this._componentMap.get(t)?.internal??!1)||o.removeInternal}));for(const i of e)this.remove(i)}move(t,o){if(Array.isArray(t)&&t.forEach((t=>this.move(t,o))),!t)return;let n;const e=b(t)||b(o);if(e&&(n=e.index,o=e.position,t=e.component||t),o&&!this._isValidPosition(o))return;const i=this.remove(t);i&&this.add(i,{position:o,index:n})}find(t){if(!t)return null;const o=this._findById(t);return o&&(o.widget||o.node)}getComponents(t,o={includeInternal:!1}){return t?Array.isArray(t)?t.flatMap((t=>this._getComponentsAtPosition(t,o))):this._getComponentsAtPosition(t,o):this._components.filter((t=>o.includeInternal||!this._componentMap.get(t)?.internal)).map((({widget:t,node:o})=>t??o))}getPosition(t){for(const o in this._positionNameToContainerLookup){if(this._positionNameToContainerLookup[o].contains(t))return o}return null}_add(t,n,e,r,s){t instanceof l||(t=new l({node:t}));const{widget:a}=t;null!=a&&a instanceof o&&a.addHandles(i((()=>{queueMicrotask((()=>this.remove(t)))})),this._removeWidgetHandleKey);this._components.some((t=>this._componentMap.get(t)?.position===n&&this._componentMap.get(t)?.index===e))&&this._components.forEach((t=>{const o=this._componentMap.get(t);o&&o.position===n&&o.index>=e&&o.index++})),this._place({component:t,position:n,index:e}),this._components.push(t),this._componentMap.set(t,{key:r,position:n,internal:s,index:e})}_find(t){return t?t instanceof l?this._findByComponent(t):"string"==typeof t?this._findById(t):"domNode"in t?this._findByNode(t.domNode):this._findByNode(t):null}_getViewPadding(){return this.view?.padding??f}_attachContainers(t){t.appendChild(this._innerContainer),t.appendChild(this._manualContainer)}_initContainers(){const t=document.createElement("div");t.classList.add(y.innerContainer,y.cornerContainer);const o=document.createElement("div");o.classList.add(y.innerContainer,y.manualContainer);const n=document.createElement("div");n.classList.add(y.topLeft,y.corner),t.appendChild(n);const e=document.createElement("div");e.classList.add(y.topRight,y.corner),t.appendChild(e);const i=document.createElement("div");i.classList.add(y.bottomLeft,y.corner),t.appendChild(i);const r=document.createElement("div");r.classList.add(y.bottomRight,y.corner),t.appendChild(r),this._innerContainer=t,this._manualContainer=o;const s=m();this._cornerNameToContainerLookup={"top-left":n,"top-right":e,"bottom-left":i,"bottom-right":r,"top-leading":s?e:n,"top-trailing":s?n:e,"bottom-leading":s?r:i,"bottom-trailing":s?i:r},this._positionNameToContainerLookup={manual:o,...this._cornerNameToContainerLookup}}_isValidPosition(t){return!!this._positionNameToContainerLookup[t]}_place(t){const o=t.position??"manual",{component:n,index:e}=t,i=this._positionNameToContainerLookup[o],r=null!=e&&e>-1;if(C(n.widget)&&n.widget.startup(),!r)return void i.appendChild(n.node);const s=Array.from(i.children);if(0!==s.length){for(const t of s){const o=this._findByNode(t);if(o&&e<(this._componentMap.get(o)?.index??0))return void t.parentNode?.insertBefore(n.node,t)}i.appendChild(n.node)}else i.appendChild(n.node)}_toPixelPosition(t){return{top:v(t.top),left:v(t.left),right:v(t.right),bottom:v(t.bottom)}}_findByComponent(t){return this._components.find((o=>o===t))??null}_findById(t){return this._components.find((({id:o})=>o===t))??null}_findByNode(t){return t?this._components.find((({node:o})=>o===t)):null}_getComponentsAtPosition(t,o){const e=this._positionNameToContainerLookup[t];return Array.prototype.slice.call(e.children).map((t=>this._findByNode(t))).filter(n).filter((t=>o.includeInternal||!this._componentMap.get(t)?.internal)).map((({widget:t,node:o})=>t??o))}_getNumComponentsAtPosition(t){const o=this._positionNameToContainerLookup[t];return o?.children.length??0}};t([a()],P.prototype,"_locale",void 0),t([a()],P.prototype,"container",null),t([a()],P.prototype,"height",null),t([a({value:_})],P.prototype,"padding",null),t([p("padding")],P.prototype,"castPadding",null),t([a()],P.prototype,"view",void 0),t([a()],P.prototype,"width",null),P=t([d("esri.views.ui.UI")],P);const x=P;export{x as default};
|
package/views/webgl/Program.js
CHANGED
|
@@ -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{webglValidateShadersEnabled as t,webglDebugEnabled as e}from"./checkWebGLError.js";import{ShaderType as o,ResourceType as i,Extension as n}from"./enums.js";import{transpileShader as r}from"./ShaderTranspiler.js";const s=4294967295;class a{constructor(e,n,a,m,f=new Map,c=[]){this._context=e,this._locations=m,this._uniformBlockBindings=f,this._transformFeedbackVaryings=c,this._refCount=1,this._compiled=!1,this._linesOfCode=0,this._nameToUniformLocation=new Map,this._nameToUniform1=new Map,this._nameToUniform1v=new Map,this._nameToUniform2=new Map,this._nameToUniform3=new Map,this._nameToUniform4=new Map,this._nameToUniformMatrix3=new Map,this._nameToUniformMatrix4=new Map,e||console.error("RenderingContext isn't initialized!"),0===n.length&&console.error("Shaders source should not be empty!"),n=r(n,o.VERTEX_SHADER),a=r(a,o.FRAGMENT_SHADER),this._vShader=h(this._context,o.VERTEX_SHADER,n),this._fShader=h(this._context,o.FRAGMENT_SHADER,a),_.enabled&&(this._linesOfCode=n.match(/\n/g).length+a.match(/\n/g).length+2,this._context.instanceCounter.increment(i.LinesOfCode,this._vShader,this._linesOfCode)),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(i.Shader,this),t()&&(this.vertexShader=n,this.fragmentShader=a),this.usedMemory=n.length+a.length;const l=this._context.gl,g=l.createProgram();l.attachShader(g,this._vShader),l.attachShader(g,this._fShader),this._locations.forEach(((t,e)=>l.bindAttribLocation(g,t,e))),this._transformFeedbackVaryings?.length&&l.transformFeedbackVaryings(g,this._transformFeedbackVaryings,l.SEPARATE_ATTRIBS),l.linkProgram(g),t()&&!l.getProgramParameter(g,l.LINK_STATUS)&&console.error(`Could not link shader\nvalidated: ${l.getProgramParameter(g,l.VALIDATE_STATUS)}, gl error ${l.getError()}, vertex: ${l.getShaderParameter(this._vShader,l.COMPILE_STATUS)}, fragment: ${l.getShaderParameter(this._fShader,l.COMPILE_STATUS)}, info log: ${l.getProgramInfoLog(g)}, vertex source: ${this.vertexShader}, fragment source: ${this.fragmentShader}`);for(const[t,o]of this._uniformBlockBindings){const e=l.getUniformBlockIndex(g,t);e<s&&l.uniformBlockBinding(g,e,o)}this._glName=g,this._context.instanceCounter.increment(i.Program,this)}get glName(){return this._glName}get hasGLName(){return null!=this._glName}get hasTransformFeedbackVaryings(){return!!this._transformFeedbackVaryings?.length}get compiled(){return!!this._compiled||(this._context.capabilities.parallelShaderCompile&&null!=this.glName?(this._compiled=!!this._context.gl.getProgramParameter(this.glName,n.COMPLETION_STATUS_KHR),this._compiled):(this._compiled=!0,!0))}dispose(){if(--this._refCount>0)return;const t=this._context.gl,e=this._context.instanceCounter;this._nameToUniformLocation.forEach((t=>t&&e.decrement(i.Uniform,t))),this._nameToUniformLocation.clear(),this._vShader&&(this._linesOfCode>0&&(e.decrement(i.LinesOfCode,this._vShader,this._linesOfCode),this._linesOfCode=0),t.deleteShader(this._vShader),this._vShader=null,e.decrement(i.Shader,this)),this._fShader&&(t.deleteShader(this._fShader),this._fShader=null),this._glName&&(t.deleteProgram(this._glName),this._glName=null,e.decrement(i.Program,this))}ref(){++this._refCount}_getUniformLocation(t){const e=this._nameToUniformLocation.get(t);if(void 0!==e)return e;if(this.glName){const e=this._context.gl.getUniformLocation(this.glName,t);return this._nameToUniformLocation.set(t,e),e&&this._context.instanceCounter.increment(i.Uniform,e),e}return null}hasUniform(t){return null!=this._getUniformLocation(t)}setUniform1i(t,e){l(e);const
|
|
5
|
+
import"../../core/has.js";import{webglValidateShadersEnabled as t,webglDebugEnabled as e}from"./checkWebGLError.js";import{ShaderType as o,ResourceType as i,Extension as n}from"./enums.js";import{transpileShader as r}from"./ShaderTranspiler.js";const s=4294967295;class a{constructor(e,n,a,m,f=new Map,c=[]){this._context=e,this._locations=m,this._uniformBlockBindings=f,this._transformFeedbackVaryings=c,this._refCount=1,this._compiled=!1,this._linesOfCode=0,this._nameToUniformLocation=new Map,this._nameToUniform1=new Map,this._nameToUniform1v=new Map,this._nameToUniform2=new Map,this._nameToUniform3=new Map,this._nameToUniform4=new Map,this._nameToUniformMatrix3=new Map,this._nameToUniformMatrix4=new Map,e||console.error("RenderingContext isn't initialized!"),0===n.length&&console.error("Shaders source should not be empty!"),n=r(n,o.VERTEX_SHADER),a=r(a,o.FRAGMENT_SHADER),this._vShader=h(this._context,o.VERTEX_SHADER,n),this._fShader=h(this._context,o.FRAGMENT_SHADER,a),_.enabled&&(this._linesOfCode=n.match(/\n/g).length+a.match(/\n/g).length+2,this._context.instanceCounter.increment(i.LinesOfCode,this._vShader,this._linesOfCode)),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(i.Shader,this),t()&&(this.vertexShader=n,this.fragmentShader=a),this.usedMemory=n.length+a.length;const l=this._context.gl,g=l.createProgram();l.attachShader(g,this._vShader),l.attachShader(g,this._fShader),this._locations.forEach(((t,e)=>l.bindAttribLocation(g,t,e))),this._transformFeedbackVaryings?.length&&l.transformFeedbackVaryings(g,this._transformFeedbackVaryings,l.SEPARATE_ATTRIBS),l.linkProgram(g),t()&&!l.getProgramParameter(g,l.LINK_STATUS)&&console.error(`Could not link shader\nvalidated: ${l.getProgramParameter(g,l.VALIDATE_STATUS)}, gl error ${l.getError()}, vertex: ${l.getShaderParameter(this._vShader,l.COMPILE_STATUS)}, fragment: ${l.getShaderParameter(this._fShader,l.COMPILE_STATUS)}, info log: ${l.getProgramInfoLog(g)}, vertex source: ${this.vertexShader}, fragment source: ${this.fragmentShader}`);for(const[t,o]of this._uniformBlockBindings){const e=l.getUniformBlockIndex(g,t);e<s&&l.uniformBlockBinding(g,e,o)}this._glName=g,this._context.instanceCounter.increment(i.Program,this)}get glName(){return this._glName}get hasGLName(){return null!=this._glName}get hasTransformFeedbackVaryings(){return!!this._transformFeedbackVaryings?.length}get compiled(){return!!this._compiled||(this._context.capabilities.parallelShaderCompile&&null!=this.glName?(this._compiled=!!this._context.gl.getProgramParameter(this.glName,n.COMPLETION_STATUS_KHR),this._compiled):(this._compiled=!0,!0))}dispose(){if(--this._refCount>0)return;const t=this._context.gl,e=this._context.instanceCounter;this._nameToUniformLocation.forEach((t=>t&&e.decrement(i.Uniform,t))),this._nameToUniformLocation.clear(),this._vShader&&(this._linesOfCode>0&&(e.decrement(i.LinesOfCode,this._vShader,this._linesOfCode),this._linesOfCode=0),t.deleteShader(this._vShader),this._vShader=null,e.decrement(i.Shader,this)),this._fShader&&(t.deleteShader(this._fShader),this._fShader=null),this._glName&&(t.deleteProgram(this._glName),this._glName=null,e.decrement(i.Program,this))}ref(){++this._refCount}_getUniformLocation(t){const e=this._nameToUniformLocation.get(t);if(void 0!==e)return e;if(this.glName){const e=this._context.gl.getUniformLocation(this.glName,t);return this._nameToUniformLocation.set(t,e),e&&this._context.instanceCounter.increment(i.Uniform,e),e}return null}hasUniform(t){return null!=this._getUniformLocation(t)}setUniform1i(t,e,o){l(o,e);const i=this._nameToUniform1.get(t);void 0!==i&&e===i||(this._context.gl.uniform1i(this._getUniformLocation(t),e),this._nameToUniform1.set(t,e))}setUniform1iv(t,e,o){g(o,e),c(this._nameToUniform1v,t,e)&&this._context.gl.uniform1iv(this._getUniformLocation(t),e)}setUniform2iv(t,e,o){g(o,e),c(this._nameToUniform2,t,e)&&this._context.gl.uniform2iv(this._getUniformLocation(t),e)}setUniform3iv(t,e,o){g(o,e),c(this._nameToUniform3,t,e)&&this._context.gl.uniform3iv(this._getUniformLocation(t),e)}setUniform4iv(t,e,o){g(o,e),c(this._nameToUniform4,t,e)&&this._context.gl.uniform4iv(this._getUniformLocation(t),e)}setUniform1f(t,e,o){l(o,e);const i=this._nameToUniform1.get(t);void 0!==i&&e===i||(this._context.gl.uniform1f(this._getUniformLocation(t),e),this._nameToUniform1.set(t,e))}setUniform1fv(t,e,o){g(o,e),c(this._nameToUniform1v,t,e)&&this._context.gl.uniform1fv(this._getUniformLocation(t),e)}setUniform2f(t,e,o,i){l(i,e,o);const n=this._nameToUniform2.get(t);void 0===n?(this._context.gl.uniform2f(this._getUniformLocation(t),e,o),this._nameToUniform2.set(t,[e,o])):e===n[0]&&o===n[1]||(this._context.gl.uniform2f(this._getUniformLocation(t),e,o),n[0]=e,n[1]=o)}setUniform2fv(t,e,o){g(o,e),c(this._nameToUniform2,t,e)&&this._context.gl.uniform2fv(this._getUniformLocation(t),e)}setUniform3f(t,e,o,i,n){l(n,e,o,i);const r=this._nameToUniform3.get(t);void 0===r?(this._context.gl.uniform3f(this._getUniformLocation(t),e,o,i),this._nameToUniform3.set(t,[e,o,i])):e===r[0]&&o===r[1]&&i===r[2]||(this._context.gl.uniform3f(this._getUniformLocation(t),e,o,i),r[0]=e,r[1]=o,r[2]=i)}setUniform3fv(t,e,o){g(o,e);const i=this._getUniformLocation(t);null!=i&&c(this._nameToUniform3,t,e)&&this._context.gl.uniform3fv(i,e)}setUniform4f(t,e,o,i,n,r){l(r,e,o,i,n);const s=this._nameToUniform4.get(t);void 0===s?(this._context.gl.uniform4f(this._getUniformLocation(t),e,o,i,n),this._nameToUniform4.set(t,[e,o,i,n])):void 0!==s&&e===s[0]&&o===s[1]&&i===s[2]&&n===s[3]||(this._context.gl.uniform4f(this._getUniformLocation(t),e,o,i,n),s[0]=e,s[1]=o,s[2]=i,s[3]=n)}setUniform4fv(t,e,o){g(o,e);const i=this._getUniformLocation(t);null!=i&&c(this._nameToUniform4,t,e)&&this._context.gl.uniform4fv(i,e)}setUniformMatrix3fv(t,e,o=!1,i){g(i,e);const n=this._getUniformLocation(t);null!=n&&c(this._nameToUniformMatrix3,t,e)&&this._context.gl.uniformMatrix3fv(n,o,e)}setUniformMatrix4fv(t,e,o=!1,i){g(i,e);const n=this._getUniformLocation(t);null!=n&&c(this._nameToUniformMatrix4,t,e)&&this._context.gl.uniformMatrix4fv(n,o,e)}stop(){}}function h(e,i,n){const r=e.gl,s=r.createShader(i);return r.shaderSource(s,n),r.compileShader(s),t()&&!r.getShaderParameter(s,r.COMPILE_STATUS)&&(console.error("Compile error in ".concat(i===o.VERTEX_SHADER?"vertex":"fragment"," shader")),console.error(r.getShaderInfoLog(s)),console.error(m(n))),s}function m(t){let e=2;return t.replaceAll("\n",(()=>"\n"+f(e++)+":"))}function f(t){return t>=1e3?t.toString():(" "+t).slice(-3)}function c(t,e,o){const i=t.get(e);if(!i)return t.set(e,Array.from(o)),!0;const n=o.length;if(i.length!==n)return t.set(e,Array.from(o)),!0;for(let r=0;r<n;++r){const t=o[r];if(i[r]!==t){for(i[r]=t;r<n;++r)i[r]=o[r];return!0}}return!1}const _={enabled:!1},l=e()?(t,...e)=>g(t,e):()=>{},g=e()?(t,e)=>{if(t?.supportsNaN)return;const o=e.length;for(let i=0;i<o;++i){const t=e[i];Number.isNaN(t)&&console.error(`Got ${t} as uniform value from ${(new Error).stack}`)}}:()=>{};export{a as Program,_ as test};
|
|
@@ -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 e from"../../core/Error.js";import"../../core/has.js";import t from"../../core/Logger.js";import{BindType as r}from"./BindType.js";const n=()=>t.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class s{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class i extends s{constructor(){super(...arguments),this.vertex=new c,this.fragment=new c,this.attributes=new h,this.varyings=new m,this.extensions=new _,this.outputs=new d}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e,t=!1){const r=this.extensions.generateSource(e),n=this.attributes.generateSource(e),s=this.varyings.generateSource(e),i="vertex"===e?this.vertex:this.fragment,
|
|
5
|
+
import e from"../../core/Error.js";import"../../core/has.js";import t from"../../core/Logger.js";import{BindType as r}from"./BindType.js";const n=()=>t.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class s{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class i extends s{constructor(){super(...arguments),this.vertex=new c,this.fragment=new c,this.attributes=new h,this.varyings=new m,this.extensions=new _,this.outputs=new d}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e,t=!1){const r=this.extensions.generateSource(e),n=this.attributes.generateSource(e),s=this.varyings.generateSource(e),i="vertex"===e?this.vertex:this.fragment,a=i.uniforms.generateSource(),o=i.code.generateSource(),u=i.main.generateSource(t),c="vertex"===e?g:p,h=i.constants.generateSource(),m=this.outputs.generateSource(e);return`#version 300 es\n${r.join("\n")}\n${c}\n${h.join("\n")}\n${a.join("\n")}\n${n.join("\n")}\n${s.join("\n")}\n${m.join("\n")}\n${o.join("\n")}\n${u.join("\n")}`}generateBind(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[r.Bind];n&&t.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[r.Bind];n&&t.set(e.name,n)}));const n=Array.from(t.values()),s=n.length;return t=>{for(let r=0;r<s;++r)n[r](e,t)}}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[r.Pass];n&&t.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[r.Pass];n&&t.set(e.name,n)}));const n=Array.from(t.values()),s=n.length;return(t,r)=>{for(let i=0;i<s;++i)n[i](e,t,r)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[r.Draw];n&&t.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[r.Draw];n&&t.set(e.name,n)}));const n=Array.from(t.values()),s=n.length;return(t,r,i)=>{for(let a=0;a<s;++a)n[a](e,i,t,r)}}}class a{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(t){if(null!=t){if(this._entries.has(t.name)&&!this._entries.get(t.name).equals(t))throw new e("shaderbuilder:duplicate-uniform",`Duplicate uniform name ${t.name} for different uniform type`);this._entries.set(t.name,t)}else n().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map((({name:e,arraySize:t,type:r})=>null!=t?`uniform ${r} ${e}[${t}];`:`uniform ${r} ${e};`))}get entries(){return Array.from(this._entries.values())}}class o{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(t){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];if(t)throw new e("shaderbuilder:missing-main","Shader does not contain main function body.");return[]}}class u{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class c extends s{constructor(){super(...arguments),this.uniforms=new a(this),this.main=new o(this),this.code=new u(this),this.constants=new l(this)}get builder(){return this}}class h{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map((e=>`in ${e[1]} ${e[0]};`))}}class m{constructor(){this._entries=new Map}add(e,t,r){this._entries.has(e)?n().warn(`Ignoring duplicate varying ${t} ${e}`):this._entries.set(e,{type:t,invariant:r?.invariant??!1,flat:r?.flat??!1})}generateSource(e){const t=new Array;return this._entries.forEach(((r,n)=>t.push((r.invariant&&"vertex"===e?"invariant ":"")+(r.flat||"int"===r.type?"flat ":"")+("vertex"===e?"out":"in")+` ${r.type} ${n};`))),t}}class _{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const t="vertex"===e?_.ALLOWLIST_VERTEX:_.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter((e=>t.includes(e))).map((e=>`#extension ${e} : enable`))}static{this.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"]}static{this.ALLOWLIST_VERTEX=[]}}class d{constructor(){this._entries=new Map}add(e,t,r=0){const s=this._entries.get(r);s?.name!==e||s?.type!==t?this._entries.set(r,{name:e,type:t}):n().warn(`Fragment shader output location ${r} occupied`)}static{this.DEFAULT_TYPE="vec4"}static{this.DEFAULT_NAME="fragColor"}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:d.DEFAULT_NAME,type:d.DEFAULT_TYPE});const t=new Array;return this._entries.forEach(((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`))),t}}class l{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let n="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":n=l._numberToFloatStr(r);break;case"int":n=l._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])}, ${l._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])}, ${l._numberToFloatStr(r[2])}, ${l._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])}, ${l._numberToIntStr(r[3])})`;break;case"uvec2":n=`uvec2(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])})`;break;case"uvec3":n=`uvec3(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])})`;break;case"uvec4":n=`uvec4(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])}, ${l._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${t}(${Array.prototype.map.call(r,(e=>l._numberToFloatStr(e))).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${n};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const p="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n precision mediump usampler2D;\n precision mediump sampler2DArray;\n precision mediump sampler2DShadow;\n#endif",g="precision highp float;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n\n\n invariant gl_Position;\n ";export{u as Code,s as Includes,o as Main,i as ShaderBuilder,c as Stage,a as Uniforms};
|
package/webscene/Slide.js
CHANGED
|
@@ -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 t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Clonable.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import a from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{Milliseconds as b,Seconds as v}from"../core/time.js";import{property as w}from"../core/accessorSupport/decorators/property.js";import{cast as f}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as T}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as j}from"../core/accessorSupport/ensureType.js";import{s as L}from"../chunks/vec32.js";import{create as C}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as E,clonePreservingTiledLayers as S}from"../support/basemapEnsureType.js";import{TaskPriority as A}from"../views/support/Scheduler.js";import{SlideThumbnail as k}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as V}from"../webdoc/support/timeProperties.js";import U from"./SunLighting.js";import x from"./VirtualLighting.js";import F from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import R from"./support/SlideGround.js";import{SlideVisibleLayer as M}from"./support/SlideVisibleLayer.js";import O from"./support/Title.js";let P=0;const q=s.ofType(M),B=["caption","cover","none"];let G=class extends(r.ClonableMixin(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+P++,this.title=new O,this.description=new F,this.hidden=!1,this.thumbnail=new k,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.environment=new D,this.timeExtent=null,this.elements=new I,this.visibleLayers=new q,this.enabledFocusAreas=new s}destroy(){this.visibleLayers.removeAll(),this.enabledFocusAreas?.removeAll(),this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new O({text:e}):j(O,e)}castDescription(e){return"string"==typeof e?new F({text:e}):j(F,e)}castThumbnail(e){return"string"==typeof e?new k({url:e}):j(k,e)}castBasemap(e){return E(e)}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),q))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=H(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}async _updateVisibleLayers(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=H(i);t.push(new M({id:e.layer.id,sublayerIds:n}))}})))).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?x.prototype.clone.apply(e.environment.lighting):U.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.enabledFocusAreas=e.focusAreasView?.enabledAreas?new s(e.focusAreasView?.enabledAreas.map((({id:e})=>e))):null,this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?R.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayers(e);const n=await e.takeScreenshot(i);return this.thumbnail=new k({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i?.abort())),s=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y((()=>e.ready),i.signal)}catch(c){throw s(),c}if(i.signal.aborted)throw s(),d();const o=e.resourceController.scheduler.registerTask(A.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([o.schedule((async()=>a=await this._setViewpointOfInterest(e,l))),o.schedule((()=>this._applyBasemap(e,l)),l.signal),o.schedule((()=>this._loadLayersWithSublayerVisibility(e)))]),await Promise.all([o.schedule((()=>this._applyLayerVisibility(e)),l.signal),o.schedule((()=>this._applyFocusAreaEnabled(e.map?.focusAreas.areas))),o.schedule((()=>this._applyGround(e)),l.signal),o.schedule((()=>this.elements.analyses.applyTo(e)),l.signal),o.schedule((()=>this._applyViewpoint(e,l)),l.signal),o.schedule((()=>e.timeExtent=this.timeExtent?.clone()??null),l.signal),o.schedule((()=>e.environment.weather=this.environment.weather.clone()))])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),o.remove(),s(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=S(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaEnabled(e){if(e&&this.enabledFocusAreas)for(const t of e)t.enabled=this.enabledFocusAreas.includes(t.id)}_getLayers(e){const t=new s;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map((e=>{const t=this.visibleLayers.find((t=>t.id===e.id))?.sublayerIds;return t?e.load():null})))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t?.sublayerIds,n=W(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())})).catch((t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t})).finally((()=>{c(i)}))}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[b(e.getTime()),v(3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds())]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,s]=this._getTime(n),[o,a]=this._getTime(i.date),l=K(s,a),p=e.renderCoordsHelper,m=C();p.toRenderCoords(e.camera.position,m);const c=C(),h=C();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g((()=>e.camera),(e=>{p.toRenderCoords(e.position,h);const i=L(m,h),n=L(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(o-r)*a,y=Q(s,v(l*a));t.date=this._setTime(d,u,y)}))}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([w({type:String,json:{write:{isRequired:!0}}})],G.prototype,"id",void 0),e([w({type:O,json:{default:()=>new O({text:""}),write:{isRequired:!0}}})],G.prototype,"title",void 0),e([f("title")],G.prototype,"castTitle",null),e([w({type:F,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],G.prototype,"description",void 0),e([f("description")],G.prototype,"castDescription",null),e([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],G.prototype,"hidden",void 0),e([w({type:k,json:{default:()=>new k({url:""}),write:{isRequired:!0}}})],G.prototype,"thumbnail",void 0),e([f("thumbnail")],G.prototype,"castThumbnail",null),e([w({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],G.prototype,"viewpoint",void 0),e([w({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],G.prototype,"basemap",void 0),e([f("basemap")],G.prototype,"castBasemap",null),e([w({type:R,json:{write:!0}})],G.prototype,"ground",void 0),e([w({type:B,json:{write:!0,default:"caption"},nonNullable:!0})],G.prototype,"layout",void 0),e([w({type:q,json:{write:{isRequired:!0}}})],G.prototype,"visibleLayers",null),e([f("visibleLayers")],G.prototype,"castVisibleLayers",null),e([w({type:s.ofType(String),json:{write:!0},clonable:e=>e?new s(e.items):null})],G.prototype,"enabledFocusAreas",void 0),e([w({type:D,json:{write:!0}})],G.prototype,"environment",void 0),e([w(V)],G.prototype,"timeExtent",void 0),e([w({type:I,nonNullable:!0,json:{write:!0}})],G.prototype,"elements",void 0),G=e([T("esri.webscene.Slide")],G);const N=G;function W(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function H(e){const t=W(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}const J=v(86400),z=v(43200);function K(e,t){let i=t-e;return i>z&&(i-=J),i<-z&&(i+=J),v(i)}function Q(e,t){return v(p(e+t,J))}export{N as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Clonable.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import a from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{Milliseconds as b,Seconds as v}from"../core/time.js";import{property as w}from"../core/accessorSupport/decorators/property.js";import{cast as f}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as T}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as j}from"../core/accessorSupport/ensureType.js";import{s as L}from"../chunks/vec32.js";import{create as C}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as E,clonePreservingTiledLayers as S}from"../support/basemapEnsureType.js";import{TaskPriority as k}from"../views/support/Scheduler.js";import{SlideThumbnail as A}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as V}from"../webdoc/support/timeProperties.js";import U from"./SunLighting.js";import x from"./VirtualLighting.js";import F from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import R from"./support/SlideGround.js";import{SlideVisibleLayer as M}from"./support/SlideVisibleLayer.js";import O from"./support/Title.js";let P=0;const q=s.ofType(M),B=["caption","cover","none"];let G=class extends(r.ClonableMixin(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+P++,this.title=new O,this.description=new F,this.hidden=!1,this.thumbnail=new A,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.enabledFocusAreas=null,this.environment=new D,this.timeExtent=null,this.elements=new I,this.visibleLayers=new q}destroy(){this.visibleLayers.removeAll(),this.enabledFocusAreas=null,this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new O({text:e}):j(O,e)}castDescription(e){return"string"==typeof e?new F({text:e}):j(F,e)}castThumbnail(e){return"string"==typeof e?new A({url:e}):j(A,e)}castBasemap(e){return E(e)}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),q))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=H(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}async _updateVisibleLayers(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=H(i);t.push(new M({id:e.layer.id,sublayerIds:n}))}})))).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?x.prototype.clone.apply(e.environment.lighting):U.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.enabledFocusAreas=new s(e.focusAreasView?.enabledAreas.map((({id:e})=>e))??[]),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?R.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayers(e);const n=await e.takeScreenshot(i);return this.thumbnail=new A({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i?.abort())),s=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y((()=>e.ready),i.signal)}catch(c){throw s(),c}if(i.signal.aborted)throw s(),d();const o=e.resourceController.scheduler.registerTask(k.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([o.schedule((async()=>a=await this._setViewpointOfInterest(e,l))),o.schedule((()=>this._applyBasemap(e,l)),l.signal),o.schedule((()=>this._loadLayersWithSublayerVisibility(e)))]),await Promise.all([o.schedule((()=>this._applyLayerVisibility(e)),l.signal),o.schedule((()=>this._applyFocusAreaEnabled(e.map?.focusAreas.areas))),o.schedule((()=>this._applyGround(e)),l.signal),o.schedule((()=>this.elements.analyses.applyTo(e)),l.signal),o.schedule((()=>this._applyViewpoint(e,l)),l.signal),o.schedule((()=>e.timeExtent=this.timeExtent?.clone()??null),l.signal),o.schedule((()=>e.environment.weather=this.environment.weather.clone()))])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),o.remove(),s(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=S(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaEnabled(e){if(e&&this.enabledFocusAreas)for(const t of e)t.enabled=this.enabledFocusAreas.includes(t.id)}_getLayers(e){const t=new s;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map((e=>{const t=this.visibleLayers.find((t=>t.id===e.id))?.sublayerIds;return t?e.load():null})))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t?.sublayerIds,n=W(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())})).catch((t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t})).finally((()=>{c(i)}))}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[b(e.getTime()),v(3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds())]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,s]=this._getTime(n),[o,a]=this._getTime(i.date),l=K(s,a),p=e.renderCoordsHelper,m=C();p.toRenderCoords(e.camera.position,m);const c=C(),h=C();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g((()=>e.camera),(e=>{p.toRenderCoords(e.position,h);const i=L(m,h),n=L(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(o-r)*a,y=Q(s,v(l*a));t.date=this._setTime(d,u,y)}))}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([w({type:String,json:{write:{isRequired:!0}}})],G.prototype,"id",void 0),e([w({type:O,json:{default:()=>new O({text:""}),write:{isRequired:!0}}})],G.prototype,"title",void 0),e([f("title")],G.prototype,"castTitle",null),e([w({type:F,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],G.prototype,"description",void 0),e([f("description")],G.prototype,"castDescription",null),e([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],G.prototype,"hidden",void 0),e([w({type:A,json:{default:()=>new A({url:""}),write:{isRequired:!0}}})],G.prototype,"thumbnail",void 0),e([f("thumbnail")],G.prototype,"castThumbnail",null),e([w({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],G.prototype,"viewpoint",void 0),e([w({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],G.prototype,"basemap",void 0),e([f("basemap")],G.prototype,"castBasemap",null),e([w({type:R,json:{write:!0}})],G.prototype,"ground",void 0),e([w({type:B,json:{write:!0,default:"caption"},nonNullable:!0})],G.prototype,"layout",void 0),e([w({type:q,json:{write:{isRequired:!0}}})],G.prototype,"visibleLayers",null),e([f("visibleLayers")],G.prototype,"castVisibleLayers",null),e([w({type:s.ofType(String),json:{write:!0},clonable:e=>e?new s(e.items):null})],G.prototype,"enabledFocusAreas",void 0),e([w({type:D,json:{write:!0}})],G.prototype,"environment",void 0),e([w(V)],G.prototype,"timeExtent",void 0),e([w({type:I,nonNullable:!0,json:{write:!0}})],G.prototype,"elements",void 0),G=e([T("esri.webscene.Slide")],G);const N=G;function W(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function H(e){const t=W(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}const J=v(86400),z=v(43200);function K(e,t){let i=t-e;return i>z&&(i-=J),i<-z&&(i+=J),v(i)}function Q(e,t){return v(p(e+t,J))}export{N as default};
|