@arcgis/core 4.25.0-next.20220718 → 4.25.0-next.20220721
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/Camera.js +1 -1
- package/analysis/DimensioningAnalysis.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/1751de504354d98ac3fd.js +1 -0
- package/assets/esri/core/workers/chunks/1f4f1896880bfa6801c5.js +1 -0
- package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +1 -0
- package/assets/esri/core/workers/chunks/{ab3bd5fecdb97f2d690e.js → 3b5be512567d9c1c6fe6.js} +1 -1
- package/assets/esri/core/workers/chunks/{c3236a7058e64ea3b939.js → 3c9da9b88777700879aa.js} +1 -1
- package/assets/esri/core/workers/chunks/{f96e8724ae3458f5e262.js → 4a7aa1b9de61eb013647.js} +1 -1
- package/assets/esri/core/workers/chunks/4cb64ccb5fba126f9a66.js +1 -0
- package/assets/esri/core/workers/chunks/{68f19e58aae01791944e.js → 579ba109718bc2554008.js} +1 -1
- package/assets/esri/core/workers/chunks/59845b02b07a8ed7ce81.js +1 -0
- package/assets/esri/core/workers/chunks/{c705f907ce60a646d9aa.js → 652d36523efbe5c9ebb2.js} +1 -1
- package/assets/esri/core/workers/chunks/888d8e4471c9a2cd5009.js +1 -0
- package/assets/esri/core/workers/chunks/9493a8e5d6001b6bf275.js +1 -0
- package/assets/esri/core/workers/chunks/9d824cdfbcdf3cb3246f.js +1 -0
- package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +987 -0
- package/assets/esri/core/workers/chunks/d02881954c0cc0d39dfb.js +1 -0
- package/assets/esri/core/workers/chunks/{1ecbf642debc2207b762.js → da54483123f377e9b3e1.js} +1 -1
- package/assets/esri/core/workers/chunks/{61b71b8e028eda10ccab.js → e4ad2cf5d6bded02e392.js} +1 -1
- package/assets/esri/core/workers/chunks/{3bfab05ae07ac18a75fe.js → f298a70f3b6f27675d53.js} +1 -1
- package/assets/esri/core/workers/chunks/{d499cce61c1c5c367380.js → f40290cfad3fe6fb4ef9.js} +1 -1
- package/assets/esri/layers/support/rasterFormats/lerc-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -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/ComponentShader.glsl.js +39 -33
- package/chunks/Laserlines.glsl.js +4 -4
- package/chunks/Precipitation.glsl.js +2 -2
- package/chunks/RibbonLine.glsl.js +46 -44
- package/chunks/Stars.glsl.js +2 -2
- package/chunks/Terrain.glsl.js +25 -17
- package/chunks/boundedPlane.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/chunks/mat2d.js +1 -1
- package/chunks/quatf32.js +1 -1
- package/core/BidiEngine.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/libs/gl-matrix-2/factories/quatf32.js +1 -1
- package/core/libs/gl-matrix-2/math/mat2d.js +1 -1
- package/core/perspectiveUtils.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/reactiveUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/geometry/projection.js +1 -1
- package/geometry/projectionEllipsoid.js +1 -1
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/scaleUtils.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +3 -33
- package/layers/FeatureLayer.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/support/ContingentValue.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/rasterDatasets/CloudRaster.js +1 -1
- package/layers/support/rasterDatasets/EphemeralBlockCache.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/rasterFormats/ImageCanvasDecoder.js +1 -1
- package/layers/support/rasterFormats/JpgPlus.js +1 -1
- package/layers/support/rasterFormats/Lerc.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/Raw.js +1 -1
- package/layers/support/rasterFormats/TiffTags.js +1 -1
- package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/RasterShadedReliefRenderer.js +1 -1
- package/renderers/RasterStretchRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/AuthoringInfo.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/DirectionsFeatureSet.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/smartMapping/labels/clusters.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LabelSymbol3D.js +1 -1
- package/symbols/PointSymbol3D.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/webStyleSymbolUtils.js +1 -1
- package/views/2d/ViewState.js +1 -1
- package/views/2d/engine/vectorTiles/Feature.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/SDFConverter.js +1 -1
- package/views/2d/engine/webgl/TurboLine.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushOverlay.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
- package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
- package/views/2d/engine/webgl/mesh/heuristics.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicLineTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicTextTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/features/createSymbolSchema.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/FogTechnique.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/lineUtils.js +1 -1
- package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/IDBCache.js +1 -1
- package/views/3d/layers/i3s/IDBMockCache.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayRenderTarget.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TilingSchemeLogic.js +1 -1
- package/views/3d/terrain/interfaces.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +9 -0
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +18 -17
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +5 -0
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/MapView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/animation/pointToPoint/apex/planning.js +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/input/handlers/MultiTouch.js +5 -0
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/support/measurements.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/navigation/FilteredFiniteDifference.js +1 -1
- package/views/navigation/MomentumEstimator.js +1 -1
- package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/navigation/RotationMomentumEstimator.js +1 -1
- package/views/support/GroundViewElevationSampler.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/capabilities/Capabilities.js +1 -1
- package/views/webgl/capabilities.js +1 -1
- package/views/webgl/renderState.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Slider/SliderViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/assets/esri/core/workers/chunks/04ea469cb081e181ca82.js +0 -1
- package/assets/esri/core/workers/chunks/16c2626ca47132700519.js +0 -1
- package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +0 -1
- package/assets/esri/core/workers/chunks/35083def3c658d1ae9ff.js +0 -1
- package/assets/esri/core/workers/chunks/40032d2bf404a46b8f80.js +0 -1
- package/assets/esri/core/workers/chunks/613e82a3e13442685ac4.js +0 -1
- package/assets/esri/core/workers/chunks/64b4f1dbf61439cde801.js +0 -1
- package/assets/esri/core/workers/chunks/abd68b7ba3be4696611c.js +0 -1
- package/assets/esri/core/workers/chunks/b8a062c0c9c626acf61e.js +0 -982
- package/assets/esri/core/workers/chunks/e08686088be0aaca1a99.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{removeUnordered as r}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import{HandleOwnerMixin as o}from"../../../../core/HandleOwner.js";import{isSome as i,isNone as a}from"../../../../core/maybe.js";import{eachAlwaysValues as n}from"../../../../core/promiseUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/Polygon.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{removeUnordered as r}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import{HandleOwnerMixin as o}from"../../../../core/HandleOwner.js";import{isSome as i,isNone as a}from"../../../../core/maybe.js";import{eachAlwaysValues as n}from"../../../../core/promiseUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/Polygon.js";import{canProjectWithoutEngine as l,project as u,initializeProjection as h}from"../../../../geometry/projection.js";import{normalizeCentralMeridianForDisplay as m}from"../../../../geometry/support/normalizeUtilsSync.js";import{featureGeometryTypeKebabDictionary as y}from"../../../../geometry/support/typeUtils.js";import{convertFromGeometry as f}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../layers/graphics/data/FeatureStore.js";import{QueryEngine as S}from"../../../../layers/graphics/data/QueryEngine.js";import{sortCandidatesInPlace as j}from"../snappingUtils.js";import{convertSnappingCandidate as v}from"./queryEngineUtils.js";let w=class extends(o(t)){constructor(e){super(e),this.availability=1,this._sources={multipoint:null,point:null,polygon:null,polyline:null},this._loadedWkids=new Set,this._loadedWkts=new Set,this._pendingAdds=[]}get updating(){return this.updatingHandles.updating}get _layer(){return this.layerSource.layer}destroy(){for(const e of this._pendingAdds)e.task.abort();this._pendingAdds.length=0,this._mapSources((e=>this._destroySource(e)))}initialize(){this.handles.add([this._layer.on("graphic-update",(e=>this._onGraphicUpdate(e))),this.updatingHandles.addOnCollectionChange((()=>this._layer.graphics),(e=>this._onGraphicsChanged(e)))]),this._addMany(this._layer.graphics.toArray())}async fetchCandidates(e,t){const r=await n(this._mapSources((r=>r.queryEngine.executeQueryForSnapping({point:e.coordinateHelper.vectorToPoint(e.point).toJSON(),distance:e.distance,types:e.types,query:i(e.filter)?e.filter.createQuery().toJSON():{where:"1=1"}},t).then((({candidates:e})=>e))))),s=r.flat().map((t=>v(t,e.coordinateHelper,e.elevationInfo)));return j(e.point,s),s}refresh(){}_onGraphicUpdate(e){switch(e.property){case"geometry":case"visible":this._remove(e.graphic),this._addMany([e.graphic])}}_onGraphicsChanged(e){for(const t of e.removed)this._remove(t);this._addMany(e.added)}_addMany(e){const t=[],r=new Map;for(const s of e)a(s.geometry)||(this._needsInitializeProjection(s.geometry.spatialReference)?(t.push(s.geometry.spatialReference),r.set(s.uid,s)):this._add(s));this._createPendingAdd(t,r)}_createPendingAdd(e,t){if(!e.length)return;const o=s((async r=>{await h(e.map((e=>({source:e,dest:this.spatialReference}))),{signal:r}),this._markLoadedSpatialReferences(e);for(const[,e]of t)this._add(e)}));this.updatingHandles.addPromise(o.promise);const i={task:o,graphics:t},a=()=>r(this._pendingAdds,i);o.promise.then(a,a),this._pendingAdds.push(i)}_markLoadedSpatialReferences(e){for(const t of e)null!=t.wkid&&this._loadedWkids.add(t.wkid),null!=t.wkt&&this._loadedWkts.add(t.wkt)}_add(e){if(a(e.geometry)||!e.visible)return;let t=e.geometry;if("mesh"===t.type)return;"extent"===t.type&&(t=c.fromExtent(t));const r=this._ensureSource(t.type);if(a(r))return;const s=this._createOptimizedFeature(e.uid,t);i(s)&&r.featureStore.add(s)}_needsInitializeProjection(e){return(null==e.wkid||!this._loadedWkids.has(e.wkid))&&((null==e.wkt||!this._loadedWkts.has(e.wkt))&&!l(e,this.spatialReference))}_createOptimizedFeature(e,t){const r=u(m(t),this.spatialReference);return r?new g(f(r,!1,!1),{[k]:e},null,e):null}_ensureSource(e){const t=this._sources[e];if(i(t))return t;const r=this._createSource(e);return this._sources[e]=r,r}_createSource(e){const t=y.toJSON(e),r=new _({geometryType:t,hasZ:!1,hasM:!1});return{featureStore:r,queryEngine:new S({featureStore:r,fields:[{name:k,type:"esriFieldTypeOID",alias:k}],geometryType:t,hasM:!1,hasZ:!1,objectIdField:k,spatialReference:this.spatialReference,scheduler:i(this.view)&&"3d"===this.view.type?this.view.resourceController.scheduler:null}),type:e}}_remove(e){this._mapSources((t=>this._removeFromSource(t,e)));for(const t of this._pendingAdds)t.graphics.delete(e.uid),0===t.graphics.size&&t.task.abort()}_removeFromSource(e,t){const r=t.uid;e.featureStore.has(r)&&e.featureStore.removeById(t.uid)}_destroySource(e){e.queryEngine.destroy(),this._sources[e.type]=null}_mapSources(e){const{point:t,polygon:r,polyline:s,multipoint:o}=this._sources,a=[];return i(t)&&a.push(e(t)),i(r)&&a.push(e(r)),i(s)&&a.push(e(s)),i(o)&&a.push(e(o)),a}};e([p({constructOnly:!0})],w.prototype,"spatialReference",void 0),e([p({constructOnly:!0})],w.prototype,"layerSource",void 0),e([p({constructOnly:!0})],w.prototype,"view",void 0),e([p({readOnly:!0})],w.prototype,"updating",null),e([p({readOnly:!0})],w.prototype,"availability",void 0),w=e([d("esri.views.interactive.snapping.featureSources.GraphicsSnappingSource")],w);const k="OBJECTID";export{w as GraphicsSnappingSource};
|
package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class t{constructor(){this._store=new Map,this._byteSize=0}set(t,e){this.delete(t),this._store.set(t,e),this._byteSize+=e.byteSize}delete(t){const e=this._store.get(t);return!!this._store.delete(t)&&(this._byteSize-=e.byteSize,!0)}get(t){return this._used(t),this._store.get(t)}has(t){return this._used(t),this._store.has(t)}clear(){this._store.clear()}applyByteSizeLimit(t,e){for(const[s,r]of this._store){if(this._byteSize<=t)break;this.delete(s),e(r)}}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}_used(t){const e=this._store.get(t);e&&(this._store.delete(t),this._store.set(t,e))}}export{t as FeatureServiceTileCache};
|
|
5
|
+
class t{constructor(){this._store=new Map,this._byteSize=0}set(t,e){this.delete(t),this._store.set(t,e),this._byteSize+=e.byteSize}delete(t){const e=this._store.get(t);return!!this._store.delete(t)&&(null!=e&&(this._byteSize-=e.byteSize),!0)}get(t){return this._used(t),this._store.get(t)}has(t){return this._used(t),this._store.has(t)}clear(){this._store.clear()}applyByteSizeLimit(t,e){for(const[s,r]of this._store){if(this._byteSize<=t)break;this.delete(s),e(r)}}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}_used(t){const e=this._store.get(t);e&&(this._store.delete(t),this._store.set(t,e))}}export{t as FeatureServiceTileCache};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{applySome as o,isSome as n,destroyMaybe as i}from"../../../core/maybe.js";import{watch as s,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{BASE as p}from"./css.js";import{tooltipContentFactory as l}from"./content/tooltipContentFactory.js";import{isRTL as d}from"../../../widgets/support/widgetUtils.js";const h={base:`${p}`};let m=class extends e{constructor(t){super(t),this.info=null,this._contentContainer=(()=>{const t=document.createElement("div");return t.classList.add(h.base),t})(),this._contentWidget=null}initialize(){const t=this._contentContainer;this.addHandles([s((()=>this.view.overlay?.surface),(e=>{t.remove(),o(e,(e=>e.appendChild(t)))}),r),s((()=>this.info),((e,s)=>{n(this._contentWidget)&&n(e)&&n(s)&&e.type===s.type?this._contentWidget.info=e:(this._contentWidget=i(this._contentWidget),o(l(this,e),(e=>{this._contentWidget=e,e.container&&t.appendChild(e.container)})))}),r),s((()=>({container:this._contentContainer,contentWidget:this._contentWidget,screenPoint:this._screenPoint})),u,r)])}destroy(){this._contentWidget=i(this._contentWidget),this._contentContainer.remove()}clear(){this.info=null}get _screenPoint(){const t=this.view.inputManager;return t?.multiTouchActive?null:t?.latestPointerLocation}get test(){return{contentContainer:this._contentContainer,visible:"none"!==this._contentContainer?.style.display}}};function u({container:t,contentWidget:e,screenPoint:o}){const{style:i}=t;if(n(o)&&n(e)){i.display="block";const e=d(t),n=`translate(${Math.round(o.x)+_[0]*(e?-1:1)}px, ${Math.round(o.y)+_[1]}px)`;i.transform=e?`translate(-100%, 0) ${n}`:n}else i.display="none"}t([c({nonNullable:!0})],m.prototype,"view",void 0),t([c()],m.prototype,"info",void 0),t([c()],m.prototype,"_contentContainer",void 0),t([c()],m.prototype,"_contentWidget",void 0),t([c()],m.prototype,"_screenPoint",null),m=t([a("esri.views.interactive.tooltip.Tooltip")],m);const _=[20,20];export{m as Tooltip};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as t}from"../../../../core/maybe.js";import{createLength as r}from"../../../../core/quantityUtils.js";import{f as e,c as n}from"../../../../chunks/vec3f64.js";import{autoAreaByDrapedStatus as s}from"../../../support/automaticAreaMeasurementUtils.js";import{
|
|
5
|
+
import{isNone as t}from"../../../../core/maybe.js";import{createLength as r}from"../../../../core/quantityUtils.js";import{f as e,c as n}from"../../../../chunks/vec3f64.js";import{autoAreaByDrapedStatus as s}from"../../../support/automaticAreaMeasurementUtils.js";import{autoLengthByElevationMode as o,autoDirectDistanceByElevationMode as u}from"../../../support/automaticLengthMeasurementUtils.js";import{createEuclideanPlanarAreaCache as i}from"../../../support/euclideanAreaMeasurementUtils.js";function a(n,s){const i=t=>o(t,s),a=(t,r,e)=>u(t,r,e,s),m=i(n),p=n.paths[0]?.[n.paths[0]?.length-1]??null,{hasZ:l,spatialReference:f}=n,h=p?e(p[0],p[1],l?p[2]:0):null;return e=>{if(t(e)||t(m)||t(h))return m;c[0]=e.x,c[1]=e.y,c[2]=l?e.z:0;const n=a(h,c,f);return t(n)?m:r(m.value+n.value,m.unit)}}function m(r,e){const n=i(),o=t=>s(t,e,n);return e=>{if(t(e)||r.rings.length<1||r.rings[0].length<2)return o(r);const n=r.clone();return n.rings[0].push([e.x,e.y]),o(n)}}const c=n();export{m as computeAreaWithStagedVertex,a as computeLengthWithStagedVertex};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as i}from"../../chunks/tslib.es6.js";import e from"../../core/Collection.js";import{
|
|
5
|
+
import{_ as i}from"../../chunks/tslib.es6.js";import e from"../../core/Collection.js";import{referenceSetter as s,castForReferenceSetter as r}from"../../core/collectionUtils.js";import{isNone as t}from"../../core/maybe.js";import{watch as l,sync as a}from"../../core/reactiveUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import h from"./LayerView.js";let p=class extends h{constructor(i){super(i),this.type="group",this.layerViews=new e}_allLayerViewVisibility(i){this.layerViews.forEach((e=>{e.visible=i}))}initialize(){this.handles.add([this.layerViews.on("change",(i=>this._layerViewsChangeHandler(i))),l((()=>this.layer.visibilityMode),(()=>this._applyVisibility((()=>this._allLayerViewVisibility(this.visible)),(()=>this._applyExclusiveVisibility(null)))),a),l((()=>this.visible),(i=>{this._applyVisibility((()=>this._allLayerViewVisibility(i)),(()=>{}))}),a)],"grouplayerview"),this._layerViewsChangeHandler({target:null,added:this.layerViews.toArray(),removed:[],moved:[]})}set layerViews(i){this._set("layerViews",s(i,this._get("layerViews")))}get updatingProgress(){return 0===this.layerViews.length?1:this.layerViews.reduce(((i,e)=>i+e.updatingProgress),0)/this.layerViews.length}isUpdating(){return this.layerViews.some((i=>i.updating))}_hasLayerViewVisibleOverrides(){return this.layerViews.some((i=>i._isOverridden("visible")))}_findLayerViewForLayer(i){return i&&this.layerViews.find((e=>e.layer===i))}_firstVisibleOnLayerOrder(){const i=this.layer.layers.find((i=>this._findLayerViewForLayer(i)?.visible));return i&&this._findLayerViewForLayer(i)}_applyExclusiveVisibility(i){t(i)&&(i=this._firstVisibleOnLayerOrder(),t(i)&&this.layerViews.length>0&&(i=this._findLayerViewForLayer(this.layer.layers.getItemAt(0)))),this.layerViews.forEach((e=>{e.visible=e===i}))}_layerViewsChangeHandler(i){this.handles.remove("grouplayerview:visible"),this.handles.add(this.layerViews.map((i=>l((()=>i.visible),(e=>this._applyVisibility((()=>{e!==this.visible&&(i.visible=this.visible)}),(()=>this._applyExclusiveVisibility(e?i:null)))),a))).toArray(),"grouplayerview:visible");const e=i.added[i.added.length-1];this._applyVisibility((()=>this._allLayerViewVisibility(this.visible)),(()=>this._applyExclusiveVisibility(e?.visible?e:null)))}_applyVisibility(i,e){this._hasLayerViewVisibleOverrides()&&("inherited"===this.layer?.visibilityMode?i():"exclusive"===this.layer?.visibilityMode&&e())}};i([y({cast:r})],p.prototype,"layerViews",null),i([y({readOnly:!0})],p.prototype,"updatingProgress",null),i([y()],p.prototype,"view",void 0),p=i([o("esri.views.layers.GroupLayerView")],p);const n=p;export{n as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class t{constructor(t){this._gain=t}update(t){if(this.hasLastValue){const e=this.computeDelta(t);this._updateDelta(e)}this.lastValue=t}reset(){this.lastValue=void 0,this.filteredDelta=void 0}
|
|
5
|
+
class t{constructor(t){this._gain=t,this.lastValue=void 0,this.filteredDelta=void 0}update(t){if(this.hasLastValue()){const e=this.computeDelta(t);this._updateDelta(e)}this.lastValue=t}reset(){this.lastValue=void 0,this.filteredDelta=void 0}hasLastValue(){return void 0!==this.lastValue}hasFilteredDelta(){return void 0!==this.filteredDelta}computeDelta(t){return void 0===this.lastValue?NaN:t-this.lastValue}_updateDelta(t){void 0!==this.filteredDelta?this.filteredDelta=(1-this._gain)*this.filteredDelta+this._gain*t:this.filteredDelta=t}}export{t as FilteredFiniteDifference};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as t}from"../../core/mathUtils.js";import{FilteredFiniteDifference as e}from"./FilteredFiniteDifference.js";import{Momentum as i}from"./Momentum.js";class s{constructor(t=2.5,i=.01,s=.95,l=12){this._minimumInitialVelocity=t,this._stopVelocity=i,this._friction=s,this._maxVelocity=l,this.enabled=!0,this.value=new e(.8),this.time=new e(.3)}add(t,e){if(this.enabled){if(this.time.hasLastValue){if(this.time.computeDelta(e)<.01)return;if(this.value.hasFilteredDelta){const e=this.value.computeDelta(t);this.value.filteredDelta*e<0&&this.value.reset()}}this.time.update(e),this.value.update(t)}}reset(){this.value.reset(),this.time.reset()}evaluateMomentum(){if(!this.enabled||!this.value.hasFilteredDelta)return null;let e=this.value.filteredDelta/this.time.filteredDelta;return e=t(e,-this._maxVelocity,this._maxVelocity),Math.abs(e)<this._minimumInitialVelocity?null:this.createMomentum(e,this._stopVelocity,this._friction)}createMomentum(t,e,s){return new i(t,e,s)}}export{s as MomentumEstimator};
|
|
5
|
+
import{clamp as t}from"../../core/mathUtils.js";import{FilteredFiniteDifference as e}from"./FilteredFiniteDifference.js";import{Momentum as i}from"./Momentum.js";class s{constructor(t=2.5,i=.01,s=.95,l=12){this._minimumInitialVelocity=t,this._stopVelocity=i,this._friction=s,this._maxVelocity=l,this.enabled=!0,this.value=new e(.8),this.time=new e(.3)}add(t,e){if(this.enabled&&null!=e){if(this.time.hasLastValue()){if(this.time.computeDelta(e)<.01)return;if(this.value.hasFilteredDelta()){const e=this.value.computeDelta(t);this.value.filteredDelta*e<0&&this.value.reset()}}this.time.update(e),this.value.update(t)}}reset(){this.value.reset(),this.time.reset()}evaluateMomentum(){if(!this.enabled||!this.value.hasFilteredDelta()||!this.time.hasFilteredDelta())return null;let e=this.value.filteredDelta/this.time.filteredDelta;return e=t(e,-this._maxVelocity,this._maxVelocity),Math.abs(e)<this._minimumInitialVelocity?null:this.createMomentum(e,this._stopVelocity,this._friction)}createMomentum(t,e,s){return new i(t,e,s)}}export{s as MomentumEstimator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{s as e,l as t,g as i}from"../../chunks/vec3.js";import{c as s}from"../../chunks/vec3f64.js";import{FilteredFiniteDifference as n}from"./FilteredFiniteDifference.js";import{Momentum as r}from"./Momentum.js";class c extends r{constructor(e,t,i,s,n){super(e,t,i),this._sceneVelocity=s,this.direction=n}value(e){return super.valueFromInitialVelocity(this._sceneVelocity,e)}}class
|
|
5
|
+
import{s as e,l as t,g as i}from"../../chunks/vec3.js";import{c as s}from"../../chunks/vec3f64.js";import{FilteredFiniteDifference as n}from"./FilteredFiniteDifference.js";import{Momentum as r}from"./Momentum.js";class c extends r{constructor(e,t,i,s,n){super(e,t,i),this._sceneVelocity=s,this.direction=n}value(e){return super.valueFromInitialVelocity(this._sceneVelocity,e)}}class l{constructor(e=300,t=12,i=.84){this._minimumInitialVelocity=e,this._stopVelocity=t,this._friction=i,this.enabled=!0,this._time=new n(.6),this._screen=[new n(.4),new n(.4)],this._scene=[new n(.6),new n(.6),new n(.6)],this._tmpDirection=s()}add(e,t,i){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(i)<.015)return}this._screen[0].update(e[0]),this._screen[1].update(e[1]),this._scene[0].update(t[0]),this._scene[1].update(t[1]),this._scene[2].update(t[2]),this._time.update(i)}}reset(){this._screen[0].reset(),this._screen[1].reset(),this._scene[0].reset(),this._scene[1].reset(),this._scene[2].reset(),this._time.reset()}evaluateMomentum(){if(!this.enabled||!this._screen[0].hasFilteredDelta()||!this._time.hasFilteredDelta())return null;const e=this._screen[0].filteredDelta,t=this._screen[1].filteredDelta,i=null==e||null==t?0:Math.sqrt(e*e+t*t),s=this._time.filteredDelta,n=null==s||null==i?0:i/s;return Math.abs(n)<this._minimumInitialVelocity?null:this.createMomentum(n,this._stopVelocity,this._friction)}createMomentum(s,n,r){e(this._tmpDirection,this._scene[0].filteredDelta??0,this._scene[1].filteredDelta??0,this._scene[2].filteredDelta??0);const l=t(this._tmpDirection);l>0&&i(this._tmpDirection,this._tmpDirection,1/l);const h=this._time.filteredDelta;return new c(s,n,r,null==h?0:l/h,this._tmpDirection)}}export{c as PanPlanarMomentum,l as PanPlanarMomentumEstimator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{a as t}from"../../chunks/vec2f64.js";import{p as e,n as i,c as s}from"../../chunks/vec3.js";import{c as a}from"../../chunks/vec3f64.js";import{rotationAngleAndAxisDirectRotation as
|
|
5
|
+
import{a as t}from"../../chunks/vec2f64.js";import{p as e,n as i,c as s}from"../../chunks/vec3.js";import{c as a}from"../../chunks/vec3f64.js";import{rotationAngleAndAxisDirectRotation as l,rotationAnglesAndAxesHeadingPreserving as n}from"../3d/state/utils/navigationUtils.js";import{FilteredFiniteDifference as h}from"./FilteredFiniteDifference.js";import{FilteredValue as r}from"./FilteredValue.js";import{Momentum as _}from"./Momentum.js";const u=1e-5;class m extends _{constructor(t,e,i,s,a,l=0,n){super(t,e,i),this._angularVelocity1=s,this.axis1=a,this.angularVelocity2=l,this.axis2=n}value1(t){return super.valueFromInitialVelocity(this._angularVelocity1,t)}value2(t){return super.valueFromInitialVelocity(this.angularVelocity2,t)}}class c{constructor(e=300,i=12,s=.84){this._minimumInitialVelocity=e,this._stopVelocity=i,this._friction=s,this.enabled=!0,this._tmpAxis1=a(),this._tmpAxis2=a(),this._tmpAngles=t(),this._time=new h(.3),this._screen=[new h(.4),new h(.4)],this._angle1=new r(.6),this._angle2=new r(.6),this._axis1=a(),this._axis2=a(),this._lastScene=a()}addMomentumDirectRotation(t,a,n,h,r,_){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(n)<.01)return;let t=l(this._lastScene,a,this._tmpAxis2,h,r,_);this._angle2.update(0),e(this._tmpAxis2)<u?t=0:i(this._axis1,this._tmpAxis2),this._angle1.update(t),s(this._lastScene,a)}this._screen[0].update(t[0]),this._screen[1].update(t[1]),this._time.update(n)}}addMomentumPreserveHeading(t,a,l,h,r,_,m){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(l)<.01)return;n(this._lastScene,a,this._tmpAxis2,this._tmpAxis1,this._tmpAngles,h,r,_,m,!1),e(this._tmpAxis2)<u?(this._angle1.update(0),this._angle2.update(0)):(this._angle1.update(this._tmpAngles[1]),this._angle2.update(this._tmpAngles[0]),i(this._axis1,this._tmpAxis1),i(this._axis2,this._tmpAxis2)),s(this._lastScene,a)}this._screen[0].update(t[0]),this._screen[1].update(t[1]),this._time.update(l)}}reset(){this._screen[0].reset(),this._screen[1].reset(),this._angle1.reset(),this._angle2.reset(),this._time.reset()}evaluateMomentum(){if(!this.enabled||!this._screen[0].hasFilteredDelta())return null;const t=this._screen[0].filteredDelta,e=this._screen[1].filteredDelta,i=null==t||null==e?null:Math.sqrt(t*t+e*e),s=this._time.filteredDelta,a=null==i||null==s?0:i/s;return Math.abs(a)<this._minimumInitialVelocity?null:this.createMomentum(a,this._stopVelocity,this._friction)}createMomentum(t,e,i){const s=this._time.filteredDelta,a=this._angle1.filteredValue,l=this._angle2.filteredValue,n=null==s||null==l?0:l/s;return new m(t,e,i,null==s||null==a?0:a/s,this._axis1,n,this._axis2)}}export{m as PanSphericalMomentum,c as PanSphericalMomentumEstimator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{MomentumEstimator as t}from"./MomentumEstimator.js";class a extends t{constructor(t=3,a=.01,s=.95,
|
|
5
|
+
import{MomentumEstimator as t}from"./MomentumEstimator.js";class a extends t{constructor(t=3,a=.01,s=.95,o=12){super(t,a,s,o)}add(t,a){const s=this.value.lastValue;if(null!=s){let a=t-s;for(;a>Math.PI;)a-=2*Math.PI;for(;a<-Math.PI;)a+=2*Math.PI;t=s+a}super.add(t,a)}}export{a as RotationMomentumEstimator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import r from"../../core/Logger.js";import{isNone as o,unwrapOr as s,isSome as i}from"../../core/maybe.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/SpatialReference.js";import{toExtent as l}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as m}from"../../geometry/support/contains.js";import{updateGeometryElevation as c}from"../../layers/support/ElevationSampler.js";import{ELEVATION_NODATA_VALUE as u}from"../3d/terrain/TerrainConst.js";let d=class extends t.EventedAccessor{constructor(e){super(e),this.demResolution={min:-1,max:-1},this.noDataValue=u}initialize(){this.view.basemapTerrain.on("elevation-change",(()=>this.emit("changed",{})))}get extent(){const e=this.view.basemapTerrain;if(o(e.extent)||o(e.spatialReference))return null;const t=l(e.extent,e.spatialReference);return t.zmin=e.elevationBounds.min,t.zmax=e.elevationBounds.max,t}get spatialReference(){return s(this.view.basemapTerrain.spatialReference,p.WGS84)}elevationAt(e,t){if(o(this.extent)||!m(this.extent,e,t)){const o=i(this.extent)?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return r.getLogger(this.declaredClass).warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler extent (${o})`),this.noDataValue}return s(this.view.elevationProvider.getElevation(e,t,0,this.spatialReference,"ground"),this.noDataValue)}queryElevation(e){return c(e.clone(),this)}};e([n({readOnly:!0})],d.prototype,"demResolution",void 0),e([n({readOnly:!0})],d.prototype,"extent",null),e([n({readOnly:!0})],d.prototype,"noDataValue",void 0),e([n()],d.prototype,"spatialReference",null),e([n({constructOnly:!0})],d.prototype,"view",void 0),d=e([a("esri.views.support.GroundViewElevationSampler")],d);const h=d;export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as t}from"../../core/maybe.js";import{createArea as
|
|
5
|
+
import{isNone as t}from"../../core/maybe.js";import{createArea as o}from"../../core/quantityUtils.js";import{areaUnitFromSpatialReference as r}from"../../core/unitUtils.js";import{e as n}from"../../chunks/earcut.js";import{s as e,C as s,p as i}from"../../chunks/vec3.js";import{c}from"../../chunks/vec3f64.js";import{projectVectorToVector as f}from"../../geometry/projection.js";import{fromPoints as u,wrap as l,normal as m,projectPointLocal as p}from"../../geometry/support/plane.js";import{areaPoints2d as a}from"../../geometry/support/triangle.js";import{computeEuclideanMeasurementSR as g}from"./measurementUtils.js";function h(t,o=C()){return y(t,o)}function j(t,o=C()){return y(t,o,!1)}function y(n,h,j=n.hasZ){const y=g(n.spatialReference),C=r(y);if(t(C))return null;const v=(t,o)=>!(o.length<2)&&(e(t,o[0],o[1],j&&o[2]||0),!0);let R=0;for(const t of n.rings){const o=t.length;if(o<3)continue;const{positionsWorldCoords:r}=h;for(;r.length<o;)r.push(c());const g=d,j=e(k,0,0,0),C=1/o;for(let e=0;e<o;e++){if(!v(g,t[e]))return null;if(!f(g,n.spatialReference,r[e],y))return null;s(j,j,r[e],C)}const W=u(r[0],r[1],j,l());if(0===i(m(W)))continue;for(let t=0;t<o;t++)p(W,j,r[t],r[t]);const b=U(r);for(let t=0;t<b.length;t+=3)R+=a(r[b[t]],r[b[t+1]],r[b[t+2]])}return o(R,C)}const d=c(),k=c();function C(){return{positionsWorldCoords:[]}}function U(t){return n(v(t),[],2)}function v(t){const o=new Float64Array(2*t.length);for(let r=0;r<t.length;++r){const n=t[r],e=2*r;o[e+0]=n[0],o[e+1]=n[1]}return o}export{y as computeEuclideanPlanarArea,C as createEuclideanPlanarAreaCache,j as euclideanHorizontalPlanarArea,h as euclideanPlanarArea,U as triangulate};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{isNone as t,isSome as n}from"../../core/maybe.js";import{createLength as r}from"../../core/quantityUtils.js";import{lengthUnitFromSpatialReference as e,verticalLengthUnitFromSpatialReference as i}from"../../core/unitUtils.js";import{i as o,s as c}from"../../chunks/vec3.js";import{c as u}from"../../chunks/vec3f64.js";import{projectVectorToVector as l}from"../../geometry/projection.js";import{equals as a}from"../../geometry/support/spatialReferenceUtils.js";import{computeEuclideanMeasurementSR as s}from"./measurementUtils.js";var f;function p(t){return m(t,f.Direct)}function h(t){return m(t,f.Horizontal)}function m(n,i){const{hasZ:o,spatialReference:c}=n,u=s(c);let l=0;const a=e(u);if(t(a))return null;const p=i===f.Direct?j:d;for(const r of n.paths){if(r.length<2)continue;const n=r.length-1;for(let e=0;e<n;++e){const n=r[e];U[0]=n[0],U[1]=n[1],U[2]=o?n[2]:0;const i=r[e+1];b[0]=i[0],b[1]=i[1],b[2]=o?i[2]:0;const u=p(U,b,c);if(t(u))return null;l+=u.value}}return r(l,a)}function z(t,n){const{spatialReference:r}=t;return a(r,n.spatialReference)?(U[0]=t.x,U[1]=t.y,U[2]=t.hasZ?t.z:0,b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,Z(U,b,r)):null}function y(t,n){const{spatialReference:r}=t;return a(r,n.spatialReference)?(U[0]=t.x,U[1]=t.y,U[2]=t.hasZ?t.z:0,b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,j(U,b,r)):null}function R(t,n){const{spatialReference:r}=t;return a(r,n.spatialReference)?(U[0]=t.x,U[1]=t.y,U[2]=t.hasZ?t.z:0,b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,d(U,b,r)):null}function v(t,n){const{spatialReference:r}=t;return a(r,n.spatialReference)?(U[0]=t.x,U[1]=t.y,U[2]=t.hasZ?t.z:0,b[0]=n.x,b[1]=n.y,b[2]=n.hasZ?n.z:0,D(U,b,r)):null}function x(t){return U[0]=t.x,U[1]=t.y,U[2]=t.hasZ?t.z:0,H(U,t.spatialReference)}function Z(t,e,i){const o=V(t,e,i);return n(o)?{direct:r(o.direct,o.unit),horizontal:r(o.horizontal,o.unit),vertical:r(o.vertical,o.unit)}:null}function j(t,e,i){const o=V(t,e,i,f.Direct);return n(o)?r(o.direct,o.unit):null}function d(t,e,i){const o=V(t,e,i,f.Horizontal);return n(o)?r(o.horizontal,o.unit):null}function g(t,e,i){const o=V(t,e,i,f.Vertical);return n(o)?r(Math.abs(o.verticalSigned),o.unit):null}function D(t,e,i){const o=V(t,e,i,f.Vertical);return n(o)?r(o.verticalSigned,o.unit):null}function H(t,e){const o=i(e);return n(o)?r(t[2],o):null}function V(n,r,i,u){const a=s(i),p=e(a);if(t(p))return null;const h=r[2]-n[2];if(u===f.Vertical)return{verticalSigned:h,unit:p};if(!l(n,i,S,a)||!l(r,i,k,a))return null;if(u===f.Direct){return{direct:o(k,S),unit:p}}if(c(M,n[0],n[1],r[2]),!l(M,i,M,a))return null;const m=o(M,k);if(u===f.Horizontal)return{horizontal:m,unit:p};return{direct:o(k,S),horizontal:m,vertical:Math.abs(h),unit:p}}!function(t){t[t.Direct=0]="Direct",t[t.Horizontal=1]="Horizontal",t[t.Vertical=2]="Vertical"}(f||(f={}));const U=u(),b=u(),S=u(),k=u(),M=u();export{H as elevation,x as elevationOfPoint,j as euclideanDirectDistance,y as euclideanDirectDistanceBetweenPoints,Z as euclideanDistance,z as euclideanDistanceBetweenPoints,d as euclideanHorizontalDistance,R as euclideanHorizontalDistanceBetweenPoints,h as euclideanHorizontalLength,p as euclideanLength,g as verticalDistance,D as verticalSignedDistance,v as verticalSignedDistanceBetweenPoints};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import{clamp as t}from"../../core/mathUtils.js";import{isNone as i}from"../../core/maybe.js";const h=2048,e=1.5,n=8;function o(i,h){const{format:e,quality:n,rotation:o,disableDecorations:a}=i||{},r=P(i,h.padding),l=
|
|
5
|
+
import"../../core/has.js";import{clamp as t}from"../../core/mathUtils.js";import{isNone as i}from"../../core/maybe.js";const h=2048,e=1.5,n=8;function o(i,h){const{format:e,quality:n,rotation:o,disableDecorations:a}=i||{},r=P(i,h.padding),l=I(i,{width:h.width-r.left-r.right,height:h.height-r.top-r.bottom}),{width:g,height:u}=v(i,l),f=k(e),d=W[f];return{format:f,quality:t(null!=n?n:d,0,100),area:l,width:g,height:u,rotation:o,disableDecorations:!!a,ignoreBackground:!(!i||!i.ignoreBackground),ignorePadding:!(!i||!i.ignorePadding)}}function a(t,i){const h=o(t,i),e=h.area,n=h.width/e.width,a=P(h,i.padding),r=a.left+a.right,l=a.top+a.bottom,g=i.width-r,u=i.height-l,f=Math.floor(g*n+r),d=Math.floor(u*n+l),c=t&&t.layers?t.layers:[],s=h.ignoreBackground,w=h.ignorePadding;return{framebufferWidth:f,framebufferHeight:d,region:{x:Math.floor(e.x*n)+a.left,y:Math.floor(e.y*n)+a.top,width:h.width,height:h.height},format:h.format,quality:h.quality,rotation:h.rotation,pixelRatio:n,layers:c,disableDecorations:h.disableDecorations,ignoreBackground:s,ignorePadding:w,objectAndLayerIdColor:!1}}function r(t,i,h){const{ctx:e,canvas:n}=g(t,h),o=e.getImageData(0,0,t.width,t.height),a=c(n,i);return u(n),{dataUrl:a,data:o}}function l(t,i){const{ctx:h,canvas:e}=g(t,i),n=h.getImageData(0,0,t.width,t.height);return u(e),n}function g(t,i){const h=f();i.premultipliedAlpha&&E(t),h.width=t.width,h.height=t.height;const e=h.getContext("2d");return e.putImageData(t,0,0),i.flipY&&B(e),{ctx:e,canvas:h}}function u(t){t.width=0,t.height=0}function f(){return i(d)&&(d=document.createElement("canvas")),d}let d=null;function c(t,i){const h=R[i.format],e=i.quality/100;return t.toDataURL(h,e)}function s(i,h){const e=k(i),n=W[e];return{format:e,quality:t(null!=h?h:n,0,100)}}function w(t,i){return i/Math.max(t[0],t[1])}function m(t,i,h){if(!t||!i)throw new Error("Cannot construct image data without dimensions");if(j)try{return new ImageData(t,i)}catch(e){j=!1}return x(t,i,h)}function M(t,i,h,e){if(!i||!h)throw new Error("Cannot construct image data without dimensions");if(j)try{return new ImageData(t,i,h)}catch(o){j=!1}const n=x(i,h,e);return n.data.set(t,0),n}function p(t,i,h,e=0,n=0,o=t.width-e,a=t.height-n,r=!1){const{data:l}=t,{width:g,height:u,data:f}=i,d=o/g,c=a/u,s=Math.ceil(d/2),w=Math.ceil(c/2),m=t.width;for(let M=0;M<u;M++)for(let t=0;t<g;t++){const i=4*(t+(r?u-M-1:M)*g);let o=0,a=0,p=0,y=0,x=0,b=0;const j=(M+.5)*c;for(let r=Math.floor(M*c);r<(M+1)*c;r++){const i=Math.abs(j-(r+.5))/w,g=(t+.5)*d,u=i*i;for(let f=Math.floor(t*d);f<(t+1)*d;f++){const t=Math.abs(g-(f+.5))/s,i=Math.sqrt(u+t*t);if(i>=1)continue;let d=2*i*i*i-3*i*i+1;const c=4*(e+f+(n+r)*m);b+=d*l[c+3],a+=d,!h&&l[c+3]<255&&(d=d*l[c+3]/255),p+=d*l[c],y+=d*l[c+1],x+=d*l[c+2],o+=d}}f[i]=p/o,f[i+1]=y/o,f[i+2]=x/o,f[i+3]=b/a}return i}function y(t,i,o){if(!i)return t;const{framebufferWidth:a,framebufferHeight:r,pixelRatio:l,region:g}=t,u=P(t,o),f=u.left+u.right,d=u.top+u.bottom,c=a-f,s=r-d,w=Math.min(n,Math.min((h-f)/c,(h-d)/s));return w<e?t:{...t,framebufferWidth:Math.round(c*w)+f,framebufferHeight:Math.round(s*w)+d,pixelRatio:l*w,resample:{region:{x:Math.round((g.x-u.left)*w)+u.left,y:Math.round((g.y-u.top)*w)+u.top,width:Math.round(g.width*w),height:Math.round(g.height*w)},width:a,height:r}}}function x(t,i,h){return h||(h=D()),h.getContext("2d").createImageData(t,i)}let b=null,j=!0;function D(){return b||(b=document.createElement("canvas"),b.width=1,b.height=1),b}function v(t,i){if(!t)return i;const h=t.width,e=t.height;if(null!=h&&null!=e)return{width:Math.floor(h),height:Math.floor(e)};if(null==h&&null==e)return i;const n=i.width/i.height;return null==e?{width:Math.floor(h),height:Math.floor(h/n)}:{width:Math.floor(e*n),height:Math.floor(e)}}function I(t,i){const h={x:0,y:0,width:i.width,height:i.height};if(t&&t.area){null!=t.area.x&&(h.x=Math.floor(t.area.x)),null!=t.area.y&&(h.y=Math.floor(t.area.y));const e=null!=t.area.width?Math.floor(t.area.width):null,n=null!=t.area.height?Math.floor(t.area.height):null;if(h.width=i.width-h.x,h.height=i.height-h.y,null!=e&&null!=n)h.width=Math.min(h.width,e),h.height=Math.min(h.height,n);else if(null==e&&null!=n){const t=Math.min(h.width,e);h.height=t/h.width*h.height,h.width=t}else if(null!=e&&null==n){const t=Math.min(h.height,n);h.width=t/h.height*h.width,h.height=t}}return q(C(h,t),i)}function q(t,i){const h=Math.floor(Math.max(t.x,0)),e=Math.floor(Math.max(t.y,0)),n={x:h,y:e,width:Math.floor(Math.min(t.width,i.width-h)),height:Math.floor(Math.min(t.height,i.height-e))},o=n.width/n.height,a=t.width/t.height;if(a===o)return n;if(a>o){const t=Math.floor(n.width/a),i=n.height-t;return{x:n.x,y:Math.floor(n.y+i/2),width:n.width,height:t}}const r=Math.floor(n.height*a),l=n.width-r;return{x:Math.floor(n.x+l/2),y:n.y,width:r,height:n.height}}function C(t,i){if(!i||null==i.width||null==i.height)return t;const h=i.width/i.height,e=t.width/t.height;if(e===h)return t;if(e<h){const i=Math.floor(t.height*h);return t.x-=(i-t.width)/2,t.width=i,t}const n=Math.floor(t.width/h);return t.y-=(n-t.height)/2,t.height=n,t}function P(t,i){return!i||t&&t.ignorePadding?A:i}function k(t){switch(t){case"png":case"jpg":case"jpeg":return t;default:return U}}function B(t){t.save(),t.globalCompositeOperation="copy",t.scale(1,-1),t.translate(0,-t.canvas.height),t.drawImage(t.canvas,0,0),t.restore()}function E(t){const i=t.data,h=i.length;for(let e=0;e<h;e+=4){const t=i[e+3];if(255!==t&&t>0){const h=255/t;i[e+0]=i[e+0]*h,i[e+1]=i[e+1]*h,i[e+2]=i[e+2]*h}}}const R={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg"},H=98,U="png",W={png:100,jpg:H,jpeg:H},A={top:0,right:0,bottom:0,left:0};export{o as completeUserSettings,m as createEmptyImageData,r as encode,l as encodeData,s as getFormatAndQuality,w as getMaximumResolutionScale,p as resampleHermite,y as screenshotSuperSampleSettings,c as toDataUrl,a as toRenderSettings,M as wrapImageData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isArrayLike as e}from"../../core/arrayUtils.js";import t from"../../core/Logger.js";import{isSome as r}from"../../core/maybe.js";import{isUint16Array as i,isUint32Array as s}from"../../core/typedArrayUtil.js";import{checkWebGLError as n}from"./checkWebGLError.js";import{ContextType as o}from"./context-util.js";import{
|
|
5
|
+
import{isArrayLike as e}from"../../core/arrayUtils.js";import t from"../../core/Logger.js";import{isSome as r}from"../../core/maybe.js";import{isUint16Array as i,isUint32Array as s}from"../../core/typedArrayUtil.js";import{checkWebGLError as n}from"./checkWebGLError.js";import{ContextType as o}from"./context-util.js";import{ResourceType as f,BufferType as a,Usage as u,DataType as h}from"./enums.js";const _=t.getLogger("esri.views.webgl.BufferObject");function b(t){return e(t)}class c{constructor(e,t,r,i){this._context=e,this.bufferType=t,this.usage=r,this._glName=null,this._size=-1,this._indexType=void 0,e.instanceCounter.increment(f.BufferObject,this),this._glName=this._context.gl.createBuffer(),n(this._context.gl),i&&this.setData(i)}static createIndex(e,t,r){return new c(e,a.ELEMENT_ARRAY_BUFFER,t,r)}static createVertex(e,t,r){return new c(e,a.ARRAY_BUFFER,t,r)}static createUniform(e,t,r){if(e.type!==o.WEBGL2)throw new Error("Uniform buffers are supported in WebGL2 only!");return new c(e,a.UNIFORM_BUFFER,t,r)}static createPixelPack(e,t=u.STREAM_READ,r){if(e.type!==o.WEBGL2)throw new Error("Pixel pack buffers are supported in WebGL2 only!");const i=new c(e,a.PIXEL_PACK_BUFFER,t);return r&&i.setSize(r),i}static createPixelUnpack(e,t=u.STREAM_DRAW,r){if(e.type!==o.WEBGL2)throw new Error("Pixel unpack buffers are supported in WebGL2 only!");return new c(e,a.PIXEL_UNPACK_BUFFER,t,r)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get byteSize(){return this.bufferType===a.ELEMENT_ARRAY_BUFFER?this._indexType===h.UNSIGNED_INT?4*this._size:2*this._size:this._size}get _isVAOAware(){return this.bufferType===a.ELEMENT_ARRAY_BUFFER||this.bufferType===a.ARRAY_BUFFER}dispose(){if(this._context?.gl){if(this._glName){this._context.gl.deleteBuffer(this._glName),this._glName=null}this._context.instanceCounter.decrement(f.BufferObject,this),this._context=null}else this._glName&&_.warn("Leaked WebGL buffer object")}setSize(e,t=null){if(e<=0&&_.error("Buffer size needs to be positive!"),this.bufferType===a.ELEMENT_ARRAY_BUFFER&&r(t))switch(this._indexType=t,t){case h.UNSIGNED_SHORT:e*=2;break;case h.UNSIGNED_INT:e*=4}this._setBufferData(e)}setData(e){if(!e)return;let t=e.byteLength;this.bufferType===a.ELEMENT_ARRAY_BUFFER&&(i(e)&&(t/=2,this._indexType=h.UNSIGNED_SHORT),s(e)&&(t/=4,this._indexType=h.UNSIGNED_INT)),this._setBufferData(t,e)}_setBufferData(e,t=null){this._size=e;const i=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const s=this._context.gl;r(t)?s.bufferData(this.bufferType,t,this.usage):s.bufferData(this.bufferType,e,this.usage),n(s),this._isVAOAware&&this._context.bindVAO(i)}setSubData(e,t=0,r=0,o=e.byteLength){if(!e)return;(t<0||t>=this._size)&&_.error("offset is out of range!");let f=t,u=r,h=o,b=e.byteLength;this.bufferType===a.ELEMENT_ARRAY_BUFFER&&(i(e)?(b/=2,f*=2,u*=2,h*=2):s(e)&&(b/=4,f*=4,u*=4,h*=4)),void 0===o&&(o=b-1),r>=o&&_.error("end must be bigger than start!"),t+r-o>this._size&&_.error("An attempt to write beyond the end of the buffer!");const c=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const E=this._context.gl,l=ArrayBuffer.isView(e)?e.buffer:e,d=0===u&&h===e.byteLength?l:l.slice(u,h);E.bufferSubData(this.bufferType,f,d),n(E),this._isVAOAware&&this._context.bindVAO(c)}setSubDataFromView(e,t,r,i){if(!e)return;(t<0||t>=this._size)&&_.error("offset is out of range!"),r>=i&&_.error("end must be bigger than start!"),t+r-i>this._size&&_.error("An attempt to write beyond the end of the buffer!");const s=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const f=this._context.gl;if(this._context.type===o.WEBGL2)f.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,e,r,i-r);else{const s=0===r&&i===e.length?e:e.subarray(r,i);f.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,s)}n(f),this._isVAOAware&&this._context.bindVAO(s)}getSubData(e,t=0,r,i){if(this._context.type!==o.WEBGL2)return void _.error("Get buffer subdata is supported in WebGL2 only!");if(r<0||i<0)return void _.error("Problem getting subdata: offset and length were less than zero!");const s=b(e)?e.BYTES_PER_ELEMENT:1;if(s*((r??0)+(i??0))>e.byteLength)return void _.error("Problem getting subdata: offset and length exceeded destination size!");t+s*(i??0)>this.byteSize&&_.warn("Potential problem getting subdata: requested data exceeds buffer size!");const n=this._context.gl;this._context.bindBuffer(this,a.COPY_READ_BUFFER),n.getBufferSubData(a.COPY_READ_BUFFER,t,e,r,i),this._context.unbindBuffer(a.COPY_READ_BUFFER)}async getSubDataAsync(e,t=0,r,i){this._context.type===o.WEBGL2?(await this._context.clientWaitAsync(),this.getSubData(e,t,r,i)):_.error("Get buffer subdata is supported in WebGL2 only!")}}export{c as BufferObject};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../core/Logger.js";import{isSome as e,isNone as i}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as h,webglValidateShadersEnabled as s}from"./checkWebGLError.js";import{ContextType as n}from"./context-util.js";import{ResourceType as c,ColorAttachment as o,DepthStencilTargetType as _,PixelFormat as a,PixelType as l,DepthStencilAttachment as T,RenderbufferFormat as E,FramebufferTarget as d,TextureType as u,Usage as f,BufferType as m,TargetType as A,TextureSamplingMode as p,TextureWrapMode as R,SizedPixelFormat as g}from"./enums.js";import{Renderbuffer as N}from"./Renderbuffer.js";import{Texture as F}from"./Texture.js";import{getGpuMemoryUsage as x}from"./Util.js";class b{constructor(t,i,r=null,h=null){if(this._context=t,this._glName=null,this._depthAttachment=null,this._stencilAttachment=null,this._colorAttachments=new Map,this._initialized=!1,this._desc={...i},t.instanceCounter.increment(c.FramebufferObject,this),e(r)){Array.isArray(r)||(r=[r]);for(let t=0;t<r.length;++t){const e=r[t],i=o.COLOR_ATTACHMENT0+t;let h;S(e)?(D(e)?(h=e.descriptor,this._colorAttachments.set(i,e)):(h=e,this._colorAttachments.set(i,new F(this._context,h))),H(h,this._desc)):(C(e)?(h=e.descriptor,this._colorAttachments.set(i,e)):(h=e,this._colorAttachments.set(i,new N(this._context,h))),P(h,this._desc)),this._validateColorAttachmentPoint(i)}}if(e(h)){let t,e;if(S(h))this._context.capabilities.depthTexture||console.error("Setting the depth/stencil texture as an attachment requires WEBGL_depth_texture or WebGL2"),D(h)?(e=h.descriptor,this._depthStencilTexture=h):(e=h,this._depthStencilTexture=new F(this._context,e)),H(e,this._desc);else{C(h)?(e=h.descriptor,t=h):(e=h,t=new N(this._context,e));const i=this._desc.depthStencilTarget??_.DEPTH_STENCIL_RENDER_BUFFER;i===_.STENCIL_RENDER_BUFFER?this._stencilAttachment=t:i===_.DEPTH_RENDER_BUFFER||i===_.DEPTH_STENCIL_RENDER_BUFFER?this._depthAttachment=t:console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'),this._desc.depthStencilTarget=i,P(e,this._desc)}}}dispose(){if(!this._desc)return;const t=this._context.getBoundFramebufferObject();if(this._disposeColorAttachments(),this._disposeDepthStencilAttachments(),this._glName){this._context.gl.deleteFramebuffer(this._glName),this._glName=null}this._context.bindFramebuffer(t),this._context.instanceCounter.decrement(c.FramebufferObject,this),this._desc=null}get glName(){return this._glName}get descriptor(){return this._desc}get colorTexture(){const t=this._colorAttachments.get(o.COLOR_ATTACHMENT0);return t&&D(t)?t:null}get colorAttachment(){return this._colorAttachments.get(o.COLOR_ATTACHMENT0)}get depthStencilAttachment(){return this._depthStencilTexture||this._depthAttachment||this._stencilAttachment}get depthStencilTexture(){return this._depthStencilTexture}get width(){return this._desc.width}get height(){return this._desc.height}get gpuMemoryUsage(){return[...this._colorAttachments].reduce(((t,[e,i])=>t+x(i)),0)+x(this.depthStencilAttachment)}getColorTexture(t){const e=this._colorAttachments.get(t);return e&&D(e)?e:null}attachColorTexture(t,e=o.COLOR_ATTACHMENT0){if(!t)return;this._validateColorAttachmentPoint(e);H(t.descriptor,this._desc),this._disposeColorAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,e)),this._colorAttachments.set(e,t)}detachColorTexture(t=o.COLOR_ATTACHMENT0){const e=this._colorAttachments.get(t);if(D(e)){const i=e;return this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t)),this._colorAttachments.delete(t),i}}setColorTextureTarget(t,e=o.COLOR_ATTACHMENT0){const i=this._colorAttachments.get(e);D(i)&&this._framebufferTexture2D(i.glName,e,t)}attachDepthStencilTexture(t){if(i(t))return;const e=t.descriptor;e.pixelFormat!==a.DEPTH_STENCIL&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),e.dataType!==l.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),H(e,this._desc),this._desc.depthStencilTarget&&this._desc.depthStencilTarget!==_.DEPTH_STENCIL_TEXTURE&&(this._desc.depthStencilTarget=_.DEPTH_STENCIL_TEXTURE),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,T)),this._depthStencilTexture=t}detachDepthStencilTexture(){const t=this._depthStencilTexture;return t&&this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,T)),this._depthStencilTexture=null,t}attachDepthStencilBuffer(t){if(i(t))return;const e=t.descriptor;if(e.internalFormat!==E.DEPTH_STENCIL&&e.internalFormat!==E.DEPTH_COMPONENT16&&console.error("Depth/Stencil buffer must have correct internalFormat"),P(e,this._desc),this._disposeDepthStencilAttachments(),this._desc.depthStencilTarget=e.internalFormat===E.DEPTH_STENCIL?_.DEPTH_STENCIL_RENDER_BUFFER:_.DEPTH_RENDER_BUFFER,this._initialized){this._context.bindFramebuffer(this);const e=this._context.gl,i=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(d.FRAMEBUFFER,i,e.RENDERBUFFER,t.glName)}this._depthAttachment=t}detachDepthStencilBuffer(){const t=this._context.gl,e=this._depthAttachment;if(e&&this._initialized){this._context.bindFramebuffer(this);const e=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(d.FRAMEBUFFER,e,t.RENDERBUFFER,null)}return this._depthAttachment=null,e}detachAll(){this._colorAttachments.forEach(((t,e)=>this._detachColorAttachment(e))),this.detachDepthStencilBuffer(),this.detachDepthStencilTexture()}copyToTexture(t,e,i,r,h,s,n){(t<0||e<0||h<0||s<0)&&console.error("Offsets cannot be negative!"),(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!");const c=this._desc,o=n.descriptor;n.descriptor.target!==u.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(t+i>c.width||e+r>c.height||h+i>o.width||s+r>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const _=this._context,a=_.bindTexture(n,F.TEXTURE_UNIT_FOR_UPDATES);_.setActiveTexture(F.TEXTURE_UNIT_FOR_UPDATES),_.bindFramebuffer(this),_.gl.copyTexSubImage2D(u.TEXTURE_2D,0,h,s,t,e,i,r),_.bindTexture(a,F.TEXTURE_UNIT_FOR_UPDATES)}readPixels(t,e,i,r,h,s,n){(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!"),n||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this);this._context.gl.readPixels(t,e,i,r,h,s,n)}async readPixelsAsync(t,e,i,s,c,o,_){if(this._context.type!==n.WEBGL2)return h()&&console.warn("Attempting to read pixels using pixel buffer object without WebGL2"),void this.readPixels(t,e,i,s,c,o,_);const a=this._context.gl,l=r.createPixelPack(this._context,f.STREAM_READ,_.byteLength);this._context.bindBuffer(l),this._context.bindFramebuffer(this),a.readPixels(t,e,i,s,c,o,0),this._context.unbindBuffer(m.PIXEL_PACK_BUFFER),await l.getSubDataAsync(_),l.dispose()}resize(t,e){const i=this._desc;if(i.width!==t||i.height!==e){if(!this._initialized)return i.width=t,i.height=e,this._colorAttachments.forEach((i=>{i&&i.resize(t,e)})),void(this._depthStencilTexture&&this._depthStencilTexture.resize(t,e));i.width=t,i.height=e,this._colorAttachments.forEach((i=>{i&&i.resize(t,e)})),null!=this._depthStencilTexture?this._depthStencilTexture.resize(t,e):(this._depthAttachment||this._stencilAttachment)&&(this._depthAttachment&&this._depthAttachment.resize(t,e),this._stencilAttachment&&this._stencilAttachment.resize(t,e)),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1}}initializeAndBind(t=d.FRAMEBUFFER){const e=this._context.gl;if(this._initialized)return void e.bindFramebuffer(t,this.glName);this._glName&&e.deleteFramebuffer(this._glName);const i=this._context,r=e.createFramebuffer(),h=this._desc,n=h.colorTarget??A.RENDER_BUFFER,c=h.width??1,T=h.height??1;if(e.bindFramebuffer(t,r),0===this._colorAttachments.size)if(n===A.TEXTURE||n===A.CUBEMAP)this._colorAttachments.set(o.COLOR_ATTACHMENT0,U(i,h,this.descriptor.colorTarget===A.CUBEMAP?u.TEXTURE_CUBE_MAP:u.TEXTURE_2D));else{const t=new N(i,{internalFormat:g.RGBA4,width:c,height:T});this._colorAttachments.set(o.COLOR_ATTACHMENT0,t)}this._colorAttachments.forEach(((i,r)=>{i&&(D(i)?this._framebufferTexture2D(i.glName,r,B(i),t):e.framebufferRenderbuffer(t,r,e.RENDERBUFFER,i.glName))}));const f=h.depthStencilTarget??_.NONE;switch(f){case _.DEPTH_RENDER_BUFFER:case _.DEPTH_STENCIL_RENDER_BUFFER:{this._depthAttachment||(this._depthAttachment=new N(i,{internalFormat:h.depthStencilTarget===_.DEPTH_RENDER_BUFFER?E.DEPTH_COMPONENT16:E.DEPTH_STENCIL,width:c,height:T}));const r=f===_.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(t,r,e.RENDERBUFFER,this._depthAttachment.glName);break}case _.STENCIL_RENDER_BUFFER:this._stencilAttachment||(this._stencilAttachment=new N(i,{internalFormat:E.STENCIL_INDEX8,width:c,height:T})),e.framebufferRenderbuffer(t,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,this._stencilAttachment.glName);break;case _.DEPTH_STENCIL_TEXTURE:if(!this._depthStencilTexture){i.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!");const t={target:u.TEXTURE_2D,pixelFormat:a.DEPTH_STENCIL,dataType:l.UNSIGNED_INT_24_8,samplingMode:p.NEAREST,wrapMode:R.CLAMP_TO_EDGE,width:c,height:T};this._depthStencilTexture=new F(i,t)}this._framebufferTexture2D(this._depthStencilTexture.glName,e.DEPTH_STENCIL_ATTACHMENT,B(this._depthStencilTexture),t)}if(s()){e.checkFramebufferStatus(t)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=r,this._initialized=!0}_framebufferTexture2D(t,e=o.COLOR_ATTACHMENT0,i=u.TEXTURE_2D,r=d.FRAMEBUFFER,h=0){this._context.gl.framebufferTexture2D(r,e,i,t,h)}_detachColorAttachment(t){h()&&console.warn("Detaching an FBO attachment can be a slow due to invalidating framebuffer completeness!");const e=this._context.gl,i=this._colorAttachments.get(t);return D(i)?this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t)):this._initialized&&(this._context.bindFramebuffer(this),e.framebufferRenderbuffer(d.FRAMEBUFFER,t,e.RENDERBUFFER,null)),this._colorAttachments.delete(t),i}_disposeColorAttachments(){this._colorAttachments.forEach(((t,e)=>{this._detachColorAttachment(e),t.dispose()})),this._colorAttachments.clear()}_disposeDepthStencilAttachments(){const t=this._context.gl;if(this._depthAttachment){if(this._initialized){this._context.bindFramebuffer(this);const e=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(d.FRAMEBUFFER,e,t.RENDERBUFFER,null)}this._depthAttachment.dispose(),this._depthAttachment=null}this._stencilAttachment&&(this._initialized&&(this._context.bindFramebuffer(this),t.framebufferRenderbuffer(d.FRAMEBUFFER,t.STENCIL_ATTACHMENT,t.RENDERBUFFER,null)),this._stencilAttachment.dispose(),this._stencilAttachment=null),this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture.dispose(),this._depthStencilTexture=null)}_validateColorAttachmentPoint(e){if(-1===b._MAX_COLOR_ATTACHMENTS){const t=this._context.capabilities.drawBuffers;if(t){const e=this._context.gl;b._MAX_COLOR_ATTACHMENTS=e.getParameter(t.MAX_COLOR_ATTACHMENTS)}else b._MAX_COLOR_ATTACHMENTS=1}const i=e-o.COLOR_ATTACHMENT0;i+1>b._MAX_COLOR_ATTACHMENTS&&t.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${i+1}. Implementation supports up to ${b._MAX_COLOR_ATTACHMENTS} color attachments`)}}function D(t){return"type"in t&&"texture"===t.type}function C(t){return"type"in t&&"renderbuffer"===t.type}function S(t){return D(t)||"pixelFormat"in t}function U(t,e,i){return new F(t,{target:i,pixelFormat:a.RGBA,dataType:l.UNSIGNED_BYTE,samplingMode:p.NEAREST,wrapMode:R.CLAMP_TO_EDGE,width:e.width,height:e.height})}function H(t,e){t.target!==u.TEXTURE_2D&&t.target!==u.TEXTURE_CUBE_MAP&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),void 0!==e.width&&e.width>=0&&void 0!==e.height&&e.height>=0?e.width===t.width&&e.height===t.height||console.error("Color attachment texture must match the framebuffer's!"):(e.width=t.width,e.height=t.height)}function P(t,e){void 0!==e.width&&e.width>=0&&void 0!==e.height&&e.height>=0?e.width===t.width&&e.height===t.height||console.error("Renderbuffer dimensions must match the framebuffer's!"):(e.width=t.width,e.height=t.height)}function B(t){return t.descriptor.target===u.TEXTURE_CUBE_MAP?u.TEXTURE_CUBE_MAP_POSITIVE_X:u.TEXTURE_2D}b._MAX_COLOR_ATTACHMENTS=-1;export{b as FramebufferObject};
|
|
5
|
+
import t from"../../core/Logger.js";import{isSome as e,isNone as i}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as h,webglValidateShadersEnabled as s}from"./checkWebGLError.js";import{ContextType as n}from"./context-util.js";import{ResourceType as c,ColorAttachment as o,DepthStencilTargetType as _,PixelFormat as a,PixelType as l,DepthStencilAttachment as T,RenderbufferFormat as E,FramebufferTarget as d,TextureType as u,Usage as f,BufferType as m,TargetType as A,SizedPixelFormat as p,TextureSamplingMode as R,TextureWrapMode as g}from"./enums.js";import{Renderbuffer as N}from"./Renderbuffer.js";import{Texture as F}from"./Texture.js";import{getGpuMemoryUsage as x}from"./Util.js";class b{constructor(t,i,r=null,h=null){if(this._context=t,this._glName=null,this._depthAttachment=null,this._stencilAttachment=null,this._colorAttachments=new Map,this._depthStencilTexture=null,this._initialized=!1,this._desc={...i},t.instanceCounter.increment(c.FramebufferObject,this),e(r)){Array.isArray(r)||(r=[r]);for(let t=0;t<r.length;++t){const e=r[t],i=o.COLOR_ATTACHMENT0+t;let h;S(e)?(D(e)?(h=e.descriptor,this._colorAttachments.set(i,e)):(h=e,this._colorAttachments.set(i,new F(this._context,h))),H(h,this._desc)):(C(e)?(h=e.descriptor,this._colorAttachments.set(i,e)):(h=e,this._colorAttachments.set(i,new N(this._context,h))),P(h,this._desc)),this._validateColorAttachmentPoint(i)}}if(e(h)){let t,e;if(S(h))this._context.capabilities.depthTexture||console.error("Setting the depth/stencil texture as an attachment requires WEBGL_depth_texture or WebGL2"),D(h)?(e=h.descriptor,this._depthStencilTexture=h):(e=h,this._depthStencilTexture=new F(this._context,e)),H(e,this._desc);else{C(h)?(e=h.descriptor,t=h):(e=h,t=new N(this._context,e));const i=this._desc.depthStencilTarget??_.DEPTH_STENCIL_RENDER_BUFFER;i===_.STENCIL_RENDER_BUFFER?this._stencilAttachment=t:i===_.DEPTH_RENDER_BUFFER||i===_.DEPTH_STENCIL_RENDER_BUFFER?this._depthAttachment=t:console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'),this._desc.depthStencilTarget=i,P(e,this._desc)}}}dispose(){if(!this._desc)return;const t=this._context.getBoundFramebufferObject();if(this._disposeColorAttachments(),this._disposeDepthStencilAttachments(),this._glName){this._context.gl.deleteFramebuffer(this._glName),this._glName=null}this._context.bindFramebuffer(t),this._context.instanceCounter.decrement(c.FramebufferObject,this),this._desc=null}get glName(){return this._glName}get descriptor(){return this._desc}get colorTexture(){const t=this._colorAttachments.get(o.COLOR_ATTACHMENT0);return t&&D(t)?t:null}get colorAttachment(){return this._colorAttachments.get(o.COLOR_ATTACHMENT0)}get depthStencilAttachment(){return this._depthStencilTexture||this._depthAttachment||this._stencilAttachment}get depthStencilTexture(){return this._depthStencilTexture}get width(){return this._desc.width??0}get height(){return this._desc.height??0}get gpuMemoryUsage(){return[...this._colorAttachments].reduce(((t,[e,i])=>t+x(i)),0)+x(this.depthStencilAttachment)}getColorTexture(t){const e=this._colorAttachments.get(t);return e&&D(e)?e:null}attachColorTexture(t,e=o.COLOR_ATTACHMENT0){if(!t)return;this._validateColorAttachmentPoint(e);H(t.descriptor,this._desc),this._disposeColorAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,e)),this._colorAttachments.set(e,t)}detachColorTexture(t=o.COLOR_ATTACHMENT0){const e=this._colorAttachments.get(t);if(D(e)){const i=e;return this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t)),this._colorAttachments.delete(t),i}}setColorTextureTarget(t,e=o.COLOR_ATTACHMENT0){const i=this._colorAttachments.get(e);D(i)&&this._framebufferTexture2D(i.glName,e,t)}attachDepthStencilTexture(t){if(i(t))return;const e=t.descriptor;e.pixelFormat!==a.DEPTH_STENCIL&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),e.dataType!==l.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),H(e,this._desc),this._desc.depthStencilTarget&&this._desc.depthStencilTarget!==_.DEPTH_STENCIL_TEXTURE&&(this._desc.depthStencilTarget=_.DEPTH_STENCIL_TEXTURE),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(t.glName,T)),this._depthStencilTexture=t}detachDepthStencilTexture(){const t=this._depthStencilTexture;return t&&this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,T)),this._depthStencilTexture=null,t}attachDepthStencilBuffer(t){if(i(t))return;const e=t.descriptor;if(e.internalFormat!==E.DEPTH_STENCIL&&e.internalFormat!==E.DEPTH_COMPONENT16&&console.error("Depth/Stencil buffer must have correct internalFormat"),P(e,this._desc),this._disposeDepthStencilAttachments(),this._desc.depthStencilTarget=e.internalFormat===E.DEPTH_STENCIL?_.DEPTH_STENCIL_RENDER_BUFFER:_.DEPTH_RENDER_BUFFER,this._initialized){this._context.bindFramebuffer(this);const e=this._context.gl,i=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(d.FRAMEBUFFER,i,e.RENDERBUFFER,t.glName)}this._depthAttachment=t}detachDepthStencilBuffer(){const t=this._context.gl,e=this._depthAttachment;if(e&&this._initialized){this._context.bindFramebuffer(this);const e=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(d.FRAMEBUFFER,e,t.RENDERBUFFER,null)}return this._depthAttachment=null,e}detachAll(){this._colorAttachments.forEach(((t,e)=>this._detachColorAttachment(e))),this.detachDepthStencilBuffer(),this.detachDepthStencilTexture()}copyToTexture(t,e,i,r,h,s,n){(t<0||e<0||h<0||s<0)&&console.error("Offsets cannot be negative!"),(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!");const c=this._desc,o=n.descriptor;n.descriptor.target!==u.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(null==c?.width||null==c?.height||null==o?.width||null==o?.height||t+i>c.width||e+r>c.height||h+i>o.width||s+r>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const _=this._context,a=_.bindTexture(n,F.TEXTURE_UNIT_FOR_UPDATES);_.setActiveTexture(F.TEXTURE_UNIT_FOR_UPDATES),_.bindFramebuffer(this),_.gl.copyTexSubImage2D(u.TEXTURE_2D,0,h,s,t,e,i,r),_.bindTexture(a,F.TEXTURE_UNIT_FOR_UPDATES)}readPixels(t,e,i,r,h,s,n){(i<=0||r<=0)&&console.error("Copy width and height must be greater than zero!"),n||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this);this._context.gl.readPixels(t,e,i,r,h,s,n)}async readPixelsAsync(t,e,i,s,c,o,_){if(this._context.type!==n.WEBGL2)return h()&&console.warn("Attempting to read pixels using pixel buffer object without WebGL2"),void this.readPixels(t,e,i,s,c,o,_);const a=this._context.gl,l=r.createPixelPack(this._context,f.STREAM_READ,_.byteLength);this._context.bindBuffer(l),this._context.bindFramebuffer(this),a.readPixels(t,e,i,s,c,o,0),this._context.unbindBuffer(m.PIXEL_PACK_BUFFER),await l.getSubDataAsync(_),l.dispose()}resize(t,e){const i=this._desc;if(i.width!==t||i.height!==e){if(!this._initialized)return i.width=t,i.height=e,this._colorAttachments.forEach((i=>{i&&i.resize(t,e)})),void(this._depthStencilTexture&&this._depthStencilTexture.resize(t,e));i.width=t,i.height=e,this._colorAttachments.forEach((i=>{i&&i.resize(t,e)})),null!=this._depthStencilTexture?this._depthStencilTexture.resize(t,e):(this._depthAttachment||this._stencilAttachment)&&(this._depthAttachment&&this._depthAttachment.resize(t,e),this._stencilAttachment&&this._stencilAttachment.resize(t,e)),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1}}initializeAndBind(t=d.FRAMEBUFFER){const e=this._context.gl;if(this._initialized)return void e.bindFramebuffer(t,this.glName);this._glName&&e.deleteFramebuffer(this._glName);const i=this._context,r=e.createFramebuffer(),h=this._desc,n=h.colorTarget??A.RENDER_BUFFER,c=h.width??1,T=h.height??1;if(e.bindFramebuffer(t,r),0===this._colorAttachments.size)if(n===A.TEXTURE||n===A.CUBEMAP)this._colorAttachments.set(o.COLOR_ATTACHMENT0,U(i,h,this.descriptor.colorTarget===A.CUBEMAP?u.TEXTURE_CUBE_MAP:u.TEXTURE_2D));else{const t=new N(i,{internalFormat:p.RGBA4,width:c,height:T});this._colorAttachments.set(o.COLOR_ATTACHMENT0,t)}this._colorAttachments.forEach(((i,r)=>{i&&(D(i)?this._framebufferTexture2D(i.glName,r,B(i),t):e.framebufferRenderbuffer(t,r,e.RENDERBUFFER,i.glName))}));const f=h.depthStencilTarget??_.NONE;switch(f){case _.DEPTH_RENDER_BUFFER:case _.DEPTH_STENCIL_RENDER_BUFFER:{this._depthAttachment||(this._depthAttachment=new N(i,{internalFormat:h.depthStencilTarget===_.DEPTH_RENDER_BUFFER?E.DEPTH_COMPONENT16:E.DEPTH_STENCIL,width:c,height:T}));const r=f===_.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(t,r,e.RENDERBUFFER,this._depthAttachment.glName);break}case _.STENCIL_RENDER_BUFFER:this._stencilAttachment||(this._stencilAttachment=new N(i,{internalFormat:E.STENCIL_INDEX8,width:c,height:T})),e.framebufferRenderbuffer(t,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,this._stencilAttachment.glName);break;case _.DEPTH_STENCIL_TEXTURE:if(!this._depthStencilTexture){i.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!");const t={target:u.TEXTURE_2D,pixelFormat:a.DEPTH_STENCIL,dataType:l.UNSIGNED_INT_24_8,samplingMode:R.NEAREST,wrapMode:g.CLAMP_TO_EDGE,width:c,height:T};this._depthStencilTexture=new F(i,t)}this._framebufferTexture2D(this._depthStencilTexture.glName,e.DEPTH_STENCIL_ATTACHMENT,B(this._depthStencilTexture),t)}if(s()){e.checkFramebufferStatus(t)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=r,this._initialized=!0}_framebufferTexture2D(t,e=o.COLOR_ATTACHMENT0,i=u.TEXTURE_2D,r=d.FRAMEBUFFER,h=0){this._context.gl.framebufferTexture2D(r,e,i,t,h)}_detachColorAttachment(t){h()&&console.warn("Detaching an FBO attachment can be a slow due to invalidating framebuffer completeness!");const e=this._context.gl,i=this._colorAttachments.get(t);return D(i)?this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t)):this._initialized&&(this._context.bindFramebuffer(this),e.framebufferRenderbuffer(d.FRAMEBUFFER,t,e.RENDERBUFFER,null)),this._colorAttachments.delete(t),i}_disposeColorAttachments(){this._colorAttachments.forEach(((t,e)=>{this._detachColorAttachment(e),t.dispose()})),this._colorAttachments.clear()}_disposeDepthStencilAttachments(){const t=this._context.gl;if(this._depthAttachment){if(this._initialized){this._context.bindFramebuffer(this);const e=this._desc.depthStencilTarget===_.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(d.FRAMEBUFFER,e,t.RENDERBUFFER,null)}this._depthAttachment.dispose(),this._depthAttachment=null}this._stencilAttachment&&(this._initialized&&(this._context.bindFramebuffer(this),t.framebufferRenderbuffer(d.FRAMEBUFFER,t.STENCIL_ATTACHMENT,t.RENDERBUFFER,null)),this._stencilAttachment.dispose(),this._stencilAttachment=null),this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,t.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture.dispose(),this._depthStencilTexture=null)}_validateColorAttachmentPoint(e){if(-1===b._MAX_COLOR_ATTACHMENTS){const t=this._context.capabilities.drawBuffers;if(t){const e=this._context.gl;b._MAX_COLOR_ATTACHMENTS=e.getParameter(t.MAX_COLOR_ATTACHMENTS)}else b._MAX_COLOR_ATTACHMENTS=1}const i=e-o.COLOR_ATTACHMENT0;i+1>b._MAX_COLOR_ATTACHMENTS&&t.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${i+1}. Implementation supports up to ${b._MAX_COLOR_ATTACHMENTS} color attachments`)}}function D(t){return null!=t&&"type"in t&&"texture"===t.type}function C(t){return null!=t&&"type"in t&&"renderbuffer"===t.type}function S(t){return D(t)||null!=t&&"pixelFormat"in t}function U(t,e,i){return new F(t,{target:i,pixelFormat:a.RGBA,dataType:l.UNSIGNED_BYTE,samplingMode:R.NEAREST,wrapMode:g.CLAMP_TO_EDGE,width:e.width,height:e.height})}function H(t,e){t.target!==u.TEXTURE_2D&&t.target!==u.TEXTURE_CUBE_MAP&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),void 0!==e.width&&e.width>=0&&void 0!==e.height&&e.height>=0?e.width===t.width&&e.height===t.height||console.error("Color attachment texture must match the framebuffer's!"):(e.width=t.width,e.height=t.height)}function P(t,e){void 0!==e.width&&e.width>=0&&void 0!==e.height&&e.height>=0?e.width===t.width&&e.height===t.height||console.error("Renderbuffer dimensions must match the framebuffer's!"):(e.width=t.width,e.height=t.height)}function B(t){return t.descriptor.target===u.TEXTURE_CUBE_MAP?u.TEXTURE_CUBE_MAP_POSITIVE_X:u.TEXTURE_2D}b._MAX_COLOR_ATTACHMENTS=-1;export{b as FramebufferObject};
|
package/views/webgl/Texture.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import{isPowerOfTwo as t}from"../../core/mathUtils.js";import{isSome as e,unwrap as i}from"../../core/maybe.js";import{checkWebGLError as r}from"./checkWebGLError.js";import{ContextType as a}from"./context-util.js";import{ResourceType as s,TextureType as o,TextureSamplingMode as n,TextureWrapMode as p,CompressedTextureFormat as h,PixelType as _,PixelFormat as l,SizedPixelFormat as m}from"./enums.js";import d from"./capabilities/isWebGL2Context.js";const c=4;class u{constructor(t,e,i=null){if(this._context=t,this.type="texture",this._glName=null,this._descriptor=void 0,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,t.instanceCounter.increment(s.Texture,this),this._descriptor={target:o.TEXTURE_2D,samplingMode:n.LINEAR,wrapMode:p.REPEAT,flipped:!1,hasMipmap:!1,isOpaque:!1,unpackAlignment:4,preMultiplyAlpha:!1,isImmutable:!1,...e},t.type!==a.WEBGL2&&(this._descriptor.isImmutable&&(this._descriptor.isImmutable=!1),A(this._descriptor.target)))throw new Error("3D and array textures are not supported in WebGL1");this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(i):this.setData(i)}get glName(){return this._glName}get descriptor(){return this._descriptor}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}dispose(){this._context.gl&&this._glName&&(this._context.unbindTexture(this),this._context.gl.deleteTexture(this._glName),this._glName=null,this._context.instanceCounter.decrement(s.Texture,this))}release(){this.dispose()}resize(t,e){const i=this._descriptor;if(i.width!==t||i.height!==e){if(this._wasImmutablyAllocated)throw new Error("Immutable textures can't be resized!");i.width=t,i.height=e,this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}_setDataCubeMap(t=null){for(let e=o.TEXTURE_CUBE_MAP_POSITIVE_X;e<=o.TEXTURE_CUBE_MAP_NEGATIVE_Z;e++)this._setData(t,e)}setData(t){this._setData(t)}_setData(t,i){if(!this._context||!this._context.gl)return;const a=this._context.gl;this._glName||(this._glName=a.createTexture()),void 0===t&&(t=null);const s=this._descriptor;i??(i=s.target);const o=A(i);null===t&&(s.width=s.width||c,s.height=s.height||c,o&&(s.depth=s.depth??1));const n=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),u._validateTexture(this._context,s),this._configurePixelStorage();const p=s.pixelFormat;let h=s.internalFormat?s.internalFormat:this._deriveInternalFormat(p,s.dataType);if(M(t)){let e=t.width,n=t.height;const p=1;t instanceof HTMLVideoElement&&(e=t.videoWidth,n=t.videoHeight),s.width&&s.height,o&&s.depth,s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(i,h,s.hasMipmap,e,n,p),this._texImage(i,0,h,e,n,p,t),r(a),s.hasMipmap&&this.generateMipmap(),void 0===s.width&&(s.width=e),void 0===s.height&&(s.height=n),o&&void 0===s.depth&&(s.depth=p)}else{const{width:n,height:p,depth:_}=s;if(null!=n&&null!=p||console.error("Width and height must be specified!"),o&&null==_&&console.error("Depth must be specified!"),s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(i,h,s.hasMipmap,n,p,_),a.DEPTH24_STENCIL8&&h===a.DEPTH_STENCIL&&(h=a.DEPTH24_STENCIL8),g(t)){const e=t.levels,r=I(i,n,p,_),o=Math.min(r-1,e.length-1);d(a)?a.texParameteri(s.target,a.TEXTURE_MAX_LEVEL,o):s.hasMipmap=s.hasMipmap&&r===e.length;const l=h;if(!T(l))throw new Error("Attempting to use compressed data with an umcompressed format!");this._forEachMipmapLevel(((t,r,a,s)=>{const o=e[Math.min(t,e.length-1)];this._compressedTexImage(i,t,l,r,a,s,o)}),o)}else e(t)?(this._texImage(i,0,h,n,p,_,t),r(a),s.hasMipmap&&this.generateMipmap()):this._forEachMipmapLevel(((t,e,s,o)=>{this._texImage(i,t,h,e,s,o,null),r(a)}))}u._applySamplingMode(a,this._descriptor),u._applyWrapMode(a,this._descriptor),u._applyAnisotropicFilteringParameters(this._context,this._descriptor),r(a),this._context.bindTexture(n,u.TEXTURE_UNIT_FOR_UPDATES)}updateData(t,e,i,r,a,s){s||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const o=this._context.gl,n=this._descriptor,{pixelFormat:p,internalFormat:h,dataType:_,isImmutable:l,target:m}=n;if(l&&!this._wasImmutablyAllocated)throw new Error("Cannot update immutable texture before allocation!");const d=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);(e<0||i<0||r>n.width||a>n.height||e+r>n.width||i+a>n.height)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),M(s)?o.texSubImage2D(m,t,e,i,p,_,s):g(s)?o.compressedTexSubImage2D(m,t,e,i,r,a,h,s.levels[t]):o.texSubImage2D(m,t,e,i,r,a,p,_,s),this._context.bindTexture(d,u.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,e,i,r,a,s,o,n){n||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const p=this._context.gl;if(!d(p))throw new Error("3D textures are not supported in WebGL1");const h=this._descriptor,{pixelFormat:_,dataType:l,isImmutable:m,target:c,internalFormat:E}=h;if(m&&!this._wasImmutablyAllocated)throw new Error("Cannot update immutable texture before allocation!");A(c)||console.warn("Attempting to set 3D texture data on a non-3D texture");const T=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);if(this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),(e<0||i<0||r<0||a>h.width||s>h.height||o>h.depth||e+a>h.width||i+s>h.height||r+o>h.depth)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),g(n))n=n.levels[t],p.compressedTexSubImage3D(c,t,e,i,r,a,s,o,E,n);else{const h=n;p.texSubImage3D(c,t,e,i,r,a,s,o,_,l,h)}this._context.bindTexture(T,u.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const t=this._descriptor;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new Error("Cannot add mipmaps to immutable texture after allocation");t.hasMipmap=!0,this._samplingModeDirty=!0,u._validateTexture(this._context,t)}t.samplingMode===n.LINEAR?(this._samplingModeDirty=!0,t.samplingMode=n.LINEAR_MIPMAP_NEAREST):t.samplingMode===n.NEAREST&&(this._samplingModeDirty=!0,t.samplingMode=n.NEAREST_MIPMAP_NEAREST);const e=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES);this._context.gl.generateMipmap(t.target),this._context.bindTexture(e,u.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,u._validateTexture(this._context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const t=this._context.gl,e=this._descriptor;this._samplingModeDirty&&(u._applySamplingMode(t,e),this._samplingModeDirty=!1),this._wrapModeDirty&&(u._applyWrapMode(t,e),this._wrapModeDirty=!1)}_deriveInternalFormat(t,e){if(this._context.type===a.WEBGL1)return t;switch(e){case _.FLOAT:switch(t){case l.RGBA:return m.RGBA32F;case l.RGB:return m.RGB32F;default:throw new Error("Unable to derive format")}case _.UNSIGNED_BYTE:switch(t){case l.RGBA:return m.RGBA8;case l.RGB:return m.RGB8}default:return t}}_configurePixelStorage(){const t=this._context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_texStorage(t,e,i,r,a,s){const o=this._context.gl;if(!d(o))throw new Error("Immutable textures are not supported in WebGL1");if(!E(e))throw new Error("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const n=i?I(t,r,a,s):1;A(t)?o.texStorage3D(t,n,e,r,a,s):o.texStorage2D(t,n,e,r,a),this._wasImmutablyAllocated=!0}_texImage(t,r,s,o,n,p,h){const _=this._context.gl;let l=null;const m=this._context.type===a.WEBGL2,d=A(t),{isImmutable:c,pixelFormat:u,dataType:E}=this._descriptor;if(m&&(l=_),m||!M(h))if(c){if(e(h)){const e=h;d?l.texSubImage3D(t,r,0,0,0,o,n,p,u,E,e):_.texSubImage2D(t,r,0,0,o,n,u,E,e)}}else{const e=i(h);d?l.texImage3D(t,r,s,o,n,p,0,u,E,e):_.texImage2D(t,r,s,o,n,0,u,E,e)}else _.texImage2D(t,0,s,u,E,h)}_compressedTexImage(t,i,r,s,o,n,p){const h=this._context.gl;let _=null;const l=A(t),m=this._descriptor.isImmutable;if(l){if(this._context.type!==a.WEBGL2)throw new Error("3D textures are not supported in WebGL1");_=h}m?e(p)&&(l?_.compressedTexSubImage3D(t,i,0,0,0,s,o,n,r,p):h.compressedTexSubImage2D(t,i,0,0,s,o,r,p)):l?_.compressedTexImage3D(t,i,r,s,o,n,0,p):h.compressedTexImage2D(t,i,r,s,o,0,p)}_forEachMipmapLevel(t,e=1/0){let{width:i,height:r,depth:a,hasMipmap:s,target:n}=this._descriptor;const p=n===o.TEXTURE_3D;for(let o=0;t(o,i,r,a),s&&(1!==i||1!==r||p&&1!==a)&&!(o>=e);++o)i=Math.max(1,i>>1),r=Math.max(1,r>>1),p&&(a=Math.max(1,a>>1))}static _validateTexture(e,i){(i.width<0||i.height<0||i.depth<0)&&console.error("Negative dimension parameters are not allowed!");const r=d(e.gl),a=t(i.width)&&t(i.height);r||!i.isImmutable&&!A(i.target)||console.error("Immutable and 3D-like textures are not supported in WebGL1!"),r||a||("number"==typeof i.wrapMode?i.wrapMode!==p.CLAMP_TO_EDGE&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):i.wrapMode.s===p.CLAMP_TO_EDGE&&i.wrapMode.t===p.CLAMP_TO_EDGE||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),i.hasMipmap&&console.error("Mipmapping requires power-of-two textures!"))}static _applySamplingMode(t,e){let i=e.samplingMode,r=e.samplingMode;i===n.LINEAR_MIPMAP_NEAREST||i===n.LINEAR_MIPMAP_LINEAR?(i=n.LINEAR,e.hasMipmap||(r=n.LINEAR)):i!==n.NEAREST_MIPMAP_NEAREST&&i!==n.NEAREST_MIPMAP_LINEAR||(i=n.NEAREST,e.hasMipmap||(r=n.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}static _applyWrapMode(t,e){"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}static _applyAnisotropicFilteringParameters(t,e){const i=t.capabilities.textureFilterAnisotropic;if(!i)return;t.gl.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}function E(t){return t in m}function T(t){return t in h}function g(t){return e(t)&&"type"in t&&"compressed"===t.type}function x(t){return e(t)&&"byteLength"in t}function M(t){return e(t)&&!g(t)&&!x(t)}function A(t){return t===o.TEXTURE_3D||t===o.TEXTURE_2D_ARRAY}function I(t,e,i,r=1){let a=Math.max(e,i);return t===o.TEXTURE_3D&&(a=Math.max(a,r)),Math.round(Math.log(a)/Math.LN2)+1}u.TEXTURE_UNIT_FOR_UPDATES=0;export{u as Texture};
|
|
5
|
+
import"../../core/has.js";import{isPowerOfTwo as t}from"../../core/mathUtils.js";import{isSome as e,unwrap as i}from"../../core/maybe.js";import{checkWebGLError as r}from"./checkWebGLError.js";import{ContextType as a}from"./context-util.js";import{ResourceType as s,TextureType as o,TextureSamplingMode as n,TextureWrapMode as p,PixelType as h,PixelFormat as _,SizedPixelFormat as l,CompressedTextureFormat as m}from"./enums.js";import d from"./capabilities/isWebGL2Context.js";const c=4;class u{constructor(t,e,i=null){if(this._context=t,this.type="texture",this._glName=null,this._descriptor=void 0,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,t.instanceCounter.increment(s.Texture,this),this._descriptor={target:o.TEXTURE_2D,samplingMode:n.LINEAR,wrapMode:p.REPEAT,flipped:!1,hasMipmap:!1,isOpaque:!1,unpackAlignment:4,preMultiplyAlpha:!1,isImmutable:!1,...e},t.type!==a.WEBGL2&&(this._descriptor.isImmutable&&(this._descriptor.isImmutable=!1),A(this._descriptor.target)))throw new Error("3D and array textures are not supported in WebGL1");this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(i):this.setData(i)}get glName(){return this._glName}get descriptor(){return this._descriptor}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}dispose(){this._context.gl&&this._glName&&(this._context.unbindTexture(this),this._context.gl.deleteTexture(this._glName),this._glName=null,this._context.instanceCounter.decrement(s.Texture,this))}release(){this.dispose()}resize(t,e){const i=this._descriptor;if(i.width!==t||i.height!==e){if(this._wasImmutablyAllocated)throw new Error("Immutable textures can't be resized!");i.width=t,i.height=e,this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}_setDataCubeMap(t=null){for(let e=o.TEXTURE_CUBE_MAP_POSITIVE_X;e<=o.TEXTURE_CUBE_MAP_NEGATIVE_Z;e++)this._setData(t,e)}setData(t){this._setData(t)}_setData(t,i){if(!this._context||!this._context.gl)return;const a=this._context.gl;this._glName||(this._glName=a.createTexture()),void 0===t&&(t=null);const s=this._descriptor;i??(i=s.target);const o=A(i);null===t&&(s.width=s.width||c,s.height=s.height||c,o&&(s.depth=s.depth??1));const n=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),u._validateTexture(this._context,s),this._configurePixelStorage();const p=s.pixelFormat;let h=s.internalFormat?s.internalFormat:this._deriveInternalFormat(p,s.dataType);if(M(t)){let e=t.width,n=t.height;const p=1;t instanceof HTMLVideoElement&&(e=t.videoWidth,n=t.videoHeight),s.width&&s.height,o&&s.depth,s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(i,h,s.hasMipmap,e,n,p),this._texImage(i,0,h,e,n,p,t),r(a),s.hasMipmap&&this.generateMipmap(),void 0===s.width&&(s.width=e),void 0===s.height&&(s.height=n),o&&void 0===s.depth&&(s.depth=p)}else{const{width:n,height:p,depth:_}=s;if(null!=n&&null!=p||console.error("Width and height must be specified!"),o&&null==_&&console.error("Depth must be specified!"),s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(i,h,s.hasMipmap,n,p,_),a.DEPTH24_STENCIL8&&h===a.DEPTH_STENCIL&&(h=a.DEPTH24_STENCIL8),g(t)){const e=t.levels,r=I(i,n,p,_),o=Math.min(r-1,e.length-1);d(a)?a.texParameteri(s.target,a.TEXTURE_MAX_LEVEL,o):s.hasMipmap=s.hasMipmap&&r===e.length;const l=h;if(!T(l))throw new Error("Attempting to use compressed data with an umcompressed format!");this._forEachMipmapLevel(((t,r,a,s)=>{const o=e[Math.min(t,e.length-1)];this._compressedTexImage(i,t,l,r,a,s,o)}),o)}else e(t)?(this._texImage(i,0,h,n,p,_,t),r(a),s.hasMipmap&&this.generateMipmap()):this._forEachMipmapLevel(((t,e,s,o)=>{this._texImage(i,t,h,e,s,o,null),r(a)}))}u._applySamplingMode(a,this._descriptor),u._applyWrapMode(a,this._descriptor),u._applyAnisotropicFilteringParameters(this._context,this._descriptor),r(a),this._context.bindTexture(n,u.TEXTURE_UNIT_FOR_UPDATES)}updateData(t,e,i,r,a,s){s||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const o=this._context.gl,n=this._descriptor,{pixelFormat:p,internalFormat:h,dataType:_,isImmutable:l,target:m}=n;if(l&&!this._wasImmutablyAllocated)throw new Error("Cannot update immutable texture before allocation!");const d=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);(e<0||i<0||r>n.width||a>n.height||e+r>n.width||i+a>n.height)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),M(s)?o.texSubImage2D(m,t,e,i,p,_,s):g(s)?o.compressedTexSubImage2D(m,t,e,i,r,a,h,s.levels[t]):o.texSubImage2D(m,t,e,i,r,a,p,_,s),this._context.bindTexture(d,u.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,e,i,r,a,s,o,n){n||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const p=this._context.gl;if(!d(p))throw new Error("3D textures are not supported in WebGL1");const h=this._descriptor,{pixelFormat:_,dataType:l,isImmutable:m,target:c,internalFormat:E}=h;if(m&&!this._wasImmutablyAllocated)throw new Error("Cannot update immutable texture before allocation!");A(c)||console.warn("Attempting to set 3D texture data on a non-3D texture");const T=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);if(this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),(e<0||i<0||r<0||a>h.width||s>h.height||o>h.depth||e+a>h.width||i+s>h.height||r+o>h.depth)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),g(n))n=n.levels[t],p.compressedTexSubImage3D(c,t,e,i,r,a,s,o,E,n);else{const h=n;p.texSubImage3D(c,t,e,i,r,a,s,o,_,l,h)}this._context.bindTexture(T,u.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const t=this._descriptor;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new Error("Cannot add mipmaps to immutable texture after allocation");t.hasMipmap=!0,this._samplingModeDirty=!0,u._validateTexture(this._context,t)}t.samplingMode===n.LINEAR?(this._samplingModeDirty=!0,t.samplingMode=n.LINEAR_MIPMAP_NEAREST):t.samplingMode===n.NEAREST&&(this._samplingModeDirty=!0,t.samplingMode=n.NEAREST_MIPMAP_NEAREST);const e=this._context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);this._context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES);this._context.gl.generateMipmap(t.target),this._context.bindTexture(e,u.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,u._validateTexture(this._context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const t=this._context.gl,e=this._descriptor;this._samplingModeDirty&&(u._applySamplingMode(t,e),this._samplingModeDirty=!1),this._wrapModeDirty&&(u._applyWrapMode(t,e),this._wrapModeDirty=!1)}_deriveInternalFormat(t,e){if(this._context.type===a.WEBGL1)return t;switch(e){case h.FLOAT:switch(t){case _.RGBA:return l.RGBA32F;case _.RGB:return l.RGB32F;default:throw new Error("Unable to derive format")}case h.UNSIGNED_BYTE:switch(t){case _.RGBA:return l.RGBA8;case _.RGB:return l.RGB8}default:return t}}_configurePixelStorage(){const t=this._context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_texStorage(t,e,i,r,a,s){const o=this._context.gl;if(!d(o))throw new Error("Immutable textures are not supported in WebGL1");if(!E(e))throw new Error("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const n=i?I(t,r,a,s):1;A(t)?o.texStorage3D(t,n,e,r,a,s):o.texStorage2D(t,n,e,r,a),this._wasImmutablyAllocated=!0}_texImage(t,r,s,o,n,p,h){const _=this._context.gl;let l=null;const m=this._context.type===a.WEBGL2,d=A(t),{isImmutable:c,pixelFormat:u,dataType:E}=this._descriptor;if(m&&(l=_),m||!M(h))if(c){if(e(h)){const e=h;d?l.texSubImage3D(t,r,0,0,0,o,n,p,u,E,e):_.texSubImage2D(t,r,0,0,o,n,u,E,e)}}else{const e=i(h);d?l.texImage3D(t,r,s,o,n,p,0,u,E,e):_.texImage2D(t,r,s,o,n,0,u,E,e)}else _.texImage2D(t,0,s,u,E,h)}_compressedTexImage(t,i,r,s,o,n,p){const h=this._context.gl;let _=null;const l=A(t),m=this._descriptor.isImmutable;if(l){if(this._context.type!==a.WEBGL2)throw new Error("3D textures are not supported in WebGL1");_=h}m?e(p)&&(l?_.compressedTexSubImage3D(t,i,0,0,0,s,o,n,r,p):h.compressedTexSubImage2D(t,i,0,0,s,o,r,p)):l?_.compressedTexImage3D(t,i,r,s,o,n,0,p):h.compressedTexImage2D(t,i,r,s,o,0,p)}_forEachMipmapLevel(t,e=1/0){let{width:i,height:r,depth:a,hasMipmap:s,target:n}=this._descriptor;const p=n===o.TEXTURE_3D;for(let o=0;t(o,i,r,a),s&&(1!==i||1!==r||p&&1!==a)&&!(o>=e);++o)i=Math.max(1,i>>1),r=Math.max(1,r>>1),p&&(a=Math.max(1,a>>1))}static _validateTexture(e,i){(i.width<0||i.height<0||i.depth<0)&&console.error("Negative dimension parameters are not allowed!");const r=d(e.gl),a=t(i.width)&&t(i.height);r||!i.isImmutable&&!A(i.target)||console.error("Immutable and 3D-like textures are not supported in WebGL1!"),r||a||("number"==typeof i.wrapMode?i.wrapMode!==p.CLAMP_TO_EDGE&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):i.wrapMode.s===p.CLAMP_TO_EDGE&&i.wrapMode.t===p.CLAMP_TO_EDGE||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),i.hasMipmap&&console.error("Mipmapping requires power-of-two textures!"))}static _applySamplingMode(t,e){let i=e.samplingMode,r=e.samplingMode;i===n.LINEAR_MIPMAP_NEAREST||i===n.LINEAR_MIPMAP_LINEAR?(i=n.LINEAR,e.hasMipmap||(r=n.LINEAR)):i!==n.NEAREST_MIPMAP_NEAREST&&i!==n.NEAREST_MIPMAP_LINEAR||(i=n.NEAREST,e.hasMipmap||(r=n.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}static _applyWrapMode(t,e){"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}static _applyAnisotropicFilteringParameters(t,e){const i=t.capabilities.textureFilterAnisotropic;if(!i)return;t.gl.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}function E(t){return t in l}function T(t){return t in m}function g(t){return e(t)&&"type"in t&&"compressed"===t.type}function x(t){return e(t)&&"byteLength"in t}function M(t){return e(t)&&!g(t)&&!x(t)}function A(t){return t===o.TEXTURE_3D||t===o.TEXTURE_2D_ARRAY}function I(t,e,i,r=1){let a=Math.max(e,i);return t===o.TEXTURE_3D&&(a=Math.max(a,r)),Math.round(Math.log(a)/Math.LN2)+1}u.TEXTURE_UNIT_FOR_UPDATES=0;export{u as Texture};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createDisjointTimerQuery as t}from"./DisjointTimerQuery.js";import{load as e}from"./DrawBuffers.js";import{load as s}from"./Instancing.js";import{loadCompressedTextureETC as i,loadCompressedTextureS3TC as r,loadTextureFilterAnisotropicCapability as n,loadTextureFloat as h,loadColorBufferFloat as
|
|
5
|
+
import{createDisjointTimerQuery as t}from"./DisjointTimerQuery.js";import{load as e}from"./DrawBuffers.js";import{load as s}from"./Instancing.js";import{loadCompressedTextureETC as i,loadCompressedTextureS3TC as r,loadTextureFilterAnisotropicCapability as n,loadTextureFloat as h,loadColorBufferFloat as l,loadMinMaxBlending as _,loadBooleanExtension as o,loadTextureNorm16 as a}from"./load.js";import{load as u}from"./LoseContext.js";import{load as d}from"./VertexArrayObjects.js";class x{constructor(t,e){this._gl=t,this._instancing=null,this._vertexArrayObject=null,this._compressedTextureETC=null,this._compressedTextureS3TC=null,this._textureFilterAnisotropic=null,this._textureFloat=null,this._colorBufferFloat=null,this._minMaxBlending=null,this._loseContext=null,this._drawBuffers=null,this._textureNorm16=null,this._depthTexture=null,this._standardDerivatives=null,this._shaderTextureLOD=null,this._fragDepth=null,this._textureFloatLinear=null,this._disabledExtensions=e.disabledExtensions||{},this._debugWebGLExtensions=e.debugWebGLExtensions||{}}get drawBuffers(){return this._drawBuffers||(this._drawBuffers=e(this._gl,this._disabledExtensions)),this._drawBuffers}get instancing(){return this._instancing||(this._instancing=s(this._gl)),this._instancing}get vao(){return this._vertexArrayObject||(this._vertexArrayObject=d(this._gl,this._disabledExtensions)),this._vertexArrayObject}get compressedTextureETC(){return this._compressedTextureETC||(this._compressedTextureETC=i(this._gl,this._disabledExtensions)),this._compressedTextureETC}get compressedTextureS3TC(){return this._compressedTextureS3TC||(this._compressedTextureS3TC=r(this._gl,this._disabledExtensions)),this._compressedTextureS3TC}get textureFilterAnisotropic(){return this._textureFilterAnisotropic||(this._textureFilterAnisotropic=n(this._gl,this._disabledExtensions)),this._textureFilterAnisotropic}get disjointTimerQuery(){return this._disjointTimerQuery||(this._disjointTimerQuery=t(this._gl,this._disabledExtensions)),this._disjointTimerQuery}get textureFloat(){return this._textureFloat||(this._textureFloat=h(this._gl,this._disabledExtensions)),this._textureFloat}get colorBufferFloat(){return this._colorBufferFloat||(this._colorBufferFloat=l(this._gl,this._disabledExtensions)),this._colorBufferFloat}get blendMinMax(){return this._minMaxBlending||(this._minMaxBlending=_(this._gl,this._disabledExtensions)),this._minMaxBlending}get depthTexture(){return null===this._depthTexture&&(this._depthTexture=o(this._gl,this._disabledExtensions,"depthTexture",!0,["WEBGL_depth_texture","MOZ_WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"])),this._depthTexture}get standardDerivatives(){return null===this._standardDerivatives&&(this._standardDerivatives=o(this._gl,this._disabledExtensions,"standardDerivatives",!0,["OES_standard_derivatives"])),this._standardDerivatives}get shaderTextureLOD(){return null===this._shaderTextureLOD&&(this._shaderTextureLOD=o(this._gl,this._disabledExtensions,"shaderTextureLOD",!0,["EXT_shader_texture_lod"])),this._shaderTextureLOD}get fragDepth(){return null===this._fragDepth&&(this._fragDepth=o(this._gl,this._disabledExtensions,"fragDepth",!0,["EXT_frag_depth"])),this._fragDepth}get loseContext(){return this._loseContext||(this._loseContext=u(this._gl,this._debugWebGLExtensions)),this._loseContext}get textureNorm16(){return this._textureNorm16||(this._textureNorm16=a(this._gl,this._disabledExtensions)),this._textureNorm16}get textureFloatLinear(){return null===this._textureFloatLinear&&(this._textureFloatLinear=o(this._gl,this._disabledExtensions,"textureFloatLinear",!1,["OES_texture_float_linear"])),this._textureFloatLinear}enable(t){return this[t]}}export{x as Capabilities};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as t,isSome as e}from"../../core/maybe.js";import{getContextTypes as r,ContextType as
|
|
5
|
+
import{isNone as t,isSome as e}from"../../core/maybe.js";import{getContextTypes as r,ContextType as s,createContext as o}from"./context-util.js";let n,a;function l(t){const e=r(t);for(;e.length>1;){const t=u(e.shift());if(t.available)return t}return u(e.shift())}function u(t){switch(t){case s.WEBGL1:return i();case s.WEBGL2:return f()}}function i(){return n||(n=d()),n}function f(){return a||(a=x()),a}class p{constructor(){this.available=!1,this.majorPerformanceCaveat=!1,this.maxTextureSize=0,this.supportsVertexShaderSamplers=!1,this.supportsHighPrecisionFragment=!1,this.supportsElementIndexUint=!1,this.supportsStandardDerivatives=!1,this.supportsInstancedArrays=!1,this.supportsTextureFloat=!1,this.supportsTextureHalfFloat=!1,this.supportsColorBufferFloat=!1,this.supportsColorBufferFloatBlend=!1,this.supportsColorBufferHalfFloat=!1}}class c extends p{constructor(){super(...arguments),this.type=s.WEBGL1}}class E extends p{constructor(){super(...arguments),this.type=s.WEBGL2,this.supportsElementIndexUint=!0,this.supportsStandardDerivatives=!0,this.supportsInstancedArrays=!0,this.supportsTextureFloat=!0,this.supportsTextureHalfFloat=!0}}function _(r,n){if(r===s.WEBGL1&&"undefined"==typeof WebGLRenderingContext||r===s.WEBGL2&&"undefined"==typeof WebGL2RenderingContext)return null;const a=document.createElement("canvas");if(!a)return null;let l=o(a,r,{failIfMajorPerformanceCaveat:!0});if(t(l)&&(l=o(a,r),e(l)&&(n.majorPerformanceCaveat=!0)),t(l))return l;if(r===s.WEBGL1){const t=l.getParameter(l.VERSION)?.match(/^WebGL\s+([\d.]*)/);if(t){const e=parseFloat(t[1]);n.available=e>=.94}}else n.available=!0;n.maxTextureSize=l.getParameter(l.MAX_TEXTURE_SIZE),n.supportsVertexShaderSamplers=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;const u=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT);return u&&(n.supportsHighPrecisionFragment=u.precision>0),l}function d(){const e=new c,r=_(s.WEBGL1,e);return t(r)||(e.supportsElementIndexUint=null!==r.getExtension("OES_element_index_uint"),e.supportsStandardDerivatives=null!==r.getExtension("OES_standard_derivatives"),e.supportsInstancedArrays=null!==r.getExtension("ANGLE_instanced_arrays"),e.supportsTextureFloat=null!==r.getExtension("OES_texture_float"),e.supportsTextureHalfFloat=null!==r.getExtension("OES_texture_half_float"),e.supportsColorBufferFloat=null!==r.getExtension("WEBGL_color_buffer_float"),e.supportsColorBufferFloatBlend=null!==r.getExtension("EXT_float_blend"),e.supportsColorBufferHalfFloat=null!==r.getExtension("EXT_color_buffer_half_float")),e}function x(){const e=new E,r=_(s.WEBGL2,e);return t(r)||(e.supportsColorBufferFloat=null!==r.getExtension("EXT_color_buffer_float"),e.supportsColorBufferFloatBlend=null!==r.getExtension("EXT_float_blend"),e.supportsColorBufferHalfFloat=e.supportsColorBufferFloat||null!==r.getExtension("EXT_color_buffer_half_float")),e}export{i as getWebGL1Capabilities,f as getWebGL2Capabilities,l as getWebGLCapabilities,u as getWebGLVersionCapabilities};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{CullFaceOptions as t}from"../3d/webgl-engine/lib/basicInterfaces.js";import{Face as e,CullMode as i,BlendOperation as n}from"./enums.js";function s(t,e,i=n.ADD,s=[0,0,0,0]){return{srcRgb:t,srcAlpha:t,dstRgb:e,dstAlpha:e,opRgb:i,opAlpha:i,color:{r:s[0],g:s[1],b:s[2],a:s[3]}}}function l(t,e,i,s,l=n.ADD,r=n.ADD,o=[0,0,0,0]){return{srcRgb:t,srcAlpha:e,dstRgb:i,dstAlpha:s,opRgb:l,opAlpha:r,color:{r:o[0],g:o[1],b:o[2],a:o[3]}}}const r={face:e.BACK,mode:i.CCW},o={face:e.FRONT,mode:i.CCW},h=e=>e===t.Back?r:e===t.Front?o:null,a={zNear:0,zFar:1},_={r:!0,g:!0,b:!0,a:!0};function c(t){return T.intern(t)}function d(t){return D.intern(t)}function p(t){return C.intern(t)}function u(t){return A.intern(t)}function g(t){return w.intern(t)}function f(t){return B.intern(t)}function v(t){return z.intern(t)}function I(t){return j.intern(t)}function W(t){return N.intern(t)}class S{constructor(t,e){this._makeKey=t,this._makeRef=e,this._interns=new Map}intern(t){if(!t)return null;const e=this._makeKey(t),i=this._interns;return i.has(e)||i.set(e,this._makeRef(t)),i.get(e)}}function b(t){return"["+t.join(",")+"]"}const T=new S(y,(t=>({__tag:"Blending",...t})));function y(t){return t?b([t.srcRgb,t.srcAlpha,t.dstRgb,t.dstAlpha,t.opRgb,t.opAlpha,t.color.r,t.color.g,t.color.b,t.color.a]):null}const D=new S(O,(t=>({__tag:"Culling",...t})));function O(t){return t?b([t.face,t.mode]):null}const C=new S(m,(t=>({__tag:"PolygonOffset",...t})));function m(t){return t?b([t.factor,t.units]):null}const A=new S(R,(t=>({__tag:"DepthTest",...t})));function R(t){return t?b([t.func]):null}const w=new S(k,(t=>({__tag:"StencilTest",...t})));function k(t){return t?b([t.function.func,t.function.ref,t.function.mask,t.operation.fail,t.operation.zFail,t.operation.zPass]):null}const B=new S(P,(t=>({__tag:"DepthWrite",...t})));function P(t){return t?b([t.zNear,t.zFar]):null}const z=new S(F,(t=>({__tag:"ColorWrite",...t})));function F(t){return t?b([t.r,t.g,t.b,t.a]):null}const j=new S(K,(t=>({__tag:"StencilWrite",...t})));function K(t){return t?b([t.mask]):null}const N=new S(x,(t=>({blending:c(t.blending),culling:d(t.culling),polygonOffset:p(t.polygonOffset),depthTest:u(t.depthTest),stencilTest:g(t.stencilTest),depthWrite:f(t.depthWrite),colorWrite:v(t.colorWrite),stencilWrite:I(t.stencilWrite)})));function x(t){return t?b([y(t.blending),O(t.culling),m(t.polygonOffset),R(t.depthTest),k(t.stencilTest),P(t.depthWrite),F(t.colorWrite),K(t.stencilWrite)]):null}class M{constructor(t){this._pipelineInvalid=!0,this._blendingInvalid=!0,this._cullingInvalid=!0,this._polygonOffsetInvalid=!0,this._depthTestInvalid=!0,this._stencilTestInvalid=!0,this._depthWriteInvalid=!0,this._colorWriteInvalid=!0,this._stencilWriteInvalid=!0,this._stateSetters=t}setPipeline(t){(this._pipelineInvalid||t!==this._pipeline)&&(this._setBlending(t.blending),this._setCulling(t.culling),this._setPolygonOffset(t.polygonOffset),this._setDepthTest(t.depthTest),this._setStencilTest(t.stencilTest),this._setDepthWrite(t.depthWrite),this._setColorWrite(t.colorWrite),this._setStencilWrite(t.stencilWrite),this._pipeline=t),this._pipelineInvalid=!1}invalidateBlending(){this._blendingInvalid=!0,this._pipelineInvalid=!0}invalidateCulling(){this._cullingInvalid=!0,this._pipelineInvalid=!0}invalidatePolygonOffset(){this._polygonOffsetInvalid=!0,this._pipelineInvalid=!0}invalidateDepthTest(){this._depthTestInvalid=!0,this._pipelineInvalid=!0}invalidateStencilTest(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}invalidateDepthWrite(){this._depthWriteInvalid=!0,this._pipelineInvalid=!0}invalidateColorWrite(){this._colorWriteInvalid=!0,this._pipelineInvalid=!0}invalidateStencilWrite(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}_setBlending(t){this._blending=this._setSubState(t,this._blending,this._blendingInvalid,this._stateSetters.setBlending),this._blendingInvalid=!1}_setCulling(t){this._culling=this._setSubState(t,this._culling,this._cullingInvalid,this._stateSetters.setCulling),this._cullingInvalid=!1}_setPolygonOffset(t){this._polygonOffset=this._setSubState(t,this._polygonOffset,this._polygonOffsetInvalid,this._stateSetters.setPolygonOffset),this._polygonOffsetInvalid=!1}_setDepthTest(t){this._depthTest=this._setSubState(t,this._depthTest,this._depthTestInvalid,this._stateSetters.setDepthTest),this._depthTestInvalid=!1}_setStencilTest(t){this._stencilTest=this._setSubState(t,this._stencilTest,this._stencilTestInvalid,this._stateSetters.setStencilTest),this._stencilTestInvalid=!1}_setDepthWrite(t){this._depthWrite=this._setSubState(t,this._depthWrite,this._depthWriteInvalid,this._stateSetters.setDepthWrite),this._depthWriteInvalid=!1}_setColorWrite(t){this._colorWrite=this._setSubState(t,this._colorWrite,this._colorWriteInvalid,this._stateSetters.setColorWrite),this._colorWriteInvalid=!1}_setStencilWrite(t){this._stencilWrite=this._setSubState(t,this._stencilWrite,this._stencilWriteInvalid,this._stateSetters.setStencilWrite),this._stencilTestInvalid=!1}_setSubState(t,e,i,n){return(i||t!==e)&&(n(t),this._pipelineInvalid=!0),t}}export{M as StateTracker,r as backFaceCullingParams,h as cullingParams,_ as defaultColorWriteParams,a as defaultDepthWriteParams,o as frontFaceCullingParams,c as makeBlending,v as makeColorWrite,d as makeCulling,u as makeDepthTest,f as makeDepthWrite,W as makePipelineState,p as makePolygonOffset,g as makeStencilTest,I as makeStencilWrite,l as separateBlendingParams,s as simpleBlendingParams};
|
|
5
|
+
import{CullFaceOptions as t}from"../3d/webgl-engine/lib/basicInterfaces.js";import{Face as e,CullMode as i,BlendOperation as n}from"./enums.js";function s(t,e,i=n.ADD,s=[0,0,0,0]){return{srcRgb:t,srcAlpha:t,dstRgb:e,dstAlpha:e,opRgb:i,opAlpha:i,color:{r:s[0],g:s[1],b:s[2],a:s[3]}}}function l(t,e,i,s,l=n.ADD,r=n.ADD,o=[0,0,0,0]){return{srcRgb:t,srcAlpha:e,dstRgb:i,dstAlpha:s,opRgb:l,opAlpha:r,color:{r:o[0],g:o[1],b:o[2],a:o[3]}}}const r={face:e.BACK,mode:i.CCW},o={face:e.FRONT,mode:i.CCW},h=e=>e===t.Back?r:e===t.Front?o:null,a={zNear:0,zFar:1},_={r:!0,g:!0,b:!0,a:!0};function c(t){return T.intern(t)}function d(t){return D.intern(t)}function p(t){return C.intern(t)}function u(t){return A.intern(t)}function g(t){return w.intern(t)}function f(t){return B.intern(t)}function v(t){return z.intern(t)}function I(t){return j.intern(t)}function W(t){return N.intern(t)}class S{constructor(t,e){this._makeKey=t,this._makeRef=e,this._interns=new Map}intern(t){if(!t)return null;const e=this._makeKey(t),i=this._interns;return i.has(e)||i.set(e,this._makeRef(t)),i.get(e)??null}}function b(t){return"["+t.join(",")+"]"}const T=new S(y,(t=>({__tag:"Blending",...t})));function y(t){return t?b([t.srcRgb,t.srcAlpha,t.dstRgb,t.dstAlpha,t.opRgb,t.opAlpha,t.color.r,t.color.g,t.color.b,t.color.a]):null}const D=new S(O,(t=>({__tag:"Culling",...t})));function O(t){return t?b([t.face,t.mode]):null}const C=new S(m,(t=>({__tag:"PolygonOffset",...t})));function m(t){return t?b([t.factor,t.units]):null}const A=new S(R,(t=>({__tag:"DepthTest",...t})));function R(t){return t?b([t.func]):null}const w=new S(k,(t=>({__tag:"StencilTest",...t})));function k(t){return t?b([t.function.func,t.function.ref,t.function.mask,t.operation.fail,t.operation.zFail,t.operation.zPass]):null}const B=new S(P,(t=>({__tag:"DepthWrite",...t})));function P(t){return t?b([t.zNear,t.zFar]):null}const z=new S(F,(t=>({__tag:"ColorWrite",...t})));function F(t){return t?b([t.r,t.g,t.b,t.a]):null}const j=new S(K,(t=>({__tag:"StencilWrite",...t})));function K(t){return t?b([t.mask]):null}const N=new S(x,(t=>({blending:c(t.blending),culling:d(t.culling),polygonOffset:p(t.polygonOffset),depthTest:u(t.depthTest),stencilTest:g(t.stencilTest),depthWrite:f(t.depthWrite),colorWrite:v(t.colorWrite),stencilWrite:I(t.stencilWrite)})));function x(t){return t?b([y(t.blending),O(t.culling),m(t.polygonOffset),R(t.depthTest),k(t.stencilTest),P(t.depthWrite),F(t.colorWrite),K(t.stencilWrite)]):null}class M{constructor(t){this._pipelineInvalid=!0,this._blendingInvalid=!0,this._cullingInvalid=!0,this._polygonOffsetInvalid=!0,this._depthTestInvalid=!0,this._stencilTestInvalid=!0,this._depthWriteInvalid=!0,this._colorWriteInvalid=!0,this._stencilWriteInvalid=!0,this._stateSetters=t}setPipeline(t){(this._pipelineInvalid||t!==this._pipeline)&&(this._setBlending(t.blending),this._setCulling(t.culling),this._setPolygonOffset(t.polygonOffset),this._setDepthTest(t.depthTest),this._setStencilTest(t.stencilTest),this._setDepthWrite(t.depthWrite),this._setColorWrite(t.colorWrite),this._setStencilWrite(t.stencilWrite),this._pipeline=t),this._pipelineInvalid=!1}invalidateBlending(){this._blendingInvalid=!0,this._pipelineInvalid=!0}invalidateCulling(){this._cullingInvalid=!0,this._pipelineInvalid=!0}invalidatePolygonOffset(){this._polygonOffsetInvalid=!0,this._pipelineInvalid=!0}invalidateDepthTest(){this._depthTestInvalid=!0,this._pipelineInvalid=!0}invalidateStencilTest(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}invalidateDepthWrite(){this._depthWriteInvalid=!0,this._pipelineInvalid=!0}invalidateColorWrite(){this._colorWriteInvalid=!0,this._pipelineInvalid=!0}invalidateStencilWrite(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}_setBlending(t){this._blending=this._setSubState(t,this._blending,this._blendingInvalid,this._stateSetters.setBlending),this._blendingInvalid=!1}_setCulling(t){this._culling=this._setSubState(t,this._culling,this._cullingInvalid,this._stateSetters.setCulling),this._cullingInvalid=!1}_setPolygonOffset(t){this._polygonOffset=this._setSubState(t,this._polygonOffset,this._polygonOffsetInvalid,this._stateSetters.setPolygonOffset),this._polygonOffsetInvalid=!1}_setDepthTest(t){this._depthTest=this._setSubState(t,this._depthTest,this._depthTestInvalid,this._stateSetters.setDepthTest),this._depthTestInvalid=!1}_setStencilTest(t){this._stencilTest=this._setSubState(t,this._stencilTest,this._stencilTestInvalid,this._stateSetters.setStencilTest),this._stencilTestInvalid=!1}_setDepthWrite(t){this._depthWrite=this._setSubState(t,this._depthWrite,this._depthWriteInvalid,this._stateSetters.setDepthWrite),this._depthWriteInvalid=!1}_setColorWrite(t){this._colorWrite=this._setSubState(t,this._colorWrite,this._colorWriteInvalid,this._stateSetters.setColorWrite),this._colorWriteInvalid=!1}_setStencilWrite(t){this._stencilWrite=this._setSubState(t,this._stencilWrite,this._stencilWriteInvalid,this._stateSetters.setStencilWrite),this._stencilTestInvalid=!1}_setSubState(t,e,i,n){return(i||t!==e)&&(n(t),this._pipelineInvalid=!0),t}}export{M as StateTracker,r as backFaceCullingParams,h as cullingParams,_ as defaultColorWriteParams,a as defaultDepthWriteParams,o as frontFaceCullingParams,c as makeBlending,v as makeColorWrite,d as makeCulling,u as makeDepthTest,f as makeDepthWrite,W as makePipelineState,p as makePolygonOffset,g as makeStencilTest,I as makeStencilWrite,l as separateBlendingParams,s as simpleBlendingParams};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Basemap.js";import t from"../../Ground.js";import n from"../../WebScene.js";import"../../core/has.js";import{
|
|
5
|
+
import e from"../../Basemap.js";import t from"../../Ground.js";import n from"../../WebScene.js";import"../../core/has.js";import{isLongFormType as r,Integer as a}from"../../core/accessorSupport/ensureType.js";import{isCollection as p}from"../../core/accessorSupport/extensions/serializableProperty/type.js";import o from"../../layers/GroupLayer.js";import s from"../../layers/KMLLayer.js";import{typeModuleMap as y}from"../../layers/mixins/operationalLayerModuleMap.js";import{supportedTypes as u}from"../../layers/mixins/operationalLayers.js";import l from"../../layers/support/Sublayer.js";import{JoinTableDataSource as i,DataLayerSource as c}from"../../layers/support/source/DataLayerSource.js";import{MapLayerSource as m}from"../../layers/support/source/MapLayerSource.js";import{ScanContext as f}from"./utils.js";async function d(e){return S(null,{typeName:"json",type:e},new f)}async function b(e,t,n){switch(t.typeName){case"array":await v(e,t,n);break;case"union":await k(e,t,n);break;case"json":await S(e,t,n);break;case"native":await w(e,t,n);break;case"enum":await j(e,t,n)}}async function w(e,t,n){n.addProperty({name:e,type:_(t),default:t.default})}function N(e){const t=e.slice();return t.sort(),t}async function j(e,t,n){const r=t.values.slice();t.nullable&&r.push(null),n.currentClass&&n.currentClass.typeValue&&"type"===e?n.addProperty({name:e,type:"string",enum:`"${n.currentClass.typeValue}"`}):n.addProperty({name:e,type:_(t),enum:N(r).map((e=>"string"==typeof e?`"${e}"`:`${e}`)).join("|"),default:t.default})}async function v(e,t,n){await b(`${e}[]`,t.elementType,n)}function g(e,t){if("json"===e.typeName){const t=e.type.__accessorMetadata__,n=t&&t.properties&&t.properties&&t.properties.type,r=n&&E(n),a=r&&r.type,p=a||n&&n.type;if(p&&Array.isArray(p)&&1===p.length&&"string"==typeof p[0])return a?p[0]:I(n,p[0])}return t}async function k(e,t,n){const r=[];for(const a of t.types)if("native"!==a.type.typeName&&t.key){const t=`${e}<${g(a.type,a.value)}>`;await b(t,a.type,n)}else r.push(a.type);if(r.length){const a=r.map(_);t.nullable&&a.push("null"),a.sort(),n.addProperty({type:a.join("|"),name:e,default:t.default})}}async function h(r,a){return r.type===n&&"layers"===a?P("web-scene/operational-layers"):r.type!==e||"baseLayers"!==a&&"baseMapLayers"!==a?r.type===e&&"elevationLayers"===a||r.type===t&&"layers"===a?P("web-scene/ground"):r.type===o&&"layers"===a?P("web-scene/operational-layers",(e=>e!==o)):r.type!==i||"leftTableSource"!==a&&"rightTableSource"!==a?null:B({key:"type",base:null,typeMap:{"data-layer":c,"map-layer":m}}):P("web-scene/basemap")}async function T(e,t,n){const r=await h(e,t);return r||C(n)}function M(e){return e.prototype.declaredClass.replace(/\./g,"/")}async function S(e,t,n){const r=t.type.__accessorMetadata__,a=M(t.type),p=r&&r.properties;if(!p)return e&&n.addProperty({name:e,type:"unknown"}),null;let o=a,s=null;const y=e&&e.match(/<([^>]+)>$/);y&&(o+=`--${y[1]}`,s=y[1]),t.type===l&&(o+=`--${n.currentClass.name}`,s=n.currentClass.name);const u=n.seen.get(o);if(u&&e)return n.addProperty({name:e,type:u}),u;const i={type:t.type,name:a,id:o,properties:[]};e&&(n.addProperty({name:e,type:i}),i.typeValue=s),n.push(e,i);for(const c in p){const e=p[c],r=K(e);if(!r||!r.enabled)continue;if(t.type===l){const e="esri/layers/TileLayer"===n.stack[n.stack.length-2].klass.name;if(e&&l.test.isMapImageLayerOverridePolicy(r.overridePolicy)||!e&&l.test.isTileImageLayerOverridePolicy(r.overridePolicy))continue}const a=r.target;if("string"==typeof a||null==a){const r=await T(t,c,e);if(!r)continue;await b("string"==typeof a?a:c,r,n)}else await L(t,a,n)}return n.pop()}async function L(e,t,n){for(const r in t){let a=await h(e,r);if(!a){const e=t[r];a=e.types?B(e.types):V(e.type),a.default=e.default,a=A(a)}await b(r,a,n)}}async function P(e,t){const n={typeName:"union",key:"layerType",types:[]};for(const r in u[e]){if("web-scene/operational-layers"===e&&"ArcGISTiledElevationServiceLayer"===r)continue;const a=await y[r]();a&&(t&&!t(a)||a!==s&&n.types.push({type:{typeName:"json",type:a},value:r}))}if(0===n.types.length)return null;return{typeName:"array",elementType:1===n.types.length?n.types[0].type:n}}function _(e){switch(e.typeName){case"array":return`${_(e.elementType)}[]`;case"union":{const t=e.types.map((e=>_(e.type)));return e.nullable&&t.push("null"),t.sort(),`${t.join(" | ")}`}case"native":switch(e.type){case Number:return"number";case a:return"integer";case String:return"string";case Boolean:return"boolean";case Object:return"object";default:return"unknown"}case"json":return e.type.prototype.declaredClass;case"enum":return"string";default:return}}function $(e){const t=e.prototype.itemType&&e.prototype.itemType.Type;if(!t)return{typeName:"array",elementType:{typeName:"native",type:null}};if("function"==typeof t)return{typeName:"array",elementType:V(t)};if(t.typeMap){const e=[];for(const n in t.typeMap){const r=t.typeMap[n];e.push({type:V(r),value:D(r)?null:n})}return{typeName:"array",elementType:{typeName:"union",key:"string"==typeof t.key?t.key:"type",types:e}}}}function O(e){if("json"!==e.typeName)return null;const t=e.type.__accessorMetadata__,n=t&&t.properties&&t.properties.type,r=n&&E(n),a=r&&r.type,p=a||n&&n.type;return p&&Array.isArray(p)&&"string"==typeof p[0]?a||n.type.map((e=>I(n,e))):null}function A(e){if("array"===e.typeName)return e.elementType=A(e.elementType),e;const t=O(e);return t?{typeName:"union",key:"type",nullable:e.nullable,types:t.map((t=>({value:t,type:e})))}:e}function C(e){const t=E(e);return t.types?B(t.types):!t.type&&e.types?B(e.types):x(A(J(e)))}function x(e){return e.nullable&&"native"===e.typeName?{typeName:"union",key:null,types:[{value:null,type:e}],nullable:!0}:e}function B(e){if(Array.isArray(e))return{typeName:"array",elementType:B(e[0])};const t=[];for(const n in e.typeMap){const r=e.typeMap[n];t.push({type:V(r),value:D(r)?null:n})}return{typeName:"union",key:"string"==typeof e.key?e.key:"type",types:t}}function G(e){return null!=e&&e.isJSONMapWriter}function I(e,t){const n=K(e);if(G(n.writer)){const e={value:""};return n.writer(t,e,"value"),e.value}return t}function J(e){const t=E(e),n=K(e),r=V(t&&t.type||e.type);return t&&void 0!==t.default&&"function"!=typeof t.default&&(r.default=I(e,t.default)),n.allowNull&&(r.nullable=!0),r}function V(e){return e?r(e)?W(e):Array.isArray(e)?"string"==typeof e[0]||"number"==typeof e[0]?{typeName:"enum",values:e}:e.length>1?{typeName:"union",key:null,types:e.map((e=>({type:V(e),value:null})))}:{typeName:"array",elementType:V(e[0])}:p(e)?$(e):D(e)?{typeName:"native",type:e}:z(e)?{typeName:"json",type:e}:{typeName:"native",type:null}:{typeName:"native",type:null}}function W(e){switch(e.type){case"native":return{typeName:"native",type:e.value};case"array":return{typeName:"array",elementType:V(e.value)};case"one-of":return{typeName:"union",key:null,types:e.values.map((e=>({type:W(e),value:null})))};default:return}}function z(e){let t=e;for(;t;){if(t.prototype&&("esri.core.JSONSupport"===t.prototype.declaredClass||"esri.core.MultiOriginJSONSupport"===t.prototype.declaredClass))return!0;t=Object.getPrototypeOf(t)}return!1}function D(e){return e===String||e===Boolean||e===Number||e===a||e===Object}function E(e){if(!e.json)return null;const t=e.json.origins,n=e.json,r=t&&t["web-scene"],a=t&&t["web-document"];return r||a||n||null}function K(e){if(!e.json)return null;const t=e.json.origins,n=e.json.write,r=t&&t["web-scene"]&&t["web-scene"].write,a=t&&t["web-document"]&&t["web-document"].write;return r||a||n||null}export{d as scan};
|