@arcgis/core 4.29.0 → 4.29.1
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/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
- package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
- package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
- package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
- package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
- package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
- package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
- package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +1 -0
- package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
- package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
- package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
- package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
- package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
- package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +1 -0
- package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
- package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
- package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
- package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
- package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
- package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
- package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
- package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
- package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
- package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
- package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
- package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
- package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
- package/chunks/Laserlines.glsl.js +3 -3
- package/chunks/Precipitation.glsl.js +1 -1
- package/chunks/SSAOBlur.glsl.js +2 -2
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/terrainUtilsPlanar.js +1 -1
- package/chunks/vec32.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/core/libs/gl-matrix-2/vec3.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/georeference.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
- package/geometry/support/meshVertexSpaceUtils.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/geometry/support/vector.js +1 -1
- package/interfaces.d.ts +6 -6
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/mixins/FeatureReductionLayer.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/video/VideoCameraSensorModel.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/layers/voxel/voxelPlaneUtils.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/arcade/callExpressionWithCursor.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/features/support/Tile.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/tiling/TileKey.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.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/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/support/measurementUtils.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/common.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/support/Segment.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudWorker.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/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LoDUtil.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/state/Frustum.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/global/ZoomController.js +1 -1
- package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomController.js +1 -1
- package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/state/utils/viewUtils.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/cameraUtilsInternal.js +1 -1
- package/views/3d/support/intersectionUtils.js +1 -1
- package/views/3d/support/mathUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
- package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
- package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/widgets/support/Selector2D/selectorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
- package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
- package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
- package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
- package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
- package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
- package/assets/esri/core/workers/chunks/9307d485a9e5f9fa77d1.js +0 -1
- package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
- package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
- package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
- package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{estimateSize as r}from"../../../../core/typedArrayUtil.js";import{identity as i,scale as a,translate as o,copy as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as c,E as h,c as d,A as m,g as p,s as u}from"../../../../chunks/vec32.js";import{fromArray as y,ONES as f,ZEROS as _,fromValues as g,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as v}from"../../../../geometry/projection/projectPointToVector.js";import{create as L,size as C,containsPoint as S,center as j}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as E}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as w,objectSymbolLayerSizeWithResourceSize as T}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as U,defaultSymbolLayerMemoryComplexity as O}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as B}from"./ElevationAligners.js";import{needsElevationUpdates3D as I,evaluateElevationInfoAtPoint as A,SampleElevationInfo as G}from"./elevationAlignmentUtils.js";import{Graphics3DLodInstanceGraphicLayer as D}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as F}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as z,mixinColorAndOpacity as V,computeObjectScale as M,computeObjectRotation as H}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{LoadStatus as W}from"./Loadable.js";import{makeLodResources as q}from"./lodResourceUtils.js";import{fetch as N}from"./objectResourceUtils.js";import{placePointOnGeometry as J,extendPointGraphicElevationContext as Y}from"./pointUtils.js";import{isValidPrimitive as $,primitiveLodResources as K}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as Q}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as X}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as Z,updateFastSymbolUpdatesState as ee,ConvertOptions as te,evaluateModelTransform as se,evaluateModelTransformScale as re}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as ie}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ae}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as oe}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as ne,texturesFromLodResources as le,geometriesFromLodResources as ce}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as he}from"../../webgl-engine/materials/DefaultMaterial.js";import{defaultSchematicMRRFactors as de}from"../../webgl-engine/materials/pbrUtils.js";class me{constructor(e,t,s,r,i,a,o,n,l,c,h,d){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.originalMaterialParameters=r,this.resourceSize=i,this.isEsriSymbolResource=a,this.isWosr=o,this.resourceBoundingBox=n,this.symbolSize=l,this.extentPadding=c,this.physicalBasedRenderingEnabled=h,this.pivotOffset=d}}class pe extends F{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){if(z(this.symbolLayer))throw new Error}if(this._isPrimitive){const t=this.symbolLayer.resource,s=t&&$(t.primitive)?t.primitive:E;this._resources=await this._createResourcesForPrimitive(s,e)}else{const t=await X(this.symbol.styleOrigin),s=t?.href??this.symbolLayer.resource.href;this._resources=await this._createResourcesForUrl(s,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return!this.symbolLayer.resource?.href}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}_setMaterialTransparencyParameters(e,t=this.symbolLayer?.material?.color){const s=this._getCombinedOpacity(t),r=s<1||this.needsDrivenTransparentPass;return e.transparent=r,e.opacity=s,e.cullFace=r?ie.None:ie.Back,e}async _createResourcesForPrimitive(t,r){const i=this.symbolLayer,a=L(w(t)),o=y(C(a)),n=y(T(o,i)),l=c(n),h=!1,d=!1,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:[...de],ambient:f,diffuse:f,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},p=!!m.usePBR;this._setMaterialTransparencyParameters(m);const u=this.symbol;if("point-3d"===u.type&&u.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=u.verticalOffset;m.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0},m.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)m.externalColor=P;else{const t=null!=i.material?i.material.color:null,s=null!=t?e.toUnitRGBA(t):P;m.externalColor=s}this._fastUpdates=Z(this._context.renderer,this._fastVisualVariableConvertOptions(a,n,o,null)),m.isInstanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),this._optionalFields.push(ae.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(m.hasInstancedColor=!0,this._optionalFields.push(ae.COLOR)),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(ae.OBJECTANDLAYERIDCOLOR);const _=new he(m),g=K(t,_);if(!g)throw new Error(`Unknown object symbol primitive: ${t}`);const b=ne(g).map((e=>({opacity:1,transparent:e.parameters.transparent}))),R=await this._createStageResources(g,p,r),x=await this._createLodRenderer(g,r);return new me(g,x,R,b,o,h,d,a,n,l,p,null)}async _createResourcesForUrl(e,t){const r={materialParameters:{isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=Z(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(r.materialParameters,this._fastUpdates.materialParameters),this._optionalFields.push(ae.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(r.materialParameters.hasInstancedColor=!0,this._optionalFields.push(ae.COLOR)),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(ae.OBJECTANDLAYERIDCOLOR);const i=this.symbol;if("point-3d"===i.type&&i.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:a}=i.verticalOffset;r.materialParameters.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=a?a:1/0},r.materialParameters.castShadows=!1}const a=this._context.physicalBasedRenderingEnabled;r.signal=t,r.usePBR=a,r.skipHighLods=this._context.skipHighSymbolLods;const o=await N(e,r),n=o.isEsriSymbolResource,l=o.isWosr,h=q(o.lods),d=this._context,m=this.symbolLayer.material,p=this._getExternalColorParameters(m),u=this.symbolLayer?.material?.color,f=this._getCombinedOpacity(u,{hasIntrinsicColor:!0}),_=this.needsDrivenTransparentPass,g=ne(h),b=ne(h).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));g.forEach((e=>{const t=e.parameters;e.setParameters(p);const s=t.opacity*f,r=s<1||_||t.transparent;e.setParameters({opacity:s,transparent:r}),d.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:d.sharedResources.screenSizePerspectiveSettings})}));const P=o.referenceBoundingBox,R=y(C(P)),x=y(h.levels[0].pivotOffset),v=y(T(R,this.symbolLayer)),L=c(v),S=this._fastUpdates;ee(S,this._context.renderer,this._fastVisualVariableConvertOptions(P,v,R,x))&&g.forEach((e=>e.setParameters(S.materialParameters)));const j=await this._createStageResources(h,a,t),E=await this._createLodRenderer(h,t);return new me(h,E,j,b,R,n,l,P,v,L,a,x)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,s,r){const i=this._context.stage,a=ne(e);s!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const o=le(e);i.addMany(o),this._addDisposeResource((()=>{o.forEach((e=>e.unload())),i.removeMany(o)})),await Promise.all(o.map((e=>this._context.stage.schedule((()=>e.load(i.renderView.renderingContext)),r)))),t(r);const n=ce(e);return i.addMany(n),this._addDisposeResource((()=>i.removeMany(n))),{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,a=i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,_e),n(s,se(i.materialParameters,_e,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,_e),re(e,i.materialParameters,_e)}}:null,o=new oe({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:a},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,t),o}_getExternalColorParameters(t){const s={};return this._drivenProperties.color?s.externalColor=P:null!=t?.color?s.externalColor=e.toUnitRGBA(t.color):(s.externalColor=P,s.colorMixMode="ignore"),s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=J(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._drivenProperties.opacity,t=!this._isPrimitive,s=this._resources.stageResources.materials,r=this._resources.originalMaterialParameters;for(let i=0;i<s.length;i++){const a=s[i],o=this.symbolLayer?.material?.color,n=r[i],l=this._getCombinedOpacity(o,{hasIntrinsicColor:t})*n.opacity,c=l<1||e||n.transparent;a.setParameters({opacity:l,transparent:c}),this._isPrimitive&&a.setParameters({cullFace:c?ie.None:ie.Back})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return k.RecreateSymbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return k.RecreateSymbol;if(!ee(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return k.RecreateSymbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return k.FastUpdate}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=U(e.levels),s=e=>Array.from(e.attributes.values()).reduce(((e,t)=>e+r(t.data,t.indices)),0),i=ce(e).reduce(((e,t)=>e+s(t)),0),a=le(e).reduce(((e,t)=>e+t.memoryEstimate),0)+i,o={...O(this.symbol,this.symbolLayer),resourceBytes:a};return new Q({verticesPerFeature:t,memory:o})}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i,a){if(!this._hasLodRenderer()||null==this._resources)return null;const o=this.getFastUpdateAttrValues(e),n=this._context.clippingExtent;if(v(t,ue,this._context.elevationProvider.spatialReference),null!=n&&!S(n,ue))return null;const l=this._requiresTerrainElevation(r),c=this._computeGlobalTransform(t,r,fe,ge),h=this._computeLocalTransform(this._resources,this.symbolLayer,s,ye),d=this._resources.lodRenderer.instanceData,m=d.addInstance();this._instanceIndexToGraphicUid.set(m,i),d.setLocalTransform(m,h,!1),d.setGlobalTransform(m,c),o&&d.setFeatureAttribute(m,o),null==this._fastUpdates&&this._hasPerInstanceColor()&&d.setColor(m,V(s.color,s.opacity,255)),null!=this._context.stage.renderView.objectAndLayerIdRenderHelper&&d.setObjectAndLayerIdColor(m,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:i,layerUid:a}));const p=new D(this,m,B,r);return l&&(p.alignedSampledElevation=ge.sampledElevation),p.needsElevationUpdates=I(r.mode),Y(p,t,this._context.elevationProvider),p}_computeGlobalTransform(e,t,s,r){return A(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),ue[0]=e.x,ue[1]=e.y,ue[2]=r.z,x(e.spatialReference,ue,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return i(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=M(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||a(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=t&&J(t);if(null==s)return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,fe,ge),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=ge.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,fe,!0),Y(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;this.loadStatus===W.LOADED&&e.symbolLayerStatePatches.push((()=>{m.symbolSize=y(T(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(m,d,t,ye),r=e.instanceIndex;m.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,a=null!=i?e.toUnitRGBA(i):P;delete r.color;const o=this._resources;null!=o&&t.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(o.lodRenderer.instanceData.setColor(e.instanceIndex,a),t=this._setMaterialTransparencyParameters({},i)):t=this._setMaterialTransparencyParameters({externalColor:a},i);for(const s of o.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return H(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,t,s){const r=b();switch(s.anchor){case"center":d(r,j(e)),h(r,r);break;case"top":{const t=j(e);u(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=j(e);u(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=j(e),i=C(e),a=s.anchorPosition,o=a?g(a.x,a.y,a.z):_;m(r,i,o),p(r,r,t),h(r,r);break}default:null!=t?h(r,t):d(r,_)}return r}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&o(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?y(C(e)):f,a=null!=e?this._computeAnchor(e,r,this.symbolLayer):_,o=this._context.renderCoordsHelper.unitInMeters,n=M(null!=t?t:void 0,t,s,o),l=g(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new te({size:!0,color:!0,rotation:!0,opacity:!1},i,t??f,o,a,n,l)}}const ue=b(),ye=l(),fe=l(),_e=R(),ge=new G;export{pe as Graphics3DObjectSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{estimateSize as r}from"../../../../core/typedArrayUtil.js";import{identity as i,scale as a,translate as o,copy as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as c,F as h,c as d,B as m,g as p,s as u}from"../../../../chunks/vec32.js";import{fromArray as y,ONES as f,ZEROS as _,fromValues as g,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as x}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as v}from"../../../../geometry/projection/projectPointToVector.js";import{create as L,size as C,containsPoint as S,center as j}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as E}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as w,objectSymbolLayerSizeWithResourceSize as T}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as U,defaultSymbolLayerMemoryComplexity as O}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as B}from"./ElevationAligners.js";import{needsElevationUpdates3D as I,evaluateElevationInfoAtPoint as A,SampleElevationInfo as G}from"./elevationAlignmentUtils.js";import{Graphics3DLodInstanceGraphicLayer as D}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as F}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as z,mixinColorAndOpacity as V,computeObjectScale as M,computeObjectRotation as H}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{LoadStatus as W}from"./Loadable.js";import{makeLodResources as q}from"./lodResourceUtils.js";import{fetch as N}from"./objectResourceUtils.js";import{placePointOnGeometry as J,extendPointGraphicElevationContext as Y}from"./pointUtils.js";import{isValidPrimitive as $,primitiveLodResources as K}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as Q}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as X}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as Z,updateFastSymbolUpdatesState as ee,ConvertOptions as te,evaluateModelTransform as se,evaluateModelTransformScale as re}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as ie}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ae}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as oe}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as ne,texturesFromLodResources as le,geometriesFromLodResources as ce}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as he}from"../../webgl-engine/materials/DefaultMaterial.js";import{defaultSchematicMRRFactors as de}from"../../webgl-engine/materials/pbrUtils.js";class me{constructor(e,t,s,r,i,a,o,n,l,c,h,d){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.originalMaterialParameters=r,this.resourceSize=i,this.isEsriSymbolResource=a,this.isWosr=o,this.resourceBoundingBox=n,this.symbolSize=l,this.extentPadding=c,this.physicalBasedRenderingEnabled=h,this.pivotOffset=d}}class pe extends F{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){if(z(this.symbolLayer))throw new Error}if(this._isPrimitive){const t=this.symbolLayer.resource,s=t&&$(t.primitive)?t.primitive:E;this._resources=await this._createResourcesForPrimitive(s,e)}else{const t=await X(this.symbol.styleOrigin),s=t?.href??this.symbolLayer.resource.href;this._resources=await this._createResourcesForUrl(s,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return!this.symbolLayer.resource?.href}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}_setMaterialTransparencyParameters(e,t=this.symbolLayer?.material?.color){const s=this._getCombinedOpacity(t),r=s<1||this.needsDrivenTransparentPass;return e.transparent=r,e.opacity=s,e.cullFace=r?ie.None:ie.Back,e}async _createResourcesForPrimitive(t,r){const i=this.symbolLayer,a=L(w(t)),o=y(C(a)),n=y(T(o,i)),l=c(n),h=!1,d=!1,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:[...de],ambient:f,diffuse:f,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},p=!!m.usePBR;this._setMaterialTransparencyParameters(m);const u=this.symbol;if("point-3d"===u.type&&u.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=u.verticalOffset;m.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0},m.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)m.externalColor=P;else{const t=null!=i.material?i.material.color:null,s=null!=t?e.toUnitRGBA(t):P;m.externalColor=s}this._fastUpdates=Z(this._context.renderer,this._fastVisualVariableConvertOptions(a,n,o,null)),m.isInstanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),this._optionalFields.push(ae.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(m.hasInstancedColor=!0,this._optionalFields.push(ae.COLOR)),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(ae.OBJECTANDLAYERIDCOLOR);const _=new he(m),g=K(t,_);if(!g)throw new Error(`Unknown object symbol primitive: ${t}`);const b=ne(g).map((e=>({opacity:1,transparent:e.parameters.transparent}))),R=await this._createStageResources(g,p,r),x=await this._createLodRenderer(g,r);return new me(g,x,R,b,o,h,d,a,n,l,p,null)}async _createResourcesForUrl(e,t){const r={materialParameters:{isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=Z(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(r.materialParameters,this._fastUpdates.materialParameters),this._optionalFields.push(ae.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(r.materialParameters.hasInstancedColor=!0,this._optionalFields.push(ae.COLOR)),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(ae.OBJECTANDLAYERIDCOLOR);const i=this.symbol;if("point-3d"===i.type&&i.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:a}=i.verticalOffset;r.materialParameters.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=a?a:1/0},r.materialParameters.castShadows=!1}const a=this._context.physicalBasedRenderingEnabled;r.signal=t,r.usePBR=a,r.skipHighLods=this._context.skipHighSymbolLods;const o=await N(e,r),n=o.isEsriSymbolResource,l=o.isWosr,h=q(o.lods),d=this._context,m=this.symbolLayer.material,p=this._getExternalColorParameters(m),u=this.symbolLayer?.material?.color,f=this._getCombinedOpacity(u,{hasIntrinsicColor:!0}),_=this.needsDrivenTransparentPass,g=ne(h),b=ne(h).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));g.forEach((e=>{const t=e.parameters;e.setParameters(p);const s=t.opacity*f,r=s<1||_||t.transparent;e.setParameters({opacity:s,transparent:r}),d.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:d.sharedResources.screenSizePerspectiveSettings})}));const P=o.referenceBoundingBox,R=y(C(P)),x=y(h.levels[0].pivotOffset),v=y(T(R,this.symbolLayer)),L=c(v),S=this._fastUpdates;ee(S,this._context.renderer,this._fastVisualVariableConvertOptions(P,v,R,x))&&g.forEach((e=>e.setParameters(S.materialParameters)));const j=await this._createStageResources(h,a,t),E=await this._createLodRenderer(h,t);return new me(h,E,j,b,R,n,l,P,v,L,a,x)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,s,r){const i=this._context.stage,a=ne(e);s!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const o=le(e);i.addMany(o),this._addDisposeResource((()=>{o.forEach((e=>e.unload())),i.removeMany(o)})),await Promise.all(o.map((e=>this._context.stage.schedule((()=>e.load(i.renderView.renderingContext)),r)))),t(r);const n=ce(e);return i.addMany(n),this._addDisposeResource((()=>i.removeMany(n))),{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,a=i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,_e),n(s,se(i.materialParameters,_e,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,_e),re(e,i.materialParameters,_e)}}:null,o=new oe({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:a},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,t),o}_getExternalColorParameters(t){const s={};return this._drivenProperties.color?s.externalColor=P:null!=t?.color?s.externalColor=e.toUnitRGBA(t.color):(s.externalColor=P,s.colorMixMode="ignore"),s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=J(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._drivenProperties.opacity,t=!this._isPrimitive,s=this._resources.stageResources.materials,r=this._resources.originalMaterialParameters;for(let i=0;i<s.length;i++){const a=s[i],o=this.symbolLayer?.material?.color,n=r[i],l=this._getCombinedOpacity(o,{hasIntrinsicColor:t})*n.opacity,c=l<1||e||n.transparent;a.setParameters({opacity:l,transparent:c}),this._isPrimitive&&a.setParameters({cullFace:c?ie.None:ie.Back})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return k.RecreateSymbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return k.RecreateSymbol;if(!ee(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return k.RecreateSymbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return k.FastUpdate}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=U(e.levels),s=e=>Array.from(e.attributes.values()).reduce(((e,t)=>e+r(t.data,t.indices)),0),i=ce(e).reduce(((e,t)=>e+s(t)),0),a=le(e).reduce(((e,t)=>e+t.memoryEstimate),0)+i,o={...O(this.symbol,this.symbolLayer),resourceBytes:a};return new Q({verticesPerFeature:t,memory:o})}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i,a){if(!this._hasLodRenderer()||null==this._resources)return null;const o=this.getFastUpdateAttrValues(e),n=this._context.clippingExtent;if(v(t,ue,this._context.elevationProvider.spatialReference),null!=n&&!S(n,ue))return null;const l=this._requiresTerrainElevation(r),c=this._computeGlobalTransform(t,r,fe,ge),h=this._computeLocalTransform(this._resources,this.symbolLayer,s,ye),d=this._resources.lodRenderer.instanceData,m=d.addInstance();this._instanceIndexToGraphicUid.set(m,i),d.setLocalTransform(m,h,!1),d.setGlobalTransform(m,c),o&&d.setFeatureAttribute(m,o),null==this._fastUpdates&&this._hasPerInstanceColor()&&d.setColor(m,V(s.color,s.opacity,255)),null!=this._context.stage.renderView.objectAndLayerIdRenderHelper&&d.setObjectAndLayerIdColor(m,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:i,layerUid:a}));const p=new D(this,m,B,r);return l&&(p.alignedSampledElevation=ge.sampledElevation),p.needsElevationUpdates=I(r.mode),Y(p,t,this._context.elevationProvider),p}_computeGlobalTransform(e,t,s,r){return A(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),ue[0]=e.x,ue[1]=e.y,ue[2]=r.z,x(e.spatialReference,ue,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return i(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=M(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||a(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=t&&J(t);if(null==s)return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,fe,ge),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=ge.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,fe,!0),Y(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;this.loadStatus===W.LOADED&&e.symbolLayerStatePatches.push((()=>{m.symbolSize=y(T(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(m,d,t,ye),r=e.instanceIndex;m.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,a=null!=i?e.toUnitRGBA(i):P;delete r.color;const o=this._resources;null!=o&&t.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(o.lodRenderer.instanceData.setColor(e.instanceIndex,a),t=this._setMaterialTransparencyParameters({},i)):t=this._setMaterialTransparencyParameters({externalColor:a},i);for(const s of o.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return H(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,t,s){const r=b();switch(s.anchor){case"center":d(r,j(e)),h(r,r);break;case"top":{const t=j(e);u(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=j(e);u(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=j(e),i=C(e),a=s.anchorPosition,o=a?g(a.x,a.y,a.z):_;m(r,i,o),p(r,r,t),h(r,r);break}default:null!=t?h(r,t):d(r,_)}return r}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&o(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?y(C(e)):f,a=null!=e?this._computeAnchor(e,r,this.symbolLayer):_,o=this._context.renderCoordsHelper.unitInMeters,n=M(null!=t?t:void 0,t,s,o),l=g(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new te({size:!0,color:!0,rotation:!0,opacity:!1},i,t??f,o,a,n,l)}}const ue=b(),ye=l(),fe=l(),_e=R(),ge=new G;export{pe as Graphics3DObjectSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{normalFromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as n,f as l,
|
|
5
|
+
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{normalFromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as n,f as l,H as a,l as u,n as c,m}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as d,expandWithVec3 as p}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as g}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec4f as x,BufferViewVec4u8 as b,BufferViewVec4u16 as h,BufferViewVec3f as T,BufferViewVec3u8 as w,BufferViewVec3u16 as y}from"../../../../geometry/support/buffer/BufferView.js";import{a as v,b as R,s as j}from"../../../../chunks/vec3.js";import{t as M,s as B}from"../../../../chunks/vec4.js";import{n as S}from"../../../../chunks/vec2.js";import{c as F}from"../../../../chunks/vec33.js";import{c as A}from"../../../../chunks/vec43.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{loadGLTF as E}from"../../glTF/loader.js";import{convertPrimitiveToTriangles as O}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as I}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as C}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as N,processLoadResult as P}from"./wosrLoader.js";import{NormalType as U}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as V}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _,DepthTestFunction as D,CullFaceOptions as H}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as q}from"../../webgl-engine/lib/Geometry.js";import{Texture as G}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as W}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{colorGamma as z}from"../../webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{defaultEsriSymbologyMRRFactors as K,defaultAdvancedMRRFactors as Q,useSchematicPBR as J,defaultSchematicMRRFactors as X}from"../../webgl-engine/materials/pbrUtils.js";async function Y(t,r){const o=Z(e(t));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):N(o.url,r)),{engineResources:t,referenceBoundingBox:s}=P(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}const s=await(r.cache?r.cache.loadGLTF(o.url,r,!!r.usePBR):E(new L(r.streamDataRequester),o.url,r,r.usePBR)),i=s.model.meta?.ESRI_proxyEllipsoid,n=s.meta.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.meta.ESRI_webstyle;n&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,ie(s,i));const l=!!r.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:[...K]}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:[...Q]},u={...r.materialParameters,treeRendering:n},{engineResources:c,referenceBoundingBox:m}=ee(s,a,u,r.skipHighLods&&null==o.specifiedLodIndex?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:o.specifiedLodIndex});return{lods:c,referenceBoundingBox:m,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function Z(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(t)return{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function ee(e,t,r,o){const s=e.model,i=new Array,n=new Map,l=new Map,a=s.lods.length,u=d();return s.lods.forEach(((e,c)=>{const m=!0===o.skipHighLods&&(a>1&&0===c||a>3&&1===c)||!1===o.skipHighLods&&null!=o.singleLodIndex&&c!==o.singleLodIndex;if(m&&0!==c)return;const f=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const o=m?new $({}):te(s,e,f,t,r,n,l),{geometry:i,vertexCount:a}=re(e,null!=o?o:new $({})),d=i.boundingInfo;null!=d&&0===c&&(p(u,d.bbMin),p(u,d.bbMax)),null!=o&&(f.stageResources.geometries.push(i),f.numberOfVertices+=a)})),m||i.push(f)})),{engineResources:i,referenceBoundingBox:u}}function te(e,t,r,o,s,n,l){const a=t.material+(t.attributes.normal?"_normal":"")+(t.attributes.color?"_color":"")+(t.attributes.texCoord0?"_texCoord0":"")+(t.attributes.tangent?"_tangent":""),u=e.materials.get(t.material),c=null!=t.attributes.texCoord0,m=null!=t.attributes.normal;if(null==u)return null;const f=se(u.alphaMode);if(!n.has(a)){if(c){const t=(t,r=!1)=>{if(null!=t&&!l.has(t)){const o=e.textures.get(t);if(null!=o){const e=o.data;l.set(t,new G(I(e)?e.data:e,{...o.parameters,preMultiplyAlpha:!I(e)&&r,encoding:I(e)&&null!=e.encoding?e.encoding:void 0}))}}};t(u.textureColor,f!==_.Opaque),t(u.textureNormal),t(u.textureOcclusion),t(u.textureEmissive),t(u.textureMetallicRoughness)}const r=u.color[0]**(1/z),d=u.color[1]**(1/z),p=u.color[2]**(1/z),g=u.emissiveFactor[0]**(1/z),x=u.emissiveFactor[1]**(1/z),b=u.emissiveFactor[2]**(1/z),h=null!=u.textureColor&&c?l.get(u.textureColor):null,T=J({normalTexture:u.textureNormal,metallicRoughnessTexture:u.textureMetallicRoughness,metallicFactor:u.metallicFactor,roughnessFactor:u.roughnessFactor,emissiveTexture:u.textureEmissive,emissiveFactor:u.emissiveFactor,occlusionTexture:u.textureOcclusion}),w=null!=u.normalTextureTransform?.scale?u.normalTextureTransform?.scale:i;n.set(a,new $({...o,transparent:f===_.Blend,customDepthTest:D.Lequal,textureAlphaMode:f,textureAlphaCutoff:u.alphaCutoff,diffuse:[r,d,p],ambient:[r,d,p],opacity:u.opacity,doubleSided:u.doubleSided,doubleSidedType:"winding-order",cullFace:u.doubleSided?H.None:H.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:m?U.Attribute:U.ScreenDerivative,castShadows:!0,receiveShadows:u.receiveShadows,receiveAmbientOcclusion:u.receiveAmbientOcclustion,textureId:null!=h?h.id:void 0,colorMixMode:u.colorMixMode,normalTextureId:null!=u.textureNormal&&c?l.get(u.textureNormal).id:void 0,textureAlphaPremultiplied:null!=h&&!!h.parameters.preMultiplyAlpha,occlusionTextureId:null!=u.textureOcclusion&&c?l.get(u.textureOcclusion).id:void 0,emissiveTextureId:null!=u.textureEmissive&&c?l.get(u.textureEmissive).id:void 0,metallicRoughnessTextureId:null!=u.textureMetallicRoughness&&c?l.get(u.textureMetallicRoughness).id:void 0,emissiveFactor:[g,x,b],mrrFactors:T?[...X]:[u.metallicFactor,u.roughnessFactor,o.mrrFactors[2]],isSchematic:T,colorTextureTransformMatrix:C(u.colorTextureTransform),normalTextureTransformMatrix:C(u.normalTextureTransform),scale:[w[0],w[1]],occlusionTextureTransformMatrix:C(u.occlusionTextureTransform),emissiveTextureTransformMatrix:C(u.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:C(u.metallicRoughnessTextureTransform),...s}))}const d=n.get(a);if(r.stageResources.materials.push(d),c){const e=e=>{null!=e&&r.stageResources.textures.push(l.get(e))};e(u.textureColor),e(u.textureNormal),e(u.textureOcclusion),e(u.textureEmissive),e(u.textureMetallicRoughness)}return d}function re(e,r){const o=e.attributes.position.count,s=O(e.indices||o,e.primitiveType),i=g(3*o),{typedBuffer:n,typedBufferStride:l}=e.attributes.position;v(i,n,e.transform,3,l);const a=[[W.POSITION,new V(i,s,3,!0)]];if(null!=e.attributes.normal){const r=g(3*o),{typedBuffer:i,typedBufferStride:n}=e.attributes.normal;t(oe,e.transform),R(r,i,oe,3,n),a.push([W.NORMAL,new V(r,s,3,!0)])}if(null!=e.attributes.tangent){const r=g(4*o),{typedBuffer:i,typedBufferStride:n}=e.attributes.tangent;t(oe,e.transform),M(r,i,oe,4,n),a.push([W.TANGENT,new V(r,s,4,!0)])}if(null!=e.attributes.texCoord0){const t=g(2*o),{typedBuffer:r,typedBufferStride:i}=e.attributes.texCoord0;S(t,r,2,i),a.push([W.UV0,new V(t,s,2,!0)])}if(null!=e.attributes.color){const t=new Uint8Array(4*o);4===e.attributes.color.elementCount?e.attributes.color instanceof x?B(t,e.attributes.color,255):e.attributes.color instanceof b?A(t,e.attributes.color):e.attributes.color instanceof h&&B(t,e.attributes.color,1/256):(t.fill(255),e.attributes.color instanceof T?j(t,e.attributes.color,255,4):e.attributes.color instanceof w?F(t,e.attributes.color.typedBuffer,4,e.attributes.color.typedBufferStride):e.attributes.color instanceof y&&j(t,e.attributes.color,1/256,4)),a.push([W.COLOR,new V(t,s,4,!0)])}return{geometry:new q(r,a),vertexCount:o}}const oe=r();function se(e){switch(e){case"BLEND":return _.Blend;case"MASK":return _.Mask;case"OPAQUE":case null:case void 0:return _.Opaque}}function ie(e,t){for(let r=0;r<e.model.lods.length;++r){const i=e.model.lods[r];for(const d of i.parts){const i=d.attributes.normal;if(null==i)return;const p=d.attributes.position,g=p.count,x=f(),h=f(),w=f(),y=new Uint8Array(4*g),v=new Float64Array(3*g),R=o(s(),d.transform);let j=0,M=0;for(let o=0;o<g;o++){p.getVec(o,h),i.getVec(o,x),n(h,h,d.transform),l(w,h,t.center),a(w,w,t.radius);const s=w[2],f=u(w),g=Math.min(.45+.55*f*f,1);a(w,w,t.radius),null!==R&&n(w,w,R),c(w,w),r+1!==e.model.lods.length&&e.model.lods.length>1&&m(w,w,x,s>-1?.2:Math.min(-4*s-3.8,1)),v[j]=w[0],v[j+1]=w[1],v[j+2]=w[2],j+=3,y[M]=255*g,y[M+1]=255*g,y[M+2]=255*g,y[M+3]=255,M+=4}d.attributes.normal=new T(v),d.attributes.color=new b(y)}}}export{Y as fetch,ee as gltfToEngineResources,Z as parseUrl};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as o}from"../../../../core/MemCache.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{generateUUID as n}from"../../../../core/uuid.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{i}from"../../../../chunks/vec32.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{isRelativeVertexSpace as u}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{b as m}from"../../../../chunks/sphere.js";import{convertMeshMaterialToPBRMaterial as c}from"./I3SClientMaterialUtil.js";class h{constructor(e,t,o,r){this._uid=e,this._worker=r,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._localMode=t.localMode,this._memCache=o.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){const o=`mesh${t}`,r=e.extent,n=r.spatialReference,s=this._indexSR,a=f(r,e.origin);d(a,n,a,s);return{type:"mesh",id:o,version:g(e),oid:t,mbs:a,componentNodeIds:[],unloadedMesh:e,nodeIndex:null,loadMeshPromise:null}}addMeshNode(t,o){if(null!=this.getMeshNodeIndex(o.oid))throw new e(`I3SClientNodeLoader: client side mesh for feature oid=${o.oid} already exists`);o.nodeIndex=t,this._id2Meta.set(o.id,o),this._oid2Meta.set(o.oid,o)}getMeshNodeIndex(e){const t=this._oid2Meta.get(e);return null==t||"mesh"!==t.type?null:t.nodeIndex}removeNode(e){const t=this._id2Meta.get(e);null!=t&&(this._id2Meta.delete(e),"mesh"===t.type&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(t){const o=this._id2Meta.get(t);if(null==o)throw new e(`I3SClientNodeLoader::loadNodeJSON unable to find node ${t}`);switch(o.type){case"mesh":return this._loadMeshNodeJSON(o);case"mesh-component":return this._loadMeshComponentNodeJSON(o);default:throw new e(`I3SClientNodeLoader::loadNodeJSON unable to handle node ${t}`)}}async _loadMeshNodeJSON(e){const t=e.id,o=(await this._getMeshData(e)).loadedMesh;if(null==o.components||0===o.components.length)return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null};const r=[],n=o.components;for(let s=0;s<n.length;++s){const o=`${t}-component${s}`,n={type:"mesh-component",id:o,mbs:e.mbs,componentIndex:s,meshNodeInfo:e,textureData:new Map};this._id2Meta.set(n.id,n),e.componentNodeIds.push(o),r.push({id:n.id,href:null,mbs:n.mbs,obb:null})}return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:r}}updateNodeIndex(e,t,o){const r=this._id2Meta.get(e);r&&"mesh"===r.type&&(r.nodeIndex=o)}async _loadMeshComponentNodeJSON(e){return{id:e.id,version:e.meshNodeInfo.version,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null,isEmpty:!1}}async loadNodeData(o,n){const s=this._id2Meta.get(o);if(null==s||"mesh-component"!==s.type)throw new e(`Failed to load client node data for node ${o} (unexpected node info)`);const a=s.meshNodeInfo,i=await this._getMeshData(a),l=i.loadedMesh,d=a.oid;if(null==l.components)throw new e(`Failed to load client node data for node ${o} (unexpected null reference)`);const u=l.components[s.componentIndex],{material:m,requiredTextures:h,textureData:f}=await c(u.material);if(null!=f)for(const e of f)null!=e&&s.textureData.set(e.id,e);const y={params:{material:m},type:"ArrayBufferView"},{vertexSpace:g,origin:M,transform:S}=l,_=[M.x,M.y,M.z??0],b={featureDataPosition:_,featureIds:[],geometries:[y]},w={attributeData:{},loadedAttributes:[]};i.projectionPromise||(t(this._worker,"SceneLayerWorker is needed to project mesh"),i.projectionPromise=this._worker.project({positions:l.vertexAttributes.position,localMatrix:S?.localMatrix,vertexSpace:g.toJSON(),origin:_,inSpatialReference:l.spatialReference.toJSON(),outSpatialReference:this._vertexSR.toJSON(),localMode:this._localMode},n));const{projected:N,original:v}=await i.projectionPromise;l.vertexAttributes.position=v;const{transformed:D,original:
|
|
5
|
+
import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as o}from"../../../../core/MemCache.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{generateUUID as n}from"../../../../core/uuid.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{j as i}from"../../../../chunks/vec32.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{isRelativeVertexSpace as u}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{b as m}from"../../../../chunks/sphere.js";import{convertMeshMaterialToPBRMaterial as c}from"./I3SClientMaterialUtil.js";class h{constructor(e,t,o,r){this._uid=e,this._worker=r,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._localMode=t.localMode,this._memCache=o.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){const o=`mesh${t}`,r=e.extent,n=r.spatialReference,s=this._indexSR,a=f(r,e.origin);d(a,n,a,s);return{type:"mesh",id:o,version:g(e),oid:t,mbs:a,componentNodeIds:[],unloadedMesh:e,nodeIndex:null,loadMeshPromise:null}}addMeshNode(t,o){if(null!=this.getMeshNodeIndex(o.oid))throw new e(`I3SClientNodeLoader: client side mesh for feature oid=${o.oid} already exists`);o.nodeIndex=t,this._id2Meta.set(o.id,o),this._oid2Meta.set(o.oid,o)}getMeshNodeIndex(e){const t=this._oid2Meta.get(e);return null==t||"mesh"!==t.type?null:t.nodeIndex}removeNode(e){const t=this._id2Meta.get(e);null!=t&&(this._id2Meta.delete(e),"mesh"===t.type&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(t){const o=this._id2Meta.get(t);if(null==o)throw new e(`I3SClientNodeLoader::loadNodeJSON unable to find node ${t}`);switch(o.type){case"mesh":return this._loadMeshNodeJSON(o);case"mesh-component":return this._loadMeshComponentNodeJSON(o);default:throw new e(`I3SClientNodeLoader::loadNodeJSON unable to handle node ${t}`)}}async _loadMeshNodeJSON(e){const t=e.id,o=(await this._getMeshData(e)).loadedMesh;if(null==o.components||0===o.components.length)return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null};const r=[],n=o.components;for(let s=0;s<n.length;++s){const o=`${t}-component${s}`,n={type:"mesh-component",id:o,mbs:e.mbs,componentIndex:s,meshNodeInfo:e,textureData:new Map};this._id2Meta.set(n.id,n),e.componentNodeIds.push(o),r.push({id:n.id,href:null,mbs:n.mbs,obb:null})}return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:r}}updateNodeIndex(e,t,o){const r=this._id2Meta.get(e);r&&"mesh"===r.type&&(r.nodeIndex=o)}async _loadMeshComponentNodeJSON(e){return{id:e.id,version:e.meshNodeInfo.version,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null,isEmpty:!1}}async loadNodeData(o,n){const s=this._id2Meta.get(o);if(null==s||"mesh-component"!==s.type)throw new e(`Failed to load client node data for node ${o} (unexpected node info)`);const a=s.meshNodeInfo,i=await this._getMeshData(a),l=i.loadedMesh,d=a.oid;if(null==l.components)throw new e(`Failed to load client node data for node ${o} (unexpected null reference)`);const u=l.components[s.componentIndex],{material:m,requiredTextures:h,textureData:f}=await c(u.material);if(null!=f)for(const e of f)null!=e&&s.textureData.set(e.id,e);const y={params:{material:m},type:"ArrayBufferView"},{vertexSpace:g,origin:M,transform:S}=l,_=[M.x,M.y,M.z??0],b={featureDataPosition:_,featureIds:[],geometries:[y]},w={attributeData:{},loadedAttributes:[]};i.projectionPromise||(t(this._worker,"SceneLayerWorker is needed to project mesh"),i.projectionPromise=this._worker.project({positions:l.vertexAttributes.position,localMatrix:S?.localMatrix,vertexSpace:g.toJSON(),origin:_,inSpatialReference:l.spatialReference.toJSON(),outSpatialReference:this._vertexSR.toJSON(),localMode:this._localMode},n));const{projected:N,original:v}=await i.projectionPromise;l.vertexAttributes.position=v;const{transformed:D,original:j}=await p(u,i,this._worker,n);l.vertexAttributes.normal=j,r(n);const{geometryBuffer:I,geometryDescriptor:R}=x(N,u.faces,D,l.vertexAttributes.uv,l.vertexAttributes.color,d);return{geometryData:b,attributeDataInfo:w,geometryBuffer:I,geometryDescriptor:R,requiredTextures:h,textureData:f,normalReferenceFrame:this._vertexSR.isGeographic?"east-north-up":"vertex-reference-frame"}}async loadAttributes(e,t,o){const r=e.numFeatures,n={};for(const{field:{name:s}}of t)n[s]=new Array(r);return n}async loadTextures(e,t,o){const r=e.id,n=this._id2Meta.get(r);if(null==n||"mesh-component"!==n.type)throw new Error(`Failed to load textures for node ${e.id} (unexpected node info)`);const s=[];for(const a of t)s.push(n.textureData.get(a.id)||null);return s}async _getMeshData(e){const t=e.version,r=this._memCache.get(t);if(null==r){if(null!=e.loadMeshPromise)return e.loadMeshPromise;const r=async(r,n)=>{const s=e.unloadedMesh.clone();try{await s.load()}catch(l){n(l)}const a=s.memoryUsage,i={loadedMesh:s,projectionPromise:null,normalsTransformPromise:null,usedMemoryInBytes:a};this._memCache.put(t,i,a,o),e.loadMeshPromise=null,r(i)};return e.loadMeshPromise=new Promise(((e,t)=>r(e,t))),e.loadMeshPromise}return r}}function f(e,t){const{spatialReference:o}=e,r=[1,-1],n=[.5*e.width,.5*e.height,e.hasZ?.5*(e.zmax-e.zmin):0],s=o.isGeographic?o.metersPerUnit:1,a=e.center;let i=0;if(e.hasZ)for(let l=0;l<2;++l)for(let e=0;e<2;++e)for(let o=0;o<2;++o){const d=(a.x+r[l]*n[0]-t.x)*s,u=(a.y+r[e]*n[1]-t.y)*s,m=a.z+r[o]*n[2]-t.z;i=Math.max(d*d+u*u+m*m,i)}else for(let l=0;l<2;++l)for(let e=0;e<2;++e){const o=(a.x+r[l]*n[0]-t.x)*s,d=(a.y+r[e]*n[1]-t.y)*s;i=Math.max(o*o+d*d,i)}return m([t.x,t.y,t.z],Math.sqrt(i))}async function p(e,o,r,n){const{transform:d,vertexAttributes:u}=o.loadedMesh,m="source"===e.shading?u.normal:null;if(!(null!=m&&null!=d&&(0!==d.rotationAngle||!i(d.scale,l))))return{transformed:m,original:u.normal};if(!o.normalsTransformPromise){t(r,"SceneLayerWorker is needed to transform mesh normals");const e=a();s(e,d.localMatrix),o.normalsTransformPromise=r.transformNormals({normalMatrix:e,normals:m},n)}return o.normalsTransformPromise}function x(e,t,o,r,n,s){const a=1,i=t.length/3,l=3*i;let d=0,u=0,m=!1,c=0,h=!1,f=0,p=!1,x=0,g=0,w=0;d+=M,d+=M,u=d,d+=3*l*S,null!=o&&(m=!0,c=d,d+=3*l*S),null!=r&&(h=!0,f=d,d+=2*l*S),null!=n&&(p=!0,x=d,d+=4*l*_),g=d,d+=a*b,w=d,d+=2*a*M;const N=new ArrayBuffer(d),v=new Uint8Array(N);y(v,0,l),y(v,M,a);const D=new Float32Array(N,u),j=null!=o?new Float32Array(N,c):null,I=null!=r?new Float32Array(N,f):null,R=null!=n?new Uint8Array(N,x):null;for(let y=0;y<i;++y){const s=3*y;for(let a=0;a<3;++a){const i=t[s+a],l=3*i,d=9*y+3*a;if(D[d]=e[l],D[d+1]=e[l+1],D[d+2]=e[l+2],null!=j&&(j[d]=o[l],j[d+1]=o[l+1],j[d+2]=o[l+2]),null!=I){const e=2*i,t=6*y+2*a;I[t]=r[e],I[t+1]=r[e+1]}if(null!=R){const e=4*i,t=12*y+4*a;R[t]=n[e],R[t+1]=n[e+1],R[t+2]=n[e+2],R[t+3]=n[e+3]}}}y(v,g,s),y(v,g+M,s/2**32),y(v,w,0),y(v,w+M,i-1);return{geometryBuffer:N,geometryDescriptor:{isDraco:!1,isLegacy:!0,color:p,normal:m,uv0:h,uvRegion:!1,featureIndex:!0}}}function y(e,t,o){e[t]=255&o,e[t+1]=255&o>>8,e[t+2]=255&o>>16,e[t+3]=255&o>>24}function g(e){const t=e.metadata.displaySource?.source;if(null==t||!Array.isArray(t)||!t.length||t[0]instanceof File)return n();const o=t;let r="";for(const n of o)r+=n.makeHash();return r+JSON.stringify(null!=e.transform?e.transform.toJSON():"")+(u(e.vertexSpace)?JSON.stringify(e.vertexSpace.origin):"")}const M=4,S=4,_=1,b=8;export{h as I3SClientNodeLoader,f as createSphereFromExtent,S as sizeOfFloat32,M as sizeOfInt32,b as sizeOfUInt64,_ as sizeOfUInt8,p as transformNormals};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{n as e,y as t,j as i,q as s,c as n,C as r,v as o,h as a,m as c,a as l,p as h,l as d,o as u,f as m,g as p}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as v,b as g}from"../../../../chunks/vec42.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as x}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as I,intersectsSphere as C,createPoints as P}from"../../../../geometry/support/frustum.js";import{isPlateCarree as E}from"../../../../geometry/support/spatialReferenceUtils.js";import{g as D,w as F}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{ViewingMode as B}from"../../../ViewingMode.js";import{evaluateElevationAlignmentAtPoint as j}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as V}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as L,extractExpressionInfo as y}from"../graphics/featureExpressionInfoUtils.js";import{LodMetric as A}from"./I3SNode.js";import{isValidMbs as w,intersectBoundingRectWithMbs as G,MbsIntersectResult as N}from"./I3SUtil.js";import{Obb as U,computeOffsetObb as T}from"../../support/orientedBoundingBox.js";const q=1e5;class z{constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=f(),this._useFrustumCulling=!1,this._poi=_(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new U,this._tmp1=_(),this._tmp2=_(),this._tmp3=_(),this._tmp0=_(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=R(l),this._isGlobalMode=l===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||E(l)),this._indexSREllipsoidRadius=S(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=x(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=V.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(L(y(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,r){I(n.viewMatrix,n.projectionMatrix,this._frustum,H);{const r=n.eye,o=k;e(o,n.viewForward);const a=W;t(a,H[4],r);const c=.5*i(a,a)/i(o,a),l=this._frustumMbs;s(l,r,o,c);const h=1+c;l[3]=h}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);return void(e&&i.expandElevationRange(e))}const r=s[0],o=s[1],a=s[2],c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const l=t?null:this._elevationProvider.getRootElevationBounds?.();l&&i.expandElevationRange(l)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(w(t))return t;e.serviceMbsInIndexSR&&v(t,e.serviceMbsInIndexSR);const i=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(i)){let s=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":s=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+i-t[2],n=r-i;break;case"on-the-ground":s=i-t[2],n=r-i}t[2]+=s+.5*n,t[3]+=.5*n}else this._elevationContext&&t[3]<q&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=j(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new U,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i[3];let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,l=this._elevationContext;if(l&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(l.mode){case"relative-to-ground":r=l.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(l&&n<q){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=j(e,this._elevationProvider,l,c)-a}const h=o>0,d=h?this._tmpObb:t;return s.transform(d,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&T(d,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(X,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),X):null}ensureElevationAgnosticBoundingVolume(e,t){-1===e.elevationAgnosticBoundingVolume[3]&&(t===B.Global?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),o=t.elevationAgnosticBoundingVolume,a=Y;let c=-1;if(s){s.getCenter(a),e(a,a),s.getCorners(J);for(const t of J){e(t,t);const s=i(t,a);if(s<=0)return void(o[3]=-1);const n=Math.sqrt(1-s*s);c=Math.max(c,n)}}else{const i=t.serviceMbsInRenderSR;if(!w(i))return void(o[3]=-1);{const t=n(Y,D(i)),s=i[3],o=r(t);c=0===s?0:o<s?-1:s/o,e(t,t)}}g(o,a);const l=.001;o[3]=c+l}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(Y);e[2]=0,g(t,e);let s=0;const n=K;i.getCorners(J);for(const t of J){t[2]=0;const e=o(n,t);s=Math.max(s,e)}t[3]=Math.sqrt(s)}else{const i=e.serviceMbsInRenderSR;if(w(i)){const e=n(Y,D(i));e[2]=0,g(t,e),t[3]=i[3]}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.isVisible(this._frustum):C(this._frustum,F(t))}isElevationAgnosticBoundingVolumeVisible(e,t){return!this._useFrustumCulling||(-1===t[3]||(e===B.Global?this._isConeVisibleInFrustum(t):this._isCylinderVisibleInFrustum(t)))}_isConeVisibleInFrustum(e){const t=this._frustumMbs,s=t,n=r(s),o=t[3],l=e,h=i(l,s),d=e[3];if(d>.9)return!0;if(n<=o)return!0;{const e=a(Z,l,h);if(c(e,s)<o)return!0}const u=h/n;if(h<=0){return-u<o}const m=Math.sqrt(1-u*u);if(m<d)return!0;const p=o/n;return m*Math.sqrt(1-p*p)-p*u<d}_isCylinderVisibleInFrustum(e){const t=this._frustumMbs,i=t,s=t[3],r=n(Z,i);r[2]=0;const o=e[3];return c(r,e)<=o+s}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.isVisible(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||G(this._clippingArea,e)!==N.OUTSIDE}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(D(i),this._camPos)),n=s-i[3];return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e)[3]}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=h(D(t),this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t[3],s=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/d(D(t))+i)/h(D(t),this._camPos);return Math.min(1,s)}hasLOD(e){return e.lodMetric!==A.None}_getDistancePlanarMode(e,t){const i=e[0]-t[0],s=e[1]-t[1],n=e[2]-t[2],r=i*i+s*s,o=t[3];if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}_getDistanceGlobeMode(e,t){const s=d(D(t)),n=d(e)-s;a(this._tmp0,e,i(e,D(t))/u(e));const r=l(D(t),this._tmp0),o=t[3];if(r<=o*o)return Math.abs(n);{const r=a(this._tmp0,D(t),1/s),c=s,l=o*o/2/c,u=a(this._tmp1,r,c-l),_=e,v=m(this._tmp2,_,u),g=m(this._tmp2,v,a(this._tmp3,r,i(r,v))),f=p(this._tmp2,u,a(this._tmp2,g,o/d(g)));let S=h(_,f);if(n>=2e5){const e=m(this._tmp1,_,f);let t=i(e,r)/d(e);t<.08&&(t=1e-4),S/=t}return S}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===A.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case A.ScreenSpaceRelative:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i[3];return this._updateMinMaxDistance(r),e.maxError*t<=n}case A.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.serviceMbsInIndexSR[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case A.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case A.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const t=this.getServiceMbsInRenderSR(e);return h(D(t),this._poi)-t[3]}distCameraToPOI(){return h(this._camPos,this._poi)}}const k=_(),H=P(),W=_(),Z=_(),X=new U,Y=_(),J=[_(),_(),_(),_(),_(),_(),_(),_()],K=_();export{z as default};
|
|
5
|
+
import{n as e,z as t,k as i,r as s,c as n,D as r,w as o,h as a,o as c,a as l,q as h,l as d,p as u,f as m,g as p}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as v,b as g}from"../../../../chunks/vec42.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as x}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as I,intersectsSphere as C,createPoints as P}from"../../../../geometry/support/frustum.js";import{isPlateCarree as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{g as E,w as F}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{ViewingMode as B}from"../../../ViewingMode.js";import{evaluateElevationAlignmentAtPoint as V}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as j}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as L,extractExpressionInfo as A}from"../graphics/featureExpressionInfoUtils.js";import{LodMetric as y}from"./I3SNode.js";import{isValidMbs as w,intersectBoundingRectWithMbs as G,MbsIntersectResult as N}from"./I3SUtil.js";import{Obb as U,computeOffsetObb as z}from"../../support/orientedBoundingBox.js";const T=1e5;class q{constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=f(),this._useFrustumCulling=!1,this._poi=_(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new U,this._tmp1=_(),this._tmp2=_(),this._tmp3=_(),this._tmp0=_(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=R(l),this._isGlobalMode=l===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||D(l)),this._indexSREllipsoidRadius=S(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=x(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=j.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(L(A(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,r){I(n.viewMatrix,n.projectionMatrix,this._frustum,H);{const r=n.eye,o=k;e(o,n.viewForward);const a=W;t(a,H[4],r);const c=.5*i(a,a)/i(o,a),l=this._frustumMbs;s(l,r,o,c);const h=1+c;l[3]=h}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);return void(e&&i.expandElevationRange(e))}const r=s[0],o=s[1],a=s[2],c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const l=t?null:this._elevationProvider.getRootElevationBounds?.();l&&i.expandElevationRange(l)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(w(t))return t;e.serviceMbsInIndexSR&&v(t,e.serviceMbsInIndexSR);const i=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(i)){let s=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":s=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+i-t[2],n=r-i;break;case"on-the-ground":s=i-t[2],n=r-i}t[2]+=s+.5*n,t[3]+=.5*n}else this._elevationContext&&t[3]<T&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=V(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new U,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i[3];let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,l=this._elevationContext;if(l&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(l.mode){case"relative-to-ground":r=l.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(l&&n<T){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=V(e,this._elevationProvider,l,c)-a}const h=o>0,d=h?this._tmpObb:t;return s.transform(d,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&z(d,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(X,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),X):null}ensureElevationAgnosticBoundingVolume(e,t){-1===e.elevationAgnosticBoundingVolume[3]&&(t===B.Global?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),o=t.elevationAgnosticBoundingVolume,a=Y;let c=-1;if(s){s.getCenter(a),e(a,a),s.getCorners(J);for(const t of J){e(t,t);const s=i(t,a);if(s<=0)return void(o[3]=-1);const n=Math.sqrt(1-s*s);c=Math.max(c,n)}}else{const i=t.serviceMbsInRenderSR;if(!w(i))return void(o[3]=-1);{const t=n(Y,E(i)),s=i[3],o=r(t);c=0===s?0:o<s?-1:s/o,e(t,t)}}g(o,a);const l=.001;o[3]=c+l}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(Y);e[2]=0,g(t,e);let s=0;const n=K;i.getCorners(J);for(const t of J){t[2]=0;const e=o(n,t);s=Math.max(s,e)}t[3]=Math.sqrt(s)}else{const i=e.serviceMbsInRenderSR;if(w(i)){const e=n(Y,E(i));e[2]=0,g(t,e),t[3]=i[3]}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.isVisible(this._frustum):C(this._frustum,F(t))}isElevationAgnosticBoundingVolumeVisible(e,t){return!this._useFrustumCulling||(-1===t[3]||(e===B.Global?this._isConeVisibleInFrustum(t):this._isCylinderVisibleInFrustum(t)))}_isConeVisibleInFrustum(e){const t=this._frustumMbs,s=t,n=r(s),o=t[3],l=e,h=i(l,s),d=e[3];if(d>.9)return!0;if(n<=o)return!0;{const e=a(Z,l,h);if(c(e,s)<o)return!0}const u=h/n;if(h<=0){return-u<o}const m=Math.sqrt(1-u*u);if(m<d)return!0;const p=o/n;return m*Math.sqrt(1-p*p)-p*u<d}_isCylinderVisibleInFrustum(e){const t=this._frustumMbs,i=t,s=t[3],r=n(Z,i);r[2]=0;const o=e[3];return c(r,e)<=o+s}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.isVisible(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||G(this._clippingArea,e)!==N.OUTSIDE}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(E(i),this._camPos)),n=s-i[3];return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e)[3]}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=h(E(t),this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t[3],s=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/d(E(t))+i)/h(E(t),this._camPos);return Math.min(1,s)}hasLOD(e){return e.lodMetric!==y.None}_getDistancePlanarMode(e,t){const i=e[0]-t[0],s=e[1]-t[1],n=e[2]-t[2],r=i*i+s*s,o=t[3];if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}_getDistanceGlobeMode(e,t){const s=d(E(t)),n=d(e)-s;a(this._tmp0,e,i(e,E(t))/u(e));const r=l(E(t),this._tmp0),o=t[3];if(r<=o*o)return Math.abs(n);{const r=a(this._tmp0,E(t),1/s),c=s,l=o*o/2/c,u=a(this._tmp1,r,c-l),_=e,v=m(this._tmp2,_,u),g=m(this._tmp2,v,a(this._tmp3,r,i(r,v))),f=p(this._tmp2,u,a(this._tmp2,g,o/d(g)));let S=h(_,f);if(n>=2e5){const e=m(this._tmp1,_,f);let t=i(e,r)/d(e);t<.08&&(t=1e-4),S/=t}return S}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===y.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case y.ScreenSpaceRelative:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i[3];return this._updateMinMaxDistance(r),e.maxError*t<=n}case y.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.serviceMbsInIndexSR[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case y.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case y.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const t=this.getServiceMbsInRenderSR(e);return h(E(t),this._poi)-t[3]}distCameraToPOI(){return h(this._camPos,this._poi)}}const k=_(),H=P(),W=_(),Z=_(),X=new U,Y=_(),J=[_(),_(),_(),_(),_(),_(),_(),_()],K=_();export{q 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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{k as e}from"../../../../chunks/vec32.js";function t(e,t,g){for(let n=0;n<t.length;n++)r[n]=!1,o[n]=null;for(let r=0;r<e.length;r++)n[r]=!1,l[r]=null;for(let n=0;n<t.length;n++){const o=h(t[n],e,g);o>=0&&(r[n]=!0,null!=l[o]?l[o].push(t[n]):l[o]=[t[n]])}for(let l=0;l<e.length;l++){const r=h(e[l],t,g);r>=0&&(n[l]=!0,null!=o[r]?o[r].push(e[l]):o[r]=[e[l]])}const u=[];for(let r=0;r<e.length;r++)null!=l[r]||n[r]||u.push({load:[],remove:[e[r]]});for(let n=0;n<t.length;n++)null!=o[n]||r[n]||u.push({load:[t[n]],remove:[]});for(let n=0;n<t.length;n++)null!=o[n]&&(o[n].length>1||o[n][0]!==t[n])&&u.push({load:[t[n]],remove:o[n]});for(let n=0;n<e.length;n++)null!=l[n]&&(l[n].length>1||l[n][0]!==e[n])&&u.push({load:l[n],remove:[e[n]]});return u}const n=[!1],l=[null],r=[!1],o=[null];function h(e,t,n){let l=e;for(;l>0;){const e=t.indexOf(l);if(e>=0)return e;l=n.getParentId(l)}return t.indexOf(l)}function g(t,n,l){return t.sort(((t,r)=>{if(0===t.load.length&&0===r.load.length)return 0;if(0===t.load.length)return-1;if(0===r.load.length)return 1;if(0===t.remove.length&&0===r.remove.length){const o=l.getRenderObb(t.load[0]).center,h=l.getRenderObb(r.load[0]).center;return e(o,n)-e(h,n)}if(0===t.remove.length)return-1;if(0===r.remove.length)return 1;if(1===t.load.length&&1===r.load.length){const o=l.getRenderObb(t.load[0]).center,h=l.getRenderObb(r.load[0]).center;return e(o,n)-e(h,n)}if(1===t.load.length)return-1;if(1===r.load.length)return 1;{const o=l.getRenderObb(t.remove[0]).center,h=l.getRenderObb(r.remove[0]).center;return e(o,n)-e(h,n)}}))}function u(e,t,n){for(let l=0;l<e.length;++l){const r=e[l];r.load.length>t&&1===r.remove.length&&d(e,r,n)}}function d(e,t,n){const l=[t.remove[0]],r=[];for(;1===l.length;){const e=l.pop();r.length=0;for(let o=0;o<t.load.length;o++){let h=t.load[o],g=n.getParentId(h);for(;g!==e;)h=g,g=n.getParentId(h);let u=l.indexOf(h);u<0&&(u=l.length,l.push(h),r.push([])),r[u].push(t.load[o])}}t.load=l;for(let o=0;o<l.length;o++)r[o].length>1?e.push({remove:[l[o]],load:r[o]}):l[o]=r[o][0]}export{t as nodeDiff,g as sortFrontToBack,u as splitWorkEntries,d as splitWorkEntry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,l as o,h as a,
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,l as o,h as a,F as l,k as h,p as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as R}from"./PointHighlights.js";import{ShaderOutput as w}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as A}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as j}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as y}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as q,StoreResults as O}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as E}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as I}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{P as v,a as F,g as N}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as C}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as T}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as H}from"../../../webgl/BufferObject.js";import{DataType as D,PrimitiveType as M,Usage as B}from"../../../webgl/enums.js";import{VertexElementDescriptor as U}from"../../../webgl/VertexElementDescriptor.js";const V={positions:[new U(L.POSITION,3,D.FLOAT,0,12)],colors:[new U(L.COLOR,3,D.UNSIGNED_BYTE,0,3,!0)]};let W=class extends A{constructor(e){super(e),this.type=q.PCL,this.isGround=!1,this._passParameters=new v,this._highlights=new R({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[E.OPAQUE_MATERIAL,e=>e!==w.LinearDepth&&(e!==w.Highlight||!this._highlights.empty)],[E.OPAQUE_NO_SSAO_DEPTH,e=>e===w.LinearDepth]]),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new T,this._nodes=new s}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=d(),f=d(),P=d(),b=d(),R=S(),w=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,s);const j=1/o(f);a(f,f,j),l(P,f),u(R,f[0],f[1],f[2],-h(f,s));const q=new $,E=new $,I=new Array,L=p(),v=p(this._passParameters.clipBox);m(v,-s[0],-s[1],-s[2],v),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(R),d=o.obb.maximumDistancePlane(R);l-=Y(a,l+A,this._passParameters,w,o.isLeaf),d-=Y(a,d+A,this._passParameters,w,o.isLeaf);const u=d<0,p=null!=q.dist&&null!=E.dist&&q.dist<l*j&&E.dist>d*j;if(u||p)return;const S=Q(a,d+A,this._passParameters,w,o.isLeaf);if(!o.obb.intersectRay(s,f,S))return;const x=S*S;o.obb.toAaBoundingBox(L),m(L,-s[0],-s[1],-s[2],L);const z=!g(v,L);n(b,o.origin,s);const y=o.coordinates.length/3;for(let n=0;n<y;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],z&&!_(v,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>x)continue;let u=l+A;const p=Y(a,u,this._passParameters,w,o.isLeaf);if(l-p<0)continue;u-=p;const m=Q(a,u,this._passParameters,w,o.isLeaf);if(d>m*m)continue;const g=(l-p)*j,S=e=>(e.point=J(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==q.dist||g<q.dist)&&(null==t||t(s,i,g))&&S(q),e.options.store!==O.MIN&&(null==E.dist||g>E.dist)&&(null==t||t(s,i,g))&&S(E),e.options.store===O.ALL&&(null==t||t(s,i,g))){const e=new $;I.push(S(e))}}}));const F=e=>{const{layerUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},N=(e,t)=>{const s=F(t);e.set(this.type,s,t.dist,t.normal)};if(ee(q)){const t=e.results.min;(null==t.dist||q.dist<t.dist)&&N(t,q)}if(ee(E)&&e.options.store!==O.MIN){const t=e.results.max;(null==t.dist||E.dist>t.dist)&&N(t,E)}if(e.options.store===O.ALL){const t=x(s,i);for(const s of I){const i=y(t);N(i,s),e.results.all.push(i)}}}prepareTechnique(e){return 0===this._nodes.length||e.output!==w.Color&&(e.output!==w.LinearDepth||e.bindParameters.slot!==E.OPAQUE_NO_SSAO_DEPTH)&&e.output!==w.Highlight?null:(this._nodes.forAll((t=>{null==t.vao&&this._initNode(e,t)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output,this._context.techniqueRepository.releaseAndAcquire(C,this._techniqueConfig,this._technique))}renderNode(e,t){const s=e.rctx,i=s.bindTechnique(t,e.bindParameters,this._passParameters),r=e.output===w.Highlight;this._nodes.forAll((t=>{0===t.coordinates.length||r&&!t.highlights||(i.bindDraw(t,e.bindParameters,this._passParameters),s.bindVAO(t.vao),r?this._renderHighlightFragments(s,t):s.drawArrays(M.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const s=t.highlights;if(null==s)return;let i=s[0].component,r=i+1;for(let o=1;o<s.length;o++){const t=s[o].component;if(t!==r){const s=r-i;s>0&&e.drawArrays(M.POINTS,i,s),i=t}r=t+1}const n=r-i;n>0&&e.drawArrays(M.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,s){e.highlights=X(e.highlights,t,s),this._requestRender()}_removeHighlight(e,t){e.highlights=Z(e.highlights,t),this._requestRender()}_initNode(e,t){const s=e.rctx;t.vao=new I(s,j,V,{positions:H.createVertex(s,B.STATIC_DRAW,t.coordinates),colors:H.createVertex(s,B.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],W.prototype,"createGraphic",void 0),W=e([r("esri.views.3d.layers.i3s.PointRenderer")],W);class k extends F{constructor(e,t,s,i,r,n,o,a,l=null,h=null){super(s,r,t),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function G(e){return e.hasOwnProperty("splatSize")}function Q(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=N(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Y(e,t,s,i,r){return s.drawScreenSpace?0:Q(e,t,s,i,r)}function J(e,t,s){return null==s&&(s=d()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function K(e){return null!=e.component?e.component:-1}function X(e,t,s){null==e&&(e=[]);const i={component:t,id:s};e.push(i);const r=K(i);let n=e.length-1;for(;n>0&&r<K(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function Z(e,t){if(null==e)return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ${constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function ee(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{W as PointRenderer,k as PointRendererNode,G as isPointRendererNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createScreenPointArray as e,createRenderScreenPointArray3 as t}from"../../../../core/screenUtils.js";import{c as r,h as i,
|
|
5
|
+
import{createScreenPointArray as e,createRenderScreenPointArray3 as t}from"../../../../core/screenUtils.js";import{c as r,h as i,r as s}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,fromValues as c,distance as a,empty as l,expandPointInPlace as m,expand as h}from"../../../../geometry/support/aaBoundingRect.js";import{PlaneIndex as u}from"../../../../geometry/support/frustum.js";import{signedDistance as p}from"../../../../geometry/support/plane.js";import{areaPoints2d as _}from"../../../../geometry/support/triangle.js";import{ViewingMode as d}from"../../../ViewingMode.js";import{Visibility as f}from"./FeatureTileDescriptor3D.js";import{FeatureTileVisibility3D as S,globalTileLevelThreshold as g,isConvexHullOutsideOfFrustum as b}from"./FeatureTileVisibility3D.js";import{Camera as v}from"../../webgl-engine/lib/Camera.js";class T{constructor(e){this._camera=new v,this._focusOnMap=[0,0],this._screenRect=n(),this._tileSize=e.tileSize,this._renderCoordsHelper=e.renderCoordsHelper,this._tilingScheme=e.tilingScheme,this._visibility=new S(e.renderCoordsHelper)}begin(e,t,r){this._camera.copyFrom(e),this._surfaceElevation=r,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,c(0,0,e.fullWidth,e.fullHeight,this._screenRect),this._visibility.begin(this._camera,r)}end(){this._visibility.end()}updateTile(e){e.measures.visibility=this._visibility.calculate(e),e.measures.distance=a(e.extent,this._focusOnMap),e.measures.visibility!==f.INVISIBLE&&this._updateScreenMeasure(e)}_updateScreenMeasure(e){const t=j,r=1<<t,i=e.measures.screenRect;l(i);let s=0;const o=e.lij,n=o[0],c=n+t,a=o[1]<<t,h=o[2]<<t,u=this._tileSizeWithBias(e),p=u*u,_=this._camera,{frustum:f,viewport:S}=_;if(this._renderCoordsHelper.viewingMode===d.Local||n>g){const t=C;this._tilingScheme.getExtent(o[0],o[1],o[2],t);const r=R,i=H,s=l();for(let e=0;e<4;++e)this._toRenderCoords(t,w[e][0],w[e][1],i[e]),_.projectToScreen(i[e],r[e]),m(s,r[e]);const n=b(f,i,4),c=s[0]>S[2]||s[1]>S[3]||s[2]<S[0]||s[3]<S[1];if(n||c)return void(e.measures.shouldSplit=!1)}for(let l=0;l<r;l++)for(let t=0;t<r;t++)if(s+=this._computeScreenArea(c,a+l,h+t,i),s>p)return void(e.measures.shouldSplit=!0);e.measures.shouldSplit=!1}_tileSizeWithBias(e){return e.measures.visibility===f.VISIBLE_WHEN_EXTENDED?this._tileSize*y:this._tileSize}_computeScreenArea(e,t,r,i){this._tilingScheme.ensureMaxLod(e);const s=C;this._tilingScheme.getExtent(e,t,r,s);const o=A;this._toRenderCoords(s,0,3,o[0]),this._toRenderCoords(s,2,3,o[1]),this._toRenderCoords(s,2,1,o[2]),this._toRenderCoords(s,0,1,o[3]);return this._computeTriangleScreenArea([o[0],o[1],o[2]],i)+this._computeTriangleScreenArea([o[2],o[1],o[3]],i)}_computeTriangleScreenArea(e,t){const i=this._camera.frustum[u.NEAR];let s=0,o=-1,n=-1;for(let r=0;r<3;++r){p(i,e[r])>0?(s++,-1===o&&(o=r)):-1===n&&(n=r)}if(0===s)return this._computeTriangleScreenAreaInside(e,t);if(1===s){const s=I,n=(o+1)%3,c=(o+2)%3,a=o;r(s[0],e[n]),r(s[1],e[c]),x(s[2],e[c],e[a],i);const l=this._computeTriangleScreenAreaInside(s,t);x(s[1],e[n],e[a],i);return l+this._computeTriangleScreenAreaInside(s,t)}if(2===s){const s=I,o=n;r(s[0],e[o]);const c=(n+1)%3,a=(n+2)%3;return x(s[1],e[o],e[c],i),x(s[2],e[o],e[a],i),this._computeTriangleScreenAreaInside(s,t)}return 0}_computeTriangleScreenAreaInside(e,t){for(let r=0;r<3;r++)this._camera.projectToRenderScreen(e[r],E),this._camera.renderToScreen(E,R[r]),h(t,R[r],t);return _(R[0],R[1],R[2])}_toRenderCoords(e,t,r,i){return M[0]=e[t],M[1]=e[r],M[2]=this._surfaceElevation,this._renderCoordsHelper.toRenderCoords(M,this._tilingScheme.spatialReference,i),i}}const j=2,y=5,R=[e(),e(),e(),e()],C=n(),M=o(),A=[o(),o(),o(),o()],E=t(),I=[o(),o(),o()];function x(e,t,r,o){const n=p(o,t),c=p(o,r),a=Math.abs(c-n);i(e,t,Math.abs(c)/a),s(e,e,r,Math.abs(n)/a)}const H=[o(),o(),o(),o()],w=[[0,3],[2,3],[2,1],[0,1]];export{T as FeatureTileMeasurements3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{acosClamped as e}from"../../../../core/mathUtils.js";import t from"../../../../core/ObjectPool.js";import{f as s,h as r,g as i,n,
|
|
5
|
+
import{acosClamped as e}from"../../../../core/mathUtils.js";import t from"../../../../core/ObjectPool.js";import{f as s,h as r,g as i,n,z as o,k as u,r as c,s as a,o as l,b as d,F as _,D as h}from"../../../../chunks/vec32.js";import{create as f,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{projectBuffer as T}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as F}from"../../../../geometry/projection/projectVec3Array.js";import{PlaneIndex as g,PointIndex as E}from"../../../../geometry/support/frustum.js";import{create as I,projectVector as R,fromPoints as A,getNormal as O,signedDistance as S}from"../../../../geometry/support/plane.js";import{wrap as b}from"../../../../geometry/support/ray.js";import{ViewingMode as P}from"../../../ViewingMode.js";import{FeatureTileDescriptor3D as B,Visibility as H}from"./FeatureTileDescriptor3D.js";import{Frustum as j}from"../../state/Frustum.js";import{FrustumExtentIntersection as x}from"../../support/FrustumExtentIntersection.js";class N{constructor(e){this._renderCoordsHelper=e,this._surfaceElevation=0,this._cache=new Map,this._frustumBoundingSphereCenter=f(),this._frustumBoundingSphereRadius=0,this._frustum=new j(e),this._extendedFrustum=new j(e),this._intersector=new x({renderCoordsHelper:e}),this._renderCoordsHelper=e}begin(e,t){this._surfaceElevation=t,this._aboveGround=this._renderCoordsHelper.getAltitude(e.eye)>t,this._frustum.update(e),this._shortenFrustumFarPlane(this._frustum),this._updateExtendedFrustum(e),this._updateFrustumBoundingSphere()}end(){this._cache.clear()}calculate(e){const t=this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]>=V&&e.lij[0]<G,s=this._getOrCalculateSingleTileVisibility(e,!t);return s!==H.INVISIBLE&&t?this._calculateAggregatedChildrenVisibility(e):s}_shortenFrustumFarPlane(e){const t=j.nearFarLineIndices,n=e.mutablePoints;for(const o of t){const[e,t]=o,u=n[e],c=n[t];s(v,c,u),r(v,v,C),i(n[t],u,v)}e.updatePoints(n)}_calculateAggregatedChildrenVisibility(e){let t=H.INVISIBLE;const s=this._cache.get(e.id);if(null!=s)return s;const r=U.acquire();e.getChildren(r);for(const i of r){const e=this.calculate(i);if(e!==H.INVISIBLE&&(t=e,e===H.VISIBLE_ON_SURFACE))break}return U.release(r),this._cache.set(e.id,t),t}_getOrCalculateSingleTileVisibility(e,t){const s=this._cache.get(e.id);if(null!=s)return s;const r=this._calculateSingleTileVisibility(e);return t&&this._cache.set(e.id,r),r}_calculateSingleTileVisibility(e){if(!this._aboveGround&&this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]<M){return this._calculateSingleTileVisibilitySided(e,!1)===H.INVISIBLE?this._calculateSingleTileVisibilitySided(e,!0):void 0}return this._calculateSingleTileVisibilitySided(e,this._aboveGround)}_isTileVisibleInFrustum(e){return this._renderCoordsHelper.viewingMode===P.Local?this._isTileVisibleInFrustumLocal(e):this._isTileVisibleInFrustumGlobal(e)}_updateFrustumBoundingSphere(){const e=this._frustum,t=e.origin,s=ce;n(s,e.direction);const r=e.points,i=ae;o(i,r[4],t);const a=.5*u(i,i)/u(s,i),l=this._frustumBoundingSphereCenter;c(l,t,s,a);const d=1+a;this._frustumBoundingSphereRadius=d}_isTileVisibleInFrustumLocal(e){const t=e.tilingScheme.spatialReference,s=e.extent,r=this._renderCoordsHelper.spatialReference,i=Q;if(i[0]=s[0],i[1]=s[1],i[2]=0,i[3]=s[2],i[4]=s[3],i[5]=0,!T(i,t,0,i,r,0,2))return!1;const n=Z;a(n[0],i[0],i[1],0),a(n[1],i[3],i[1],0),a(n[2],i[3],i[4],0),a(n[3],i[0],i[4],0);const d=$;a(d,.5*(i[0]+i[3]),.5*(i[1]+i[4]),.5*(i[2]+i[5]));const _=ee;a(_,0,0,1);const h=.5*l(n[0],n[2]),f=this._frustum,m=this._frustumBoundingSphereRadius,p=this._frustumBoundingSphereCenter,F=de;o(F,p,d);const g=u(_,F),E=le;c(E,d,_,g);if(l(E,p)>h+m)return!1;const I=K,R=g+m,A=g-m;for(let o=0;o<4;++o)c(I[o],n[o],_,R),c(I[o+4],n[o],_,A);return!X(f.planes,I,8)}_isTileVisibleInFrustumGlobal(e){const t=e.tilingScheme.spatialReference,s=e.extent,_=this._renderCoordsHelper.spatialReference;if(e.lij[0]<Y)return!0;const h=Z,f=.5*(s[0]+s[2]);if(a(h[0],s[0],s[1],0),a(h[1],s[2],s[1],0),a(h[2],s[2],s[3],0),a(h[3],s[0],s[3],0),a(h[4],f,s[1],0),a(h[5],f,s[3],0),!F(h,t,0,h,_,0,6))return!1;const T=h[0][2]>0,g=h[3][2]<0,E=T||g,I=p(_).radius;if(E){const e=m(0,0,1),t=se;D(t,e,h[0]);const s=re;if(D(s,e,h[1]),T){const r=te,i=h[4],n=ie;D(n,i,e),D(r,n,i);const o=h[0];d(o,t,r),k(o,I);const u=h[1];d(u,s,r),k(u,I)}else if(g){const r=te,i=h[5],n=ie;D(n,i,e),D(r,i,n);const o=h[3];d(o,r,t),k(o,I);const u=h[2];d(u,r,s),k(u,I)}}const R=$;{const e=pe;o(e,h[3],h[0]),n(e,e);const t=Te;i(t,h[0],h[3]),r(t,t,.5);const s=-u(t,e),a=Fe,l=ge;i(a,h[0],h[1]),r(a,a,.5),i(l,h[2],h[3]),r(l,l,.5);const d=Ee;o(d,l,a),n(d,d);const _=-(s+u(e,a))/u(e,d);c(R,a,d,_),k(R,I)}const A=this._frustumBoundingSphereRadius,O=this._frustumBoundingSphereCenter,S=this._frustum,b=S.planes;if(h.some((e=>S.intersectsPoint(e))))return!0;if(S.intersectsPoint(R))return!0;const P=ne;n(P,R);const B=he;o(B,O,_e);const H=u(B,P);if(H<-A)return!1;const j=ue;n(j,h[0]);const x=u(j,P);if(x<=0)return!0;const N=oe;r(N,P,H);const V=l(N,O),G=t.isWGS84,M=e.lij,C=G&&M[2]===2**M[0]-1,L=G&&0===M[2],v=L?je:C?Be:be,y=L?xe:C?He:Pe,w=S.points;{const e=h,t=Ne,s=Ie,r=Re,i=_e;for(const n of v){const o=e[n];if(W(s,e[(n+1)%4],o),W(r,i,o),D(t,r,s),J(t,w,1))return!1}}let U=null;if(H<2*A){const e=2.5*A;if(V>x*e+A)return!1;const t=me,s=e/x;for(let i=0;i<4;++i)r(t[i],h[i],s/I);a(t[4],0,0,0),U=t}else{const e=(H+A)/x,t=(H-A)/x,s=fe;for(let i=0;i<4;++i){const n=h[i];r(s[i+4],n,t/I),r(s[i],n,e/I)}U=s}if(X(b,U,U.length))return!1;const z=S.lines,q=Ae,K=Oe;for(const r of y){n(q,h[r]);for(const e of z)if(n(K,e.direction),Ce(K,q,U,w))return!1}return!0}_calculateSingleTileVisibilitySided(e,t){if(this._isTileVisibleInFrustum(e)){this._intersector.update(e.extent,e.tilingScheme.spatialReference,this._surfaceElevation,t);const s=p(e.tilingScheme.spatialReference).radius;return this._intersector.isVisibleInFrustum(this._frustum,s,!0)?H.VISIBLE_ON_SURFACE:H.VISIBLE_WHEN_EXTENDED}return H.INVISIBLE}_updateExtendedFrustum(t){this._extendedFrustum.update(t),this._shortenFrustumFarPlane(this._extendedFrustum);const s=this._renderCoordsHelper.worldUpAtPosition(t.eye,v);this._aboveGround||_(s,s);const i=e(-u(s,t.viewForward));if(this._hasExtendedFrustum=i>t.fovY/2,!this._hasExtendedFrustum)return;const n=this._extendedFrustumParameters(),o=this._extendedFrustum.mutablePoints;for(let e=0;e<4;e++){const t=n.pointIndices[e],s=o[t],i=this._renderCoordsHelper.getAltitude(s);if(n.needsAltitudeAdjustment(i)){switch(this._renderCoordsHelper.worldUpAtPosition(s,v),t){case E.FAR_BOTTOM_LEFT:case E.FAR_TOP_LEFT:case E.NEAR_BOTTOM_LEFT:case E.NEAR_TOP_LEFT:R(this._extendedFrustum.planes[g.LEFT],v,v);break;case E.FAR_BOTTOM_RIGHT:case E.FAR_TOP_RIGHT:case E.NEAR_BOTTOM_RIGHT:case E.NEAR_TOP_RIGHT:R(this._extendedFrustum.planes[g.RIGHT],v,v)}r(v,v,n.direction),this._renderCoordsHelper.intersectInfiniteManifold(b(s,v),n.zWithMargin,s)}}if(this._extendedFrustum.updatePoints(o),A(o[E.NEAR_BOTTOM_LEFT],o[E.NEAR_BOTTOM_RIGHT],o[E.NEAR_TOP_RIGHT],y),A(o[E.NEAR_BOTTOM_RIGHT],o[E.NEAR_TOP_RIGHT],o[E.NEAR_TOP_LEFT],w),u(O(y),O(w))<0){const e=this._extendedFrustum.mutablePoints;this._aboveGround?[e[E.NEAR_BOTTOM_LEFT],e[E.NEAR_BOTTOM_RIGHT]]=[e[E.NEAR_BOTTOM_RIGHT],e[E.NEAR_BOTTOM_LEFT]]:[e[E.NEAR_TOP_LEFT],e[E.NEAR_TOP_RIGHT]]=[e[E.NEAR_TOP_RIGHT],e[E.NEAR_TOP_LEFT]],this._extendedFrustum.updatePoints(e)}}_extendedFrustumParameters(){return this._aboveGround?this._extendedFrustumParametersAboveSurface():this._extendedFrustumParametersBelowSurface()}_extendedFrustumParametersAboveSurface(){const e=this._surfaceElevation-L;return{zWithMargin:e,pointIndices:j.planePointIndices.bottom,direction:-1,needsAltitudeAdjustment:t=>t>e}}_extendedFrustumParametersBelowSurface(){const e=this._surfaceElevation+L;return{zWithMargin:e,pointIndices:j.planePointIndices.top,direction:1,needsAltitudeAdjustment:t=>t<e}}}const V=2,G=6,M=12,C=.95,L=1,v=f(),y=I(),w=I(),U=new t(Array,(e=>{4!==e.length&&(e[0]=new B,e[1]=new B,e[2]=new B,e[3]=new B)}),(e=>{e[0].release(),e[1].release(),e[2].release(),e[3].release()}));function D(e,t,s){return d(e,t,s),n(e,e),e}function W(e,t,s){return o(e,t,s),n(e,e),e}function k(e,t){return r(e,e,t/h(e)),e}const z=[g.LEFT,g.RIGHT,g.BOTTOM,g.TOP,g.FAR];function q(e,t,s){for(let r=0;r<s;++r)if(S(e,t[r])<0)return!1;return!0}function X(e,t,s){for(const r of z)if(q(e[r],t,s))return!0;return!1}const Y=3;function J(e,t,s){for(const r of t)if(u(r,e)<s)return!1;return!0}const K=[f(),f(),f(),f(),f(),f(),f(),f()],Q=[0,0,0,0,0,0],Z=[f(),f(),f(),f(),f(),f()],$=f(),ee=f(),te=f(),se=f(),re=f(),ie=f(),ne=f(),oe=f(),ue=f(),ce=f(),ae=f(),le=f(),de=f(),_e=m(0,0,0),he=f(),fe=[f(),f(),f(),f(),f(),f(),f(),f()],me=[f(),f(),f(),f(),f()],pe=f(),Te=f(),Fe=f(),ge=f(),Ee=f(),Ie=f(),Re=f(),Ae=f(),Oe=f(),Se=f(),be=[0,1,2,3],Pe=[0,1,2,3],Be=[0,1,3],He=[0,1,3],je=[1,2,3],xe=[1,2,3],Ne=f();function Ve(e,t,s){let r=1/0,i=-1/0;for(const n of s){const e=u(t,n);r=Math.min(r,e),i=Math.max(i,e)}e[0]=r,e[1]=i}function Ge(e,t,s,r){let i=1/0,n=-1/0;for(const o of r){const r=u(s,o);if(i=Math.min(i,r),n=Math.max(n,r),i<=t&&n>=e)return!1}return!0}const Me=[0,0];function Ce(e,t,s,r){const i=Se;D(i,e,t);const n=Me;return Ve(n,i,s),Ge(n[0],n[1],i,r)}export{N as FeatureTileVisibility3D,Y as globalTileLevelThreshold,X as isConvexHullOutsideOfFrustum};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as e,
|
|
5
|
+
import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as e,k as s,f as i,h as a,g as m,c as n,r as c,n as l,b as f}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as p}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as N}from"../../../../geometry/support/DoubleArray.js";import{create as g,fromArray as b,getNormal as u}from"../../../../geometry/support/plane.js";import{ViewingMode as j}from"../../../ViewingMode.js";function T(t,r,e,s,i=1){if(e.isGeographic&&s===j.Global){const t=N(r.length),o=r.length,s=h(e);for(let e=0;e<o;e+=3)p(r,e,t,e,s);r=t}o(y,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);for(let o=0;o<r.length;o+=3)y[0]=Math.min(y[0],r[o]),y[1]=Math.min(y[1],r[o+1]);const a=y[0]%i,m=y[1]%i,n=y[0]-a,c=y[1]-m;for(let o=0;o<r.length;o+=3){const e=o/3*4;t[e]=(r[o]-n)/i,t[e+1]=(r[o+1]-c)/i,t[e+2]=n/i,t[e+3]=c/i}}function M(t,r,n,c,l=1){e(F,1,0,0),e(Y,0,1,0),e(_,0,0,1),D(x,n),b(V,n)&&O(V,F,Y,_,c,x),o(y,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),o(P,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let o=0;o<n.length;o+=3){e(E,n[o],n[o+1],n[o+2]);const t=s(F,E),r=s(Y,E);y[0]=Math.min(y[0],t),y[1]=Math.min(y[1],r),P[0]=Math.max(P[0],t),P[1]=Math.max(P[1],r)}const f=s(_,x);q(v,y[0],y[1],f,F,Y,_),q(A,P[0],y[1],f,F,Y,_),q(G,y[0],P[1],f,F,Y,_),i(A,A,v),a(A,A,.5),i(G,G,v),a(G,G,.5),m(v,v,A),m(v,v,G);const I=y[0]%l,h=y[1]%l,p=y[0]-I,N=y[1]-h;for(let o=0;o<n.length;o+=3){e(E,n[o],n[o+1],n[o+2]);const i=o/3,a=4*i;t[a]=(s(F,E)-p)/l,t[a+1]=(s(Y,E)-N)/l,t[a+2]=p/l,t[a+3]=N/l;const m=9*i;for(let t=0;t<3;t++)r[m+t]=v[t],r[m+t+3]=A[t],r[m+t+6]=G[t]}}const x=I(),E=I(),V=g(),F=I(),Y=I(),_=I(),y=r(),P=r(),v=I(),A=I(),G=I();function O(t,o,r,i,m,I){null!=m?(m.basisMatrixAtPosition(I,S),e(d,S[0],S[1],S[2]),e(k,S[4],S[5],S[6]),e(w,S[8],S[9],S[10])):(e(d,1,0,0),e(k,0,1,0),e(w,0,0,1));const h=u(t);s(h,w)<0&&a(h,h,-1),n(i,h);const p=s(h,k),N=s(h,d);Math.abs(p)>Math.abs(N)?(c(o,d,h,-N),l(o,o),f(r,o,h),l(r,r),a(r,r,-1)):(c(r,k,h,-p),l(r,r),f(o,r,h),l(o,o))}const S=t(),d=I(),k=I(),w=I();function D(t,o){e(U,0,0,0);for(let r=0;r<o.length-3;r+=3)U[0]+=o[r],U[1]+=o[r+1],U[2]+=o[r+2];a(t,U,1/(o.length/3-1))}const U=I();function q(t,o,r,s,i,a,m){e(t,o*i[0]+r*a[0]+s*m[0],o*i[1]+r*a[1]+s*m[1],o*i[2]+r*a[2]+s*m[2])}export{M as createMapSpaceUVCoords,T as createMapSpaceUVCoordsDraped};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as t,
|
|
5
|
+
import{c as t,E as i}from"../../../chunks/vec32.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{PointIndex as e,create as r,createPoints as n,fromMatrix as o,computePlanes as u,intersectsSphere as h,intersectsRay as _,intersectsLineSegment as l,intersectsPoint as p,planePointIndices as a}from"../../../geometry/support/frustum.js";class c{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}constructor(t){this.renderCoordsHelper=t,this.frustum=r(),this._points=n(),this.lines=new Array(12),this._origin=s(),this._direction=s(),this._altitude=null;for(let i=0;i<12;i++)this.lines[i]={origin:null,direction:s(),endpoint:null}}update(i){o(i.viewMatrix,i.projectionMatrix,this.frustum,this._points),t(this._origin,i.eye),t(this._direction,i.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines()}updatePoints(i){for(let s=0;s<this._points.length;s++)t(this._points[s],i[s]);u(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(t){return h(this.frustum,t)}intersectsRay(t){return _(this.frustum,t)}intersectsLineSegment(t,i){return l(this.frustum,t,i)}intersectsPoint(t){return p(this.frustum,t)}_updateLines(){const t=this._points;for(let i=0;i<4;i++){const s=i+4;d(this.lines[i],t[i],t[s]),d(this.lines[i+4],t[i],3===i?t[0]:t[i+1]),d(this.lines[i+8],t[s],3===i?t[4]:t[s+1])}}}function d(t,s,e){t.origin=s,t.endpoint=e,i(t.direction,s,e)}c.planePointIndices=a,c.nearFarLineIndices=[[e.NEAR_BOTTOM_LEFT,e.FAR_BOTTOM_LEFT],[e.NEAR_BOTTOM_RIGHT,e.FAR_BOTTOM_RIGHT],[e.NEAR_TOP_RIGHT,e.FAR_TOP_RIGHT],[e.NEAR_TOP_LEFT,e.FAR_TOP_LEFT]];export{c as Frustum};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{f as r,n as s,
|
|
5
|
+
import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{f as r,n as s,k as n,l as a}from"../../../chunks/vec32.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as o}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{ViewingMode as l}from"../../ViewingMode.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";function c(e,t,i){return e===l.Global?new M(i):new u(t,i)}class u{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=o(t),this._unitInMeters=i(t,this._referenceEllipsoid.metersPerDegree)}compute(i,a,m,o,l){l||(l={near:0,far:0});let x=i[2]*this._unitInMeters;const c=x,u=x-o,M=this._elevationProvider?.visibleElevationBounds;M&&(x=u>=0?c-this._unitInMeters*M.min:this._unitInMeters*M.max-c);const _={x:(m=null!=m?m:new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-m.xmin,y:m.ymax-m.ymin,z:4*Math.max(m.xmax-m.xmin,m.ymax-m.ymin)},I=Math.max(_.x,_.y,_.z);r(E,a,i),v[0]=E[0]>0?m.xmax:m.xmin,v[1]=E[1]>0?m.ymax:m.ymin,v[2]=E[2]>0?I/2:-I/2,r(v,v,i),s(E,E);const j=1.1*n(v,E)*this._unitInMeters,g=Math.sqrt(x*(x+2*this._referenceEllipsoid.radius)),b=Math.max(m.xmax-m.xmin,m.ymax-m.ymin),w=b*d*this._unitInMeters,z=b*y*this._unitInMeters,U=t((x-z)/(w-z),0,1)**3,P=Math.min(e(g,j,U),g)*Math.max(Math.log(Math.abs(u)),1);return f(Math.min(P,Math.max(34064e4,I))/this._unitInMeters,p,this._unitInMeters,l)}}class M{constructor(e){this._referenceEllipsoid=o(e)}compute(i,r,s,n,m){m||(m={near:0,far:0});const o=a(i),h=o-this._referenceEllipsoid.radius,l=this._referenceEllipsoid.radius+Math.min(0,n),c=Math.abs(h-n),u=Math.max(c,Math.abs(h)),M=Math.sqrt(u*(u+2*l)),p=o+this._referenceEllipsoid.radius;return f(1.2*e(M,p,x(u)),t(2e4-(Math.log(u)-7.983)/9.011*19e3,1e3,2e4),1,m)}}function f(e,t,i,r){const s=_/i;return e/t>s?(r.far=e,r.near=r.far/t):(r.near=s,r.far=r.near*t),r}const p=2e4,_=2,d=.001,y=1e-4,v=m(),E=m();export{c as createNearFarHeuristic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as p,e as h,g as d,h as u,c as _,E as f,l as v,s as C,n as g,b as y,p as w,D as O,j as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{j as L,k as M,t as T}from"../../../../chunks/sphere.js";import{angle as A}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as D}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as U}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as R}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as H}from"../Constraints.js";import{InteractiveController as N}from"./InteractiveController.js";import{panMotionToRotationMatrix as k,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as G}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as V}from"../../support/cameraUtils.js";import{createDirectionUp as B}from"../../support/cameraUtilsInternal.js";import{Camera as K}from"../../webgl-engine/lib/Camera.js";import{extractTransformation as X,isZeroTransformation as Z,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends N{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(D.ALL,U.NONE,0,new K,null,R.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||Z(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);Z(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=U.NONE,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;p(rt,e.center,e.eye),h(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=h(rt,e.up,t.matrix),this._constraintOptions.interactionType=U.LOOK_AROUND,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=h(rt,e.eye,t.matrix),e.center=h(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=h(rt,e.up,t.matrix)),this._constraintOptions.interactionType=U.PAN,this._constraintOptions.selection=D.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=U.ZOOM,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=U.ASCEND,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,p=C(E.get(),s[0],s[1],0);g(p,p);const h=m.translation[0]*t.pan;if(0!==h){const t=u(E.get(),o,h);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),p,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,H.min,H.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),k(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const p=-o.heading*t.rotate;0!==p&&(c(i.rotate.matrix,i.rotate.matrix,p,this._tmpCamera.eye),i.rotate.enabled=!0);const h=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(h,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(H.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(H.max,e.origin,a,r)}else{L(M(T,a+r.radius),e,c);const t=Math.PI+A(e.direction,c);s=G(t,e.origin,a,r),n=G(H.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=V(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=p(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,p=$*r.width,h=c*Math.tan(.5*r.fovX)/m,d=h/a,u=h/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:h)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*p,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||Z(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=B();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as p,e as h,g as d,h as u,c as _,F as f,l as v,s as C,n as g,b as y,q as w,E as O,k as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{j as L,k as M,t as T}from"../../../../chunks/sphere.js";import{angle as A}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as U}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as D}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as R}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as N,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as F}from"../utils/navigationUtils.js";import{viewAngle as G}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as V}from"../../support/cameraUtils.js";import{createDirectionUp as B}from"../../support/cameraUtilsInternal.js";import{Camera as K}from"../../webgl-engine/lib/Camera.js";import{extractTransformation as X,isZeroTransformation as q,extractTransformationKeyboard as Z}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(U.ALL,D.NONE,0,new K,null,R.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||q(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,Z(this._keysButtonState,this._transformation)}deactivateDirection(t){this._keysButtonState[t]=0;const e=Z(this._keysButtonState,this._transformation);q(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=D.NONE,this._constraintOptions.selection=U.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;p(rt,e.center,e.eye),h(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=h(rt,e.up,t.matrix),this._constraintOptions.interactionType=D.LOOK_AROUND,this._constraintOptions.selection=U.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=h(rt,e.eye,t.matrix),e.center=h(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=h(rt,e.up,t.matrix)),this._constraintOptions.interactionType=D.PAN,this._constraintOptions.selection=U.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=D.ZOOM,this._constraintOptions.selection=U.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=D.ASCEND,this._constraintOptions.selection=U.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=U.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,p=C(E.get(),s[0],s[1],0);g(p,p);const h=m.translation[0]*t.pan;if(0!==h){const t=u(E.get(),o,h);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),p,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=G(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,k.min,k.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),N(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const p=-o.heading*t.rotate;0!==p&&(c(i.rotate.matrix,i.rotate.matrix,p,this._tmpCamera.eye),i.rotate.enabled=!0);const h=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(h,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(k.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=G(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(k.max,e.origin,a,r)}else{L(M(T,a+r.radius),e,c);const t=Math.PI+A(e.direction,c);s=F(t,e.origin,a,r),n=F(k.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=V(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=p(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,p=$*r.width,h=c*Math.tan(.5*r.fovX)/m,d=h/a,u=h/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:h)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*p,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||q(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=B();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as a,rotate as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c,f as l,l as _,
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as a,rotate as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c,f as l,l as _,k as v,n as f,g as C,h as P,b as u,e as w}from"../../../../chunks/vec32.js";import{create as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{applyAll as R}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as T}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as y}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{getVoxelWasm as g}from"../../layers/VoxelWasm.js";import{TiltRange as x}from"../Constraints.js";import{InteractiveController as M}from"./InteractiveController.js";import{contentIntersectorOptions as O,normalizeCoordinate as b,rotatePivotDistanceModifier as D,rotatePivotMinDistanceModifier as A,decideNavigationMode as N,rotateScreenPixelArea as L,NavigationMode as V}from"../utils/navigationUtils.js";var k;!function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"}(k||(k={}));let H=class extends M{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(t){super(t),this.pivot=k.CENTER,this._rotScale=0,this._lastPoint=m(),this._tmpWorldUp=E(),this._tmpViewDir=E(),this._tmpRotCurPoint=m(),this._tmpTransf=p(),this._tmpAxis=E(),this._tmpPivotPoint=E(),this._pivotPos=E(),this._constraintOptions=new j(T.ALL,y.TUMBLE,0,this.startCamera)}initialize(){this._rotScale=this.pivot===k.CENTER?3:1.5}begin(t){if(this.active){switch(this.pivot){case k.EYE:c(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=y.LOOK_AROUND,this._constraintOptions.tiltMode=U.LOOK_AROUND,this._constraintOptions.selection=T.NONE;break;case k.CENTER:{const i=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,0===this.view.map.ground.opacity?O:{});i||c(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(t,i),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=y.TUMBLE,this._constraintOptions.tiltMode=U.TUMBLE,this._constraintOptions.selection=T.ALL&~T.DISTANCE;break}}b(this.startCamera,t,this._lastPoint)}}_constrainPivotPoint(t,i){const s=this.startCamera,o=E();l(o,this._pivotPos,s.eye);const e=_(o),a=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(s.eye,I);let n=Math.max(Math.min(D,1/Math.abs(v(I,s.viewForward)))*a,A);i&&(n=Math.min(e,n));const p=d(this.view.spatialReference),h=r(s.width/s.pixelRatio*.5,s.height/s.pixelRatio*.5),m=N(this.startCamera,h,p);let u=this.view._stage.renderView.getMinimalDepthForArea(g(this.view),s.fullWidth/s.pixelRatio*.5,s.fullHeight/s.pixelRatio*.5,s,2.5*L,L),w=this.view._stage.renderView.getMinimalDepthForArea(g(this.view),t[0],t[1],s,L);null==u&&null==w||(u=u??w??0,w=null==w||m===V.Horizontal?u:w,n=u>w?w:u,n=i?Math.min(n,e):n),f(o,o),c(this._pivotPos,C(this._tmpPivotPoint,s.eye,P(this._tmpPivotPoint,o,n)))}update(t){if(this.active){switch(this.pivot){case k.EYE:this.currentCamera.center=this._applyRotation(this.currentCamera,t,this.currentCamera.center,this._pivotPos);break;case k.CENTER:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,t,this.currentCamera.eye,this._pivotPos)}R(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.active&&this.finishController()}_applyRotation(t,r,o,e){this.view.renderCoordsHelper.worldUpAtPosition(e,this._tmpWorldUp),b(t,r,this._tmpRotCurPoint);let p=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotScale,m=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotScale;l(this._tmpViewDir,o,e);const c=_(this._tmpViewDir),f=i(v(this._tmpViewDir,this._tmpWorldUp)/c);if(this.pivot===k.EYE){p*=-.5;const t=.5*Math.PI-f,i=.5*Math.PI*.99;p=t-Math.max(-i,Math.min(i,t+p))}return p=s(p+f,x.min,x.max)-f,u(this._tmpAxis,t.up,this._tmpViewDir),this.pivot===k.CENTER&&(m=-m),a(this._tmpTransf,m,this._tmpWorldUp),n(this._tmpTransf,this._tmpTransf,p,this._tmpAxis),w(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),t.up=w(S,t.up,this._tmpTransf),C(S,e,this._tmpViewDir),h(this._lastPoint,this._tmpRotCurPoint),S}};t([o()],H.prototype,"pivot",void 0),H=t([e("esri.views.3d.state.controllers.RotateController")],H);const S=E(),I=E();export{k as PivotPoint,H as RotateController};
|