@arcgis/core 5.2.0-next.21 → 5.2.0-next.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Graphic.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{eccbddaec4be44c86f79.js → 1040bce57ea63a6dbca4.js} +2 -2
- package/assets/esri/core/workers/chunks/1a7c0a1dc6ecc93ea03a.js +1 -0
- package/assets/esri/core/workers/chunks/292498a9c7d462d215c6.js +1 -0
- package/assets/esri/core/workers/chunks/2d6d01913096f7cb5ff8.js +1 -0
- package/assets/esri/core/workers/chunks/30298f84bd414f9dea64.js +1 -0
- package/assets/esri/core/workers/chunks/353c67da4b25c29360db.js +2 -0
- package/assets/esri/core/workers/chunks/3b4fc67f6cb7393fbd97.js +1 -0
- package/assets/esri/core/workers/chunks/47948c72bc01bd173c20.js +2 -0
- package/assets/esri/core/workers/chunks/{f0519b06987471456b69.js → 502464c4eab7667f6566.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7acbc2ddff4cee8a465.js → 5ee887fc6e1e0e70e02f.js} +1 -1
- package/assets/esri/core/workers/chunks/6c0c77de1934f35dc45f.js +1 -0
- package/assets/esri/core/workers/chunks/{f7f820483e45c05ab9e4.js → 75df436e6e9773bdcfc2.js} +1 -1
- package/assets/esri/core/workers/chunks/780519b60aa674a61a74.js +1 -0
- package/assets/esri/core/workers/chunks/7dbaa089c7472825b80c.js +1 -0
- package/assets/esri/core/workers/chunks/7dec8c453fdee1968d12.js +1 -0
- package/assets/esri/core/workers/chunks/{a2247f4c3116efb16c4f.js → 7e23de8d9b2d938808f6.js} +1 -1
- package/assets/esri/core/workers/chunks/7e4093f42795ba2f8cfd.js +1 -0
- package/assets/esri/core/workers/chunks/{6649acaceab00ad30e7f.js → 8ba3e0462a9bdaae5f40.js} +1 -1
- package/assets/esri/core/workers/chunks/928b18e13e015330d44b.js +1 -0
- package/assets/esri/core/workers/chunks/9434c76ad39c936dba90.js +1 -0
- package/assets/esri/core/workers/chunks/{909e67dee8c30e391d69.js → a8310f55de4749f973d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{ac16016964be3b684e98.js → aded4e704e09a28edc8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{7175f0c6a6e56b685d20.js → b419fd36337e76e2d4a3.js} +6 -6
- package/assets/esri/core/workers/chunks/{05d597dd117766beadd8.js → b91a15522692781560b4.js} +1 -1
- package/assets/esri/core/workers/chunks/c86d388d216adbb15a05.js +1 -0
- package/assets/esri/core/workers/chunks/{f1ff33584680d8718400.js → c9ce408675dae6a0edd1.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b522e05668bef729b1b.js → ceb5bd9f2afaa2ea0808.js} +1 -1
- package/assets/esri/core/workers/chunks/d07068c44d560e4ce02e.js +1 -0
- package/assets/esri/core/workers/chunks/{da47fdffb5969694a2ae.js → d41eed41916ed0422059.js} +1 -1
- package/assets/esri/core/workers/chunks/{19493c9c7e1d2ac0f80f.js → d4e0346209fabc58f929.js} +1 -1
- package/assets/esri/core/workers/chunks/{b375abfb2a2d9c63e20a.js → db90fb8ac96579259566.js} +1 -1
- package/assets/esri/core/workers/chunks/{44b30bce8e9a75b9e1b3.js → dd0acd0f8b96839b4f24.js} +2 -2
- package/assets/esri/core/workers/chunks/{5809e70a8e57e9b05959.js → dd795c95cdc3812b5b49.js} +1 -1
- package/assets/esri/core/workers/chunks/f7344d855f1092383abe.js +1 -0
- package/assets/esri/core/workers/chunks/{2dbd88566abac030e965.js → f859c53432f258af77e3.js} +2 -2
- package/assets/esri/core/workers/chunks/{ecbf84a1f42e6188faab.js → fd629872b5c07853f695.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +5 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/GaussianSplat.glsl.js +4 -4
- package/chunks/GaussianSplatShadow.glsl.js +1 -1
- package/config.d.ts +9 -2
- package/config.js +1 -1
- package/core/date.js +1 -1
- package/form/FormTemplate.d.ts +15 -20
- package/form/elements/AttachmentElement.d.ts +38 -11
- package/form/elements/Element.d.ts +9 -6
- package/form/elements/FieldElement.d.ts +0 -1
- package/form/elements/GroupElement.d.ts +4 -6
- package/form/elements/RelationshipElement.d.ts +8 -8
- package/form/elements/inputs/attachments/AttachmentInput.d.ts +34 -18
- package/form/elements/inputs/attachments/AudioInput.d.ts +4 -3
- package/form/elements/inputs/attachments/DocumentInput.d.ts +2 -6
- package/form/elements/inputs/attachments/ImageInput.d.ts +4 -3
- package/form/elements/inputs/attachments/Input.d.ts +6 -3
- package/form/elements/inputs/attachments/SignatureInput.d.ts +3 -3
- package/form/elements/inputs/attachments/VideoInput.d.ts +4 -3
- package/form/elements.d.ts +6 -12
- package/form/types.d.ts +0 -4
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -1
- package/layers/OrientedImageryLayer.d.ts +20 -2
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
- package/layers/graphics/sources/parquet/fileProviderChangedError.js +2 -0
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/orientedImagery/types.d.ts +4 -1
- package/layers/support/RasterBandInfo.js +1 -1
- package/layers/types.d.ts +1 -0
- package/package.json +3 -3
- package/rest/support/AttachmentQuery.d.ts +13 -1
- package/rest/support/AttachmentQuery.js +1 -1
- package/rest/support/OutDistance.d.ts +5 -1
- package/rest/support/PrintParameters.d.ts +2 -1
- package/rest/support/Query.d.ts +2 -0
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/SimpleMarkerSymbol.d.ts +2 -2
- package/views/2d/engine/AFeatureContainer.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/2d/layers/support/annodime/cimAnnotations.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerViewPerformanceInfo.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.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/utils/navigationUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatAtlasPages.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatHeaderTexture.js +2 -0
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js +13 -12
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatShadowRenderNode.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/shaders/OutputColorHighlightOLID.glsl.js +1 -1
- package/views/PopupView.d.ts +3 -0
- package/views/View2D.d.ts +2 -2
- package/views/layers/AnnotationFeatureLayerView.d.ts +9 -1
- package/views/layers/DimensionFeatureLayerView.d.ts +9 -1
- package/views/layers/FeatureLikeLayerView.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/types.d.ts +0 -7
- package/widgets/BatchAttributeForm.d.ts +7 -9
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +12 -2
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/compatibilityAdapters.js +2 -0
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/legacy/AddAssociationWorkflow.js +2 -0
- package/widgets/Editor/legacy/AddAssociationWorkflowData.js +2 -0
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/CreateFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/MergeFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/MergeFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/SplitFeatureWorkflow.js +2 -0
- package/widgets/Editor/legacy/SplitFeatureWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateFeatureWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateFeatureWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateRecordWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateRecordWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateWorkflowData.js +2 -0
- package/widgets/Editor/legacy/Workflow.js +2 -0
- package/widgets/Editor/legacy/workflowUtils.js +2 -0
- package/widgets/Editor/types.d.ts +12 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.d.ts +16 -12
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm.d.ts +14 -16
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +2 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.d.ts +3 -0
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/types.d.ts +20 -0
- package/widgets/FeatureTable.d.ts +14 -2
- package/widgets/FeatureTable.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
- package/widgets/OrientedImageryViewer/support/panConstraint.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/057d288d795b853295f1.js +0 -2
- package/assets/esri/core/workers/chunks/26aa8190ac439f634c5b.js +0 -1
- package/assets/esri/core/workers/chunks/3192586ec7fc73ed1165.js +0 -1
- package/assets/esri/core/workers/chunks/33866e6e6de1bab64599.js +0 -1
- package/assets/esri/core/workers/chunks/360fd810d70d21c092d9.js +0 -1
- package/assets/esri/core/workers/chunks/3e89f487c5851c954d8b.js +0 -1
- package/assets/esri/core/workers/chunks/5aa375b0c6a205134703.js +0 -1
- package/assets/esri/core/workers/chunks/5f0bc019add4aff3130c.js +0 -1
- package/assets/esri/core/workers/chunks/630ad47857de3cf726d1.js +0 -1
- package/assets/esri/core/workers/chunks/754f7ed62afc4e0a1972.js +0 -2
- package/assets/esri/core/workers/chunks/7ee76504e7fea389a1c9.js +0 -1
- package/assets/esri/core/workers/chunks/8331e04ebe0a54b04ab6.js +0 -1
- package/assets/esri/core/workers/chunks/8c64c6b8d7376a9d1c91.js +0 -1
- package/assets/esri/core/workers/chunks/c30ca771dd3f7198142b.js +0 -1
- package/assets/esri/core/workers/chunks/e5fcd8e7a4a660ef6ad6.js +0 -1
- package/assets/esri/core/workers/chunks/f47319d36f1527277923.js +0 -1
- package/assets/esri/core/workers/chunks/ff00ac01f0baaecaa890.js +0 -1
- /package/assets/esri/core/workers/chunks/{eccbddaec4be44c86f79.js.LICENSE.txt → 1040bce57ea63a6dbca4.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{057d288d795b853295f1.js.LICENSE.txt → 353c67da4b25c29360db.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{44b30bce8e9a75b9e1b3.js.LICENSE.txt → 47948c72bc01bd173c20.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{754f7ed62afc4e0a1972.js.LICENSE.txt → dd0acd0f8b96839b4f24.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{2dbd88566abac030e965.js.LICENSE.txt → f859c53432f258af77e3.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ReshapeOperation as r}from"./ReshapeOperation.js";import{InteractiveToolBase as p}from"../../../../interactive/InteractiveToolBase.js";import{sketchKeys as
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ReshapeOperation as r}from"./ReshapeOperation.js";import{InteractiveToolBase as p}from"../../../../interactive/InteractiveToolBase.js";import{sketchKeys as s}from"../../../../interactive/keybindings.js";import a from"../../../../interactive/sketch/SketchOptions.js";let h=class extends p{constructor(e){super(e),this._reshapeOperation=null,this.events=new t,this.enableZShape=!0,this.enableZVertex=!0,this.enableMoveObject=!0,this.enableDeleteVertices=!0,this.autoHideManipulators=!1,this.enableMidpoints=!0,this.enableEdgeOffset=!1,this.type="reshape-3d",this.sketchOptions=new a,this.snappingManager=null,this.automaticManipulatorSelection=!1}initialize(){const e=this._reshapeOperation=new r({tool:this});this.addHandles([e.events.on("reshape",e=>this.events.emit("reshape",e)),e.events.on("move",e=>this.events.emit("move",e)),e.events.on("vertex-add",e=>this.events.emit("vertex-add",e)),e.events.on("before-vertex-remove",e=>this.events.emit("before-vertex-remove",e)),e.events.on("vertex-remove",e=>this.events.emit("vertex-remove",e)),e.events.on("immediate-click",e=>this.events.emit("immediate-click",{...e,object:this.object})),this.view.on("pointer-down",["Shift"],e=>e.stopPropagation())]),this.finishToolCreation()}destroy(){this._reshapeOperation=o(this._reshapeOperation)}set snapToScene(e){this._reshapeOperation&&(this._reshapeOperation.snapToScene=e),this._set("snapToScene",e)}get updating(){return((this.object.updating??!1)||this._reshapeOperation?.updating||this.snappingManager?.updating)??!1}get activeTooltipInfo(){return this._reshapeOperation?.activeTooltipInfo??null}get tooltip(){return this._reshapeOperation?.tooltip??null}onManipulatorSelectionChanged(){this._reshapeOperation?.onManipulatorSelectionChanged()}clearSelection(){this._reshapeOperation?.clearSelection()}selectManipulator(e){return this._reshapeOperation?.selectManipulator(e)??!1}recordUndo(e,t){this._reshapeOperation?.recordUndo({apply:e,undo:t,accumulate:()=>!1})}get canUndo(){return this._reshapeOperation?.canUndo??!1}undo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.undo()}get canRedo(){return this._reshapeOperation?.canRedo??!1}redo(){this.snappingManager?.doneSnapping(),this._reshapeOperation?.redo()}onInputEvent(e){const t=this._reshapeOperation;if(t&&!t.enterInputModeIfAvailable(e)&&this.enableDeleteVertices&&"key-down"===e.type&&s.delete.includes(e.key)){t.removeSelectedVertices()>0&&e.stopPropagation()}}reset(){}get test(){}};e([i()],h.prototype,"_reshapeOperation",void 0),e([i({constructOnly:!0})],h.prototype,"view",void 0),e([i({constructOnly:!0})],h.prototype,"object",void 0),e([i()],h.prototype,"enableZShape",void 0),e([i()],h.prototype,"enableZVertex",void 0),e([i()],h.prototype,"enableMoveObject",void 0),e([i()],h.prototype,"enableDeleteVertices",void 0),e([i()],h.prototype,"autoHideManipulators",void 0),e([i()],h.prototype,"enableMidpoints",void 0),e([i()],h.prototype,"enableEdgeOffset",void 0),e([i()],h.prototype,"type",void 0),e([i({type:a})],h.prototype,"sketchOptions",void 0),e([i()],h.prototype,"snappingManager",void 0),e([i({value:!1})],h.prototype,"snapToScene",null),e([i()],h.prototype,"updating",null),e([i()],h.prototype,"activeTooltipInfo",null),e([i()],h.prototype,"tooltip",null),e([i()],h.prototype,"automaticManipulatorSelection",void 0),h=e([n("esri.views.3d.interactive.editingTools.reshape.ReshapeTool3D")],h);export{h as ReshapeTool3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as n,convertUnit as l}from"../../../core/units.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{fromValues as d}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as u}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/HeightModelInfo.js";import{create as p}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as f}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as g,equals as _,isGeographic as y}from"../../../geometry/support/spatialReferenceUtils.js";import w from"../../../geometry/support/WKIDUnitConversion.js";import{validateMeshData as v,makeCacheKey as b,getHeightModelInfoFromVCS as S}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as C}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as M}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as x}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as I}from"./LayerView3D.js";import{addLayerViewToWasm as T,getLyr3DWasm as H,removeLayerViewFromWasm as A}from"./Lyr3DWasm.js";import{LayerElevationProvider as P}from"./i3s/LayerElevationProvider.js";import{ElevationRange as F}from"../support/ElevationRange.js";import{projectToBoundingBox as R}from"../support/extentUtils.js";import{Obb as V}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as j,packedGaussianSizeInU32 as E,splatPageSizeInU32WithoutHeader as G,gaussiansPerSplatPage as O,elementsPerSplatPage as U,splatAtlasTextureWidth as D}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as L}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as B}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as z}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as k}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as N}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as q}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import W from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as $,isInEffectiveScaleRange as X}from"../../support/layerViewUtils.js";import{TaskPriority as Z}from"../../support/Scheduler.js";var K;const Y=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),J=3,Q=J*J,ee=255,te=(()=>{const e=new Int16Array(ee+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/ee));return e})();let ie=class extends(I(W)){static{K=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(j),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(Z.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=p();return R(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw $("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=T(this).then(e=>{this._wasmLayerId=e,this._renderNode=new N({view:this.view,layerView:this}),this.data=new L(this._renderNode,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadowRenderNode=new q({view:this.view,layerView:this}),this.fadeHelper=new B(this),this._intersectionHandler=new z(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new P({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),r(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([r(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([r(()=>this.view.qualitySettings.fadeDuration,e=>{const t=this.data;t&&(this.fadeHelper.onFadeDurationChanged(e),t.fadingTexture.updateTexture(t.textureAtlas.pageAllocator.pageCount))}),r(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),r(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return H(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return C(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new F(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return X(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!v(t))throw new Error("meshData not valid");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return Y().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)throw new Error("unexpected meshData.data format");l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),h=2.048,c=o.tileOrigin.x*h,p=o.tileOrigin.y*h,f=o.tileOrigin.z*h,m=t.desc;if(null==m.obb)throw new Error("meshData.desc.obb undefined");const g=m.obb.quaternion,_=new V(m.obb.center,m.obb.halfSize,d(...g)),y=this.view.state.isGlobal,w=y?u(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:p,z:f},invPosScale:o.invPosScale,obb:_,origin:{x:_.centerX,y:_.centerY,z:_.centerZ},isGlobal:y,ellipsoidRadius:w},S=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal);return()=>S}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,f=n.z,m=h.x,g=h.y,_=h.z,y=new Uint32Array(r),w=new Float32Array(3*r),v=new Uint32Array(r),b=new Uint32Array(r),S=new Array,C=Math.ceil(r/O);for(let F=0;F<C;F++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)throw new Error("ran out of gaussian splat memory");S.push(e);const i=r-F*O,n=Math.min(i,O),l=F*O,o=U*e;for(let t=0;t<n;t++)y[l+t]=o+t;const h=F*G;this._pageBuffer.set(s.subarray(h,h+n*E)),this._pageBuffer.set(a,G);const d=e*U,u=d%D,c=Math.floor(d/D);this.data.textureAtlas.update(u,c,this._pageBuffer),t.madeProgress()&&(t=yield)}let M=1/0,x=-1/0,I=1/0,T=-1/0,H=0,A=-1,P=0;for(let F=0;F<r;F++){const e=F*E,i=s[e],r=s[e+1],a=s[e+2],n=s[e+3],o=16383&r,h=r>>>14&16383,u=r>>>28&15|(1023&a)<<4,y=te[n>>>24],S=(a>>>10&255)+y,C=(a>>>18&255)+y,R=(a>>>26&63|(3&n)<<6)+y,V=S>0?S:0,j=C>0?C:0,G=R>0?R:0,O=V|j<<8|G<<16,U=Math.max(V,j,G),D=o*l+c,L=h*l+p,B=u*l+f;if(w[H]=D-m,w[H+1]=L-g,w[H+2]=B-_,d){const e=D*D+L*L+B*B;I=Math.min(I,e),T=Math.max(T,e)}else M=Math.min(M,B),x=Math.max(x,B);v[F]=i,b[F]=O,U>A&&(A=U),H+=3,P++,P===K.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(M=Math.sqrt(I)-u,x=Math.sqrt(T)-u);const R=this._extractGaussianSplatMbsRadiusSquared(A),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(M=Math.max(M,V.zmin),x=Math.min(x,V.zmax));const j=new F(M,x),L=new k(i,o,y,S,w,v,b,r,R,j);return this._memCache.put(`${L.handle}`,L),this._tileHandles.set(i,L),this._cacheTileMemory+=L.usedMemory,{memUsageBytes:L.usedMemory,numGaussians:r}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Q}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,r=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,r);let a=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,r):this._prepareTileFadeOut(i,s);a||=l}a?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}this._triggerFadeIns(t,s,i);const r=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(s))continue;const a=this._tileHandles.get(s);if(!a){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(r),l=0===a.lifecycleState;2!==a.lifecycleState&&(a.lifecycleState=2,l&&this._popTileFromCache(a),i.push(a)),this.fadeHelper.fadeTile(a,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(r);this.fadeHelper.fadeTile(a,1,s),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(b(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(b(e.handle),e)}destroy(){this._createRenderableAbortController.abort(),A(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode=s(this._shadowRenderNode),this._renderNode=s(this._renderNode),this._memCache.destroy(),this.data=s(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||g(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&_(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=S(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!y(t)&&t.wkid&&-1!==t.wkid&&(i=n(w.units[w[t.wkid]])),i&&(e=new c({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===f(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=l(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=M(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,C(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,a=this.data?.sortBufferMemory??0;return new x(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a)}get test(){}};e([o()],ie.prototype,"layer",void 0),e([o({readOnly:!0})],ie.prototype,"_clippingBox",null),e([o()],ie.prototype,"elevationOffset",null),e([o({readOnly:!0})],ie.prototype,"visibleAtCurrentScale",null),e([o()],ie.prototype,"fullExtentInLocalViewSpatialReference",void 0),ie=K=e([h("esri.views.3d.layers.GaussianSplatLayerView3D")],ie);const se=ie;export{se as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as n,convertUnit as l}from"../../../core/units.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{fromValues as d}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as u}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/HeightModelInfo.js";import{create as p}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as f}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as g,equals as y,isGeographic as _}from"../../../geometry/support/spatialReferenceUtils.js";import w from"../../../geometry/support/WKIDUnitConversion.js";import{validateMeshData as v,makeCacheKey as b,getHeightModelInfoFromVCS as S}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as C}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as M}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as x}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as T}from"./LayerView3D.js";import{addLayerViewToWasm as I,getLyr3DWasm as H,removeLayerViewFromWasm as A}from"./Lyr3DWasm.js";import{LayerElevationProvider as P}from"./i3s/LayerElevationProvider.js";import{ElevationRange as F}from"../support/ElevationRange.js";import{projectToBoundingBox as R}from"../support/extentUtils.js";import{Obb as V}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as j,gaussiansPerPage as E,packedGaussianSizeInU32 as G,splatAtlasTextureWidth as O}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as U}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as D}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as B}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as z}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as k}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import N from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as q,isInEffectiveScaleRange as W}from"../../support/layerViewUtils.js";import{TaskPriority as $}from"../../support/Scheduler.js";var X;const Z=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),K=3,Y=K*K,J=255,Q=(()=>{const e=new Int16Array(J+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/J));return e})();let ee=class extends(T(N)){static{X=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(j),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask($.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=p();return R(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw q("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=I(this).then(e=>{this._wasmLayerId=e,this._renderNode=new z({view:this.view,layerView:this}),this.data=new U(this._renderNode,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadowRenderNode=new k({view:this.view,layerView:this}),this.fadeHelper=new D(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new P({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),r(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([r(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([r(()=>this.view.qualitySettings.fadeDuration,e=>{const t=this.data;t&&(this.fadeHelper.onFadeDurationChanged(e),t.fadingTexture.updateTexture(t.textureAtlas.pageAllocator.pageCount))}),r(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),r(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return H(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return C(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new F(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return W(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!v(t))throw new Error("meshData not valid");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return Z().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)throw new Error("unexpected meshData.data format");l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),h=2.048,c=o.tileOrigin.x*h,p=o.tileOrigin.y*h,f=o.tileOrigin.z*h,m=t.desc;if(null==m.obb)throw new Error("meshData.desc.obb undefined");const g=m.obb.quaternion,y=new V(m.obb.center,m.obb.halfSize,d(...g)),_=this.view.state.isGlobal,w=_?u(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:p,z:f},invPosScale:o.invPosScale,obb:y,origin:{x:y.centerX,y:y.centerY,z:y.centerZ},isGlobal:_,ellipsoidRadius:w},S=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal);return()=>S}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,f=n.z,m=h.x,g=h.y,y=h.z,_=new Uint32Array(r),w=new Float32Array(3*r),v=new Uint32Array(r),b=new Uint32Array(r),S=new Array,C=Math.ceil(r/E);for(let F=0;F<C;F++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)throw new Error("ran out of gaussian splat memory");S.push(e);const i=r-F*E,n=Math.min(i,E),l=F*E,o=e*E;for(let t=0;t<n;t++)_[l+t]=o+t;const h=F*j,d=n*G;this._pageBuffer.set(s.subarray(h,h+d));const u=o%O,c=Math.floor(o/O);this.data.textureAtlas.update(u,c,this._pageBuffer),this.data.headerTexture.update(e,a),t.madeProgress()&&(t=yield)}let M=1/0,x=-1/0,T=1/0,I=-1/0,H=0,A=-1,P=0;for(let F=0;F<r;F++){const e=F*G,i=s[e],r=s[e+1],a=s[e+2],n=s[e+3],o=16383&r,h=r>>>14&16383,u=r>>>28&15|(1023&a)<<4,_=Q[n>>>24],S=(a>>>10&255)+_,C=(a>>>18&255)+_,R=(a>>>26&63|(3&n)<<6)+_,V=S>0?S:0,j=C>0?C:0,E=R>0?R:0,O=V|j<<8|E<<16,U=Math.max(V,j,E),D=o*l+c,L=h*l+p,B=u*l+f;if(w[H]=D-m,w[H+1]=L-g,w[H+2]=B-y,d){const e=D*D+L*L+B*B;T=Math.min(T,e),I=Math.max(I,e)}else M=Math.min(M,B),x=Math.max(x,B);v[F]=i,b[F]=O,U>A&&(A=U),H+=3,P++,P===X.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(M=Math.sqrt(T)-u,x=Math.sqrt(I)-u);const R=this._extractGaussianSplatMbsRadiusSquared(A),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(M=Math.max(M,V.zmin),x=Math.min(x,V.zmax));const U=new F(M,x),D=new B(i,o,_,S,w,v,b,r,R,U);return this._memCache.put(`${D.handle}`,D),this._tileHandles.set(i,D),this._cacheTileMemory+=D.usedMemory,{memUsageBytes:D.usedMemory,numGaussians:r}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Y}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,r=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,r);let a=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,r):this._prepareTileFadeOut(i,s);a||=l}a?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}this._triggerFadeIns(t,s,i);const r=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(s))continue;const a=this._tileHandles.get(s);if(!a){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(r),l=0===a.lifecycleState;2!==a.lifecycleState&&(a.lifecycleState=2,l&&this._popTileFromCache(a),i.push(a)),this.fadeHelper.fadeTile(a,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(r);this.fadeHelper.fadeTile(a,1,s),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(b(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(b(e.handle),e)}destroy(){this._createRenderableAbortController.abort(),A(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode=s(this._shadowRenderNode),this._renderNode=s(this._renderNode),this._memCache.destroy(),this.data=s(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||g(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&y(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=S(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!_(t)&&t.wkid&&-1!==t.wkid&&(i=n(w.units[w[t.wkid]])),i&&(e=new c({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===f(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=l(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=M(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,C(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.headerTextureMemory??0,r=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,n=this.data?.sortBufferMemory??0;return new x(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a,n)}get test(){}};e([o()],ee.prototype,"layer",void 0),e([o({readOnly:!0})],ee.prototype,"_clippingBox",null),e([o()],ee.prototype,"elevationOffset",null),e([o({readOnly:!0})],ee.prototype,"visibleAtCurrentScale",null),e([o()],ee.prototype,"fullExtentInLocalViewSpatialReference",void 0),ee=X=e([h("esri.views.3d.layers.GaussianSplatLayerView3D")],ee);const te=ee;export{te as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{LayerViewPerformanceInfo as e}from"./support/LayerViewPerformanceInfo.js";class r extends e{constructor(e,r,s,t,o,i,h,m,u){super(e,0,0,0,r),this.usedMemory=e,this.nodes=r,this.usedTileMemory=s,this.cachedNodes=t,this.cacheTileMemory=o,this.textureAtlasMemory=i,this.
|
|
2
|
+
import{LayerViewPerformanceInfo as e}from"./support/LayerViewPerformanceInfo.js";class r extends e{constructor(e,r,s,t,o,i,h,m,u,d){super(e,0,0,0,r),this.usedMemory=e,this.nodes=r,this.usedTileMemory=s,this.cachedNodes=t,this.cacheTileMemory=o,this.textureAtlasMemory=i,this.headerTextureMemory=h,this.orderTextureMemory=m,this.fadingTextureMemory=u,this.sortBufferMemory=d}}export{r as GaussianSplatLayerViewPerformanceInfo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as
|
|
2
|
+
import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as n}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as t}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as i,triangulateIndexedF64 as s}from"../../../../geometry/libtess.js";import{isClockwise as r}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as u,doubleSubArray as l,concatDoubleArrays as c}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as g,newIndexArray as h,concatIndexArrays as f}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as p}from"../../../../geometry/support/polygonUtils.js";const d=1e-5,a={method:"auto",projectionAxis:void 0,outlines:void 0};function m(n,t){const{hasZ:e,ccwRingsAsHoles:o,spatialReference:i}=t,s=t.axis??x(n,e,i),r=n.length,c=[],g=[],h=[],f=[],p=n.reduce((n,t)=>n+t.length,0);let d=0;const a=u(3*p);let m=0;const L=o&&n[0]&&y(n[0],e,s);for(let u=r-1;u>=0;u--){const t=n[u],i=S(t,e);if(i<3){i>1&&f.push(t);continue}const r=!!o&&y(t,e,s);if(L?!r:r)c[d++]=t;else{let n=t.length;for(let t=0;t<d;++t)n+=c[t].length;const o={index:m,pathLengths:new Array(d+1),count:n,holeIndices:new Array(d)};o.pathLengths[0]=t.length,t.length>0&&h.push({index:m,count:t.length}),m=k(t,a,m,t.length,e,L);for(let t=0;t<d;++t){const n=c[t];o.holeIndices[t]=m,o.pathLengths[t+1]=n.length,n.length>0&&h.push({index:m,count:n.length}),m=k(n,a,m,n.length,e,L)}d=0,o.count>0&&g.push(o)}}const j=m;for(const u of f)h.push({index:m,count:u.length}),m=k(u,a,m,u.length,e,L);return{positions:3*m===a.length?a:l(a,0,3*m),polygonVertexCount:j,polygons:g,outlines:h}}function x(n,t,e){if(!t)return 2;const o=n.map(n=>{const o=S(n,t);return o<3?2:p(n,o,e)}),i=o[0];return o.every(n=>n===i)?i:2}function y(n,t,e){if(!t)return!r(n);if(n.length<3)return!1;switch(e){case 0:return!r(n,1,2);case 1:return!r(n,0,2);case 2:return!r(n,0,1)}}const L=new t;function j(t,e){const o=v(t,e);if(o.succeeded)return o;return"libtess-not-loaded"===o.message?(n(L),I()):o}async function I(){try{await o(),L.notify()}catch(n){throw n}}function v(n,t){const e={method:t?.method??a.method,projectionAxis:t?.projectionAxis??a.projectionAxis,outlines:t?.outlines??a.outlines},{projectionAxis:o}=e,i=null!=o&&2!==o;i&&b(n.positions,o,2);const s=R(n,e);if(i){const t=s.succeeded?s.positions:null;null!=t&&t!==n.positions&&b(t,2,o),b(n.positions,2,o)}return s}function R(n,t){if("libtess"===t.method)return A(n,t);const o=Array();let i=0;for(const u of n.polygons){const s=O(n.positions,u),r=(u.holeIndices??[]).map(n=>n-u.index),l=r.length>0?r:null,c=e(s,l,3),g=e.deviation(s,r,3,c);if("auto"===t.method&&g>d)return A(n,t);for(let n=0;n<c.length;n++)o.push(c[n]+u.index);i=Math.max(i,g)}const{outlineIndexBuffer:s,outlineRingLengths:r}=null!=t.outlines?w(t.outlines,n.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:n.positions,indices:g(o),outlineIndexBuffer:s,outlineRingLengths:r,vertexCount:n.positions.length/3,method:"earcut",deviation:i}}function A(n,t){if(!i())return V("libtess-not-loaded");const e=null!=t.outlines,{positions:o,mergedPathLengths:r}=U(n),{vertices:u,indices:l,outlineIndices:c,outlineRingLengths:g}=s(o,r,3,e);if(u.length%3!=0)return V("positions-not-multiple-of-3");const{positions:h,outlineIndexBuffer:f,mergedOutlineRingLengths:p}=e?B(n,t.outlines,u,c,g):{positions:u,outlineIndexBuffer:void 0,mergedOutlineRingLengths:void 0};return{succeeded:!0,positions:h,indices:l,outlineIndexBuffer:f,outlineRingLengths:p,vertexCount:h.length/3,method:"libtess"}}function B(n,t,e,o,i){const s=n.polygonVertexCount,r=t?.filter(n=>n.index>=s)??[];if(0===r.length)return{positions:e,outlineIndexBuffer:o,mergedOutlineRingLengths:i};const u=3*s,g=l(n.positions,u,n.positions.length-u),h=c(e,g),p=e.length/3,d=r.map(n=>({index:p+n.index-s,count:n.count})),{outlineIndexBuffer:a,outlineRingLengths:m}=w(d,h);return{positions:h,outlineIndexBuffer:f(o,a,h.length/3),mergedOutlineRingLengths:f(i,m,i.length+m.length)}}function b(n,t,e){for(let o=0;o<n.length;o+=3){const i=n[o+t];n[o+t]=n[o+e],n[o+e]=i}}function w(n,t){const e=h(n.length);let o=0;for(let r=0;r<n.length;r++){const i=n[r],s=i.count;if(s<=0){e[r]=0;continue}const u=3*i.index,l=3*(i.index+s-1),c=s>1&&t[u]===t[l]&&t[u+1]===t[l+1]&&t[u+2]===t[l+2]?s-1:s,g=c>0?c+1:0;e[r]=g,o+=g}const i=h(o,t.length/3);let s=0;for(let r=0;r<n.length;r++){const t=e[r];if(0===t)continue;const o=n[r].index,u=t-1;for(let n=0;n<u;n++)i[s++]=o+n;i[s++]=o}return{outlineIndexBuffer:i,outlineRingLengths:e}}function C(n){const t=n.reduce((n,t)=>n+t.pathLengths.length,0),e=new Array(t);let o=0;for(let i=0;i<n.length;i++){const t=n[i].pathLengths;for(let n=0;n<t.length;n++)e[o++]=t[n]}return e}function O(n,{index:t,count:e}){return l(n,3*t,3*e)}function k(n,t,e,o,i,s){let r=s?n.length-1:0;const u=s?-1:1;e*=3;for(let l=0;l<o;++l){const o=n[r];t[e++]=o[0],t[e++]=o[1],t[e++]=i&&null!=o[2]?o[2]:0,r+=u}return e/3}function P(n,t){const e=n.length;if(e<2)return!1;const o=n[0],i=n[e-1];return o[0]===i[0]&&o[1]===i[1]&&(!t||o[2]===i[2])}function S(n,t){return P(n,t)?n.length-1:n.length}function V(n){return{succeeded:!1,message:n}}function U(n){const t=C(n.polygons),e=3*n.polygonVertexCount;return e===n.positions.length?{positions:n.positions,mergedPathLengths:t}:{positions:l(n.positions,0,e),mergedPathLengths:t}}export{x as axisFromRings,y as isCounterClockwise,I as load,m as ringsToOutlinedTessellationInfo,v as tessellate,j as tessellateOrLoad};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as m,negate as c,length as _,subtract as p,normalize as l,add as u,scale as d,dot as P}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as C,fromPositionAndNormal as b,getNormal as w}from"../../../../geometry/support/plane.js";import{Sphere as M}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as f,applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as E}from"../../input/util.js";import{InteractiveController as A}from"./InteractiveController.js";import{PanPlanarMomentumController as k}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as y}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as R}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as x}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as O}from"./momentum/ZoomSphericalMomentumController.js";import{inferNavigationMode as H,pickPointAndInitSphere as F,excludeTerrain as Y,sphereOrPlanePointFromScreenPoint as L,maxPanDistanceModifier as T,minPinchAndPanCameraHeight as D,pivotSearchAreaSize as U,intersectPlaneFromScreenPointAtEye as G,applyZoomOnSphere as I,findHorizonScreenY as V,computeHorizonDownLimitScreenY as Z,shouldClampScreenY as q,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as J,applyPanSphericalDirectRotation as K,computeHorizonUpLimitScreenY as N,normalizeRotationDelta as Q,applyRotation as W,applyPanPlanar as X,applyZoomToPoint as $,intersectsSphereAtScreenPoint as tt}from"../utils/navigationUtils.js";import it from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as et}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as nt}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as st}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as rt}from"../../../navigation/ZoomMomentumEstimator.js";let ot=class extends A{constructor(t){super(t),this.forceHorizontalPan=!1,this._smoothRotation=new E(.05),this._rotationAxis=g(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=C(),this._beginRadius=0,this._smoothScaling=new E(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new rt,this._rotationMomentumEstimator=new st,this._panSphericalMomentumEstimator=new nt,this._panPlanarMomentumEstimator=new et,this._adjustedSphere=new M,this._referenceSphere=new M,this._tmp3d=g(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=g(),this._screenPickPoint=n(),this._clampedScreenPoint=n(),this._scenePickPoint=g(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._navigationMode=1,this._sphere=new M,this._pointerCount=0,this._tmpInteractionDirection=g(),this._beginCamera=new it,this._constraintOptions=new j(15,0,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._beginAngle=t.angle,this._pointerCount=t.pointers.size,this._smoothRotation.reset(),this._referenceSphere.radius=S(this.view.spatialReference).radius,s(t.center,this._screenPickPoint),this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=H(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),a(this._screenPickPoint,this._clampScreenPointToHorizonPaddingRegion(this._screenPickPoint))),a(this._beginScreenPoint,this._screenPickPoint);const n=F(this._intersectionHelper,this.startCamera,this._screenPickPoint,this._referenceSphere.radius,1,this.view.basemapTerrain.invisible?Y:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,m(this._beginScenePoint,this._scenePickPoint),0===this._navigationMode?this._preparePlanarPanMode(t,n.hasGeometryIntersection):this._prepareSphericalPanMode(),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navigationMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navigationMode?new O({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new x({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new R({view:this.view,momentum:e,center:this._sphere.center,axis:this._rotationAxis});if(1===this._navigationMode){const t=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new y({view:this.view,momentum:t})}else{const t=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);b(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),o=g(),a=_(this.startCamera.eye);this._adjustedSphere.radius=a<this._sphere.radius?a-100:this._sphere.radius,L(this._adjustedSphere,this.startCamera,r,o);const h=g(),S=g(),v=g();p(h,this._scenePickPoint,this.currentCamera.eye);const C=_(h);l(h,h);const M=T*Math.max(Math.abs(this.view.camera.position.z),D),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,U);let z=null!=f?f:M;i&&(z=Math.min(z,C)),m(v,u(S,this.currentCamera.eye,d(S,h,z))),this._panningPlane[3]=-P(w(this._panningPlane),v),this.startCamera.center=u(S,this.startCamera.eye,d(S,this.startCamera.viewForward,z));const j=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.startCamera,j,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),I(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_initClampValues(){this._horizonScreenY=V(this.startCamera,t=>tt(this._referenceSphere,this.startCamera,this._screenPickPoint[0],t));const t=null!=this._horizonScreenY;this._panLimitFromAbove=t&&this._screenPickPoint[1]<this._horizonScreenY,this._panLimitScreenY=t?Z(this.startCamera,this._horizonScreenY):null}_prepareSphericalPanMode(){null!=this._panLimitScreenY&&q(this._screenPickPoint[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._screenPickPoint[1]=this._panLimitScreenY,L(this._sphere,this.startCamera,this._screenPickPoint,this._beginScenePoint),m(this._scenePickPoint,this._beginScenePoint)),a(this._clampedScreenPoint,this._screenPickPoint)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray),e=this._clampScreenPointToHorizonPaddingRegion(i);L(this._sphere,this.currentCamera,e,this._tmp3d),B(this._beginScenePoint,P(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(J(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(K(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._screenPickPoint,e)),z(this.view,this.currentCamera,this._constraintOptions)}_clampScreenPointToHorizonPaddingRegion(t){if(a(this._clampedScreenPoint,t),null==this._panLimitScreenY)return this._clampedScreenPoint;const i=V(this.startCamera,i=>tt(this._referenceSphere,this.currentCamera,t[0],i));return null!=i&&(this._horizonScreenY=i,this._panLimitScreenY=this._panLimitFromAbove?Z(this.currentCamera,i):N(this.currentCamera,i)),q(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panSphericalMomentumEstimator.reset()),this._clampedScreenPoint}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+Q(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*e),z(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(X(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),$(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){m(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=Q(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const r=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*r),z(this.view,this.currentCamera,this._constraintOptions)}};t([r()],ot.prototype,"forceHorizontalPan",void 0),ot=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],ot);export{ot as PinchAndPanControllerGlobal};
|
|
2
|
+
import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as m,negate as c,length as _,subtract as p,normalize as l,add as u,scale as d,dot as P}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as C,fromPositionAndNormal as b,getNormal as w}from"../../../../geometry/support/plane.js";import{Sphere as M}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as f,applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as E}from"../../input/util.js";import{InteractiveController as A}from"./InteractiveController.js";import{PanPlanarMomentumController as k}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as y}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as R}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as x}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as O}from"./momentum/ZoomSphericalMomentumController.js";import{inferNavigationMode as H,pickPointAndInitSphere as F,excludeTerrain as Y,sphereOrPlanePointFromScreenPoint as L,maxPanDistanceModifier as T,minPinchAndPanCameraHeight as D,pivotSearchAreaSize as U,intersectPlaneFromScreenPointAtEye as G,applyZoomOnSphere as I,findSphereHorizonY as V,computeHorizonDownLimitScreenY as Z,shouldClampScreenY as q,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as J,applyPanSphericalDirectRotation as K,computeHorizonUpLimitScreenY as N,normalizeRotationDelta as Q,applyRotation as W,applyPanPlanar as X,applyZoomToPoint as $}from"../utils/navigationUtils.js";import tt from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as it}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as et}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as nt}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as st}from"../../../navigation/ZoomMomentumEstimator.js";let rt=class extends A{constructor(t){super(t),this.forceHorizontalPan=!1,this._smoothRotation=new E(.05),this._rotationAxis=g(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=C(),this._beginRadius=0,this._smoothScaling=new E(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new st,this._rotationMomentumEstimator=new nt,this._panSphericalMomentumEstimator=new et,this._panPlanarMomentumEstimator=new it,this._adjustedSphere=new M,this._referenceSphere=new M,this._tmp3d=g(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=g(),this._screenPickPoint=n(),this._clampedScreenPoint=n(),this._scenePickPoint=g(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._navigationMode=1,this._sphere=new M,this._pointerCount=0,this._tmpInteractionDirection=g(),this._beginCamera=new tt,this._constraintOptions=new j(15,0,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._beginAngle=t.angle,this._pointerCount=t.pointers.size,this._smoothRotation.reset(),this._referenceSphere.radius=S(this.view.spatialReference).radius,s(t.center,this._screenPickPoint),this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=H(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),a(this._screenPickPoint,this._clampScreenPointToHorizonPaddingRegion(this._screenPickPoint))),a(this._beginScreenPoint,this._screenPickPoint);const n=F(this._intersectionHelper,this.startCamera,this._screenPickPoint,this._referenceSphere.radius,1,this.view.basemapTerrain.invisible?Y:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,m(this._beginScenePoint,this._scenePickPoint),0===this._navigationMode?this._preparePlanarPanMode(t,n.hasGeometryIntersection):this._prepareSphericalPanMode(),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navigationMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navigationMode?new O({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new x({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new R({view:this.view,momentum:e,center:this._sphere.center,axis:this._rotationAxis});if(1===this._navigationMode){const t=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new y({view:this.view,momentum:t})}else{const t=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);b(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),o=g(),a=_(this.startCamera.eye);this._adjustedSphere.radius=a<this._sphere.radius?a-100:this._sphere.radius,L(this._adjustedSphere,this.startCamera,r,o);const h=g(),S=g(),v=g();p(h,this._scenePickPoint,this.currentCamera.eye);const C=_(h);l(h,h);const M=T*Math.max(Math.abs(this.view.camera.position.z),D),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,U);let z=null!=f?f:M;i&&(z=Math.min(z,C)),m(v,u(S,this.currentCamera.eye,d(S,h,z))),this._panningPlane[3]=-P(w(this._panningPlane),v),this.startCamera.center=u(S,this.startCamera.eye,d(S,this.startCamera.viewForward,z));const j=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.startCamera,j,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),I(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_initClampValues(){this._horizonScreenY=V(this.startCamera,this._referenceSphere,this._screenPickPoint);const t=null!=this._horizonScreenY;this._panLimitFromAbove=t&&this._screenPickPoint[1]<this._horizonScreenY,this._panLimitScreenY=t?Z(this.startCamera,this._horizonScreenY):null}_prepareSphericalPanMode(){null!=this._panLimitScreenY&&q(this._screenPickPoint[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._screenPickPoint[1]=this._panLimitScreenY,L(this._sphere,this.startCamera,this._screenPickPoint,this._beginScenePoint),m(this._scenePickPoint,this._beginScenePoint)),a(this._clampedScreenPoint,this._screenPickPoint)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray),e=this._clampScreenPointToHorizonPaddingRegion(i);L(this._sphere,this.currentCamera,e,this._tmp3d),B(this._beginScenePoint,P(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(J(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(K(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._screenPickPoint,e)),z(this.view,this.currentCamera,this._constraintOptions)}_clampScreenPointToHorizonPaddingRegion(t){if(a(this._clampedScreenPoint,t),null==this._panLimitScreenY)return this._clampedScreenPoint;const i=V(this.currentCamera,this._referenceSphere,t);return null!=i&&(this._horizonScreenY=i,this._panLimitScreenY=this._panLimitFromAbove?Z(this.currentCamera,i):N(this.currentCamera,i)),q(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panSphericalMomentumEstimator.reset()),this._clampedScreenPoint}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+Q(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*e),z(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(X(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),$(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){m(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=Q(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const r=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*r),z(this.view,this.currentCamera,this._constraintOptions)}};t([r()],rt.prototype,"forceHorizontalPan",void 0),rt=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],rt);export{rt as PinchAndPanControllerGlobal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as a,copy as m,dot as h,subtract as l,length as c,normalize as _,scale as p,add as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as v,fromNormalAndOffset as b,setOffsetFromPoint as S,negate as M,getNormal as w}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as
|
|
2
|
+
import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as a,copy as m,dot as h,subtract as l,length as c,normalize as _,scale as p,add as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as v,fromNormalAndOffset as b,setOffsetFromPoint as S,negate as M,getNormal as w}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as z,applyAll as P}from"../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as V}from"../../input/util.js";import{getVoxelWasm as H}from"../../layers/VoxelWasm.js";import{InteractiveController as E}from"./InteractiveController.js";import{PanPlanarMomentumController as j}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as F}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as y}from"./momentum/ZoomPlanarMomentumController.js";import{inferNavigationMode as Y,excludeTerrain as x,getTiltScaleFactor as L,maxPanDistanceModifier as A,minPinchAndPanCameraHeight as O,pivotSearchAreaSize as R,centroid as T,applyZoomToPoint as U,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as Z,intersectPlaneFromScreenPointAtEye as k,findPlaneHorizonY as G,computeHorizonDownLimitScreenY as W,computeHorizonUpLimitScreenY as q,shouldClampScreenY as B}from"../utils/navigationUtils.js";import J from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as K}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as N}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as Q}from"../../../navigation/ZoomMomentumEstimator.js";const X=g(0,0,1);let $=class extends E{constructor(t){super(t),this.forceHorizontalPan=!1,this._rotationValueSmooth=new V(.05),this._scalingValueSmooth=new V(.05),this._planeHorizontal=v(),this._planeVertical=v(),this._rotationMomentumEstimator=new N,this._panMomentumEstimator=new K(300,12,.9),this._zoomMomentumEstimator=new Q,this._beginRadius=0,this._beginCenter=d(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=i(),this._tmpCentroid3d=d(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._clampedScreenPoint=i(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._pointerCount=0,this._beginCamera=new J,this._constraintOptions=new f(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),b(X,0,this._planeHorizontal);const n=d();a(n,this.startCamera.viewForward);const o=d();m(o,X);const r=h(n,o);this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=Y(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),s(this._beginCenterScreen,this._clampScreenPointToHorizonPaddingRegion(this._beginCenterScreen)));const g=d(),C=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,g,this.view.basemapTerrain.invisible?x:{}),v=L(o,this.startCamera.viewForward,A)*Math.max(Math.abs(this.view.camera.position.z),O);S(this._planeHorizontal,this._planeHorizontal,g),this.startCamera.aboveGround||M(this._planeHorizontal,this._planeHorizontal);const z=d(),P=d(),f=d();l(z,g,this.currentCamera.eye);const V=c(z);if(_(z,z),0===this._navigationMode){p(o,o,r),l(w(this._planeVertical),n,o),_(w(this._planeVertical),w(this._planeVertical)),S(this._planeVertical,this._planeVertical,g);const i=this.view.stage.renderView.getMinimalDepthForArea(H(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,R);let e=null!=i?i:v;C&&(e=Math.min(e,V)),m(f,u(P,this.currentCamera.eye,p(P,z,e))),this._planeVertical[3]=-h(w(this._planeVertical),f),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}else{const i=C?V:v;m(f,u(P,this.currentCamera.eye,p(P,z,i))),this._planeHorizontal[3]=-h(w(this._planeHorizontal),f),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=1===this._navigationMode?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),U(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=z(Math.abs(t.radius-this._beginRadius)),P(this.view,this.currentCamera,this._constraintOptions)}this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),T(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d);const s=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(this._tmpCentroid2d):this._tmpCentroid2d;if(D(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(s,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=z(r(this._beginCenterScreen,s)),P(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const r=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp);const a=w(this._planeHorizontal);Z(this.currentCamera,i,C(a,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=z(Math.abs(t.radius*r)),P(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return new y({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new F({view:this.view,momentum:e,center:this._beginCenter,axis:w(this._planeHorizontal)});const n=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return n?new j({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach(t=>{o[0]=t.x,o[1]=t.y;const r=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(o):o;void 0===n[s]&&(n[s]=d()),k(i,e,r,n[s]),s+=1}),n}_initClampValues(){this._horizonScreenY=G(this.startCamera,this._planeHorizontal),this._panLimitFromAbove=this._beginCenterScreen[1]<this._horizonScreenY,this._panLimitScreenY=this._panLimitFromAbove?W(this.startCamera,this._horizonScreenY):q(this.startCamera,this._horizonScreenY)}_clampScreenPointToHorizonPaddingRegion(t){return s(this._clampedScreenPoint,t),null==this._panLimitScreenY||(this._horizonScreenY=G(this.currentCamera,this._planeHorizontal),this._panLimitScreenY=this._panLimitFromAbove?W(this.currentCamera,this._horizonScreenY):q(this.currentCamera,this._horizonScreenY),B(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panMomentumEstimator.reset())),this._clampedScreenPoint}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};t([n()],$.prototype,"forceHorizontalPan",void 0),$=t([o("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],$);export{$ as PinchAndPanControllerLocal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as r,asinClamped as o}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as a,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as u,create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{length as h,dot as M,subtract as g,normalize as y,squaredDistance as d,copy as b,transformMat4 as x,add as j,distance as v,cross as P,scale as z,lerp as w,set as I}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,axis as H,fromPoints as S,wrapAxisAngle as T}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as U,vectorCoordinates as G}from"../../../../geometry/support/coordinateSystem.js";import{create as k,fromNormalAndOffset as E,intersectRay as q}from"../../../../geometry/support/plane.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{sm4d as F,sv3d as O}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as W,fromScreen as B}from"../../support/geometryUtils/ray.js";import{intersectScreen as D}from"../../support/geometryUtils/sphere.js";import J from"../../webgl/RenderCamera.js";import{terrainId as K}from"../../webgl-engine/lib/verticalOffsetUtils.js";const L=30,N=[1,3e8],Q=8,V=[200,1508e5],X=5,Y=50,Z=5,$=10,_=80,tt=90,et=1e-6,nt={exclude:new Set([K])};function rt(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ot(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function it(t,e,n){const r=a(F.get(),n[3],H(n));null==r||s(r,u)||(g(fe,t.eye,e),x(fe,fe,r),t.eye=j(fe,fe,e),g(fe,t.center,e),x(fe,fe,r),t.center=j(fe,fe,e),t.up=x(fe,t.up,r))}function at(t,e,n,r){return q(t,B(e,n,de),r)}function st(t,e,n,r){return q(t,W(e,n,de),r)}function ct(t,e,n,r){const o=O.get();let i=1-n;g(o,e,t.eye);const a=h(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<et||(z(o,o,i),t.eye=j(fe,t.eye,o),t.center=w(fe,t.center,e,i))}function lt(t,e,n){e.getScreenCenter(ut),D(t,e,ut,fe)&&(e.center=fe);const r=e.distance,o=r*n;if(Math.abs(r-o)<et)return;const i=z(O.get(),e.viewForward,o);e.eye=g(fe,e.center,i)}const ut=i();function mt(t,e){I(e,0,0,0);for(const n of t)j(e,e,n);z(e,e,1/t.length)}function ft(t,e,n,r){return Math.sin(t/h(e))*(n+r.radius)}function pt(t,e,n,r){return ft(Math.PI/2,e,n,r)+(t-Math.PI/2)}const ht={Elevation:3e4,Angle:e(16)},Mt=.05,gt=12,yt=12,dt=e(80);function bt(t,e,n,r,o,i){const a=R(),s=new C;let c=!0,l=!0;const{eye:u}=e;return t.intersectScreen(n,a,i)&&Zt(u,a,r)?s.radius=h(a):(l=!1,e.aboveGround&&0!==o?s.radius=Math.max(h(e.center),.9*r):s.radius=h(e.eye)-e.relativeElevation,1===o?Pt(s,e,n,a):c=D(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:l}}function xt(t,e,n,r){const o=t.relativeElevation;if(o>ht.Elevation&&"global"===r)return 1;W(t,e,be);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,fe);return-i*M(a,be.direction)<Math.sin(ht.Angle)*h(be.direction)?0:1}function jt(t,e,n){g(vt,n,e),t.eye=g(fe,t.eye,vt),t.center=g(fe,t.center,vt)}const vt=R();function Pt(t,e,n,r){const o=W(e,n,de);return null!=o&&(t.closestPointOnSilhouette(o,zt),t.intersectRay(o,r)?!(d(zt,o.origin)<d(r,o.origin))||(b(r,zt),!1):(g(wt,e.eye,e.center),y(wt,wt),E(wt,-M(y(wt,wt),zt),It),q(It,o,r),!1))}const zt=R(),wt=R(),It=k();function Rt(t,e){const n=t.fullHeight/t.pixelRatio,r=e(0),o=e(n);if(r||!o)return null;let i=0,a=n;for(let s=0;s<yt;s++){const t=.5*(i+a);e(t)?a=t:i=t}return a}function At(t,e,n){return e?t>n:t<n}function Ht(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(gt,Mt*r)}function St(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+Ht(t,e))}function Tt(t,e){return Math.max(0,e-Ht(t,e))}function Ut(t,e,n,r){return xe[0]=n,xe[1]=r,t.intersectRay(W(e,xe,de),fe)}function Gt(t,e,n,r){return xe[0]=n,xe[1]=r,q(t,W(e,xe,de),fe)}function kt(i,a,s,c,l,u){let m=0;if(P(Me,i,a),g(pe,i,a),h(i)<=l||!c.aboveGround){P(s,pe,c.eye);const f=M(i,a)/(h(i)*h(a));if(f<.9999)m=r(f);else{const t=h(P(R(),i,a))/(h(i)*h(a));m=o(t)}const p=Math.cos(n(t.normalize(e(u)),0,dt));m=-m-Math.max(0,h(a)-l)/(p*l)}else g(Et,c.eye,c.center),P(s,pe,Et),m=-h(pe)/l;return y(s,s),z(s,s,h(Me)),m}const Et=R();function qt(o,i,a,s){let c,l;const u=Math.cos(n(t.normalize(e(s)),0,dt));return c=i>a?-(i-a)/(u*a):i<-a?Math.PI-(i+a)/(u*a):r(i/a),l=o>a?-(o-a)/(u*a):o<-a?Math.PI-(o+a)/(u*a):r(o/a),(l-c)*a}function Ct(t,e,n,r,o,i,a,s,c,l){const u=qt(t[2],e[2],i.radius,s),m=c?qt(t[0],e[0],i.radius,180):e[0]-t[0],p=Math.sin(a)*m-Math.cos(a)*u,h=Math.cos(a)*m+Math.sin(a)*u;y(fe,o);const g=c?p/Math.sqrt(Math.abs(i.radius**2-M(n,fe)**2)):p/i.radius,d=h/Math.sqrt(Math.abs(i.radius**2-M(n,r)**2));f(l,g,d)}function Ft(t,e,n,r,o,i,a,s,c,l){P(Me,t,e),U(i.up,i.eye,ee,ne,re),U([0,0,1],i.eye,$t,_t,te),b(n,_t),b(r,$t),y(n,n),z(n,n,h(Me)),G(t,y(ne,ne),y(re,re),y(ee,ee),oe),G(e,ne,re,ee,ie),Ct(oe,ie,t,$t,_t,a,s,c,l,o)}function Ot(t,e,n,r,o,i,s){a(ce,o,r),a(le,s,i),l(ue,ce,le),g(e,t,n),x(e,e,ue),j(e,e,n)}function Wt(t,e,n,r,o,i){a(ce,r,n),a(le,i,o),l(ue,ce,le),g(fe,t.eye,e),x(fe,fe,ue),t.eye=j(fe,fe,e),g(fe,t.center,e),x(fe,fe,ue),t.center=j(fe,fe,e),g(fe,t.up,e),x(fe,fe,ue),t.up=j(fe,fe,e)}const Bt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let Dt=!1;function Jt(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-Bt.Angle||Math.abs(r)<Bt.Angle,s=(Math.abs(t[2])<n*Bt.Pole||Math.abs(e)>n)&&i;return a&&s?!Dt&&o<Bt.Tilt-Bt.TiltHysteresisMargin?Dt=!0:Dt&&o>Bt.Tilt+Bt.TiltHysteresisMargin&&(Dt=!1):Dt=!1,Dt}function Kt(t,e,n,r,o,i){if(i)S(n,r,se),it(e,t.center,se);else{const i=kt(n,r,ge,e,t.radius,o);it(e,t.center,T(ge,i))}}function Lt(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let l,u;b(me,r),he.copyFrom(e);for(let m=0;m<s&&d(n,me)>c&&(l=d(n,me),Ft(n,me,_t,$t,ae,he,t,o,i,a),Wt(he,t.center,$t,ae[1],_t,ae[0]),Ot(me,me,t.center,$t,ae[1],_t,ae[0]),u=d(n,me),u<l||0===m);m++)e.copyFrom(he)}function Nt(n,r,o,i,a,s,c){Jt(o,M(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?Lt(n,r,o,i,-t.normalize(e(a)),s,c):Kt(n,r,o,i,s,c)}function Qt(t,e,n,r,o,i){const{eye:a}=t;U([0,0,1],a,$t,_t,te);const s=e.translation[0]*n.pan,l="zoom"===o.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-M(t.center,$t)**2/h(t.center)**2)),.5),m=(Math.sin(i)*l+Math.cos(i)*s)/u,f=-Math.cos(i)*l+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,$t),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,f,_t),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function Vt(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(O.get(),a,i),l=e.translation[0]*n.pan;switch(0!==l&&(c(r.pan.matrix,r.pan.matrix,-l,s),r.pan.enabled=!0),o.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(r.pan.matrix,r.pan.matrix,t,a),r.pan.enabled=!0);break}case"zoom":r.zoom=-e.translation[1]*n.zoom}}function Xt(n,r,o,i,a,s,c,l,u){Jt(n.center,M(n.up,n.center),h(n.center),-t.normalize(e(s)),c,r.aboveGround)?Qt(r,o,i,l,u,-t.normalize(e(a))):Vt(r,o,i,l,u)}function Yt(t,e,n=1/0){const r=Math.abs(M(t,e));return Math.min(n,1/r)}function Zt(t,e,n){const r=v(t,e),o=h(t);return r<Math.max(o,n)}const $t=R(),_t=R(),te=R(),ee=R(),ne=R(),re=R(),oe=R(),ie=R(),ae=p(),se=A(),ce=m(),le=m(),ue=m(),me=R(),fe=R(),pe=R();let he=new J;const Me=R(),ge=R();function ye(){he=new J}const de={origin:R(),direction:R()},be={origin:R(),direction:R()},xe=i();export{dt as TiltThresholdPanningSpeed,ht as VerticalPanTresholds,jt as applyPanPlanar,Kt as applyPanSphericalDirectRotation,Lt as applyPanSphericalPreserveHeading,it as applyRotation,Wt as applyRotationWithTwoAxes,lt as applyZoomOnSphere,ct as applyZoomToPoint,mt as centroid,ye as cleanupNavigationUtils,Tt as computeHorizonDownLimitScreenY,Ht as computeHorizonPadding,St as computeHorizonUpLimitScreenY,et as distanceComparisonTolerance,nt as excludeTerrain,Rt as findHorizonScreenY,Yt as getTiltScaleFactor,xt as inferNavigationMode,at as intersectPlaneFromScreenPoint,st as intersectPlaneFromScreenPointAtEye,Gt as intersectsPlaneAtScreenPoint,Ut as intersectsSphereAtScreenPoint,Zt as isHitOnSamePlanetSide,qt as lengthFromPoints,X as maxPanDistanceModifier,Z as maxRotatePivotDistanceModifier,L as maxZoomPivotDistanceModifier,Q as maxZoomStepDistanceModifier,Y as minPinchAndPanCameraHeight,$ as minRotatePivotDistance,rt as normalizeCoordinate,ot as normalizeRotationDelta,pt as offSurfaceTiltToEyeTiltGlobal,ft as onSurfaceTiltToEyeTiltGlobal,Xt as panMotionToRotationMatrix,Nt as panToPosition,bt as pickPointAndInitSphere,_ as pivotSearchAreaSize,Bt as preservingHeadingThresholds,Mt as relativeHorizonPanPadding,tt as rotatePivotSearchAreaSize,Ot as rotatePointAroundTwoAxes,kt as rotationAngleAndAxisDirectRotation,Ft as rotationAnglesAndAxesHeadingPreserving,Ct as rotationAnglesHeadingPreserving,At as shouldClampScreenY,Jt as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,N as zoomPivotDistanceClamp,V as zoomStepDistanceClamp};
|
|
2
|
+
import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as r,asinClamped as o}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as a,exactEquals as s,rotate as c,multiply as u}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as l,create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{length as h,dot as M,subtract as g,normalize as y,squaredDistance as d,copy as b,transformMat4 as x,add as j,distance as v,cross as P,scale as w,lerp as z,crossAndNormalize as I,scaleAndAdd as S,set as T}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,axis as q,fromPoints as H,wrapAxisAngle as U}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as G,vectorCoordinates as k}from"../../../../geometry/support/coordinateSystem.js";import{create as E,fromNormalAndOffset as F,intersectRay as C,fromPositionAndNormal as O,distance as W,projectPoint as B,projectVector as D}from"../../../../geometry/support/plane.js";import{create as J}from"../../../../geometry/support/ray.js";import{Sphere as K}from"../../../../geometry/support/sphere.js";import{sm4d as L,sv3d as N}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as Q,fromScreen as V}from"../../support/geometryUtils/ray.js";import{intersectScreen as X}from"../../support/geometryUtils/sphere.js";import Y from"../../webgl/RenderCamera.js";import{terrainId as Z}from"../../webgl-engine/lib/verticalOffsetUtils.js";const $=30,_=[1,3e8],tt=8,et=[200,1508e5],nt=5,rt=50,ot=5,it=10,at=80,st=90,ct=1e-6,ut={exclude:new Set([Z])};function lt(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function mt(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ft(t,e,n){const r=a(L.get(),n[3],q(n));null==r||s(r,l)||(g(ke,t.eye,e),x(ke,ke,r),t.eye=j(ke,ke,e),g(ke,t.center,e),x(ke,ke,r),t.center=j(ke,ke,e),t.up=x(ke,t.up,r))}function pt(t,e,n,r){return C(t,V(e,n,Be),r)}function ht(t,e,n,r){return C(t,Q(e,n,Be),r)}function Mt(t,e,n,r){const o=N.get();let i=1-n;g(o,e,t.eye);const a=h(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<ct||(w(o,o,i),t.eye=j(ke,t.eye,o),t.center=z(ke,t.center,e,i))}function gt(t,e,n){e.getScreenCenter(yt),X(t,e,yt,ke)&&(e.center=ke);const r=e.distance,o=r*n;if(Math.abs(r-o)<ct)return;const i=w(N.get(),e.viewForward,o);e.eye=g(ke,e.center,i)}const yt=i();function dt(t,e){T(e,0,0,0);for(const n of t)j(e,e,n);w(e,e,1/t.length)}function bt(t,e,n,r){return Math.sin(t/h(e))*(n+r.radius)}function xt(t,e,n,r){return bt(Math.PI/2,e,n,r)+(t-Math.PI/2)}const jt={Elevation:3e4,Angle:e(16)},vt=e(80);function Pt(t,e,n,r,o,i){const a=R(),s=new K;let c=!0,u=!0;const{eye:l}=e;return t.intersectScreen(n,a,i)&&xe(l,a,r)?s.radius=h(a):(u=!1,e.aboveGround&&0!==o?s.radius=Math.max(h(e.center),.9*r):s.radius=h(e.eye)-e.relativeElevation,1===o?St(s,e,n,a):c=X(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:u}}function wt(t,e,n,r){const o=t.relativeElevation;if(o>jt.Elevation&&"global"===r)return 1;Q(t,e,De);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,ke);return-i*M(a,De.direction)<Math.sin(jt.Angle)*h(De.direction)?0:1}function zt(t,e,n){g(It,n,e),t.eye=g(ke,t.eye,It),t.center=g(ke,t.center,It)}const It=R();function St(t,e,n,r){const o=Q(e,n,Be);return null!=o&&(t.closestPointOnSilhouette(o,Tt),t.intersectRay(o,r)?!(d(Tt,o.origin)<d(r,o.origin))||(b(r,Tt),!1):(g(Rt,e.eye,e.center),y(Rt,Rt),F(Rt,-M(y(Rt,Rt),Tt),At),C(At,o,r),!1))}const Tt=R(),Rt=R(),At=E(),qt=R(),Ht=R(),Ut=i();function Gt(t,e){return D(e,t.viewForward,qt),j(Ht,t.eye,qt),t.projectToScreen(Ht,Ut),Ut[1]}const kt=R(),Et=E(),Ft=R(),Ct=R(),Ot=R(),Wt=R(),Bt=R(),Dt=R(),Jt=R(),Kt=R(),Lt=i(),Nt=i(),Qt=J();function Vt(t,e,n){const r=t.eye;if(v(e.center,r)<e.radius)return null;const o=t.up;Q(t,n,Qt);const i=e.radius;if(I(kt,o,Qt.direction),O(r,kt,Et),W(Et,e.center)>i)return null;B(Et,e.center,Ft);const a=v(e.center,Ft),s=Math.sqrt(i**2-a**2);g(Ct,r,Ft),y(Ot,Ct),I(Wt,kt,Ot);const c=M(Ct,Ot),u=M(Ct,Wt),l=Math.sqrt(c**2+u**2),m=s**2/l**2,f=s/l**2*Math.sqrt(l**2-s**2),p=m*c,h=f*-u,d=m*u,b=f*c,x=p-h,P=d+b,z=d-b;return j(Bt,Ft,S(Bt,w(Bt,Ot,p+h),Wt,P)),j(Dt,Ft,S(Dt,w(Dt,Ot,x),Wt,z)),g(Jt,Bt,r),g(Kt,Dt,r),t.projectToScreen(Bt,Lt),t.projectToScreen(Dt,Nt),Math.min(Lt[1],Nt[1])}function Xt(t,e,n){return e?t>n:t<n}const Yt=.05,Zt=12;function $t(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(Zt,Yt*r)}function _t(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+$t(t,e))}function te(t,e){return Math.max(0,e-$t(t,e))}function ee(t,e,n,r){return Je[0]=n,Je[1]=r,t.intersectRay(Q(e,Je,Be),ke)}function ne(t,e,n,r){return Je[0]=n,Je[1]=r,C(t,Q(e,Je,Be),ke)}function re(i,a,s,c,u,l){let m=0;if(P(Ce,i,a),g(Ee,i,a),h(i)<=u||!c.aboveGround){P(s,Ee,c.eye);const f=M(i,a)/(h(i)*h(a));if(f<.9999)m=r(f);else{const t=h(P(R(),i,a))/(h(i)*h(a));m=o(t)}const p=Math.cos(n(t.normalize(e(l)),0,vt));m=-m-Math.max(0,h(a)-u)/(p*u)}else g(oe,c.eye,c.center),P(s,Ee,oe),m=-h(Ee)/u;return y(s,s),w(s,s,h(Ce)),m}const oe=R();function ie(o,i,a,s){let c,u;const l=Math.cos(n(t.normalize(e(s)),0,vt));return c=i>a?-(i-a)/(l*a):i<-a?Math.PI-(i+a)/(l*a):r(i/a),u=o>a?-(o-a)/(l*a):o<-a?Math.PI-(o+a)/(l*a):r(o/a),(u-c)*a}function ae(t,e,n,r,o,i,a,s,c,u){const l=ie(t[2],e[2],i.radius,s),m=c?ie(t[0],e[0],i.radius,180):e[0]-t[0],p=Math.sin(a)*m-Math.cos(a)*l,h=Math.cos(a)*m+Math.sin(a)*l;y(ke,o);const g=c?p/Math.sqrt(Math.abs(i.radius**2-M(n,ke)**2)):p/i.radius,d=h/Math.sqrt(Math.abs(i.radius**2-M(n,r)**2));f(u,g,d)}function se(t,e,n,r,o,i,a,s,c,u){P(Ce,t,e),G(i.up,i.eye,we,ze,Ie),G([0,0,1],i.eye,je,ve,Pe),b(n,ve),b(r,je),y(n,n),w(n,n,h(Ce)),k(t,y(ze,ze),y(Ie,Ie),y(we,we),Se),k(e,ze,Ie,we,Te),ae(Se,Te,t,je,ve,a,s,c,u,o)}function ce(t,e,n,r,o,i,s){a(qe,o,r),a(He,s,i),u(Ue,qe,He),g(e,t,n),x(e,e,Ue),j(e,e,n)}function ue(t,e,n,r,o,i){a(qe,r,n),a(He,i,o),u(Ue,qe,He),g(ke,t.eye,e),x(ke,ke,Ue),t.eye=j(ke,ke,e),g(ke,t.center,e),x(ke,ke,Ue),t.center=j(ke,ke,e),g(ke,t.up,e),x(ke,ke,Ue),t.up=j(ke,ke,e)}const le={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let me=!1;function fe(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-le.Angle||Math.abs(r)<le.Angle,s=(Math.abs(t[2])<n*le.Pole||Math.abs(e)>n)&&i;return a&&s?!me&&o<le.Tilt-le.TiltHysteresisMargin?me=!0:me&&o>le.Tilt+le.TiltHysteresisMargin&&(me=!1):me=!1,me}function pe(t,e,n,r,o,i){if(i)H(n,r,Ae),ft(e,t.center,Ae);else{const i=re(n,r,Oe,e,t.radius,o);ft(e,t.center,U(Oe,i))}}function he(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let u,l;b(Ge,r),Fe.copyFrom(e);for(let m=0;m<s&&d(n,Ge)>c&&(u=d(n,Ge),se(n,Ge,ve,je,Re,Fe,t,o,i,a),ue(Fe,t.center,je,Re[1],ve,Re[0]),ce(Ge,Ge,t.center,je,Re[1],ve,Re[0]),l=d(n,Ge),l<u||0===m);m++)e.copyFrom(Fe)}function Me(n,r,o,i,a,s,c){fe(o,M(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?he(n,r,o,i,-t.normalize(e(a)),s,c):pe(n,r,o,i,s,c)}function ge(t,e,n,r,o,i){const{eye:a}=t;G([0,0,1],a,je,ve,Pe);const s=e.translation[0]*n.pan,u="zoom"===o.mode?0:e.translation[1]*n.pan,l=Math.max(Math.sqrt(Math.abs(1-M(t.center,je)**2/h(t.center)**2)),.5),m=(Math.sin(i)*u+Math.cos(i)*s)/l,f=-Math.cos(i)*u+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,je),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,f,ve),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function ye(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(N.get(),a,i),u=e.translation[0]*n.pan;switch(0!==u&&(c(r.pan.matrix,r.pan.matrix,-u,s),r.pan.enabled=!0),o.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(r.pan.matrix,r.pan.matrix,t,a),r.pan.enabled=!0);break}case"zoom":r.zoom=-e.translation[1]*n.zoom}}function de(n,r,o,i,a,s,c,u,l){fe(n.center,M(n.up,n.center),h(n.center),-t.normalize(e(s)),c,r.aboveGround)?ge(r,o,i,u,l,-t.normalize(e(a))):ye(r,o,i,u,l)}function be(t,e,n=1/0){const r=Math.abs(M(t,e));return Math.min(n,1/r)}function xe(t,e,n){const r=v(t,e),o=h(t);return r<Math.max(o,n)}const je=R(),ve=R(),Pe=R(),we=R(),ze=R(),Ie=R(),Se=R(),Te=R(),Re=p(),Ae=A(),qe=m(),He=m(),Ue=m(),Ge=R(),ke=R(),Ee=R();let Fe=new Y;const Ce=R(),Oe=R();function We(){Fe=new Y}const Be={origin:R(),direction:R()},De={origin:R(),direction:R()},Je=i();export{vt as TiltThresholdPanningSpeed,jt as VerticalPanTresholds,zt as applyPanPlanar,pe as applyPanSphericalDirectRotation,he as applyPanSphericalPreserveHeading,ft as applyRotation,ue as applyRotationWithTwoAxes,gt as applyZoomOnSphere,Mt as applyZoomToPoint,dt as centroid,We as cleanupNavigationUtils,te as computeHorizonDownLimitScreenY,$t as computeHorizonPadding,_t as computeHorizonUpLimitScreenY,ct as distanceComparisonTolerance,ut as excludeTerrain,Gt as findPlaneHorizonY,Vt as findSphereHorizonY,be as getTiltScaleFactor,wt as inferNavigationMode,pt as intersectPlaneFromScreenPoint,ht as intersectPlaneFromScreenPointAtEye,ne as intersectsPlaneAtScreenPoint,ee as intersectsSphereAtScreenPoint,xe as isHitOnSamePlanetSide,ie as lengthFromPoints,nt as maxPanDistanceModifier,ot as maxRotatePivotDistanceModifier,$ as maxZoomPivotDistanceModifier,tt as maxZoomStepDistanceModifier,rt as minPinchAndPanCameraHeight,it as minRotatePivotDistance,lt as normalizeCoordinate,mt as normalizeRotationDelta,xt as offSurfaceTiltToEyeTiltGlobal,bt as onSurfaceTiltToEyeTiltGlobal,de as panMotionToRotationMatrix,Me as panToPosition,Pt as pickPointAndInitSphere,at as pivotSearchAreaSize,le as preservingHeadingThresholds,Yt as relativeHorizonPanPadding,st as rotatePivotSearchAreaSize,ce as rotatePointAroundTwoAxes,re as rotationAngleAndAxisDirectRotation,se as rotationAnglesAndAxesHeadingPreserving,ae as rotationAnglesHeadingPreserving,Xt as shouldClampScreenY,fe as shouldPreserveHeading,St as sphereOrPlanePointFromScreenPoint,_ as zoomPivotDistanceClamp,et as zoomStepDistanceClamp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const t=4096,s=64,e=
|
|
2
|
+
const t=4096,s=64,e=1024,i=t*s/e,n=4,r=e*n,o=t*s;class h{constructor(t=i){this._pageCount=t;const s=Math.ceil(t/32);this._bitset=new Uint32Array(s)}get pageCount(){return this._pageCount}isAllocated(t){const s=t/32|0,e=t%32;return!!(this._bitset[s]&1<<e)}allocate(t){const s=t/32|0,e=t%32;this._bitset[s]|=1<<e}free(t){const s=t/32|0,e=t%32;this._bitset[s]&=~(1<<e)}findFirstFreePage(){for(let t=0;t<this._bitset.length;t++)if(4294967295!==this._bitset[t])for(let s=0;s<32;s++){const e=32*t+s;if(e>=this._pageCount)break;if(!(this._bitset[t]&1<<s))return e}return null}resize(t){this._pageCount=t;const s=Math.ceil(t/32),e=this._bitset.length;if(s!==e){const t=new Uint32Array(s),i=Math.min(e,s);t.set(this._bitset.subarray(0,i)),this._bitset=t}this._clearExcessBits(this._bitset,t)}_clearExcessBits(t,s){const e=Math.floor((s-1)/32),i=(s-1)%32;if(s>0&&i<31){const s=(1<<i+1)-1;t[e]&=s}e+1<t.length&&t.fill(0,e+1)}}export{h as GaussianSplatAtlasPages,e as gaussiansPerPage,s as initialSplatAtlasTextureHeight,i as initialSplatAtlasTexturePages,o as minExpectedGaussianCount,n as packedGaussianSizeInU32,t as splatAtlasTextureWidth,r as splatPageSizeInU32};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as o,now as a}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as T}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as b}from"./GaussianSplatTextureAtlas.js";import{DepthRange as S}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as y}from"../../../support/Scheduler.js";class C{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new S,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=o(-1/0),this._sortInterval=o(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new T(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._textureAtlas=new b(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new m(f(i)),this._frameTask=i.scheduler.registerTask(y.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],o=s[1],a=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-o)+d*(e.obbCenterZ-a),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const e=a()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=a(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._sortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas();const o=this._renderer.camera;h(this._cameraDirectionNormalized,o.ray.direction);const a=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=o,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],C=g[3],x=g[4],V=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:o,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:v}=s,A=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*v;e=b[0]*o+b[1]*h+b[2]*g+b[3]<t&&S[0]*o+S[1]*h+S[2]*g+S[3]<t&&y[0]*o+y[1]*h+y[2]*g+y[3]<t&&C[0]*o+C[1]*h+C[2]*g+C[3]<t&&x[0]*o+x[1]*h+x[2]*g+x[3]<t&&V[0]*o+V[1]*h+V[2]*g+V[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=a*o+n*h+l*g,G=u+A;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],o=r[t+2];_[e]=s*a+i*n+o*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const v={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},A=await(this._workerHandle?.sort(v,e));if(e.aborted)return;A&&(this._distancesBuffer=A.distances,this._atlasIndicesBuffer=A.atlasIndices,this._sortedAtlasIndicesBuffer=A.sortedAtlasIndices);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
|
|
2
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{estimateNumberArrayMemory as s}from"../../../../core/memoryEstimations.js";import{isAbortError as i}from"../../../../core/promiseUtils.js";import{signal as r}from"../../../../core/signal.js";import{Milliseconds as a,now as o}from"../../../../core/time.js";import{exactEquals as n,copy as l,normalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,exactEquals as _,intersects as c,copy as p}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as f}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as m}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as g}from"./GaussianSplatFadeTexture.js";import{GaussianSplatHeaderTexture as T}from"./GaussianSplatHeaderTexture.js";import{GaussianSplatOrderTexture as b}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as S}from"./GaussianSplatTextureAtlas.js";import{DepthRange as y}from"../../webgl-engine/lib/DepthRange.js";import{TaskPriority as x}from"../../../support/Scheduler.js";class C{constructor(e,t,s){this._updating=r(!1),this._useDeterministicSort=!1,this._sortBufferMemory=0,this.visibleGaussians=0,this._visibleTileDepthRange=new y,this._previousVisibleTileDepthRangeEye=u(),this._previousVisibleTileDepthRangeViewForward=u(),this._previousVisibleTileDepthRangeClippingBox=d(),this._latestSortedGaussianTilesVersion=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._previousVisibleTileDepthRangeHasClippingBox=!1,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=u(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=a(-1/0),this._sortInterval=a(80),this._renderer=e,this._onSortComplete=t,this._orderTexture=new b(this._renderer.renderingContext),this._fadingTexture=new g(this._renderer.renderingContext),this._headerTexture=new T(this._renderer.renderingContext),this._textureAtlas=new S(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache,s);const{resourceController:i}=this._renderer.view;this._workerHandle=new m(f(i)),this._frameTask=i.scheduler.registerTask(x.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get headerTexture(){return this._headerTexture}get textureAtlasMemory(){return this._textureAtlas.usedMemory}get orderTextureMemory(){return this._orderTexture.usedMemory}get fadingTextureMemory(){return this._fadingTexture.usedMemory}get headerTextureMemory(){return this._headerTexture.usedMemory}get sortBufferMemory(){return this._sortBufferMemory}get usedMemory(){return this.textureAtlasMemory+this.headerTextureMemory+this.orderTextureMemory+this.fadingTextureMemory+this.sortBufferMemory}queryVisibleTileDepthRange(e,t){if(0===this.visibleGaussians)return null;const{eye:s,viewForward:i}=e,r=s[0],a=s[1],o=s[2],h=i[0],u=i[1],d=i[2],f=this._visibleTileDepthRange;if(this._previousVisibleTileDepthRangeTilesVersion===this._latestSortedGaussianTilesVersion&&n(this._previousVisibleTileDepthRangeEye,s)&&n(this._previousVisibleTileDepthRangeViewForward,i)&&(null==t?!this._previousVisibleTileDepthRangeHasClippingBox:this._previousVisibleTileDepthRangeHasClippingBox&&_(this._previousVisibleTileDepthRangeClippingBox,t)))return f.near<=f.far?f:null;let m=1/0,g=-1/0;const T=this._latestSortedGaussianTiles;for(let n=0;n<T.length;n++){const e=T[n];if(null!=t){const s=e.boundingBox;if(!c(s,t))continue}const s=h*(e.obbCenterX-r)+u*(e.obbCenterY-a)+d*(e.obbCenterZ-o),i=e.paddedMbsRadius,l=s-i;l<m&&(m=l);const _=s+i;_>g&&(g=_)}const b=m<=g;return b?f.set(m,g):f.set(1/0,-1/0),this._previousVisibleTileDepthRangeTilesVersion=this._latestSortedGaussianTilesVersion,this._previousVisibleTileDepthRangeHasClippingBox=null!=t,l(this._previousVisibleTileDepthRangeEye,s),l(this._previousVisibleTileDepthRangeViewForward,i),null!=t&&p(this._previousVisibleTileDepthRangeClippingBox,t),b?f:null}updateGaussianVisibility(e,t){this._latestUpdatedGaussianTiles=e,this._requestedLyr3dVisibilityChange=t,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=t(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._headerTexture.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const e=o()-this._lastSortStartTime,t=this._sortInterval-e;t<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},t))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const e=new AbortController;this._sortAbortController=e,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=o(),this._sortOnWorker(e.signal).finally(()=>{this._sortAbortController===e&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._sortBufferMemory=0,this._orderTexture.clear(),this._textureAtlas.clear(),this._headerTexture.clear()}_computeExpandedCapacity(t,s){let i=Math.max(1,t);for(;i<s;)i=Math.ceil(i*e);return i}_ensureSortBufferCapacities(e){if(this._bufferCapacity<e){const t=this._computeExpandedCapacity(this._bufferCapacity,e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._bufferCapacity=t,this._sortBufferMemory=s(this._atlasIndicesBuffer,this._sortedAtlasIndicesBuffer,this._distancesBuffer)}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._previousVisibleTileDepthRangeTilesVersion=-1,this._workerHandle?.clear()}async _sortOnWorker(e){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((e,t)=>e.obb.centerX-t.obb.centerX||e.obb.centerY-t.obb.centerY||e.obb.centerZ-t.obb.centerZ);const t=this._latestUpdatedGaussianTiles,s=t.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let e=0;e<s;e++)r+=t[e].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas(),this._headerTexture.ensureCapacity(this._textureAtlas.pageAllocator.pageCount);const a=this._renderer.camera;h(this._cameraDirectionNormalized,a.ray.direction);const o=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],l=this._cameraDirectionNormalized[2];let u=0;const d=this._atlasIndicesBuffer,_=this._distancesBuffer,p=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;const{frustum:g}=a,T=this._renderer.tileCullingRevision,b=g[0],S=g[1],y=g[2],x=g[3],C=g[4],A=g[5];for(let e=0;e<s;e++){const s=t[e],{gaussianAtlasIndices:i,relativePositions:r,obbCenterX:a,obbCenterY:h,obbCenterZ:g,paddedMbsRadius:V}=s,v=s.gaussianCount;if(s.cullingRevision!==T){let e=null==p||c(s.boundingBox,p);if(e){const t=1.5*V;e=b[0]*a+b[1]*h+b[2]*g+b[3]<t&&S[0]*a+S[1]*h+S[2]*g+S[3]<t&&y[0]*a+y[1]*h+y[2]*g+y[3]<t&&x[0]*a+x[1]*h+x[2]*g+x[3]<t&&C[0]*a+C[1]*h+C[2]*g+C[3]<t&&A[0]*a+A[1]*h+A[2]*g+A[3]<t}s.cullingRevision=T,s.cullingVisible=e}if(!s.cullingVisible)continue;d.set(i,u),f[m++]=s;const B=o*a+n*h+l*g,G=u+v;for(let e=u,t=0;e<G;e++,t+=3){const s=r[t],i=r[t+1],a=r[t+2];_[e]=s*o+i*n+a*l+B}u=G}if(f.length=m,0===u)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const V={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:u,preciseSort:this._useDeterministicSort},v=await(this._workerHandle?.sort(V,e));if(e.aborted)return;v&&(this._distancesBuffer=v.distances,this._atlasIndicesBuffer=v.atlasIndices,this._sortedAtlasIndicesBuffer=v.sortedAtlasIndices);const B=async e=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,u);const t=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=t,this._latestSortedGaussianTilesVersion++,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=u,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),e.madeProgress()};await this._frameTask.schedule(B,e)}catch(t){if(i(t))return}}set useDeterministicSort(e){this._useDeterministicSort=e}}export{C as GaussianSplatDataStore};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import s from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as a}from"../../../webgl/enums.js";import"../../../webgl/Util.js";import{initialSplatAtlasTexturePages as o,packedGaussianSizeInU32 as h}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class m{constructor(e){this.texture=null,this._headerTextureCapacity=0,this._rctx=e}get usedMemory(){return(this.texture?.usedMemory??0)+t(this._headerBuffer)}ensureCapacity(t){const r=this.texture;if(this._headerTextureCapacity>=t&&r?.hasWebGLTextureObject)return;const m=Math.max(Math.ceil(t*e),o,this._headerTextureCapacity),[c,p]=this._evalTextureSize(m),l=c*p,f=this._headerBuffer,d=new Uint32Array(l*h);f&&d.set(f.subarray(0,Math.min(f.length,d.length))),this._headerBuffer=d,this._headerTextureCapacity=l,this.texture?.dispose();const n=new u;n.width=c,n.height=p,n.pixelFormat=36249,n.dataType=i.UNSIGNED_INT,n.internalFormat=a.RGBA32UI,n.wrapMode=33071,n.samplingMode=9728,n.isImmutable=!0,this.texture=new s(this._rctx,n),this.texture.updateData(0,0,0,c,p,this._headerBuffer)}update(e,t){this.ensureCapacity(e+1);const r=e*h;this._headerBuffer.set(t,r);const s=this.texture,i=s.descriptor.width,a=e%i,o=Math.floor(e/i);s.updateData(0,a,o,1,1,this._headerBuffer.subarray(r,r+4))}clear(){this.texture?.dispose(),this.texture=null}destroy(){this._headerBuffer=void 0,this._headerTextureCapacity=0,this.clear()}_evalTextureSize(e){const t=Math.ceil(Math.sqrt(e)),s=Math.ceil(e/t);return r(t,s)}}export{m as GaussianSplatHeaderTexture};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,
|
|
2
|
+
import{has}from"../../../../applications/Components/baUtils.js";import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,gaussiansPerPage as a}from"./GaussianSplatAtlasPages.js";import{PixelType as i,SizedPixelFormat as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as o}from"../../../webgl/FramebufferObject.js";import h from"../../../webgl/Texture.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class c{constructor(t,r,a,i){this._splatAtlasTextureHeight=e,this.texture=null,this._rctx=t,this._fboCache=a,this._onCachedTextureEvicted=i,this.pageAllocator=new s,this._cache=r.newCache("gaussian texture cache",t=>{t.dispose(),this._onCachedTextureEvicted()})}get usedMemory(){return this.texture?.usedMemory??0}ensureTextureAtlas(){if(this.texture?.hasWebGLTextureObject)return;this.texture=null;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new u;e.height=this._splatAtlasTextureHeight,e.width=r,e.pixelFormat=36249,e.dataType=i.UNSIGNED_INT,e.internalFormat=l.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,e.isImmutable=!0,this.texture=new h(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const e=Math.floor(this._splatAtlasTextureHeight*t);if(e>Math.min(has("esri-mobile")?1048:4096,this._rctx.parameters.maxTextureSize))return!1;const s=new o(this._rctx,this.texture),a=this._fboCache.acquire(r,e,"gaussian splat atlas resize",12);return this._rctx.blitFramebuffer(s,a.fbo,16384,9728,0,0,r,this._splatAtlasTextureHeight,0,0,r,this._splatAtlasTextureHeight),this.texture=a.fbo?.detachColorTexture(),s.dispose(),a.dispose(),this._splatAtlasTextureHeight=e,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,s){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,a,1,s)}_updatePageAllocator(){const t=r*this._splatAtlasTextureHeight/a;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._onCachedTextureEvicted=()=>{},this._cache.destroy(),this.texture?.dispose(),this.texture=null}}export{c as GaussianSplatTextureAtlas};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as e}from"../../../../../../core/mathUtils.js";import{isColor as s}from"../ShaderOutput.js";import{VertexTextureCoordinates as i}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as o}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as r}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as m}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as t}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as n}from"../../shaderModules/FloatPassUniform.js";import{If as a,glsl as v}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as l}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as u}from"../../shaderModules/Texture2DPassUniform.js";import{maxEmissiveStrength as f}from"../../../shaders/oitResolution.glsl.js";const c=1,d=1;function g(c,g){if(!s(g.output))return;c.fragment.include(o);const{emissionSource:x,hasEmissiveTextureTransform:p,bindType:h}=g,j=3===x||4===x||5===x;j&&(c.include(i,g),c.fragment.uniforms.add(1===h?new u("texEmission",e=>e.textureEmissive):new l("texEmission",e=>e.textureEmissive)));const T=2===x||j;T&&c.fragment.uniforms.add(1===h?new m("emissiveBaseColor",e=>e.emissiveBaseColor):new r("emissiveBaseColor",e=>e.emissiveBaseColor));const
|
|
2
|
+
import{clamp as e}from"../../../../../../core/mathUtils.js";import{isColor as s}from"../ShaderOutput.js";import{VertexTextureCoordinates as i}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as o}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as r}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as m}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as t}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as n}from"../../shaderModules/FloatPassUniform.js";import{If as a,glsl as v}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as l}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as u}from"../../shaderModules/Texture2DPassUniform.js";import{maxEmissiveStrength as f}from"../../../shaders/oitResolution.glsl.js";const c=1,d=1;function g(c,g){if(!s(g.output))return;c.fragment.include(o);const{emissionSource:x,hasEmissiveTextureTransform:p,bindType:h}=g,j=3===x||4===x||5===x;j&&(c.include(i,g),c.fragment.uniforms.add(1===h?new u("texEmission",e=>e.textureEmissive):new l("texEmission",e=>e.textureEmissive)));const T=2===x||j;T&&c.fragment.uniforms.add(1===h?new m("emissiveBaseColor",e=>e.emissiveBaseColor):new r("emissiveBaseColor",e=>e.emissiveBaseColor));const C=0!==x;if(C&&!(7===x||6===x||4===x||5===x)){const s=s=>e(s??0,0,f);c.fragment.uniforms.add(1===h?new n("emissiveStrength",e=>s(e.emissiveStrength)):new t("emissiveStrength",e=>s(e.emissiveStrength)))}const b=7===x,F=5===x,S=1===x||6===x||b;c.fragment.code.add(v`
|
|
3
3
|
vec4 getEmissions(vec3 symbolColor) {
|
|
4
|
-
vec4 emissions = ${T?
|
|
5
|
-
${a(j,`${a(
|
|
6
|
-
${a(
|
|
4
|
+
vec4 emissions = ${T?F?"emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(emissiveBaseColor, 1.0)":S?b?"emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)":"vec4(linearizeGamma(symbolColor), 1.0)":"vec4(0.0)"};
|
|
5
|
+
${a(j,`${a(F,`if(emissiveSource == 0) {\n vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);\n }`,`vec4 emissiveFromTex = textureLookup(texEmission, ${p?"emissiveUV":"vuv0"});\n emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);`)}\n emissions.a = emissions.rgb == vec3(0.0) ? 0.0: emissions.a;`)}
|
|
6
|
+
${a(C,`emissions.rgb *= emissiveStrength * ${v.float(d)};`)}
|
|
7
7
|
return emissions;
|
|
8
8
|
}
|
|
9
9
|
`)}export{g as Emissions,d as emissiveStrengthBoost,c as emissiveStrengthDefault};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{splatAtlasTextureWidth as e,
|
|
2
|
+
import{splatAtlasTextureWidth as e,gaussiansPerPage as a}from"../../../../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{glsl as n}from"../../shaderModules/glsl.js";function t(e){e.code.add(n`
|
|
3
3
|
uint fetchOrderedGaussianIndex(uint instanceID) {
|
|
4
4
|
uint orderTextureWidth = uint(textureSize(splatOrderTexture, 0).x);
|
|
5
5
|
uint x = instanceID % orderTextureWidth;
|
|
@@ -9,18 +9,23 @@ import{splatAtlasTextureWidth as e,elementsPerSplatPage as a}from"../../../../su
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
uvec4 fetchPackedGaussian(uint gaussianIndex) {
|
|
12
|
-
uint gaussianIndexX = gaussianIndex & ${
|
|
13
|
-
uint gaussianIndexY = gaussianIndex >> ${s}
|
|
12
|
+
uint gaussianIndexX = gaussianIndex & ${n.uint(i)};
|
|
13
|
+
uint gaussianIndexY = gaussianIndex >> ${n.uint(s)};
|
|
14
14
|
|
|
15
15
|
return texelFetch(splatAtlasTexture, ivec2(gaussianIndexX, gaussianIndexY), 0);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
uint fetchGaussianPageIndex(uint gaussianIndex) {
|
|
19
|
+
return gaussianIndex >> ${n.uint(u)};
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
uvec4 fetchPackedGaussianHeader(uint gaussianIndex) {
|
|
19
|
-
uint
|
|
20
|
-
uint
|
|
21
|
-
uint
|
|
23
|
+
uint pageIndex = fetchGaussianPageIndex(gaussianIndex);
|
|
24
|
+
uint headerTextureWidth = uint(textureSize(splatHeaderTexture, 0).x);
|
|
25
|
+
uint headerIndexX = pageIndex % headerTextureWidth;
|
|
26
|
+
uint headerIndexY = pageIndex / headerTextureWidth;
|
|
22
27
|
|
|
23
|
-
return texelFetch(
|
|
28
|
+
return texelFetch(splatHeaderTexture, ivec2(headerIndexX, headerIndexY), 0);
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
vec3 fetchGaussianCameraRelativePosition(uint gaussianIndex, uvec4 packedGaussian) {
|
|
@@ -29,8 +34,4 @@ import{splatAtlasTextureWidth as e,elementsPerSplatPage as a}from"../../../../su
|
|
|
29
34
|
|
|
30
35
|
return unpackCameraRelativeGaussianPosition(packedHeader, tileOriginRelativePosition);
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
uint fetchGaussianPageIndex(uint gaussianIndex) {
|
|
34
|
-
return gaussianIndex >> ${d}u;
|
|
35
|
-
}
|
|
36
|
-
`)}const t=""+(e-1),s=`${Math.log2(e)}`,u=""+(a-1),d=`${Math.log2(a)}`;export{i as GaussianSplatTextureFetch};
|
|
37
|
+
`)}const i=e-1,s=Math.log2(e),u=Math.log2(a);export{t as GaussianSplatTextureFetch};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as T}from"../../../../webgl/enums.js";let v=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.
|
|
2
|
+
import{__decorate as t}from"tslib";import{releaseMaybe as e}from"../../../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as p}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as _}from"./GlowBlurTechniqueConfiguration.js";import{G as g,a as d,m as b}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as f}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as P}from"./GlowCompositionTechniqueConfiguration.js";import{floatBlendReductionFactor as w}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as C,DepthStencilAttachment as T}from"../../../../webgl/enums.js";let v=class extends m{constructor(t){super(t),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._scatteringFactors={realistic:new g([.9,.06,.03,.01,0,0],1),cartographicMin:new g([.58,.18,.12,.08,.04,0],1),cartographicDefault:new g([.99,.95,.75,.2,.1,.01],3),cartographicMax:new g([2.8,2.32,2.05,1.4,.4,.03],9)},this._blurHorizontalConfiguration=new _,this._blurVerticalConfiguration=new _,this._compositeConfiguration=new P,this._compositionParameters=new d,this._blurParameters=new u,this._blurScalePerLod=3.06,this._logicalBlurRadius=.0037;const e=l(t.view.spatialReference);this._atmosphereRadius=e.radius+e.atmosphereHeight,this._blurVerticalConfiguration.glowStage=1}initialize(){this.addHandles([i(()=>this._updateParameters(),()=>{},r)])}_updateParameters(){this._compositionParameters.minDisperse.preset=this._preset,this.requestRender(1)}_updateConfigurations(){this._compositeConfiguration.useFloatBlend=this._blurHorizontalConfiguration.useFloatBlend=this._blurVerticalConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositeConfiguration.blurEnabled=2!==this._mode}precompile(){this._updateConfigurations(),this._compositeConfiguration.blurEnabled&&(this.techniques.precompile(p,this._blurHorizontalConfiguration),this.techniques.precompile(p,this._blurVerticalConfiguration)),this.techniques.precompile(f,this._compositeConfiguration)}render(t){const i=t.find(({name:t})=>t===c.TRANSPARENT_ENVIRONMENT),r=i.getAttachment(C);if(!r?.attachment)return i;const s=i.getTexture(),o=i.getAttachment(T),a=this.fboCache,{fullWidth:h,fullHeight:l}=this.bindParameters.camera,m=this.renderingContext;this._updateConfigurations();const u=this.camera,p=n(u.eye);if(this._compositionParameters.fogOpacity=this.view.stage.renderView.fog?.strength??0,this._compositionParameters.color=s,this._compositionParameters.emission=r.attachment,this._compositionParameters.atmosphereC=p**2-this._atmosphereRadius**2,!this._compositeConfiguration.blurEnabled){const t=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);this._setupFBO(t,h,l);const e=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(e,this.bindParameters,this._compositionParameters),m.screen.draw(),t.attachDepth(o),t.attachColor(r,C),t}this._renderGlowMipMap();const _=a.acquire(s.descriptor.width,s.descriptor.height,this.produces);_.acquireColor(C,this.bindParameters.useFloatBlend.value?8:5,"emissive glow"),this._setupFBO(_,h,l,!0);const g=this.techniques.get(f,this._compositeConfiguration);return m.bindTechnique(g,this.bindParameters,this._compositionParameters),m.screen.draw(),this._compositionParameters.lodTexture=e(this._compositionParameters.lodTexture),_.attachDepth(o),_}_renderGlowMipMap(){const t=this.fboCache,{fullWidth:e,fullHeight:i}=this.camera,r=this.renderingContext,s=5,o=this.techniques.get(p,this._blurHorizontalConfiguration),n=this.techniques.get(p,this._blurVerticalConfiguration);this._blurParameters.input=this._compositionParameters.emission,this._blurParameters.inputScale=w,this._blurParameters.level=0,this._blurParameters.blurRadius=this._logicalBlurRadius,a(this._blurParameters.size,.5*e,.5*i);let h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]);const c=t.acquire(h,l,"glow horizontal",8);for(this._compositionParameters.lodTexture=t.acquire(h,l,"glow mipmap",9);h>1&&l>1&&this._blurParameters.level<s;)this._setupFBO(c,h,l),r.bindTechnique(o,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(`glow horizontal ${this._blurParameters.level}`,c.fbo),this._blurParameters.inputScale=1,this._blurParameters.input=c.getTexture(),this._setupFBO(this._compositionParameters.lodTexture,h,l,!1,this._blurParameters.level),r.bindTechnique(n,this.bindParameters,this._blurParameters),r.screen.draw(),t.debugCallback?.(this._compositionParameters.lodTexture.name,this._compositionParameters.lodTexture.fbo),a(this._blurParameters.size,.5*h,.5*l),h=Math.floor(this._blurParameters.size[0]),l=Math.floor(this._blurParameters.size[1]),this._blurParameters.input=this._compositionParameters.lodTexture.getTexture(),this._blurParameters.blurRadius*=this._blurScalePerLod,++this._blurParameters.level;c.release(),this._compositionParameters.lodTexture.fbo.level=0}get _preset(){return 0===this._mode?this._scatteringFactors.realistic.preset:this._intensity<=.5?b(this._scatteringFactors.cartographicMin.preset,this._scatteringFactors.cartographicDefault.preset,2*this._intensity):b(this._scatteringFactors.cartographicDefault.preset,this._scatteringFactors.cartographicMax.preset,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(t,e,i,r=!1,s=0){t.fbo.level=s;const o=this.renderingContext;o.bindFramebuffer(t.fbo),o.setViewport(0,0,e,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,h)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,preset:this._preset,setMinDisperse:(t,e)=>{0===this._mode?this._scatteringFactors.realistic.preset[t]=e:(this._scatteringFactors.cartographicMin.preset[t]=e,this._scatteringFactors.cartographicMax.preset[t]=e)}}}};t([s()],v.prototype,"consumes",void 0),t([s()],v.prototype,"produces",void 0),v=t([o("esri.views.3d.webgl-engine.effects.glow.Glow")],v);export{v as Glow};
|