@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{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as e}from"../../../../core/mathUtils.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.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 o}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a,
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as e}from"../../../../core/mathUtils.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.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 o}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a,q as n,h as c,g as u,j as l,p as d}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import f from"../../../../geometry/Point.js";import{projectBoundingRect as m}from"../../../../geometry/projection/projectBoundingRect.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{debugFlags as S}from"../debugFlags.js";import{PropertiesPool as g}from"../PropertiesPool.js";import{PointOfInterest as y}from"./PointOfInterest.js";import{Yield as A}from"../../../support/Yield.js";const j=Array;let L=class extends y{constructor(t){super(t),this._propertiesPool=new g({location:f,renderLocation:j},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=p(),this.updating=!1}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=r(this._frameWorker),this._propertiesPool=s(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const t=this._propertiesPool.get("location");return t.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,t),t}updateRenderLocation(){this.updating=!0,this._updateRenderLocation()}get estimatedSurfaceAltitude(){return this._latestSurfaceAltitude}get running(){return this.updating}runTask(){return this._latestSurfaceAltitude=this.estimateSurfaceAltitudeAtCenter(),this._updateRenderLocation(),this.updating=!1,A}_updateRenderLocation(){const t=C;let e=this._calculateSurfaceIntersection(this._currentSurfaceAltitude,t);const r=this._currentSurfaceAltitude!==this._latestSurfaceAltitude;!e&&r&&(e=this._calculateSurfaceIntersection(this._latestSurfaceAltitude,t),e&&(this._currentSurfaceAltitude=this._latestSurfaceAltitude));const s=v;e&&this._latestSurfaceAltitudeChangesDistanceSignificantly(t,s)&&(a(t,s),this._currentSurfaceAltitude=this._latestSurfaceAltitude),e?this.distance=n(this._camera.eye,t):(c(t,this._camera.viewForward,this._get("distance")),u(t,t,this._camera.eye)),l(this._get("renderLocation"),t)||this._set("renderLocation",a(this._propertiesPool.get("renderLocation"),t))}_calculateSurfaceIntersection(t,r){const s=this._camera;if(!this.renderCoordsHelper.intersectInfiniteManifold(s.ray,t,r))return!1;if(this.state.isGlobal){const e=h(this.renderCoordsHelper.spatialReference).radius,i=e+t,o=d(s.eye),a=o<i*i,l=n(s.eye,r);if(a&&l>e/4){const t=i-Math.sqrt(o);return c(r,s.viewForward,t),u(r,r,s.eye),!0}}else{const t=this.surface?.ready?this.surface.extent:null;null!=t&&m(t,this.surface?.spatialReference,k,this.renderCoordsHelper.spatialReference)&&(r[0]=e(r[0],k[0],k[2]),r[1]=e(r[1],k[1],k[3]))}return!0}_latestSurfaceAltitudeChangesDistanceSignificantly(t,e){if(this._latestSurfaceAltitude===this._currentSurfaceAltitude||null==t)return!1;if(this._calculateSurfaceIntersection(this._latestSurfaceAltitude,e)){if(S.TESTS_DISABLE_OPTIMIZATIONS)return!0;const r=this._camera.eye,s=n(r,t),i=n(r,e);if(Math.abs(i-s)/s>R)return!0}return!1}};t([i({constructOnly:!0})],L.prototype,"scheduler",void 0),t([i({constructOnly:!0})],L.prototype,"task",void 0),t([i()],L.prototype,"distance",void 0),t([i({constructOnly:!0})],L.prototype,"estimateSurfaceAltitudeAtCenter",void 0),t([i({readOnly:!0})],L.prototype,"location",null),t([i({readOnly:!0})],L.prototype,"renderLocation",void 0),t([i()],L.prototype,"updating",void 0),L=t([o("esri.views.3d.support.CenterOnSurface")],L);const R=.05,C=p(),v=p(),k=_();export{L as CenterOnSurface};
|
|
@@ -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{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{k as a,G as c,c as p,m as d,f as l,n as u}from"../../../../chunks/vec32.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../../geometry/Point.js";import{wrap as f}from"../../../../geometry/support/ray.js";import{PropertiesPool as g}from"../PropertiesPool.js";import{PointOfInterest as y}from"./PointOfInterest.js";import{PaddingSide as P}from"../../webgl-engine/lib/Camera.js";import{TaskPriority as _}from"../../../support/Scheduler.js";import{Yield as j}from"../../../support/Yield.js";const L=Array;let O=class extends y{constructor(e){super(e),this._propertiesPool=new g({location:m,renderLocation:L},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([o((()=>this.centerOnSurface.renderLocation),(()=>this.updateRenderLocation())),o((()=>this.state.contentCamera),(()=>this.updateRenderLocation()))]),this.scheduler&&this.addHandles(this.scheduler.registerTask(_.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=r(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return e.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e),e}get worldUnitsPerContentPixel(){const{camera:e,contentPixelRatio:t}=this.state;return e.computeRenderPixelSizeAt(this.renderLocation)*(e.pixelRatio/t)}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,i=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,S);const s=Math.max(0,(Math.acos(a(S,i.viewForward))-.5*Math.PI)*(i.aboveGround?1:-1));if(Number.isNaN(s)){if(!e||!c(e,r)){const e=this._propertiesPool.get("renderLocation");p(e,r),this._set("renderLocation",e)}return j}const n=1-t(s/(.5*Math.PI),0,1),l=n*n*n;this._calculateScreenHorizontalEdgeOnSurface(C);const u=this._propertiesPool.get("renderLocation");return d(u,r,C,l),e&&c(e,u)||this._set("renderLocation",u),j}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,r=t.getRenderCenter(i());if(r[1]=t.aboveGround?t.padding[P.BOTTOM]:t.fullHeight-t.padding[P.TOP],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const o=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(r,R)){l(R,R,t.eye);const r=u(R,R);if(this.renderCoordsHelper.intersectInfiniteManifold(f(t.eye,r),o,e))return e}return this.renderCoordsHelper.setAltitude(e,o,t.eye)}updateRenderLocation(){this._dirty=!0}};e([s()],O.prototype,"_dirty",void 0),e([s({constructOnly:!0})],O.prototype,"scheduler",void 0),e([s({constructOnly:!0})],O.prototype,"centerOnSurface",void 0),e([s({constructOnly:!0})],O.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),e([s()],O.prototype,"updating",null),e([s()],O.prototype,"location",null),e([s()],O.prototype,"renderLocation",void 0),e([s()],O.prototype,"worldUnitsPerContentPixel",null),O=e([n("esri.views.3d.support.pointsOfInterest.Focus")],O);const S=h(),R=h(),C=h();export{O as Focus};
|
|
@@ -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 t from"../../../../core/Accessor.js";import{watch as r,sync as s,when as n,on as i,initial as o}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as u,
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{watch as r,sync as s,when as n,on as i,initial as o}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as u,j as h,c as d}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p}from"../../../../geometry/support/ray.js";import{debugFlags as _}from"../debugFlags.js";import{PointGraphics as m}from"../debugUtils.js";import{PropertiesPool as l}from"../PropertiesPool.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as y}from"./CameraOnSurface.js";import{CenterOnSurface as A}from"./CenterOnSurface.js";import{ContentGeometryUpdates as O}from"./ContentGeometryUpdates.js";import{Focus as g}from"./Focus.js";import{StableSurfaceCenter as w}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as I}from"./SurfaceGeometryUpdates.js";import{newIntersector as S}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as v}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{terrainId as b}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{TaskPriority as R}from"../../../support/Scheduler.js";let P=class extends t{constructor(e){super(e),this.renderPointOfView=f(),this._pois=new Array,this._debugCenters=new Map,this._tmpRay=p(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._propertiesPool=new l({renderPointOfView:T},this)}initialize(){const{state:e,basemapTerrain:t,renderCoordsHelper:a,map:c}=this.view;this._surfaceIntersector=S(e.viewingMode),e.isGlobal?this._surfaceIntersector.options.backfacesTerrain=!1:this._surfaceIntersector.options.backfacesTerrain=!0,this._surfaceIntersector.options.invisibleTerrain=!1,this._surfaceIntersector.options.store=v.MIN,this._contentIntersector=S(e.viewingMode);const u=()=>this._estimateSurfaceAltitudeAtCenter(),h=this.view.resourceController.scheduler,d=this.view.basemapTerrain?.elevationQueryCache,f={state:e,scheduler:h,surface:t,renderCoordsHelper:a};this._set("centerOnSurfaceInfrequent",new A({...f,task:R.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnSurfaceFrequent",new A({...f,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnContent",new A({...f,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:()=>this._estimateContentAltitudeAtCenter()})),this._set("cameraOnSurface",new y({...f,cache:d,task:R.POINT_OF_INTEREST_INFREQUENT,map:c})),this._set("surfaceGeometryUpdates",new I({...f,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set("contentGeometryUpdates",new O({contentLayerViews:this.view.allLayerViews,renderCoordsHelper:a})),this._set("surfaceOrigin",new w({cache:d,view:this.view})),this._set("focus",new g({state:e,scheduler:h,surface:t,renderCoordsHelper:a,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(e,t)=>this._estimateSurfaceIntersectionAtRenderPoint(e,this.view.state.contentCamera,t)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus);const p=this.view.graphics;this._debugCenters.set(this.centerOnContent,new m(p,"red","CenterOnContent")),this._debugCenters.set(this.centerOnSurfaceFrequent,new m(p,"red","CenterOnSurface")),this._debugCenters.set(this.centerOnSurfaceInfrequent,new m(p,"red","CenterOnSurface")),this._debugCenters.set(this.cameraOnSurface,new m(p,"blue","CameraOnSurface")),this._debugCenters.set(this.focus,new m(p,"green","Focus")),this.addHandles([r((()=>e.contentCamera),(e=>this._cameraChanged(e)),s),r((()=>t.extent),(()=>this._updateCenterPointsOfInterest())),n((()=>!t.updating),(()=>this._updateCenterPointsOfInterest()),s),i((()=>this.surfaceGeometryUpdates.events),"request-update",(()=>this._updateCenterPointsOfInterest())),i((()=>this.contentGeometryUpdates.events),"request-update",(()=>this._updateCenterOnContent())),n((()=>_.SHOW_POI),(e=>this._setDebug(e)),o)]),this._cameraChanged(this.view.state.contentCamera);for(const r of this._pois)r.runTask()}destroy(){this._setDebug(!1),this._propertiesPool.destroy();for(const e of this._pois)e.destroy();this.surfaceOrigin.destroy()}get updating(){return!(!this.surfaceGeometryUpdates?.updating&&!this._pois.some((e=>e.updating)))}get _centerRay(){return this._centerRayDirty&&(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),this._centerRayDirty=!1),this._centerRayCached}_estimateContentAltitudeAtCenter(){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;this._contentAltitudeAtCenterDirty=!1;const e=this._centerRay;return null==e||(this.view.sceneIntersectionHelper.intersectRay(e,this._contentIntersector,j,E)?this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j):this._contentAltitudeAtCenter=this._estimateSurfaceAltitudeAtCenter()),this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(){if(!this.view.basemapTerrain)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;this._surfaceAltitudeAtCenterDirty=!1;const e=this._centerRay;if(null==e)return this._surfaceAltitudeAtCenter;const t=e.origin,r=u(j,e.origin,e.direction);return this._surfaceIntersector.resetWithRay(e,this.view.state.contentCamera),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,t,r),this._surfaceIntersector.results.min.getIntersectionPoint(j)&&(this._surfaceAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j)),this._surfaceAltitudeAtCenter}_estimateSurfaceIntersectionAtRenderPoint(e,t,r){const s=C(t,e,U);if(null==s)return null;const n=s.origin,i=u(j,s.origin,s.direction);return this._surfaceIntersector.resetWithRay(s,t),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,n,i),this._surfaceIntersector.results.min.getIntersectionPoint(r)?r:null}_cameraChanged(e){this._updateCenterPointsOfInterest();const t=e.eye;h(this.renderPointOfView,t)||this._set("renderPointOfView",d(this._propertiesPool.get("renderPointOfView"),t))}_updateCenterPointsOfInterest(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0;for(const e of this._pois)e.updateRenderLocation()}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)return this._debugCenters.forEach((e=>e.hide())),void this.removeHandles("debug");for(const t of this._pois)this.addHandles(r((()=>t.renderLocation),(e=>this._debugCenters.get(t)?.show(e,t.renderCoordsHelper.spatialReference)),o),"debug")}get test(){return{update:()=>{this.surfaceGeometryUpdates.runTask();for(const e of this._pois)e.runTask()},surfaceGeometryUpdates:this.surfaceGeometryUpdates}}};e([a()],P.prototype,"centerOnContent",void 0),e([a()],P.prototype,"centerOnSurfaceFrequent",void 0),e([a()],P.prototype,"centerOnSurfaceInfrequent",void 0),e([a()],P.prototype,"cameraOnSurface",void 0),e([a()],P.prototype,"focus",void 0),e([a()],P.prototype,"renderPointOfView",void 0),e([a()],P.prototype,"surfaceOrigin",void 0),e([a()],P.prototype,"contentGeometryUpdates",void 0),e([a()],P.prototype,"surfaceGeometryUpdates",void 0),e([a({constructOnly:!0})],P.prototype,"view",void 0),e([a()],P.prototype,"updating",null),P=e([c("esri.views.3d.support.PointsOfInterest")],P);const T=Array,j=f(),U=p(),E={exclude:new Set([b])};export{P as PointsOfInterest};
|
|
@@ -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 t,clamp as e}from"../../../core/mathUtils.js";import{fromRotation as i,identity as o,rotateX as n,rotateY as a,rotateZ as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as c,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,create as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as g,
|
|
5
|
+
import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{fromRotation as i,identity as o,rotateX as n,rotateY as a,rotateZ as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as c,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,create as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as g,m as f,n as d,h,e as b,g as y,c as p}from"../../../chunks/vec32.js";import{fromValues as A,create as w,clone as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as N}from"../../ViewingMode.js";import{S as v}from"../../../chunks/SunCalc.js";import{angle as T}from"./mathUtils.js";const M={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};class S{constructor(t,e){this.direct=t,this.ambient=e}}function j(i,o,n,a,l,r){g(r.ambient.color,1,1,1),r.ambient.intensity=M.global.ambient,g(r.direct.color,1,1,1),r.direct.intensity=M.global.direct;const c=o[2],s=e((Math.abs(c)-M.local.altitude)/(M.global.altitude-M.local.altitude),0,1);let u;if(r.globalFactor=s,null!=i&&(u=v.getTimes(i,o[1],o[0])),s<1){let e;if(null!=i)e=ot(i,u,a);else{const t=L(a);e={direct:{intensity:M.local.directAtNoon*t.direct,color:A(1,1,1)},ambient:{intensity:M.local.ambientAtNoon*t.ambient,color:A(1,1,1)},timeOfDay:"early afternoon"}}f(r.ambient.color,e.ambient.color,r.ambient.color,s),r.ambient.intensity=t(e.ambient.intensity,r.ambient.intensity,s),f(r.direct.color,e.direct.color,r.direct.color,s),r.direct.intensity=t(e.direct.intensity,r.direct.intensity,s),r.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,r.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}r.noonFactor=null!=i?F(i,u):1,null!=i?P(i,o,n,r.direct.directionToLightSource):O(l,n,r.direct.directionToLightSource)}function O(t,e,o){e===N.Global?d(lt,t.eye):g(lt,0,0,1),h(rt,t.viewForward,-1);const n=T(rt,lt),a=Math.max(n-2*st,0),l=.85*a/(a+1),r=Math.max(st,n-st-l);i(at,-r,t.viewRight),b(o,rt,at),y(o,o,h(ct,t.viewRight,ut)),d(o,o)}function P(t,i,r,c){const s=H,u=o(G);if(r===N.Global)v.getPosition(t,0,0,s),g(c,0,0,-1),n(u,u,-s.azimuth),a(u,u,-s.altitude),b(c,c,u);else{const o=M.planarDirection,a=o.globalAngles,r=i[2];let m=(Math.abs(r)-o.localAltitude)/(o.globalAltitude-o.localAltitude);m=e(m,0,1),m<1?(v.getPosition(t,i[1],i[0],s),s.azimuth=(1-m)*s.azimuth+m*a.azimuth,s.altitude=(1-m)*s.altitude+m*a.altitude):(s.azimuth=a.azimuth,s.altitude=a.altitude),g(c,0,-1,0),l(u,u,-s.azimuth),n(u,u,-s.altitude),b(c,c,u)}}function z(t,e){if(e===N.Global)return!0;const i=M.planarDirection;return Math.abs(t)<i.localAltitude}function D(t,e,i,o,n){const a=t.getTime(),l=e.getTime()-a,r=Math.floor(l/i)+1,c=new Array(r);for(let s=0;s<r;++s)nt.setTime(a+i*s),c[s]=w(),P(nt,o,n,c[s]);return c}const E=A(.5773502691896258,-.5773502691896258,.5773502691896258);class I{constructor(){this.ambient={color:A(1,1,1),intensity:.55},this.direct={color:A(1,1,1),intensity:.55,directionToLightSource:x(E)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const G=r(),H={azimuth:0,altitude:0};function F(t,i){const o=t.valueOf();let n,a;i.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):i.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=i.sunrise.valueOf(),a=i.sunset.valueOf());const l=n+(a-n)/2;return 1-e(Math.abs(o-l)/432e5,0,1)}function L(t){switch(t){case"disabled":case"sunny":case"cloudy":return new S(1,1);case"rainy":return new S(.4,1.2);case"snowy":return new S(.5,1.3);case"foggy":return new S(.2,1.6)}}function R(t,e){const i=(t[0]+t[1]+t[2])/3;t[0]+=(i-t[0])*e,t[1]+=(i-t[1])*e,t[2]+=(i-t[2])*e}const U=A(.01,.01,.01),_=A(1,.6,.5),k=A(1,.98,.98),V=A(1,1,1),C=A(.8,.8,1),q=A(.8,.8,1),B=A(.98,.98,1),J=A(1,1,1),K=u(.01,M.local.ambientAtNight),Q=u(M.local.directAtTwilight,M.local.ambientAtTwilight),W=u(.9*M.local.directAtNoon,M.local.ambientAtNoon),X=u(M.local.directAtNoon,M.local.ambientAtNoon),Y=W,Z=k,$=B,tt=Q,et=_,it=q;function ot(t,e,i){const o=t.valueOf();let n,a;e.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):e.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=e.sunrise.valueOf(),a=e.sunset.valueOf());const l=a-n,r=n+l/2,u=l/4,g=r-u,d=r+u,h=.06*l,b=n-h/2,y=n+h/2,A=a-h/2,x=a+h/2,N=m(),T=w(),M=w();let S="";if(o<b||o>x)c(N,K),p(T,U),p(M,C),S="night";else if(o<y){const t=(o-b)/(y-b);s(N,K,Q,t),f(T,U,_,t),f(M,C,q,t),S="sun rising"}else if(o<g){const t=(o-y)/(g-y);s(N,Q,W,t),f(T,_,k,t),f(M,q,B,t),S="early morning"}else if(o<r){const t=(o-g)/(r-g);s(N,W,X,t),f(T,k,V,t),f(M,B,J,t),S="late morning"}else if(o<d){const t=(o-r)/(d-r);s(N,X,Y,t),f(T,V,Z,t),f(M,J,$,t),S="early afternoon"}else if(o<A){const t=(o-d)/(A-d);s(N,Y,tt,t),f(T,Z,et,t),f(M,$,it,t),S="late afternoon"}else if(o<x){const t=(o-A)/(x-A);s(N,tt,K,t),f(T,et,U,t),f(M,it,C,t),S="sun setting"}let j=0;switch(i){case"rainy":case"foggy":j=.8;break;case"snowy":j=.5}j>0&&(R(T,j),R(M,j));const O=L(i);return{direct:{intensity:N[0]*O.direct,color:T},ambient:{intensity:N[1]*O.ambient,color:M},timeOfDay:S}}const nt=new Date(0),at=r(),lt=w(),rt=w(),ct=w(),st=.25,ut=.2;export{I as ColorAndIntensity,j as computeColorAndIntensity,D as computeDirectionsOverTime,z as computeShadowsEnabled,O as computeVirtualLightDirection};
|
|
@@ -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 t from"../../../Camera.js";import"../../../geometry.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as r}from"../../../core/Cyclical.js";import o from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{fromMat4 as s,transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as u,g as f,p,c as g,f as y,s as h,t as d}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as x,projectWithZConversion as j}from"../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorAsync as b}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as R}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as G,empty as S,center as B,toRect as T,isPoint as M,expandWithVec3 as Z,expandWithAABB as E,width as A,height as F,depth as O}from"../../../geometry/support/aaBoundingBox.js";import{create as P,isPoint as D}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as U}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as V}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as C}from"../camera/intersectionUtils.js";import{getViewSR as k,fromExtentSync as I,fromExtentAsync as J,internalToExternal as K,OrientationMode as L,scaleToDistance as N,fromCenterDistanceSync as W,fromCenterDistanceAsync as Y,externalToInternal as q,computeScale as X,distanceToScale as _,fromCenterScale as H,directionToHeadingTilt as Q,zoomToScale as $}from"./cameraUtils.js";import{getElevationAtPoint as tt}from"./ElevationProvider.js";import et from"../../../geometry/Point.js";import nt from"../../../geometry/Extent.js";import at from"../../../geometry/SpatialReference.js";import rt from"../../../geometry/Geometry.js";import ot from"../../../geometry/Multipoint.js";const it=.66;function st(t){return 360-r.normalize(t)}function ct(t){return r.normalize(360-t)}function lt(t,e,n){const a=e.camera;if(null!=a)return ut(a,k(t));const{targetGeometry:r}=e;if(null==r)return null;const{camera:o,mode:i}=pt(t,e.rotation,n);if("point"===r.type)return gt(t,e,r,o,i);const s=r.extent;return null==s?null:I(t,s,o.heading,o.tilt,i)}async function mt(t,e,n,a){const r=e.camera;if(null!=r)return ft(r,k(t),a);const{targetGeometry:o}=e;if(null==o)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=pt(t,e.rotation,n);if("point"===o.type)return yt(t,e,o,i,s,a);const c=o.extent;if(null==c)throw new Error("Target geometry has no extent!");return J(t,c,i.heading,i.tilt,s,a)}function ut(t,e){const n=t.position;let a;try{a=x(n,e)}catch(o){return null}if(!a)return null;const r=t.clone();return r.position=a.clone(),r}async function ft(t,e,n){const a=t.position,r=await j(a,e,{signal:n});i(n);const o=t.clone();return o.position=r.clone(),o}function pt(t,e,n){const a=K(t,t.state.camera);let r=L.ADJUST;return null!=e&&(a.heading=st(e),r=L.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:r}}function gt(t,e,n,a,r){const o=t.spatialReference;let i;try{i=x(n.clone(),o)}catch(c){return null}if(!i)return null;const s=null!=e.scale?N(t,e.scale,i.latitude):t.state.camera.distance;return W(t,i,s,a,r)}async function yt(t,e,n,a,r,o){const s=t.spatialReference,c=await j(n.clone(),s,{signal:o});i(o);const l=null!=e.scale?N(t,e.scale,c.latitude):t.state.camera.distance;return Y(t,c,l,a,r,o)}function ht(t,e,a=null){return null==a&&(a=new n),vt(t,null,e.clone(),a)}async function dt(e,a,r){const i=Ot(e,a);if(!i)throw new o("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Pt(await Gt(e,i.target,i,r,c))}if(i.target instanceof t)return Pt(await St(e,i.target,r,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof nt){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Pt(l||t?await Tt(e,i,i.target.center,s,r,c):await Et(e,i,i.target,s,r,c))}const m={boundingBox:S(),hasZ:!1,screenSpaceObjects:[]},u=l?xt(e,i):void 0;if(await zt(e,i.target,u,m,r),isFinite(m.boundingBox[0])){let t;if(B(m.boundingBox,Ut),Wt.x=Ut[0],Wt.y=Ut[1],Wt.z=Ut[2],Wt.spatialReference=e.spatialReference,isFinite(Wt.z)&&m.hasZ?t=M(m.boundingBox):(Wt.z=void 0,t=D(T(m.boundingBox,It))),l||t)return Pt(await Tt(e,i,Wt,s,r,c));const n=Dt(e,m.screenSpaceObjects);return Pt(await Ft(e,i,Wt,m.boundingBox,n,s,r,c))}return i.position?Pt(await Mt(e,i,s,c,r)):Pt(await Zt(e,i,s,r,c))}function wt(t,e){return null==e.scale&&null!=e.zoom?$(t,e.zoom):e.scale}function xt(t,e){const n=wt(t,e);return n?V(n):void 0}function jt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=st(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function vt(t,e,n,a){const r=t.spatialReference||at.WGS84;if(null==(e=null!=e?e:q(t,n)))return a;const o=new et({spatialReference:r});return R(e.center,t.renderSpatialReference,o)?(a.targetGeometry=o,a.scale=X(t,e),a.rotation=ct(n.heading),a.camera=n,a):a}async function bt(t,e,n,a){const r=()=>new o("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw r();"mesh"===e.type&&(e=e.extent);const i=e.spatialReference,s=t.spatialReference,c=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&null!=c&&null!=t.elevationProvider?(n=await j(n,c,{signal:a}),Ut[2]=tt(t.elevationProvider,n)??0):Ut[2]=0}const l=Yt[e.type],m=new Array;if(l(e,e.hasZ?t=>{m.push([t[0],t[1],t[2]])}:t=>{m.push([t[0],t[1]])},Ut),0===m.length)throw r();const u=await j(new ot({spatialReference:i,hasZ:e.hasZ,hasM:!1,points:m}),s,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[o,f,p]of u.points)Ut[0]=o,Ut[1]=f,Ut[2]=p,Z(n.boundingBox,Ut);else for(const[o,f]of u.points)Ut[0]=o,Ut[1]=f,Z(n.boundingBox,Ut)}async function Rt(t,e,n,r,o){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await bt(t,e.geometry,r,o);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await bt(t,e.geometry,r,o);const{screenSpaceObjects:l,boundingBox:m}=c.value;E(r.boundingBox,m),l&&l.forEach((t=>{r.screenSpaceObjects.push(t)})),isFinite(m[2])&&(r.hasZ=!0)}async function zt(t,n,a,r,o){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Wt.x=e,Wt.y=a,Wt.z=void 0,Wt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:at.WGS84,void await bt(t,Wt,r,o)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>zt(t,e,a,r,o)))):n instanceof rt?await bt(t,n,r,o):n instanceof e&&await Rt(t,n,a,r,o)}async function Gt(t,e,n,a,r){if(null!=e.camera)return St(t,e.camera,a,r);r.scale=e.scale,r.rotation=e.rotation,r.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,r.camera=null,null!=n.heading?r.rotation=ct(n.heading):null!=n.rotation&&(r.rotation=n.rotation);const o=wt(t,n);return null!=o&&(r.scale=o),r.camera=await mt(t,r,n.tilt,a),r}async function St(t,e,n,a){const r=t.spatialReference,o=await j(e.position,r,{signal:n});return(e=e.clone()).fov=t.camera.fov,e.position=o,vt(t,null,e,a)}async function Bt(t,e,n,a,r,o,i){const s=t.renderSpatialReference;return await b(e,Lt,s,0,{signal:i}),await b(n,Kt,s,0,{signal:i}),o.targetGeometry=new et(e),r.position=new et(n),y(Jt,Lt,Kt),Q(t,Kt,Jt,a.up,r),o.scale=_(t,p(Kt,Lt),o.targetGeometry.latitude),o.rotation=ct(r.heading),o.camera=r,o}async function Tt(t,e,n,a,r,i){if(null==n)throw new o("createfromcenter","invalid point");i.targetGeometry=n.clone();const s=C(t);if(e.position)return Bt(t,i.targetGeometry,e.position,s,a,i,r);if(e.zoomFactor){const a=s.distance/e.zoomFactor,r=u(Ut,s.viewForward,-a);s.eye=f(Ut,s.center,r),i.scale=_(t,a,n.latitude)}K(t,s,a);const c=jt(a,e)?L.LOCKED:L.ADJUST;if(!e.zoomFactor){const o=wt(t,e);if(null==o){const{renderSpatialReference:e}=t;await b(n,Ut,e,0,{signal:r}),U(s.frustum,Ut)?i.scale=_(t,p(s.eye,Ut),n.latitude):i.scale=X(t,s)}else i.scale=o;i.camera=await H(t,i.targetGeometry,i.scale,a,c,r)}return i}async function Mt(t,e,n,a,r){const o=C(t);g(Jt,o.viewForward),Q(t,o.eye,Jt,o.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await j(s,i,{signal:r});n.position=t}else n.position=new et;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,vt(t,null,n,a)}async function Zt(t,e,n,a,r){const o=C(t),{spatialReference:i,renderSpatialReference:s}=t,c=new et({spatialReference:i});return R(o.center,s,c)?Tt(t,e,c,n,a,r):Tt(t,e,null,n,a,r)}async function Et(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=C(t);K(t,i,a);const s=jt(a,e)?L.LOCKED:L.ADJUST;return o.camera=await J(t,n,a.heading,a.tilt,s,r),o}function At(t,e,n,a,r){let o=0;null!=n.z?o=n.z:t.basemapTerrain&&t.elevationProvider&&(o=tt(t.elevationProvider,n)),h(Ut,n.x,n.y,o),v(t.spatialReference,Ut,Vt,t.renderSpatialReference),s(Ct,Vt),c(Ct,Ct),S(kt);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=o),h(Ut,a[e[0]],a[e[1]],n),z(Ut,t.spatialReference,Ut,t.renderSpatialReference),Z(kt,d(Ut,Ut,Ct))}const l=A(kt),m=F(kt),u=O(kt),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/r}async function Ft(t,e,n,a,r,o,i,s){s.targetGeometry=n.clone();const c=C(t),l=At(t,c,n,a,r);K(t,c,o);const m=jt(o,e)?L.LOCKED:L.ADJUST;return s.scale=_(t,l,s.targetGeometry.latitude),s.camera=await H(t,s.targetGeometry,s.scale,o,m,i),s}function Ot(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),e.center&&!n.target&&(n.target=e.center)),n}function Pt(t){return null!=t?.camera&&(t.rotation=ct(t.camera.heading)),t}function Dt(t,e){const n=it;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let r=0;r<e.length;r++){const t=e[r].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}const Ut=w(),Vt=m(),Ct=l(),kt=G(),It=P(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},Wt=new et,Yt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let r=0;r<t.rings.length;r++){const o=t.rings[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let r=0;r<t.paths.length;r++){const o=t.paths[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,r=t.hasZ;for(let o=0;o<a.length;o++)n[0]=a[o][0],n[1]=a[o][1],r&&(n[2]=a[o][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{dt as create,ht as fromCamera,mt as toCameraAsync,lt as toCameraSync};
|
|
5
|
+
import t from"../../../Camera.js";import"../../../geometry.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as r}from"../../../core/Cyclical.js";import o from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{fromMat4 as s,transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as u,g as f,q as p,c as g,f as y,s as h,t as d}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as x,projectWithZConversion as j}from"../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorAsync as b}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as R}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as G,empty as S,center as B,toRect as T,isPoint as M,expandWithVec3 as Z,expandWithAABB as E,width as A,height as F,depth as O}from"../../../geometry/support/aaBoundingBox.js";import{create as P,isPoint as D}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as U}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as V}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as C}from"../camera/intersectionUtils.js";import{getViewSR as k,fromExtentSync as I,fromExtentAsync as J,internalToExternal as K,OrientationMode as L,scaleToDistance as N,fromCenterDistanceSync as q,fromCenterDistanceAsync as W,externalToInternal as Y,computeScale as X,distanceToScale as _,fromCenterScale as H,directionToHeadingTilt as Q,zoomToScale as $}from"./cameraUtils.js";import{getElevationAtPoint as tt}from"./ElevationProvider.js";import et from"../../../geometry/Point.js";import nt from"../../../geometry/Extent.js";import at from"../../../geometry/SpatialReference.js";import rt from"../../../geometry/Geometry.js";import ot from"../../../geometry/Multipoint.js";const it=.66;function st(t){return 360-r.normalize(t)}function ct(t){return r.normalize(360-t)}function lt(t,e,n){const a=e.camera;if(null!=a)return ut(a,k(t));const{targetGeometry:r}=e;if(null==r)return null;const{camera:o,mode:i}=pt(t,e.rotation,n);if("point"===r.type)return gt(t,e,r,o,i);const s=r.extent;return null==s?null:I(t,s,o.heading,o.tilt,i)}async function mt(t,e,n,a){const r=e.camera;if(null!=r)return ft(r,k(t),a);const{targetGeometry:o}=e;if(null==o)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=pt(t,e.rotation,n);if("point"===o.type)return yt(t,e,o,i,s,a);const c=o.extent;if(null==c)throw new Error("Target geometry has no extent!");return J(t,c,i.heading,i.tilt,s,a)}function ut(t,e){const n=t.position;let a;try{a=x(n,e)}catch(o){return null}if(!a)return null;const r=t.clone();return r.position=a.clone(),r}async function ft(t,e,n){const a=t.position,r=await j(a,e,{signal:n});i(n);const o=t.clone();return o.position=r.clone(),o}function pt(t,e,n){const a=K(t,t.state.camera);let r=L.ADJUST;return null!=e&&(a.heading=st(e),r=L.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:r}}function gt(t,e,n,a,r){const o=t.spatialReference;let i;try{i=x(n.clone(),o)}catch(c){return null}if(!i)return null;const s=null!=e.scale?N(t,e.scale,i.latitude):t.state.camera.distance;return q(t,i,s,a,r)}async function yt(t,e,n,a,r,o){const s=t.spatialReference,c=await j(n.clone(),s,{signal:o});i(o);const l=null!=e.scale?N(t,e.scale,c.latitude):t.state.camera.distance;return W(t,c,l,a,r,o)}function ht(t,e,a=null){return null==a&&(a=new n),vt(t,null,e.clone(),a)}async function dt(e,a,r){const i=Ot(e,a);if(!i)throw new o("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Pt(await Gt(e,i.target,i,r,c))}if(i.target instanceof t)return Pt(await St(e,i.target,r,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof nt){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Pt(l||t?await Tt(e,i,i.target.center,s,r,c):await Et(e,i,i.target,s,r,c))}const m={boundingBox:S(),hasZ:!1,screenSpaceObjects:[]},u=l?xt(e,i):void 0;if(await zt(e,i.target,u,m,r),isFinite(m.boundingBox[0])){let t;if(B(m.boundingBox,Ut),qt.x=Ut[0],qt.y=Ut[1],qt.z=Ut[2],qt.spatialReference=e.spatialReference,isFinite(qt.z)&&m.hasZ?t=M(m.boundingBox):(qt.z=void 0,t=D(T(m.boundingBox,It))),l||t)return Pt(await Tt(e,i,qt,s,r,c));const n=Dt(e,m.screenSpaceObjects);return Pt(await Ft(e,i,qt,m.boundingBox,n,s,r,c))}return i.position?Pt(await Mt(e,i,s,c,r)):Pt(await Zt(e,i,s,r,c))}function wt(t,e){return null==e.scale&&null!=e.zoom?$(t,e.zoom):e.scale}function xt(t,e){const n=wt(t,e);return n?V(n):void 0}function jt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=st(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function vt(t,e,n,a){const r=t.spatialReference||at.WGS84;if(null==(e=null!=e?e:Y(t,n)))return a;const o=new et({spatialReference:r});return R(e.center,t.renderSpatialReference,o)?(a.targetGeometry=o,a.scale=X(t,e),a.rotation=ct(n.heading),a.camera=n,a):a}async function bt(t,e,n,a){const r=()=>new o("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw r();"mesh"===e.type&&(e=e.extent);const i=e.spatialReference,s=t.spatialReference,c=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&null!=c&&null!=t.elevationProvider?(n=await j(n,c,{signal:a}),Ut[2]=tt(t.elevationProvider,n)??0):Ut[2]=0}const l=Wt[e.type],m=new Array;if(l(e,e.hasZ?t=>{m.push([t[0],t[1],t[2]])}:t=>{m.push([t[0],t[1]])},Ut),0===m.length)throw r();const u=await j(new ot({spatialReference:i,hasZ:e.hasZ,hasM:!1,points:m}),s,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[o,f,p]of u.points)Ut[0]=o,Ut[1]=f,Ut[2]=p,Z(n.boundingBox,Ut);else for(const[o,f]of u.points)Ut[0]=o,Ut[1]=f,Z(n.boundingBox,Ut)}async function Rt(t,e,n,r,o){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await bt(t,e.geometry,r,o);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await bt(t,e.geometry,r,o);const{screenSpaceObjects:l,boundingBox:m}=c.value;E(r.boundingBox,m),l&&l.forEach((t=>{r.screenSpaceObjects.push(t)})),isFinite(m[2])&&(r.hasZ=!0)}async function zt(t,n,a,r,o){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return qt.x=e,qt.y=a,qt.z=void 0,qt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:at.WGS84,void await bt(t,qt,r,o)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>zt(t,e,a,r,o)))):n instanceof rt?await bt(t,n,r,o):n instanceof e&&await Rt(t,n,a,r,o)}async function Gt(t,e,n,a,r){if(null!=e.camera)return St(t,e.camera,a,r);r.scale=e.scale,r.rotation=e.rotation,r.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,r.camera=null,null!=n.heading?r.rotation=ct(n.heading):null!=n.rotation&&(r.rotation=n.rotation);const o=wt(t,n);return null!=o&&(r.scale=o),r.camera=await mt(t,r,n.tilt,a),r}async function St(t,e,n,a){const r=t.spatialReference,o=await j(e.position,r,{signal:n});return(e=e.clone()).fov=t.camera.fov,e.position=o,vt(t,null,e,a)}async function Bt(t,e,n,a,r,o,i){const s=t.renderSpatialReference;return await b(e,Lt,s,0,{signal:i}),await b(n,Kt,s,0,{signal:i}),o.targetGeometry=new et(e),r.position=new et(n),y(Jt,Lt,Kt),Q(t,Kt,Jt,a.up,r),o.scale=_(t,p(Kt,Lt),o.targetGeometry.latitude),o.rotation=ct(r.heading),o.camera=r,o}async function Tt(t,e,n,a,r,i){if(null==n)throw new o("createfromcenter","invalid point");i.targetGeometry=n.clone();const s=C(t);if(e.position)return Bt(t,i.targetGeometry,e.position,s,a,i,r);if(e.zoomFactor){const a=s.distance/e.zoomFactor,r=u(Ut,s.viewForward,-a);s.eye=f(Ut,s.center,r),i.scale=_(t,a,n.latitude)}K(t,s,a);const c=jt(a,e)?L.LOCKED:L.ADJUST;if(!e.zoomFactor){const o=wt(t,e);if(null==o){const{renderSpatialReference:e}=t;await b(n,Ut,e,0,{signal:r}),U(s.frustum,Ut)?i.scale=_(t,p(s.eye,Ut),n.latitude):i.scale=X(t,s)}else i.scale=o;i.camera=await H(t,i.targetGeometry,i.scale,a,c,r)}return i}async function Mt(t,e,n,a,r){const o=C(t);g(Jt,o.viewForward),Q(t,o.eye,Jt,o.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await j(s,i,{signal:r});n.position=t}else n.position=new et;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,vt(t,null,n,a)}async function Zt(t,e,n,a,r){const o=C(t),{spatialReference:i,renderSpatialReference:s}=t,c=new et({spatialReference:i});return R(o.center,s,c)?Tt(t,e,c,n,a,r):Tt(t,e,null,n,a,r)}async function Et(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=C(t);K(t,i,a);const s=jt(a,e)?L.LOCKED:L.ADJUST;return o.camera=await J(t,n,a.heading,a.tilt,s,r),o}function At(t,e,n,a,r){let o=0;null!=n.z?o=n.z:t.basemapTerrain&&t.elevationProvider&&(o=tt(t.elevationProvider,n)),h(Ut,n.x,n.y,o),v(t.spatialReference,Ut,Vt,t.renderSpatialReference),s(Ct,Vt),c(Ct,Ct),S(kt);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=o),h(Ut,a[e[0]],a[e[1]],n),z(Ut,t.spatialReference,Ut,t.renderSpatialReference),Z(kt,d(Ut,Ut,Ct))}const l=A(kt),m=F(kt),u=O(kt),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/r}async function Ft(t,e,n,a,r,o,i,s){s.targetGeometry=n.clone();const c=C(t),l=At(t,c,n,a,r);K(t,c,o);const m=jt(o,e)?L.LOCKED:L.ADJUST;return s.scale=_(t,l,s.targetGeometry.latitude),s.camera=await H(t,s.targetGeometry,s.scale,o,m,i),s}function Ot(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),e.center&&!n.target&&(n.target=e.center)),n}function Pt(t){return null!=t?.camera&&(t.rotation=ct(t.camera.heading)),t}function Dt(t,e){const n=it;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let r=0;r<e.length;r++){const t=e[r].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}const Ut=w(),Vt=m(),Ct=l(),kt=G(),It=P(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},qt=new et,Wt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let r=0;r<t.rings.length;r++){const o=t.rings[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let r=0;r<t.paths.length;r++){const o=t.paths[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,r=t.hasZ;for(let o=0;o<a.length;o++)n[0]=a[o][0],n[1]=a[o][1],r&&(n[2]=a[o][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{dt as create,ht as fromCamera,mt as toCameraAsync,lt as toCameraSync};
|
|
@@ -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 t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{Milliseconds as h}from"../../../core/time.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as p,f as m,v as _,c as y,p as g}from"../../../chunks/vec32.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as v,d as R,g as w}from"../../../chunks/vec42.js";import{create as O,fromValues as T}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as D}from"../../../geometry/projection/projectVectorToVector.js";import{create as S,width as E,copy as P,center as M,height as j,intersection as b,contains as I,intersects as C,offset as U}from"../../../geometry/support/aaBoundingRect.js";import{create as N,wrap as A}from"../../../geometry/support/ray.js";import{j as L,k as G,t as V}from"../../../chunks/sphere.js";import{angleAroundAxis as q}from"../../../geometry/support/vector.js";import{y2lat as F}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as B}from"../state/utils/viewUtils.js";import{debugFlags as k}from"../support/debugFlags.js";import{PointGraphics as H}from"../support/debugUtils.js";import{OverlayIndex as W}from"./interfaces.js";import{OverlayRenderer as Y}from"./OverlayRenderer.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{newIntersector as X}from"../webgl-engine/lib/Intersector.js";import{fromValues as K}from"../webgl-engine/lib/LocalOriginFactory.js";import{UpdateParameters as Z}from"../webgl-engine/lib/Material.js";import{SortedRenderGeometryRenderer as J}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as Q}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as $}from"../webgl-engine/parts/requireUtils.js";import{TaskPriority as ee,noBudget as te}from"../../support/Scheduler.js";import{Yield as re}from"../../support/Yield.js";const se=1.3,ie=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let ae,ne=class extends t{constructor(e){super(e),this._spatialReference=null,this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=has("esri-mobile")?2048:4096,this._animationTimeLast=0}initialize(){const e=this.view;this.renderer=new Y({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.plugins.add(this.renderer);const t=()=>this.setDrawTexturesDirty();this._groundIntersector=X(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(t=>e._stage?.renderer.setParameters({hasOverlayWater:t}))),this.renderer.events.on("content-changed",t),o((()=>e.state.camera.pixelRatio),t),o((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),o((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),o((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),l),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask(ee.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays(te,e.camera,z.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(z.BACKGROUND,e)}))]),e._stage.renderer.renderOverlay=e=>this._renderOverlay(e)}destroy(){this.view?._stage&&(this.view._stage.renderer.plugins.remove(this.renderer),this.view._stage.renderer.renderOverlay=()=>{}),ae&&(ae.hide(),ae=null),this.renderer=n(this.renderer)}get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||k.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?x(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return se/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}_renderOverlay(e){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._dispatchAnimationUpdate(e),this._drawOverlays(z.UPDATE,this.view.state)}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,t,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const s=this.renderer.createDrapeSourceRenderer(e,t,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),s}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,J)}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("running"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,z.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return re;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,de),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,de.stretch);const i=this._updateOverlay(W.INNER,de.inner,s,1*de.pixelRatioAdjustment,de.mapUnitsPerPixel),a=E(de.inner)/E(de.outer),n=this._updateOverlay(W.OUTER,de.outer,s,a*de.pixelRatioAdjustment,de.mapUnitsPerPixel);i!==_e.EXTENT&&n!==_e.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.surface.updateTileOverlayParams(r)),i===_e.NONE&&n===_e.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s));return Math.min(Q(i),this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return _e.NONE;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,oe(t,a.extent)&&r===a.resolution)return n===i?_e.NONE:_e.RERENDER_ONLY;P(a.extent,t),a.resolution=r;const o=M(a.extent);return a.renderLocalOrigin=K(o[0],o[1],0,"OV_"+this._latestOriginId++),_e.EXTENT}setTileParameters(e){const t=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[W.INNER],s=this.renderer.overlays[W.OUTER],i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,W.INNER,t),this._setTileOverlayData(i,W.OUTER,t)):(this._clearTileOverlayData(W.INNER,t),this._clearTileOverlayData(W.OUTER,t))}else this._clearTileOverlayData(W.INNER,t),this._clearTileOverlayData(W.OUTER,t)}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[W.INNER],s=this.renderer.overlays[W.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=E(s),a=j(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,E(e)/i,j(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}async reloadShaders(){$(),await this.renderer.reloadShaders(),this.setDrawTexturesDirty(),this.runTask(te)}_dispatchAnimationUpdate(e){const t=h(e-this._animationTimeLast);if(t>=this.surface.view._stage.renderer.animationTimestep||null!=this.view.state.forcedAnimationTime||this._drawTexturesDirty||this._drawTexturesAnimateDirty){const r=h(t/this.surface.view._stage.renderer.animationTimeDilation),s=new Z(this.view.state.camera,r,this.view.state.forcedAnimationTime);this.renderer.updateAnimation(s)&&(this._drawTexturesAnimateDirty=!0),this._animationTimeLast=e}}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s){const i=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,me,t,r);if(null==i)return!1;const a=i.origin,n=p(ce,i.origin,i.direction);return this._groundIntersector.reset(a,n,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,n),this._groundIntersector.results.min.getIntersectionPoint(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=ce;L(G(V,x(this.view.spatialReference).radius+h),A(e.eye,e.viewForward),t),m(t,t,e.eye);const i=s.normalize(q(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=T(0,s,1,0),o=v(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return!!this._intersectGroundFromView(e,.5,r,t)&&_(t,e.eye)<o.distance*o.distance}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=f();this._findHorizonBasedPointOfInterest(e,i)||y(i,s),k.OVERLAY_SHOW_CENTER?(null==ae&&(ae=new H(this.view.graphics,"red")),ae.show(i,this._renderSR)):null!=ae&&ae.hide();const n=Math.max(.1,g(e.eye,i)),o=B(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||D(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference&&this._spatialReference.isGeographic,c=h&&this._spatialReference?1/x(this._spatialReference).metersPerDegree:1,d=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/d*n*c;r.mapUnitsPerPixel=p/this._worldToPCSRatio,r.stretch=this._overlayStretch;let m=t*p/2*r.stretch,_=!1,v=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(m/=Math.cos(F(i[1])),v=l[3]):(_=!0,m/=x(this._spatialReference).metersPerDegree,v=90),m>=v&&(m=v,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let O=1;_&&(O=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),m*O>180&&(O=180/m),r.mapUnitsPerPixel*=O);const T=Math.log(2)/12;m=Math.exp(Math.round(Math.log(m)/T)*T);const S=m*O,M=32,j=.5*t/(M*S),C=.5*t/(M*m);i[0]=Math.round(i[0]*j)/j,i[1]=Math.round(i[1]*C)/C;const U=r.inner;U[0]=i[0]-S,U[1]=i[1]-m,U[2]=i[0]+S,U[3]=i[1]+m,this._isSpherical&&this._shiftExtentToFitBounds(U,1/0,v);const N=r.outer;if(6*S>E(l))P(N,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)N[0]=U[0]-S,N[1]=U[1]-m,N[2]=U[2]+S,N[3]=U[3]+m;else{D(e.eye,this._renderSR,ce,this._spatialReference),u(he,i,ce);let t=-Math.atan2(he[1],he[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));R(he,ie[r],2*m),he[0]*=O,he[2]*=O,w(N,U,he)}}if(this._isSpherical)N[0]=this._longitudeCyclical.clamp(N[0]),N[2]=this._longitudeCyclical.clamp(N[2]),N[1]=Math.max(N[1],-v),N[3]=Math.min(N[3],v);else{const e=b(U,l,ue),t=b(N,l,pe);I(e,t)&&(N[2]=N[0],N[3]=N[1])}const A=Math.abs(U[2]-U[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_drawOverlays(e,t){if(!this.renderer.hasOverlays)return;if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(z.UPDATE),r?(this.surface.requestRender(e),e===z.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(z.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):C(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:I(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),U(e,s,i)}get test(){return{renderer:this.renderer,update:()=>this.runTask(te)}}};function oe(e,t){const r=1e-5,s=k.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([c()],ne.prototype,"_spatialReference",void 0),e([c({readOnly:!0})],ne.prototype,"running",null),e([c()],ne.prototype,"_placementDirty",void 0),e([c()],ne.prototype,"_contentUpdated",void 0),e([c()],ne.prototype,"_isSpherical",null),e([c()],ne.prototype,"_worldToPCSRatio",null),e([c()],ne.prototype,"renderer",void 0),e([c({constructOnly:!0})],ne.prototype,"view",void 0),e([c({constructOnly:!0})],ne.prototype,"surface",void 0),e([c()],ne.prototype,"suspended",null),e([c()],ne.prototype,"updating",null),e([c({type:Boolean})],ne.prototype,"rendersOccludedDraped",null),ne=e([d("esri.views.3d.terrain.OverlayManager")],ne);class le{constructor(){this.inner=S(),this.outer=S(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=se}}const he=O(),ce=f(),de=new le,ue=S(),pe=S(),me=N();var _e;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(_e||(_e={}));export{ne as OverlayManager};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{Milliseconds as h}from"../../../core/time.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as p,f as m,w as _,c as y,q as g}from"../../../chunks/vec32.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as v,d as R,g as w}from"../../../chunks/vec42.js";import{create as O,fromValues as T}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as D}from"../../../geometry/projection/projectVectorToVector.js";import{create as S,width as E,copy as P,center as M,height as j,intersection as b,contains as I,intersects as C,offset as U}from"../../../geometry/support/aaBoundingRect.js";import{create as N,wrap as A}from"../../../geometry/support/ray.js";import{j as L,k as G,t as q}from"../../../chunks/sphere.js";import{angleAroundAxis as V}from"../../../geometry/support/vector.js";import{y2lat as F}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as B}from"../state/utils/viewUtils.js";import{debugFlags as k}from"../support/debugFlags.js";import{PointGraphics as H}from"../support/debugUtils.js";import{OverlayIndex as W}from"./interfaces.js";import{OverlayRenderer as Y}from"./OverlayRenderer.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{newIntersector as X}from"../webgl-engine/lib/Intersector.js";import{fromValues as K}from"../webgl-engine/lib/LocalOriginFactory.js";import{UpdateParameters as Z}from"../webgl-engine/lib/Material.js";import{SortedRenderGeometryRenderer as J}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as Q}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as $}from"../webgl-engine/parts/requireUtils.js";import{TaskPriority as ee,noBudget as te}from"../../support/Scheduler.js";import{Yield as re}from"../../support/Yield.js";const se=1.3,ie=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let ae,ne=class extends t{constructor(e){super(e),this._spatialReference=null,this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=has("esri-mobile")?2048:4096,this._animationTimeLast=0}initialize(){const e=this.view;this.renderer=new Y({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.plugins.add(this.renderer);const t=()=>this.setDrawTexturesDirty();this._groundIntersector=X(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(t=>e._stage?.renderer.setParameters({hasOverlayWater:t}))),this.renderer.events.on("content-changed",t),o((()=>e.state.camera.pixelRatio),t),o((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),o((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),o((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),l),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask(ee.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays(te,e.camera,z.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(z.BACKGROUND,e)}))]),e._stage.renderer.renderOverlay=e=>this._renderOverlay(e)}destroy(){this.view?._stage&&(this.view._stage.renderer.plugins.remove(this.renderer),this.view._stage.renderer.renderOverlay=()=>{}),ae&&(ae.hide(),ae=null),this.renderer=n(this.renderer)}get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||k.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?x(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return se/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}_renderOverlay(e){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._dispatchAnimationUpdate(e),this._drawOverlays(z.UPDATE,this.view.state)}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,t,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const s=this.renderer.createDrapeSourceRenderer(e,t,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),s}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,J)}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("running"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,z.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return re;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,de),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,de.stretch);const i=this._updateOverlay(W.INNER,de.inner,s,1*de.pixelRatioAdjustment,de.mapUnitsPerPixel),a=E(de.inner)/E(de.outer),n=this._updateOverlay(W.OUTER,de.outer,s,a*de.pixelRatioAdjustment,de.mapUnitsPerPixel);i!==_e.EXTENT&&n!==_e.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.surface.updateTileOverlayParams(r)),i===_e.NONE&&n===_e.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s));return Math.min(Q(i),this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return _e.NONE;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,oe(t,a.extent)&&r===a.resolution)return n===i?_e.NONE:_e.RERENDER_ONLY;P(a.extent,t),a.resolution=r;const o=M(a.extent);return a.renderLocalOrigin=K(o[0],o[1],0,"OV_"+this._latestOriginId++),_e.EXTENT}setTileParameters(e){const t=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[W.INNER],s=this.renderer.overlays[W.OUTER],i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,W.INNER,t),this._setTileOverlayData(i,W.OUTER,t)):(this._clearTileOverlayData(W.INNER,t),this._clearTileOverlayData(W.OUTER,t))}else this._clearTileOverlayData(W.INNER,t),this._clearTileOverlayData(W.OUTER,t)}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[W.INNER],s=this.renderer.overlays[W.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=E(s),a=j(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,E(e)/i,j(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}async reloadShaders(){$(),await this.renderer.reloadShaders(),this.setDrawTexturesDirty(),this.runTask(te)}_dispatchAnimationUpdate(e){const t=h(e-this._animationTimeLast);if(t>=this.surface.view._stage.renderer.animationTimestep||null!=this.view.state.forcedAnimationTime||this._drawTexturesDirty||this._drawTexturesAnimateDirty){const r=h(t/this.surface.view._stage.renderer.animationTimeDilation),s=new Z(this.view.state.camera,r,this.view.state.forcedAnimationTime);this.renderer.updateAnimation(s)&&(this._drawTexturesAnimateDirty=!0),this._animationTimeLast=e}}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s){const i=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,me,t,r);if(null==i)return!1;const a=i.origin,n=p(ce,i.origin,i.direction);return this._groundIntersector.reset(a,n,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,n),this._groundIntersector.results.min.getIntersectionPoint(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=ce;L(G(q,x(this.view.spatialReference).radius+h),A(e.eye,e.viewForward),t),m(t,t,e.eye);const i=s.normalize(V(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=T(0,s,1,0),o=v(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return!!this._intersectGroundFromView(e,.5,r,t)&&_(t,e.eye)<o.distance*o.distance}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=f();this._findHorizonBasedPointOfInterest(e,i)||y(i,s),k.OVERLAY_SHOW_CENTER?(null==ae&&(ae=new H(this.view.graphics,"red")),ae.show(i,this._renderSR)):null!=ae&&ae.hide();const n=Math.max(.1,g(e.eye,i)),o=B(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||D(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference&&this._spatialReference.isGeographic,c=h&&this._spatialReference?1/x(this._spatialReference).metersPerDegree:1,d=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/d*n*c;r.mapUnitsPerPixel=p/this._worldToPCSRatio,r.stretch=this._overlayStretch;let m=t*p/2*r.stretch,_=!1,v=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(m/=Math.cos(F(i[1])),v=l[3]):(_=!0,m/=x(this._spatialReference).metersPerDegree,v=90),m>=v&&(m=v,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let O=1;_&&(O=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),m*O>180&&(O=180/m),r.mapUnitsPerPixel*=O);const T=Math.log(2)/12;m=Math.exp(Math.round(Math.log(m)/T)*T);const S=m*O,M=32,j=.5*t/(M*S),C=.5*t/(M*m);i[0]=Math.round(i[0]*j)/j,i[1]=Math.round(i[1]*C)/C;const U=r.inner;U[0]=i[0]-S,U[1]=i[1]-m,U[2]=i[0]+S,U[3]=i[1]+m,this._isSpherical&&this._shiftExtentToFitBounds(U,1/0,v);const N=r.outer;if(6*S>E(l))P(N,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)N[0]=U[0]-S,N[1]=U[1]-m,N[2]=U[2]+S,N[3]=U[3]+m;else{D(e.eye,this._renderSR,ce,this._spatialReference),u(he,i,ce);let t=-Math.atan2(he[1],he[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));R(he,ie[r],2*m),he[0]*=O,he[2]*=O,w(N,U,he)}}if(this._isSpherical)N[0]=this._longitudeCyclical.clamp(N[0]),N[2]=this._longitudeCyclical.clamp(N[2]),N[1]=Math.max(N[1],-v),N[3]=Math.min(N[3],v);else{const e=b(U,l,ue),t=b(N,l,pe);I(e,t)&&(N[2]=N[0],N[3]=N[1])}const A=Math.abs(U[2]-U[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_drawOverlays(e,t){if(!this.renderer.hasOverlays)return;if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(z.UPDATE),r?(this.surface.requestRender(e),e===z.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(z.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):C(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:I(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),U(e,s,i)}get test(){return{renderer:this.renderer,update:()=>this.runTask(te)}}};function oe(e,t){const r=1e-5,s=k.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([c()],ne.prototype,"_spatialReference",void 0),e([c({readOnly:!0})],ne.prototype,"running",null),e([c()],ne.prototype,"_placementDirty",void 0),e([c()],ne.prototype,"_contentUpdated",void 0),e([c()],ne.prototype,"_isSpherical",null),e([c()],ne.prototype,"_worldToPCSRatio",null),e([c()],ne.prototype,"renderer",void 0),e([c({constructOnly:!0})],ne.prototype,"view",void 0),e([c({constructOnly:!0})],ne.prototype,"surface",void 0),e([c()],ne.prototype,"suspended",null),e([c()],ne.prototype,"updating",null),e([c({type:Boolean})],ne.prototype,"rendersOccludedDraped",null),ne=e([d("esri.views.3d.terrain.OverlayManager")],ne);class le{constructor(){this.inner=S(),this.outer=S(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=se}}const he=O(),ce=f(),de=new le,ue=S(),pe=S(),me=N();var _e;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(_e||(_e={}));export{ne as OverlayManager};
|
|
@@ -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{equals as e}from"../../../core/arrayUtils.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../core/maybe.js";import{p as i,m as s,C as o,f as a,n,j as l,y as g,F as d}from"../../../chunks/vec32.js";import{create as h,clone as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{containsXY as u}from"../../../geometry/support/aaBoundingRect.js";import{earth as c}from"../../../geometry/support/Ellipsoid.js";import{glLayout as f}from"../support/buffer/glUtil.js";import{GeometryState as p}from"./GeometryState.js";import{NeighborIndex as y}from"./ITile.js";import{LayerClass as _}from"./LayerClass.js";import{PatchGeometry as x}from"./PatchGeometry.js";import{maxTileNeighborLevelDelta as v}from"./TerrainConst.js";import{enableTerrainInternalChecks as E,internalAssert as $,neighborEdgeIndices as C,oppositeEdge as S,neighborCornerIndices as D,v32s as T,lij2s as b}from"./terrainUtils.js";import{TextureFader as j,ActivationTime as A}from"./TextureFader.js";import{isEdgeNeighbor as V}from"./Tile.js";import R from"./TileOverlayData.js";import{fallsWithinLayer as w}from"./tileUtils.js";import{VertexArrayObject as L}from"../webgl-engine/lib/VertexArrayObject.js";import{terrainVertexAttributeLocations as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{BufferObject as P}from"../../webgl/BufferObject.js";import{PixelFormat as F}from"../../webgl/enums.js";class G{constructor(){this.geometry=new x,this.intersectionData=null,this.geometryState=null,this._vao=null,this._texture=null,this._textureRef=new j((()=>this.tile.surface.fadeDuration)),this.overlay=new R,this._localOrigin=null,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._modifiedFlags=0}get tile(){return this._tile}get localOrigin(){return this._localOrigin}init(e,t){this.clear(),this._tile=e,this.geometry.reset(),this.intersectionData=null,this.geometryState=new p,this._localOrigin=t,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureRef.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this.wireframeChanged||this.clippingAreaChanged||this.samplerDataChanged||this.numVerticesPerSideChanged||this.dirtyCorners||this.dirtyEdgeResolutions||this.dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),E&&this.tile.intersectsClippingArea)for(let t=0;t<4;++t)$(this.geometry.getEdgeCount(t)===this.geometryState.edgeResolutions[t]+1)}_calculateEdgeResolution(e,t){const r=this.tile,i=this.geometryState.numVerticesPerSide-1;if(!r.surface.isGlobal){const t=r.surface.extent;if(null!=t&&(0===e&&r.extent[3]>t[3]||1===e&&r.extent[2]>t[2]||2===e&&r.extent[1]<t[1]||3===e&&r.extent[0]<t[0]))return i}const s=r.level,o=C[e];if(!t)return $(null==r.surface?.rootTiles||r.surface.updatingRootTiles||!r.shouldHaveNeighbor(o)),i;if(t.isLoaded){const r=t,o=r.renderData.geometryState,a=s-r.level;if($(a>=0),0===a){const e=o.numVerticesPerSide-1;return Math.max(e,i)}const n=2**a,l=o.edgeResolutions[(e+2)%4]/n;return Math.max(1,l)}$(!t.isLeaf);let a=i;return t.forAllSubtreeOnSide(S(o),(e=>e===r||(e.isLoaded?(a=Math.max(a,2**(e.level-s)),!0):($(!e.isLeaf),!1)))),a}updateNeighborData(){const e=this.tile;if(!e.intersectsClippingArea)return;const r=e.renderData.geometryState,i=t=>(t.isLoaded||t.level===e.level)&&t?.intersectsClippingArea,s=r.edgePeerNeighbors,o=r.edgePeerNeighborSamplerVersions;for(let a=0;a<4;++a){const n=e.findNeighborTile(C[a],i),l=W(e,n),g=l?.renderData?.geometryState.samplerDataVersion??-1,d=s[a],h=l!==W(e,d),m=o[a]!==g;E&&n&&($(e.level>=n.level),$(e.level-n.level<=v)),s[a]=n,(h||m)&&(o[a]=g,this._markEdgeDirty(a));const u=r.edgeResolutions[a],c=this._calculateEdgeResolution(a,n);$(t(c)),$(c>=1),r.edgeResolutions[a]=c,u!==c&&this._markEdgeResolutionDirty(a)}for(let t=0;t<4;++t){const o=e.findNeighborTile(D[t],i);r.cornerPeerNeighbors[t]=o;const a=W(e,s[t]),n=W(e,s[(t+1)%4]),l=W(e,o);H[t]=l,H[(t+1)%4]=n,H[(t+2)%4]=e,H[(t+3)%4]=a,$(H.some((t=>t?.isLoaded||t===e)));const g=H.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);H.forEach(((e,t)=>{e&&e?.level>g&&(H[t]=null)})),$(H.some((t=>t?.isLoaded||t===e)));const d=r.cornerNeighborCornerTiles,h=r.cornerNeighborCornerTileSamplerVersions;for(let e=0;e<4;++e){const r=H[e],i=r?.renderData.geometryState.samplerDataVersion??-1,s=4*t+e,o=d[s]!==r,a=!o&&h[s]!==i;(o||a)&&(d[s]=r,h[s]=i,this._markCornerDirty(t))}E&&$(ee.some((r=>d[4*t+r]?.isLoaded||d[4*t+r]===e)))}E&&$(this.geometryState.edgeResolutions.every((e=>e>0)));for(let t=0;t<4;++t)H[t]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;E&&$(!this.tile.intersectsClippingArea||this.geometryState.edgeResolutions.every((e=>e>0))),this.intersectionData=null;const{tile:t,_vao:r,geometry:i,geometryState:s}=this,o=!r||!{geometry:i}||this.wireframeChanged||this.samplerDataChanged||this.clippingAreaChanged||this.numVerticesPerSideChanged,a=0!==this.dirtyEdgeResolutions,n=s.edgeResolutions.reduce(((e,t)=>e+t+1),0),l=o||a&&n>(i?.maxEdgeVertexCount??0),g=!l&&a,d=!g&&(0!==this.dirtyEdges||a),h=!d&&0!==this.dirtyCorners;l?(this.releaseGeometry(),this._createGeometry(e)):g?t.updateEdgeElevationsAndResolutions():d||h?t.updateEdgeElevations():h?t.updateCornerElevations():console.warn("Update for no reason?"),this._modifiedFlags=0}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,!!this._vao&&(this._vao=r(this._vao),this.geometry.release(),!0)}ensureTexture(e,t,r){const i=t?F.RGBA:F.RGB;return null==this._texture||this._texture.descriptor.width===e&&this._texture.descriptor.pixelFormat===i||this.releaseTexture(),null==this._texture&&(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){null!=this._texture&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}get numVerticesPerSideChanged(){return 0!=(this._modifiedFlags&q)}get samplerDataChanged(){return 0!=(this._modifiedFlags&z)}get clippingAreaChanged(){return 0!=(this._modifiedFlags&J)}get wireframeChanged(){return 0!=(this._modifiedFlags&K)}get dirtyEdges(){return this._modifiedFlags>>Q&15}get dirtyCorners(){return this._modifiedFlags>>Y&15}get dirtyEdgeResolutions(){return this._modifiedFlags>>Z&15}_markCornerDirty(e){const t=1<<e<<Y;this._modifiedFlags|=t}_markEdgeDirty(e){const t=1<<e<<Q;this._modifiedFlags|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){const t=1<<e<<Z;this._modifiedFlags|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._modifiedFlags|=15<<Y|15<<Q|15<<Z}updateGeometryState(){const t=this._getElevationInfo(),r=this.tile,i=t.samplerData?r.getElevationVerticesPerSide(t.maxTileLevel):r.getDefaultVerticesPerSide(),s=Math.max(i,5);let o=r.clippingArea;r.intersectsClippingArea&&!r.isWithinClippingArea||(o=null);const a=this.geometryState;let n=!1;a.numVerticesPerSide!==s&&(this._modifiedFlags|=1,a.numVerticesPerSide=s,a.samplerDataVersion++,n=!0),t.changed&&(this._modifiedFlags|=2,a.samplerData=t.samplerData,a.samplerDataVersion++,n=!0),e(a.clippingArea,o)||(this._modifiedFlags=4,a.clippingArea=o,n=!0);const l=r.surface.wireframe;return a.wireframe!==l&&(this._modifiedFlags=8,a.wireframe=l,n=!0),this._geometryStateChangedSinceLastUpdate||=n,n&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();const t=this.geometry.vertexAttributes,r=this.geometry.indices,i=e.gl;this._vao=new L(e,N,{geometry:f(t.layout)},{geometry:P.createVertex(e,i.STATIC_DRAW,t.buffer)},P.createIndex(e,i.STATIC_DRAW,r)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=A.Immediate){null!=e&&e.texture!==this._texture&&this.releaseTexture(),this._textureRef.push(e,t)}get textureReference(){return this._textureRef.current}get nextTextureReference(){return this._textureRef.next}get textureFadeFactor(){return this._textureRef.fadeFactor}get textureIsFading(){return this._textureRef.isFading}_getElevationInfo(){const e=this.geometryState.samplerData,t=this.tile.layerInfo[_.ELEVATION],r=t.length,i=new Array(r);let s=0,o=0,a=!1;for(let g=0;g<r;g++){const r=t[g];if(null!=r.upsampleInfo){const t=r.upsampleInfo.tile,n=t.layerInfo[_.ELEVATION][g].data,l=n&&n.samplerData;e&&e[s]===l||(a=!0),i[s++]=l,o=Math.max(o,t.lij[0])}else if(r.data){const t=this.tile.surface.layerViewByIndex(g,_.ELEVATION);if(w(this.tile,t.layer,!1)){const t=r.data;e&&e[s]===t.samplerData||(a=!0),i[s++]=t.samplerData,o=this.tile.level}}}null!=e&&e.length!==s&&(a=!0);const n=s>0,l=n?i:null;return n&&(i.length=s),{changed:a,samplerData:l,maxTileLevel:o}}get estimatedGeometryMemoryUsage(){const e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){return{hasTexture:null!=this._texture}}checkGeometryWaterproofness(){if(!E)return;const e=this.tile;if(!e.isLoaded||!e.intersectsClippingArea||0===e.level)return void $(e?.isLoaded);const r=e.surface.extent;if(null!=r&&!e.intersectsExtent(r))return;const f=C.map(((t,i)=>null!=r&&(i<2?-1:1)*(e.extent[3-i]-r[3-i])<0)),p=e.level;$(0===this.dirtyCorners),$(0===this.dirtyEdges),$(0===this.dirtyEdgeResolutions),$(!this.numVerticesPerSideChanged),$(!this.samplerDataChanged),$(!this.clippingAreaChanged),$(!this.wireframeChanged);const _=D.map((t=>e.findNeighborCornerTileExact(t,(t=>!t.intersectsClippingArea||t.isLoaded||t.level===e.level))??null)).map((e=>e?.intersectsClippingArea?e:null)),x=this.geometryState;for(let t=0;t<4;++t){const r=x.cornerPeerNeighbors[t],i=_[t];$(i===r,`Tile[${e.lij}].corner[${t}] out of date: cur=[${r?.lij}] exp=[${i?.lij}]`)}C.forEach(((r,_)=>{if(f[_])return;const x=e.findNeighborTile(r,(e=>(e.level===p||e?.isLoaded)&&e?.intersectsClippingArea));if(!x){const t=!e.surface.updatingRootTiles&&null!=e.surface.rootTiles&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(r);return void $(!t)}$(x.isLoaded||x.level===e.level),$(x===this.geometryState.edgePeerNeighbors[_]);const v=p-x.level;if(!x.isLoaded)return $(!x.isLeaf),void $(0===v);const E=x.renderData;$(V(e,x,r)),$(v>=0);const C=2**v;if(v<0)return void $(!1);const S=e.renderData,D=S.geometry,j=S.localOrigin,A=D.getEdgeCount(_),R=D.numVerticesPerSide-1,w=E.geometry;if(!w)return void $(!1);const L=E.localOrigin,N=this.geometryState.edgePeerNeighbors[_];if(N?.isLoaded){const e=N.renderData;$(S.geometryState.edgePeerNeighborSamplerVersions[_]===e.geometryState.samplerDataVersion),$(this.geometryState.edgePeerNeighborSamplerVersions[_]===e.geometryState.samplerDataVersion)}const P=(_+2)%4,F=w.getEdgeCount(P),G=A-1,H=F-1;$(G*C===H,`Tile[${e.lij}]:e${_},res=${G} edgeRes mismatch with Neighbor[${x.lij}]:e${P},res=${H} (expected:${G*C})`);const W=e.extent,q=r===y.NORTH||r===y.SOUTH,z=F-1,J=z>>v,K=A-1;if(J<1)return void $(1===K);$(J===K),$(t(J));const Q=w.numVerticesPerSide-1;$(v>0||J===Math.max(Q,R));const Y=e.getNeighborEdgeStartVertexIndex(_,x);$(0<=Y&&Y<C);const Z=Y*J;$(0<=Z&&Z<=z-J);let ee=0,te=Z;D.getEdgeVertexPosition(_,O,j,0),D.getEdgeVertexPosition(_,I,j,A-1);const re=i(O,I),ie=Math.max(B,1e-4*re);for(let t=0;t<=J;++t){D.getEdgeVertexPosition(_,O,j,ee),w.getEdgeVertexPosition(P,I,L,te);const i=t/J,f=q?W[0]+i*(W[2]-W[0]):r===y.WEST?W[0]:W[2],p=q?r===y.SOUTH?W[1]:W[3]:W[1]+i*(W[3]-W[1]),v=e.surface.extent;if(null==v||u(v,f,p)){const t=s(O,I),r=o(O)-c.radius,i=o(I)-c.radius,u=t<ie;if(!u){console.warn(`Tile edge vertex position mismatch: between [${e.lij}].edge${_}[${ee}/${A}] and [${x.lij}].edge${P}[${te}/${F}]`),null!=v&&console.warn(" surface extent= ",v," x,y=",f,",",p);const s=h();a(s,S.localOrigin,E.localOrigin),o(s)>0&&console.warn(` localOrigins: ${S.localOrigin} vs ${E.localOrigin} d=${o(s)} [${s}]`);(()=>{const t=m(O),r=m(I);e.updateEdgeElevations(),x.updateEdgeElevations(),D.getEdgeVertexPosition(_,O,j,ee),w.getEdgeVertexPosition(P,I,L,te);const i=h();g(i,O,t),o(i)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${t} vs ${O} d=${o(i)} [${i}]`),g(i,I,r),o(i)>0&&console.warn(` XXX Neighbor[${x.lij}] edge out of date: ${r} vs ${I} d=${o(i)} [${i}]`)})();const n=D.getEdgeCount(_),l=w.getEdgeCount(F);$(u,`Mismatch in tile [${e.lij}].edge[${_}][${ee}/${n}] vs neighbor [${x.lij}].edge[${P}][${te}/${l}] ${T(O)} vs ${T(I)} dist=${t} h(t|n|d)=${r}|${i}|${i-r}`)}D.getEdgeNormal(_,M,ee),w.getEdgeNormal(P,U,te),n(k,M),n(X,U);const y=l(k,X),C=1-y<.01||!1||e===x;if(!C){const t=h();g(t,M,U);const r=()=>`Mismatch in tile edge normal ${b(e.lij)} (${ee}/${A-1}) edge ${_} vs neighbor ${b(x.lij)} (${te}/${F-1}) nedge ${P} :${T(M)} vs ${T(U)} dot = ${y} : ${T(t)}`;console.warn("Mismatch in tile edge normal: ",r());{e.updateEdgeElevations(),x.updateEdgeElevations();const t=h(),r=h();D.getEdgeNormal(_,t,ee),w.getEdgeNormal(P,r,te),d(M,t)||console.warn("Missing update in tile normal: ",T(M)," => ",T(t)),d(U,r)||console.warn("Missing update in neighbor normal: ",T(U)," => ",T(r))}$(C,r())}}ee+=1,te+=1}}))}}const O=h(),I=h(),M=h(),U=h(),k=h(),X=h(),B=1,H=[null,null,null,null];function W(e,t){return t?.isLoaded||t===e?t:null}const q=1,z=2,J=4,K=8,Q=4,Y=8,Z=12,ee=[0,1,2,3];export{A as ActivationTime,G as PatchRenderData,W as neighborTileIfLoadedOrSelf,ee as zeroToFour};
|
|
5
|
+
import{equals as e}from"../../../core/arrayUtils.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../core/maybe.js";import{q as i,o as s,D as o,f as a,n,k as l,z as g,G as d}from"../../../chunks/vec32.js";import{create as h,clone as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{containsXY as u}from"../../../geometry/support/aaBoundingRect.js";import{earth as c}from"../../../geometry/support/Ellipsoid.js";import{glLayout as f}from"../support/buffer/glUtil.js";import{GeometryState as p}from"./GeometryState.js";import{NeighborIndex as y}from"./ITile.js";import{LayerClass as _}from"./LayerClass.js";import{PatchGeometry as x}from"./PatchGeometry.js";import{maxTileNeighborLevelDelta as v}from"./TerrainConst.js";import{enableTerrainInternalChecks as E,internalAssert as $,neighborEdgeIndices as S,oppositeEdge as C,neighborCornerIndices as D,v32s as T,lij2s as b}from"./terrainUtils.js";import{TextureFader as j,ActivationTime as A}from"./TextureFader.js";import{isEdgeNeighbor as V}from"./Tile.js";import R from"./TileOverlayData.js";import{fallsWithinLayer as w}from"./tileUtils.js";import{VertexArrayObject as L}from"../webgl-engine/lib/VertexArrayObject.js";import{terrainVertexAttributeLocations as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{BufferObject as P}from"../../webgl/BufferObject.js";import{PixelFormat as F}from"../../webgl/enums.js";class G{constructor(){this.geometry=new x,this.intersectionData=null,this.geometryState=null,this._vao=null,this._texture=null,this._textureRef=new j((()=>this.tile.surface.fadeDuration)),this.overlay=new R,this._localOrigin=null,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._modifiedFlags=0}get tile(){return this._tile}get localOrigin(){return this._localOrigin}init(e,t){this.clear(),this._tile=e,this.geometry.reset(),this.intersectionData=null,this.geometryState=new p,this._localOrigin=t,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureRef.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this.wireframeChanged||this.clippingAreaChanged||this.samplerDataChanged||this.numVerticesPerSideChanged||this.dirtyCorners||this.dirtyEdgeResolutions||this.dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),E&&this.tile.intersectsClippingArea)for(let t=0;t<4;++t)$(this.geometry.getEdgeCount(t)===this.geometryState.edgeResolutions[t]+1)}_calculateEdgeResolution(e,t){const r=this.tile,i=this.geometryState.numVerticesPerSide-1;if(!r.surface.isGlobal){const t=r.surface.extent;if(null!=t&&(0===e&&r.extent[3]>t[3]||1===e&&r.extent[2]>t[2]||2===e&&r.extent[1]<t[1]||3===e&&r.extent[0]<t[0]))return i}const s=r.level,o=S[e];if(!t)return $(null==r.surface?.rootTiles||r.surface.updatingRootTiles||!r.shouldHaveNeighbor(o)),i;if(t.isLoaded){const r=t,o=r.renderData.geometryState,a=s-r.level;if($(a>=0),0===a){const e=o.numVerticesPerSide-1;return Math.max(e,i)}const n=2**a,l=o.edgeResolutions[(e+2)%4]/n;return Math.max(1,l)}$(!t.isLeaf);let a=i;return t.forAllSubtreeOnSide(C(o),(e=>e===r||(e.isLoaded?(a=Math.max(a,2**(e.level-s)),!0):($(!e.isLeaf),!1)))),a}updateNeighborData(){const e=this.tile;if(!e.intersectsClippingArea)return;const r=e.renderData.geometryState,i=t=>(t.isLoaded||t.level===e.level)&&t?.intersectsClippingArea,s=r.edgePeerNeighbors,o=r.edgePeerNeighborSamplerVersions;for(let a=0;a<4;++a){const n=e.findNeighborTile(S[a],i),l=W(e,n),g=l?.renderData?.geometryState.samplerDataVersion??-1,d=s[a],h=l!==W(e,d),m=o[a]!==g;E&&n&&($(e.level>=n.level),$(e.level-n.level<=v)),s[a]=n,(h||m)&&(o[a]=g,this._markEdgeDirty(a));const u=r.edgeResolutions[a],c=this._calculateEdgeResolution(a,n);$(t(c)),$(c>=1),r.edgeResolutions[a]=c,u!==c&&this._markEdgeResolutionDirty(a)}for(let t=0;t<4;++t){const o=e.findNeighborTile(D[t],i);r.cornerPeerNeighbors[t]=o;const a=W(e,s[t]),n=W(e,s[(t+1)%4]),l=W(e,o);H[t]=l,H[(t+1)%4]=n,H[(t+2)%4]=e,H[(t+3)%4]=a,$(H.some((t=>t?.isLoaded||t===e)));const g=H.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);H.forEach(((e,t)=>{e&&e?.level>g&&(H[t]=null)})),$(H.some((t=>t?.isLoaded||t===e)));const d=r.cornerNeighborCornerTiles,h=r.cornerNeighborCornerTileSamplerVersions;for(let e=0;e<4;++e){const r=H[e],i=r?.renderData.geometryState.samplerDataVersion??-1,s=4*t+e,o=d[s]!==r,a=!o&&h[s]!==i;(o||a)&&(d[s]=r,h[s]=i,this._markCornerDirty(t))}E&&$(ee.some((r=>d[4*t+r]?.isLoaded||d[4*t+r]===e)))}E&&$(this.geometryState.edgeResolutions.every((e=>e>0)));for(let t=0;t<4;++t)H[t]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;E&&$(!this.tile.intersectsClippingArea||this.geometryState.edgeResolutions.every((e=>e>0))),this.intersectionData=null;const{tile:t,_vao:r,geometry:i,geometryState:s}=this,o=!r||!{geometry:i}||this.wireframeChanged||this.samplerDataChanged||this.clippingAreaChanged||this.numVerticesPerSideChanged,a=0!==this.dirtyEdgeResolutions,n=s.edgeResolutions.reduce(((e,t)=>e+t+1),0),l=o||a&&n>(i?.maxEdgeVertexCount??0),g=!l&&a,d=!g&&(0!==this.dirtyEdges||a),h=!d&&0!==this.dirtyCorners;l?(this.releaseGeometry(),this._createGeometry(e)):g?t.updateEdgeElevationsAndResolutions():d||h?t.updateEdgeElevations():h?t.updateCornerElevations():console.warn("Update for no reason?"),this._modifiedFlags=0}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,!!this._vao&&(this._vao=r(this._vao),this.geometry.release(),!0)}ensureTexture(e,t,r){const i=t?F.RGBA:F.RGB;return null==this._texture||this._texture.descriptor.width===e&&this._texture.descriptor.pixelFormat===i||this.releaseTexture(),null==this._texture&&(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){null!=this._texture&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}get numVerticesPerSideChanged(){return 0!=(this._modifiedFlags&q)}get samplerDataChanged(){return 0!=(this._modifiedFlags&z)}get clippingAreaChanged(){return 0!=(this._modifiedFlags&J)}get wireframeChanged(){return 0!=(this._modifiedFlags&K)}get dirtyEdges(){return this._modifiedFlags>>Q&15}get dirtyCorners(){return this._modifiedFlags>>Y&15}get dirtyEdgeResolutions(){return this._modifiedFlags>>Z&15}_markCornerDirty(e){const t=1<<e<<Y;this._modifiedFlags|=t}_markEdgeDirty(e){const t=1<<e<<Q;this._modifiedFlags|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){const t=1<<e<<Z;this._modifiedFlags|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._modifiedFlags|=15<<Y|15<<Q|15<<Z}updateGeometryState(){const t=this._getElevationInfo(),r=this.tile,i=t.samplerData?r.getElevationVerticesPerSide(t.maxTileLevel):r.getDefaultVerticesPerSide(),s=Math.max(i,5);let o=r.clippingArea;r.intersectsClippingArea&&!r.isWithinClippingArea||(o=null);const a=this.geometryState;let n=!1;a.numVerticesPerSide!==s&&(this._modifiedFlags|=1,a.numVerticesPerSide=s,a.samplerDataVersion++,n=!0),t.changed&&(this._modifiedFlags|=2,a.samplerData=t.samplerData,a.samplerDataVersion++,n=!0),e(a.clippingArea,o)||(this._modifiedFlags=4,a.clippingArea=o,n=!0);const l=r.surface.wireframe;return a.wireframe!==l&&(this._modifiedFlags=8,a.wireframe=l,n=!0),this._geometryStateChangedSinceLastUpdate||=n,n&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();const t=this.geometry.vertexAttributes,r=this.geometry.indices,i=e.gl;this._vao=new L(e,N,{geometry:f(t.layout)},{geometry:P.createVertex(e,i.STATIC_DRAW,t.buffer)},P.createIndex(e,i.STATIC_DRAW,r)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=A.Immediate){null!=e&&e.texture!==this._texture&&this.releaseTexture(),this._textureRef.push(e,t)}get textureReference(){return this._textureRef.current}get nextTextureReference(){return this._textureRef.next}get textureFadeFactor(){return this._textureRef.fadeFactor}get textureIsFading(){return this._textureRef.isFading}_getElevationInfo(){const e=this.geometryState.samplerData,t=this.tile.layerInfo[_.ELEVATION],r=t.length,i=new Array(r);let s=0,o=0,a=!1;for(let g=0;g<r;g++){const r=t[g];if(null!=r.upsampleInfo){const t=r.upsampleInfo.tile,n=t.layerInfo[_.ELEVATION][g].data,l=n&&n.samplerData;e&&e[s]===l||(a=!0),i[s++]=l,o=Math.max(o,t.lij[0])}else if(r.data){const t=this.tile.surface.layerViewByIndex(g,_.ELEVATION);if(w(this.tile,t.layer,!1)){const t=r.data;e&&e[s]===t.samplerData||(a=!0),i[s++]=t.samplerData,o=this.tile.level}}}null!=e&&e.length!==s&&(a=!0);const n=s>0,l=n?i:null;return n&&(i.length=s),{changed:a,samplerData:l,maxTileLevel:o}}get estimatedGeometryMemoryUsage(){const e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){return{hasTexture:null!=this._texture}}checkGeometryWaterproofness(){if(!E)return;const e=this.tile;if(!e.isLoaded||!e.intersectsClippingArea||0===e.level)return void $(e?.isLoaded);const r=e.surface.extent;if(null!=r&&!e.intersectsExtent(r))return;const f=S.map(((t,i)=>null!=r&&(i<2?-1:1)*(e.extent[3-i]-r[3-i])<0)),p=e.level;$(0===this.dirtyCorners),$(0===this.dirtyEdges),$(0===this.dirtyEdgeResolutions),$(!this.numVerticesPerSideChanged),$(!this.samplerDataChanged),$(!this.clippingAreaChanged),$(!this.wireframeChanged);const _=D.map((t=>e.findNeighborCornerTileExact(t,(t=>!t.intersectsClippingArea||t.isLoaded||t.level===e.level))??null)).map((e=>e?.intersectsClippingArea?e:null)),x=this.geometryState;for(let t=0;t<4;++t){const r=x.cornerPeerNeighbors[t],i=_[t];$(i===r,`Tile[${e.lij}].corner[${t}] out of date: cur=[${r?.lij}] exp=[${i?.lij}]`)}S.forEach(((r,_)=>{if(f[_])return;const x=e.findNeighborTile(r,(e=>(e.level===p||e?.isLoaded)&&e?.intersectsClippingArea));if(!x){const t=!e.surface.updatingRootTiles&&null!=e.surface.rootTiles&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(r);return void $(!t)}$(x.isLoaded||x.level===e.level),$(x===this.geometryState.edgePeerNeighbors[_]);const v=p-x.level;if(!x.isLoaded)return $(!x.isLeaf),void $(0===v);const E=x.renderData;$(V(e,x,r)),$(v>=0);const S=2**v;if(v<0)return void $(!1);const C=e.renderData,D=C.geometry,j=C.localOrigin,A=D.getEdgeCount(_),R=D.numVerticesPerSide-1,w=E.geometry;if(!w)return void $(!1);const L=E.localOrigin,N=this.geometryState.edgePeerNeighbors[_];if(N?.isLoaded){const e=N.renderData;$(C.geometryState.edgePeerNeighborSamplerVersions[_]===e.geometryState.samplerDataVersion),$(this.geometryState.edgePeerNeighborSamplerVersions[_]===e.geometryState.samplerDataVersion)}const P=(_+2)%4,F=w.getEdgeCount(P),G=A-1,H=F-1;$(G*S===H,`Tile[${e.lij}]:e${_},res=${G} edgeRes mismatch with Neighbor[${x.lij}]:e${P},res=${H} (expected:${G*S})`);const W=e.extent,q=r===y.NORTH||r===y.SOUTH,z=F-1,J=z>>v,K=A-1;if(J<1)return void $(1===K);$(J===K),$(t(J));const Q=w.numVerticesPerSide-1;$(v>0||J===Math.max(Q,R));const Y=e.getNeighborEdgeStartVertexIndex(_,x);$(0<=Y&&Y<S);const Z=Y*J;$(0<=Z&&Z<=z-J);let ee=0,te=Z;D.getEdgeVertexPosition(_,O,j,0),D.getEdgeVertexPosition(_,I,j,A-1);const re=i(O,I),ie=Math.max(B,1e-4*re);for(let t=0;t<=J;++t){D.getEdgeVertexPosition(_,O,j,ee),w.getEdgeVertexPosition(P,I,L,te);const i=t/J,f=q?W[0]+i*(W[2]-W[0]):r===y.WEST?W[0]:W[2],p=q?r===y.SOUTH?W[1]:W[3]:W[1]+i*(W[3]-W[1]),v=e.surface.extent;if(null==v||u(v,f,p)){const t=s(O,I),r=o(O)-c.radius,i=o(I)-c.radius,u=t<ie;if(!u){console.warn(`Tile edge vertex position mismatch: between [${e.lij}].edge${_}[${ee}/${A}] and [${x.lij}].edge${P}[${te}/${F}]`),null!=v&&console.warn(" surface extent= ",v," x,y=",f,",",p);const s=h();a(s,C.localOrigin,E.localOrigin),o(s)>0&&console.warn(` localOrigins: ${C.localOrigin} vs ${E.localOrigin} d=${o(s)} [${s}]`);(()=>{const t=m(O),r=m(I);e.updateEdgeElevations(),x.updateEdgeElevations(),D.getEdgeVertexPosition(_,O,j,ee),w.getEdgeVertexPosition(P,I,L,te);const i=h();g(i,O,t),o(i)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${t} vs ${O} d=${o(i)} [${i}]`),g(i,I,r),o(i)>0&&console.warn(` XXX Neighbor[${x.lij}] edge out of date: ${r} vs ${I} d=${o(i)} [${i}]`)})();const n=D.getEdgeCount(_),l=w.getEdgeCount(F);$(u,`Mismatch in tile [${e.lij}].edge[${_}][${ee}/${n}] vs neighbor [${x.lij}].edge[${P}][${te}/${l}] ${T(O)} vs ${T(I)} dist=${t} h(t|n|d)=${r}|${i}|${i-r}`)}D.getEdgeNormal(_,M,ee),w.getEdgeNormal(P,U,te),n(k,M),n(X,U);const y=l(k,X),S=1-y<.01||!1||e===x;if(!S){const t=h();g(t,M,U);const r=()=>`Mismatch in tile edge normal ${b(e.lij)} (${ee}/${A-1}) edge ${_} vs neighbor ${b(x.lij)} (${te}/${F-1}) nedge ${P} :${T(M)} vs ${T(U)} dot = ${y} : ${T(t)}`;console.warn("Mismatch in tile edge normal: ",r());{e.updateEdgeElevations(),x.updateEdgeElevations();const t=h(),r=h();D.getEdgeNormal(_,t,ee),w.getEdgeNormal(P,r,te),d(M,t)||console.warn("Missing update in tile normal: ",T(M)," => ",T(t)),d(U,r)||console.warn("Missing update in neighbor normal: ",T(U)," => ",T(r))}$(S,r())}}ee+=1,te+=1}}))}}const O=h(),I=h(),M=h(),U=h(),k=h(),X=h(),B=1,H=[null,null,null,null];function W(e,t){return t?.isLoaded||t===e?t:null}const q=1,z=2,J=4,K=8,Q=4,Y=8,Z=12,ee=[0,1,2,3];export{A as ActivationTime,G as PatchRenderData,W as neighborTileIfLoadedOrSelf,ee as zeroToFour};
|
|
@@ -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 t}from"../../../core/mathUtils.js";import{n as e,s as i,g as s,h as o,
|
|
5
|
+
import{lerp as t}from"../../../core/mathUtils.js";import{n as e,s as i,g as s,h as o,D as n,b as r,k as l,o as a,z as h}from"../../../chunks/vec32.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as c}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as p,numPlanes as f,PlaneIndex as m}from"../../../geometry/support/frustum.js";import{d as g,g as x}from"../../../chunks/sphere.js";import{PatchType as $}from"./interfaces.js";import{TileFrustumVisibility as _}from"./ITile.js";import{createSphericalGlobePatch as v,updateCornerSpherical as M,updateEdgesAndCornersSpherical as S,updateEdgeElevationsAndResolutionsSpherical as b}from"./PatchGeometryFactory.js";import{enableTerrainInternalChecks as j,internalAssert as T,almostEquals as E}from"./terrainUtils.js";import{Tile as I,CenterPosition as B}from"./Tile.js";import{compareTilesByLij as D}from"./tileUtils.js";class H extends I{constructor(t,e,i,s,o){super(),this._convexHull=new Array(24),this._boundingSphere=g(),this._baseUsedMemory=1816,this.init(t,e,i,s,o)}init(i,s,o,n,r){super.init(i,s,o,n,r);const l=this.ellipsoid.radius,a=this.extentInRadians[0],h=this.extentInRadians[1],u=this.extentInRadians[2],c=this.extentInRadians[3],p=t(h,c,.5),f=t(a,u,.5),m=0===i?0:Math.min(Math.abs(h),Math.abs(c));this._edgeLen=(u-a)*Math.cos(m)*l,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=l-Math.sqrt(l*l-this._edgeLen2/4),d(this.centerAtSeaLevel,f,p,this.ellipsoid.radius),e(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const t=this._center;if(0===this.lij[0])i(x(t[B.MIDDLE]),0,0,0),i(t[B.TOP],0,0,0),i(t[B.BOTTOM],0,0,0),t[B.MIDDLE][3]=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();const e=t[B.MIDDLE],i=this.convexHull;let s=0;for(let t=0;t<8;++t)s=Math.max(s,y(x(e),i,3*t));t[B.MIDDLE][3]=Math.sqrt(s)}}_calculateFrustumVisibilityStatus(t){if(!p(t,this._boundingSphere))return _.OUTSIDE;if(this.lij[0]<10)return _.INTERSECTS;const e=this.convexHull,i=this.surface.view.state.camera.near;let s=!0;for(let o=0;o<f;o++){const n=o===m.NEAR,r=t[o],l=r[0],a=r[1],h=r[2],u=r[3]-(n?i:0);let d=!1;for(let t=0;t<8;++t){const i=3*t;if(l*e[i]+a*e[i+1]+h*e[i+2]+u<0){if(d=!0,!s)break}else s=!1}if(!d)return _.OUTSIDE}return s?_.INSIDE:_.INTERSECTS}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){v(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),j&&this._checkBVs()}_updateBoundingSphere(){const t=this._boundingSphere,e=x(t),r=this.elevationBoundsMin,l=this.elevationBoundsMax,a=this.ellipsoid.radius,h=l;if(0===this.level)i(e,0,0,0),t[3]=a+h;else{const i=this.extentInRadians,h=.5*(i[0]+i[2]),u=i[1],d=i[3];O(A,h,u,a),O(V,h,d,a),s(e,A,V);o(e,e,(a+.5*(r+l))/n(e));const c=this.convexHull;let p=0;const f=(t,e)=>{const i=t[0]-c[3*e],s=t[1]-c[3*e+1],o=t[2]-c[3*e+2];return Math.sqrt(i*i+s*s+o*o)};for(let t=0;t<8;++t){const i=f(e,t);p=Math.max(p,i)}const m=p;t[3]=m+2}}_updateConvexHull(){const t=this.extentInRadians,i=this.ellipsoid.radius;if(0===this.level)return;const a=this.elevationBoundsMin,d=this.elevationBoundsMax,c=this._getPatchType(),p=this.surface.isWebMercator,f=p&&c===$.HAS_NORTH_POLE,m=p&&c===$.HAS_SOUTH_POLE,g=m||f,x=Math.PI/2,_=t[0],v=t[2],M=m?-x:t[1],S=f?x:t[3],b=.5*(_+v),j=a,I=i+(g?Math.min(0,j-1):j),B=(t,e,i)=>O(t,e,i,I),D=u(),H=u(),L=u(),y=u();B(D,_,M),B(H,_,S),B(L,v,S),B(y,v,M);const R=(t,e)=>{for(let i=0;i<3;++i)this._convexHull[3*e+i]=t[i]};R(D,0),R(H,1),R(L,2),R(y,3);const A=d,V=i+(g?Math.max(0,A+1):A),C=u(),N=u(),U=u();O(N,b,S,I),O(U,b,M,I),s(C,N,U),e(C,C);const k=u(),F=u(),w=(t,i)=>{h(F,t,i),e(F,F);const n=-l(t,k)/l(F,k);T(n>=0),o(F,F,n),s(t,t,F)};if(2**this.lij[0]>2*this.lij[1]){const t=U,i=u();r(i,P,t),e(i,i),r(k,t,i),e(k,k),T(E(l(k,t)/n(t),0)),w(D,H),w(y,L),R(D,0),R(y,3)}else if(2**this.lij[0]!==2*this.lij[1]){const t=N,i=u();r(i,P,t),e(i,i),r(k,i,t),e(k,k),w(H,D),w(L,y),R(H,1),R(L,2)}const q=(t,e)=>{const i=V/l(e,C);for(let s=0;s<3;++s)this._convexHull[3*t+s]=e[s]*i};q(4,D),q(5,H),q(6,L),q(7,y)}_getPatchType(){const t=this.lij[1],e=0===t,i=t===(1<<this.level)-1;return e?i?$.HAS_BOTH_POLES:$.HAS_NORTH_POLE:i?$.HAS_SOUTH_POLE:$.REGULAR}intersectsRay(t,e,i,s){const o=this._boundingSphere,n=o[3]+i,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],l=o[0]-t[0],a=o[1]-t[1],h=o[2]-t[2],u=(l*e[0]+a*e[1]+h*e[2])/r,d=e[0]*u-l,c=e[1]*u-a,p=e[2]*u-h;return d*d+c*c+p*p<n*n}getDefaultVerticesPerSide(){return this.level<L.length?L[this.level]+1:2}updateCornerElevations(){M(this.renderData),this._updateBoundingVolumes()}updateEdgeElevations(){S(this.renderData),this._updateBoundingVolumes()}updateEdgeElevationsAndResolutions(){b(this.renderData),this._updateBoundingVolumes()}_checkBVs(){if(!j)return;if(this.level<=2)return;const t=this._boundingSphere,i=t[3],o=x(t),d=u(),p=this.ellipsoid.radius,f=this.elevationBoundsMin,m=this.elevationBoundsMax,g=p+f,$=1,_=0,v=this._center[B.MIDDLE][3],M=this.convexHull,S=(t,e)=>{for(let i=0;i<3;++i)t[i]=M[3*e+i]};{const t=u(),i=u(),s=u(),o=u(),n=u(),a=(a,u,d,c)=>{S(i,a),S(s,u),S(o,d),h(i,i,s),h(o,o,s),r(t,i,o),e(t,t);const p=l(t,s);S(n,c);const f=l(t,n),m=Math.abs(f-p);T(E(m,0),`Non coplanar ${a},${u},${d},${c} diff = ${m}`)};a(0,1,2,3),a(4,5,6,7),a(0,1,4,5),a(1,2,5,6),a(2,3,6,7),a(3,0,7,4)}const b=c(24),I=(t,e,i)=>{const s=4*t;for(let o=0;o<3;++o)b[s+o]=e[o];b[s+3]=i},H=u(),L=u(),y=u(),P=u(),A=(t,i,s,o)=>{S(H,i),S(L,s),S(y,o),h(H,H,L),e(H,H),h(y,y,L),e(y,y),r(P,H,y),e(P,P);const n=l(P,L);I(t,P,n)};A(0,0,1,2),A(1,1,0,4),A(2,1,5,2),A(3,3,2,6),A(4,4,0,3),A(5,4,6,5);const V=1,C=(t,e,i,s)=>{const o=4*t;return b[o]*e+b[o+1]*i+b[o+2]*s-b[o+3]},N=(t,e,i,s)=>C(t,e,i,s)>=-V,U=(t,e)=>N(t,e[0],e[1],e[2]),k=2**this.lij[0]>2*this.lij[1],F=(t,e,s)=>Math.sqrt(R(t,e,s,o[0],o[1],o[2]))<i,w=t=>F(t[0],t[1],t[2]),q=(t,e)=>F(t[e],t[e+1],t[e+2]),G=this.extentInRadians,z=.5*(G[0]+G[2]),W=G[1],J=G[3],K=u(),Q=u();O(K,z,J,g),O(Q,z,W,g);const X=k?"Upper":"Lower";let Y=!0;for(let e=0;e<6;++e){for(let t=0;t<8;++t){const i=3*t,s=N(e,M[i],M[i+1],M[i+2]);Y&&=s,T(s,`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}T(U(e,Q),`Tile[${this.lij}] (${X}) bottom mid outside of plane ${e}`),T(U(e,K),`Tile[${this.lij}] (${X}) top mid outside of plane ${e}`)}T(Y,"Not all convex hull points are inside convex hull polyhedron"),T(w(Q),`Tile[${this.lij}] (${X}) bottom mid outside of bounding sphere`),T(w(K),`Tile[${this.lij}] (${X}) top mid outside of bounding sphere`);for(let e=0;e<8;++e){const t=q(M,3*e);T(t,`Tile[${this.lij}] Convex hull point ${e} outside of bounding sphere`)}for(let e=0;e<6;++e)for(let t=0;t<8;++t){const i=3*t;N(e,M[i],M[i+1],M[i+2])||console.error(`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}const{extentInRadians:Z}=this,tt=Math.max(Z[2]-Z[0],Z[3]-Z[1]),et=Math.round(tt*p),{renderData:it}=this;if(!it)return;const{geometry:st,geometryState:ot,localOrigin:nt}=it,rt=st.vertexAttributes?.position;if(!rt)return;const lt=u(),at=st.numVerticesPerSide-2,{indices:ht,indexCount:ut,edgeVerticesStartIndex:dt,poleVerticesStartIndex:ct}=st;if(!ht)return;const pt=new Set;for(let e=0;e<ut;++e){const t=ht[e];if(pt.has(t))continue;pt.add(t);const r=t<ct,l=t>=dt;let h=!1,u=-1;if(l){let e=dt;for(let i=0;i<4;++i){const s=ot.edgeResolutions[i];if(t===e||t===e+s-1){h=!0;break}if(e+=s,t<e){u=i;break}}}const c=l?ot.edgePeerNeighbors[u]:null,g=l&&c&&D(this,c)>0;rt.getVec(t,d),s(lt,d,nt);const x=n(lt)-p;let M=0,S=!1;const b=f-x,j=x-m,T=b>$,E=j>$,I=T||E,B=()=>{const e=r?"internal":l&&!h?"edge":h?"corner":"pole";return`Tile[${this.lij}].vertex[${t}]:${e}`+(T?"(below)":E?"(above)":"")+(g?"(Neighbor)":"")},H=a(lt,o);if(H>=i+_){const t=H-i;I||(console.error(`${B()} is out of the bounding sphere by ${t.toFixed(0)} / ${i.toFixed(0)}[tol=${_}] h=${x.toFixed(0)} / [${f.toFixed(0)}..${m.toFixed(0)}] (${(t/i).toFixed(0)})`),S=!0)}for(let e=0;e<6;++e)if(!N(e,lt[0],lt[1],lt[2])){const s=C(e,lt[0],lt[1],lt[2]),o=t%at,n=(t-o)/at;0===e&&b||5===e&&j||(console.error(`${B()} (${o},${n})|${at}] is out of the bounding trapezoid plane ${e} h=${Math.round(x)} / [${Math.round(f)}..${Math.round(m)}] dist=${Math.round(s)} radii = ${Math.round(i)}/${Math.round(v)}} : maxL = ${et}`),++M)}if(S||M>0)break}}get convexHull(){return this._convexHull}}const L=[128,64,64,32,16,8,8,4];function y(t,e,i){return R(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function R(t,e,i,s,o,n){const r=s-t,l=o-e,a=n-i;return r*r+l*l+a*a}const O=(t,e,i,s)=>{const o=Math.cos(e),n=Math.sin(e),r=Math.cos(i),l=Math.sin(i);t[0]=s*r*o,t[1]=s*r*n,t[2]=s*l},P=[0,0,1],A=u(),V=u();export{H as SphericalPatch};
|
|
@@ -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 t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as h}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as c,s as d,j as u}from"../../../chunks/vec32.js";import{ZEROS as p,fromValues as _,create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as C}from"./LayerClass.js";import{OverlayContent as R}from"./OverlayContent.js";import{overlayRenderOccludedFlag as x}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as v}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as w}from"./TileRenderer.js";import{TileUpdate as q}from"./TileUpdate.js";import{IteratorPreorder as E,sortTiles as A,compareTiles as N}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as j,ComponentIntersectionData as B}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as I}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as F}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as U,ConsumesDepth as G,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as M}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as V}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as W,StoreResults as Y}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{RenderSlot as X}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as K}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Z}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as J,getVerticalOffsetTerrain as $}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ee}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as te,intersectTriangles as ie}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as re}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as se}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ne}from"../../webgl/enums.js";const ae=7,oe=10,le=g();var he;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(he||(he={}));let ce=class extends U{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=W.TERRAIN,this.isGround=!0,this._tileSize=256,this._techniqueConfiguration=new se,this._passParameters=new L,this._drawParameters=new ee,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new E,this._transparencyState=he.Opaque,this._castShadows=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=Q.Occlude,this.produces=new Map([[X.OPAQUE_TERRAIN,()=>this._produces()],[X.TRANSPARENT_TERRAIN,()=>this._produces()],[X.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new D(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?x:Q.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?G:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===he.TransparentWithDraped||e===he.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return J}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,q.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===q.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[C.ELEVATION])i.pendingUpdates&=~q.GEOMETRY;e.resetPendingUpdate(q.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=oe-ae,i=Math.max(0,Math.floor((e.level-t)/ae)*ae);if(this._isGlobal&&0===i)return p;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=z.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=z.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=z.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new w(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==he.Opaque)return;const s=de,n=ue;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,p=e.options.store===Y.MIN,_=!!e.results.ground.target,f=$(e.verticalOffset),m=e.tolerance;let g,T=p&&null!=a.dist?a.dist:1/0;const O=d=>{const _=d.renderData;if(!_?.vao)return;const O=_.geometry;b(le,O.boundingBox);const C=_.localOrigin;null!=f&&(f.localOrigin=C,f.applyToAabb(le));const R=le;if(pe[0]=i[0]-C[0],pe[1]=i[1]-C[1],pe[2]=i[2]-C[2],!te(R,pe,n,m,T))return;const x=(e,t,i)=>{e.set(this.type,d,t,i,h),T=p&&null!=a.dist?a.dist:1/0},P=(n,h)=>{if(null!=h&&n>=0&&(e.options.backfacesTerrain||u(h,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&x(l,n,h),e.options.isFiltered)return;e.options.store===Y.ALL&&(null==g?(g=V(e.ray),x(g,n,h),e.results.all.push(g)):n<g.dist&&x(g,n,h)),(null==a.dist||n<a.dist)&&x(a,n,h),e.options.store!==Y.MIN&&(null==o.dist||n>o.dist)&&x(o,n,h)}},v=_e;c(v,r,C);const{indices:D,indexCount:S}=O,w=O.vertexAttributes,q=w.getField(Z.POSITION,y),E=new M(q.typedBuffer,3,w.stride/4),A=S/3;if(!f&&A>j){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new B(D,0,A,E)),e.intersectionData.intersectRay(pe,v,P)}else ie(pe,v,0,A,D,E,null,f,P)},C=this._rootTiles;if(null!=C){(()=>{const t=this._tileIterator;t.reset(C);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(i,s,m,T)||_&&this._useStencilForTile(e)?t.skipSubtree():O(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;if(t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0),e.bindParameters.slot===X.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&x))return null}else{const t=this.transparency===he.Opaque?X.OPAQUE_TERRAIN:X.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===he.Empty)return null;switch(e.output){case I.Color:return this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(I.Color,e.bindParameters.slot===X.OCCLUDED_TERRAIN);case I.Shadow:case I.ShadowExcludeHighlight:return this._castShadows?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Shadow,!1)):null;case I.LinearDepth:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.LinearDepth,!1);case I.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Normal,!1);case I.ObjectAndLayerIdColor:return this._updateTechnique(I.ObjectAndLayerIdColor,!1);case I.Highlight:return this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case I.Color:{const i=e.bindParameters.slot===X.OCCLUDED_TERRAIN?R.Occluded:R.Color;this._renderMaterialPass(e,t,i);break}case I.LinearDepth:case I.Normal:this._renderAuxiliaryPass(e,t,R.Color,this._visiblePatchesByOrigin);break;case I.Highlight:this._renderAuxiliaryPass(e,t,R.Highlight,this._visiblePatchesByOrigin);break;case I.Shadow:case I.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case I.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,R.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,O.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?F.GridComposite:null!=i.backgroundColor?F.ColorComposite:F.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==v.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)A(this.renderOrder,i,t);e.sort(((e,t)=>N(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(this._drawParameters,e.bindParameters,this._passParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],ne.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=K(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===R.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",p),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:p;this._techniqueConfiguration.tileBlendInput===F.ColorComposite&&n.setUniform3fv("backgroundColor",l);const h=this.wireframe?ne.LINES:ne.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const r=d[0].renderData.localOrigin;t.program.bindDraw(new ee(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of d){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,h,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const h=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const c=a.geometry.indexCount;e.rctx.bindVAO(o),h.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,c,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(re,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([o({readOnly:!0})],ce.prototype,"_isGlobal",null),e([o()],ce.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],ce.prototype,"renderingDisabled",null),e([o({value:!0})],ce.prototype,"visible",null),e([o()],ce.prototype,"renderPatchBorders",null),e([o()],ce.prototype,"visualizeNormals",null),e([o()],ce.prototype,"cullBackFaces",null),e([o({value:v.FRONT_TO_BACK})],ce.prototype,"renderOrder",null),e([o()],ce.prototype,"wireframe",null),ce=e([l("esri.views.3d.terrain.TerrainRenderer")],ce);const de=f(),ue=f(),pe=f(),_e=f();export{ce as TerrainRenderer,he as TransparencyMode};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as h}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as c,s as d,k as u}from"../../../chunks/vec32.js";import{ZEROS as p,fromValues as _,create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as C}from"./LayerClass.js";import{OverlayContent as R}from"./OverlayContent.js";import{overlayRenderOccludedFlag as x}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as v}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as w}from"./TileRenderer.js";import{TileUpdate as q}from"./TileUpdate.js";import{IteratorPreorder as E,sortTiles as A,compareTiles as N}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as j,ComponentIntersectionData as B}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as I}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as F}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as U,ConsumesDepth as G,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as M}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as V}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as W,StoreResults as Y}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{RenderSlot as X}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as K}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Z}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as J,getVerticalOffsetTerrain as $}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ee}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as te,intersectTriangles as ie}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as re}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as se}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ne}from"../../webgl/enums.js";const ae=7,oe=10,le=g();var he;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(he||(he={}));let ce=class extends U{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=W.TERRAIN,this.isGround=!0,this._tileSize=256,this._techniqueConfiguration=new se,this._passParameters=new L,this._drawParameters=new ee,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new E,this._transparencyState=he.Opaque,this._castShadows=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=Q.Occlude,this.produces=new Map([[X.OPAQUE_TERRAIN,()=>this._produces()],[X.TRANSPARENT_TERRAIN,()=>this._produces()],[X.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new D(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?x:Q.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?G:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===he.TransparentWithDraped||e===he.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return J}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,q.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===q.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[C.ELEVATION])i.pendingUpdates&=~q.GEOMETRY;e.resetPendingUpdate(q.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=oe-ae,i=Math.max(0,Math.floor((e.level-t)/ae)*ae);if(this._isGlobal&&0===i)return p;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=z.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=z.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=z.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new w(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==he.Opaque)return;const s=de,n=ue;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,p=e.options.store===Y.MIN,_=!!e.results.ground.target,f=$(e.verticalOffset),m=e.tolerance;let g,T=p&&null!=a.dist?a.dist:1/0;const O=d=>{const _=d.renderData;if(!_?.vao)return;const O=_.geometry;b(le,O.boundingBox);const C=_.localOrigin;null!=f&&(f.localOrigin=C,f.applyToAabb(le));const R=le;if(pe[0]=i[0]-C[0],pe[1]=i[1]-C[1],pe[2]=i[2]-C[2],!te(R,pe,n,m,T))return;const x=(e,t,i)=>{e.set(this.type,d,t,i,h),T=p&&null!=a.dist?a.dist:1/0},P=(n,h)=>{if(null!=h&&n>=0&&(e.options.backfacesTerrain||u(h,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&x(l,n,h),e.options.isFiltered)return;e.options.store===Y.ALL&&(null==g?(g=V(e.ray),x(g,n,h),e.results.all.push(g)):n<g.dist&&x(g,n,h)),(null==a.dist||n<a.dist)&&x(a,n,h),e.options.store!==Y.MIN&&(null==o.dist||n>o.dist)&&x(o,n,h)}},v=_e;c(v,r,C);const{indices:D,indexCount:S}=O,w=O.vertexAttributes,q=w.getField(Z.POSITION,y),E=new M(q.typedBuffer,3,w.stride/4),A=S/3;if(!f&&A>j){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new B(D,0,A,E)),e.intersectionData.intersectRay(pe,v,P)}else ie(pe,v,0,A,D,E,null,f,P)},C=this._rootTiles;if(null!=C){(()=>{const t=this._tileIterator;t.reset(C);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(i,s,m,T)||_&&this._useStencilForTile(e)?t.skipSubtree():O(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;if(t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0),e.bindParameters.slot===X.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&x))return null}else{const t=this.transparency===he.Opaque?X.OPAQUE_TERRAIN:X.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===he.Empty)return null;switch(e.output){case I.Color:return this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(I.Color,e.bindParameters.slot===X.OCCLUDED_TERRAIN);case I.Shadow:case I.ShadowExcludeHighlight:return this._castShadows?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Shadow,!1)):null;case I.LinearDepth:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.LinearDepth,!1);case I.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Normal,!1);case I.ObjectAndLayerIdColor:return this._updateTechnique(I.ObjectAndLayerIdColor,!1);case I.Highlight:return this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case I.Color:{const i=e.bindParameters.slot===X.OCCLUDED_TERRAIN?R.Occluded:R.Color;this._renderMaterialPass(e,t,i);break}case I.LinearDepth:case I.Normal:this._renderAuxiliaryPass(e,t,R.Color,this._visiblePatchesByOrigin);break;case I.Highlight:this._renderAuxiliaryPass(e,t,R.Highlight,this._visiblePatchesByOrigin);break;case I.Shadow:case I.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case I.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,R.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,O.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?F.GridComposite:null!=i.backgroundColor?F.ColorComposite:F.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==v.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)A(this.renderOrder,i,t);e.sort(((e,t)=>N(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(this._drawParameters,e.bindParameters,this._passParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],ne.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=K(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===R.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",p),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:p;this._techniqueConfiguration.tileBlendInput===F.ColorComposite&&n.setUniform3fv("backgroundColor",l);const h=this.wireframe?ne.LINES:ne.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const r=d[0].renderData.localOrigin;t.program.bindDraw(new ee(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of d){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,h,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const h=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const c=a.geometry.indexCount;e.rctx.bindVAO(o),h.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,c,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(re,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([o({readOnly:!0})],ce.prototype,"_isGlobal",null),e([o()],ce.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],ce.prototype,"renderingDisabled",null),e([o({value:!0})],ce.prototype,"visible",null),e([o()],ce.prototype,"renderPatchBorders",null),e([o()],ce.prototype,"visualizeNormals",null),e([o()],ce.prototype,"cullBackFaces",null),e([o({value:v.FRONT_TO_BACK})],ce.prototype,"renderOrder",null),e([o()],ce.prototype,"wireframe",null),ce=e([l("esri.views.3d.terrain.TerrainRenderer")],ce);const de=f(),ue=f(),pe=f(),_e=f();export{ce as TerrainRenderer,he as TransparencyMode};
|